Java Doc for Spline3.java in  » Testing » jakarta-jmeter » org » apache » jmeter » visualizers » 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 » Testing » jakarta jmeter » org.apache.jmeter.visualizers 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.jmeter.visualizers.Spline3

Spline3
public class Spline3 (Code)
This class implements the representation of an interpolated Spline curve.

The curve described by such an object interpolates an arbitrary number of fixed points called nodes. The distance between two nodes should currently be constant. This is about to change in a later version but it can last a while as it's not really needed. Nevertheless, if you need the feature, just write me a note and I'll write it asap.

The interpolated Spline curve can't be described by an polynomial analytic equation, the degree of which would be as high as the number of nodes, which would cause extreme oscillations of the curve on the edges.

The solution is to split the curve accross a lot of little intervals : an interval starts at one node and ends at the next one. Then, the interpolation is done on each interval, according to the following conditions :

  1. the interpolated curve is degree 3 : it's a cubic curve ;
  2. the interpolated curve contains the two points delimiting the interval. This condition obviously implies the curve is continuous ;
  3. the interpolated curve has a smooth slope : the curvature has to be the same on the left and the right sides of each node ;
  4. the curvature of the global curve is 0 at both edges.
Every part of the global curve is represented by a cubic (degree-3) polynomial, the coefficients of which have to be computed in order to meet the above conditions.

This leads to a n-unknow n-equation system to resolve. One can resolve an equation system by several manners ; this class uses the Jacobi iterative method, particularly well adapted to this situation, as the diagonal of the system matrix is strong compared to the other elements. This implies the algorithm always converges ! This is not the case of the Gauss-Seidel algorithm, which is quite faster (it uses intermediate results of each iteration to speed up the convergence) but it doesn't converge in all the cases or it converges to a wrong value. This is not acceptable and that's why the Jacobi method is safer. Anyway, the gain of speed is about a factor of 3 but, for a 100x100 system, it means 10 ms instead of 30 ms, which is a pretty good reason not to explore the question any further :)

Here is a little piece of code showing how to use this class :

 // ... float[] nodes = {3F, 2F, 4F, 1F, 2.5F, 5F, 3F}; Spline3 curve =
 new Spline3(nodes); // ... public void paint(Graphics g) { int[] plot =
 curve.getPlots(); for (int i = 1; i < n; i++) { g.drawLine(i - 1, plot[i -
 1], i, plot[i]); } } // ...
 
Have fun with it !
Any comments, feedback, bug reports or suggestions will be appreciated.
author:
   Jean-Pierre Norguet
version:
   $Revison$ updated $Date: 2007-01-07 17:09:09 +0000 (Sun, 07 Jan 2007) $


Field Summary
final protected static  intDEFAULT_MAX_ITERATIONS
    
final protected static  floatDEFAULT_PRECISION
    
protected  float[][]_A
    
protected  float[]_B
    
protected  float[][]_coefficients
    
protected  int_m
    
protected  int_maxIterations
    
protected  float_minPrecision
    
protected  int_n
    
protected  float[]_r
    
protected  float[]_rS
    

Constructor Summary
public  Spline3(float[] r)
     Creates a new Spline curve by calculating the coefficients of each part of the curve, i.e.

Method Summary
protected  booleanconverge()
     Test if the Jacobi resolution of the equation system converges.
public  voiddebugCheck()
     Manual check of the curve at the interpolated points.
public  intgetDefaultMaxIterations()
    
public  floatgetDefaultPrecision()
    
public  intgetMaxIterations()
    
public  int[]getPlots(int width, int height)
     Computes drawable plots from the curve for a given draw space.
public  floatgetPrecision()
    
protected  voidinterpolation()
     Computes the coefficients of the Spline interpolated curve, on each interval.
protected  voidjacobi()
     Resolves the equation system by a Jacobi algorithm.
protected  floatprecision(float[] oldX, float[] newX)
     Computes the current precision reached.
public  voidsetMaxIterations(int iterations)
    
public  voidsetPrecision(float precision)
    
public  voidsetToDefaultMaxIterations()
    
public  voidsetToDefaultPrecision()
    
public  floatvalue(float t)
     Computes a (vertical) Y-axis value of the global curve.

Field Detail
DEFAULT_MAX_ITERATIONS
final protected static int DEFAULT_MAX_ITERATIONS(Code)



DEFAULT_PRECISION
final protected static float DEFAULT_PRECISION(Code)



_A
protected float[][] _A(Code)



_B
protected float[] _B(Code)



_coefficients
protected float[][] _coefficients(Code)



_m
protected int _m(Code)



_maxIterations
protected int _maxIterations(Code)



_minPrecision
protected float _minPrecision(Code)



_n
protected int _n(Code)



_r
protected float[] _r(Code)



_rS
protected float[] _rS(Code)




Constructor Detail
Spline3
public Spline3(float[] r)(Code)
Creates a new Spline curve by calculating the coefficients of each part of the curve, i.e. by resolving the equation system implied by the interpolation condition on every interval.
Parameters:
  r - an array of float containing the vertical coordinates of thenodes to interpolate ; the vertical coordinates start at 0 andare equidistant with a step of 1.




Method Detail
converge
protected boolean converge()(Code)
Test if the Jacobi resolution of the equation system converges. It's OK if A has a strong diagonal.



debugCheck
public void debugCheck()(Code)
Manual check of the curve at the interpolated points.



getDefaultMaxIterations
public int getDefaultMaxIterations()(Code)



getDefaultPrecision
public float getDefaultPrecision()(Code)



getMaxIterations
public int getMaxIterations()(Code)



getPlots
public int[] getPlots(int width, int height)(Code)
Computes drawable plots from the curve for a given draw space. The values returned are drawable vertically and from the bottom of a Panel.
Parameters:
  width - width within the plots have to be computed
Parameters:
  height - height within the plots are expected to be drawed drawable plots within the limits defined, in an array of int (asmany int as the value of the width parameter)



getPrecision
public float getPrecision()(Code)



interpolation
protected void interpolation()(Code)
Computes the coefficients of the Spline interpolated curve, on each interval. The matrix system to resolve is AX=B



jacobi
protected void jacobi()(Code)
Resolves the equation system by a Jacobi algorithm. The use of the slower Jacobi algorithm instead of Gauss-Seidel is choosen here because Jacobi is assured of to be convergent for this particular equation system, as the system matrix has a strong diagonal.



precision
protected float precision(float[] oldX, float[] newX)(Code)
Computes the current precision reached.



setMaxIterations
public void setMaxIterations(int iterations)(Code)



setPrecision
public void setPrecision(float precision)(Code)



setToDefaultMaxIterations
public void setToDefaultMaxIterations()(Code)



setToDefaultPrecision
public void setToDefaultPrecision()(Code)



value
public float value(float t)(Code)
Computes a (vertical) Y-axis value of the global curve.
Parameters:
  t - abscissa computed ordinate



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.