All Packages Class Hierarchy This Package Previous Next Index
Class cs101.util.Coerce
java.lang.Object
|
+----cs101.util.Coerce
- public final class Coerce
- extends Object
Coerce implements some coercion utilities for a variety of java
classes.
This file was created for
Rethinking CS101
project of Lynn Andrea Stein's AP Group at the MIT
Artificial Intelligence Laboratory.
- See Also:
- String, Double, Color
-
Coerce()
-
-
StringToColor(Object)
- StringToColor( String )
Given a string representing the name of one of java's built-in
colors, returns the corresponding Color object.
-
StringTodouble(String)
- StringTodouble( String )
Given a string representing a floating point number, returns the
corresponding (unwrapped) double.
Coerce
public Coerce()
StringTodouble
public static final double StringTodouble(String s)
- StringTodouble( String )
Given a string representing a floating point number, returns the
corresponding (unwrapped) double.
Note: this is not Double StringToDouble( String ), which
would be just Double.valueOf( s );
- Parameters:
- s - A string representing a floating point number.
- Returns:
- s the corresponding (unwrapped) double.
StringToColor
public static final Color StringToColor(Object colorName)
- StringToColor( String )
Given a string representing the name of one of java's built-in
colors, returns the corresponding Color object.
- Parameters:
- s - A string representing a java Color.
- Returns:
- s the corresponding Color object.
All Packages Class Hierarchy This Package Previous Next Index