jdk/src/share/classes/com/sun/jdi/ArrayReference.java
author duke
Sat, 01 Dec 2007 00:00:00 +0000
changeset 2 90ce3da70b43
child 5506 202f599c92aa
permissions -rw-r--r--
Initial load
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
     2
 * Copyright 1998-2004 Sun Microsystems, Inc.  All Rights Reserved.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Sun designates this
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
 * by Sun in the LICENSE file that accompanied this code.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
 * CA 95054 USA or visit www.sun.com if you need additional information or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
 * have any questions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package com.sun.jdi;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.util.List;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
 * Provides access to an array object and its components in the target VM.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
 * Each array component is mirrored by a {@link Value} object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 * The array components, in aggregate, are placed in {@link java.util.List}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * objects instead of arrays for consistency with the rest of the API and
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * for interoperability with other APIs.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * @author Robert Field
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * @author Gordon Hirsch
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * @author James McIlree
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * @since  1.3
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
public interface ArrayReference extends ObjectReference {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
     * Returns the number of components in this array.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
     * @return the integer count of components in this array.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
    int length();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
     * Returns an array component value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
     * @param index the index of the component to retrieve
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
     * @return the {@link Value} at the given index.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
     * @throws java.lang.IndexOutOfBoundsException if
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
     * <CODE><I>index</I></CODE> is outside the range of this array,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
     * that is, if either of the following are true:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
     * <PRE>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
     *    <I>index</I> &lt; 0
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
     *    <I>index</I> &gt;= {@link #length() length()} </PRE>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
    Value getValue(int index);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
     * Returns all of the components in this array.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
     * @return a list of {@link Value} objects, one for each array
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
     * component ordered by array index.  For zero length arrays,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
     * an empty list is returned.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
    List<Value> getValues();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
     * Returns a range of array components.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
     * @param index the index of the first component to retrieve
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
     * @param length the number of components to retrieve, or -1 to
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
     * retrieve all components to the end of this array.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
     * @return a list of {@link Value} objects, one for each requested
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
     * array component ordered by array index.  When there are
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
     * no elements in the specified range (e.g.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
     * <CODE><I>length</I></CODE> is zero) an empty list is returned
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
     * @throws java.lang.IndexOutOfBoundsException if the range
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
     * specified with <CODE><I>index</I></CODE> and
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
     * <CODE><I>length</I></CODE> is not within the range of the array,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
     * that is, if either of the following are true:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
     * <PRE>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
     *    <I>index</I> &lt; 0
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
     *    <I>index</I> &gt; {@link #length() length()} </PRE>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
     * or if <CODE><I>length</I> != -1</CODE> and
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
     * either of the following are true:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
     * <PRE>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
     *    <I>length</I> &lt; 0
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
     *    <I>index</I> + <I>length</I> &gt;  {@link #length() length()}</PRE>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
    List<Value> getValues(int index, int length);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
     * Replaces an array component with another value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
     * Object values must be assignment compatible with the component type
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
     * (This implies that the component type must be loaded through the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
     * declaring class's class loader). Primitive values must be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
     * either assignment compatible with the component type or must be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
     * convertible to the component type without loss of information.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
     * See JLS section 5.2 for more information on assignment
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
     * compatibility.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
     * @param value the new value
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
     * @param index the index of the component to set
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
     * @throws java.lang.IndexOutOfBoundsException if
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
     * <CODE><I>index</I></CODE> is outside the range of this array,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
     * that is, if either of the following are true:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
     * <PRE>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
     *    <I>index</I> &lt; 0
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
     *    <I>index</I> &gt;= {@link #length() length()} </PRE>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
     * @throws InvalidTypeException if the type of <CODE><I>value</I></CODE>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
     * is not compatible with the declared type of array components.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
     * @throws ClassNotLoadedException if the array component type
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
     * has not yet been loaded
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
     * through the appropriate class loader.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
     * @throws VMCannotBeModifiedException if the VirtualMachine is read-only - see {@link VirtualMachine#canBeModified()}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
     * @see ArrayType#componentType()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
    void setValue(int index, Value value)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
            throws InvalidTypeException,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
                   ClassNotLoadedException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
     * Replaces all array components with other values. If the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
     * list is larger in size than the array, the values at the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
     * end of the list are ignored.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
     * Object values must be assignment compatible with the element type
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
     * (This implies that the component type must be loaded through the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
     * enclosing class's class loader). Primitive values must be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
     * either assignment compatible with the component type or must be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
     * convertible to the component type without loss of information.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
     * See JLS section 5.2 for more information on assignment
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
     * compatibility.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
     * @param values a list of {@link Value} objects to be placed
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
     * in this array.  If <CODE><I>values</I>.size()</CODE> is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
     * less that the length of the array, the first
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
     * <CODE><I>values</I>.size()</CODE> elements are set.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
     * @throws InvalidTypeException if any of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
     * new <CODE><I>values</I></CODE>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
     * is not compatible with the declared type of array components.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
     * @throws ClassNotLoadedException if the array component
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
     * type has not yet been loaded
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
     * through the appropriate class loader.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
     * @throws VMCannotBeModifiedException if the VirtualMachine is read-only - see {@link VirtualMachine#canBeModified()}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
     * @see ArrayType#componentType()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
    void setValues(List<? extends Value> values)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
            throws InvalidTypeException,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
                   ClassNotLoadedException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
     * Replaces a range of array components with other values.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
     * Object values must be assignment compatible with the component type
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
     * (This implies that the component type must be loaded through the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
     * enclosing class's class loader). Primitive values must be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
     * either assignment compatible with the component type or must be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
     * convertible to the component type without loss of information.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
     * See JLS section 5.2 for more information on assignment
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
     * compatibility.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
     * @param index the index of the first component to set.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
     * @param values a list of {@link Value} objects to be placed
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
     * in this array.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
     * @param srcIndex the index of the first source value to use.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
     * @param length the number of components to set, or -1 to set
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
     * all components to the end of this array or the end of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
     * <CODE><I>values</I></CODE> (whichever comes first).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
     * @throws InvalidTypeException if any element of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
     * <CODE><I>values</I></CODE>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
     * is not compatible with the declared type of array components.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
     * @throws java.lang.IndexOutOfBoundsException if the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
     * array range specified with
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
     * <CODE><I>index</I></CODE> and  <CODE><I>length</I></CODE>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
     * is not within the range of the array,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
     * or if the source range specified with
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
     * <CODE><I>srcIndex</I></CODE> and <CODE><I>length</I></CODE>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
     * is not within <CODE><I>values</I></CODE>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
     * that is, if any of the following are true:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
     * <PRE>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
     *    <I>index</I> &lt; 0
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
     *    <I>index</I> &gt; {@link #length() length()}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
     *    <I>srcIndex</I> &lt; 0
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
     *    <I>srcIndex</I> &gt; <I>values</I>.size() </PRE>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
     * or if <CODE><I>length</I> != -1</CODE> and any of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
     * following are true:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
     * <PRE>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
     *    <I>length</I> &lt; 0
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
     *    <I>index</I> + <I>length</I> &gt; {@link #length() length()}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
     *    <I>srcIndex</I> + <I>length</I> &gt; <I>values</I>.size() </PRE>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
     * @throws VMCannotBeModifiedException if the VirtualMachine is read-only - see {@link VirtualMachine#canBeModified()}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
     * @see ArrayType#componentType()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
    void setValues(int index, List<? extends Value> values, int srcIndex, int length)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
            throws InvalidTypeException,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
                   ClassNotLoadedException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
}