Source Code Cross Referenced for RandomGeneratorForTesting.java in  » Development » jgap » org » jgap » impl » 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 » Development » jgap » org.jgap.impl 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * This file is part of JGAP.
003:         *
004:         * JGAP offers a dual license model containing the LGPL as well as the MPL.
005:         *
006:         * For licencing information please see the file license.txt included with JGAP
007:         * or have a look at the top of class org.jgap.Chromosome which representatively
008:         * includes the JGAP license policy applicable for any file delivered with JGAP.
009:         */
010:        package org.jgap.impl;
011:
012:        import org.jgap.*;
013:
014:        /**
015:         * A random generator only determined for testing purposes. With this, you can
016:         * specify the next value which will be returned. It is also possible to
017:         * specify a sequence to be produced.
018:         *
019:         * @author Klaus Meffert
020:         * @since 1.1
021:         */
022:        public class RandomGeneratorForTesting implements  RandomGenerator,
023:                java.io.Serializable {
024:
025:            /** String containing the CVS revision. Read out via reflection!*/
026:            private static final String CVS_REVISION = "$Revision: 1.1 $";
027:
028:            private long m_nextLong;
029:            private double m_nextDouble;
030:            private boolean m_nextBoolean;
031:            private int[] m_nextIntSequence;
032:            private float[] m_nextFloatSequence;
033:            private double m_nextGaussian;
034:            private int m_intIndex, m_floatIndex;
035:
036:            public RandomGeneratorForTesting() {
037:            }
038:
039:            public RandomGeneratorForTesting(int a_nextInt) {
040:                this ();
041:                setNextInt(a_nextInt);
042:            }
043:
044:            public RandomGeneratorForTesting(double a_nextDouble) {
045:                this ();
046:                setNextDouble(a_nextDouble);
047:            }
048:
049:            public RandomGeneratorForTesting(float a_nextFloat) {
050:                this ();
051:                setNextFloat(a_nextFloat);
052:            }
053:
054:            public RandomGeneratorForTesting(long a_nextLong) {
055:                this ();
056:                setNextLong(a_nextLong);
057:            }
058:
059:            public RandomGeneratorForTesting(boolean a_nextBoolean) {
060:                this ();
061:                setNextBoolean(a_nextBoolean);
062:                setNextInt(1);
063:            }
064:
065:            public int nextInt() {
066:                int result = m_nextIntSequence[m_intIndex++];
067:                if (m_intIndex >= m_nextIntSequence.length) {
068:                    m_intIndex = 0;
069:                }
070:                return result;
071:            }
072:
073:            public int nextInt(int a_ceiling) {
074:                return nextInt() % a_ceiling;
075:            }
076:
077:            public long nextLong() {
078:                return m_nextLong;
079:            }
080:
081:            public double nextDouble() {
082:                return m_nextDouble;
083:            }
084:
085:            public double nextGaussian() {
086:                return m_nextGaussian;
087:            }
088:
089:            public float nextFloat() {
090:                float result = m_nextFloatSequence[m_floatIndex++];
091:                if (m_floatIndex >= m_nextFloatSequence.length) {
092:                    m_floatIndex = 0;
093:                }
094:                return result;
095:            }
096:
097:            public boolean nextBoolean() {
098:                return m_nextBoolean;
099:            }
100:
101:            public void setNextBoolean(boolean a_nextBoolean) {
102:                m_nextBoolean = a_nextBoolean;
103:            }
104:
105:            public void setNextDouble(double a_nextDouble) {
106:                m_nextDouble = a_nextDouble % 1.0d;
107:            }
108:
109:            public void setNextGaussian(double a_nextDouble) {
110:                m_nextGaussian = a_nextDouble;
111:            }
112:
113:            public void setNextFloat(float a_nextFloat) {
114:                setNextFloatSequence(new float[] { a_nextFloat % 1.0f });
115:            }
116:
117:            public void setNextInt(int a_nextInt) {
118:                setNextIntSequence(new int[] { a_nextInt });
119:            }
120:
121:            public void setNextLong(long a_nextLong) {
122:                m_nextLong = a_nextLong;
123:            }
124:
125:            public void setNextFloatSequence(float[] a_sequence) {
126:                m_floatIndex = 0;
127:                m_nextFloatSequence = a_sequence;
128:            }
129:
130:            public void setNextIntSequence(int[] a_sequence) {
131:                m_intIndex = 0;
132:                m_nextIntSequence = a_sequence;
133:            }
134:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.