ListElementSample.java
01 /*
02  * $Id: ListElementSample.java,v 1.11 2008/02/02 05:53:02 koga Exp $
03  *
04  * Copyright (C) 2004 Koga Laboratory. All rights reserved.
05  *
06  */
07 package matxbook.chap03;
08 
09 import org.mklab.nfc.matrix.DoubleMatrix;
10 import org.mklab.nfc.matrix.Matrix;
11 import org.mklab.nfc.matx.MatxList;
12 import org.mklab.nfc.scalar.DoubleComplexNumber;
13 
14 
15 /**
16  * MaTXリストの成分の参照のサンプルです。
17  
18  @author koga
19  @version $Revision: 1.11 $, 2004/04/09
20  */
21 public class ListElementSample {
22 
23   /**
24    * メインメソッド
25    
26    @param args コマンドライン引数
27    */
28   @SuppressWarnings("nls")
29   public static void main(String[] args) {
30     Integer i = Integer.valueOf(4);
31     Double d = new Double(3.14);
32     DoubleComplexNumber c = new DoubleComplexNumber(34);
33     DoubleMatrix m = new DoubleMatrix(new double[] {12});
34     MatxList x = new MatxList(new Object[] {i, d, c, m});
35 
36     int ii = x.getInt(1);
37     double dd = x.getDouble(2);
38     DoubleComplexNumber cc = x.getComplex(3);
39     Matrix mm = x.getMatrix(4);
40     
41     System.out.println("ii = " + ii);
42     System.out.println("dd = " + dd);
43     System.out.println("cc = " + cc);
44     mm.print("mm");
45   }
46 }