summaryrefslogtreecommitdiff
path: root/sources/scala/Array.java
blob: 83be2255266d46c4aee1df9b2e268ca7083d7dda (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
/*                     __                                               *\
**     ________ ___   / /  ___     Scala API                            **
**    / __/ __// _ | / /  / _ |    (c) 2002, LAMP/EPFL                  **
**  __\ \/ /__/ __ |/ /__/ __ |                                         **
** /____/\___/_/ |_/____/_/ | |                                         **
**                          |/                                          **
** $Id$
\*                                                                      */

package scala;


/** @meta class [?T] extends scala.Function1[scala.Int, ?T] with scala.ScalaObject with java.lang.Cloneable with java.io.Serializable;
 */
public abstract class Array
    extends java.lang.Object
    implements ScalaObject, Function1, Cloneable, java.io.Serializable {

    /** @meta constr (scala.Int);
     */
    public Array() {
    }

    /** @meta method []scala.Int;
     */
    public abstract int length();

    public boolean isDefinedAt(int x) {
        return (x >= 0) && (x < length());
    }

    /** @meta method (scala.Int, ?T) scala.Unit;
     */
    public abstract void update(int i, java.lang.Object x);

    /** @meta method (scala.Int) ?T;
     */
    public abstract java.lang.Object apply(int i);

    public java.lang.Object apply(java.lang.Object i) {
		return apply(((scala.Int)i).value);
    }

    /** @meta method () scala.Array[scala.AnyRef];
     */
    public java.lang.Object[] asObjectArray() {
        throw new ClassCastException();
    }

    /** @meta method (scala.Function1[?T, scala.Unit]) scala.Unit;
     */
    public void foreach(Function1 f) {
    	for (int i = 0; i < length(); i++)
    		f.apply(apply(scala.runtime.RunTime.box_ivalue(i)));
    }

    /** @meta method (scala.Function1[?T, scala.Boolean]) scala.Boolean;
     */
    public boolean forall(Function1 f) {
    	for (int i = 0; i < length(); i++)
    		if (!((scala.Boolean)f.apply(apply(scala.runtime.RunTime.box_ivalue(i)))).value)
    			return false;
    	return true;
    }

    /** @meta method (scala.Function1[?T, scala.Boolean]) scala.Boolean;
     */
    public boolean exists(Function1 f) {
    	for (int i = 0; i < length(); i++)
    		if (((scala.Boolean)f.apply(apply(scala.runtime.RunTime.box_ivalue(i)))).value)
    			return true;
    	return false;
    }

    /** @meta method () scala.Array[?T];
     */
    public java.lang.Object asArray() {
        throw new ClassCastException();
    }

    public boolean[] asBooleanArray() {
        throw new ClassCastException();
    }

    public byte[] asByteArray() {
        throw new ClassCastException();
    }

    public short[] asShortArray() {
        throw new ClassCastException();
    }

    public char[] asCharArray() {
        throw new ClassCastException();
    }

    public int[] asIntArray() {
        throw new ClassCastException();
    }

    public long[] asLongArray() {
        throw new ClassCastException();
    }

    public float[] asFloatArray() {
        throw new ClassCastException();
    }

    public double[] asDoubleArray() {
        throw new ClassCastException();
    }

    public int $tag() {
    	return 0;
    }
}