File: Test.java

package info (click to toggle)
ruby-rjb 1.5.5-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster
  • size: 704 kB
  • sloc: ansic: 3,859; ruby: 2,604; java: 247; makefile: 35; sh: 3
file content (143 lines) | stat: -rw-r--r-- 4,010 bytes parent folder | download | duplicates (2)
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
//
// $Id: Test.java 168 2011-07-15 18:57:04Z arton $
//
package jp.co.infoseek.hp.arton.rjb;
import java.net.URI;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Comparator;
import java.util.SortedMap;
import java.util.TreeMap;
import java.math.BigDecimal;

public class Test {
    public String concat(Iterator i) {
	StringBuffer sb = new StringBuffer();
	for (; i.hasNext(); ) {
	    sb.append(i.next());
	}
	return new String(sb);
    }
    public int check(Comparator<Integer> c, int x, int y) {
	return c.compare(new Integer(x), new Integer(y));
    }
    public String[][] getStringArrayOfArrays() {
	return new String[][] { { "abc", "def" }, { "123", "456" } };
    }

    public int[][] getIntArrayOfArrays() {
	return new int[][] { { 1,2,3 }, { 4, 5, 6} };
    }

    public Object[][][] getMixedArray() {
	return new Object[][][] {
 		{
			{12, "test", new Integer(15), new BigDecimal("1234.567")}, {}
		},
		{
			{"a string","another string"}, {1,2,3}, {4,5,6}
		},
		{
		},
	};
    }

    public String[][][][] getSizedArray() {
	String[][][][] sizedArray = new String[1][2][3][4];
	sizedArray[0][1][2][3]="find me";
	return sizedArray;
    }

    public String[] joinStringArray(String[][] aa) {
        ArrayList<String> list = new ArrayList<String>();
        for (int i = 0; i < aa.length; i++) {
            for (int j = 0; j < aa[i].length; j++) { 
                list.add(aa[i][j]);
            }
        }
        return list.toArray(new String[list.size()]);
    }
    public Integer[] joinIntArray(int[][] aa) {
        ArrayList<Integer> list = new ArrayList<Integer>();
        for (int i = 0; i < aa.length; i++) {
            for (int j = 0; j < aa[i].length; j++) { 
                list.add(aa[i][j]);
            }
        }
        return list.toArray(new Integer[list.size()]);
    }
    public int[][][] throughIntArray(int[][][] a) {
        return a;
    }
    public Object getObjectArray() {
	return new Object[] {
	    new Integer(1), "Hello World !",
	};
    }
    public Object getObjectArrayOfArray() {
	return new Object[][] {
	    { new Integer(1), "Hello World !", },
	    { new Integer(2), "Hello World !!", },
	};
    }
    public void callWithArrays(byte[] ab, short[] as, int[] ai,
				long[] al, double[] ad, float[] af,
				String[] ax, Object[] ao)
    {
    }
    public enum TestTypes {
        ONE, TWO, THREE
    }

    public SortedMap<String, byte[]> getSortedMap() {
        SortedMap<String, byte[]> map = new TreeMap<String, byte[]>();
        map.put("abc", new byte[]{0,1,2,3,4});
        map.put("def", new byte[]{5,6,7,8,9});
        return map;
    }

    public static SortedMap<String, byte[]> getSortedMapS() {
        SortedMap<String, byte[]> map = new TreeMap<String, byte[]>();
        map.put("abc", new byte[]{0,1,2,3,4});
        map.put("def", new byte[]{5,6,7,8,9});
        return map;
    }

    public SortedMap<String, byte[]> throughSortedMap(SortedMap<String, byte[]> map) {
        SortedMap<String, byte[]> value = map;
        return value;
    }

    public static void setSortedMapS(SortedMap<String, byte[]> map) {
        SortedMap<String, byte[]> value = map;
    }

    public boolean isSameString(String s) {
	return "漢字テキスト".equals(s);
    }

    public String getUmlaut() {
	return "\u01D6" + "\u00FC\u0304" + "\u0075\u0308\u0304" + "\ud869\udeb2" + "\u304b\u309a";
    }

    public String[] getJavaTypedArray(String[] o, Integer[] n, URI[] u) {
        return new String[] { o.getClass().getName(),
                              n.getClass().getName(),
                              u.getClass().getName() };
    }

    public void causeException() {
	try {
	    throw new IllegalArgumentException("bad argument");
	} catch (Exception e) {
	    throw new IllegalStateException("outer exception", e);
	}
    }

    public String helloData = "Hello World !!";

    public static void main(String[] args) {
	Test test = new Test();
	System.out.println(test.getUmlaut());
    }
}