Skip to content

Instantly share code, notes, and snippets.

View jodastephen's full-sized avatar

Stephen Colebourne jodastephen

View GitHub Profile
@jodastephen
jodastephen / OffsetIdPrinterParser
Last active May 31, 2016 13:45
Proposed OffsetIdPrinterParser changes
//-----------------------------------------------------------------------
/**
* Prints or parses an offset ID.
*/
static final class OffsetIdPrinterParser implements DateTimePrinterParser {
static final String[] PATTERNS = new String[] {
"+HH", "+HHmm", "+HH:mm", "+HHMM", "+HH:MM", "+HHMMss", "+HH:MM:ss", "+HHMMSS", "+HH:MM:SS", "+HHmmss", "+HH:mm:ss",
"+H", "+Hmm", "+H:mm", "+HMM", "+H:MM", "+HMMss", "+H:MM:ss", "+HMMSS", "+H:MM:SS", "+Hmmss", "+H:mm:ss",
}; // order used in pattern builder
static final OffsetIdPrinterParser INSTANCE_ID_Z = new OffsetIdPrinterParser("+HH:MM:ss", "Z");
// released to the public domain, no copyright applies
package com.opengamma.strata.calc;
import java.io.ByteArrayOutputStream;
import java.io.Externalizable;
import java.io.IOException;
import java.io.InvalidObjectException;
import java.io.ObjectInput;
import java.io.ObjectInputStream;
import java.io.ObjectOutput;
@jodastephen
jodastephen / Reduced
Created September 22, 2013 14:25
Patch for reduced print/parse
diff -r b7f9218d0f37 src/share/classes/java/time/format/DateTimeFormatterBuilder.java
--- a/src/share/classes/java/time/format/DateTimeFormatterBuilder.java Sat Sep 14 22:54:38 2013 +0100
+++ b/src/share/classes/java/time/format/DateTimeFormatterBuilder.java Sun Sep 22 07:24:24 2013 -0700
@@ -78,9 +78,11 @@
import java.text.ParsePosition;
import java.time.DateTimeException;
import java.time.Instant;
+import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.ZoneId;
@jodastephen
jodastephen / CollectionOf
Created September 22, 2013 12:37
Patch proposing additing of() static methods to the collection interfaces.
diff -r b7f9218d0f37 src/share/classes/java/util/Collection.java
--- a/src/share/classes/java/util/Collection.java Sat Sep 14 22:54:38 2013 +0100
+++ b/src/share/classes/java/util/Collection.java Sun Sep 22 05:35:55 2013 -0700
@@ -135,6 +135,30 @@
*/
public interface Collection<E> extends Iterable<E> {
+
+ /**
+ * Returns an immutable collection consisting of the specified elements.
@jodastephen
jodastephen / ThreeTen328
Created September 13, 2013 12:05
Patch for #328
# HG changeset patch
# User scolebourne
# Date 1379073847 -3600
# Node ID 46b86421753a3c3c71167d327a2012e50e45bd94
# Parent 0d78450f712812a6fef52db03e6143cb274494ba
Change until() to accept any compatible temporal
Method until(Temporal,TemporalUnit) now uses from() to convert
Update Javadoc spec
Enhance from() methods where necessary
@jodastephen
jodastephen / ThreeTen#331
Created August 30, 2013 16:59
Patch to implement ChronoPeriod
# HG changeset patch
# User scolebourne
# Date 1377881894 -3600
# Node ID 774445b243ad6e5f9cf2b6a65af0e5ae90ac4f6b
# Parent 66f2d8a694e598397e077a683d773692e7a4fb49
Add ChronoPeriod
Make Period ISO-only, adding a Chronology-specific period concept
Fixes #331, JBS 8023762
@jodastephen
jodastephen / SetAggregatedMojo
Created August 1, 2013 17:18
SetAggregatedMojo added to versions-maven-plugin
package org.codehaus.mojo.versions;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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
@jodastephen
jodastephen / ThreeTen321
Created July 9, 2013 20:37
Change Chronology to an interface
# HG changeset patch
# User scolebourne
# Date 1373402104 -3600
# Node ID 31e46fdf3f133e075f7084d522ad47e9e3f0a061
# Parent ae87386e002940843fa82efcfc2bf65995ad5c92
Change Chronology to an interface
See #321
diff --git a/src/share/classes/java/time/chrono/AbstractChronology.java b/src/share/classes/java/time/chrono/AbstractChronology.java
new file mode 100644
@jodastephen
jodastephen / ThreeTen315
Created July 1, 2013 14:48
Patch for #315
# HG changeset patch
# User scolebourne
# Date 1372689842 -3600
# Node ID 81d32359e09023be1f642f27181b38137295e457
# Parent e92ef0ad0c59d9e66bde0611640e3eaf96769d3b
Add Temporal.isSupported(TemporalUnit)
See #315
diff --git a/src/share/classes/java/time/Instant.java b/src/share/classes/java/time/Instant.java
--- a/src/share/classes/java/time/Instant.java
@jodastephen
jodastephen / ThreeTenJapaneseTests
Created June 24, 2013 11:20
More tests for Japanese
# HG changeset patch
# User scolebourne
# Date 1372072772 -3600
# Node ID 03444bbacab9f76b1492e21dcb27b94b00f458b1
# Parent fbac779a293ec66a1f141d22b7a10e9078677c07
Enhance Japanese calendar system tests
See #299
diff --git a/test/java/time/tck/java/time/chrono/TCKJapaneseChronology.java b/test/java/time/tck/java/time/chrono/TCKJapaneseChronology.java
--- a/test/java/time/tck/java/time/chrono/TCKJapaneseChronology.java