Source Code Cross Referenced for CommonFunctionCompLsThOrEquTag.java in  » Workflow-Engines » JFolder » org » jfolder » common » function » v1 » 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 » JFolder » org.jfolder.common.function.v1 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * JFolder, Copyright 2001-2006 Gary Steinmetz
003:         *
004:         * Distributable under LGPL license.
005:         * See terms of license at gnu.org.
006:         */
007:
008:        package org.jfolder.common.function.v1;
009:
010:        //base classes
011:        import java.math.BigDecimal;
012:
013:        //project specific classes
014:        import org.jfolder.common.SelfArgumentlessConstructor;
015:        import org.jfolder.common.StandardDataTypes;
016:        import org.jfolder.common.UnexpectedSystemException;
017:        import org.jfolder.common.function.BaseCommonFunctionCompatibilityTag;
018:        import org.jfolder.common.function.WebPageTagInstanceViewContext;
019:        import org.jfolder.common.function.WebPageTagInstanceViewContextInfo;
020:        import org.jfolder.common.tagging.AppraiseConceptTagContext;
021:        import org.jfolder.common.tagging.ConceptTagCharacteristic;
022:        import org.jfolder.common.tagging.ConceptTagConstraint;
023:        import org.jfolder.common.tagging.ConceptTagConstraintHolder;
024:        import org.jfolder.common.tagging.ConceptTagFlagsHelper;
025:        import org.jfolder.common.tagging.DetermineClassConceptTagContext;
026:        import org.jfolder.common.tagging.DetermineValueAndClassConceptTagContext;
027:        import org.jfolder.common.tagging.DetermineValueAndClassConceptTagException;
028:        import org.jfolder.common.tagging.DynamicConceptTagConstraintContext;
029:        import org.jfolder.common.tagging.InitializeConceptTagContext;
030:        import org.jfolder.common.tagging.ReturnableConceptTag;
031:        import org.jfolder.common.tagging.SelectionCriteriaForReturnableConceptTag;
032:        import org.jfolder.common.tagging.StaticConceptTagConstraintContext;
033:        import org.jfolder.common.tagging.StudioConceptTagCreParInfoContext;
034:        import org.jfolder.common.tagging.StudioConceptTagInstanceInfoContext;
035:        import org.jfolder.common.tagging.StudioConceptTagTypeInfoContext;
036:        import org.jfolder.common.tagging.ValueAndClassForConceptTag;
037:        import org.jfolder.common.utils.misc.CommonExpressions;
038:        import org.jfolder.common.utils.misc.MiscHelper;
039:
040:        //other classes
041:
042:        public class CommonFunctionCompLsThOrEquTag extends
043:                BaseCommonFunctionCompatibilityTag implements 
044:                SelfArgumentlessConstructor {
045:
046:            //characteristics
047:            private ConceptTagCharacteristic operandCtchar = null;
048:
049:            //operand details
050:            private final static String OPERAND_CTCON = "operand";
051:            private final static String OPERAND_TITLE = "Operands";
052:            private final static String OPERAND_SHORT_DESCRIPTION = "Number values to compare - "
053:                    + "the result is true only if the first operand is less"
054:                    + " than or equal to the second, false otherwise";
055:
056:            public void initialize(InitializeConceptTagContext inIctc) {
057:
058:                //
059:                ConceptTagConstraintHolder rootCtconh = ConceptTagConstraintHolder
060:                        .newInstance(inIctc);
061:
062:                //constrain "operand"
063:                ConceptTagConstraint operandCtcon = ConceptTagConstraint
064:                        .newInstance(OPERAND_CTCON, rootCtconh);
065:                operandCtcon.setMinimumLength(2);
066:                operandCtcon.setMaximumLength(2);
067:                operandCtcon.setTitle(OPERAND_TITLE);
068:                operandCtcon.setShortDescription(OPERAND_SHORT_DESCRIPTION);
069:                //
070:                StaticConceptTagConstraintContext operandSctcc = StaticConceptTagConstraintContext
071:                        .newInstance(operandCtcon);
072:                operandSctcc.setRegularExpression(CommonExpressions.DECIMAL);
073:                //
074:                DynamicConceptTagConstraintContext operandDctcc = DynamicConceptTagConstraintContext
075:                        .newInstance(operandCtcon);
076:                operandDctcc.getValidator().allowReturnOfOnlyDecimal();
077:                operandDctcc.getValidator().filterDirectChildOfRootAndHtml();
078:                //
079:                operandSctcc.addDefaultValue("0");
080:                operandSctcc.addDefaultValue("0");
081:
082:                //
083:                ConceptTagFlagsHelper
084:                        .pushNonIterativeCommonFunctionDepth(inIctc);
085:                inIctc.initialize();
086:                ConceptTagFlagsHelper
087:                        .popNonIterativeCommonFunctionDepth(inIctc);
088:
089:                //initialize characteristics
090:                this .operandCtchar = operandCtcon.getCharacteristic();
091:
092:            }
093:
094:            public void appraise(AppraiseConceptTagContext inActc) {
095:
096:                if (inActc instanceof  StudioConceptTagInstanceInfoContext) {
097:
098:                    StudioConceptTagInstanceInfoContext sctiic = (StudioConceptTagInstanceInfoContext) inActc;
099:
100:                    sctiic.setInstanceTitle("Less Than Or Equal");
101:                    sctiic.setInstanceDescription("Less Than Or Equal");
102:                    /*
103:                    if (this.operandCtchar.getValueLength() == 2) {
104:                        //initialize first operand
105:                        String operandTitle1 = "";
106:                        String operandDesc1 = "";
107:                        if (this.operandCtchar.isStatic(0, inActc)) {
108:                            operandTitle1 =
109:                                this.operandCtchar.getValueAsString(0, inActc);
110:                            operandDesc1 =
111:                                this.operandCtchar.getValueAsString(0, inActc);
112:                        }
113:                        else if (this.operandCtchar.isHolderWithConceptTag(0, inActc)) {
114:                            StudioConceptTagInstanceInfoContext nextStiic =
115:                                this.operandCtchar.getInstanceInformation(0);
116:                            
117:                            operandTitle1 = nextStiic.getInstanceTitle();
118:                            operandDesc1 = nextStiic.getInstanceDescription();
119:                        }
120:                        //initialize second operand
121:                        String operandTitle2 = "";
122:                        String operandDesc2 = "";
123:                        if (this.operandCtchar.isStatic(1, inActc)) {
124:                            operandTitle2 =
125:                                this.operandCtchar.getValueAsString(1, inActc);
126:                            operandDesc2 =
127:                                this.operandCtchar.getValueAsString(1, inActc);
128:                        }
129:                        else if (this.operandCtchar.isHolderWithConceptTag(1, inActc)) {
130:                            StudioConceptTagInstanceInfoContext nextStiic =
131:                                this.operandCtchar.getInstanceInformation(1);
132:                            
133:                            operandTitle2 = nextStiic.getInstanceTitle();
134:                            operandDesc2 = nextStiic.getInstanceDescription();
135:                        }
136:                        
137:                        //set title and description
138:                        sctiic.setInstanceTitle(
139:                            "(" + operandTitle1 + " <= " + operandTitle2 + ")");
140:                        sctiic.setInstanceDescription(
141:                            "(" + operandDesc1 + " <= " + operandDesc2 + ")");
142:                    }
143:                    else {
144:                        sctiic.setInstanceTitle("(Error)");
145:                        sctiic.setInstanceDescription("(Error)");
146:                    }
147:                     */
148:                } else if (inActc instanceof  StudioConceptTagTypeInfoContext) {
149:
150:                    StudioConceptTagTypeInfoContext scttic = (StudioConceptTagTypeInfoContext) inActc;
151:
152:                    scttic.setTypeTitle("Less Than Or Equal");
153:                    scttic
154:                            .setTypeDescription("Determines if one number is less than or equal to another");
155:                } else if (inActc instanceof  WebPageTagInstanceViewContext) {
156:
157:                    WebPageTagInstanceViewContext wptivc = (WebPageTagInstanceViewContext) inActc;
158:
159:                    WebPageTagInstanceViewContextInfo info = wptivc
160:                            .getInfoAsNonHtml();
161:
162:                    if (this .operandCtchar.getValueLength() >= 2) {
163:                        for (int i = 0; i < this .operandCtchar.getValueLength(); i++) {
164:                            WebPageTagInstanceViewContextInfo nextInfo = info
165:                                    .createNonHtmlInfo();
166:                            if (i > 0) {
167:                                nextInfo.setNonHtmlContent(" >= ");
168:                            }
169:                            WebPageTagInstanceViewContext.displayView(
170:                                    this .operandCtchar, nextInfo, wptivc, i,
171:                                    i + 1);
172:                        }
173:                    } else if (this .operandCtchar.getValueLength() == 1) {
174:                        WebPageTagInstanceViewContext.displayView(
175:                                this .operandCtchar, info, wptivc);
176:                        info.setNonHtmlContent("", " >= ???");
177:                    } else {
178:                        info.setNonHtmlContent("??? >= ???");
179:                    }
180:                } else if (inActc instanceof  SelectionCriteriaForReturnableConceptTag) {
181:
182:                    SelectionCriteriaForReturnableConceptTag scfrct = (SelectionCriteriaForReturnableConceptTag) inActc;
183:
184:                    scfrct.canReturnBoolean();
185:                    scfrct.declareFormatAsPlain();
186:                } else if (inActc instanceof  StudioConceptTagCreParInfoContext) {
187:
188:                    StudioConceptTagCreParInfoContext scpc = (StudioConceptTagCreParInfoContext) inActc;
189:                }
190:            }
191:
192:            public void determineValueAndClass(
193:                    DetermineValueAndClassConceptTagContext inDvacctc) {
194:
195:                try {
196:                    ValueAndClassForConceptTag vacfct = null;
197:
198:                    boolean result = true;
199:                    BigDecimal nextOperand = null;
200:
201:                    if (this .operandCtchar.isStatic(0, inDvacctc)) {
202:                        //MiscHelper.println("LessThEqSt arg1 = "
203:                        //    + this.operandTc.getValueAsString(0));
204:                        nextOperand = new BigDecimal(this .operandCtchar
205:                                .getValueAsString(0, inDvacctc));
206:                    } else {
207:                        ValueAndClassForConceptTag operandVac = this .operandCtchar
208:                                .getDetermineValueAndClass(0, inDvacctc);
209:                        //MiscHelper.println("LessThEqSt arg1 = " + vac.getValue());
210:                        nextOperand = MiscHelper
211:                                .fromNumberToBigDecimal(operandVac.getValue());
212:                    }
213:
214:                    if (this .operandCtchar.isStatic(1, inDvacctc)) {
215:                        BigDecimal bd = new BigDecimal(this .operandCtchar
216:                                .getValueAsString(1, inDvacctc));
217:                        //MiscHelper.println("LessThEqSt arg2 = "
218:                        //    + this.operandTc.getValueAsString(1));
219:                        result = result & (nextOperand.compareTo(bd) <= 0);
220:                    } else {
221:                        ValueAndClassForConceptTag operandVac = this .operandCtchar
222:                                .getDetermineValueAndClass(1, inDvacctc);
223:                        //MiscHelper.println("LessThEqSt arg2 = " + vac.getValue());
224:                        BigDecimal bd = MiscHelper
225:                                .fromNumberToBigDecimal(operandVac.getValue());
226:                        result = result & (nextOperand.compareTo(bd) <= 0);
227:                    }
228:                    //MiscHelper.println("LessThEqSt result = " + result);
229:                    vacfct = ValueAndClassForConceptTag.newBoolean(new Boolean(
230:                            result));
231:
232:                    inDvacctc.setDetermineValueAndClass(vacfct);
233:                } catch (DetermineValueAndClassConceptTagException dvaccte) {
234:                    inDvacctc.setDetermineException(dvaccte);
235:                }
236:
237:            }
238:
239:            public void determineClass(DetermineClassConceptTagContext inDcctc) {
240:                inDcctc.setDetermineClass(StandardDataTypes.getBooleanClass());
241:            }
242:
243:            public Object createUninitializedSelf() {
244:                return new CommonFunctionCompLsThOrEquTag();
245:            }
246:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.