Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Update licence

  • Loading branch information...
commit c75130efbe36f108427a1b275922a9909a1bfbda 1 parent 71ba10f
@lincolnthree lincolnthree authored
Showing with 1,313 additions and 869 deletions.
  1. +3 −0  CHANGELOG.txt
  2. +201 −0 LICENSE
  3. +5 −0 NOTICE
  4. +2 −2 pom.xml
  5. +37 −39 src/main/java/com/ocpsoft/pretty/time/AbstractTimeUnit.java
  6. +39 −50 src/main/java/com/ocpsoft/pretty/time/BasicTimeFormat.java
  7. +53 −48 src/main/java/com/ocpsoft/pretty/time/Duration.java
  8. +297 −312 src/main/java/com/ocpsoft/pretty/time/PrettyTime.java
  9. +26 −58 src/main/java/com/ocpsoft/pretty/time/TimeFormat.java
  10. +47 −63 src/main/java/com/ocpsoft/pretty/time/TimeUnit.java
  11. +15 −0 src/main/java/com/ocpsoft/pretty/time/i18n/Resources.java
  12. +15 −0 src/main/java/com/ocpsoft/pretty/time/i18n/Resources_bg.java
  13. +15 −0 src/main/java/com/ocpsoft/pretty/time/i18n/Resources_de.java
  14. +15 −0 src/main/java/com/ocpsoft/pretty/time/i18n/Resources_en.java
  15. +15 −0 src/main/java/com/ocpsoft/pretty/time/i18n/Resources_es.java
  16. +15 −0 src/main/java/com/ocpsoft/pretty/time/i18n/Resources_et.java
  17. +15 −0 src/main/java/com/ocpsoft/pretty/time/i18n/Resources_fr.java
  18. +15 −0 src/main/java/com/ocpsoft/pretty/time/i18n/Resources_hr.java
  19. +15 −0 src/main/java/com/ocpsoft/pretty/time/i18n/Resources_hu.java
  20. +15 −0 src/main/java/com/ocpsoft/pretty/time/i18n/Resources_it.java
  21. +15 −0 src/main/java/com/ocpsoft/pretty/time/i18n/Resources_nl.java
  22. +15 −0 src/main/java/com/ocpsoft/pretty/time/i18n/Resources_no.java
  23. +15 −0 src/main/java/com/ocpsoft/pretty/time/i18n/Resources_pl.java
  24. +15 −0 src/main/java/com/ocpsoft/pretty/time/i18n/Resources_pt.java
  25. +15 −0 src/main/java/com/ocpsoft/pretty/time/i18n/Resources_ro.java
  26. +15 −0 src/main/java/com/ocpsoft/pretty/time/i18n/Resources_se.java
  27. +15 −0 src/main/java/com/ocpsoft/pretty/time/i18n/Resources_sl.java
  28. +15 −0 src/main/java/com/ocpsoft/pretty/time/i18n/Resources_tr.java
  29. +15 −0 src/main/java/com/ocpsoft/pretty/time/i18n/Resources_vi.java
  30. +15 −0 src/main/java/com/ocpsoft/pretty/time/i18n/Resources_zh.java
  31. +10 −15 src/main/java/com/ocpsoft/pretty/time/units/Century.java
  32. +10 −15 src/main/java/com/ocpsoft/pretty/time/units/Day.java
  33. +10 −15 src/main/java/com/ocpsoft/pretty/time/units/Decade.java
  34. +10 −15 src/main/java/com/ocpsoft/pretty/time/units/Hour.java
  35. +10 −15 src/main/java/com/ocpsoft/pretty/time/units/JustNow.java
  36. +10 −15 src/main/java/com/ocpsoft/pretty/time/units/Millennium.java
  37. +10 −15 src/main/java/com/ocpsoft/pretty/time/units/Millisecond.java
  38. +10 −15 src/main/java/com/ocpsoft/pretty/time/units/Minute.java
  39. +10 −15 src/main/java/com/ocpsoft/pretty/time/units/Month.java
  40. +10 −15 src/main/java/com/ocpsoft/pretty/time/units/Second.java
  41. +10 −15 src/main/java/com/ocpsoft/pretty/time/units/TimeUnitComparator.java
  42. +10 −15 src/main/java/com/ocpsoft/pretty/time/units/Week.java
  43. +10 −15 src/main/java/com/ocpsoft/pretty/time/units/Year.java
  44. +15 −0 src/main/java/com/ocpsoft/pretty/time/web/jsf/PrettyTimeConverter.java
  45. +58 −42 src/test/java/com/ocpsoft/pretty/time/BasicTimeFormatTest.java
  46. +10 −15 src/test/java/com/ocpsoft/pretty/time/PrettyTimeI18nTest.java
  47. +10 −15 src/test/java/com/ocpsoft/pretty/time/PrettyTimeI18nTest_FR.java
  48. +10 −15 src/test/java/com/ocpsoft/pretty/time/PrettyTimeI18nTest_NL.java
  49. +10 −15 src/test/java/com/ocpsoft/pretty/time/PrettyTimeI18nTest_NO.java
  50. +15 −0 src/test/java/com/ocpsoft/pretty/time/PrettyTimeI18nTest_SE.java
  51. +15 −0 src/test/java/com/ocpsoft/pretty/time/PrettyTimeLocaleFallbackTest.java
  52. +15 −0 src/test/java/com/ocpsoft/pretty/time/PrettyTimeTest.java
  53. +15 −0 src/test/java/com/ocpsoft/pretty/time/units/TimeUnitComparatorTest.java
