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.
19 package gov.nasa.jpf.vm;
21 import gov.nasa.jpf.util.HashData;
22 import gov.nasa.jpf.util.IntVector;
24 import java.io.PrintStream;
27 * element values for int[] objects
29 public class IntArrayFields extends ArrayFields {
33 public IntArrayFields (int length) {
34 values = new int[length];
38 public int[] asIntArray() {
43 public void copyElements (ArrayFields src, int srcPos, int dstPos, int len){
44 IntArrayFields a = (IntArrayFields) src;
45 System.arraycopy(a.values, srcPos, values, dstPos, len);
49 protected void printValue(PrintStream ps, int idx){
50 ps.print(values[idx]);
54 public Object getValues(){
59 public int arrayLength() {
64 public int getHeapSize() { // in bytes
65 return values.length * 4;
69 public void appendTo (IntVector v) {
74 public IntArrayFields clone(){
75 IntArrayFields f = (IntArrayFields)cloneFields();
76 f.values = values.clone();
81 public boolean equals (Object o) {
82 if (o instanceof IntArrayFields) {
83 IntArrayFields other = (IntArrayFields)o;
86 int[] vOther = other.values;
87 if (v.length != vOther.length) {
91 for (int i=0; i<v.length; i++) {
92 if (v[i] != vOther[i]) {
97 return compareAttrs(other);
105 public void setIntValue (int pos, int newValue) {
106 values[pos] = newValue;
110 public int getIntValue (int pos) {
116 public void hash(HashData hd) {
118 for (int i=0; i < v.length; i++) {