MmFormatWrite.java
01 /*
02  * $Id: MmFormatWrite.java,v 1.6 2008/02/02 05:53:02 koga Exp $
03  *
04  * Copyright (C) 2004 Koga Laboratory. All rights reserved.
05  *
06  */
07 package matxbook.chap14;
08 
09 import java.io.FileWriter;
10 import java.io.IOException;
11 import java.io.Writer;
12 
13 import org.mklab.nfc.matrix.DoubleMatrix;
14 import org.mklab.nfc.matx.MatxInteger;
15 import org.mklab.nfc.matx.MatxList;
16 import org.mklab.nfc.matx.MatxString;
17 import org.mklab.nfc.scalar.DoubleComplexNumber;
18 
19 
20 /**
21  @author koga
22  @version $Revision: 1.6 $, 2004/04/29
23  */
24 public class MmFormatWrite {
25 
26   /**
27    * メインメソッド
28    
29    @param args コマンドライン引数
30    @throws IOException ファイルに出力できない場合
31    */
32   @SuppressWarnings("nls")
33   public static void main(String[] argsthrows IOException {
34     int a = 1;
35     String b = "hello";
36     DoubleMatrix c = new DoubleMatrix(new double[][] { {12}{34}});
37     MatxList d = new MatxList(new Object[] {new Integer(1)new Double(1.2)new DoubleComplexNumber(34)});
38 
39     Writer output = new FileWriter("data.mm");
40     MatxInteger.writeMmFormat(a, output, "a");
41     MatxString.writeMmFormat(b, output, "b");
42     c.writeMmFormat(output, "c"true);
43     d.writeMmFormat(output, "d"true);
44     output.close();
45   }
46 }