<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Ralph's TechBlog &#187; Java</title>
	<atom:link href="http://techblog.ralph-schuster.eu/category/programming/java/feed/" rel="self" type="application/rss+xml" />
	<link>http://techblog.ralph-schuster.eu</link>
	<description>Technical stuff for IT experts</description>
	<lastBuildDate>Tue, 27 Dec 2011 09:38:41 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Undocumented Java WebStart Features</title>
		<link>http://techblog.ralph-schuster.eu/2011/09/22/undocumented-java-webstart-features/</link>
		<comments>http://techblog.ralph-schuster.eu/2011/09/22/undocumented-java-webstart-features/#comments</comments>
		<pubDate>Thu, 22 Sep 2011 09:53:23 +0000</pubDate>
		<dc:creator>Ralph</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Tomcat]]></category>
		<category><![CDATA[JNLP]]></category>
		<category><![CDATA[WebStart]]></category>

		<guid isPermaLink="false">http://techblog.ralph-schuster.eu/?p=267</guid>
		<description><![CDATA[Many of you might use Oracle&#8217;s JNLP Download Servlet, delivered with JDK in jnlp-servlet.jar. One of the nice features of this servlet is the automatic replacement of variables at runtime, e.g. codebase and context. However, the existing documentation does not reveal all of these replacements. While searching for a solution where I need to put [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Ftechblog.ralph-schuster.eu%2F2011%2F09%2F22%2Fundocumented-java-webstart-features%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Ftechblog.ralph-schuster.eu%2F2011%2F09%2F22%2Fundocumented-java-webstart-features%2F&amp;source=TechnicalG&amp;style=compact&amp;hashtags=JNLP,WebStart&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Many of you might use Oracle&#8217;s JNLP Download Servlet, delivered with JDK in jnlp-servlet.jar. One of the nice features of this servlet is the automatic replacement of variables at runtime, e.g. codebase and context. However, the <a title="JnlpDownloadServlet Guide" href="http://download.oracle.com/javase/1.5.0/docs/guide/javaws/developersguide/downloadservletguide.html" target="_blank">existing documentation</a> does not reveal all of these replacements. While searching for a solution where I need to put the server name into the JNLP file, I also examined the source code of JnlpDownloadServlet. And voilá: the feature is already there but not documented.</p>
<p>Here is the complete list of replacements that the servlet does for you while delivering a JNLP:</p>
<ul>
<li><code>$$name</code>: will be replaced by the name of the URL file requested (without path, e.g. myfile.jnlp)</li>
<li><code>$$hostname</code>: will be replaced by the servername as given in the HTTP(S) request</li>
<li><code>$$codebase</code>: will be replaced by the codebase (request without URL file: http://my.server/appname/somedir/)</li>
<li><code>$$site</code>: will be replaced by the protocol, server and port, e.g. http://my.server:8080</li>
</ul>
<p>I hope you&#8217;ll find that useful next time you look for a solution to deliver WAR files to individual servers with the specific servername in its JNLP file.</p>
]]></content:encoded>
			<wfw:commentRss>http://techblog.ralph-schuster.eu/2011/09/22/undocumented-java-webstart-features/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>CSV/Excel Utility Package V2.0.2 released</title>
		<link>http://techblog.ralph-schuster.eu/2010/09/22/csvexcel-utility-package-v2-0-2-released/</link>
		<comments>http://techblog.ralph-schuster.eu/2010/09/22/csvexcel-utility-package-v2-0-2-released/#comments</comments>
		<pubDate>Wed, 22 Sep 2010 09:06:00 +0000</pubDate>
		<dc:creator>Ralph</dc:creator>
				<category><![CDATA[CSV]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://techblog.ralph-schuster.eu/?p=218</guid>
		<description><![CDATA[The package has undergone some minor bugfixing andJUnit Test was introduced for CSV files. Thanks to eldn for his help making this release. You can download it here or visit the Homepage of the utility where you will find some examples on how to use it.]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Ftechblog.ralph-schuster.eu%2F2010%2F09%2F22%2Fcsvexcel-utility-package-v2-0-2-released%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Ftechblog.ralph-schuster.eu%2F2010%2F09%2F22%2Fcsvexcel-utility-package-v2-0-2-released%2F&amp;source=TechnicalG&amp;style=compact&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>The package has undergone some minor bugfixing andJUnit Test was introduced for CSV files. Thanks to eldn for his help making this release.</p>
<p>You can download it <a title="Stable Release" href="http://www.ralph-schuster.eu/projects/csv/csv-stable.tar.gz" target="_self">here</a> or visit the <a title="CSV/Excel Utility Package" href="../csv-utility-package-for-java/" target="_self">Homepage</a> of the utility where you will find some examples on how to use it.</p>
]]></content:encoded>
			<wfw:commentRss>http://techblog.ralph-schuster.eu/2010/09/22/csvexcel-utility-package-v2-0-2-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Log4j Configuration Problem</title>
		<link>http://techblog.ralph-schuster.eu/2009/12/08/log4j-configuration-problem/</link>
		<comments>http://techblog.ralph-schuster.eu/2009/12/08/log4j-configuration-problem/#comments</comments>
		<pubDate>Tue, 08 Dec 2009 13:46:53 +0000</pubDate>
		<dc:creator>Ralph</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Log4j]]></category>
		<category><![CDATA[logging]]></category>

		<guid isPermaLink="false">http://techblog.ralph-schuster.eu/?p=159</guid>
		<description><![CDATA[It seems that some documentation that is hanging around the net contains incorrect information about correct configuration of the log4j system. Take care that you specify the properties filename as an URL rather than simple plain path location, e.g java -Dlog4j.configuration=file:///my/path/to/log4j.properties ... Log4j should find your configuration then. So make sure you include file:// there&#8230;]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Ftechblog.ralph-schuster.eu%2F2009%2F12%2F08%2Flog4j-configuration-problem%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Ftechblog.ralph-schuster.eu%2F2009%2F12%2F08%2Flog4j-configuration-problem%2F&amp;source=TechnicalG&amp;style=compact&amp;hashtags=Log4j,logging&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>It seems that some documentation that is hanging around the net contains incorrect information about correct configuration of the log4j system.</p>
<p>Take care that you specify the properties filename as an URL rather than simple plain path location, e.g</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">java -Dlog4j.configuration=<span style="color: #c20cb9; font-weight: bold;">file</span>:<span style="color: #000000; font-weight: bold;">///</span>my<span style="color: #000000; font-weight: bold;">/</span>path<span style="color: #000000; font-weight: bold;">/</span>to<span style="color: #000000; font-weight: bold;">/</span>log4j.properties ...</pre></div></div>

<p>Log4j should find your configuration then. So make sure you include file:// there&#8230; <img src='http://techblog.ralph-schuster.eu/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://techblog.ralph-schuster.eu/2009/12/08/log4j-configuration-problem/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSV Utility Package 2.0 Beta</title>
		<link>http://techblog.ralph-schuster.eu/2009/11/26/csv-utility-package-2-0-beta/</link>
		<comments>http://techblog.ralph-schuster.eu/2009/11/26/csv-utility-package-2-0-beta/#comments</comments>
		<pubDate>Thu, 26 Nov 2009 12:25:30 +0000</pubDate>
		<dc:creator>Ralph</dc:creator>
				<category><![CDATA[CSV]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Excel]]></category>

		<guid isPermaLink="false">http://techblog.ralph-schuster.eu/?p=154</guid>
		<description><![CDATA[Some work has been spent over the last weeks to upgrade the stable CSV Utility Package. Of course, the new version contains all the useful existing functionality. The most beneficial improvement is the introduction of ExcelReader and ExcelWriter classes that behave like the CSV pendants. This means that you do not have to care about [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Ftechblog.ralph-schuster.eu%2F2009%2F11%2F26%2Fcsv-utility-package-2-0-beta%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Ftechblog.ralph-schuster.eu%2F2009%2F11%2F26%2Fcsv-utility-package-2-0-beta%2F&amp;source=TechnicalG&amp;style=compact&amp;hashtags=CSV,Excel&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Some work has been spent over the last weeks to upgrade the stable <a title="CSV/Excel Utility Package Homepage" href="http://techblog.ralph-schuster.eu/csv-utility-package-for-java/" target="_self">CSV Utility Package</a>. Of course, the new version contains all the useful existing functionality. The most beneficial improvement is the introduction of ExcelReader and ExcelWriter classes that behave like the CSV pendants. This means that you do not have to care about the underlying output format when you want to read or write table-structured data. The most important changes are:</p>
<ul>
<li>Introduction of a <a title="API TableReader" href="http://ralph-schuster.eu/projects/csv/csv-current/doc/api/csv/TableReader.html" target="_blank">TableReader</a> and <a title="API TableWriter" href="http://ralph-schuster.eu/projects/csv/csv-current/doc/api/csv/TableWriter.html" target="_blank">TableWriter</a> interface</li>
<li>Introduction of Excel implementation</li>
<li>Aligning CSV and Excel implementations to these interfaces</li>
<li>Introduction of a <a title="API CSVFactory" href="http://ralph-schuster.eu/projects/csv/csv-current/doc/api/csv/CSVFactory.html" target="_blank">Factory</a> class in order to select correct implementation (CSV or Excel)</li>
</ul>
<p>The Beta version still requires some work in terms of documentation and code beautifying. However, the CSV part is already frozen and you can use it to upgrade your existing projects to the new utility version. The Excel part still faces some changes while improving usability.</p>
<p>Please be aware also that Java package structure needed to be changed to integrate the new classes and interfaces. Additionally, new 3rd party libraries were integrated (<a title="Apache POI" href="http://poi.apache.org/" target="_blank">Apache POI</a> and <a title="JavaBeans Activation API" href="http://java.sun.com/javase/7/docs/api/javax/activation/package-summary.html" target="_blank">JavaBeans Activation</a>).</p>
<p><a title="Download CSV 2.0 Beta" href="http://ralph-schuster.eu/projects/csv/csv-2.0beta2.tar.gz">Download</a> the Beta Version or browse the existing <a title="API CSV V2.0 Beta" href="http://ralph-schuster.eu/projects/csv/csv-2.0beta2/doc/api/" target="_blank">API Documentation</a>. Bugs and/or enhancements can be requested via <a title="Bugzilla" href="http://bugzilla.ralph-schuster.eu/bugzilla/" target="_blank">Bugzilla</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://techblog.ralph-schuster.eu/2009/11/26/csv-utility-package-2-0-beta/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Templating Java Package 1.0.1 released</title>
		<link>http://techblog.ralph-schuster.eu/2009/04/27/templating-java-package-101-released/</link>
		<comments>http://techblog.ralph-schuster.eu/2009/04/27/templating-java-package-101-released/#comments</comments>
		<pubDate>Mon, 27 Apr 2009 19:57:44 +0000</pubDate>
		<dc:creator>Ralph</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Templating]]></category>
		<category><![CDATA[Templates]]></category>

		<guid isPermaLink="false">http://techblog.ralph-schuster.eu/?p=97</guid>
		<description><![CDATA[A new minor release of Templating Java Package has just been released. It fixes a major bug when replacing markers with values that itself contain strings looking like regular expressions. All such expressions are masked now to prevent an exception. Download the release here.]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Ftechblog.ralph-schuster.eu%2F2009%2F04%2F27%2Ftemplating-java-package-101-released%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Ftechblog.ralph-schuster.eu%2F2009%2F04%2F27%2Ftemplating-java-package-101-released%2F&amp;source=TechnicalG&amp;style=compact&amp;hashtags=Templates&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>A new minor release of <a href="http://techblog.ralph-schuster.eu/templating-java-package/">Templating Java Package</a> has just been released. It fixes a major bug when replacing markers with values that itself contain strings looking like regular expressions. All such expressions are masked now to prevent an exception.</p>
<p>Download the release <a href="http://techblog.ralph-schuster.eu/templating-java-package/">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://techblog.ralph-schuster.eu/2009/04/27/templating-java-package-101-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Templating Java Package</title>
		<link>http://techblog.ralph-schuster.eu/2009/04/16/templating-java-package/</link>
		<comments>http://techblog.ralph-schuster.eu/2009/04/16/templating-java-package/#comments</comments>
		<pubDate>Thu, 16 Apr 2009 17:48:21 +0000</pubDate>
		<dc:creator>Ralph</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Templating]]></category>
		<category><![CDATA[Templates]]></category>

		<guid isPermaLink="false">http://techblog.ralph-schuster.eu/?p=84</guid>
		<description><![CDATA[You might remember my Templating post describing a Java class that implements a Typo3-like technique for a templating machine. I made a Java package out of it and you can use it right away. Just download it here. The API documentation is available, too.]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Ftechblog.ralph-schuster.eu%2F2009%2F04%2F16%2Ftemplating-java-package%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Ftechblog.ralph-schuster.eu%2F2009%2F04%2F16%2Ftemplating-java-package%2F&amp;source=TechnicalG&amp;style=compact&amp;hashtags=Templates,Templating&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>You might remember my <a title="TYPO3-like templating with Java" href="http://techblog.ralph-schuster.eu/2007/11/20/typo3-like-templating-with-java/" target="_self">Templating post</a> describing a Java class that implements a Typo3-like technique for a templating machine. I made a Java package out of it and you can use it right away. Just download it <a title="Download latest Templating Java Package" href="http://www.ralph-schuster.eu/projects/templating/templating-latest.tar.gz" target="_self">here</a>. The <a title="Templating API documentation" href="http://www.ralph-schuster.eu/projects/templating/templating-latest/doc/api/index.html" target="_blank">API documentation</a> is available, too.</p>
]]></content:encoded>
			<wfw:commentRss>http://techblog.ralph-schuster.eu/2009/04/16/templating-java-package/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSV Utility Package Released</title>
		<link>http://techblog.ralph-schuster.eu/2008/08/16/csv-utility-package-released/</link>
		<comments>http://techblog.ralph-schuster.eu/2008/08/16/csv-utility-package-released/#comments</comments>
		<pubDate>Sat, 16 Aug 2008 17:22:40 +0000</pubDate>
		<dc:creator>Ralph</dc:creator>
				<category><![CDATA[CSV]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Open Source]]></category>

		<guid isPermaLink="false">http://techblog.ralph-schuster.eu/?p=37</guid>
		<description><![CDATA[I decided recently to publish my very simple utility classes for reading and writing CSV files. The main project page is now available. The package, published under the GNU Lesser General Public License, allows you to easily integrate CSV functionality into your application. The utilities can be configured to use different column delimiter and separator [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Ftechblog.ralph-schuster.eu%2F2008%2F08%2F16%2Fcsv-utility-package-released%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Ftechblog.ralph-schuster.eu%2F2008%2F08%2F16%2Fcsv-utility-package-released%2F&amp;source=TechnicalG&amp;style=compact&amp;hashtags=Open+Source&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>I decided recently to publish my very simple utility classes for reading and writing CSV files. The main <a title="CSV Utility Package" href="http://techblog.ralph-schuster.eu/csv-utility-package-for-java/" target="_self">project page</a> is now available. The package, published under the <a title="GNU Lesser General Public License 3.0" href="http://www.gnu.org/licenses/lgpl-3.0.html" target="_blank">GNU Lesser General Public License</a>, allows you to easily integrate CSV functionality into your application. The utilities can be configured to use different column delimiter and separator characters in case you need to adopt some other versions of CSV. The default configuration conforms to the Excel style of CSV.</p>
<p>Since this CSV package uses streams, you are able to read from any stream. And, of course, you can write to any stream. You could even synchronize in your application by applying the <a title="Synchronizing Reader and Writer Threads" href="http://techblog.ralph-schuster.eu/2008/08/09/synchronizing-reader-and-writer-threads/" target="_self">reader/writer synchronization</a> described in one of my artices.</p>
<p>You can <a title="Latest Stable Release" href="http://www.ralph-schuster.eu/projects/csv/csv-current.tar.gz" target="_self">download</a> the latest stable release at the <a title="CSV Utility Package" href="http://techblog.ralph-schuster.eu/csv-utility-package-for-java/" target="_self">main project page</a>.</p>
<p>Here is a short example on reading a CSV file using the <a title="CSVReader API Documentation" href="http://ralph-schuster.eu/projects/csv/csv-current/doc/api/csv/CSVReader.html" target="_blank">CSVReader</a> class:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">java.<span style="color: #006633;">io</span>.<span style="color: #003399;">File</span> f <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> java.<span style="color: #006633;">io</span>.<span style="color: #003399;">File</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;csv-test.csv&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
csv.<span style="color: #006633;">CSVReader</span> in <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> csv.<span style="color: #006633;">CSVReader</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> java.<span style="color: #006633;">io</span>.<span style="color: #003399;">FileReader</span><span style="color: #009900;">&#40;</span>f<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">while</span> <span style="color: #009900;">&#40;</span>in.<span style="color: #006633;">hasNext</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #003399;">String</span> columns<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> in.<span style="color: #006633;">next</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #666666; font-style: italic;">// Do something here</span>
<span style="color: #009900;">&#125;</span>
in.<span style="color: #006633;">close</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Please note that the CSVReader class actually implements the Iterator interface.</p>
<p>Writing a CSV file is even easier. Just create an instance of the <a title="CSVWriter API Documentation" href="http://ralph-schuster.eu/projects/csv/csv-current/doc/api/csv/CSVWriter.html" target="_blank">CSVWriter</a> class and pass it your rows:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">java.<span style="color: #006633;">io</span>.<span style="color: #003399;">File</span> f <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> java.<span style="color: #006633;">io</span>.<span style="color: #003399;">File</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;csv-test.csv&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
CSVWriter out <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> CSVWriter<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> java.<span style="color: #006633;">io</span>.<span style="color: #003399;">FileWriter</span><span style="color: #009900;">&#40;</span>f<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
out.<span style="color: #006633;">printRow</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span> <span style="color: #0000ff;">&quot;0:0&quot;</span>, <span style="color: #0000ff;">&quot;0:1&quot;</span>, <span style="color: #0000ff;">&quot;0:2&quot;</span> <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
out.<span style="color: #006633;">printRow</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span> <span style="color: #0000ff;">&quot;1:0&quot;</span>, <span style="color: #0000ff;">&quot;1:1&quot;</span>, <span style="color: #0000ff;">&quot;1:2&quot;</span> <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
out.<span style="color: #006633;">close</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<h2>Documentation</h2>
<p>The <a title="Current API Documentation" href="http://ralph-schuster.eu/projects/csv/csv-current/doc/api/index.html" target="_blank">API documentation</a> tells you all details and configuration parameters that you can use to control the behaviour of the reader and writer classes.</p>
]]></content:encoded>
			<wfw:commentRss>http://techblog.ralph-schuster.eu/2008/08/16/csv-utility-package-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Synchronizing Reader and Writer Threads</title>
		<link>http://techblog.ralph-schuster.eu/2008/08/09/synchronizing-reader-and-writer-threads/</link>
		<comments>http://techblog.ralph-schuster.eu/2008/08/09/synchronizing-reader-and-writer-threads/#comments</comments>
		<pubDate>Sat, 09 Aug 2008 13:35:45 +0000</pubDate>
		<dc:creator>Ralph</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Bounded Buffer Problem]]></category>
		<category><![CDATA[Producer/Consumer Problem]]></category>
		<category><![CDATA[Semaphores]]></category>
		<category><![CDATA[Synchronization]]></category>
		<category><![CDATA[Synchronizing threads]]></category>

		<guid isPermaLink="false">http://techblog.ralph-schuster.eu/?p=35</guid>
		<description><![CDATA[Here are two functions that you should use when you want two threads, producer and consumer, to be synchronized. I used these functions mainly to ensure that the reader will stop until an object is ready to read. An advantage is that you can control how many objects are in memory at the same time. [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Ftechblog.ralph-schuster.eu%2F2008%2F08%2F09%2Fsynchronizing-reader-and-writer-threads%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Ftechblog.ralph-schuster.eu%2F2008%2F08%2F09%2Fsynchronizing-reader-and-writer-threads%2F&amp;source=TechnicalG&amp;style=compact&amp;hashtags=Bounded+Buffer+Problem,Producer%2FConsumer+Problem,Semaphores,Synchronization,Synchronizing+threads&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Here are two functions that you should use when you want two threads, producer and consumer, to be synchronized. I used these functions mainly to ensure that the reader will stop until an object is ready to read. An advantage is that you can control how many objects are in memory at the same time.</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">&nbsp;
<span style="color: #000000; font-weight: bold;">protected</span> List<span style="color: #339933;">&lt;</span>Object<span style="color: #339933;">&gt;</span> availableObjects <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> ArrayList<span style="color: #339933;">&lt;</span>Object<span style="color: #339933;">&gt;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #008000; font-style: italic; font-weight: bold;">/**
 * Delivers the next object.
 * Used by the reader/consumer thread.
 */</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">synchronized</span> <span style="color: #003399;">Object</span> next<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #003399;">Object</span> rc<span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">while</span> <span style="color: #009900;">&#40;</span>availableObjects.<span style="color: #006633;">isEmpty</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
			wait<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">InterruptedException</span> e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
	rc <span style="color: #339933;">=</span> availableObjects.<span style="color: #006633;">remove</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	notify<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">return</span> rc<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #008000; font-style: italic; font-weight: bold;">/**
 * Adds a new object to the list of available objects.
 * Used by the writer/producer thread.
 */</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">synchronized</span> <span style="color: #000066; font-weight: bold;">void</span> addObject<span style="color: #009900;">&#40;</span><span style="color: #003399;">Object</span> o<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">while</span> <span style="color: #009900;">&#40;</span>availableObjects.<span style="color: #006633;">size</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&gt;=</span> <span style="color: #cc66cc;">20</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
			wait<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">InterruptedException</span> e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
	availableObjects.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span>o<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	notify<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>The main idea was taken from Silberschatz&#8217; book about <a href="http://www.amazon.de/Applied-Operating-System-Concepts/dp/0471365084">Operating Systems</a>. You have to make sure that you never call the next() method when the last object was read. So be careful when your number of objects produced is limited.</p>
]]></content:encoded>
			<wfw:commentRss>http://techblog.ralph-schuster.eu/2008/08/09/synchronizing-reader-and-writer-threads/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Enable Browser Caching for Tomcat&#8217;s Deliveries</title>
		<link>http://techblog.ralph-schuster.eu/2008/02/19/enable-browser-caching-for-tomcats-deliveries/</link>
		<comments>http://techblog.ralph-schuster.eu/2008/02/19/enable-browser-caching-for-tomcats-deliveries/#comments</comments>
		<pubDate>Tue, 19 Feb 2008 10:55:13 +0000</pubDate>
		<dc:creator>Ralph</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Tomcat]]></category>
		<category><![CDATA[caching]]></category>
		<category><![CDATA[no-cache]]></category>

		<guid isPermaLink="false">http://techblog.ralph-schuster.eu/2008/02/19/enable-browser-caching-for-tomcats-deliveries/</guid>
		<description><![CDATA[Tomcat automatically adds &#8220;no-cache&#8221; directives to each response. This is not a good idea when you are not using Apache as the serving host for static content. I found a very easy way to get rid of that HTTP header. Just add a new file named &#8220;context.xml&#8221; to the WEB-INF directory of your application: 1 [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Ftechblog.ralph-schuster.eu%2F2008%2F02%2F19%2Fenable-browser-caching-for-tomcats-deliveries%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Ftechblog.ralph-schuster.eu%2F2008%2F02%2F19%2Fenable-browser-caching-for-tomcats-deliveries%2F&amp;source=TechnicalG&amp;style=compact&amp;hashtags=caching,no-cache&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Tomcat automatically adds &#8220;no-cache&#8221; directives to each response. This is not a good idea when you are not using Apache as the serving host for static content. I found a very easy way to get rid of that HTTP header. Just add a new file named &#8220;context.xml&#8221; to the WEB-INF directory of your application:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;context<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;valve</span> <span style="color: #000066;">className</span>=<span style="color: #ff0000;">&quot;org.apache.catalina.authenticator.BasicAuthenticator&quot;</span>  </span>
<span style="color: #009900;">		<span style="color: #000066;">disableProxyCaching</span>=<span style="color: #ff0000;">&quot;false&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/context<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>For finer control, please have a look at <a href="http://www.symphonious.net/2007/06/19/caching-in-tomcat/" title="Symphonious' article">Symphonious&#8217; article</a> on that topic.</p>
]]></content:encoded>
			<wfw:commentRss>http://techblog.ralph-schuster.eu/2008/02/19/enable-browser-caching-for-tomcats-deliveries/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Handling Unix&#8217; cron-like information in Java</title>
		<link>http://techblog.ralph-schuster.eu/2008/02/01/handling-unix-cron-like-information-in-java/</link>
		<comments>http://techblog.ralph-schuster.eu/2008/02/01/handling-unix-cron-like-information-in-java/#comments</comments>
		<pubDate>Fri, 01 Feb 2008 14:28:27 +0000</pubDate>
		<dc:creator>Ralph</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[cron]]></category>
		<category><![CDATA[crontab]]></category>
		<category><![CDATA[scheduling]]></category>

		<guid isPermaLink="false">http://techblog.ralph-schuster.eu/2008/02/01/handling-unix-cron-like-information-in-java/</guid>
		<description><![CDATA[I recently had the requirement to write scheduled tasks within Java. I decided to use cron-like syntax in order to define when a task should run. A special class was created handling the scheduling information. Here it is: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Ftechblog.ralph-schuster.eu%2F2008%2F02%2F01%2Fhandling-unix-cron-like-information-in-java%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Ftechblog.ralph-schuster.eu%2F2008%2F02%2F01%2Fhandling-unix-cron-like-information-in-java%2F&amp;source=TechnicalG&amp;style=compact&amp;hashtags=cron,crontab,scheduling&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>I recently had the requirement to write scheduled tasks within Java. I decided to use cron-like syntax in order to define when a task should run. A special class was created handling the scheduling information. Here it is:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
</pre></td><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">mypackage</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.Calendar</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.GregorianCalendar</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #008000; font-style: italic; font-weight: bold;">/**
 * Provides cron-like scheduling information.
 * This class implements cron-like definition of scheduling information.
 * Various methods can be used to check whether a timestamp matches the
 * schedule or not. However, there is a slight difference between cron and
 * this class. Cron describes a match when either the day of month and month
 * or the day of week are met. This class requires both to be met for a match.
 * Also note that Calendar defines Sunday through Saturday with 1 through 7 respectively
 * @author RalphSchuster
 *
 */</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> CronSchedule <span style="color: #000000; font-weight: bold;">implements</span> SlamConstants <span style="color: #009900;">&#123;</span>
&nbsp;
	<span style="color: #008000; font-style: italic; font-weight: bold;">/**
	 * Types being used.
	 * This array defines the types and their indices.
	 */</span>
	<span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">int</span> TYPES<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #000066; font-weight: bold;">int</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #003399;">Calendar</span>.<span style="color: #006633;">MINUTE</span>, <span style="color: #003399;">Calendar</span>.<span style="color: #006633;">HOUR_OF_DAY</span>, 
		<span style="color: #003399;">Calendar</span>.<span style="color: #006633;">DAY_OF_MONTH</span>, <span style="color: #003399;">Calendar</span>.<span style="color: #006633;">MONTH</span>, 
		<span style="color: #003399;">Calendar</span>.<span style="color: #006633;">DAY_OF_WEEK</span>
	<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">private</span> AbstractTimeValue timeValues<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> AbstractTimeValue<span style="color: #009900;">&#91;</span>TYPES.<span style="color: #006633;">length</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #008000; font-style: italic; font-weight: bold;">/**
	 * Default constructor
	 * Constructor with all terms set to &quot;*&quot;.
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> CronSchedule<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">this</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;*&quot;</span>, <span style="color: #0000ff;">&quot;*&quot;</span>, <span style="color: #0000ff;">&quot;*&quot;</span>, <span style="color: #0000ff;">&quot;*&quot;</span>, <span style="color: #0000ff;">&quot;*&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #008000; font-style: italic; font-weight: bold;">/**
	 * Constructor with cron-style string initialization.
	 * The cron style is: $minute $hour $dayOfMonth $month $dayOfWeek
	 * @param schedule
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> CronSchedule<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> schedule<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		set<span style="color: #009900;">&#40;</span>schedule<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #008000; font-style: italic; font-weight: bold;">/**
	 * Constructor with separate initialization values.
	 * @param min - minute definition
	 * @param hour - hour definition
	 * @param dom - day of month definition
	 * @param mon - month definition
	 * @param dow - day of week definition
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> CronSchedule<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> min, <span style="color: #003399;">String</span> hour, <span style="color: #003399;">String</span> dom, <span style="color: #003399;">String</span> mon, <span style="color: #003399;">String</span> dow<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		set<span style="color: #009900;">&#40;</span><span style="color: #003399;">Calendar</span>.<span style="color: #006633;">MINUTE</span>, min<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		set<span style="color: #009900;">&#40;</span><span style="color: #003399;">Calendar</span>.<span style="color: #006633;">HOUR_OF_DAY</span>, hour<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		set<span style="color: #009900;">&#40;</span><span style="color: #003399;">Calendar</span>.<span style="color: #006633;">DAY_OF_MONTH</span>, dom<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		set<span style="color: #009900;">&#40;</span><span style="color: #003399;">Calendar</span>.<span style="color: #006633;">MONTH</span>, mon<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		set<span style="color: #009900;">&#40;</span><span style="color: #003399;">Calendar</span>.<span style="color: #006633;">DAY_OF_WEEK</span>, dow<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #008000; font-style: italic; font-weight: bold;">/**
	 * Sets the cron schedule.
	 * The cron style is: $minute $hour $dayOfMonth $month $dayOfWeek
	 * The function will return any characters that follow the cron definition
	 * @param schedule - cron-like schedule definition
	 * @return characters following the cron definition.
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> set<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> schedule<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #003399;">String</span> parts<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> schedule.<span style="color: #006633;">split</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot; &quot;</span>, TYPES.<span style="color: #006633;">length</span><span style="color: #339933;">+</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>parts.<span style="color: #006633;">length</span> <span style="color: #339933;">&lt;</span> TYPES.<span style="color: #006633;">length</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throw</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">IllegalArgumentException</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Invalid cron format: &quot;</span><span style="color: #339933;">+</span>schedule<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> i<span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> i<span style="color: #339933;">&lt;</span>TYPES.<span style="color: #006633;">length</span><span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> set<span style="color: #009900;">&#40;</span>getType<span style="color: #009900;">&#40;</span>i<span style="color: #009900;">&#41;</span>, parts<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">return</span> parts.<span style="color: #006633;">length</span> <span style="color: #339933;">&gt;</span> TYPES.<span style="color: #006633;">length</span> <span style="color: #339933;">?</span> parts<span style="color: #009900;">&#91;</span>TYPES.<span style="color: #006633;">length</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">:</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #008000; font-style: italic; font-weight: bold;">/**
	 * Sets the time values accordingly
	 * @param type - Calendar constant to define what values will be set
	 * @param values - comma-separated list of definitions for that type
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> set<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> type, <span style="color: #003399;">String</span> values<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #666666; font-style: italic;">// Split the values</span>
		<span style="color: #003399;">String</span> parts<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> values.<span style="color: #006633;">split</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;,&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		AbstractTimeValue result<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> AbstractTimeValue<span style="color: #009900;">&#91;</span>parts.<span style="color: #006633;">length</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// Iterate over entries</span>
		<span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> i<span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> i<span style="color: #339933;">&lt;</span>parts .<span style="color: #006633;">length</span><span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #666666; font-style: italic;">// Decide what time value is set and create it</span>
			<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>parts<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #006633;">indexOf</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;/&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> result<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> TimeSteps<span style="color: #009900;">&#40;</span>parts<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000000; font-weight: bold;">else</span> <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>parts<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #006633;">indexOf</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;-&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> result<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> TimeRange<span style="color: #009900;">&#40;</span>parts<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000000; font-weight: bold;">else</span> <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>parts<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #006633;">equals</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;*&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> result<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> TimeAll<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000000; font-weight: bold;">else</span> result<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> SingleTimeValue<span style="color: #009900;">&#40;</span>parts<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// Save the array</span>
		set<span style="color: #009900;">&#40;</span>type, result<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #008000; font-style: italic; font-weight: bold;">/**
	 * Sets the values for a specific type
	 * @param type - Calendar constant defining the time type
	 * @param values - values to be set
	 */</span>
	<span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000066; font-weight: bold;">void</span> set<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> type, AbstractTimeValue values<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		timeValues<span style="color: #009900;">&#91;</span>getIndex<span style="color: #009900;">&#40;</span>type<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> values<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #008000; font-style: italic; font-weight: bold;">/**
	 * Returns the values for a specific time type
	 * @param type - Calendar constant defining the type
	 * @return time value definitions
	 */</span>
	<span style="color: #000000; font-weight: bold;">protected</span> AbstractTimeValue<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> getValues<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> type<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">return</span> timeValues<span style="color: #009900;">&#91;</span>getIndex<span style="color: #009900;">&#40;</span>type<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #008000; font-style: italic; font-weight: bold;">/**
	 * Returns the cron-like definition string for the given time value
	 * @param type - Calendar constant defining time type
	 * @return cron-like definition
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> get<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> type<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		AbstractTimeValue values<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> getValues<span style="color: #009900;">&#40;</span>type<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #003399;">String</span> rc <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> i<span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> i<span style="color: #339933;">&lt;</span>values .<span style="color: #006633;">length</span><span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> rc <span style="color: #339933;">+=</span> <span style="color: #0000ff;">&quot;,&quot;</span><span style="color: #339933;">+</span>values<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">return</span> rc.<span style="color: #006633;">substring</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #008000; font-style: italic; font-weight: bold;">/**
	 * Returns the cron-like definition of the schedule.
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> toString<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #003399;">String</span> rc <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> i<span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> i<span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span>TYPES.<span style="color: #006633;">length</span><span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			rc <span style="color: #339933;">+=</span> <span style="color: #0000ff;">&quot; &quot;</span><span style="color: #339933;">+</span>get<span style="color: #009900;">&#40;</span>getType<span style="color: #009900;">&#40;</span>i<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #000000; font-weight: bold;">return</span> rc.<span style="color: #006633;">trim</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #008000; font-style: italic; font-weight: bold;">/**
	 * Checks whether given timestamp matches with defined schedule.
	 * This is default check method. All criteria must be met including seconds to be 0.
	 * @param timeStamp - time in ms since Epoch time
	 * @return true when schedule matches
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">boolean</span> matches<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">long</span> timeStamp<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">return</span> matches<span style="color: #009900;">&#40;</span>getCalendar<span style="color: #009900;">&#40;</span>timeStamp<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #008000; font-style: italic; font-weight: bold;">/**
	 * Checks whether given timestamp matches with defined schedule.
	 * This is default check method. All criteria must be met including seconds to be 0.
	 * @param cal - calendar date
	 * @return true when schedule matches
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">boolean</span> matches<span style="color: #009900;">&#40;</span><span style="color: #003399;">Calendar</span> cal<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">return</span> isMinute<span style="color: #009900;">&#40;</span>cal<span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #009900;">&#40;</span>cal.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span><span style="color: #003399;">Calendar</span>.<span style="color: #006633;">SECOND</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #008000; font-style: italic; font-weight: bold;">/**
	 * Checks whether given timestamp matches with defined schedule.
	 * This method can be used when seconds are not relevant for matching.
	 * This is default check method.
	 * @param timeStamp - time in ms since Epoch time
	 * @return true when schedule matches
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">boolean</span> isMinute<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">long</span> timeStamp<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">return</span> isMinute<span style="color: #009900;">&#40;</span>getCalendar<span style="color: #009900;">&#40;</span>timeStamp<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #008000; font-style: italic; font-weight: bold;">/**
	 * Checks whether given calendar date matches with defined schedule.
	 * This method can be used when seconds are not relevant for matching.
	 * @param cal - calendar date
	 * @return true when schedule matches
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">boolean</span> isMinute<span style="color: #009900;">&#40;</span><span style="color: #003399;">Calendar</span> cal<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">return</span> matches<span style="color: #009900;">&#40;</span><span style="color: #003399;">Calendar</span>.<span style="color: #006633;">MINUTE</span>, cal<span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> isHour<span style="color: #009900;">&#40;</span>cal<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #008000; font-style: italic; font-weight: bold;">/**
	 * Checks whether given timestamp matches with defined hour schedule.
	 * This method can be used when minute definition is not relevant for matching.
	 * @param timestamp - time in ms since Epoch time
	 * @return true when schedule matches
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">boolean</span> isHour<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">long</span> timeStamp<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">return</span> isHour<span style="color: #009900;">&#40;</span>getCalendar<span style="color: #009900;">&#40;</span>timeStamp<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #008000; font-style: italic; font-weight: bold;">/**
	 * Checks whether given calendar date matches with defined hour schedule.
	 * This method can be used when minute definition is not relevant for matching.
	 * @param cal - calendar date
	 * @return true when schedule matches
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">boolean</span> isHour<span style="color: #009900;">&#40;</span><span style="color: #003399;">Calendar</span> cal<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">return</span> matches<span style="color: #009900;">&#40;</span><span style="color: #003399;">Calendar</span>.<span style="color: #006633;">HOUR_OF_DAY</span>, cal<span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> isDay<span style="color: #009900;">&#40;</span>cal<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #008000; font-style: italic; font-weight: bold;">/**
	 * Checks whether given timestamp matches with defined day schedule.
	 * This method can be used when minute and hour definitions are not relevant for matching.
	 * @param timestamp - time in ms since Epoch time
	 * @return true when schedule matches
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">boolean</span> isDay<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">long</span> timeStamp<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">return</span> isDay<span style="color: #009900;">&#40;</span>getCalendar<span style="color: #009900;">&#40;</span>timeStamp<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #008000; font-style: italic; font-weight: bold;">/**
	 * Checks whether given calendar date matches with defined day schedule.
	 * This method can be used when minute and hour definitions are not relevant for matching.
	 * @param cal - calendar date
	 * @return true when schedule matches
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">boolean</span> isDay<span style="color: #009900;">&#40;</span><span style="color: #003399;">Calendar</span> cal<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">return</span> 
			matches<span style="color: #009900;">&#40;</span><span style="color: #003399;">Calendar</span>.<span style="color: #006633;">DAY_OF_WEEK</span>, cal<span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span>
			matches<span style="color: #009900;">&#40;</span><span style="color: #003399;">Calendar</span>.<span style="color: #006633;">DAY_OF_MONTH</span>, cal<span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span>
			matches<span style="color: #009900;">&#40;</span><span style="color: #003399;">Calendar</span>.<span style="color: #006633;">MONTH</span>, cal<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #008000; font-style: italic; font-weight: bold;">/**
	 * Checks whether specific schedule definition matches against the given calendar date.
	 * @param type - Calendar constant defining time type to check for
	 * @param calendar - calendar representing the date to check
	 * @return true when definition matches
	 */</span>
	<span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000066; font-weight: bold;">boolean</span> matches<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> type, <span style="color: #003399;">Calendar</span> calendar<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #666666; font-style: italic;">// get the definitions and the comparison value</span>
		AbstractTimeValue defs<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> timeValues<span style="color: #009900;">&#91;</span>getIndex<span style="color: #009900;">&#40;</span>type<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">int</span> value <span style="color: #339933;">=</span> calendar.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span>type<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// Any of the criteria must be met</span>
		<span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> i<span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> i<span style="color: #339933;">&lt;</span>defs.<span style="color: #006633;">length</span><span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>defs<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #006633;">matches</span><span style="color: #009900;">&#40;</span>value<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">true</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">false</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #008000; font-style: italic; font-weight: bold;">/**
	 * Creates the calendar for a timestamp.
	 * @param timeStamp - timestamp
	 * @return calendar
	 */</span>
	<span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #003399;">Calendar</span> getCalendar<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">long</span> timeStamp<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #003399;">Calendar</span> rc <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">GregorianCalendar</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		rc.<span style="color: #006633;">setTimeInMillis</span><span style="color: #009900;">&#40;</span>timeStamp<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #008000; font-style: italic; font-weight: bold;">/**
	 * Returns the type at the specified index
	 * @param index - index
	 * @return Calendar constant of type
	 */</span>
	<span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">int</span> getType<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> index<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">return</span> TYPES<span style="color: #009900;">&#91;</span>index<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #008000; font-style: italic; font-weight: bold;">/**
	 * Returns the index for the specified Calendar type.
	 * @param type - Calendar constant for type
	 * @return internal index
	 */</span>
	<span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">int</span> getIndex<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> type<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> i<span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> i<span style="color: #339933;">&lt;</span>TYPES.<span style="color: #006633;">length</span><span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>TYPES<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> type<span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">return</span> i<span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #000000; font-weight: bold;">throw</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">IllegalArgumentException</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;No such time type: &quot;</span><span style="color: #339933;">+</span>type<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #008000; font-style: italic; font-weight: bold;">/**
	 * Base class for timing values.
	 * @author RalphSchuster
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">abstract</span> <span style="color: #000000; font-weight: bold;">class</span> AbstractTimeValue <span style="color: #009900;">&#123;</span>
&nbsp;
		<span style="color: #008000; font-style: italic; font-weight: bold;">/**
		 * Returns true when given time value matches defined time.
		 * @param timeValue - time value to evaluate
		 * @return true when time matches
		 */</span>
		<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">abstract</span> <span style="color: #000066; font-weight: bold;">boolean</span> matches<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> timeValue<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #008000; font-style: italic; font-weight: bold;">/**
	 * Represents a single time value, e.g. 9
	 * @author RalphSchuster
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">class</span> SingleTimeValue <span style="color: #000000; font-weight: bold;">extends</span> AbstractTimeValue <span style="color: #009900;">&#123;</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">int</span> value<span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">public</span> SingleTimeValue<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> value<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			setValue<span style="color: #009900;">&#40;</span>value<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">public</span> SingleTimeValue<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> value<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			setValue<span style="color: #009900;">&#40;</span><span style="color: #003399;">Integer</span>.<span style="color: #006633;">parseInt</span><span style="color: #009900;">&#40;</span>value<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #008000; font-style: italic; font-weight: bold;">/**
		 * @return the value
		 */</span>
		<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">int</span> getValue<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">return</span> value<span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #008000; font-style: italic; font-weight: bold;">/**
		 * @param value the value to set
		 */</span>
		<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> setValue<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> value<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">value</span> <span style="color: #339933;">=</span> value<span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #008000; font-style: italic; font-weight: bold;">/**
		 * Returns true when given time value matches defined value.
		 * @param timeValue - time value to evaluate
		 * @return true when time matches
		 */</span>
		<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">boolean</span> matches<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> timeValue<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">return</span> timeValue <span style="color: #339933;">==</span> getValue<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #008000; font-style: italic; font-weight: bold;">/**
		 * Returns cron-like string of this definition.
		 */</span>
		<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> toString<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">return</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">+</span>getValue<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #008000; font-style: italic; font-weight: bold;">/**
	 * Represents a time range, e.g. 5-9
	 * @author RalphSchuster
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">class</span> TimeRange <span style="color: #000000; font-weight: bold;">extends</span> AbstractTimeValue <span style="color: #009900;">&#123;</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">int</span> startValue<span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">int</span> endValue<span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">public</span> TimeRange<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> startValue, <span style="color: #000066; font-weight: bold;">int</span> endValue<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			setStartValue<span style="color: #009900;">&#40;</span>startValue<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			setEndValue<span style="color: #009900;">&#40;</span>endValue<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">public</span> TimeRange<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> range<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000066; font-weight: bold;">int</span> dashPos <span style="color: #339933;">=</span> range.<span style="color: #006633;">indexOf</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;-&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			setStartValue<span style="color: #009900;">&#40;</span><span style="color: #003399;">Integer</span>.<span style="color: #006633;">parseInt</span><span style="color: #009900;">&#40;</span>range.<span style="color: #006633;">substring</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span>, dashPos<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			setEndValue<span style="color: #009900;">&#40;</span><span style="color: #003399;">Integer</span>.<span style="color: #006633;">parseInt</span><span style="color: #009900;">&#40;</span>range.<span style="color: #006633;">substring</span><span style="color: #009900;">&#40;</span>dashPos<span style="color: #339933;">+</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #008000; font-style: italic; font-weight: bold;">/**
		 * @return the endValue
		 */</span>
		<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">int</span> getEndValue<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">return</span> endValue<span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #008000; font-style: italic; font-weight: bold;">/**
		 * @param endValue the endValue to set
		 */</span>
		<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> setEndValue<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> endValue<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">endValue</span> <span style="color: #339933;">=</span> endValue<span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #008000; font-style: italic; font-weight: bold;">/**
		 * @return the startValue
		 */</span>
		<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">int</span> getStartValue<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">return</span> startValue<span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #008000; font-style: italic; font-weight: bold;">/**
		 * @param startValue the startValue to set
		 */</span>
		<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> setStartValue<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> startValue<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">startValue</span> <span style="color: #339933;">=</span> startValue<span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #008000; font-style: italic; font-weight: bold;">/**
		 * Returns true when given time value falls in range.
		 * @param timeValue - time value to evaluate
		 * @return true when time falls in range
		 */</span>
		<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">boolean</span> matches<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> timeValue<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">return</span> <span style="color: #009900;">&#40;</span>getStartValue<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&lt;=</span> timeValue<span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #009900;">&#40;</span>timeValue <span style="color: #339933;">&lt;=</span> getEndValue<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #008000; font-style: italic; font-weight: bold;">/**
		 * Returns cron-like string of this definition.
		 */</span>
		<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> toString<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">return</span> getStartValue<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">+</span><span style="color: #0000ff;">&quot;-&quot;</span><span style="color: #339933;">+</span>getEndValue<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #008000; font-style: italic; font-weight: bold;">/**
	 * Represents a time interval, e.g. 0-4/10
	 * @author RalphSchuster
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">class</span> TimeSteps <span style="color: #000000; font-weight: bold;">extends</span> AbstractTimeValue <span style="color: #009900;">&#123;</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">private</span> AbstractTimeValue range<span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">int</span> steps<span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">public</span> TimeSteps<span style="color: #009900;">&#40;</span>AbstractTimeValue range, <span style="color: #000066; font-weight: bold;">int</span> steps<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			setRange<span style="color: #009900;">&#40;</span>range<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			setSteps<span style="color: #009900;">&#40;</span>steps<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">public</span> TimeSteps<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> def<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000066; font-weight: bold;">int</span> divPos <span style="color: #339933;">=</span> def.<span style="color: #006633;">indexOf</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;/&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #003399;">String</span> r <span style="color: #339933;">=</span> def.<span style="color: #006633;">substring</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span>, divPos<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>r.<span style="color: #006633;">equals</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;*&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> setRange<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> TimeAll<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000000; font-weight: bold;">else</span> <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>r.<span style="color: #006633;">indexOf</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;-&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> setRange<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> TimeRange<span style="color: #009900;">&#40;</span>r<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000000; font-weight: bold;">else</span> <span style="color: #000000; font-weight: bold;">throw</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">IllegalArgumentException</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Invalid range: &quot;</span><span style="color: #339933;">+</span>def<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			setSteps<span style="color: #009900;">&#40;</span><span style="color: #003399;">Integer</span>.<span style="color: #006633;">parseInt</span><span style="color: #009900;">&#40;</span>def.<span style="color: #006633;">substring</span><span style="color: #009900;">&#40;</span>divPos<span style="color: #339933;">+</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #008000; font-style: italic; font-weight: bold;">/**
		 * Returns true when given time value matches the interval.
		 * @param timeValue - time value to evaluate
		 * @return true when time matches the interval
		 */</span>
		<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">boolean</span> matches<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> timeValue<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000066; font-weight: bold;">boolean</span> rc <span style="color: #339933;">=</span> getRange<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">matches</span><span style="color: #009900;">&#40;</span>timeValue<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>rc<span style="color: #009900;">&#41;</span> rc <span style="color: #339933;">=</span> timeValue <span style="color: #339933;">%</span> getSteps<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
			<span style="color: #000000; font-weight: bold;">return</span> rc<span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #008000; font-style: italic; font-weight: bold;">/**
		 * @return the range
		 */</span>
		<span style="color: #000000; font-weight: bold;">public</span> AbstractTimeValue getRange<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">return</span> range<span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #008000; font-style: italic; font-weight: bold;">/**
		 * @param range the range to set
		 */</span>
		<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> setRange<span style="color: #009900;">&#40;</span>AbstractTimeValue range<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">range</span> <span style="color: #339933;">=</span> range<span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #008000; font-style: italic; font-weight: bold;">/**
		 * @return the steps
		 */</span>
		<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">int</span> getSteps<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">return</span> steps<span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #008000; font-style: italic; font-weight: bold;">/**
		 * @param steps the steps to set
		 */</span>
		<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> setSteps<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> steps<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">steps</span> <span style="color: #339933;">=</span> steps<span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #008000; font-style: italic; font-weight: bold;">/**
		 * Returns cron-like string of this definition.
		 */</span>
		<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> toString<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">return</span> getRange<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">+</span><span style="color: #0000ff;">&quot;/&quot;</span><span style="color: #339933;">+</span>getSteps<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #008000; font-style: italic; font-weight: bold;">/**
	 * Represents the ALL time, *.
	 * @author RalphSchuster
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">class</span> TimeAll <span style="color: #000000; font-weight: bold;">extends</span> AbstractTimeValue <span style="color: #009900;">&#123;</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">public</span> TimeAll<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #008000; font-style: italic; font-weight: bold;">/**
		 * Returns always true.
		 * @param timeValue - time value to evaluate
		 * @return true 
		 */</span>
		<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">boolean</span> matches<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> timeValue<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">true</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #008000; font-style: italic; font-weight: bold;">/**
		 * Returns cron-like string of this definition.
		 */</span>
		<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> toString<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">return</span> <span style="color: #0000ff;">&quot;*&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #339933;">&lt;/</span>values<span style="color: #339933;">&gt;&lt;/</span>parts<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

<p>Some explanations how you can use this class:</p>
<ul>
<li>Create the schedule by just passing in the cron-like definition to the constructor method.</li>
<li>You can also create a schedule by using the default constructor and then setting the schedule with set(String). The advantage of this method is that it will return you any additional information that follows the schedule definition, e.g. as you can find it in /etc/crontab.</li>
<li>Beware that Java defines Sunday as 1, Saturday as 7. The real crontab ranges from 0-6 (7 as sunday, too)</li>
<li>matches(long) (line 149) is the default method to check whether a timestamp fulfills the requirements of the schedule definition. This method always checks whether the second of the timestamp is 0 (no millisecond check!).</li>
<li>isMinute(long), isHour(long), isDay(long) check the given timestamp only if the respective time requirement is met. That mean isMinute() will ignore seconds, isHour() will ignore minutes and seconds, isDay() will ignore time of the day.</li>
<li>Override getCalendar(long) (line 251) when you don&#8217;t wanna use the Gregorian Calendar or need a different timezone than your current default timezone.</li>
<li>You can easily add more time value checks (e.g. week of the year) by simply enhancing the TYPES array (line 23)</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://techblog.ralph-schuster.eu/2008/02/01/handling-unix-cron-like-information-in-java/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

