01 /*
02 * $Id: ListCompareElements4.java,v 1.8 2006/08/18 06:46:33 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 * @author koga
15 * @version $Revision: 1.8 $, 2004/04/21
16 */
17 public class ListCompareElements4 {
18
19 /**
20 * メインメソッド
21 *
22 * @param args コマンドライン引数
23 */
24 @SuppressWarnings("nls")
25 public static void main(String[] args) {
26 double[] aa = new double[] {1, 2.1, 3, 4.2, 5, 7.3, 9.4, 10.5};
27 MatxList a = new MatxList(aa.length);
28 for (int i = 0; i < aa.length; i++) {
29 a.set(i + 1, aa[i]);
30 }
31 BooleanMatrix bm1 = a.compareElementWise(3, ".>=");
32 BooleanMatrix bm2 = a.compareElementWise(9, ".<=");
33 BooleanMatrix bm3 = bm1.andElementWise(bm2);
34 MatxList b = a.getSubList(bm3.find());
35 b.print("a(3 .<= a && a .<= 9)");
36 }
37 }
|