2 * Copyright (C) 2014, United States Government, as represented by the
3 * Administrator of the National Aeronautics and Space Administration.
6 * The Java Pathfinder core (jpf-core) platform is licensed under the
7 * Apache License, Version 2.0 (the "License"); you may not use this file except
8 * in compliance with the License. You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0.
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
18 package gov.nasa.jpf.vm;
20 import gov.nasa.jpf.util.HashData;
21 import gov.nasa.jpf.util.IntVector;
23 import java.io.PrintStream;
26 * element values for double[] objects
28 public class DoubleArrayFields extends ArrayFields {
32 public DoubleArrayFields (int length) {
33 values = new double[length];
37 public double[] asDoubleArray() {
42 public void copyElements (ArrayFields src, int srcPos, int dstPos, int len){
43 DoubleArrayFields a = (DoubleArrayFields) src;
44 System.arraycopy(a.values, srcPos, values, dstPos, len);
48 protected void printValue(PrintStream ps, int idx){
49 ps.print(values[idx]);
53 public Object getValues(){
58 public int arrayLength() {
63 public int getHeapSize() { // in bytes
64 return values.length * 8;
68 public void appendTo (IntVector v) {
69 v.appendRawBits(values);
73 public DoubleArrayFields clone(){
74 DoubleArrayFields f = (DoubleArrayFields)cloneFields();
75 f.values = values.clone();
80 public boolean equals (Object o) {
81 if (o instanceof DoubleArrayFields) {
82 DoubleArrayFields other = (DoubleArrayFields)o;
85 double[] vOther = other.values;
86 if (v.length != vOther.length) {
90 for (int i=0; i<v.length; i++) {
91 if (v[i] != vOther[i]) {
96 return compareAttrs(other);
104 public void setDoubleValue (int pos, double newValue) {
105 values[pos] = newValue;
109 public double getDoubleValue (int pos) {
115 public void hash(HashData hd) {
117 for (int i=0; i < v.length; i++) {