01 /*
02 * $Id: ListCompareElements2.java,v 1.8 2006/08/18 06:46:32 koga Exp $
03 *
04 * Copyright (C) 2004 Koga Laboratory. All rights reserved.
05 *
06 */
07 package matxbook.chap18;
08
09 import org.mklab.nfc.matrix.BooleanMatrix;
10 import org.mklab.nfc.matx.MatxList;
11
12
13 /**
14 * 条件を満たすリストの成分を求めるサンプルです。
15 * @author koga
16 * @version $Revision: 1.8 $, 2004/04/21
17 */
18 public class ListCompareElements2 {
19
20 /**
21 * メインメソッド
22 *
23 * @param args コマンドライン引数
24 */
25 @SuppressWarnings("nls")
26 public static void main(String[] args) {
27 int[] aa = new int[] {1, 2, 3, 4, 5, 6, 7};
28 int[] bb = new int[] {0, 3, 5, 3, 3, 6, 8};
29 MatxList a = new MatxList(7);
30 MatxList b = new MatxList(7);
31 for (int i = 0; i < 7; i++) {
32 a.set(i + 1, aa[i]);
33 b.set(i + 1, bb[i]);
34 }
35 BooleanMatrix bm = a.compareElementWise(b, ".<");
36 MatxList c = a.getSubList(bm.find());
37 c.print("a(a .< b)");
38 }
39 }
|