Java Doc for Constant.java in  » Science » jcm1-source » edu » hws » jcm » data » 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.data 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   edu.hws.jcm.data.Constant

All known Subclasses:   edu.hws.jcm.data.Variable,
Constant
public class Constant implements Expression,ExpressionCommand,MathObject(Code)
A Constant is a Value that represents a constant real number. (The value doesn't have to be constant in sub-classes, since the member that stores the value is protected, not private.) A Constant doesn't necessarily need a name. If the name is null, then the print string for the Constant is the value of the constant. If it has a non-null name, then the print string is the name. (Note that, as for any MathObject, if the name is null, than the Constant can't be added to a Parser.) Constant objects are used to represent the mathematical constants pi and e. A Constant is both an Expression and an ExpressionCommand. Since it is an ExpressionCommand, it can occur as a command in an ExpressionProgram. In that case, it simply represens a named constant occurs in an expression.


Field Summary
protected  doublevalue
     The value of this Constant.

Constructor Summary
public  Constant(double value)
     Create an unnamed Constant with the given value and null name.
public  Constant(String name, double value)
     Create a Constant with the given name and value.

Method Summary
public  voidappendOutputString(ExpressionProgram prog, int myIndex, StringBuffer buffer)
     Append the print string for this Constant to the buffer.
public  voidapply(StackOfDouble stack, Cases cases)
     Apply the Constant to the stack.
public  voidcompileDerivative(ExpressionProgram prog, int myIndex, ExpressionProgram deriv, Variable wrt)
     Add a commands to deriv to evaluate the derivative of this Constant with respect to the variable.
public  booleandependsOn(Variable x)
     Retrun false, since the value of this Constant is independent of the value of x.
public  Expressionderivative(Variable wrt)
     Return the derivative of this Constant with respect to the variable wrt.
public  intextent(ExpressionProgram prog, int myIndex)
     Return the number of locations that this Constant uses in the program.
public  StringgetName()
     Return the name of this Constant.
public  doublegetVal()
     Return the value of this Constant.
public  doublegetValueWithCases(Cases cases)
     Return the value of the Constant.
public  voidsetName(String name)
     Set the name of this Constant.
public  StringtoString()
     Return the print string representing this Constant.

Field Detail
value
protected double value(Code)
The value of this Constant.




Constructor Detail
Constant
public Constant(double value)(Code)
Create an unnamed Constant with the given value and null name.



Constant
public Constant(String name, double value)(Code)
Create a Constant with the given name and value. The name can be null.




Method Detail
appendOutputString
public void appendOutputString(ExpressionProgram prog, int myIndex, StringBuffer buffer)(Code)
Append the print string for this Constant to the buffer. (The values of prog and myIndex are irrelevant.)



apply
public void apply(StackOfDouble stack, Cases cases)(Code)
Apply the Constant to the stack. This is done by pushing the value of the constant onto the stack. The evaluation of a constant doesn't have any "cases", so there is no need to record any information in cases.



compileDerivative
public void compileDerivative(ExpressionProgram prog, int myIndex, ExpressionProgram deriv, Variable wrt)(Code)
Add a commands to deriv to evaluate the derivative of this Constant with respect to the variable. The derivative is 0, so the only command is the constant 0 (which really represents the stack operation "push 0"). The program and the position of the Constant in that program are irrelevant.



dependsOn
public boolean dependsOn(Variable x)(Code)
Retrun false, since the value of this Constant is independent of the value of x.



derivative
public Expression derivative(Variable wrt)(Code)
Return the derivative of this Constant with respect to the variable wrt. The derivative is another Constant with value zero.



extent
public int extent(ExpressionProgram prog, int myIndex)(Code)
Return the number of locations that this Constant uses in the program. The value is always 1, since the constant is a complete sub-expression in itself.



getName
public String getName()(Code)
Return the name of this Constant. It can be null.



getVal
public double getVal()(Code)
Return the value of this Constant.



getValueWithCases
public double getValueWithCases(Cases cases)(Code)
Return the value of the Constant. Since a constant is continuous function, there is only one "case", so no case information needs to be recorded in cases.



setName
public void setName(String name)(Code)
Set the name of this Constant. (Note that this should not be done if the Constant has been registered with a Parser.)



toString
public String toString()(Code)
Return the print string representing this Constant. The string is the name of the constant, if that is non-null. Otherwise, it is the value of the constant.



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.