KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jruby > runtime > MethodSelectorTable


1 /*
2  * MethodSelectorTable.java
3  *
4  * Created on January 1, 2007, 7:45 PM
5  *
6  * To change this template, choose Tools | Template Manager
7  * and open the template in the editor.
8  */

9
10 package org.jruby.runtime;
11
12 import org.jruby.RubyArray;
13 import org.jruby.RubyBignum;
14 import org.jruby.RubyFixnum;
15 import org.jruby.RubyString;
16
17 /**
18  *
19  * @author headius
20  */

21 public class MethodSelectorTable {
22     public final byte[][] table = new byte[ClassIndex.MAX_CLASSES][MethodIndex.MAX_METHODS];
23     
24     public MethodSelectorTable() {
25         // Fixnum
26
table[ClassIndex.FIXNUM] = new byte[MethodIndex.MAX_METHODS];
27         table[ClassIndex.FIXNUM][MethodIndex.OP_PLUS] = RubyFixnum.OP_PLUS_SWITCHVALUE;
28         table[ClassIndex.FIXNUM][MethodIndex.OP_MINUS] = RubyFixnum.OP_MINUS_SWITCHVALUE;
29         table[ClassIndex.FIXNUM][MethodIndex.OP_LT] = RubyFixnum.OP_LT_SWITCHVALUE;
30         
31         // Bignum
32
table[ClassIndex.BIGNUM] = new byte[MethodIndex.MAX_METHODS];
33         table[ClassIndex.BIGNUM][MethodIndex.OP_PLUS] = RubyBignum.OP_PLUS_SWITCHVALUE;
34         table[ClassIndex.BIGNUM][MethodIndex.OP_MINUS] = RubyBignum.OP_MINUS_SWITCHVALUE;
35         table[ClassIndex.BIGNUM][MethodIndex.OP_LT] = RubyBignum.OP_LT_SWITCHVALUE;
36         
37         // Array
38
table[ClassIndex.ARRAY] = new byte[MethodIndex.MAX_METHODS];
39         table[ClassIndex.ARRAY][MethodIndex.OP_PLUS] = RubyArray.OP_PLUS_SWITCHVALUE;
40         table[ClassIndex.ARRAY][MethodIndex.AREF] = RubyArray.AREF_SWITCHVALUE;
41         table[ClassIndex.ARRAY][MethodIndex.ASET] = RubyArray.ASET_SWITCHVALUE;
42         table[ClassIndex.ARRAY][MethodIndex.POP] = RubyArray.POP_SWITCHVALUE;
43         table[ClassIndex.ARRAY][MethodIndex.PUSH] = RubyArray.PUSH_SWITCHVALUE;
44         table[ClassIndex.ARRAY][MethodIndex.NIL_P] = RubyArray.NIL_P_SWITCHVALUE;
45         table[ClassIndex.ARRAY][MethodIndex.EQUALEQUAL] = RubyArray.EQUALEQUAL_SWITCHVALUE;
46         table[ClassIndex.ARRAY][MethodIndex.UNSHIFT] = RubyArray.UNSHIFT_SWITCHVALUE;
47         table[ClassIndex.ARRAY][MethodIndex.OP_LSHIFT] = RubyArray.OP_LSHIFT_SWITCHVALUE;
48         table[ClassIndex.ARRAY][MethodIndex.EMPTY_P] = RubyArray.EMPTY_P_SWITCHVALUE;
49         
50         // String
51
table[ClassIndex.STRING] = new byte[MethodIndex.MAX_METHODS];
52         table[ClassIndex.STRING][MethodIndex.OP_PLUS] = RubyString.OP_PLUS_SWITCHVALUE;
53         table[ClassIndex.STRING][MethodIndex.OP_LT] = RubyString.OP_LT_SWITCHVALUE;
54         table[ClassIndex.STRING][MethodIndex.AREF] = RubyString.AREF_SWITCHVALUE;
55         table[ClassIndex.STRING][MethodIndex.ASET] = RubyString.ASET_SWITCHVALUE;
56         table[ClassIndex.STRING][MethodIndex.NIL_P] = RubyString.NIL_P_SWITCHVALUE;
57         table[ClassIndex.STRING][MethodIndex.EQUALEQUAL] = RubyString.EQUALEQUAL_SWITCHVALUE;
58         table[ClassIndex.STRING][MethodIndex.OP_GE] = RubyString.OP_GE_SWITCHVALUE;
59         table[ClassIndex.STRING][MethodIndex.OP_LSHIFT] = RubyString.OP_LSHIFT_SWITCHVALUE;
60         table[ClassIndex.STRING][MethodIndex.EMPTY_P] = RubyString.EMPTY_P_SWITCHVALUE;
61     }
62     
63 }
64
Popular Tags