View
3  CHANGELOG.txt
@@ -1,3 +1,6 @@
+=== 1.0.8 ===
+Support for outputting formatted lists of Duration objects.
+
=== 1.0.7 ===
Croatian - Miroslav Rešetar
View
201 LICENSE
@@ -0,0 +1,201 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
View
5 NOTICE
@@ -0,0 +1,5 @@
+PrettyFaces
+Copyright [2011] Lincoln Baxter, III
+
+This product includes software developed at
+OCPSoft (http://ocpsoft.org/).
View
4 pom.xml
@@ -81,8 +81,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
- <source>1.5</source>
- <target>1.5</target>
+ <source>1.6</source>
+ <target>1.6</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
View
76 src/main/java/com/ocpsoft/pretty/time/AbstractTimeUnit.java
@@ -1,60 +1,58 @@
/*
- * PrettyTime is an OpenSource Java time comparison library for creating human
- * readable time.
+ * Copyright 2012 <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
*
- * Copyright (C) 2009 - Lincoln Baxter, III <lincoln@ocpsoft.com>
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * This program is free software: you can redistribute it and/or modify it under
- * the terms of the GNU Lesser General Public License as published by the Free
- * Software Foundation, either version 3 of the License, or (at your option) any
- * later version.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
- * details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program. If not, see the file COPYING.LESSER3 or visit the
- * GNU website at <http://www.gnu.org/licenses/>.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package com.ocpsoft.pretty.time;
import java.util.Locale;
import java.util.ResourceBundle;
+/**
+ * @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
+ */
public abstract class AbstractTimeUnit
{
- protected Locale locale;
- protected TimeFormat format;
- protected String name;
- protected String pluralName;
+ protected Locale locale;
+ protected TimeFormat format;
+ protected String name;
+ protected String pluralName;
- // Use sensitive defaults
- protected long maxQuantity = 0;
- protected long millisPerUnit = 1;
+ // Use sensitive defaults
+ protected long maxQuantity = 0;
+ protected long millisPerUnit = 1;
- public AbstractTimeUnit(final Locale locale)
- {
- this.locale = locale;
+ public AbstractTimeUnit(final Locale locale)
+ {
+ this.locale = locale;
- // Resource bundles need to be in the given package, names start with
- // 'Resources', e.g. 'Resources_de.java'
- ResourceBundle bundle = ResourceBundle.getBundle("com.ocpsoft.pretty.time.i18n.Resources", locale);
+ // Resource bundles need to be in the given package, names start with
+ // 'Resources', e.g. 'Resources_de.java'
+ ResourceBundle bundle = ResourceBundle.getBundle("com.ocpsoft.pretty.time.i18n.Resources", locale);
- String pattern = bundle.getString(getResourceKeyPrefix() + "Pattern");
- String futurePrefix = bundle.getString(getResourceKeyPrefix() + "FuturePrefix");
- String futureSuffix = bundle.getString(getResourceKeyPrefix() + "FutureSuffix");
- String pastPrefix = bundle.getString(getResourceKeyPrefix() + "PastPrefix");
- String pastSuffix = bundle.getString(getResourceKeyPrefix() + "PastSuffix");
- format = new BasicTimeFormat().setPattern(pattern).setFuturePrefix(futurePrefix).setFutureSuffix(futureSuffix)
- .setPastPrefix(pastPrefix).setPastSuffix(pastSuffix);
+ String pattern = bundle.getString(getResourceKeyPrefix() + "Pattern");
+ String futurePrefix = bundle.getString(getResourceKeyPrefix() + "FuturePrefix");
+ String futureSuffix = bundle.getString(getResourceKeyPrefix() + "FutureSuffix");
+ String pastPrefix = bundle.getString(getResourceKeyPrefix() + "PastPrefix");
+ String pastSuffix = bundle.getString(getResourceKeyPrefix() + "PastSuffix");
+ format = new BasicTimeFormat().setPattern(pattern).setFuturePrefix(futurePrefix).setFutureSuffix(futureSuffix)
+ .setPastPrefix(pastPrefix).setPastSuffix(pastSuffix);
- name = bundle.getString(getResourceKeyPrefix() + "Name");
- pluralName = (bundle.getString(getResourceKeyPrefix() + "PluralName"));
- }
+ name = bundle.getString(getResourceKeyPrefix() + "Name");
+ pluralName = (bundle.getString(getResourceKeyPrefix() + "PluralName"));
+ }
- abstract protected String getResourceKeyPrefix();
+ abstract protected String getResourceKeyPrefix();
}
View
89 src/main/java/com/ocpsoft/pretty/time/BasicTimeFormat.java
@@ -1,26 +1,20 @@
/*
- * PrettyTime is an OpenSource Java time comparison library for creating human
- * readable time.
+ * Copyright 2012 <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
*
- * Copyright (C) 2009 - Lincoln Baxter, III <lincoln@ocpsoft.com>
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * This program is free software: you can redistribute it and/or modify it under
- * the terms of the GNU Lesser General Public License as published by the Free
- * Software Foundation, either version 3 of the License, or (at your option) any
- * later version.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
- * details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program. If not, see the file COPYING.LESSER3 or visit the
- * GNU website at <http://www.gnu.org/licenses/>.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package com.ocpsoft.pretty.time;
-
/**
* Represents a simple method of formatting a specific {@link Duration} of time
*
@@ -40,55 +34,40 @@
private String pastSuffix = "";
private int roundingTolerance = 50;
-
+ @Override
public String format(final Duration duration)
{
- String result = format(duration, true);
- String sign = getSign(duration);
- return decorate(sign, result);
- }
-
- public String formatWithoutRounding(final Duration duration) {
- return format(duration, false);
+ return format(duration, true);
}
-
- public String formatWithRounding(final Duration duration) {
- return format(duration, true);
+
+ @Override
+ public String formatUnrounded(Duration duration)
+ {
+ return format(duration, false);
}
-
+
private String format(final Duration duration, final boolean doRounding)
{
String sign = getSign(duration);
String unit = getGramaticallyCorrectName(duration);
long quantity = getQuantity(duration, doRounding);
- String result = applyPattern(sign, unit, quantity);
- return result;
+ return applyPattern(sign, unit, quantity);
}
- public String decoratePast(String value) {
- return decorate(NEGATIVE, value);
- }
-
- public String decorateFuture(String value) {
- return decorate("", value);
- }
-
- private String decorate(final String sign, String result)
+ @Override
+ public String decorate(Duration duration, String time)
{
- if (NEGATIVE.equals(sign))
+ StringBuilder result = new StringBuilder();
+ if (duration.isInPast())
{
- result = pastPrefix + " " + result + " " + pastSuffix;
+ result.append(pastPrefix).append(" ").append(time).append(" ").append(pastSuffix);
}
else
{
- result = futurePrefix + " " + result + " " + futureSuffix;
+ result.append(futurePrefix).append(" ").append(time).append(" ").append(futureSuffix);
}
- return result.replaceAll("\\s+", " ").trim();
- }
-
- public String decorate(String value, boolean inThePast) {
- return decorate(inThePast ? NEGATIVE : "", value);
+ return result.toString().replaceAll("\\s+", " ").trim();
}
private String applyPattern(final String sign, final String unit, final long quantity)
@@ -99,8 +78,9 @@ private String applyPattern(final String sign, final String unit, final long qua
return result;
}
- private long getQuantity(final Duration duration) {
- return getQuantity(duration, true);
+ private long getQuantity(final Duration duration)
+ {
+ return getQuantity(duration, true);
}
private long getQuantity(final Duration duration, boolean doRounding)
@@ -110,7 +90,7 @@ private long getQuantity(final Duration duration, boolean doRounding)
if (duration.getDelta() != 0)
{
double threshold = Math
- .abs(((double) duration.getDelta() / (double) duration.getUnit().getMillisPerUnit()) * 100);
+ .abs(((double) duration.getDelta() / (double) duration.getUnit().getMillisPerUnit()) * 100);
if (doRounding && (threshold > roundingTolerance))
{
quantity = quantity + 1;
@@ -216,4 +196,13 @@ public int getRoundingTolerance()
{
return roundingTolerance;
}
+
+ @Override
+ public String toString()
+ {
+ return "BasicTimeFormat [pattern=" + pattern + ", futurePrefix=" + futurePrefix + ", futureSuffix="
+ + futureSuffix + ", pastPrefix=" + pastPrefix + ", pastSuffix=" + pastSuffix + ", roundingTolerance="
+ + roundingTolerance + "]";
+ }
+
}
View
101 src/main/java/com/ocpsoft/pretty/time/Duration.java
@@ -1,58 +1,63 @@
/*
- * PrettyTime is an OpenSource Java time comparison library for creating human
- * readable time.
+ * Copyright 2012 <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
*
- * Copyright (C) 2009 - Lincoln Baxter, III <lincoln@ocpsoft.com>
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * This program is free software: you can redistribute it and/or modify it under
- * the terms of the GNU Lesser General Public License as published by the Free
- * Software Foundation, either version 3 of the License, or (at your option) any
- * later version.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
- * details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program. If not, see the file COPYING.LESSER3 or visit the
- * GNU website at <http://www.gnu.org/licenses/>.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package com.ocpsoft.pretty.time;
public class Duration
{
- private long quantity;
- private long delta;
- private TimeUnit unit;
-
- public long getQuantity()
- {
- return quantity;
- }
-
- public void setQuantity(final long quantity)
- {
- this.quantity = quantity;
- }
-
- public TimeUnit getUnit()
- {
- return unit;
- }
-
- public void setUnit(final TimeUnit unit)
- {
- this.unit = unit;
- }
-
- public long getDelta()
- {
- return delta;
- }
-
- public void setDelta(final long delta)
- {
- this.delta = delta;
- }
+ private long quantity;
+ private long delta;
+ private TimeUnit unit;
+
+ public long getQuantity()
+ {
+ return quantity;
+ }
+
+ public void setQuantity(final long quantity)
+ {
+ this.quantity = quantity;
+ }
+
+ public TimeUnit getUnit()
+ {
+ return unit;
+ }
+
+ public void setUnit(final TimeUnit unit)
+ {
+ this.unit = unit;
+ }
+
+ public long getDelta()
+ {
+ return delta;
+ }
+
+ public void setDelta(final long delta)
+ {
+ this.delta = delta;
+ }
+
+ public boolean isInPast()
+ {
+ return getQuantity() < 0;
+ }
+
+ public boolean isInFuture()
+ {
+ return !isInPast();
+ }
}
View
609 src/main/java/com/ocpsoft/pretty/time/PrettyTime.java
@@ -1,22 +1,17 @@
/*
- * PrettyTime is an OpenSource Java time comparison library for creating human
- * readable time.
+ * Copyright 2012 <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
*
- * Copyright (C) 2009 - Lincoln Baxter, III <lincoln@ocpsoft.com>
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * This program is free software: you can redistribute it and/or modify it under
- * the terms of the GNU Lesser General Public License as published by the Free
- * Software Foundation, either version 3 of the License, or (at your option) any
- * later version.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
- * details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program. If not, see the file COPYING.LESSER3 or visit the
- * GNU website at <http://www.gnu.org/licenses/>.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package com.ocpsoft.pretty.time;
@@ -41,8 +36,8 @@
import com.ocpsoft.pretty.time.units.Year;
/**
- * A utility for creating social-networking style timestamps. (e.g. "just now",
- * "moments ago", "3 days ago", "within 2 months")
+ * A utility for creating social-networking style timestamps. (e.g. "just now", "moments ago", "3 days ago",
+ * "within 2 months")
* <p>
* <b>Usage:</b>
* <p>
@@ -58,304 +53,294 @@
public class PrettyTime
{
- private volatile Date reference;
- private volatile List<TimeUnit> timeUnits;
- private volatile Locale locale = Locale.getDefault();
-
- /**
- * Default constructor
- */
- public PrettyTime()
- {
- initTimeUnits();
- }
-
- /**
- * Constructor accepting a Date timestamp to represent the point of
- * reference for comparison. This may be changed by the user, after
- * construction.
- * <p>
- * See {@code PrettyTime.setReference(Date timestamp)}.
- *
- * @param reference
- */
- public PrettyTime(final Date reference)
- {
- this();
- setReference(reference);
- }
-
- public PrettyTime(final Locale locale)
- {
- this.setLocale(locale);
- initTimeUnits();
- }
-
- public PrettyTime(final Date reference, final Locale locale)
- {
- this(locale);
- setReference(reference);
- }
-
- /**
- * Calculate the approximate duration between the referenceDate and date
- *
- * @param date
- * @return
- */
- public Duration approximateDuration(final Date then)
- {
- Date ref = reference;
- if (null == ref)
- {
- ref = new Date();
- }
-
- long difference = then.getTime() - ref.getTime();
- return calculateDuration(difference);
- }
-
- private void initTimeUnits()
- {
- timeUnits = new ArrayList<TimeUnit>();
- timeUnits.add(new JustNow(locale));
- timeUnits.add(new Millisecond(locale));
- timeUnits.add(new Second(locale));
- timeUnits.add(new Minute(locale));
- timeUnits.add(new Hour(locale));
- timeUnits.add(new Day(locale));
- timeUnits.add(new Week(locale));
- timeUnits.add(new Month(locale));
- timeUnits.add(new Year(locale));
- timeUnits.add(new Decade(locale));
- timeUnits.add(new Century(locale));
- timeUnits.add(new Millennium(locale));
- }
-
- private Duration calculateDuration(final long difference)
- {
- long absoluteDifference = Math.abs(difference);
-
- // Required for thread-safety
- List<TimeUnit> units = new ArrayList<TimeUnit>(timeUnits.size());
- units.addAll(timeUnits);
-
- Duration result = new Duration();
-
- for (int i = 0; i < units.size(); i++)
- {
- TimeUnit unit = units.get(i);
- long millisPerUnit = Math.abs(unit.getMillisPerUnit());
- long quantity = Math.abs(unit.getMaxQuantity());
-
- boolean isLastUnit = (i == units.size() - 1);
-
- if ((0 == quantity) && !isLastUnit)
+ private volatile Date reference;
+ private volatile List<TimeUnit> timeUnits;
+ private volatile Locale locale = Locale.getDefault();
+
+ /**
+ * Default constructor
+ */
+ public PrettyTime()
+ {
+ initTimeUnits();
+ }
+
+ /**
+ * Constructor accepting a Date timestamp to represent the point of reference for comparison. This may be changed by
+ * the user, after construction.
+ * <p>
+ * See {@code PrettyTime.setReference(Date timestamp)}.
+ *
+ * @param reference
+ */
+ public PrettyTime(final Date reference)
+ {
+ this();
+ setReference(reference);
+ }
+
+ public PrettyTime(final Locale locale)
+ {
+ this.setLocale(locale);
+ initTimeUnits();
+ }
+
+ public PrettyTime(final Date reference, final Locale locale)
+ {
+ this(locale);
+ setReference(reference);
+ }
+
+ /**
+ * Calculate the approximate duration between the referenceDate and date
+ *
+ * @param date
+ * @return
+ */
+ public Duration approximateDuration(final Date then)
+ {
+ Date ref = reference;
+ if (null == ref)
+ {
+ ref = new Date();
+ }
+
+ long difference = then.getTime() - ref.getTime();
+ return calculateDuration(difference);
+ }
+
+ private void initTimeUnits()
+ {
+ timeUnits = new ArrayList<TimeUnit>();
+ timeUnits.add(new JustNow(locale));
+ timeUnits.add(new Millisecond(locale));
+ timeUnits.add(new Second(locale));
+ timeUnits.add(new Minute(locale));
+ timeUnits.add(new Hour(locale));
+ timeUnits.add(new Day(locale));
+ timeUnits.add(new Week(locale));
+ timeUnits.add(new Month(locale));
+ timeUnits.add(new Year(locale));
+ timeUnits.add(new Decade(locale));
+ timeUnits.add(new Century(locale));
+ timeUnits.add(new Millennium(locale));
+ }
+
+ private Duration calculateDuration(final long difference)
+ {
+ long absoluteDifference = Math.abs(difference);
+
+ // Required for thread-safety
+ List<TimeUnit> units = new ArrayList<TimeUnit>(timeUnits.size());
+ units.addAll(timeUnits);
+
+ Duration result = new Duration();
+
+ for (int i = 0; i < units.size(); i++)
+ {
+ TimeUnit unit = units.get(i);
+ long millisPerUnit = Math.abs(unit.getMillisPerUnit());
+ long quantity = Math.abs(unit.getMaxQuantity());
+
+ boolean isLastUnit = (i == units.size() - 1);
+
+ if ((0 == quantity) && !isLastUnit)
+ {
+ quantity = units.get(i + 1).getMillisPerUnit() / unit.getMillisPerUnit();
+ }
+
+ // does our unit encompass the time duration?
+ if ((millisPerUnit * quantity > absoluteDifference) || isLastUnit)
+ {
+ result.setUnit(unit);
+ if (millisPerUnit > absoluteDifference)
{
- quantity = units.get(i + 1).getMillisPerUnit() / unit.getMillisPerUnit();
+ // we are rounding up: get 1 or -1 for past or future
+ result.setQuantity(getSign(difference, absoluteDifference));
}
-
- // does our unit encompass the time duration?
- if ((millisPerUnit * quantity > absoluteDifference) || isLastUnit)
+ else
{
- result.setUnit(unit);
- if (millisPerUnit > absoluteDifference)
- {
- // we are rounding up: get 1 or -1 for past or future
- result.setQuantity(getSign(difference, absoluteDifference));
- }
- else
- {
- result.setQuantity(difference / millisPerUnit);
- }
- result.setDelta(difference - result.getQuantity() * millisPerUnit);
- break;
+ result.setQuantity(difference / millisPerUnit);
}
-
- }
- return result;
- }
-
- private long getSign(final long difference, final long absoluteDifference)
- {
- if (0 > difference)
- {
- return -1;
- }
- else
- {
- return 1;
- }
- }
-
- /**
- * Calculate to the precision of the smallest provided {@link TimeUnit}, the
- * exact duration represented by the difference between the reference
- * timestamp, and {@code then}
- * <p>
- * <b>Note</b>: Precision may be lost if no supplied {@link TimeUnit} is
- * granular enough to represent one millisecond
- *
- * @param then
- * The date to be compared against the reference timestamp, or
- * <i>now</i> if no reference timestamp was provided
- * @return A sorted {@link List} of {@link Duration} objects, from largest
- * to smallest. Each element in the list represents the approximate
- * duration (number of times) that {@link TimeUnit} to fit into the
- * previous element's delta. The first element is the largest
- * {@link TimeUnit} to fit within the total difference between
- * compared dates.
- */
- public List<Duration> calculatePreciseDuration(final Date then)
- {
- if (null == reference)
- {
- reference = new Date();
- }
-
- List<Duration> result = new ArrayList<Duration>();
- long difference = then.getTime() - reference.getTime();
- Duration duration = calculateDuration(difference);
- result.add(duration);
- while (0 != duration.getDelta())
- {
- duration = calculateDuration(duration.getDelta());
- result.add(duration);
- }
- return result;
- }
-
- /**
- * Format the given {@link Duration} object, using the {@link TimeFormat}
- * specified by the {@link TimeUnit} contained within
- *
- * @param duration
- * the {@link Duration} to be formatted
- * @return A formatted string representing {@code duration}
- */
- public String format(final Duration duration)
- {
- TimeFormat format = duration.getUnit().getFormat();
- return format.format(duration);
- }
-
-
- /**
- * Format the given {@link Duration} objects, using the {@link TimeFormat}
- * specified by the {@link TimeUnit} contained within.
- * Rounds only the last {@link Duration} object.
- *
- * @param durations
- * the {@link Duration}s to be formatted
- * @return A list of formatted strings representing {@code durations}
- */
- public String format(final List<Duration> durations)
- {
- String result = null;
- if (durations != null) {
- StringBuilder builder = new StringBuilder();
- Duration duration = null;
- TimeFormat format = null;
- for (int i=0; i<durations.size(); i++) {
- duration = durations.get(i);
- boolean isLast = (i == durations.size() - 1);
- format = duration.getUnit().getFormat();
- if (!isLast) {
- builder.append(format.formatWithoutRounding(duration));
- builder.append(" ");
- } else {
- builder.append(format.formatWithRounding(duration));
- }
- }
- if (duration.getQuantity() < 0) {
- result = format.decoratePast(builder.toString());
- } else {
- result = format.decorateFuture(builder.toString());
- }
- }
- return result;
- }
-
- /**
- * Format the given {@link Date} object. This method applies the {@code
- * PrettyTime.approximateDuration(date)} method to perform its calculation.
- * If {@code then} is null, it will default to {@code new Date()}
- *
- * @param duration
- * the {@link Date} to be formatted
- * @return A formatted string representing {@code then}
- */
- public String format(Date then)
- {
- if (then == null)
- {
- then = new Date();
- }
- Duration d = approximateDuration(then);
- return format(d);
- }
-
- /**
- * Get the current reference timestamp.
- * <p>
- * See {@code PrettyTime.setReference(Date timestamp)}
- *
- * @return
- */
- public Date getReference()
- {
- return reference;
- }
-
- /**
- * Set the reference timestamp.
- * <p>
- * If the Date formatted is before the reference timestamp, the format
- * command will produce a String that is in the past tense. If the Date
- * formatted is after the reference timestamp, the format command will
- * produce a string that is in the future tense.
- *
- * @param timestamp
- */
- public void setReference(final Date timestamp)
- {
- reference = timestamp;
- }
-
- /**
- * Get a {@link List} of the current configured {@link TimeUnit}s in this
- * instance.
- *
- * @return
- */
- public List<TimeUnit> getUnits()
- {
- return Collections.unmodifiableList(timeUnits);
- }
-
- /**
- * Set the current configured {@link TimeUnit}s to be used in calculations
- *
- * @return
- */
- public void setUnits(final List<TimeUnit> units)
- {
- this.timeUnits = units;
- }
-
- public void setUnits(final TimeUnit... units)
- {
- this.timeUnits = Arrays.asList(units);
- }
-
- public Locale getLocale()
- {
- return locale;
- }
-
- public void setLocale(final Locale locale)
- {
- this.locale = locale;
- }
+ result.setDelta(difference - result.getQuantity() * millisPerUnit);
+ break;
+ }
+
+ }
+ return result;
+ }
+
+ private long getSign(final long difference, final long absoluteDifference)
+ {
+ if (0 > difference)
+ {
+ return -1;
+ }
+ else
+ {
+ return 1;
+ }
+ }
+
+ /**
+ * Calculate to the precision of the smallest provided {@link TimeUnit}, the exact duration represented by the
+ * difference between the reference timestamp, and {@code then}
+ * <p>
+ * <b>Note</b>: Precision may be lost if no supplied {@link TimeUnit} is granular enough to represent one millisecond
+ *
+ * @param then The date to be compared against the reference timestamp, or <i>now</i> if no reference timestamp was
+ * provided
+ * @return A sorted {@link List} of {@link Duration} objects, from largest to smallest. Each element in the list
+ * represents the approximate duration (number of times) that {@link TimeUnit} to fit into the previous
+ * element's delta. The first element is the largest {@link TimeUnit} to fit within the total difference
+ * between compared dates.
+ */
+ public List<Duration> calculatePreciseDuration(final Date then)
+ {
+ if (null == reference)
+ {
+ reference = new Date();
+ }
+
+ List<Duration> result = new ArrayList<Duration>();
+ long difference = then.getTime() - reference.getTime();
+ Duration duration = calculateDuration(difference);
+ result.add(duration);
+ while (0 != duration.getDelta())
+ {
+ duration = calculateDuration(duration.getDelta());
+ result.add(duration);
+ }
+ return result;
+ }
+
+ /**
+ * Format the given {@link Date} object. This method applies the {@code PrettyTime.approximateDuration(date)} method
+ * to perform its calculation. If {@code then} is null, it will default to {@code new Date()}
+ *
+ * @param duration the {@link Date} to be formatted
+ * @return A formatted string representing {@code then}
+ */
+ public String format(Date then)
+ {
+ if (then == null)
+ {
+ then = new Date();
+ }
+ Duration d = approximateDuration(then);
+ return format(d);
+ }
+
+ /**
+ * Format the given {@link Duration} object, using the {@link TimeFormat} specified by the {@link TimeUnit} contained
+ * within
+ *
+ * @param duration the {@link Duration} to be formatted
+ * @return A formatted string representing {@code duration}
+ */
+ public String format(final Duration duration)
+ {
+ TimeFormat format = duration.getUnit().getFormat();
+ String time = format.format(duration);
+ return format.decorate(duration, time);
+ }
+
+ /**
+ * Format the given {@link Duration} objects, using the {@link TimeFormat} specified by the {@link TimeUnit}
+ * contained within. Rounds only the last {@link Duration} object.
+ *
+ * @param durations the {@link Duration}s to be formatted
+ * @return A list of formatted strings representing {@code durations}
+ */
+ public String format(final List<Duration> durations)
+ {
+ String result = null;
+ if (durations != null) {
+ StringBuilder builder = new StringBuilder();
+ Duration duration = null;
+ TimeFormat format = null;
+ for (int i = 0; i < durations.size(); i++) {
+ duration = durations.get(i);
+ boolean isLast = (i == durations.size() - 1);
+ format = duration.getUnit().getFormat();
+ if (!isLast) {
+ builder.append(format.formatUnrounded(duration));
+ builder.append(" ");
+ }
+ else {
+ builder.append(format.format(duration));
+ }
+ }
+ result = format.decorate(duration, builder.toString());
+ }
+ return result;
+ }
+
+ /**
+ * Get the current reference timestamp.
+ * <p>
+ * See {@code PrettyTime.setReference(Date timestamp)}
+ *
+ * @return
+ */
+ public Date getReference()
+ {
+ return reference;
+ }
+
+ /**
+ * Set the reference timestamp.
+ * <p>
+ * If the Date formatted is before the reference timestamp, the format command will produce a String that is in the
+ * past tense. If the Date formatted is after the reference timestamp, the format command will produce a string that
+ * is in the future tense.
+ *
+ * @param timestamp
+ */
+ public void setReference(final Date timestamp)
+ {
+ reference = timestamp;
+ }
+
+ /**
+ * Get a {@link List} of the current configured {@link TimeUnit}s in this instance.
+ *
+ * @return
+ */
+ public List<TimeUnit> getUnits()
+ {
+ return Collections.unmodifiableList(timeUnits);
+ }
+
+ /**
+ * Set the current configured {@link TimeUnit}s to be used in calculations
+ *
+ * @return
+ */
+ public void setUnits(final List<TimeUnit> units)
+ {
+ this.timeUnits = units;
+ }
+
+ public void setUnits(final TimeUnit... units)
+ {
+ this.timeUnits = Arrays.asList(units);
+ }
+
+ public Locale getLocale()
+ {
+ return locale;
+ }
+
+ public void setLocale(final Locale locale)
+ {
+ this.locale = locale;
+ }
+
+ @Override
+ public String toString()
+ {
+ return "PrettyTime [reference=" + reference + ", locale=" + locale + "]";
+ }
}
View
84 src/main/java/com/ocpsoft/pretty/time/TimeFormat.java
@@ -1,74 +1,42 @@
/*
- * PrettyTime is an OpenSource Java time comparison library for creating human
- * readable time.
+ * Copyright 2012 <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
*
- * Copyright (C) 2009 - Lincoln Baxter, III <lincoln@ocpsoft.com>
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * This program is free software: you can redistribute it and/or modify it under
- * the terms of the GNU Lesser General Public License as published by the Free
- * Software Foundation, either version 3 of the License, or (at your option) any
- * later version.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
- * details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program. If not, see the file COPYING.LESSER3 or visit the
- * GNU website at <http://www.gnu.org/licenses/>.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package com.ocpsoft.pretty.time;
-
/**
* Format a Duration object.
*
- * @author lb3
+ * @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
*/
public interface TimeFormat
{
- /**
- * Given a populated Duration object. Apply formatting, decorate and output the
- * result.
- *
- * @param duration
- * @return
- */
- public abstract String format(final Duration duration);
+ /**
+ * Given a populated Duration object. Apply plurality formatting (with rounding) and output the result.
+ */
+ public abstract String format(final Duration duration);
+
+ /**
+ * Return formatted duration without rounding
+ */
+ public String formatUnrounded(Duration duration);
- /**
- * Return formatted duration without rounding
- *
- * @param duration
- * @return
- */
- public String formatWithRounding(Duration duration);
-
- /**
- * Return formatted duration with rounding if necessary
- *
- * @param duration
- * @return
- */
- public String formatWithoutRounding(Duration duration);
-
-
- /**
- * Decorate with past prefix/suffix
- *
- * @param value
- * @return
- */
- public String decoratePast(String value);
-
-
- /**
- * Decorate with future prefix/suffix
- *
- * @param value
- * @return
- */
- public String decorateFuture(String value);
+ /**
+ * Decorate with past or future prefix/suffix
+ *
+ * @param The original {@link Duration} instance from which the time string should be decorated.
+ */
+ public String decorate(Duration duration, String time);
}
View
110 src/main/java/com/ocpsoft/pretty/time/TimeUnit.java
@@ -1,81 +1,65 @@
/*
- * PrettyTime is an OpenSource Java time comparison library for creating human
- * readable time.
+ * Copyright 2012 <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
*
- * Copyright (C) 2009 - Lincoln Baxter, III <lincoln@ocpsoft.com>
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * This program is free software: you can redistribute it and/or modify it under
- * the terms of the GNU Lesser General Public License as published by the Free
- * Software Foundation, either version 3 of the License, or (at your option) any
- * later version.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
- * details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program. If not, see the file COPYING.LESSER3 or visit the
- * GNU website at <http://www.gnu.org/licenses/>.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package com.ocpsoft.pretty.time;
/**
- * Defines a Unit of time (e.g. seconds, minutes, hours) and its conversion to
- * milliseconds.
+ * Defines a Unit of time (e.g. seconds, minutes, hours) and its conversion to milliseconds.
*
- * @author lb3
+ * @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
*/
public interface TimeUnit {
- /**
- * The number of milliseconds represented by each instance of this TimeUnit.
- * Must be a positive number greater than zero.
- *
- * @return
- */
- public long getMillisPerUnit();
+ /**
+ * The number of milliseconds represented by each instance of this TimeUnit.
+ * Must be a positive number greater than zero.
+ */
+ public long getMillisPerUnit();
- /**
- * The maximum quantity of this Unit to be used as a threshold for the next
- * largest Unit (e.g. if one <code>Second</code> represents 1000ms, and
- * <code>Second</code> has a maxQuantity of 5, then if the difference
- * between compared timestamps is larger than 5000ms, PrettyTime will move
- * on to the next smallest TimeUnit for calculation; <code>Minute</code>, by
- * default)
- * <p>
- * millisPerUnit * maxQuantity = maxAllowedMs
- * <p>
- * If maxQuantity is zero, it will be equal to the next highest
- * <code>TimeUnit.getMillisPerUnit() /
- * this.getMillisPerUnit()</code> or infinity if there are no greater
- * TimeUnits
- *
- * @return
- */
- public long getMaxQuantity();
+ /**
+ * The maximum quantity of this Unit to be used as a threshold for the next
+ * largest Unit (e.g. if one <code>Second</code> represents 1000ms, and
+ * <code>Second</code> has a maxQuantity of 5, then if the difference
+ * between compared timestamps is larger than 5000ms, PrettyTime will move
+ * on to the next smallest TimeUnit for calculation; <code>Minute</code>, by
+ * default)
+ * <p>
+ * millisPerUnit * maxQuantity = maxAllowedMs
+ * <p>
+ * If maxQuantity is zero, it will be equal to the next highest
+ * <code>TimeUnit.getMillisPerUnit() /
+ * this.getMillisPerUnit()</code> or infinity if there are no greater
+ * TimeUnits
+ */
+ public long getMaxQuantity();
- /**
- * The grammatically singular name for this unit of time. (e.g. one
- * "second")
- *
- * @return
- */
- public String getName();
+ /**
+ * The grammatically singular name for this unit of time. (e.g. one
+ * "second")
+ */
+ public String getName();
- /**
- * The grammatically plural name for this unit of time. (e.g. many
- * "seconds")
- *
- * @return
- */
- public String getPluralName();
+ /**
+ * The grammatically plural name for this unit of time. (e.g. many
+ * "seconds")
+ */
+ public String getPluralName();
- /**
- * The current {@link BasicTimeFormat} for this unit of time.
- *
- * @return
- */
- public TimeFormat getFormat();
+ /**
+ * The current {@link TimeFormat} for this unit of time.
+ */
+ public TimeFormat getFormat();
}
View
15 src/main/java/com/ocpsoft/pretty/time/i18n/Resources.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2012 <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package com.ocpsoft.pretty.time.i18n;
import java.util.ListResourceBundle;
View
15 src/main/java/com/ocpsoft/pretty/time/i18n/Resources_bg.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2012 <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package com.ocpsoft.pretty.time.i18n;
import java.util.ListResourceBundle;
View
15 src/main/java/com/ocpsoft/pretty/time/i18n/Resources_de.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2012 <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package com.ocpsoft.pretty.time.i18n;
import java.util.ListResourceBundle;
View
15 src/main/java/com/ocpsoft/pretty/time/i18n/Resources_en.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2012 <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package com.ocpsoft.pretty.time.i18n;
import java.util.ListResourceBundle;
View
15 src/main/java/com/ocpsoft/pretty/time/i18n/Resources_es.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2012 <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package com.ocpsoft.pretty.time.i18n;
import java.util.ListResourceBundle;
View
15 src/main/java/com/ocpsoft/pretty/time/i18n/Resources_et.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2012 <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package com.ocpsoft.pretty.time.i18n;
import java.util.ListResourceBundle;
View
15 src/main/java/com/ocpsoft/pretty/time/i18n/Resources_fr.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2012 <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package com.ocpsoft.pretty.time.i18n;
import java.util.ListResourceBundle;
View
15 src/main/java/com/ocpsoft/pretty/time/i18n/Resources_hr.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2012 <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package com.ocpsoft.pretty.time.i18n;
import java.util.ListResourceBundle;
View
15 src/main/java/com/ocpsoft/pretty/time/i18n/Resources_hu.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2012 <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package com.ocpsoft.pretty.time.i18n;
import java.util.ListResourceBundle;
View
15 src/main/java/com/ocpsoft/pretty/time/i18n/Resources_it.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2012 <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package com.ocpsoft.pretty.time.i18n;
import java.util.ListResourceBundle;
View
15 src/main/java/com/ocpsoft/pretty/time/i18n/Resources_nl.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2012 <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package com.ocpsoft.pretty.time.i18n;
import java.util.ListResourceBundle;
View
15 src/main/java/com/ocpsoft/pretty/time/i18n/Resources_no.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2012 <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package com.ocpsoft.pretty.time.i18n;
import java.util.ListResourceBundle;
View
15 src/main/java/com/ocpsoft/pretty/time/i18n/Resources_pl.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2012 <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package com.ocpsoft.pretty.time.i18n;
import java.util.ListResourceBundle;
View
15 src/main/java/com/ocpsoft/pretty/time/i18n/Resources_pt.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2012 <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package com.ocpsoft.pretty.time.i18n;
import java.util.ListResourceBundle;
View
15 src/main/java/com/ocpsoft/pretty/time/i18n/Resources_ro.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2012 <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package com.ocpsoft.pretty.time.i18n;
import java.util.ListResourceBundle;
View
15 src/main/java/com/ocpsoft/pretty/time/i18n/Resources_se.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2012 <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package com.ocpsoft.pretty.time.i18n;
import java.util.ListResourceBundle;
View
15 src/main/java/com/ocpsoft/pretty/time/i18n/Resources_sl.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2012 <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package com.ocpsoft.pretty.time.i18n;
import java.util.ListResourceBundle;
View
15 src/main/java/com/ocpsoft/pretty/time/i18n/Resources_tr.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2012 <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package com.ocpsoft.pretty.time.i18n;
import java.util.ListResourceBundle;
View
15 src/main/java/com/ocpsoft/pretty/time/i18n/Resources_vi.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2012 <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package com.ocpsoft.pretty.time.i18n;
import java.util.ListResourceBundle;
View
15 src/main/java/com/ocpsoft/pretty/time/i18n/Resources_zh.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2012 <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package com.ocpsoft.pretty.time.i18n;
import java.util.ListResourceBundle;
View
25 src/main/java/com/ocpsoft/pretty/time/units/Century.java
@@ -1,22 +1,17 @@
/*
- * PrettyTime is an OpenSource Java time comparison library for creating human
- * readable time.
+ * Copyright 2012 <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
*
- * Copyright (C) 2009 - Lincoln Baxter, III <lincoln@ocpsoft.com>
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * This program is free software: you can redistribute it and/or modify it under
- * the terms of the GNU Lesser General Public License as published by the Free
- * Software Foundation, either version 3 of the License, or (at your option) any
- * later version.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
- * details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program. If not, see the file COPYING.LESSER3 or visit the
- * GNU website at <http://www.gnu.org/licenses/>.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package com.ocpsoft.pretty.time.units;
View
25 src/main/java/com/ocpsoft/pretty/time/units/Day.java
@@ -1,22 +1,17 @@
/*
- * PrettyTime is an OpenSource Java time comparison library for creating human
- * readable time.
+ * Copyright 2012 <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
*
- * Copyright (C) 2009 - Lincoln Baxter, III <lincoln@ocpsoft.com>
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * This program is free software: you can redistribute it and/or modify it under
- * the terms of the GNU Lesser General Public License as published by the Free
- * Software Foundation, either version 3 of the License, or (at your option) any
- * later version.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
- * details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program. If not, see the file COPYING.LESSER3 or visit the
- * GNU website at <http://www.gnu.org/licenses/>.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package com.ocpsoft.pretty.time.units;
View
25 src/main/java/com/ocpsoft/pretty/time/units/Decade.java
@@ -1,22 +1,17 @@
/*
- * PrettyTime is an OpenSource Java time comparison library for creating human
- * readable time.
+ * Copyright 2012 <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
*
- * Copyright (C) 2009 - Lincoln Baxter, III <lincoln@ocpsoft.com>
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * This program is free software: you can redistribute it and/or modify it under
- * the terms of the GNU Lesser General Public License as published by the Free
- * Software Foundation, either version 3 of the License, or (at your option) any
- * later version.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
- * details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program. If not, see the file COPYING.LESSER3 or visit the
- * GNU website at <http://www.gnu.org/licenses/>.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package com.ocpsoft.pretty.time.units;
View
25 src/main/java/com/ocpsoft/pretty/time/units/Hour.java
@@ -1,22 +1,17 @@
/*
- * PrettyTime is an OpenSource Java time comparison library for creating human
- * readable time.
+ * Copyright 2012 <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
*
- * Copyright (C) 2009 - Lincoln Baxter, III <lincoln@ocpsoft.com>
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * This program is free software: you can redistribute it and/or modify it under
- * the terms of the GNU Lesser General Public License as published by the Free
- * Software Foundation, either version 3 of the License, or (at your option) any
- * later version.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
- * details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program. If not, see the file COPYING.LESSER3 or visit the
- * GNU website at <http://www.gnu.org/licenses/>.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package com.ocpsoft.pretty.time.units;
View
25 src/main/java/com/ocpsoft/pretty/time/units/JustNow.java
@@ -1,22 +1,17 @@
/*
- * PrettyTime is an OpenSource Java time comparison library for creating human
- * readable time.
+ * Copyright 2012 <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
*
- * Copyright (C) 2009 - Lincoln Baxter, III <lincoln@ocpsoft.com>
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * This program is free software: you can redistribute it and/or modify it under
- * the terms of the GNU Lesser General Public License as published by the Free
- * Software Foundation, either version 3 of the License, or (at your option) any
- * later version.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
- * details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program. If not, see the file COPYING.LESSER3 or visit the
- * GNU website at <http://www.gnu.org/licenses/>.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package com.ocpsoft.pretty.time.units;
View
25 src/main/java/com/ocpsoft/pretty/time/units/Millennium.java
@@ -1,22 +1,17 @@
/*
- * PrettyTime is an OpenSource Java time comparison library for creating human
- * readable time.
+ * Copyright 2012 <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
*
- * Copyright (C) 2009 - Lincoln Baxter, III <lincoln@ocpsoft.com>
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * This program is free software: you can redistribute it and/or modify it under
- * the terms of the GNU Lesser General Public License as published by the Free
- * Software Foundation, either version 3 of the License, or (at your option) any
- * later version.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
- * details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program. If not, see the file COPYING.LESSER3 or visit the
- * GNU website at <http://www.gnu.org/licenses/>.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package com.ocpsoft.pretty.time.units;
View
25 src/main/java/com/ocpsoft/pretty/time/units/Millisecond.java
@@ -1,22 +1,17 @@
/*
- * PrettyTime is an OpenSource Java time comparison library for creating human
- * readable time.
+ * Copyright 2012 <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
*
- * Copyright (C) 2009 - Lincoln Baxter, III <lincoln@ocpsoft.com>
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * This program is free software: you can redistribute it and/or modify it under
- * the terms of the GNU Lesser General Public License as published by the Free
- * Software Foundation, either version 3 of the License, or (at your option) any
- * later version.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
- * details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program. If not, see the file COPYING.LESSER3 or visit the
- * GNU website at <http://www.gnu.org/licenses/>.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package com.ocpsoft.pretty.time.units;
View
25 src/main/java/com/ocpsoft/pretty/time/units/Minute.java
@@ -1,22 +1,17 @@
/*
- * PrettyTime is an OpenSource Java time comparison library for creating human
- * readable time.
+ * Copyright 2012 <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
*
- * Copyright (C) 2009 - Lincoln Baxter, III <lincoln@ocpsoft.com>
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * This program is free software: you can redistribute it and/or modify it under
- * the terms of the GNU Lesser General Public License as published by the Free
- * Software Foundation, either version 3 of the License, or (at your option) any
- * later version.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
- * details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program. If not, see the file COPYING.LESSER3 or visit the
- * GNU website at <http://www.gnu.org/licenses/>.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package com.ocpsoft.pretty.time.units;
View
25 src/main/java/com/ocpsoft/pretty/time/units/Month.java
@@ -1,22 +1,17 @@
/*
- * PrettyTime is an OpenSource Java time comparison library for creating human
- * readable time.
+ * Copyright 2012 <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
*
- * Copyright (C) 2009 - Lincoln Baxter, III <lincoln@ocpsoft.com>
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * This program is free software: you can redistribute it and/or modify it under
- * the terms of the GNU Lesser General Public License as published by the Free
- * Software Foundation, either version 3 of the License, or (at your option) any
- * later version.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
- * details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program. If not, see the file COPYING.LESSER3 or visit the
- * GNU website at <http://www.gnu.org/licenses/>.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package com.ocpsoft.pretty.time.units;
View
25 src/main/java/com/ocpsoft/pretty/time/units/Second.java
@@ -1,22 +1,17 @@
/*
- * PrettyTime is an OpenSource Java time comparison library for creating human
- * readable time.
+ * Copyright 2012 <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
*
- * Copyright (C) 2009 - Lincoln Baxter, III <lincoln@ocpsoft.com>
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * This program is free software: you can redistribute it and/or modify it under
- * the terms of the GNU Lesser General Public License as published by the Free
- * Software Foundation, either version 3 of the License, or (at your option) any
- * later version.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
- * details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program. If not, see the file COPYING.LESSER3 or visit the
- * GNU website at <http://www.gnu.org/licenses/>.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package com.ocpsoft.pretty.time.units;
View
25 <