Source Code Cross Referenced for Edge.java in  » Workflow-Engines » Bossa » com » bigbross » bossa » wfnet » 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 » Workflow Engines » Bossa » com.bigbross.bossa.wfnet 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Bossa Workflow System
003:         *
004:         * $Id: Edge.java,v 1.11 2004/01/15 22:13:32 gdvieira Exp $
005:         *
006:         * Copyright (C) 2003,2004 OpenBR Sistemas S/C Ltda.
007:         *
008:         * This file is part of Bossa.
009:         *
010:         * Bossa is free software; you can redistribute it and/or modify it
011:         * under the terms of version 2 of the GNU General Public License as
012:         * published by the Free Software Foundation.
013:         *
014:         * This program is distributed in the hope that it will be useful,
015:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
016:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
017:         * General Public License for more details.
018:         *
019:         * You should have received a copy of the GNU General Public
020:         * License along with this program; if not, write to the
021:         * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
022:         * Boston, MA 02111-1307, USA.
023:         */
024:
025:        package com.bigbross.bossa.wfnet;
026:
027:        import java.io.Serializable;
028:
029:        /**
030:         * This class represents one edge of one transition.  It may be an input or
031:         * output edge, mapping the precondition or postcondition of one transition. <p>
032:         *
033:         * @author <a href="http://www.bigbross.com">BigBross Team</a>
034:         */
035:        public abstract class Edge implements  Serializable {
036:
037:            protected static final Integer INACTIVE = new Integer(0);
038:
039:            protected Object expression = INACTIVE;
040:
041:            private Place place;
042:
043:            /**
044:             * Creates a new edge, with the provided weight expression and
045:             * connected place. For an input edge the connected place will be a
046:             * source place, and for an output edge it will be a sink place. <p>
047:             *
048:             * @param place the connected place.
049:             * @param expression the weight expression.
050:             */
051:            protected Edge(Place place, String expression) {
052:                this .place = place;
053:                try {
054:                    this .expression = Integer.valueOf(expression);
055:                } catch (NumberFormatException e) {
056:                    this .expression = expression;
057:                }
058:            }
059:
060:            /**
061:             * Returns the place this edge is connected to. For an input edge the
062:             * connected place will be a source place, and for an output edge it
063:             * will be a sink place. <p>
064:             * 
065:             * @return the place this edge is connected to.
066:             */
067:            Place getPlace() {
068:                return this .place;
069:            }
070:
071:            /**
072:             * Returns the weight of this edge. <p>
073:             *
074:             * @return A negative, zero, or a positive integer as this edge is a
075:             *         precondition, no-condition, or a postcondition.
076:             * @exception EvaluationException if an expression evaluation error
077:             *            occurs.
078:             */
079:            int weight(Case caze) throws EvaluationException {
080:                return INACTIVE.intValue();
081:            }
082:
083:            /**
084:             * Returns the weight of a precondition edge. <p>
085:             *
086:             * @return A positive integer if this edge is a precondition,
087:             *         zero otherwise.
088:             * @exception EvaluationException if an expression evaluation error
089:             *            occurs.
090:             */
091:            int input(Case caze) throws EvaluationException {
092:                return INACTIVE.intValue();
093:            }
094:
095:            /**
096:             * Returns the weight of a postcondition edge. <p>
097:             *
098:             * @return A positive integer if this edge is a precondition,
099:             *         zero otherwise.
100:             * @exception EvaluationException if an expression evaluation error
101:             *            occurs.
102:             */
103:            int output(Case caze) throws EvaluationException {
104:                return INACTIVE.intValue();
105:            }
106:
107:            /**
108:             * Evaluates an integer expression representing the edge weight
109:             * using the case attributes. <p>
110:             * 
111:             * @param caze the case that contains the attributes.
112:             * @return The value of the expression, a positive integer.
113:             * @exception EvaluationException if an expression evaluation error
114:             *            occurs.
115:             */
116:            protected int eval(Case caze) throws EvaluationException {
117:                int result;
118:
119:                if (expression instanceof  Integer) {
120:                    result = ((Integer) expression).intValue();
121:                } else {
122:                    result = caze.eval((String) expression);
123:                }
124:
125:                if (result < 0) {
126:                    throw new EvaluationException(
127:                            "The edge absolute weight must "
128:                                    + "be positive. Was: " + result);
129:                }
130:
131:                return result;
132:            }
133:
134:            /**
135:             * Creates a new input edge, with the transition precondition
136:             * weight expression and source place. <p>
137:             *
138:             * @param place the connected place.
139:             * @param expression the weight expression.
140:             * @return the input edge.
141:             */
142:            static Edge newInput(Place place, String expression) {
143:                return new Edge(place, expression) {
144:                    int weight(Case caze) throws EvaluationException {
145:                        return -this .eval(caze);
146:                    }
147:
148:                    int input(Case caze) throws EvaluationException {
149:                        return this .eval(caze);
150:                    }
151:
152:                    public String toString() {
153:                        return "-" + this .expression;
154:                    }
155:                };
156:            }
157:
158:            /**
159:             * Creates a new output edge, with the transition postcondition           
160:             * weight expression and sink place. <p>
161:             *
162:             * @param place the connected place.
163:             * @param expression the expression.
164:             * @return the output edge.
165:             */
166:            static Edge newOutput(Place place, String expression) {
167:                return new Edge(place, expression) {
168:                    int weight(Case caze) throws EvaluationException {
169:                        return this .eval(caze);
170:                    }
171:
172:                    int output(Case caze) throws EvaluationException {
173:                        return this .eval(caze);
174:                    }
175:                };
176:            }
177:
178:            /**
179:             * Returns a string with the condition expression. <p>
180:             *
181:             * @return a string representation of this edge.
182:             */
183:            public String toString() {
184:                return expression.toString();
185:            }
186:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.