HugeGraph-81: Small optimization of package structure

Change-Id: I84109719a0064ea0d53c26843fbe435b84655912
This commit is contained in:
liningrui 2018-06-20 17:06:55 +08:00
parent 8c76d5b0cf
commit 4aae65cd4d
5 changed files with 58 additions and 75 deletions

View File

@ -6,7 +6,7 @@
<groupId>com.baidu.hugegraph</groupId>
<artifactId>hugegraph-common</artifactId>
<version>1.4.4-SNAPSHOT</version>
<version>1.4.5-SNAPSHOT</version>
<distributionManagement>
<snapshotRepository>
@ -169,7 +169,7 @@
</manifest>
<manifestEntries>
<Implementation-Version>
1.4.4.0
1.4.5.0
</Implementation-Version>
</manifestEntries>
</archive>

View File

@ -17,7 +17,7 @@
* under the License.
*/
package com.baidu.hugegraph.type;
package com.baidu.hugegraph.func;
public interface TriFunction <T1, T2, T3, R> {
public R apply(T1 v1, T2 v2, T3 v3);

View File

@ -38,7 +38,7 @@ import java.util.stream.Stream;
import org.slf4j.Logger;
import com.baidu.hugegraph.type.TriFunction;
import com.baidu.hugegraph.func.TriFunction;
import com.baidu.hugegraph.util.Log;
import com.baidu.hugegraph.util.ReflectionUtil;
import com.google.common.reflect.ClassPath.ClassInfo;

View File

@ -1,71 +0,0 @@
/*
* Copyright 2017 HugeGraph Authors
*
* 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 com.baidu.hugegraph.type;
/**
* Shard is used for backend storage (like cassandra, hbase) scanning
* operations. Each shard represents a range of tokens for a node.
* Reading data from a given shard does not cross multiple nodes.
*/
public class Shard {
// token range start
private String start;
// token range end
private String end;
// partitions count in this range
private long length;
public Shard(String start, String end, long length) {
this.start = start;
this.end = end;
this.length = length;
}
public String start() {
return this.start;
}
public void start(String start) {
this.start = start;
}
public String end() {
return this.end;
}
public void end(String end) {
this.end = end;
}
public long length() {
return this.length;
}
public void length(long length) {
this.length = length;
}
@Override
public String toString() {
return String.format("Shard{start=%s, end=%s, length=%s}",
this.start, this.end, this.length);
}
}

View File

@ -0,0 +1,54 @@
/*
* Copyright 2017 HugeGraph Authors
*
* 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 com.baidu.hugegraph.util;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
public final class InsertionOrderUtil {
public static <K, V> Map<K, V> newMap() {
return new LinkedHashMap<>();
}
public static <K, V> Map<K, V> newMap(Map<K, V> origin) {
return new LinkedHashMap<>(origin);
}
public static <V> Set<V> newSet() {
return new LinkedHashSet<>();
}
public static <V> Set<V> newSet(Set<V> origin) {
return new LinkedHashSet<>(origin);
}
public static <V> List<V> newList() {
return new ArrayList<>();
}
public static <V> List<V> newList(List<V> origin) {
return new ArrayList<>(origin);
}
}