Source Code Cross Referenced for AbstractDoubleGenerator.java in  » Testing » databene-benerator » org » databene » benerator » 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 » databene benerator » org.databene.benerator 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.databene.benerator;
002:
003:        /**
004:         * Abstract Double genarator that serves as parent class for implementation of custom Sequences.<br/>
005:         * <br/>
006:         * Created: 07.06.2006 18:51:16
007:         */
008:        public abstract class AbstractDoubleGenerator extends
009:                LightweightGenerator<Double> implements  NumberGenerator<Double> {
010:
011:            /** The minimum value to create */
012:            protected double min;
013:
014:            /** The maximum value to create */
015:            protected double max;
016:
017:            /** the precision used */
018:            protected double precision;
019:
020:            /** first distribution parameter */
021:            protected double variation1;
022:
023:            /** second distribution parameter */
024:            protected double variation2;
025:
026:            /** consistency flag */
027:            protected boolean dirty;
028:
029:            // constructors ----------------------------------------------------------------------------------------------------
030:
031:            protected AbstractDoubleGenerator() {
032:                this (Double.MIN_VALUE, Double.MAX_VALUE);
033:            }
034:
035:            protected AbstractDoubleGenerator(double min, double max) {
036:                this (min, max, 1L);
037:            }
038:
039:            protected AbstractDoubleGenerator(double min, double max,
040:                    double precision) {
041:                this (min, max, precision, 1L, 1L);
042:            }
043:
044:            protected AbstractDoubleGenerator(double min, double max,
045:                    double precision, double variation1, double variation2) {
046:                if (min > max)
047:                    throw new IllegalArgumentException("min. value (" + min
048:                            + ") is greater than max. value (" + max + ')');
049:                this .min = min;
050:                this .max = max;
051:                if (precision < 0)
052:                    throw new IllegalArgumentException(
053:                            "Unsupported precision: " + precision);
054:                this .precision = precision;
055:                this .variation1 = variation1;
056:                this .variation2 = variation2;
057:                this .dirty = true;
058:            }
059:
060:            // config properties -----------------------------------------------------------------------------------------------
061:
062:            public Double getMin() {
063:                return min;
064:            }
065:
066:            public void setMin(Double min) {
067:                this .min = min;
068:                this .dirty = true;
069:            }
070:
071:            public Double getMax() {
072:                return max;
073:            }
074:
075:            public void setMax(Double max) {
076:                this .max = max;
077:                this .dirty = true;
078:            }
079:
080:            public Double getPrecision() {
081:                return precision;
082:            }
083:
084:            public void setPrecision(Double precision) {
085:                this .precision = precision;
086:                this .dirty = true;
087:            }
088:
089:            public Double getVariation1() {
090:                return variation1;
091:            }
092:
093:            public void setVariation1(Double variation1) {
094:                this .variation1 = variation1;
095:                this .dirty = true;
096:            }
097:
098:            public Double getVariation2() {
099:                return variation2;
100:            }
101:
102:            public void setVariation2(Double variation2) {
103:                this .variation2 = variation2;
104:                this .dirty = true;
105:            }
106:
107:            // Generator interface ---------------------------------------------------------------------------------------------
108:
109:            public Class<Double> getGeneratedType() {
110:                return Double.class;
111:            }
112:
113:            public void validate() {
114:                if (dirty) {
115:                    if (min > max)
116:                        throw new InvalidGeneratorSetupException("min",
117:                                "greater than max (" + min + ")");
118:                    super .validate();
119:                    dirty = false;
120:                }
121:            }
122:
123:            // java.lang.Object overrides --------------------------------------------------------------------------------------
124:
125:            public String toString() {
126:                return getClass().getSimpleName() + "[min=" + min + ", max="
127:                        + max + ", precision=" + precision + ", "
128:                        + "variation1=" + variation1 + ", variation2="
129:                        + variation2 + ']';
130:            }
131:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.