Java Doc for TableFunction.java in  » Science » jcm1-source » edu » hws » jcm » functions » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Science » jcm1 source » edu.hws.jcm.functions 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   edu.hws.jcm.functions.FunctionParserExtension
      edu.hws.jcm.functions.TableFunction

TableFunction
public class TableFunction extends FunctionParserExtension (Code)
A TableFunction is a function that is specified by a table of (x,y)-points. Values are interpolated between the specified x-values. This can be done in several differnt ways; the method that is used is controlled by the "Style" property. Since a TableFunction extends FunctionParserExtension, a TableFunction can be added to a Parser (provided it has a name), and it can then be used in expressions parsed by that parser. Note that this class is meant to be used for functions that are defined by a fairly small number of points, since each function evaluation involves a linear search through the list of x-values of the defining points.


Field Summary
final public static  intPIECEWISE_LINEAR
     If the style of the function is set to PIECEWISE_LINEAR, then linear interpolation is used to find the value of the functions for x-values between the points that define the function.
final public static  intSMOOTH
     If the style of the function is set to SMOOTH, then cubic interpolation is used to find the value of the functions for x-values between the points that define the function.
final public static  intSTEP
     If the style of the function is set to STEP, then the function is piecewise constant, and the value of the function at x is taken from the nearest point in the list of points that define the function.
final public static  intSTEP_LEFT
     If the style of the function is set to STEP_LEFT, then the function is piecewise constant, and the value of the function at x is taken from the nearest point to the left in the list of points that define the function.
final public static  intSTEP_RIGHT
     If the style of the function is set to STEP_RIGHT, then the function is piecewise constant, and the value of the function at x is taken from the nearest point to the right in the list of points that define the function.

Constructor Summary
public  TableFunction()
     Create a TableFunction with SMOOTH style and no points.
public  TableFunction(int sytle)
     Create a TableFunction with specified style and no points.
Parameters:
  style - The style for the function: SMOOTH, PIECEWISE_LINEAR, STEP,STEP_LEFT, or STEP_RIGHT.

Method Summary
public  voidaddIntervals(int intervals, double xmin, double xmax)
     Add points to the table.
public  intaddPoint(double x, double y)
     Add a point with the specified x and y coordinates.
public  voidaddPoints(double[] xCoords, double[] yCoords)
     Add points to the table.
public  voidapply(StackOfDouble stack, Cases cases)
     Override method apply() from interface FunctionParserExtension, to handle cases properly.
public  voidcopyDataFrom(TableFunction source)
     Copy data from another TableFunction, except that the name of the funcion is not duplicated.
public  booleandependsOn(Variable wrt)
     Returns false.
public  Functionderivative(int wrt)
     Compute the derivative of this function.
public  Functionderivative(Variable wrt)
     Returns null. It really should be the constant function zero, but I don't expect this ever to be called.
public  intfindPoint(double x)
     If there is a point in the list with x-coordinate x, then this function returns the index of that point in the list (where the index of the first point is zero).
public  intgetArity()
     Returns the arity of the function, which is 1.
public  intgetPointCount()
     Gets the number of points in the table.
public  intgetStyle()
     Get the style of this TableFunction, which specifies how values are interpolated between points on the curve. The style of this TableFunction.
public  doublegetVal(double x)
     Get the value of the function at x, using interpolation if x lies between two x-coordinates in the list of points that define the function.
public  doublegetVal(double[] params)
     Get the value of the function at the specified parameter value.
public  doublegetValueWithCases(double[] params, Cases cases)
     Get the value of the function at the specified parameter value.
public  doublegetX(int i)
     Get the x-coordinate in the i-th point, where the first point is number zero.
public  doublegetY(int i)
     Get the y-coordinate in the i-th point, where the first point is number zero.
public  voidremoveAllPoints()
     Remove all points.
public  voidremovePointAt(int i)
     Removes the i-th point from the list of points.
public  voidsetStyle(int style)
     Set the style of this TableFunction, to specify how values are interpolated between points on the curve.
Parameters:
  style - One of the style constants SMOOTH, PIECEWISE_LINEAR, STEP,STEP_LEFT, STEP_RIGHT.
public  voidsetY(int i, double y)
     Set the y-coordinate in the i-th point to y, where the first point is number zero.

Field Detail
PIECEWISE_LINEAR
final public static int PIECEWISE_LINEAR(Code)
If the style of the function is set to PIECEWISE_LINEAR, then linear interpolation is used to find the value of the functions for x-values between the points that define the function.



SMOOTH
final public static int SMOOTH(Code)
If the style of the function is set to SMOOTH, then cubic interpolation is used to find the value of the functions for x-values between the points that define the function.



STEP
final public static int STEP(Code)
If the style of the function is set to STEP, then the function is piecewise constant, and the value of the function at x is taken from the nearest point in the list of points that define the function.



STEP_LEFT
final public static int STEP_LEFT(Code)
If the style of the function is set to STEP_LEFT, then the function is piecewise constant, and the value of the function at x is taken from the nearest point to the left in the list of points that define the function.



STEP_RIGHT
final public static int STEP_RIGHT(Code)
If the style of the function is set to STEP_RIGHT, then the function is piecewise constant, and the value of the function at x is taken from the nearest point to the right in the list of points that define the function.




Constructor Detail
TableFunction
public TableFunction()(Code)
Create a TableFunction with SMOOTH style and no points.



TableFunction
public TableFunction(int sytle)(Code)
Create a TableFunction with specified style and no points.
Parameters:
  style - The style for the function: SMOOTH, PIECEWISE_LINEAR, STEP,STEP_LEFT, or STEP_RIGHT.




