Repository: incubator-kylin Updated Branches: refs/heads/2.x-staging d5a676ab6 -> 6c4148ec7
KYLIN-1112 Remove ITopK.java Project: http://git-wip-us.apache.org/repos/asf/incubator-kylin/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-kylin/commit/6c4148ec Tree: http://git-wip-us.apache.org/repos/asf/incubator-kylin/tree/6c4148ec Diff: http://git-wip-us.apache.org/repos/asf/incubator-kylin/diff/6c4148ec Branch: refs/heads/2.x-staging Commit: 6c4148ec7eec47d4c612e1703b0c8fc8fc305842 Parents: 60f9da0 Author: shaofengshi <shaofeng...@apache.org> Authored: Thu Nov 19 14:10:40 2015 +0800 Committer: shaofengshi <shaofeng...@apache.org> Committed: Thu Nov 19 14:11:05 2015 +0800 ---------------------------------------------------------------------- .../org/apache/kylin/common/topn/ITopK.java | 53 -------------------- .../apache/kylin/common/topn/TopNCounter.java | 5 +- 2 files changed, 1 insertion(+), 57 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/6c4148ec/core-common/src/main/java/org/apache/kylin/common/topn/ITopK.java ---------------------------------------------------------------------- diff --git a/core-common/src/main/java/org/apache/kylin/common/topn/ITopK.java b/core-common/src/main/java/org/apache/kylin/common/topn/ITopK.java deleted file mode 100644 index 36603b7..0000000 --- a/core-common/src/main/java/org/apache/kylin/common/topn/ITopK.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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 - * - * 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 org.apache.kylin.common.topn; - -import java.util.List; - -/** - * Modified from https://github.com/addthis/stream-lib - * - * @param <T> - */ -public interface ITopK<T> { - - /** - * offer a single element to the top. - * - * @param element - the element to add to the top - * @return false if the element was already in the top - */ - boolean offer(T element); - - /** - * offer a single element to the top and increment the count - * for that element by incrementCount. - * - * @param element - the element to add to the top - * @param incrementCount - the increment count for the given count - * @return false if the element was already in the top - */ - boolean offer(T element, double incrementCount); - - /** - * @param k - * @return top k elements offered (may be an approximation) - */ - List<T> peek(int k); -} http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/6c4148ec/core-common/src/main/java/org/apache/kylin/common/topn/TopNCounter.java ---------------------------------------------------------------------- diff --git a/core-common/src/main/java/org/apache/kylin/common/topn/TopNCounter.java b/core-common/src/main/java/org/apache/kylin/common/topn/TopNCounter.java index e6c5c90..9536ef7 100644 --- a/core-common/src/main/java/org/apache/kylin/common/topn/TopNCounter.java +++ b/core-common/src/main/java/org/apache/kylin/common/topn/TopNCounter.java @@ -34,7 +34,7 @@ import java.util.*; * * @param <T> type of data in the stream to be summarized */ -public class TopNCounter<T> implements ITopK<T>, Iterable<Counter<T>> { +public class TopNCounter<T> implements Iterable<Counter<T>> { public static final int EXTRA_SPACE_RATE = 50; @@ -61,7 +61,6 @@ public class TopNCounter<T> implements ITopK<T>, Iterable<Counter<T>> { * @param item stream element (<i>e</i>) * @return false if item was already in the stream summary, true otherwise */ - @Override public boolean offer(T item) { return offer(item, 1.0); } @@ -72,7 +71,6 @@ public class TopNCounter<T> implements ITopK<T>, Iterable<Counter<T>> { * @param item stream element (<i>e</i>) * @return false if item was already in the stream summary, true otherwise */ - @Override public boolean offer(T item, double incrementCount) { return offerReturnAll(item, incrementCount).getFirst(); } @@ -153,7 +151,6 @@ public class TopNCounter<T> implements ITopK<T>, Iterable<Counter<T>> { } - @Override public List<T> peek(int k) { List<T> topK = new ArrayList<T>(k);