jaxp/src/share/classes/org/xml/sax/helpers/LocatorImpl.java
author kvn
Fri, 20 Jun 2008 11:10:05 -0700
changeset 762 1b26adb5fea1
parent 6 7f561c08de6b
permissions -rw-r--r--
6715633: when matching a memory node the adr_type should not change Summary: verify the adr_type of a mach node was not changed Reviewed-by: rasbold, never
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6
7f561c08de6b Initial load
duke
parents:
diff changeset
     1
/*
7f561c08de6b Initial load
duke
parents:
diff changeset
     2
 * Copyright 2000-2005 Sun Microsystems, Inc.  All Rights Reserved.
7f561c08de6b Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7f561c08de6b Initial load
duke
parents:
diff changeset
     4
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
7f561c08de6b Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
7f561c08de6b Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Sun designates this
7f561c08de6b Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
7f561c08de6b Initial load
duke
parents:
diff changeset
     9
 * by Sun in the LICENSE file that accompanied this code.
7f561c08de6b Initial load
duke
parents:
diff changeset
    10
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
7f561c08de6b Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
7f561c08de6b Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
7f561c08de6b Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
7f561c08de6b Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
7f561c08de6b Initial load
duke
parents:
diff changeset
    16
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
7f561c08de6b Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
7f561c08de6b Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
7f561c08de6b Initial load
duke
parents:
diff changeset
    20
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    21
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
7f561c08de6b Initial load
duke
parents:
diff changeset
    22
 * CA 95054 USA or visit www.sun.com if you need additional information or
7f561c08de6b Initial load
duke
parents:
diff changeset
    23
 * have any questions.
7f561c08de6b Initial load
duke
parents:
diff changeset
    24
 */
7f561c08de6b Initial load
duke
parents:
diff changeset
    25
7f561c08de6b Initial load
duke
parents:
diff changeset
    26
// SAX default implementation for Locator.
7f561c08de6b Initial load
duke
parents:
diff changeset
    27
// http://www.saxproject.org
7f561c08de6b Initial load
duke
parents:
diff changeset
    28
// No warranty; no copyright -- use this as you will.
7f561c08de6b Initial load
duke
parents:
diff changeset
    29
// $Id: LocatorImpl.java,v 1.2 2004/11/03 22:53:09 jsuttor Exp $
7f561c08de6b Initial load
duke
parents:
diff changeset
    30
7f561c08de6b Initial load
duke
parents:
diff changeset
    31
package org.xml.sax.helpers;
7f561c08de6b Initial load
duke
parents:
diff changeset
    32
7f561c08de6b Initial load
duke
parents:
diff changeset
    33
import org.xml.sax.Locator;
7f561c08de6b Initial load
duke
parents:
diff changeset
    34
7f561c08de6b Initial load
duke
parents:
diff changeset
    35
7f561c08de6b Initial load
duke
parents:
diff changeset
    36
/**
7f561c08de6b Initial load
duke
parents:
diff changeset
    37
 * Provide an optional convenience implementation of Locator.
7f561c08de6b Initial load
duke
parents:
diff changeset
    38
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    39
 * <blockquote>
7f561c08de6b Initial load
duke
parents:
diff changeset
    40
 * <em>This module, both source code and documentation, is in the
7f561c08de6b Initial load
duke
parents:
diff changeset
    41
 * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
7f561c08de6b Initial load
duke
parents:
diff changeset
    42
 * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
7f561c08de6b Initial load
duke
parents:
diff changeset
    43
 * for further information.
7f561c08de6b Initial load
duke
parents:
diff changeset
    44
 * </blockquote>
7f561c08de6b Initial load
duke
parents:
diff changeset
    45
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    46
 * <p>This class is available mainly for application writers, who
7f561c08de6b Initial load
duke
parents:
diff changeset
    47
 * can use it to make a persistent snapshot of a locator at any
7f561c08de6b Initial load
duke
parents:
diff changeset
    48
 * point during a document parse:</p>
7f561c08de6b Initial load
duke
parents:
diff changeset
    49
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    50
 * <pre>
7f561c08de6b Initial load
duke
parents:
diff changeset
    51
 * Locator locator;
7f561c08de6b Initial load
duke
parents:
diff changeset
    52
 * Locator startloc;
7f561c08de6b Initial load
duke
parents:
diff changeset
    53
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    54
 * public void setLocator (Locator locator)
7f561c08de6b Initial load
duke
parents:
diff changeset
    55
 * {
7f561c08de6b Initial load
duke
parents:
diff changeset
    56
 *         // note the locator
7f561c08de6b Initial load
duke
parents:
diff changeset
    57
 *   this.locator = locator;
7f561c08de6b Initial load
duke
parents:
diff changeset
    58
 * }
7f561c08de6b Initial load
duke
parents:
diff changeset
    59
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    60
 * public void startDocument ()
7f561c08de6b Initial load
duke
parents:
diff changeset
    61
 * {
7f561c08de6b Initial load
duke
parents:
diff changeset
    62
 *         // save the location of the start of the document
7f561c08de6b Initial load
duke
parents:
diff changeset
    63
 *         // for future use.
7f561c08de6b Initial load
duke
parents:
diff changeset
    64
 *   Locator startloc = new LocatorImpl(locator);
7f561c08de6b Initial load
duke
parents:
diff changeset
    65
 * }
7f561c08de6b Initial load
duke
parents:
diff changeset
    66
 *</pre>
7f561c08de6b Initial load
duke
parents:
diff changeset
    67
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    68
 * <p>Normally, parser writers will not use this class, since it
7f561c08de6b Initial load
duke
parents:
diff changeset
    69
 * is more efficient to provide location information only when
7f561c08de6b Initial load
duke
parents:
diff changeset
    70
 * requested, rather than constantly updating a Locator object.</p>
7f561c08de6b Initial load
duke
parents:
diff changeset
    71
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    72
 * @since SAX 1.0
7f561c08de6b Initial load
duke
parents:
diff changeset
    73
 * @author David Megginson
7f561c08de6b Initial load
duke
parents:
diff changeset
    74
 * @see org.xml.sax.Locator Locator
7f561c08de6b Initial load
duke
parents:
diff changeset
    75
 */
