You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by jh...@apache.org on 2014/11/14 22:32:28 UTC
[20/58] [abbrv] [partial] incubator-calcite git commit: [CALCITE-306]
Standardize code style for "import package.*; "
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/util/ChunkList.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/util/ChunkList.java b/core/src/main/java/org/apache/calcite/util/ChunkList.java
index a8a4a0c..66644e9 100644
--- a/core/src/main/java/org/apache/calcite/util/ChunkList.java
+++ b/core/src/main/java/org/apache/calcite/util/ChunkList.java
@@ -14,9 +14,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.eigenbase.util;
+package org.apache.calcite.util;
-import java.util.*;
+import java.util.AbstractSequentialList;
+import java.util.Collection;
+import java.util.LinkedList;
+import java.util.ListIterator;
+import java.util.NoSuchElementException;
/**
* Implementation of list similar to {@link LinkedList}, but stores elements
@@ -24,6 +28,8 @@ import java.util.*;
*
* <p>ArrayList has O(n) insertion and deletion into the middle of the list.
* ChunkList insertion and deletion are O(1).</p>
+ *
+ * @param <E> element type
*/
public class ChunkList<E> extends AbstractSequentialList<E> {
private static final int HEADER_SIZE = 3;
@@ -91,18 +97,15 @@ public class ChunkList<E> extends AbstractSequentialList<E> {
return true;
}
- @Override
- public ListIterator<E> listIterator(int index) {
+ @Override public ListIterator<E> listIterator(int index) {
return locate(index);
}
- @Override
- public int size() {
+ @Override public int size() {
return size;
}
- @Override
- public boolean add(E element) {
+ @Override public boolean add(E element) {
Object[] chunk = last;
int occupied;
if (chunk == null) {
@@ -124,8 +127,7 @@ public class ChunkList<E> extends AbstractSequentialList<E> {
return true;
}
- @Override
- public void add(int index, E element) {
+ @Override public void add(int index, E element) {
if (index == size) {
add(element);
} else {
@@ -185,6 +187,7 @@ public class ChunkList<E> extends AbstractSequentialList<E> {
}
}
+ /** Iterator over a {@link ChunkList}. */
private class ChunkListIterator implements ListIterator<E> {
private Object[] chunk;
private int startIndex;
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/util/ClosableAllocation.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/util/ClosableAllocation.java b/core/src/main/java/org/apache/calcite/util/ClosableAllocation.java
index 75f6334..9568772 100644
--- a/core/src/main/java/org/apache/calcite/util/ClosableAllocation.java
+++ b/core/src/main/java/org/apache/calcite/util/ClosableAllocation.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.eigenbase.util;
+package org.apache.calcite.util;
/**
* ClosableAllocation represents an object which requires a call in order to
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/util/ClosableAllocationOwner.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/util/ClosableAllocationOwner.java b/core/src/main/java/org/apache/calcite/util/ClosableAllocationOwner.java
index 8996306..3915657 100644
--- a/core/src/main/java/org/apache/calcite/util/ClosableAllocationOwner.java
+++ b/core/src/main/java/org/apache/calcite/util/ClosableAllocationOwner.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.eigenbase.util;
+package org.apache.calcite.util;
/**
* ClosableAllocationOwner represents an object which can take ownership of
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/util/Compatible.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/util/Compatible.java b/core/src/main/java/org/apache/calcite/util/Compatible.java
index 0c8d09d..41b5123 100644
--- a/core/src/main/java/org/apache/calcite/util/Compatible.java
+++ b/core/src/main/java/org/apache/calcite/util/Compatible.java
@@ -14,13 +14,20 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package net.hydromatic.optiq.util;
+package org.apache.calcite.util;
import com.google.common.base.Function;
-import com.google.common.collect.*;
+import com.google.common.collect.ImmutableSortedMap;
+import com.google.common.collect.ImmutableSortedSet;
+import com.google.common.collect.Maps;
-import java.lang.reflect.*;
-import java.util.*;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.util.Map;
+import java.util.NavigableMap;
+import java.util.NavigableSet;
+import java.util.Set;
/** Compatibility layer.
*
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/util/CompatibleGuava11.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/util/CompatibleGuava11.java b/core/src/main/java/org/apache/calcite/util/CompatibleGuava11.java
index 791558e..8c2a916 100644
--- a/core/src/main/java/org/apache/calcite/util/CompatibleGuava11.java
+++ b/core/src/main/java/org/apache/calcite/util/CompatibleGuava11.java
@@ -14,13 +14,29 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package net.hydromatic.optiq.util;
+package org.apache.calcite.util;
-import com.google.common.base.*;
+import com.google.common.base.Function;
import com.google.common.base.Objects;
-import com.google.common.collect.*;
-
-import java.util.*;
+import com.google.common.collect.Collections2;
+import com.google.common.collect.ForwardingSet;
+import com.google.common.collect.ImmutableSortedMap;
+import com.google.common.collect.ImmutableSortedSet;
+import com.google.common.collect.Maps;
+import com.google.common.collect.Multiset;
+import com.google.common.collect.Sets;
+
+import java.util.AbstractCollection;
+import java.util.AbstractMap;
+import java.util.AbstractSet;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.NavigableMap;
+import java.util.NavigableSet;
+import java.util.Set;
+import java.util.TreeMap;
+import java.util.TreeSet;
import static com.google.common.base.Preconditions.checkNotNull;
@@ -41,13 +57,11 @@ class CompatibleGuava11 {
* {@code removeAll} implementation.
*/
abstract static class ImprovedAbstractSet<E> extends AbstractSet<E> {
- @Override
- public boolean removeAll(Collection<?> c) {
+ @Override public boolean removeAll(Collection<?> c) {
return removeAllImpl(this, c);
}
- @Override
- public boolean retainAll(Collection<?> c) {
+ @Override public boolean retainAll(Collection<?> c) {
return super.retainAll(checkNotNull(c)); // GWT compatibility
}
}
@@ -140,8 +154,7 @@ class CompatibleGuava11 {
static <K, V> Iterator<K> keyIterator(
Iterator<Map.Entry<K, V>> entryIterator) {
return new TransformedIterator<Map.Entry<K, V>, K>(entryIterator) {
- @Override
- K transform(Map.Entry<K, V> entry) {
+ @Override K transform(Map.Entry<K, V> entry) {
return entry.getKey();
}
};
@@ -182,18 +195,15 @@ class CompatibleGuava11 {
private static <E> Set<E> removeOnlySet(final Set<E> set) {
return new ForwardingSet<E>() {
- @Override
- protected Set<E> delegate() {
+ @Override protected Set<E> delegate() {
return set;
}
- @Override
- public boolean add(E element) {
+ @Override public boolean add(E element) {
throw new UnsupportedOperationException();
}
- @Override
- public boolean addAll(Collection<? extends E> es) {
+ @Override public boolean addAll(Collection<? extends E> es) {
throw new UnsupportedOperationException();
}
};
@@ -202,8 +212,7 @@ class CompatibleGuava11 {
private static <K, V> Iterator<Map.Entry<K, V>> asSetEntryIterator(
Set<K> set, final Function<? super K, V> function) {
return new TransformedIterator<K, Map.Entry<K, V>>(set.iterator()) {
- @Override
- Map.Entry<K, V> transform(K key) {
+ @Override Map.Entry<K, V> transform(K key) {
return Maps.immutableEntry(key, function.apply(key));
}
};
@@ -223,30 +232,25 @@ class CompatibleGuava11 {
this.function = checkNotNull(function);
}
- @Override
- public Set<K> keySet() {
+ @Override public Set<K> keySet() {
// probably not worth caching
return removeOnlySet(backingSet());
}
- @Override
- public Collection<V> values() {
+ @Override public Collection<V> values() {
// probably not worth caching
return Collections2.transform(set, function);
}
- @Override
- public int size() {
+ @Override public int size() {
return backingSet().size();
}
- @Override
- public boolean containsKey(Object key) {
+ @Override public boolean containsKey(Object key) {
return backingSet().contains(key);
}
- @Override
- public V get(Object key) {
+ @Override public V get(Object key) {
if (backingSet().contains(key)) {
@SuppressWarnings("unchecked") // unsafe, but Javadoc warns about it
K k = (K) key;
@@ -256,8 +260,7 @@ class CompatibleGuava11 {
}
}
- @Override
- public V remove(Object key) {
+ @Override public V remove(Object key) {
if (backingSet().remove(key)) {
@SuppressWarnings("unchecked") // unsafe, but Javadoc warns about it
K k = (K) key;
@@ -267,21 +270,17 @@ class CompatibleGuava11 {
}
}
- @Override
- public void clear() {
+ @Override public void clear() {
backingSet().clear();
}
- @Override
- protected Set<Map.Entry<K, V>> createEntrySet() {
+ @Override protected Set<Map.Entry<K, V>> createEntrySet() {
return new EntrySet<K, V>() {
- @Override
- Map<K, V> map() {
+ @Override Map<K, V> map() {
return AsMapView.this;
}
- @Override
- public Iterator<Map.Entry<K, V>> iterator() {
+ @Override public Iterator<Map.Entry<K, V>> iterator() {
return asSetEntryIterator(backingSet(), function);
}
};
@@ -357,8 +356,7 @@ class CompatibleGuava11 {
static <K, V> Iterator<V> valueIterator(
Iterator<Map.Entry<K, V>> entryIterator) {
return new TransformedIterator<Map.Entry<K, V>, V>(entryIterator) {
- @Override
- V transform(Map.Entry<K, V> entry) {
+ @Override V transform(Map.Entry<K, V> entry) {
return entry.getValue();
}
};
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/util/CompositeList.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/util/CompositeList.java b/core/src/main/java/org/apache/calcite/util/CompositeList.java
index 00fc24f..85ed62c 100644
--- a/core/src/main/java/org/apache/calcite/util/CompositeList.java
+++ b/core/src/main/java/org/apache/calcite/util/CompositeList.java
@@ -14,12 +14,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.eigenbase.util;
-
-import java.util.*;
+package org.apache.calcite.util;
import com.google.common.collect.ImmutableList;
+import java.util.AbstractList;
+import java.util.List;
+
/**
* Read-only list that is the concatenation of sub-lists.
*
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/util/CompositeMap.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/util/CompositeMap.java b/core/src/main/java/org/apache/calcite/util/CompositeMap.java
index 748cb1d..66a3e40 100644
--- a/core/src/main/java/org/apache/calcite/util/CompositeMap.java
+++ b/core/src/main/java/org/apache/calcite/util/CompositeMap.java
@@ -14,12 +14,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package net.hydromatic.optiq.util;
+package org.apache.calcite.util;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
-import java.util.*;
+import java.util.Collection;
+import java.util.LinkedHashSet;
+import java.util.Map;
+import java.util.Set;
/** Unmodifiable view onto multiple backing maps. An element occurs in the map
* if it occurs in any of the backing maps; the value is the value that occurs
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/util/CompoundClosableAllocation.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/util/CompoundClosableAllocation.java b/core/src/main/java/org/apache/calcite/util/CompoundClosableAllocation.java
index 04c2239..283f064 100644
--- a/core/src/main/java/org/apache/calcite/util/CompoundClosableAllocation.java
+++ b/core/src/main/java/org/apache/calcite/util/CompoundClosableAllocation.java
@@ -14,9 +14,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.eigenbase.util;
+package org.apache.calcite.util;
-import java.util.*;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.ListIterator;
/**
* CompoundClosableAllocation represents a collection of ClosableAllocations
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/util/ControlFlowException.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/util/ControlFlowException.java b/core/src/main/java/org/apache/calcite/util/ControlFlowException.java
index f656157..0740b38 100644
--- a/core/src/main/java/org/apache/calcite/util/ControlFlowException.java
+++ b/core/src/main/java/org/apache/calcite/util/ControlFlowException.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.eigenbase.util;
+package org.apache.calcite.util;
/**
* Exception intended to be used for control flow, as opposed to the usual
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/util/ConversionUtil.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/util/ConversionUtil.java b/core/src/main/java/org/apache/calcite/util/ConversionUtil.java
index a577b14..193cc7c 100644
--- a/core/src/main/java/org/apache/calcite/util/ConversionUtil.java
+++ b/core/src/main/java/org/apache/calcite/util/ConversionUtil.java
@@ -14,12 +14,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.eigenbase.util14;
+package org.apache.calcite.util;
-import java.nio.*;
-import java.text.*;
+import java.nio.ByteOrder;
+import java.text.NumberFormat;
-import static org.eigenbase.util.Static.RESOURCE;
+import static org.apache.calcite.util.Static.RESOURCE;
/**
* Utility functions for converting from one type to another
@@ -79,8 +79,8 @@ public class ConversionUtil {
}
/**
- * Converts a string into a byte array. The inverse of {@link
- * #toStringFromByteArray(byte[], int)}.
+ * Converts a string into a byte array. The inverse of
+ * {@link #toStringFromByteArray(byte[], int)}.
*/
public static byte[] toByteArrayFromString(
String value,
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/util/DateTimeUtil.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/util/DateTimeUtil.java b/core/src/main/java/org/apache/calcite/util/DateTimeUtil.java
index 267d59d..82b8665 100644
--- a/core/src/main/java/org/apache/calcite/util/DateTimeUtil.java
+++ b/core/src/main/java/org/apache/calcite/util/DateTimeUtil.java
@@ -14,11 +14,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.eigenbase.util14;
+package org.apache.calcite.util;
-import java.text.*;
-
-import java.util.*;
+import java.text.NumberFormat;
+import java.text.ParsePosition;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.TimeZone;
/**
* Utility functions for datetime types: date, time, timestamp. Refactored from
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/util/DelegatingInvocationHandler.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/util/DelegatingInvocationHandler.java b/core/src/main/java/org/apache/calcite/util/DelegatingInvocationHandler.java
index 7f5293a..8df789f 100644
--- a/core/src/main/java/org/apache/calcite/util/DelegatingInvocationHandler.java
+++ b/core/src/main/java/org/apache/calcite/util/DelegatingInvocationHandler.java
@@ -14,9 +14,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.eigenbase.util;
+package org.apache.calcite.util;
-import java.lang.reflect.*;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
/**
* A class derived from <code>DelegatingInvocationHandler</code> handles a
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/util/Filterator.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/util/Filterator.java b/core/src/main/java/org/apache/calcite/util/Filterator.java
index aab8a49..6b282bd 100644
--- a/core/src/main/java/org/apache/calcite/util/Filterator.java
+++ b/core/src/main/java/org/apache/calcite/util/Filterator.java
@@ -14,16 +14,21 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.eigenbase.util;
+package org.apache.calcite.util;
-import java.util.*;
+import java.util.Iterator;
+import java.util.NoSuchElementException;
/**
* Filtered iterator class: an iterator that includes only elements that are
- * instanceof a specified class. Apologies for the dorky name.
+ * instanceof a specified class.
*
- * @see Util#cast(List, Class)
+ * <p>Apologies for the dorky name.
+ *
+ * @see Util#cast(java.util.List, Class)
* @see Util#cast(Iterator, Class)
+ *
+ * @param <E> Element type
*/
public class Filterator<E> implements Iterator<E> {
//~ Instance fields --------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/util/Glossary.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/util/Glossary.java b/core/src/main/java/org/apache/calcite/util/Glossary.java
index f4edc79..be32145 100644
--- a/core/src/main/java/org/apache/calcite/util/Glossary.java
+++ b/core/src/main/java/org/apache/calcite/util/Glossary.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.eigenbase.util;
+package org.apache.calcite.util;
/**
* A collection of terms.
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/util/Holder.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/util/Holder.java b/core/src/main/java/org/apache/calcite/util/Holder.java
index 090697c..938fb4d 100644
--- a/core/src/main/java/org/apache/calcite/util/Holder.java
+++ b/core/src/main/java/org/apache/calcite/util/Holder.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.eigenbase.util;
+package org.apache.calcite.util;
/**
* A mutable slot that can contain one object.
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/util/ImmutableIntList.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/util/ImmutableIntList.java b/core/src/main/java/org/apache/calcite/util/ImmutableIntList.java
index 1e1c2e3..ace0c95 100644
--- a/core/src/main/java/org/apache/calcite/util/ImmutableIntList.java
+++ b/core/src/main/java/org/apache/calcite/util/ImmutableIntList.java
@@ -14,16 +14,23 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.eigenbase.util;
+package org.apache.calcite.util;
-import java.lang.reflect.Array;
-import java.util.*;
-
-import net.hydromatic.optiq.runtime.FlatLists;
+import org.apache.calcite.runtime.FlatLists;
import com.google.common.base.Preconditions;
import com.google.common.collect.UnmodifiableListIterator;
+import java.lang.reflect.Array;
+import java.util.AbstractList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.NoSuchElementException;
+
/**
* An immutable list of {@link Integer} values backed by an array of
* {@code int}s.
@@ -83,13 +90,11 @@ public class ImmutableIntList extends FlatLists.AbstractFlatList<Integer> {
return new ImmutableIntList(ints);
}
- @Override
- public int hashCode() {
+ @Override public int hashCode() {
return Arrays.hashCode(ints);
}
- @Override
- public boolean equals(Object obj) {
+ @Override public boolean equals(Object obj) {
return this == obj
|| obj instanceof ImmutableIntList
&& Arrays.equals(ints, ((ImmutableIntList) obj).ints)
@@ -97,13 +102,11 @@ public class ImmutableIntList extends FlatLists.AbstractFlatList<Integer> {
&& obj.equals(this);
}
- @Override
- public String toString() {
+ @Override public String toString() {
return Arrays.toString(ints);
}
- @Override
- public boolean isEmpty() {
+ @Override public boolean isEmpty() {
return ints.length == 0;
}
@@ -218,27 +221,25 @@ public class ImmutableIntList extends FlatLists.AbstractFlatList<Integer> {
};
}
+ /** Special sub-class of {@link ImmutableIntList} that is always
+ * empty and has only one instance. */
private static class EmptyImmutableIntList extends ImmutableIntList {
- @Override
- public Object[] toArray() {
+ @Override public Object[] toArray() {
return EMPTY_ARRAY;
}
- @Override
- public <T> T[] toArray(T[] a) {
+ @Override public <T> T[] toArray(T[] a) {
if (a.length > 0) {
a[0] = null;
}
return a;
}
- @Override
- public Iterator<Integer> iterator() {
+ @Override public Iterator<Integer> iterator() {
return Collections.<Integer>emptyList().iterator();
}
- @Override
- public ListIterator<Integer> listIterator() {
+ @Override public ListIterator<Integer> listIterator() {
return Collections.<Integer>emptyList().listIterator();
}
}
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/util/ImmutableNullableList.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/util/ImmutableNullableList.java b/core/src/main/java/org/apache/calcite/util/ImmutableNullableList.java
index a3367aa..1e92f7b 100644
--- a/core/src/main/java/org/apache/calcite/util/ImmutableNullableList.java
+++ b/core/src/main/java/org/apache/calcite/util/ImmutableNullableList.java
@@ -14,12 +14,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.eigenbase.util;
-
-import java.util.*;
+package org.apache.calcite.util;
import com.google.common.collect.ImmutableList;
+import java.util.AbstractList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
/**
* An immutable list that may contain null values.
*
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/util/IntList.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/util/IntList.java b/core/src/main/java/org/apache/calcite/util/IntList.java
index 33269ea..7edb508 100644
--- a/core/src/main/java/org/apache/calcite/util/IntList.java
+++ b/core/src/main/java/org/apache/calcite/util/IntList.java
@@ -14,9 +14,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.eigenbase.util;
+package org.apache.calcite.util;
-import java.util.*;
+import java.util.AbstractList;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
/**
* Extension to {@link ArrayList} to help build an array of <code>int</code>
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/util/IntegerIntervalSet.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/util/IntegerIntervalSet.java b/core/src/main/java/org/apache/calcite/util/IntegerIntervalSet.java
index 5fb726d..1105461 100644
--- a/core/src/main/java/org/apache/calcite/util/IntegerIntervalSet.java
+++ b/core/src/main/java/org/apache/calcite/util/IntegerIntervalSet.java
@@ -14,15 +14,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.eigenbase.util;
+package org.apache.calcite.util;
+
+import org.apache.calcite.linq4j.Enumerator;
+import org.apache.calcite.linq4j.Linq4j;
import java.util.AbstractSet;
import java.util.Iterator;
import java.util.Set;
-import net.hydromatic.linq4j.Enumerator;
-import net.hydromatic.linq4j.Linq4j;
-
/**
* A set of non-negative integers defined by a sequence of points, intervals,
* and exclusions.
@@ -75,13 +75,11 @@ public class IntegerIntervalSet extends AbstractSet<Integer> {
}
@SuppressWarnings("NullableProblems")
- @Override
- public Iterator<Integer> iterator() {
+ @Override public Iterator<Integer> iterator() {
return Linq4j.enumeratorIterator(enumerator());
}
- @Override
- public int size() {
+ @Override public int size() {
int n = 0;
Enumerator<Integer> e = enumerator();
while (e.moveNext()) {
@@ -130,8 +128,7 @@ public class IntegerIntervalSet extends AbstractSet<Integer> {
};
}
- @Override
- public boolean contains(Object o) {
+ @Override public boolean contains(Object o) {
return o instanceof Number
&& contains(((Number) o).intValue());
}
@@ -150,6 +147,7 @@ public class IntegerIntervalSet extends AbstractSet<Integer> {
return bs[0];
}
+ /** A callback. */
private interface Handler {
void range(int start, int end, boolean exclude);
}
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/util/JsonBuilder.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/util/JsonBuilder.java b/core/src/main/java/org/apache/calcite/util/JsonBuilder.java
index eb95a53..378fd63 100644
--- a/core/src/main/java/org/apache/calcite/util/JsonBuilder.java
+++ b/core/src/main/java/org/apache/calcite/util/JsonBuilder.java
@@ -14,15 +14,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.eigenbase.util;
+package org.apache.calcite.util;
+
+import org.apache.calcite.runtime.Spaces;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
-import net.hydromatic.optiq.runtime.Spaces;
-
/**
* Builder for JSON documents (represented as {@link List}, {@link Map},
* {@link String}, {@link Boolean}, {@link Long}).
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/util/NlsString.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/util/NlsString.java b/core/src/main/java/org/apache/calcite/util/NlsString.java
index 087a0c7..1a49e5d 100644
--- a/core/src/main/java/org/apache/calcite/util/NlsString.java
+++ b/core/src/main/java/org/apache/calcite/util/NlsString.java
@@ -14,21 +14,27 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.eigenbase.util;
+package org.apache.calcite.util;
-import java.nio.*;
-import java.nio.charset.*;
-import java.util.List;
+import org.apache.calcite.runtime.SqlFunctions;
+import org.apache.calcite.sql.SqlCollation;
+import org.apache.calcite.sql.SqlUtil;
-import org.eigenbase.sql.*;
+import com.google.common.base.Objects;
-import net.hydromatic.optiq.runtime.SqlFunctions;
+import java.nio.CharBuffer;
+import java.nio.charset.CharacterCodingException;
+import java.nio.charset.Charset;
+import java.nio.charset.CharsetEncoder;
+import java.nio.charset.IllegalCharsetNameException;
+import java.nio.charset.UnsupportedCharsetException;
+import java.util.List;
-import static org.eigenbase.util.Static.RESOURCE;
+import static org.apache.calcite.util.Static.RESOURCE;
/**
- * A string, optionally with {@link Charset character set} and {@link
- * SqlCollation}. It is immutable.
+ * A string, optionally with {@link Charset character set} and
+ * {@link SqlCollation}. It is immutable.
*/
public class NlsString implements Comparable<NlsString> {
//~ Instance fields --------------------------------------------------------
@@ -100,9 +106,9 @@ public class NlsString implements Comparable<NlsString> {
return false;
}
NlsString that = (NlsString) obj;
- return Util.equal(value, that.value)
- && Util.equal(charsetName, that.charsetName)
- && Util.equal(collation, that.collation);
+ return Objects.equal(value, that.value)
+ && Objects.equal(charsetName, that.charsetName)
+ && Objects.equal(collation, that.collation);
}
// implement Comparable
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/util/NumberUtil.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/util/NumberUtil.java b/core/src/main/java/org/apache/calcite/util/NumberUtil.java
index 3231464..4d5f71a 100644
--- a/core/src/main/java/org/apache/calcite/util/NumberUtil.java
+++ b/core/src/main/java/org/apache/calcite/util/NumberUtil.java
@@ -14,11 +14,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.eigenbase.util14;
+package org.apache.calcite.util;
-import java.math.*;
-
-import java.text.*;
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.text.DecimalFormat;
+import java.text.NumberFormat;
/**
* Utility functions for working with numbers This class is JDK 1.4 compatible.
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/util/Pair.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/util/Pair.java b/core/src/main/java/org/apache/calcite/util/Pair.java
index d5bb8b9..a01e9e7 100644
--- a/core/src/main/java/org/apache/calcite/util/Pair.java
+++ b/core/src/main/java/org/apache/calcite/util/Pair.java
@@ -14,19 +14,28 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.eigenbase.util;
-
-import java.io.Serializable;
-import java.util.*;
+package org.apache.calcite.util;
+import com.google.common.base.Objects;
import com.google.common.collect.Iterators;
+import java.io.Serializable;
+import java.util.AbstractList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
/**
* Pair of objects.
*
* <p>Because a pair implements {@link #equals(Object)}, {@link #hashCode()} and
* {@link #compareTo(Pair)}, it can be used in any kind of
* {@link java.util.Collection}.
+ *
+ * @param <T1> Left-hand type
+ * @param <T2> Right-hand type
*/
public class Pair<T1, T2>
implements Comparable<Pair<T1, T2>>, Map.Entry<T1, T2>, Serializable {
@@ -70,8 +79,8 @@ public class Pair<T1, T2>
public boolean equals(Object obj) {
return this == obj
|| (obj instanceof Pair)
- && Util.equal(this.left, ((Pair) obj).left)
- && Util.equal(this.right, ((Pair) obj).right);
+ && Objects.equal(this.left, ((Pair) obj).left)
+ && com.google.common.base.Objects.equal(this.right, ((Pair) obj).right);
}
public int hashCode() {
@@ -147,14 +156,14 @@ public class Pair<T1, T2>
}
/**
- * Converts two lists into a list of {@link org.eigenbase.util.Pair}s,
+ * Converts two lists into a list of {@link Pair}s,
* whose length is the lesser of the lengths of the
* source lists.
*
* @param ks Left list
* @param vs Right list
* @return List of pairs
- * @see net.hydromatic.linq4j.Ord#zip(java.util.List)
+ * @see org.apache.calcite.linq4j.Ord#zip(java.util.List)
*/
public static <K, V> List<Pair<K, V>> zip(List<K> ks, List<V> vs) {
return zip(ks, vs, false);
@@ -170,7 +179,7 @@ public class Pair<T1, T2>
* @param vs Right list
* @param strict Whether to fail if lists have different size
* @return List of pairs
- * @see net.hydromatic.linq4j.Ord#zip(java.util.List)
+ * @see org.apache.calcite.linq4j.Ord#zip(java.util.List)
*/
public static <K, V> List<Pair<K, V>> zip(
final List<K> ks,
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/util/PartiallyOrderedSet.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/util/PartiallyOrderedSet.java b/core/src/main/java/org/apache/calcite/util/PartiallyOrderedSet.java
index 33ef912..200e1c9 100644
--- a/core/src/main/java/org/apache/calcite/util/PartiallyOrderedSet.java
+++ b/core/src/main/java/org/apache/calcite/util/PartiallyOrderedSet.java
@@ -14,9 +14,20 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package net.hydromatic.optiq.util;
-
-import java.util.*;
+package org.apache.calcite.util;
+
+import java.util.AbstractList;
+import java.util.AbstractSet;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.Set;
/**
* Partially-ordered set.
@@ -98,8 +109,7 @@ public class PartiallyOrderedSet<E> extends AbstractSet<E> {
}
@SuppressWarnings("NullableProblems")
- @Override
- public Iterator<E> iterator() {
+ @Override public Iterator<E> iterator() {
final Iterator<E> iterator = map.keySet().iterator();
return new Iterator<E>() {
E previous;
@@ -124,19 +134,16 @@ public class PartiallyOrderedSet<E> extends AbstractSet<E> {
};
}
- @Override
- public int size() {
+ @Override public int size() {
return map.size();
}
- @Override
- public boolean contains(Object o) {
+ @Override public boolean contains(Object o) {
//noinspection SuspiciousMethodCalls
return map.containsKey(o);
}
- @Override
- public boolean remove(Object o) {
+ @Override public boolean remove(Object o) {
@SuppressWarnings("SuspiciousMethodCalls")
final Node<E> node = map.remove(o);
if (node == null) {
@@ -168,8 +175,7 @@ public class PartiallyOrderedSet<E> extends AbstractSet<E> {
/**
* Adds an element to this lattice.
*/
- @Override
- public boolean add(E e) {
+ @Override public boolean add(E e) {
assert e != null;
assert !DEBUG || isValid(true);
Node<E> node = map.get(e);
@@ -588,8 +594,7 @@ public class PartiallyOrderedSet<E> extends AbstractSet<E> {
return new StripList<E>(bottomNode.parentList);
}
- @Override
- public void clear() {
+ @Override public void clear() {
map.clear();
assert topNode.parentList.isEmpty();
topNode.childList.clear();
@@ -673,8 +678,7 @@ public class PartiallyOrderedSet<E> extends AbstractSet<E> {
this.e = e;
}
- @Override
- public String toString() {
+ @Override public String toString() {
return e.toString();
}
}
@@ -693,8 +697,7 @@ public class PartiallyOrderedSet<E> extends AbstractSet<E> {
this.description = top ? "top" : "bottom";
}
- @Override
- public String toString() {
+ @Override public String toString() {
return description;
}
}
@@ -739,13 +742,11 @@ public class PartiallyOrderedSet<E> extends AbstractSet<E> {
this.list = list;
}
- @Override
- public E get(int index) {
+ @Override public E get(int index) {
return list.get(index).e;
}
- @Override
- public int size() {
+ @Override public int size() {
return list.size();
}
}
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/util/Permutation.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/util/Permutation.java b/core/src/main/java/org/apache/calcite/util/Permutation.java
index f7a7471..4cbff86 100644
--- a/core/src/main/java/org/apache/calcite/util/Permutation.java
+++ b/core/src/main/java/org/apache/calcite/util/Permutation.java
@@ -14,11 +14,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.eigenbase.util;
+package org.apache.calcite.util;
-import java.util.*;
+import org.apache.calcite.util.mapping.IntPair;
+import org.apache.calcite.util.mapping.Mapping;
+import org.apache.calcite.util.mapping.MappingType;
+import org.apache.calcite.util.mapping.Mappings;
-import org.eigenbase.util.mapping.*;
+import java.util.Arrays;
+import java.util.Iterator;
/**
* Represents a mapping which reorders elements in an array.
@@ -109,8 +113,7 @@ public class Permutation implements Mapping, Mappings.TargetMapping {
public void clear() {
throw new UnsupportedOperationException(
- "Cannot clear: permutation must always contain one mapping per "
- + "element");
+ "Cannot clear: permutation must always contain one mapping per element");
}
/**
@@ -450,13 +453,15 @@ public class Permutation implements Mapping, Mappings.TargetMapping {
for (int i = 0; i < size; i++) {
int target = targets[i];
if (sources[target] != i) {
- assert !fail : "source[" + target + "] = " + sources[target]
+ assert !fail
+ : "source[" + target + "] = " + sources[target]
+ ", should be " + i;
return false;
}
int source = sources[i];
if (targets[source] != i) {
- assert !fail : "target[" + source + "] = " + targets[source]
+ assert !fail
+ : "target[" + source + "] = " + targets[source]
+ ", should be " + i;
return false;
}
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/util/ReflectUtil.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/util/ReflectUtil.java b/core/src/main/java/org/apache/calcite/util/ReflectUtil.java
index 6695281..4a29253 100644
--- a/core/src/main/java/org/apache/calcite/util/ReflectUtil.java
+++ b/core/src/main/java/org/apache/calcite/util/ReflectUtil.java
@@ -14,16 +14,19 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.eigenbase.util;
-
-import java.lang.reflect.*;
-
-import java.nio.*;
-
-import java.util.*;
+package org.apache.calcite.util;
import com.google.common.collect.ImmutableList;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
/**
* Static utilities for Java reflection.
*/
@@ -181,11 +184,13 @@ public abstract class ReflectUtil {
}
/**
- * Implements the {@link Glossary#VISITOR_PATTERN} via reflection. The basic
- * technique is taken from <a
+ * Implements the {@link org.apache.calcite.util.Glossary#VISITOR_PATTERN} via
+ * reflection. The basic technique is taken from <a
* href="http://www.javaworld.com/javaworld/javatips/jw-javatip98.html">a
- * Javaworld article</a>. For an example of how to use it, see {@code
- * ReflectVisitorTest}. Visit method lookup follows the same rules as if
+ * Javaworld article</a>. For an example of how to use it, see
+ * {@code ReflectVisitorTest}.
+ *
+ * <p>Visit method lookup follows the same rules as if
* compile-time resolution for VisitorClass.visit(VisiteeClass) were
* performed. An ambiguous match due to multiple interface inheritance
* results in an IllegalArgumentException. A non-match is indicated by
@@ -393,9 +398,8 @@ public abstract class ReflectUtil {
// to set candidateMethod = method
} else {
// c1 and c2 are not directly related
- throw new IllegalArgumentException(
- "dispatch ambiguity between " + candidateMethod
- + " and " + method);
+ throw new IllegalArgumentException("dispatch ambiguity between "
+ + candidateMethod + " and " + method);
}
}
}
@@ -557,9 +561,8 @@ public abstract class ReflectUtil {
new ArrayList<Class>();
classList.add(arg0Clazz);
classList.addAll(otherArgClassList);
- throw new IllegalArgumentException(
- "Method not found: " + methodName + "(" + classList
- + ")");
+ throw new IllegalArgumentException("Method not found: " + methodName
+ + "(" + classList + ")");
}
return method;
}
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/util/ReflectiveVisitDispatcher.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/util/ReflectiveVisitDispatcher.java b/core/src/main/java/org/apache/calcite/util/ReflectiveVisitDispatcher.java
index a4d60a4..bfb444f 100644
--- a/core/src/main/java/org/apache/calcite/util/ReflectiveVisitDispatcher.java
+++ b/core/src/main/java/org/apache/calcite/util/ReflectiveVisitDispatcher.java
@@ -14,11 +14,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.eigenbase.util;
+package org.apache.calcite.util;
-import java.lang.reflect.*;
-
-import java.util.*;
+import java.lang.reflect.Method;
+import java.util.List;
/**
* Interface for looking up methods relating to reflective visitation. One
@@ -29,6 +28,9 @@ import java.util.*;
*
* <p>TODO: obsolete {@link ReflectUtil#lookupVisitMethod}, and use caching in
* implementing that method.
+ *
+ * @param <E> Argument type
+ * @param <R> Return type
*/
public interface ReflectiveVisitDispatcher<R extends ReflectiveVisitor, E> {
//~ Methods ----------------------------------------------------------------
@@ -66,8 +68,8 @@ public interface ReflectiveVisitDispatcher<R extends ReflectiveVisitor, E> {
String visitMethodName);
/**
- * Implements the {@link Glossary#VISITOR_PATTERN} via reflection. The basic
- * technique is taken from <a
+ * Implements the {@link org.apache.calcite.util.Glossary#VISITOR_PATTERN} via
+ * reflection. The basic technique is taken from <a
* href="http://www.javaworld.com/javaworld/javatips/jw-javatip98.html">a
* Javaworld article</a>. For an example of how to use it, see
* {@code ReflectVisitorTest}.
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/util/ReflectiveVisitor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/util/ReflectiveVisitor.java b/core/src/main/java/org/apache/calcite/util/ReflectiveVisitor.java
index d5fa6e3..fa5d810 100644
--- a/core/src/main/java/org/apache/calcite/util/ReflectiveVisitor.java
+++ b/core/src/main/java/org/apache/calcite/util/ReflectiveVisitor.java
@@ -14,11 +14,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.eigenbase.util;
+package org.apache.calcite.util;
/**
- * Object which can be a target for a reflective visitation (see {@link
- * ReflectUtil#invokeVisitor(ReflectiveVisitor, Object, Class, String)}.
+ * Object which can be a target for a reflective visitation (see
+ * {@link ReflectUtil#invokeVisitor(ReflectiveVisitor, Object, Class, String)}.
*
* <p>This is a tagging interface: it has no methods, and is not even required
* in order to use reflective visitation, but serves to advise users of the
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/util/RhBase64.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/util/RhBase64.java b/core/src/main/java/org/apache/calcite/util/RhBase64.java
index bf56dc0..c24db2b 100644
--- a/core/src/main/java/org/apache/calcite/util/RhBase64.java
+++ b/core/src/main/java/org/apache/calcite/util/RhBase64.java
@@ -14,9 +14,21 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.eigenbase.util;
-
-import java.io.*;
+package org.apache.calcite.util;
+
+import java.io.BufferedInputStream;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.FilterInputStream;
+import java.io.FilterOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.io.UnsupportedEncodingException;
import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream;
@@ -704,9 +716,8 @@ public class RhBase64 {
}
}
} else {
- System.err.println(
- "Bad Base64 input character at " + i + ": " + source[i]
- + "(decimal)");
+ System.err.println("Bad Base64 input character at " + i + ": "
+ + source[i] + "(decimal)");
return null;
}
}
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/util/SaffronProperties.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/util/SaffronProperties.java b/core/src/main/java/org/apache/calcite/util/SaffronProperties.java
index dc5e9cd..88025d6 100644
--- a/core/src/main/java/org/apache/calcite/util/SaffronProperties.java
+++ b/core/src/main/java/org/apache/calcite/util/SaffronProperties.java
@@ -14,15 +14,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.eigenbase.util;
+package org.apache.calcite.util;
-import java.io.*;
+import org.eigenbase.util.property.BooleanProperty;
+import org.eigenbase.util.property.StringProperty;
-import java.security.*;
-
-import java.util.*;
-
-import org.eigenbase.util.property.*;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.security.AccessControlException;
+import java.util.Enumeration;
+import java.util.Properties;
/**
* Provides an environment for debugging information, et cetera, used by
@@ -39,9 +41,9 @@ import org.eigenbase.util.property.*;
* </p>
*
* <p>Every property used in saffron code must have a member in this class. The
- * member must be public and final, and be of type {@link
- * org.eigenbase.util.property.Property} or some subtype. The javadoc comment
- * must describe the name of the property (for example,
+ * member must be public and final, and be of type
+ * {@link org.eigenbase.util.property.Property} or some subtype. The javadoc
+ * comment must describe the name of the property (for example,
* "net.sf.saffron.connection.PoolSize") and the default value, if any. <em>
* Developers, please make sure that this remains so!</em></p>
*/
@@ -69,8 +71,8 @@ public class SaffronProperties extends Properties {
/**
* The string property "saffron.default.charset" is the name of the default
- * character set. The default is "ISO-8859-1". It is used in {@link
- * org.eigenbase.sql.validate.SqlValidator}.
+ * character set. The default is "ISO-8859-1". It is used in
+ * {@link org.apache.calcite.sql.validate.SqlValidator}.
*/
public final StringProperty defaultCharset =
new StringProperty(this, "saffron.default.charset", "ISO-8859-1");
@@ -79,8 +81,8 @@ public class SaffronProperties extends Properties {
* The string property "saffron.default.nationalcharset" is the name of the
* default national character set which is used with the N'string' construct
* which may or may not be different from the {@link #defaultCharset}. The
- * default is "ISO-8859-1". It is used in {@link
- * org.eigenbase.sql.SqlLiteral#SqlLiteral}
+ * default is "ISO-8859-1". It is used in
+ * {@link org.apache.calcite.sql.SqlLiteral#SqlLiteral}
*/
public final StringProperty defaultNationalCharset =
new StringProperty(
@@ -90,9 +92,9 @@ public class SaffronProperties extends Properties {
/**
* The string property "saffron.default.collation.name" is the name of the
- * default collation. The default is "ISO-8859-1$en_US". Used in {@link
- * org.eigenbase.sql.SqlCollation} and {@link
- * org.eigenbase.sql.SqlLiteral#SqlLiteral}
+ * default collation. The default is "ISO-8859-1$en_US". Used in
+ * {@link org.apache.calcite.sql.SqlCollation} and
+ * {@link org.apache.calcite.sql.SqlLiteral#SqlLiteral}
*/
public final StringProperty defaultCollation =
new StringProperty(
@@ -102,9 +104,9 @@ public class SaffronProperties extends Properties {
/**
* The string property "saffron.default.collation.strength" is the strength
- * of the default collation. The default is "primary". Used in {@link
- * org.eigenbase.sql.SqlCollation} and {@link
- * org.eigenbase.sql.SqlLiteral#SqlLiteral}
+ * of the default collation. The default is "primary". Used in
+ * {@link org.apache.calcite.sql.SqlCollation} and
+ * {@link org.apache.calcite.sql.SqlLiteral#SqlLiteral}
*/
public final StringProperty defaultCollationStrength =
new StringProperty(
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/util/SerializableCharset.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/util/SerializableCharset.java b/core/src/main/java/org/apache/calcite/util/SerializableCharset.java
index 87efce3..0c6ca81 100644
--- a/core/src/main/java/org/apache/calcite/util/SerializableCharset.java
+++ b/core/src/main/java/org/apache/calcite/util/SerializableCharset.java
@@ -14,11 +14,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.eigenbase.util;
+package org.apache.calcite.util;
-import java.io.*;
-
-import java.nio.charset.*;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.nio.charset.Charset;
/**
* Serializable wrapper around a {@link Charset}.
@@ -38,8 +40,8 @@ public class SerializableCharset implements Serializable {
//~ Constructors -----------------------------------------------------------
/**
- * Creates a SerializableCharset. External users should call {@link
- * #forCharset(Charset)}.
+ * Creates a SerializableCharset. External users should call
+ * {@link #forCharset(Charset)}.
*
* @param charset Character set; must not be null
*/
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/util/StackWriter.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/util/StackWriter.java b/core/src/main/java/org/apache/calcite/util/StackWriter.java
index 72f1dae..da2295c 100644
--- a/core/src/main/java/org/apache/calcite/util/StackWriter.java
+++ b/core/src/main/java/org/apache/calcite/util/StackWriter.java
@@ -14,11 +14,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.eigenbase.util;
+package org.apache.calcite.util;
-import java.io.*;
-
-import java.util.*;
+import java.io.FilterWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.List;
/**
* A helper class for generating formatted text. StackWriter keeps track of
@@ -112,8 +115,8 @@ public class StackWriter extends FilterWriter {
* specified string to be used for each level of indentation.
*
* @param writer underlying writer
- * @param indentation indentation unit such as {@link #INDENT_TAB} or {@link
- * #INDENT_SPACE4}
+ * @param indentation indentation unit such as {@link #INDENT_TAB} or
+ * {@link #INDENT_SPACE4}
*/
public StackWriter(Writer writer, String indentation) {
super(writer);
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/util/Stacks.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/util/Stacks.java b/core/src/main/java/org/apache/calcite/util/Stacks.java
index cee92cc..70ef045 100644
--- a/core/src/main/java/org/apache/calcite/util/Stacks.java
+++ b/core/src/main/java/org/apache/calcite/util/Stacks.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.eigenbase.util;
+package org.apache.calcite.util;
import java.util.List;
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/util/Static.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/util/Static.java b/core/src/main/java/org/apache/calcite/util/Static.java
index 9e5030b..a761d80 100644
--- a/core/src/main/java/org/apache/calcite/util/Static.java
+++ b/core/src/main/java/org/apache/calcite/util/Static.java
@@ -14,28 +14,38 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.eigenbase.util;
+package org.apache.calcite.util;
-import org.eigenbase.resource.EigenbaseNewResource;
-import org.eigenbase.resource.Resources;
+import org.apache.calcite.runtime.CalciteResource;
+
+import org.apache.calcite.runtime.Resources;
/**
* Definitions of objects to be statically imported.
*
- * <p>Developers: Give careful consideration before including an object in this
- * class.
- * Pros: Code that uses these objects will be terser.
- * Cons: Namespace pollution,
- * code that is difficult to understand (a general problem with static imports),
- * potential cyclic initialization.</p>
+ * <h3>Note to developers</h3>
+ *
+ * <p>Please give careful consideration before including an object in this
+ * class. Pros:
+ * <ul>
+ * <li>Code that uses these objects will be terser.
+ * </ul>
+ *
+ * <p>Cons:</p>
+ * <ul>
+ * <li>Namespace pollution,
+ * <li>code that is difficult to understand (a general problem with static
+ * imports),
+ * <li>potential cyclic initialization.
+ * </ul>
*/
public abstract class Static {
private Static() {}
/** Resources. */
- public static final EigenbaseNewResource RESOURCE =
- Resources.create("org.eigenbase.resource.EigenbaseResource",
- EigenbaseNewResource.class);
+ public static final CalciteResource RESOURCE =
+ Resources.create("org.apache.calcite.runtime.CalciteResource",
+ CalciteResource.class);
}
// End Static.java
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/util/Template.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/util/Template.java b/core/src/main/java/org/apache/calcite/util/Template.java
index d7e1737..1936f8e 100644
--- a/core/src/main/java/org/apache/calcite/util/Template.java
+++ b/core/src/main/java/org/apache/calcite/util/Template.java
@@ -14,13 +14,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.eigenbase.util;
-
-import java.text.MessageFormat;
-import java.util.*;
+package org.apache.calcite.util;
import com.google.common.collect.ImmutableList;
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
/**
* String template.
*
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/util/UnmodifiableArrayList.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/util/UnmodifiableArrayList.java b/core/src/main/java/org/apache/calcite/util/UnmodifiableArrayList.java
index 119df37..3a27b02 100644
--- a/core/src/main/java/org/apache/calcite/util/UnmodifiableArrayList.java
+++ b/core/src/main/java/org/apache/calcite/util/UnmodifiableArrayList.java
@@ -14,13 +14,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.eigenbase.util;
+package org.apache.calcite.util;
+
+import com.google.common.base.Preconditions;
import java.util.AbstractList;
import java.util.RandomAccess;
-import com.google.common.base.Preconditions;
-
/**
* A view onto an array that cannot be modified by the client.
*
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/util/Util.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/util/Util.java b/core/src/main/java/org/apache/calcite/util/Util.java
index 41587a6..435df11 100644
--- a/core/src/main/java/org/apache/calcite/util/Util.java
+++ b/core/src/main/java/org/apache/calcite/util/Util.java
@@ -14,27 +14,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.eigenbase.util;
+package org.apache.calcite.util;
-import java.awt.Toolkit;
-import java.io.*;
-import java.lang.reflect.Array;
-import java.lang.reflect.Field;
-import java.math.*;
-import java.net.*;
-import java.nio.charset.*;
-import java.sql.*;
-import java.text.*;
-import java.util.*;
-import java.util.jar.*;
-import java.util.logging.*;
-import java.util.regex.*;
-
-import javax.annotation.Nullable;
-
-import net.hydromatic.linq4j.Ord;
+import org.apache.calcite.linq4j.Ord;
+import org.apache.calcite.runtime.CalciteException;
import com.google.common.base.Function;
+import com.google.common.base.Objects;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
@@ -42,6 +28,52 @@ import com.google.common.collect.Collections2;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.io.Reader;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.lang.reflect.Array;
+import java.lang.reflect.Field;
+import java.math.BigDecimal;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.nio.charset.Charset;
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.text.SimpleDateFormat;
+import java.util.AbstractCollection;
+import java.util.AbstractList;
+import java.util.AbstractMap;
+import java.util.AbstractSet;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+import java.util.TimeZone;
+import java.util.jar.JarFile;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import javax.annotation.Nullable;
+
/**
* Miscellaneous utility functions.
*/
@@ -51,17 +83,6 @@ public class Util {
//~ Static fields/initializers ---------------------------------------------
/**
- * Name of the system property that controls whether the AWT work-around is
- * enabled. This workaround allows Farrago to load its native libraries
- * despite a conflict with AWT and allows applications that use AWT to
- * function normally.
- *
- * @see #loadLibrary(String)
- */
- public static final String AWT_WORKAROUND_PROPERTY =
- "org.eigenbase.util.AWT_WORKAROUND";
-
- /**
* System-dependent newline character.
*
* <p>In general, you should not use this in expected results of tests.
@@ -84,8 +105,6 @@ public class Util {
*/
public static final String FILE_TIMESTAMP_FORMAT = "yyyy-MM-dd_HH_mm_ss";
- private static boolean driversLoaded = false;
-
/**
* Regular expression for a valid java identifier which contains no
* underscores and can therefore be returned intact by {@link #toJavaId}.
@@ -94,11 +113,6 @@ public class Util {
Pattern.compile("[a-zA-Z_$][a-zA-Z0-9$]*");
/**
- * @see #loadLibrary(String)
- */
- private static Toolkit awtToolkit;
-
- /**
* Maps classes to the map of their enum values. Uses a weak map so that
* classes are not prevented from being unloaded.
*/
@@ -107,8 +121,7 @@ public class Util {
.weakKeys()
.build(
new CacheLoader<Class, Map<String, Enum>>() {
- @Override
- public Map<String, Enum> load(Class clazz) {
+ @Override public Map<String, Enum> load(Class clazz) {
//noinspection unchecked
return enumConstants(clazz);
}
@@ -174,21 +187,6 @@ public class Util {
}
/**
- * Returns whether two objects are equal or are both null.
- */
- public static boolean equal(
- Object s0,
- Object s1) {
- if (s0 == s1) {
- return true;
- } else if (s0 == null) {
- return false;
- } else {
- return s0.equals(s1);
- }
- }
-
- /**
* Returns whether two lists are equal to each other using shallow
* comparisons.
*
@@ -251,17 +249,6 @@ public class Util {
return h;
}
- /**
- * Computes a hash code over var args.
- */
- public static int hashV(Object... a) {
- int h = 19690721;
- for (Object o : a) {
- h = hash(h, o);
- }
- return h;
- }
-
/** Computes the hash code of a {@code double} value. Equivalent to
* {@link Double}{@code .hashCode(double)}, but that method was only
* introduced in JDK 1.8.
@@ -655,8 +642,8 @@ public class Util {
}
/**
- * Materializes the results of a {@link java.util.Iterator} as a {@link
- * java.util.List}.
+ * Materializes the results of a {@link java.util.Iterator} as a
+ * {@link java.util.List}.
*
* @param iter iterator to materialize
* @return materialized list
@@ -715,8 +702,8 @@ public class Util {
}
/**
- * Returns the {@link Charset} object representing the value of {@link
- * SaffronProperties#defaultCharset}
+ * Returns the {@link Charset} object representing the value of
+ * {@link SaffronProperties#defaultCharset}
*
* @throws java.nio.charset.IllegalCharsetNameException If the given charset
* name is illegal
@@ -765,7 +752,7 @@ public class Util {
StringBuilder sb = new StringBuilder();
for (Throwable curr = t; curr != null; curr = curr.getCause()) {
String msg =
- ((curr instanceof EigenbaseException)
+ ((curr instanceof CalciteException)
|| (curr instanceof SQLException)) ? curr.getMessage()
: curr.toString();
if (sb.length() > 0) {
@@ -944,46 +931,6 @@ public class Util {
}
/**
- * Uses {@link System#loadLibrary(String)} to load a native library
- * correctly under mingw (Windows/Cygwin) and Linux environments.
- *
- * <p>This method also implements a work-around for applications that wish
- * to load AWT. AWT conflicts with some native libraries in a way that
- * requires AWT to be loaded first. This method checks the system property
- * named {@link #AWT_WORKAROUND_PROPERTY} and if it is set to "on" (default;
- * case-insensitive) it pre-loads AWT to avoid the conflict.
- *
- * @param libName the name of the library to load, as in {@link
- * System#loadLibrary(String)}.
- */
- public static void loadLibrary(String libName) {
- String awtSetting = System.getProperty(AWT_WORKAROUND_PROPERTY, "on");
- if ((awtToolkit == null) && awtSetting.equalsIgnoreCase("on")) {
- // REVIEW jvs 8-Sept-2006: workaround upon workaround. This
- // is required because in native code, we sometimes (see Farrago)
- // have to use dlopen("libfoo.so", RTLD_GLOBAL) in order for native
- // plugins to load correctly. But the RTLD_GLOBAL causes trouble
- // later if someone tries to use AWT from within the same JVM.
- // So... preload AWT here unless someone configured explicitly
- // not to do so.
- try {
- awtToolkit = Toolkit.getDefaultToolkit();
- } catch (Throwable ex) {
- // Suppress problems so that a headless server doesn't fail on
- // startup. If AWT is actually needed, the same exception will
- // show up later, which is fine.
-
- // NOTE jvs 27-Mar-2007: If this exception occurs, we'll
- // retry the AWT load on each loadLibrary call. That's okay,
- // since there are only a few libraries and they're loaded
- // via static initializers.
- }
- }
-
- System.loadLibrary(libName);
- }
-
- /**
* Returns whether an array of strings contains a given string among the
* first <code>length</code> entries.
*
@@ -1282,8 +1229,7 @@ public class Util {
// POSIX allows us to omit DST offset if it is 1:00:00
appendPosixTime(buf, dstSavings);
}
- String patternString =
- ".*,"
+ String patternString = ".*,"
+ "startMode=([0-9]*),"
+ "startMonth=([0-9]*),"
+ "startDay=([-0-9]*),"
@@ -1545,7 +1491,8 @@ public class Util {
/**
* Runs an external application process.
*
- * @param pb {@link ProcessBuilder} for the application; might be returned by {@link #newAppProcess}.
+ * @param pb ProcessBuilder for the application; might be
+ * returned by {@link #newAppProcess}.
* @param logger if not null, command and exit status will be logged here
* @param appInput if not null, data will be copied to application's stdin
* @param appOutput if not null, data will be captured from application's
@@ -1611,8 +1558,8 @@ public class Util {
* type.
*
* <p>If a member of the backing list is not an instanceof <code>E</code>,
- * the accessing method (such as {@link List#get}) will throw a {@link
- * ClassCastException}.
+ * the accessing method (such as {@link List#get}) will throw a
+ * {@link ClassCastException}.
*
* <p>All modifications are automatically written to the backing list. Not
* synchronized.
@@ -1630,8 +1577,8 @@ public class Util {
* type.
*
* <p>If a member of the backing iterator is not an instanceof <code>
- * E</code>, {@link Iterator#next()}) will throw a {@link
- * ClassCastException}.
+ * E</code>, {@link Iterator#next()}) will throw a
+ * {@link ClassCastException}.
*
* <p>All modifications are automatically written to the backing iterator.
* Not synchronized.
@@ -1876,8 +1823,7 @@ public class Util {
* @return an error, to be thrown
*/
public static <E extends Enum<E>> Error unexpected(E value) {
- return new AssertionError(
- "Was not expecting value '" + value
+ return new AssertionError("Was not expecting value '" + value
+ "' for enumeration '" + value.getDeclaringClass().getName()
+ "' in this context");
}
@@ -2015,48 +1961,6 @@ public class Util {
}
/**
- * Converts an underscore-separated name into a camelCase name.
- * For example, {@code uncamel("MY_JDBC_DRIVER")} returns "myJdbcDriver".
- */
- public static String toCamelCase(String name) {
- StringBuilder buf = new StringBuilder();
- int nextUpper = -1;
- for (int i = 0; i < name.length(); i++) {
- char c = name.charAt(i);
- if (c == '_') {
- nextUpper = i + 1;
- continue;
- }
- if (nextUpper == i) {
- c = Character.toUpperCase(c);
- } else {
- c = Character.toLowerCase(c);
- }
- buf.append(c);
- }
- return buf.toString();
- }
-
- /**
- * Converts a camelCase name into an upper-case underscore-separated name.
- * For example, {@code camelToUpper("myJdbcDriver")} returns
- * "MY_JDBC_DRIVER".
- */
- public static String camelToUpper(String name) {
- StringBuilder buf = new StringBuilder();
- for (int i = 0; i < name.length(); i++) {
- char c = name.charAt(i);
- if (Character.isUpperCase(c)) {
- buf.append('_');
- } else {
- c = Character.toUpperCase(c);
- }
- buf.append(c);
- }
- return buf.toString();
- }
-
- /**
* Returns whether the elements of {@code list} are distinct.
*/
public static <E> boolean isDistinct(List<E> list) {
@@ -2086,7 +1990,7 @@ public class Util {
E e = list.get(i);
for (int j = i - 1; j >= 0; j--) {
E e1 = list.get(j);
- if (equal(e, e1)) {
+ if (Objects.equal(e, e1)) {
return i;
}
}
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/util/XmlOutput.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/util/XmlOutput.java b/core/src/main/java/org/apache/calcite/util/XmlOutput.java
index cd529e8..4be5669 100644
--- a/core/src/main/java/org/apache/calcite/util/XmlOutput.java
+++ b/core/src/main/java/org/apache/calcite/util/XmlOutput.java
@@ -14,13 +14,19 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.eigenbase.util;
-
-import java.io.*;
-import java.util.*;
+package org.apache.calcite.util;
import com.google.common.collect.Lists;
+import java.io.IOException;
+import java.io.LineNumberReader;
+import java.io.PrintWriter;
+import java.io.StringReader;
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
/**
* Streaming XML output.
*
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/util/ZonelessDate.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/util/ZonelessDate.java b/core/src/main/java/org/apache/calcite/util/ZonelessDate.java
index 80cfa79..9648327 100644
--- a/core/src/main/java/org/apache/calcite/util/ZonelessDate.java
+++ b/core/src/main/java/org/apache/calcite/util/ZonelessDate.java
@@ -14,12 +14,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.eigenbase.util14;
+package org.apache.calcite.util;
import java.sql.Date;
-
-import java.text.*;
-
+import java.text.DateFormat;
import java.util.Calendar;
import java.util.TimeZone;
@@ -77,9 +75,10 @@ public class ZonelessDate extends ZonelessDatetime {
}
/**
- * Formats this ZonelessDate via a SimpleDateFormat
+ * Formats this ZonelessDate via a SimpleDateFormat.
*
- * @param format format string, as required by {@link SimpleDateFormat}
+ * @param format Format string, as required by
+ * {@link java.text.SimpleDateFormat}
* @return the formatted date string
*/
public String toString(String format) {
@@ -104,7 +103,7 @@ public class ZonelessDate extends ZonelessDatetime {
*
* @param s a string representing a date in ISO format, i.e. according to
* the SimpleDateFormat string "yyyy-MM-dd"
- * @param format format string as per {@link SimpleDateFormat}
+ * @param format Format string as per {@link java.text.SimpleDateFormat}
* @return the parsed date, or null if parsing failed
*/
public static ZonelessDate parse(String s, String format) {
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/util/ZonelessDatetime.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/util/ZonelessDatetime.java b/core/src/main/java/org/apache/calcite/util/ZonelessDatetime.java
index 7f030f0..abe8165 100644
--- a/core/src/main/java/org/apache/calcite/util/ZonelessDatetime.java
+++ b/core/src/main/java/org/apache/calcite/util/ZonelessDatetime.java
@@ -14,13 +14,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.eigenbase.util14;
+package org.apache.calcite.util;
-import java.io.*;
-
-import java.text.*;
-
-import java.util.*;
+import java.io.Serializable;
+import java.text.DateFormat;
+import java.util.Calendar;
+import java.util.TimeZone;
/**
* ZonelessDatetime is an abstract class for dates, times, or timestamps that
@@ -101,8 +100,8 @@ public abstract class ZonelessDatetime implements BasicDatetime, Serializable {
}
/**
- * Gets the value of this datetime as a milliseconds value for {@link
- * java.sql.Time}.
+ * Gets the value of this datetime as a milliseconds value for
+ * {@link java.sql.Time}.
*
* @param zone time zone in which to generate a time value for
*/
@@ -112,8 +111,8 @@ public abstract class ZonelessDatetime implements BasicDatetime, Serializable {
}
/**
- * Gets the value of this datetime as a milliseconds value for {@link
- * java.sql.Date}.
+ * Gets the value of this datetime as a milliseconds value for
+ * {@link java.sql.Date}.
*
* @param zone time zone in which to generate a time value for
*/
@@ -132,8 +131,8 @@ public abstract class ZonelessDatetime implements BasicDatetime, Serializable {
}
/**
- * Gets the value of this datetime as a milliseconds value for {@link
- * java.sql.Timestamp}.
+ * Gets the value of this datetime as a milliseconds value for
+ * {@link java.sql.Timestamp}.
*
* @param zone time zone in which to generate a time value for
*/
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/util/ZonelessTime.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/util/ZonelessTime.java b/core/src/main/java/org/apache/calcite/util/ZonelessTime.java
index 5a4b52b..d55cb70 100644
--- a/core/src/main/java/org/apache/calcite/util/ZonelessTime.java
+++ b/core/src/main/java/org/apache/calcite/util/ZonelessTime.java
@@ -14,12 +14,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.eigenbase.util14;
+package org.apache.calcite.util;
import java.sql.Time;
-
-import java.text.*;
-
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.TimeZone;
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/util/ZonelessTimestamp.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/util/ZonelessTimestamp.java b/core/src/main/java/org/apache/calcite/util/ZonelessTimestamp.java
index 0f99596..94a6b76 100644
--- a/core/src/main/java/org/apache/calcite/util/ZonelessTimestamp.java
+++ b/core/src/main/java/org/apache/calcite/util/ZonelessTimestamp.java
@@ -14,11 +14,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.eigenbase.util14;
+package org.apache.calcite.util;
-import java.sql.*;
-
-import java.text.*;
+import java.sql.Timestamp;
+import java.text.DateFormat;
/**
* ZonelessTimestamp is a timestamp value without a time zone.
@@ -122,7 +121,7 @@ public class ZonelessTimestamp extends ZonelessDatetime {
*
* @param s a string representing a time in ISO format, i.e. according to
* the SimpleDateFormat string "yyyy-MM-dd HH:mm:ss"
- * @param format format string as per {@link SimpleDateFormat}
+ * @param format Format string as per {@link java.text.SimpleDateFormat}
* @return the parsed timestamp, or null if parsing failed
*/
public static ZonelessTimestamp parse(String s, String format) {
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/util/graph/BreadthFirstIterator.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/util/graph/BreadthFirstIterator.java b/core/src/main/java/org/apache/calcite/util/graph/BreadthFirstIterator.java
index 0f7589b..21aed24 100644
--- a/core/src/main/java/org/apache/calcite/util/graph/BreadthFirstIterator.java
+++ b/core/src/main/java/org/apache/calcite/util/graph/BreadthFirstIterator.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package net.hydromatic.optiq.util.graph;
+package org.apache.calcite.util.graph;
import java.util.ArrayDeque;
import java.util.Deque;
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/util/graph/CycleDetector.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/util/graph/CycleDetector.java b/core/src/main/java/org/apache/calcite/util/graph/CycleDetector.java
index 8480435..4e9fcc5 100644
--- a/core/src/main/java/org/apache/calcite/util/graph/CycleDetector.java
+++ b/core/src/main/java/org/apache/calcite/util/graph/CycleDetector.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package net.hydromatic.optiq.util.graph;
+package org.apache.calcite.util.graph;
import java.util.Set;
@@ -37,4 +37,3 @@ public class CycleDetector<V, E extends DefaultEdge> {
}
// End CycleDetector.java
-
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/util/graph/DefaultDirectedGraph.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/util/graph/DefaultDirectedGraph.java b/core/src/main/java/org/apache/calcite/util/graph/DefaultDirectedGraph.java
index 3bafdf6..f093393 100644
--- a/core/src/main/java/org/apache/calcite/util/graph/DefaultDirectedGraph.java
+++ b/core/src/main/java/org/apache/calcite/util/graph/DefaultDirectedGraph.java
@@ -14,9 +14,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package net.hydromatic.optiq.util.graph;
-
-import java.util.*;
+package org.apache.calcite.util.graph;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
/**
* Default implementation of {@link DirectedGraph}.
@@ -45,8 +53,7 @@ public class DefaultDirectedGraph<V, E extends DefaultEdge>
return new DefaultDirectedGraph<V, E>(edgeFactory);
}
- @Override
- public String toString() {
+ @Override public String toString() {
StringBuilder buf = new StringBuilder();
buf.append("graph(")
.append("vertices: ")
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/util/graph/DefaultEdge.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/util/graph/DefaultEdge.java b/core/src/main/java/org/apache/calcite/util/graph/DefaultEdge.java
index b44cf16..3f32bdf 100644
--- a/core/src/main/java/org/apache/calcite/util/graph/DefaultEdge.java
+++ b/core/src/main/java/org/apache/calcite/util/graph/DefaultEdge.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package net.hydromatic.optiq.util.graph;
+package org.apache.calcite.util.graph;
/**
* Default implementation of Edge.
@@ -28,13 +28,11 @@ public class DefaultEdge {
this.target = target;
}
- @Override
- public int hashCode() {
+ @Override public int hashCode() {
return source.hashCode() * 31 + target.hashCode();
}
- @Override
- public boolean equals(Object obj) {
+ @Override public boolean equals(Object obj) {
return this == obj
|| obj instanceof DefaultEdge
&& ((DefaultEdge) obj).source.equals(source)
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/util/graph/DepthFirstIterator.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/util/graph/DepthFirstIterator.java b/core/src/main/java/org/apache/calcite/util/graph/DepthFirstIterator.java
index c6cd7cf..1631d38 100644
--- a/core/src/main/java/org/apache/calcite/util/graph/DepthFirstIterator.java
+++ b/core/src/main/java/org/apache/calcite/util/graph/DepthFirstIterator.java
@@ -14,12 +14,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package net.hydromatic.optiq.util.graph;
+package org.apache.calcite.util.graph;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
-import java.util.*;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
/**
* Iterates over the vertices in a directed graph in depth-first order.
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/util/graph/DirectedGraph.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/util/graph/DirectedGraph.java b/core/src/main/java/org/apache/calcite/util/graph/DirectedGraph.java
index b7b9939..ba5c69c 100644
--- a/core/src/main/java/org/apache/calcite/util/graph/DirectedGraph.java
+++ b/core/src/main/java/org/apache/calcite/util/graph/DirectedGraph.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package net.hydromatic.optiq.util.graph;
+package org.apache.calcite.util.graph;
import java.util.Collection;
import java.util.List;
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/util/graph/Graphs.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/util/graph/Graphs.java b/core/src/main/java/org/apache/calcite/util/graph/Graphs.java
index cb5f657..c1b94a6 100644
--- a/core/src/main/java/org/apache/calcite/util/graph/Graphs.java
+++ b/core/src/main/java/org/apache/calcite/util/graph/Graphs.java
@@ -14,13 +14,19 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package net.hydromatic.optiq.util.graph;
+package org.apache.calcite.util.graph;
-import org.eigenbase.util.Pair;
+import org.apache.calcite.util.Pair;
import com.google.common.collect.ImmutableList;
-import java.util.*;
+import java.util.AbstractList;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
/**
* Miscellaneous graph utilities.
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/util/graph/TopologicalOrderIterator.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/util/graph/TopologicalOrderIterator.java b/core/src/main/java/org/apache/calcite/util/graph/TopologicalOrderIterator.java
index da4d537..db7154f 100644
--- a/core/src/main/java/org/apache/calcite/util/graph/TopologicalOrderIterator.java
+++ b/core/src/main/java/org/apache/calcite/util/graph/TopologicalOrderIterator.java
@@ -14,9 +14,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package net.hydromatic.optiq.util.graph;
+package org.apache.calcite.util.graph;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
/**
* Iterates over the edges of a graph in topological order.
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/util/graph/package-info.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/util/graph/package-info.java b/core/src/main/java/org/apache/calcite/util/graph/package-info.java
index d2a0024..69d3018 100644
--- a/core/src/main/java/org/apache/calcite/util/graph/package-info.java
+++ b/core/src/main/java/org/apache/calcite/util/graph/package-info.java
@@ -18,6 +18,6 @@
/**
* Graph-theoretic algorithms and data structures.
*/
-package net.hydromatic.optiq.util.graph;
+package org.apache.calcite.util.graph;
// End package-info.java