Method Detail
addIntervals
public void addIntervals(int intervals, double xmin, double xmax)(Code)
Add points to the table. The number of points added is intervals + 1. The x-coordinates are evenly spaced between xmin and xmax. The y-coordinates are zero.
Parameters:
  intervals - The number of intervals. The number of points added is intervals + 1.The value should be at least 1. If not, nothing is done.
Parameters:
  xmin - The minimim x-coordinate for added points.
Parameters:
  xmax - The maximum x-coodinate for added points. Should be greater thanxmin, for efficiency, but no error occurs if it is not.



addPoint
public int addPoint(double x, double y)(Code)
Add a point with the specified x and y coordinates. If a point with the given x coordinate already exists in the table, then no new point is added, but the associated y-value is changed. (If x is Double.NaN, then no change is made and the return value is -1.)
Parameters:
  x - The x-coordinate of the point to be added or modified.
Parameters:
  y - The y-coordinate of the point. the position of the point in the list of points, where the first point is at position zero.



addPoints
public void addPoints(double[] xCoords, double[] yCoords)(Code)
Add points to the table. The x-coordinates of the points are taken from the xCoords array. The y-coordinate for the i-th point is yCoords[i], if an i-th position exists in this array. Otherwise, the y-coordinate is is zero. (Note that if xCoords[i] duplicates an x-value already in the table, then no new point is added but the corresponging y-value is changed.)
Parameters:
  xCoords - A list of x-coordinates to be added to the table. If this isnull, then nothing is done.
Parameters:
  yCoords - The value of yCoords[i], if it exists, is the y-coordinatecorresponding to xCoords[i]. Otherwise, the y-coordinate is undefined.This can be null, in which case all y-coordinates are zero.



apply
public void apply(StackOfDouble stack, Cases cases)(Code)
Override method apply() from interface FunctionParserExtension, to handle cases properly. Not meant to be called directly.



copyDataFrom
public void copyDataFrom(TableFunction source)(Code)
Copy data from another TableFunction, except that the name of the funcion is not duplicated. The new TableFunction is nameless.



dependsOn
public boolean dependsOn(Variable wrt)(Code)
Returns false.



derivative
public Function derivative(int wrt)(Code)
Compute the derivative of this function. The value of the parameter, wrt, must be 1 or an IllegalArguemntException will be thrown.



derivative
public Function derivative(Variable wrt)(Code)
Returns null. It really should be the constant function zero, but I don't expect this ever to be called. Since dependsOn(wrt) returns false, it will never be called within the JCM system.



findPoint
public int findPoint(double x)(Code)
If there is a point in the list with x-coordinate x, then this function returns the index of that point in the list (where the index of the first point is zero). If there is no such point, then -1 is returned.



getArity
public int getArity()(Code)
Returns the arity of the function, which is 1.



getPointCount
public int getPointCount()(Code)
Gets the number of points in the table.



getStyle
public int getStyle()(Code)
Get the style of this TableFunction, which specifies how values are interpolated between points on the curve. The style of this TableFunction. This is one of the constantsSMOOTH, PIECEWISE_LINEAR, STEP, STEP_LEFT, or STEP_RIGHT.



getVal
public double getVal(double x)(Code)
Get the value of the function at x, using interpolation if x lies between two x-coordinates in the list of points that define the function. If x is outside the range of x-coords in the table, the value of the function is Double.NaN.



getVal
public double getVal(double[] params)(Code)
Get the value of the function at the specified parameter value.



getValueWithCases
public double getValueWithCases(double[] params, Cases cases)(Code)
Get the value of the function at the specified parameter value.



getX
public double getX(int i)(Code)
Get the x-coordinate in the i-th point, where the first point is number zero. Throws an IllegalArgumentException if i is less than zero or greater than or equal to the number of points.



getY
public double getY(int i)(Code)
Get the y-coordinate in the i-th point, where the first point is number zero. Throws an IllegalArgumentException if i is less than zero or greater than or equal to the number of points.



removeAllPoints
public void removeAllPoints()(Code)
Remove all points. The resulting function is undefined everywhere.



removePointAt
public void removePointAt(int i)(Code)
Removes the i-th point from the list of points. Throws an IllegalArgumentException if i is less than zero or greater than or equal to the number of points.



setStyle
public void setStyle(int style)(Code)
Set the style of this TableFunction, to specify how values are interpolated between points on the curve.
Parameters:
  style - One of the style constants SMOOTH, PIECEWISE_LINEAR, STEP,STEP_LEFT, STEP_RIGHT. Other values are ignored.



setY
public void setY(int i, double y)(Code)
Set the y-coordinate in the i-th point to y, where the first point is number zero. Throws an IllegalArgumentException if i is less than zero or greater than or equal to the number of points.



Fields inherited from edu.hws.jcm.functions.FunctionParserExtension
protected String name(Code)(Java Doc)

Methods inherited from edu.hws.jcm.functions.FunctionParserExtension
public void appendOutputString(ExpressionProgram prog, int myIndex, StringBuffer buffer)(Code)(Java Doc)
public void apply(StackOfDouble stack, Cases cases)(Code)(Java Doc)
public void compileDerivative(ExpressionProgram prog, int myIndex, ExpressionProgram deriv, Variable wrt)(Code)(Java Doc)
public void doParse(Parser parser, ParserContext context)(Code)(Java Doc)
public int extent(ExpressionProgram prog, int myIndex)(Code)(Java Doc)
public String getName()(Code)(Java Doc)
public void setName(String name)(Code)(Java Doc)
public void setParensCanBeOptional(boolean b)(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.