01: //
02: // Copyright (C) 2005 United States Government as represented by the
03: // Administrator of the National Aeronautics and Space Administration
04: // (NASA). All Rights Reserved.
05: //
06: // This software is distributed under the NASA Open Source Agreement
07: // (NOSA), version 1.3. The NOSA has been approved by the Open Source
08: // Initiative. See the file NOSA-1.3-JPF at the top of the distribution
09: // directory tree for the complete NOSA document.
10: //
11: // THE SUBJECT SOFTWARE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY OF ANY
12: // KIND, EITHER EXPRESSED, IMPLIED, OR STATUTORY, INCLUDING, BUT NOT
13: // LIMITED TO, ANY WARRANTY THAT THE SUBJECT SOFTWARE WILL CONFORM TO
14: // SPECIFICATIONS, ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR
15: // A PARTICULAR PURPOSE, OR FREEDOM FROM INFRINGEMENT, ANY WARRANTY THAT
16: // THE SUBJECT SOFTWARE WILL BE ERROR FREE, OR ANY WARRANTY THAT
17: // DOCUMENTATION, IF PROVIDED, WILL CONFORM TO THE SUBJECT SOFTWARE.
18: //
19: package gov.nasa.jpf.jvm;
20:
21: /**
22: * <2do> pcm - another superfluous type, we should reduce this to Fields. See
23: * DynamicFields
24: *
25: * Represents the fields of an object or class. Contains the values of the
26: * fields, not their descriptors. Descriptors are represented by
27: * gov.nasa.jpf.jvm.FieldInfo objects, which are stored in the
28: * ClassInfo structure. Unlike DynamicFields, ONLY the values of fields of
29: * a single class are present in a StaticFields.
30: * @see gov.nasa.jpf.jvm.FieldInfo
31: */
32: public class StaticFields extends Fields {
33: /**
34: * Creates a new field object.
35: */
36: public StaticFields(ClassInfo ci) {
37: super (ci.getType(), ci, ci.getStaticDataSize());
38: ci.initializeStaticData(this );
39: }
40:
41: public FieldInfo getFieldInfo(String clsBase, String fname) {
42: return ci.getStaticField(clsBase, fname);
43: }
44:
45: public String getLogChar() {
46: return "@";
47: }
48:
49: public boolean equals(Object o) {
50: if (o == null) {
51: return false;
52: }
53:
54: if (!(o instanceof StaticFields)) {
55: return false;
56: }
57:
58: return super .equals(o);
59: }
60:
61: public FieldInfo getFieldInfo(int index) {
62: return ci.getStaticField(index);
63: }
64:
65: public int getNumberOfFields() {
66: return ci.getNumberOfStaticFields();
67: }
68: }
|