jdk/src/share/classes/java/awt/image/DataBufferDouble.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 2000-2007 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 java.awt.image;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import static sun.java2d.StateTrackable.State.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
 * This class extends <code>DataBuffer</code> and stores data internally
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
 * in <code>double</code> form.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * <a name="optimizations">
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * Note that some implementations may function more efficiently
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 * if they can maintain control over how the data for an image is
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * stored.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * For example, optimizations such as caching an image in video
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * memory require that the implementation track all modifications
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * to that data.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * Other implementations may operate better if they can store the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * data in locations other than a Java array.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * To maintain optimum compatibility with various optimizations
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * it is best to avoid constructors and methods which expose the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * underlying storage as a Java array as noted below in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * documentation for those methods.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 * </a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
public final class DataBufferDouble extends DataBuffer {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
    /** The array of data banks. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
    double bankdata[][];
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
    /** A reference to the default data bank. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
    double data[];
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
     * Constructs a <code>double</code>-based <code>DataBuffer</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
     * with a specified size.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
     * @param size The number of elements in the <code>DataBuffer</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
    public DataBufferDouble(int size) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
        super(STABLE, TYPE_DOUBLE, size);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
        data = new double[size];
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
        bankdata = new double[1][];
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
        bankdata[0] = data;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
     * Constructs a <code>double</code>-based <code>DataBuffer</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
     * with a specified number of banks, all of which are of a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
     * specified size.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
     * @param size The number of elements in each bank of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
     *        <code>DataBuffer</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
     * @param numBanks The number of banks in the <code>DataBuffer</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
    public DataBufferDouble(int size, int numBanks) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
        super(STABLE, TYPE_DOUBLE, size, numBanks);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
        bankdata = new double[numBanks][];
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
        for (int i= 0; i < numBanks; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
            bankdata[i] = new double[size];
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
        data = bankdata[0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
     * Constructs a <code>double</code>-based <code>DataBuffer</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
     * with the specified data array.  Only the first
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
     * <code>size</code> elements are available for use by this
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
     * <code>DataBuffer</code>.  The array must be large enough to
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
     * hold <code>size</code> elements.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
     * Note that {@code DataBuffer} objects created by this constructor
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
     * may be incompatible with <a href="#optimizations">performance
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
     * optimizations</a> used by some implementations (such as caching
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
     * an associated image in video memory).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
     * @param dataArray An array of <code>double</code>s to be used as the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
     *                  first and only bank of this <code>DataBuffer</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
     * @param size The number of elements of the array to be used.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
    public DataBufferDouble(double dataArray[], int size) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
        super(UNTRACKABLE, TYPE_DOUBLE, size);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
        data = dataArray;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
        bankdata = new double[1][];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
        bankdata[0] = data;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
     * Constructs a <code>double</code>-based <code>DataBuffer</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
     * with the specified data array.  Only the elements between
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
     * <code>offset</code> and <code>offset + size - 1</code> are
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
     * available for use by this <code>DataBuffer</code>.  The array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
     * must be large enough to hold <code>offset + size</code> elements.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
     * Note that {@code DataBuffer} objects created by this constructor
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
     * may be incompatible with <a href="#optimizations">performance
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
     * optimizations</a> used by some implementations (such as caching
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
     * an associated image in video memory).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
     * @param dataArray An array of <code>double</code>s to be used as the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
     *                  first and only bank of this <code>DataBuffer</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
     * @param size The number of elements of the array to be used.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
     * @param offset The offset of the first element of the array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
     *               that will be used.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
    public DataBufferDouble(double dataArray[], int size, int offset) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
        super(UNTRACKABLE, TYPE_DOUBLE, size, 1, offset);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
        data = dataArray;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
        bankdata = new double[1][];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
        bankdata[0] = data;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
     * Constructs a <code>double</code>-based <code>DataBuffer</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
     * with the specified data arrays.  Only the first
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
     * <code>size</code> elements of each array are available for use
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
     * by this <code>DataBuffer</code>.  The number of banks will be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
     * equal <code>to dataArray.length</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
     * Note that {@code DataBuffer} objects created by this constructor
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
     * may be incompatible with <a href="#optimizations">performance
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
     * optimizations</a> used by some implementations (such as caching
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
     * an associated image in video memory).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
     * @param dataArray An array of arrays of <code>double</code>s to be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
     *        used as the banks of this <code>DataBuffer</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
     * @param size The number of elements of each array to be used.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
    public DataBufferDouble(double dataArray[][], int size) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
        super(UNTRACKABLE, TYPE_DOUBLE, size, dataArray.length);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
        bankdata = (double[][]) dataArray.clone();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
        data = bankdata[0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
     * Constructs a <code>double</code>-based <code>DataBuffer</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
     * with the specified data arrays, size, and per-bank offsets.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
     * The number of banks is equal to dataArray.length.  Each array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
     * must be at least as large as <code>size</code> plus the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
     * corresponding offset.  There must be an entry in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
     * <code>offsets</code> array for each data array.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
     * Note that {@code DataBuffer} objects created by this constructor
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
     * may be incompatible with <a href="#optimizations">performance
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
     * optimizations</a> used by some implementations (such as caching
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
     * an associated image in video memory).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
     * @param dataArray An array of arrays of <code>double</code>s to be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
     *        used as the banks of this <code>DataBuffer</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
     * @param size The number of elements of each array to be used.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
     * @param offsets An array of integer offsets, one for each bank.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
    public DataBufferDouble(double dataArray[][], int size, int offsets[]) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
        super(UNTRACKABLE, TYPE_DOUBLE, size, dataArray.length, offsets);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
        bankdata = (double[][]) dataArray.clone();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
        data = bankdata[0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
     * Returns the default (first) <code>double</code> data array.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
     * Note that calling this method may cause this {@code DataBuffer}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
     * object to be incompatible with <a href="#optimizations">performance
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
     * optimizations</a> used by some implementations (such as caching
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
     * an associated image in video memory).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
     * @return the first double data array.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
    public double[] getData() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
        theTrackable.setUntrackable();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
        return data;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
     * Returns the data array for the specified bank.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
     * Note that calling this method may cause this {@code DataBuffer}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
     * object to be incompatible with <a href="#optimizations">performance
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
     * optimizations</a> used by some implementations (such as caching
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
     * an associated image in video memory).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
     * @param bank the data array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
     * @return the data array specified by <code>bank</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
    public double[] getData(int bank) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
        theTrackable.setUntrackable();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
        return bankdata[bank];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
     * Returns the data array for all banks.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
     * Note that calling this method may cause this {@code DataBuffer}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
     * object to be incompatible with <a href="#optimizations">performance
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
     * optimizations</a> used by some implementations (such as caching
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
     * an associated image in video memory).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
     * @return all data arrays from this data buffer.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
    public double[][] getBankData() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
        theTrackable.setUntrackable();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
        return (double[][]) bankdata.clone();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
     * Returns the requested data array element from the first
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
     * (default) bank as an <code>int</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
     * @param i The desired data array element.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
     * @return The data entry as an <code>int</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
     * @see #setElem(int, int)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
     * @see #setElem(int, int, int)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
    public int getElem(int i) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
        return (int)(data[i+offset]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
     * Returns the requested data array element from the specified
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
     * bank as an <code>int</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
     * @param bank The bank number.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
     * @param i The desired data array element.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
     * @return The data entry as an <code>int</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
     * @see #setElem(int, int)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
     * @see #setElem(int, int, int)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
    public int getElem(int bank, int i) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
        return (int)(bankdata[bank][i+offsets[bank]]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
     * Sets the requested data array element in the first (default)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
     * bank to the given <code>int</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
     * @param i The desired data array element.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
     * @param val The value to be set.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
     * @see #getElem(int)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
     * @see #getElem(int, int)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
    public void setElem(int i, int val) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
        data[i+offset] = (double)val;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
        theTrackable.markDirty();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
     * Sets the requested data array element in the specified bank
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
     * to the given <code>int</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
     * @param bank The bank number.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
     * @param i The desired data array element.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
     * @param val The value to be set.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
     * @see #getElem(int)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
     * @see #getElem(int, int)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
    public void setElem(int bank, int i, int val) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
        bankdata[bank][i+offsets[bank]] = (double)val;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
        theTrackable.markDirty();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
     * Returns the requested data array element from the first
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
     * (default) bank as a <code>float</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
     * @param i The desired data array element.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
     * @return The data entry as a <code>float</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
     * @see #setElemFloat(int, float)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
     * @see #setElemFloat(int, int, float)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
    public float getElemFloat(int i) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
        return (float)data[i+offset];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
     * Returns the requested data array element from the specified
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
     * bank as a <code>float</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
     * @param bank The bank number.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
     * @param i The desired data array element.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
     * @return The data entry as a <code>float</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
     * @see #setElemFloat(int, float)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
     * @see #setElemFloat(int, int, float)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
    public float getElemFloat(int bank, int i) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
        return (float)bankdata[bank][i+offsets[bank]];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
     * Sets the requested data array element in the first (default)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
     * bank to the given <code>float</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
     * @param i The desired data array element.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
     * @param val The value to be set.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
     * @see #getElemFloat(int)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
     * @see #getElemFloat(int, int)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
    public void setElemFloat(int i, float val) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
        data[i+offset] = (double)val;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
        theTrackable.markDirty();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
     * Sets the requested data array element in the specified bank to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
     * the given <code>float</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
     * @param bank The bank number.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
     * @param i The desired data array element.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
     * @param val The value to be set.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
     * @see #getElemFloat(int)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
     * @see #getElemFloat(int, int)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
    public void setElemFloat(int bank, int i, float val) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
        bankdata[bank][i+offsets[bank]] = (double)val;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
        theTrackable.markDirty();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
     * Returns the requested data array element from the first
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
     * (default) bank as a <code>double</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
     * @param i The desired data array element.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
     * @return The data entry as a <code>double</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
     * @see #setElemDouble(int, double)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
     * @see #setElemDouble(int, int, double)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
    public double getElemDouble(int i) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
        return data[i+offset];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
     * Returns the requested data array element from the specified
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
     * bank as a <code>double</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
     * @param bank The bank number.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
     * @param i The desired data array element.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
     * @return The data entry as a <code>double</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
     * @see #setElemDouble(int, double)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
     * @see #setElemDouble(int, int, double)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
    public double getElemDouble(int bank, int i) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
        return bankdata[bank][i+offsets[bank]];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
     * Sets the requested data array element in the first (default)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
     * bank to the given <code>double</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
     * @param i The desired data array element.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
     * @param val The value to be set.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
     * @see #getElemDouble(int)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
     * @see #getElemDouble(int, int)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
    public void setElemDouble(int i, double val) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
        data[i+offset] = val;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
        theTrackable.markDirty();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
     * Sets the requested data array element in the specified bank to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
     * the given <code>double</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
     * @param bank The bank number.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
     * @param i The desired data array element.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
     * @param val The value to be set.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
     * @see #getElemDouble(int)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
     * @see #getElemDouble(int, int)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
    public void setElemDouble(int bank, int i, double val) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
        bankdata[bank][i+offsets[bank]] = val;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
        theTrackable.markDirty();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
}