Modify class description
This commit is contained in:
@@ -11,6 +11,9 @@ import physics.Nyquist;
|
||||
import stdlib.Color;
|
||||
import stdlib.StdDraw;
|
||||
|
||||
/**
|
||||
* @author Daniel Weschke
|
||||
*/
|
||||
public class Draw extends StdDraw{
|
||||
static Thread plot;
|
||||
static JLabel infoLabel;
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package exception;
|
||||
|
||||
/**
|
||||
* @author Daniel Weschke
|
||||
*/
|
||||
public class ComplexException extends Exception {
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package exception;
|
||||
|
||||
/**
|
||||
* @author Daniel Weschke
|
||||
*/
|
||||
public class IllegalDimensionException extends Exception {
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package exception;
|
||||
|
||||
/**
|
||||
* @author Daniel Weschke
|
||||
*/
|
||||
public class IllegalSetupException extends Exception {
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package exception;
|
||||
|
||||
/**
|
||||
* @author Daniel Weschke
|
||||
*/
|
||||
public class NoSquareException extends Exception {
|
||||
|
||||
private static final long serialVersionUID = -4049443845429534140L;
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package exception;
|
||||
|
||||
/**
|
||||
* @author Daniel Weschke
|
||||
*/
|
||||
public class SingularException extends Exception {
|
||||
|
||||
private static final long serialVersionUID = -5121014712549208662L;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
/**
|
||||
* Exceptions
|
||||
*
|
||||
* @author Daniel Weschke
|
||||
*/
|
||||
package exception;
|
||||
@@ -14,9 +14,7 @@ import exception.NoSquareException;
|
||||
import exception.SingularException;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Weschke
|
||||
*
|
||||
*/
|
||||
public class Polynomial{
|
||||
protected String symbolic = "x";
|
||||
|
||||
@@ -2,7 +2,9 @@ package math.equation;
|
||||
|
||||
import math.number.NumberComplex;
|
||||
|
||||
|
||||
/**
|
||||
* @author Daniel Weschke
|
||||
*/
|
||||
public class PolynomialComplex {
|
||||
private Polynomial re;
|
||||
private Polynomial im;
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package math.equation;
|
||||
|
||||
|
||||
/**
|
||||
* @author Daniel Weschke
|
||||
*/
|
||||
public class RationalPolynomial {
|
||||
public Polynomial a;
|
||||
public Polynomial b;
|
||||
|
||||
@@ -3,10 +3,8 @@ package math.equation;
|
||||
import math.number.NumberComplex;
|
||||
|
||||
/**
|
||||
* quotient
|
||||
* a(x) + b(x)i / c(x) + d(x)i
|
||||
* @author Daniel
|
||||
*
|
||||
* quotient ( a(x) + b(x)i ) / ( c(x) + d(x)i )
|
||||
* @author Daniel Weschke
|
||||
*/
|
||||
public class RationalPolynomialComplex {
|
||||
|
||||
|
||||
@@ -4,6 +4,9 @@ import java.text.DecimalFormat;
|
||||
|
||||
import math.matrix.Vector;
|
||||
|
||||
/**
|
||||
* @author Daniel Weschke
|
||||
*/
|
||||
public class Point {
|
||||
protected double[] point;
|
||||
protected int n;
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package math.geometry;
|
||||
|
||||
/**
|
||||
* @author Daniel Weschke
|
||||
*/
|
||||
public class PointPolar {
|
||||
double r;
|
||||
double theta;
|
||||
|
||||
@@ -1,13 +1,9 @@
|
||||
package math.geometry;
|
||||
|
||||
/*************************************************************************
|
||||
* Compilation: javac PointPolar.java
|
||||
* Execution: java PointPolar
|
||||
*
|
||||
/**
|
||||
* Implementation of 2D point using polar coordinates.
|
||||
*
|
||||
*************************************************************************/
|
||||
|
||||
* @author Daniel Weschke
|
||||
*/
|
||||
public final class PointPolar2D {
|
||||
private final double r;
|
||||
private final double theta;
|
||||
@@ -38,8 +34,6 @@ public final class PointPolar2D {
|
||||
|
||||
public String toString() { return "(" + x() + ", " + y() + ")"; }
|
||||
|
||||
|
||||
|
||||
// test client
|
||||
public static void main(String[] args) {
|
||||
PointPolar2D p = new PointPolar2D();
|
||||
|
||||
@@ -2,16 +2,17 @@ package math.matrix;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/** Cholesky Decomposition.
|
||||
<P>
|
||||
For a symmetric, positive definite matrix A, the Cholesky decomposition
|
||||
is an lower triangular matrix L so that A = L*L'.
|
||||
<P>
|
||||
If the matrix is not symmetric or positive definite, the constructor
|
||||
returns a partial decomposition and sets an internal flag that may
|
||||
be queried by the isSPD() method.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Cholesky Decomposition.
|
||||
* <P>
|
||||
* For a symmetric, positive definite matrix A, the Cholesky decomposition
|
||||
* is an lower triangular matrix L so that A = L*L'.
|
||||
* <P>
|
||||
* If the matrix is not symmetric or positive definite, the constructor
|
||||
* returns a partial decomposition and sets an internal flag that may
|
||||
* be queried by the isSPD() method.
|
||||
* @author Daniel Weschke
|
||||
*/
|
||||
public class CholeskyDecomposition implements Serializable {
|
||||
|
||||
/* ------------------------
|
||||
|
||||
@@ -2,6 +2,11 @@ package math.matrix;
|
||||
|
||||
import exception.IllegalDimensionException;
|
||||
|
||||
/**
|
||||
* Diagonal matrix object d<sub>ij</sub>∈ℝ, i≠j=0
|
||||
* with m rows and n columns
|
||||
* @author Daniel Weschke
|
||||
*/
|
||||
public class Diagonal extends Matrix{
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
package math.matrix;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 2D diagonal matrix object d<sub>ij</sub>∈ℝ, i≠j=0
|
||||
* with 2 rows and 2 columns
|
||||
* @author Daniel Weschke
|
||||
*/
|
||||
public class Diagonal2D extends Matrix2D {
|
||||
|
||||
/**
|
||||
@@ -9,14 +12,10 @@ public class Diagonal2D extends Matrix2D {
|
||||
*/
|
||||
private static final long serialVersionUID = 553077525134866149L;
|
||||
|
||||
public Diagonal2D(int n){
|
||||
this(n,n);
|
||||
}
|
||||
|
||||
public Diagonal2D(int m, int n){
|
||||
this.m = m;
|
||||
this.n = n;
|
||||
data = new double[m>n?m:n];
|
||||
public Diagonal2D(){
|
||||
m = 2;
|
||||
n = 2;
|
||||
data = new double[2];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -27,7 +26,7 @@ public class Diagonal2D extends Matrix2D {
|
||||
*/
|
||||
public static Diagonal2D identity(int n){
|
||||
int i;
|
||||
Diagonal2D c = new Diagonal2D(n);
|
||||
Diagonal2D c = new Diagonal2D();
|
||||
for(i=0; i<n; i++)
|
||||
c.set(i, 1);
|
||||
return c;
|
||||
|
||||
@@ -4,22 +4,23 @@ import java.io.Serializable;
|
||||
|
||||
import math.Maths;
|
||||
|
||||
/** Eigenvalues and eigenvectors of a real matrix.
|
||||
<P>
|
||||
If A is symmetric, then A = V*D*V' where the eigenvalue matrix D is
|
||||
diagonal and the eigenvector matrix V is orthogonal.
|
||||
I.e. A = V.times(D.times(V.transpose())) and
|
||||
V.times(V.transpose()) equals the identity matrix.
|
||||
<P>
|
||||
If A is not symmetric, then the eigenvalue matrix D is block diagonal
|
||||
with the real eigenvalues in 1-by-1 blocks and any complex eigenvalues,
|
||||
lambda + i*mu, in 2-by-2 blocks, [lambda, mu; -mu, lambda]. The
|
||||
columns of V represent the eigenvectors in the sense that A*V = V*D,
|
||||
i.e. A.times(V) equals V.times(D). The matrix V may be badly
|
||||
conditioned, or even singular, so the validity of the equation
|
||||
A = V*D*inverse(V) depends upon V.cond().
|
||||
**/
|
||||
|
||||
/**
|
||||
* Eigenvalues and eigenvectors of a real matrix.
|
||||
* <P>
|
||||
* If A is symmetric, then A = V*D*V' where the eigenvalue matrix D is
|
||||
* diagonal and the eigenvector matrix V is orthogonal.
|
||||
* I.e. A = V.times(D.times(V.transpose())) and
|
||||
* V.times(V.transpose()) equals the identity matrix.
|
||||
* <P>
|
||||
* If A is not symmetric, then the eigenvalue matrix D is block diagonal
|
||||
* with the real eigenvalues in 1-by-1 blocks and any complex eigenvalues,
|
||||
* lambda + i*mu, in 2-by-2 blocks, [lambda, mu; -mu, lambda]. The
|
||||
* columns of V represent the eigenvectors in the sense that A*V = V*D,
|
||||
* i.e. A.times(V) equals V.times(D). The matrix V may be badly
|
||||
* conditioned, or even singular, so the validity of the equation
|
||||
* A = V*D*inverse(V) depends upon V.cond().
|
||||
* @author Daniel Weschke
|
||||
*/
|
||||
public class EigenvalueDecomposition implements Serializable {
|
||||
|
||||
/**
|
||||
|
||||
@@ -14,6 +14,7 @@ import java.io.Serializable;
|
||||
* singular, so the constructor will never fail. The primary use of the
|
||||
* LU decomposition is in the solution of square systems of simultaneous
|
||||
* linear equations. This will fail if isNonsingular() returns false.
|
||||
* @author Daniel Weschke
|
||||
*/
|
||||
public class LUDecomposition implements Serializable {
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ import exception.NoSquareException;
|
||||
import exception.SingularException;
|
||||
|
||||
/**
|
||||
* Matrix object M∈ℝ
|
||||
* Matrix object m<sub>ij</sub>∈ℝ
|
||||
* with m rows and n columns
|
||||
* @author Daniel Weschke
|
||||
* @version 01 November 2013
|
||||
|
||||
@@ -9,9 +9,9 @@ import exception.NoSquareException;
|
||||
import exception.SingularException;
|
||||
|
||||
/**
|
||||
* Matrix 2xn, m is always 2
|
||||
* @author Daniel
|
||||
*
|
||||
* 2D matrix object m<sub>ij</sub>∈ℝ
|
||||
* with 2 rows and n columns
|
||||
* @author Daniel Weschke
|
||||
*/
|
||||
public class Matrix2D extends Matrix{
|
||||
|
||||
|
||||
@@ -6,7 +6,11 @@ import exception.ComplexException;
|
||||
import exception.IllegalDimensionException;
|
||||
import exception.NoSquareException;
|
||||
|
||||
|
||||
/**
|
||||
* 3D matrix object m<sub>ij</sub>∈ℝ
|
||||
* with 3 rows and n columns
|
||||
* @author Daniel Weschke
|
||||
*/
|
||||
public class Matrix3D extends Matrix{
|
||||
/**
|
||||
* UID
|
||||
|
||||
@@ -15,6 +15,7 @@ import math.Maths;
|
||||
* QR decomposition is in the least squares solution of nonsquare systems
|
||||
* of simultaneous linear equations. This will fail if isFullRank()
|
||||
* returns false.
|
||||
* @author Daniel Weschke
|
||||
*/
|
||||
public class QRDecomposition implements Serializable {
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ import math.Maths;
|
||||
* The singular value decompostion always exists, so the constructor will
|
||||
* never fail. The matrix condition number and the effective numerical
|
||||
* rank can be computed from this decomposition.
|
||||
* @author Daniel Weschke
|
||||
*/
|
||||
public class SingularValueDecomposition implements Serializable {
|
||||
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
package math.matrix;
|
||||
|
||||
/**
|
||||
* Second-order tensor (3x3 matrix).
|
||||
* @author Daniel Weschke
|
||||
*/
|
||||
public class TensorII extends Matrix3D {
|
||||
|
||||
/**
|
||||
|
||||
@@ -4,9 +4,8 @@ import math.Maths;
|
||||
import exception.IllegalDimensionException;
|
||||
|
||||
/**
|
||||
* Tensor 2x2
|
||||
* @author Daniel
|
||||
*
|
||||
* Second-order tensor (2x2 matrix).
|
||||
* @author Daniel Weschke
|
||||
*/
|
||||
public class TensorII2D extends Matrix2D {
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import thisandthat.WObject;
|
||||
import exception.IllegalDimensionException;
|
||||
|
||||
/**
|
||||
* Vector of real numbers, v∈ℝ.
|
||||
* Vector of real numbers, v<sub>i</sub>∈ℝ.
|
||||
* @author Daniel Weschke
|
||||
*/
|
||||
public class Vector extends WObject implements Cloneable, Serializable{
|
||||
|
||||
@@ -2,6 +2,10 @@ package math.matrix;
|
||||
|
||||
import exception.IllegalDimensionException;
|
||||
|
||||
/**
|
||||
* 2D vector of real numbers, v<sub>i</sub>∈ℝ.
|
||||
* @author Daniel Weschke
|
||||
*/
|
||||
public class Vector2D extends Vector{
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,6 +2,10 @@ package math.matrix;
|
||||
|
||||
import exception.IllegalDimensionException;
|
||||
|
||||
/**
|
||||
* 3D vector of real numbers, v<sub>i</sub>∈ℝ.
|
||||
* @author Daniel Weschke
|
||||
*/
|
||||
public class Vector3D extends Vector{
|
||||
|
||||
/**
|
||||
|
||||
@@ -5,8 +5,7 @@ import thisandthat.WObject;
|
||||
|
||||
/**
|
||||
* Complex vector v<sub>i</sub>∈ℂ
|
||||
* @author Daniel
|
||||
*
|
||||
* @author Daniel Weschke
|
||||
*/
|
||||
public class VectorComplex extends WObject{
|
||||
/**
|
||||
|
||||
@@ -2,6 +2,9 @@ package math.number;
|
||||
|
||||
import thisandthat.WObject;
|
||||
|
||||
/**
|
||||
* @author Daniel Weschke
|
||||
*/
|
||||
public class Number extends WObject {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
@@ -2,7 +2,6 @@ package math.number;
|
||||
|
||||
import math.Maths;
|
||||
|
||||
|
||||
/**
|
||||
* Data type for complex number ∈ℂ which defines complex arithmetic and
|
||||
* mathematical functions.
|
||||
|
||||
@@ -2,7 +2,9 @@ package math.statistics;
|
||||
|
||||
import math.Maths;
|
||||
|
||||
|
||||
/**
|
||||
* @author Daniel Weschke
|
||||
*/
|
||||
public class Probability {
|
||||
|
||||
/**
|
||||
|
||||
@@ -14,6 +14,9 @@ import math.matrix.Vector;
|
||||
import stdlib.StdDraw;
|
||||
import awt.Draw;
|
||||
|
||||
/**
|
||||
* @author Daniel Weschke
|
||||
*/
|
||||
public class Nyquist{
|
||||
Draw nyquist = new Draw();
|
||||
static JTextField tf = new JTextField();
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package stdlib;
|
||||
|
||||
|
||||
/**
|
||||
* @author Daniel Weschke
|
||||
*/
|
||||
public class Color extends java.awt.Color{
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,62 +1,50 @@
|
||||
package stdlib;
|
||||
|
||||
/*************************************************************************
|
||||
* Compilation: javac StdArrayIO.java
|
||||
* Execution: java StdArrayIO < input.txt
|
||||
*
|
||||
* A library for reading in 1D and 2D arrays of integers, doubles,
|
||||
* and booleans from standard input and printing them out to
|
||||
* standard output.
|
||||
*
|
||||
* % more tinyDouble1D.txt
|
||||
* 4
|
||||
* .000 .246 .222 -.032
|
||||
*
|
||||
* % more tinyDouble2D.txt
|
||||
* 4 3
|
||||
* .000 .270 .000
|
||||
* .246 .224 -.036
|
||||
* .222 .176 .0893
|
||||
* -.032 .739 .270
|
||||
*
|
||||
* % more tinyBoolean2D.txt
|
||||
* 4 3
|
||||
* 1 1 0
|
||||
* 0 0 0
|
||||
* 0 1 1
|
||||
* 1 1 1
|
||||
*
|
||||
* % cat tinyDouble1D.txt tinyDouble2D.txt tinyBoolean2D.txt | java StdArrayIO
|
||||
* 4
|
||||
* 0.00000 0.24600 0.22200 -0.03200
|
||||
*
|
||||
* 4 3
|
||||
* 0.00000 0.27000 0.00000
|
||||
* 0.24600 0.22400 -0.03600
|
||||
* 0.22200 0.17600 0.08930
|
||||
* 0.03200 0.73900 0.27000
|
||||
*
|
||||
* 4 3
|
||||
* 1 1 0
|
||||
* 0 0 0
|
||||
* 0 1 1
|
||||
* 1 1 1
|
||||
*
|
||||
*************************************************************************/
|
||||
|
||||
|
||||
/**
|
||||
* <i>Standard array IO</i>. This class provides methods for reading
|
||||
* in 1D and 2D arrays from standard input and printing out to
|
||||
* standard output.
|
||||
* <p>
|
||||
* For additional documentation, see
|
||||
* <a href="http://introcs.cs.princeton.edu/22libary">Section 2.2</a> of
|
||||
* <i>Introduction to Programming in Java: An Interdisciplinary Approach</i>
|
||||
* by Robert Sedgewick and Kevin Wayne.
|
||||
* <i>Standard array IO</i>. This class provides methods for reading
|
||||
* in 1D and 2D arrays of integers, doubles, and booleans from standard
|
||||
* input and printing out to standard output.
|
||||
* <p>
|
||||
* For additional documentation, see
|
||||
* <a href="http://introcs.cs.princeton.edu/22libary">Section 2.2</a> of
|
||||
* <i>Introduction to Programming in Java: An Interdisciplinary Approach</i>
|
||||
* by Robert Sedgewick and Kevin Wayne.
|
||||
*
|
||||
* @author Robert Sedgewick
|
||||
* @author Kevin Wayne
|
||||
* % more tinyDouble1D.txt
|
||||
* 4
|
||||
* .000 .246 .222 -.032
|
||||
*
|
||||
* % more tinyDouble2D.txt
|
||||
* 4 3
|
||||
* .000 .270 .000
|
||||
* .246 .224 -.036
|
||||
* .222 .176 .0893
|
||||
* -.032 .739 .270
|
||||
*
|
||||
* % more tinyBoolean2D.txt
|
||||
* 4 3
|
||||
* 1 1 0
|
||||
* 0 0 0
|
||||
* 0 1 1
|
||||
* 1 1 1
|
||||
*
|
||||
* % cat tinyDouble1D.txt tinyDouble2D.txt tinyBoolean2D.txt | java StdArrayIO
|
||||
* 4
|
||||
* 0.00000 0.24600 0.22200 -0.03200
|
||||
*
|
||||
* 4 3
|
||||
* 0.00000 0.27000 0.00000
|
||||
* 0.24600 0.22400 -0.03600
|
||||
* 0.22200 0.17600 0.08930
|
||||
* 0.03200 0.73900 0.27000
|
||||
*
|
||||
* 4 3
|
||||
* 1 1 0
|
||||
* 0 0 0
|
||||
* 0 1 1
|
||||
* 1 1 1
|
||||
*
|
||||
* @author Daniel Weschke
|
||||
*/
|
||||
public class StdArrayIO {
|
||||
|
||||
|
||||
@@ -1,28 +1,5 @@
|
||||
package stdlib;
|
||||
|
||||
/*************************************************************************
|
||||
* Compilation: javac StdDraw.java
|
||||
* Execution: java StdDraw
|
||||
*
|
||||
* Standard drawing library. This class provides a basic capability for
|
||||
* creating drawings with your programs. It uses a simple graphics model that
|
||||
* allows you to create drawings consisting of points, lines, and curves
|
||||
* in a window on your computer and to save the drawings to a file.
|
||||
*
|
||||
* Todo
|
||||
* ----
|
||||
* - Add support for gradient fill, etc.
|
||||
*
|
||||
* Remarks
|
||||
* -------
|
||||
* - don't use AffineTransform for rescaling since it inverts
|
||||
* images and strings
|
||||
* - careful using setFont in inner loop within an animation -
|
||||
* it can cause flicker
|
||||
*
|
||||
*************************************************************************/
|
||||
|
||||
|
||||
import java.awt.BasicStroke;
|
||||
import java.awt.FileDialog;
|
||||
import java.awt.Font;
|
||||
@@ -63,13 +40,24 @@ import javax.swing.JMenuItem;
|
||||
import javax.swing.KeyStroke;
|
||||
|
||||
/**
|
||||
* <i>Standard draw</i>. This class provides a basic capability for
|
||||
* creating drawings with your programs. It uses a simple graphics model that
|
||||
* allows you to create drawings consisting of points, lines, and curves
|
||||
* in a window on your computer and to save the drawings to a file.
|
||||
* <p>
|
||||
* For additional documentation, see <a href="http://introcs.cs.princeton.edu/15inout">Section 1.5</a> of
|
||||
* <i>Introduction to Programming in Java: An Interdisciplinary Approach</i> by Robert Sedgewick and Kevin Wayne.
|
||||
* <i>Standard draw</i>. This class provides a basic capability for
|
||||
* creating drawings with your programs. It uses a simple graphics model that
|
||||
* allows you to create drawings consisting of points, lines, and curves
|
||||
* in a window on your computer and to save the drawings to a file.
|
||||
* <p>
|
||||
* For additional documentation, see <a href="http://introcs.cs.princeton.edu/15inout">Section 1.5</a> of
|
||||
* <i>Introduction to Programming in Java: An Interdisciplinary Approach</i> by Robert Sedgewick and Kevin Wayne.
|
||||
* Todo
|
||||
* ----
|
||||
* - Add support for gradient fill, etc.
|
||||
*
|
||||
* Remarks
|
||||
* -------
|
||||
* - don't use AffineTransform for rescaling since it inverts
|
||||
* images and strings
|
||||
* - careful using setFont in inner loop within an animation -
|
||||
* it can cause flicker
|
||||
* @author Daniel Weschke
|
||||
*/
|
||||
public class StdDraw implements ActionListener, MouseListener, MouseMotionListener, KeyListener {
|
||||
|
||||
|
||||
@@ -1,29 +1,22 @@
|
||||
package stdlib;
|
||||
|
||||
/*************************************************************************
|
||||
* Compilation: javac StdIn.java
|
||||
* Execution: java StdIn
|
||||
*
|
||||
* Reads in data of various types from standard input.
|
||||
*
|
||||
*************************************************************************/
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.util.Locale;
|
||||
import java.util.Scanner;
|
||||
|
||||
/**
|
||||
* <i>Standard input</i>. This class provides methods for reading strings
|
||||
* and numbers from standard input.
|
||||
* <p>
|
||||
* The Locale used is: language = English, country = US. This is consistent
|
||||
* with the formatting conventions with Java floating-point literals,
|
||||
* command-line arguments (via <tt>Double.parseDouble()</tt>)
|
||||
* and standard output (via <tt>System.out.print()</tt>). It ensures that
|
||||
* standard input works with the input files used in the textbook.
|
||||
* <p>
|
||||
* For additional documentation, see <a href="http://introcs.cs.princeton.edu/15inout">Section 1.5</a> of
|
||||
* <i>Introduction to Programming in Java: An Interdisciplinary Approach</i> by Robert Sedgewick and Kevin Wayne.
|
||||
* <i>Standard input</i>. This class provides methods for reading strings
|
||||
* and numbers from standard input.
|
||||
* <p>
|
||||
* The Locale used is: language = English, country = US. This is consistent
|
||||
* with the formatting conventions with Java floating-point literals,
|
||||
* command-line arguments (via <tt>Double.parseDouble()</tt>)
|
||||
* and standard output (via <tt>System.out.print()</tt>). It ensures that
|
||||
* standard input works with the input files used in the textbook.
|
||||
* <p>
|
||||
* For additional documentation, see <a href="http://introcs.cs.princeton.edu/15inout">Section 1.5</a> of
|
||||
* <i>Introduction to Programming in Java: An Interdisciplinary Approach</i> by Robert Sedgewick and Kevin Wayne.
|
||||
* @author Daniel Weschke
|
||||
*/
|
||||
public final class StdIn {
|
||||
|
||||
|
||||
@@ -1,24 +1,19 @@
|
||||
package stdlib;
|
||||
|
||||
/*************************************************************************
|
||||
* Compilation: javac StdOut.java
|
||||
* Execution: java StdOut
|
||||
*
|
||||
* Writes data of various types to standard output.
|
||||
*
|
||||
*************************************************************************/
|
||||
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* <i>Standard output</i>. This class provides methods for writing strings
|
||||
* and numbers to standard output.
|
||||
* <p>
|
||||
* For additional documentation, see <a href="http://introcs.cs.princeton.edu/15inout">Section 1.5</a> of
|
||||
* <i>Introduction to Programming in Java: An Interdisciplinary Approach</i> by Robert Sedgewick and Kevin Wayne.
|
||||
* <i>Standard output</i>. This class provides methods for writing strings
|
||||
* and numbers to standard output.
|
||||
* <p>
|
||||
* For additional documentation, see
|
||||
* <a href="http://introcs.cs.princeton.edu/15inout">Section 1.5</a> of
|
||||
* <i>Introduction to Programming in Java: An Interdisciplinary Approach</i>
|
||||
* by Robert Sedgewick and Kevin Wayne.
|
||||
* @author Daniel Weschke
|
||||
*/
|
||||
public final class StdOut {
|
||||
|
||||
|
||||
@@ -4,6 +4,9 @@ import java.util.Arrays;
|
||||
|
||||
import thisandthat.WObject;
|
||||
|
||||
/**
|
||||
* @author Daniel Weschke
|
||||
*/
|
||||
public class WString extends WObject{
|
||||
String str;
|
||||
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package thisandthat;
|
||||
|
||||
/**
|
||||
* @author Daniel Weschke
|
||||
*/
|
||||
public class WObject {
|
||||
private static boolean supressErrorMessage = false;
|
||||
private String name;
|
||||
|
||||
Reference in New Issue
Block a user