Projekt

Obecné

Profil

Stáhnout (1.18 KB) Statistiky
| Větev: | Tag: | Revize:
1
package jdeserialize;
2

    
3
/**
4
 * <p>Represents an array instance, including the values the comprise the array.  </p>
5
 *
6
 * <p>Note that in arrays of primitives, the classdesc will be named "[x", where x is the
7
 * field type code representing the primitive type.  See jdeserialize.resolveJavaType()
8
 * for an example of analysis/generation of human-readable names from these class names.</p>
9
 */
10
public class arrayobj extends contentbase {
11
    /**
12
     * Type of the array instance.
13
     */
14
    public classdesc classdesc;
15

    
16
    /**
17
     * Values of the array, in the order they were read from the stream.
18
     */
19
    public arraycoll data;
20

    
21
    public arrayobj(int handle, classdesc cd, arraycoll data) {
22
        super(contenttype.ARRAY);
23
        this.handle = handle;
24
        this.classdesc = cd;
25
        this.data = data;
26
    }
27
    public String toString() {
28
        StringBuilder sb = new StringBuilder();
29
        sb.append("[ ");
30
        for(Object el : this.data)
31
        {
32
            sb.append(el.toString());
33
            if(!el.equals(this.data.get(this.data.size()-1)))
34
            {
35
                sb.append(", ");
36
            }
37
        }
38
        sb.append(" ]");
39
        return sb.toString();
40
    }
41
}
42

    
(6-6/20)