Java Doc for Duration.java in  » Workflow-Engines » wfmopen-2.1.1 » de » danet » an » util » 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 » wfmopen 2.1.1 » de.danet.an.util 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   de.danet.an.util.Duration

Duration
public class Duration (Code)
This class provides a representation of durations and a parser for strings that represent durations.

Strings that can be parsed consist of value/unit pairs. Values can be arbitrary text, valid unit names are "years", "yrs", "months", "mts", "hours", "hrs", "min" and "sec". There may be only one pair for each unit i.e. "5 years 3 yrs" is illegal.

Value/unit pairs must be separated from each other with at least one whitespace character. Units may follow values immediately if the value is a number, else they must be separated by at least one whitespace.

Any duration unit may be omitted, but the descending order of units must be preserved.

Parsing is done in two phases. First, during parse the value/unit pairs are identified and the values are stored as strings. This allows the class even to be used when the values are expressions that must be evaluated. If this feature is used, the evaluation must be performed by retrieving the string values (using "...AsParsed"), evaluating the expression and setting the result.

Duration will try to convert the parsed string to a number only if a unit is accessed and has not been set explicitly. Thus, all accessor methods may throw a NumberFormatException even if parse has not thrown a ParseException.
author:
   Michael Lipp
version:
   $Revision: 1.3 $


Inner Class :public static interface ValueEvaluator


Constructor Summary
public  Duration()
     Creates an instance of Duration with a time span of 0.

Method Summary
public  DateaddTo(Date dateTime)
     Adds this duration to the given date and returns the result.
public  intgetDays()
     Get the value of days.
public  intgetHours()
     Get the value of hours.
public  intgetMinutes()
     Get the value of minutes.
public  intgetMonths()
     Get the value of months.
public  floatgetSeconds()
     Get the value of seconds.
public  intgetYears()
     Get the value of years.
public static  Durationparse(String s)
     Parse the given string.
public static  Durationparse(String s, ValueEvaluator e)
     Parse the given string.
public  voidsetDays(int v)
     Set the value of days.
public  voidsetHours(int v)
     Set the value of hours.
public  voidsetMinutes(int v)
     Set the value of minutes.
public  voidsetMonths(int v)
     Set the value of months.
public  voidsetSeconds(float v)
     Set the value of seconds.
public  voidsetYears(int v)
     Set the value of years.
public  StringtoString()
     Return a string representation for debugging purposes.


Constructor Detail
Duration
public Duration()(Code)
Creates an instance of Duration with a time span of 0.




Method Detail
addTo
public Date addTo(Date dateTime)(Code)
Adds this duration to the given date and returns the result. This uses the algorithm described in the XSD datatypes specification.
Parameters:
  dateTime - the date/time to add to the date/time offset by this duration



getDays
public int getDays()(Code)
Get the value of days. value of days.
See Also:   Duration.setDays



getHours
public int getHours()(Code)
Get the value of hours. value of hours.
See Also:   Duration.setHours



getMinutes
public int getMinutes()(Code)
Get the value of minutes. value of minutes.
See Also:   Duration.setMinutes



getMonths
public int getMonths()(Code)
Get the value of months. value of months.
See Also:   Duration.setMonths



getSeconds
public float getSeconds()(Code)
Get the value of seconds. value of seconds.
See Also:   Duration.setSeconds



getYears
public int getYears()(Code)
Get the value of years. value of years.
See Also:   Duration.setYears



parse
public static Duration parse(String s) throws ParseException(Code)
Parse the given string.
Parameters:
  s - the text to parse the duration
throws:
  ParseException - if the string cannot be parsed



parse
public static Duration parse(String s, ValueEvaluator e) throws ParseException(Code)
Parse the given string.
Parameters:
  s - the text to parse
Parameters:
  e - the evaluator, if null use simple floatparser the duration
throws:
  ParseException - if the string cannot be parsed



setDays
public void setDays(int v)(Code)
Set the value of days.
Parameters:
  v - value to assign to days.
See Also:   Duration.getDays



setHours
public void setHours(int v)(Code)
Set the value of hours.
Parameters:
  v - value to assign to hours.
See Also:   Duration.getHours



setMinutes
public void setMinutes(int v)(Code)
Set the value of minutes.
Parameters:
  v - value to assign to minutes.
See Also:   Duration.getMinutes



setMonths
public void setMonths(int v)(Code)
Set the value of months.
Parameters:
  v - value to assign to months.
See Also:   Duration.getMonths



setSeconds
public void setSeconds(float v)(Code)
Set the value of seconds.
Parameters:
  v - value to assign to seconds.
See Also:   Duration.getSeconds



setYears
public void setYears(int v)(Code)
Set the value of years.
Parameters:
  v - value to assign to years.
See Also:   Duration.getYears



toString
public String toString()(Code)
Return a string representation for debugging purposes. string representation.



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.