7f561c08de6b Initial load
duke
parents:
diff changeset
    76
public class LocatorImpl implements Locator
7f561c08de6b Initial load
duke
parents:
diff changeset
    77
{
7f561c08de6b Initial load
duke
parents:
diff changeset
    78
7f561c08de6b Initial load
duke
parents:
diff changeset
    79
7f561c08de6b Initial load
duke
parents:
diff changeset
    80
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
    81
     * Zero-argument constructor.
7f561c08de6b Initial load
duke
parents:
diff changeset
    82
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
    83
     * <p>This will not normally be useful, since the main purpose
7f561c08de6b Initial load
duke
parents:
diff changeset
    84
     * of this class is to make a snapshot of an existing Locator.</p>
7f561c08de6b Initial load
duke
parents:
diff changeset
    85
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
    86
    public LocatorImpl ()
7f561c08de6b Initial load
duke
parents:
diff changeset
    87
    {
7f561c08de6b Initial load
duke
parents:
diff changeset
    88
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
    89
7f561c08de6b Initial load
duke
parents:
diff changeset
    90
7f561c08de6b Initial load
duke
parents:
diff changeset
    91
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
    92
     * Copy constructor.
7f561c08de6b Initial load
duke
parents:
diff changeset
    93
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
    94
     * <p>Create a persistent copy of the current state of a locator.
7f561c08de6b Initial load
duke
parents:
diff changeset
    95
     * When the original locator changes, this copy will still keep
7f561c08de6b Initial load
duke
parents:
diff changeset
    96
     * the original values (and it can be used outside the scope of
7f561c08de6b Initial load
duke
parents:
diff changeset
    97
     * DocumentHandler methods).</p>
7f561c08de6b Initial load
duke
parents:
diff changeset
    98
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
    99
     * @param locator The locator to copy.
7f561c08de6b Initial load
duke
parents:
diff changeset
   100
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   101
    public LocatorImpl (Locator locator)
7f561c08de6b Initial load
duke
parents:
diff changeset
   102
    {
7f561c08de6b Initial load
duke
parents:
diff changeset
   103
        setPublicId(locator.getPublicId());
7f561c08de6b Initial load
duke
parents:
diff changeset
   104
        setSystemId(locator.getSystemId());
7f561c08de6b Initial load
duke
parents:
diff changeset
   105
        setLineNumber(locator.getLineNumber());
7f561c08de6b Initial load
duke
parents:
diff changeset
   106
        setColumnNumber(locator.getColumnNumber());
7f561c08de6b Initial load
duke
parents:
diff changeset
   107
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   108
7f561c08de6b Initial load
duke
parents:
diff changeset
   109
7f561c08de6b Initial load
duke
parents:
diff changeset
   110
7f561c08de6b Initial load
duke
parents:
diff changeset
   111
    ////////////////////////////////////////////////////////////////////
7f561c08de6b Initial load
duke
parents:
diff changeset
   112
    // Implementation of org.xml.sax.Locator
7f561c08de6b Initial load
duke
parents:
diff changeset
   113
    ////////////////////////////////////////////////////////////////////
7f561c08de6b Initial load
duke
parents:
diff changeset
   114
7f561c08de6b Initial load
duke
parents:
diff changeset
   115
7f561c08de6b Initial load
duke
parents:
diff changeset
   116
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   117
     * Return the saved public identifier.
7f561c08de6b Initial load
duke
parents:
diff changeset
   118
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   119
     * @return The public identifier as a string, or null if none
7f561c08de6b Initial load
duke
parents:
diff changeset
   120
     *         is available.
7f561c08de6b Initial load
duke
parents:
diff changeset
   121
     * @see org.xml.sax.Locator#getPublicId
7f561c08de6b Initial load
duke
parents:
diff changeset
   122
     * @see #setPublicId
7f561c08de6b Initial load
duke
parents:
diff changeset
   123
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   124
    public String getPublicId ()
7f561c08de6b Initial load
duke
parents:
diff changeset
   125
    {
7f561c08de6b Initial load
duke
parents:
diff changeset
   126
        return publicId;
7f561c08de6b Initial load
duke
parents:
diff changeset
   127
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   128
7f561c08de6b Initial load
duke
parents:
diff changeset
   129
7f561c08de6b Initial load
duke
parents:
diff changeset
   130
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   131
     * Return the saved system identifier.
7f561c08de6b Initial load
duke
parents:
diff changeset
   132
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   133
     * @return The system identifier as a string, or null if none
7f561c08de6b Initial load
duke
parents:
diff changeset
   134
     *         is available.
7f561c08de6b Initial load
duke
parents:
diff changeset
   135
     * @see org.xml.sax.Locator#getSystemId
7f561c08de6b Initial load
duke
parents:
diff changeset
   136
     * @see #setSystemId
7f561c08de6b Initial load
duke
parents:
diff changeset
   137
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   138
    public String getSystemId ()
7f561c08de6b Initial load
duke
parents:
diff changeset
   139
    {
7f561c08de6b Initial load
duke
parents:
diff changeset
   140
        return systemId;
7f561c08de6b Initial load
duke
parents:
diff changeset
   141
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   142
7f561c08de6b Initial load
duke
parents:
diff changeset
   143
7f561c08de6b Initial load
duke
parents:
diff changeset
   144
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   145
     * Return the saved line number (1-based).
7f561c08de6b Initial load
duke
parents:
diff changeset
   146
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   147
     * @return The line number as an integer, or -1 if none is available.
7f561c08de6b Initial load
duke
parents:
diff changeset
   148
     * @see org.xml.sax.Locator#getLineNumber
7f561c08de6b Initial load
duke
parents:
diff changeset
   149
     * @see #setLineNumber
7f561c08de6b Initial load
duke
parents:
diff changeset
   150
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   151
    public int getLineNumber ()
7f561c08de6b Initial load
duke
parents:
diff changeset
   152
    {
7f561c08de6b Initial load
duke
parents:
diff changeset
   153
        return lineNumber;
7f561c08de6b Initial load
duke
parents:
diff changeset
   154
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   155
7f561c08de6b Initial load
duke
parents:
diff changeset
   156
7f561c08de6b Initial load
duke
parents:
diff changeset
   157
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   158
     * Return the saved column number (1-based).
7f561c08de6b Initial load
duke
parents:
diff changeset
   159
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   160
     * @return The column number as an integer, or -1 if none is available.
7f561c08de6b Initial load
duke
parents:
diff changeset
   161
     * @see org.xml.sax.Locator#getColumnNumber
7f561c08de6b Initial load
duke
parents:
diff changeset
   162
     * @see #setColumnNumber
7f561c08de6b Initial load
duke
parents:
diff changeset
   163
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   164
    public int getColumnNumber ()
7f561c08de6b Initial load
duke
parents:
diff changeset
   165
    {
7f561c08de6b Initial load
duke
parents:
diff changeset
   166
        return columnNumber;
7f561c08de6b Initial load
duke
parents:
diff changeset
   167
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   168
7f561c08de6b Initial load
duke
parents:
diff changeset
   169
7f561c08de6b Initial load
duke
parents:
diff changeset
   170
7f561c08de6b Initial load
duke
parents:
diff changeset
   171
    ////////////////////////////////////////////////////////////////////
7f561c08de6b Initial load
duke
parents:
diff changeset
   172
    // Setters for the properties (not in org.xml.sax.Locator)
7f561c08de6b Initial load
duke
parents:
diff changeset
   173
    ////////////////////////////////////////////////////////////////////
7f561c08de6b Initial load
duke
parents:
diff changeset
   174
7f561c08de6b Initial load
duke
parents:
diff changeset
   175
7f561c08de6b Initial load
duke
parents:
diff changeset
   176
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   177
     * Set the public identifier for this locator.
7f561c08de6b Initial load
duke
parents:
diff changeset
   178
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   179
     * @param publicId The new public identifier, or null
7f561c08de6b Initial load
duke
parents:
diff changeset
   180
     *        if none is available.
7f561c08de6b Initial load
duke
parents:
diff changeset
   181
     * @see #getPublicId
7f561c08de6b Initial load
duke
parents:
diff changeset
   182
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   183
    public void setPublicId (String publicId)
7f561c08de6b Initial load
duke
parents:
diff changeset
   184
    {
7f561c08de6b Initial load
duke
parents:
diff changeset
   185
        this.publicId = publicId;
7f561c08de6b Initial load
duke
parents:
diff changeset
   186
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   187
7f561c08de6b Initial load
duke
parents:
diff changeset
   188
7f561c08de6b Initial load
duke
parents:
diff changeset
   189
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   190
     * Set the system identifier for this locator.
7f561c08de6b Initial load
duke
parents:
diff changeset
   191
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   192
     * @param systemId The new system identifier, or null
7f561c08de6b Initial load
duke
parents:
diff changeset
   193
     *        if none is available.
7f561c08de6b Initial load
duke
parents:
diff changeset
   194
     * @see #getSystemId
7f561c08de6b Initial load
duke
parents:
diff changeset
   195
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   196
    public void setSystemId (String systemId)
7f561c08de6b Initial load
duke
parents:
diff changeset
   197
    {
7f561c08de6b Initial load
duke
parents:
diff changeset
   198
        this.systemId = systemId;
7f561c08de6b Initial load
duke
parents:
diff changeset
   199
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   200
7f561c08de6b Initial load
duke
parents:
diff changeset
   201
7f561c08de6b Initial load
duke
parents:
diff changeset
   202
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   203
     * Set the line number for this locator (1-based).
7f561c08de6b Initial load
duke
parents:
diff changeset
   204
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   205
     * @param lineNumber The line number, or -1 if none is available.
7f561c08de6b Initial load
duke
parents:
diff changeset
   206
     * @see #getLineNumber
7f561c08de6b Initial load
duke
parents:
diff changeset
   207
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   208
    public void setLineNumber (int lineNumber)
7f561c08de6b Initial load
duke
parents:
diff changeset
   209
    {
7f561c08de6b Initial load
duke
parents:
diff changeset
   210
        this.lineNumber = lineNumber;
7f561c08de6b Initial load
duke
parents:
diff changeset
   211
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   212
7f561c08de6b Initial load
duke
parents:
diff changeset
   213
7f561c08de6b Initial load
duke
parents:
diff changeset
   214
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   215
     * Set the column number for this locator (1-based).
7f561c08de6b Initial load
duke
parents:
diff changeset
   216
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   217
     * @param columnNumber The column number, or -1 if none is available.
7f561c08de6b Initial load
duke
parents:
diff changeset
   218
     * @see #getColumnNumber
7f561c08de6b Initial load
duke
parents:
diff changeset
   219
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   220
    public void setColumnNumber (int columnNumber)
7f561c08de6b Initial load
duke
parents:
diff changeset
   221
    {
7f561c08de6b Initial load
duke
parents:
diff changeset
   222
        this.columnNumber = columnNumber;
7f561c08de6b Initial load
duke
parents:
diff changeset
   223
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   224
7f561c08de6b Initial load
duke
parents:
diff changeset
   225
7f561c08de6b Initial load
duke
parents:
diff changeset
   226
7f561c08de6b Initial load
duke
parents:
diff changeset
   227
    ////////////////////////////////////////////////////////////////////
7f561c08de6b Initial load
duke
parents:
diff changeset
   228
    // Internal state.
7f561c08de6b Initial load
duke
parents:
diff changeset
   229
    ////////////////////////////////////////////////////////////////////
7f561c08de6b Initial load
duke
parents:
diff changeset
   230
7f561c08de6b Initial load
duke
parents:
diff changeset
   231
    private String publicId;
7f561c08de6b Initial load
duke
parents:
diff changeset
   232
    private String systemId;
7f561c08de6b Initial load
duke
parents:
diff changeset
   233
    private int lineNumber;
7f561c08de6b Initial load
duke
parents:
diff changeset
   234
    private int columnNumber;
7f561c08de6b Initial load
duke
parents:
diff changeset
   235
7f561c08de6b Initial load
duke
parents:
diff changeset
   236
}
7f561c08de6b Initial load
duke
parents:
diff changeset
   237
7f561c08de6b Initial load
duke
parents:
diff changeset
   238
// end of LocatorImpl.java