jbil.util
Class ArrayPrinter

java.lang.Object
  extended by jbil.util.ArrayPrinter

public class ArrayPrinter
extends java.lang.Object

Utility functions for printing arrays.

Author:
Paulo G. S. da Fonseca

Constructor Summary
ArrayPrinter()
           
 
Method Summary
static void printArray(double[] v)
          Prints a double array in standard output.
static void printArray(int[] v)
          Prints an int array with a given name in standard output.
static void printArray(java.io.PrintStream stream, java.lang.String open, java.lang.String close, java.lang.String separator, java.lang.String format, double[] v)
          Prints a double array.
static void printArray(java.io.PrintStream stream, java.lang.String open, java.lang.String close, java.lang.String separator, java.lang.String format, int[] v)
          Prints an int array.
static void printArray(java.io.PrintWriter writer, java.lang.String open, java.lang.String close, java.lang.String separator, java.lang.String format, double[] v)
          Prints a double array.
static void printArray(java.io.PrintWriter writer, java.lang.String open, java.lang.String close, java.lang.String separator, java.lang.String format, int[] v)
          Prints an int array.
static void printAsRArray(java.io.PrintStream stream, java.lang.String name, java.lang.String format, double[] v)
          Prints a double array as a R array definition.
static void printAsRArray(java.io.PrintStream stream, java.lang.String name, java.lang.String format, java.lang.Double[] v)
          Prints a Double array as a R array definition.
static void printAsRMatrix(java.io.PrintStream stream, java.lang.String name, java.lang.String format, double[][] v)
          Prints a double bi-dimensional array as a R matrix definition.
static void printAsRMatrix(java.io.PrintStream stream, java.lang.String name, java.lang.String format, java.lang.Double[][] v)
          Prints a Double bi-dimensional array as a R matrix definition.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArrayPrinter

public ArrayPrinter()
Method Detail

printArray

public static void printArray(double[] v)
Prints a double array in standard output.

Parameters:
v - The array to print.

printArray

public static void printArray(java.io.PrintStream stream,
                              java.lang.String open,
                              java.lang.String close,
                              java.lang.String separator,
                              java.lang.String format,
                              double[] v)
Prints a double array.

Parameters:
stream - The stream where to print.
open - The opening delimiter of the array.
close - The closing delimiter of the array
separator - The element separator.
format - The print format of the array elements (e.g. "%f")
v - The array to print.

printArray

public static void printArray(java.io.PrintWriter writer,
                              java.lang.String open,
                              java.lang.String close,
                              java.lang.String separator,
                              java.lang.String format,
                              double[] v)
Prints a double array.

Parameters:
writer - The writer used to print.
open - The opening delimiter of the array.
close - The closing delimiter of the array
separator - The element separator.
format - The print format of the array elements (e.g. "%f")
v - The array to print.

printArray

public static void printArray(int[] v)
Prints an int array with a given name in standard output.

Parameters:
v - The array to print.

printArray

public static void printArray(java.io.PrintStream stream,
                              java.lang.String open,
                              java.lang.String close,
                              java.lang.String separator,
                              java.lang.String format,
                              int[] v)
Prints an int array.

Parameters:
stream - The stream where to print.
open - The opening delimiter of the array.
close - The closing delimiter of the array
separator - The element separator.
format - The print format of the array elements (e.g. "%f")
v - The array to print.

printArray

public static void printArray(java.io.PrintWriter writer,
                              java.lang.String open,
                              java.lang.String close,
                              java.lang.String separator,
                              java.lang.String format,
                              int[] v)
Prints an int array.

Parameters:
writer - The writer used to print.
open - The opening delimiter of the array.
close - The closing delimiter of the array
separator - The element separator.
format - The print format of the array elements (e.g. "%f")
v - The array to print.

printAsRArray

public static void printAsRArray(java.io.PrintStream stream,
                                 java.lang.String name,
                                 java.lang.String format,
                                 double[] v)
Prints a double array as a R array definition. (e.g. x=c(0.0,1.0,2.0) )

Parameters:
stream - The stream where to print.
name - the name of the array.
format - The print format of the array elements (e.g. "%f")
v - The array to print.

printAsRArray

public static void printAsRArray(java.io.PrintStream stream,
                                 java.lang.String name,
                                 java.lang.String format,
                                 java.lang.Double[] v)
Prints a Double array as a R array definition. (e.g. x=c(0.0,1.0,2.0) )

Parameters:
stream - The stream where to print.
name - the name of the array.
format - The print format of the array elements (e.g. "%f")
v - The array to print.

printAsRMatrix

public static void printAsRMatrix(java.io.PrintStream stream,
                                  java.lang.String name,
                                  java.lang.String format,
                                  double[][] v)
Prints a double bi-dimensional array as a R matrix definition.

Parameters:
stream - The stream where to print.
name - the name of the matrix.
format - The print format of the array elements (e.g. "%f")
v - The array to print.

printAsRMatrix

public static void printAsRMatrix(java.io.PrintStream stream,
                                  java.lang.String name,
                                  java.lang.String format,
                                  java.lang.Double[][] v)
Prints a Double bi-dimensional array as a R matrix definition.

Parameters:
stream - The stream where to print.
name - the name of the matrix.
format - The print format of the array elements (e.g. "%f")
v - The array to print.