本文整理汇总了Java中com.github.davidmoten.guavamini.annotations.VisibleForTesting类的典型用法代码示例。如果您正苦于以下问题:Java VisibleForTesting类的具体用法?Java VisibleForTesting怎么用?Java VisibleForTesting使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
VisibleForTesting类属于com.github.davidmoten.guavamini.annotations包,在下文中一共展示了VisibleForTesting类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: reduce
import com.github.davidmoten.guavamini.annotations.VisibleForTesting; //导入依赖的package包/类
@VisibleForTesting
static List<Range> reduce(List<Range> ranges) {
List<Range> list = Lists.newArrayList();
Range previous = null;
for (Range r : ranges) {
if (previous != null) {
if (previous.high() >= r.low() - 1) {
// combine with previous because overlapping or contiguous
previous = new Range(previous.low(), Math.max(previous.high(), r.high()));
} else {
list.add(previous);
previous = r;
}
} else {
previous = r;
}
}
if (previous != null) {
list.add(previous);
}
return list;
}
开发者ID:davidmoten,项目名称:hilbert-curve,代码行数:23,代码来源:SmallHilbertCurve.java
示例2: toRange
import com.github.davidmoten.guavamini.annotations.VisibleForTesting; //导入依赖的package包/类
@VisibleForTesting
Range toRange(Box box, BoxMinMaxIndexEstimationStrategy strategy) {
Preconditions.checkNotNull(strategy, "strategy cannot be null");
Visitor visitor = new Visitor();
if (strategy == BoxMinMaxIndexEstimationStrategy.SCAN_ENTIRE_PERIMETER) {
// brute force method of finding min and max values within box
// min and max values must be on the perimeter of the box
visitPerimeter(box, visitor);
} else {
// TODO ideally don't use brute force but this method not working yet
// not a problem with visitVertices I don't think but perhaps the choice of
// split indices
// visitVertices(box, visitor);
throw new RuntimeException("Unsupported strategy: " + strategy);
}
return visitor.getRange();
}
开发者ID:davidmoten,项目名称:hilbert-curve,代码行数:18,代码来源:SmallHilbertCurve.java
示例3: toIndex
import com.github.davidmoten.guavamini.annotations.VisibleForTesting; //导入依赖的package包/类
@VisibleForTesting
BigInteger toIndex(long... transposedIndex) {
byte[] b = new byte[length];
int bIndex = length - 1;
long mask = 1L << (bits - 1);
for (int i = 0; i < bits; i++) {
for (int j = 0; j < transposedIndex.length; j++) {
if ((transposedIndex[j] & mask) != 0) {
b[length - 1 - bIndex / 8] |= 1 << (bIndex % 8);
}
bIndex--;
}
mask >>= 1;
}
// b is expected to be BigEndian
return new BigInteger(1, b);
}
开发者ID:davidmoten,项目名称:hilbert-curve,代码行数:18,代码来源:HilbertCurve.java
示例4: visitBox
import com.github.davidmoten.guavamini.annotations.VisibleForTesting; //导入依赖的package包/类
@VisibleForTesting
void visitBox(Box box, Consumer<long[]> visitor) {
int dimensions = box.a.length;
long[] p = new long[dimensions];
for (int i = 0; i < dimensions; i++) {
p[i] = Math.min(box.a[i], box.b[i]);
}
visitBox(box, p, 0, visitor);
}
开发者ID:davidmoten,项目名称:hilbert-curve,代码行数:10,代码来源:SmallHilbertCurve.java
示例5: visitVertices
import com.github.davidmoten.guavamini.annotations.VisibleForTesting; //导入依赖的package包/类
@VisibleForTesting
void visitVertices(Box box, Consumer<long[]> visitor) {
for (long i = 0; i < (1L << dimensions); i++) {
long[] x = new long[box.a.length];
for (int j = 0; j < box.dimensions(); j++) {
if ((i & (1L << j)) != 0) {
// if jth bit set
x[j] = box.b[j];
} else {
x[j] = box.a[j];
}
}
visitor.accept(x);
}
}
开发者ID:davidmoten,项目名称:hilbert-curve,代码行数:16,代码来源:SmallHilbertCurve.java
示例6: transposedIndex
import com.github.davidmoten.guavamini.annotations.VisibleForTesting; //导入依赖的package包/类
/**
* <p>
* Given the axes (coordinates) of a point in N-Dimensional space, find the
* distance to that point along the Hilbert curve. That distance will be
* transposed; broken into pieces and distributed into an array.
*
* <p>
* The number of dimensions is the length of the hilbertAxes array.
*
* <p>
* Note: In Skilling's paper, this function is called AxestoTranspose.
*
* @param mutate
*
* @param point
* Point in N-space
* @return The Hilbert distance (or index) as a transposed Hilbert index
*/
@VisibleForTesting
static long[] transposedIndex(int bits, long... point) {
final long M = 1L << (bits - 1);
final int n = point.length; // n: Number of dimensions
final long[] x = Arrays.copyOf(point, n);
long p, q, t;
int i;
// Inverse undo
for (q = M; q > 1; q >>= 1) {
p = q - 1;
for (i = 0; i < n; i++)
if ((x[i] & q) != 0)
x[0] ^= p; // invert
else {
t = (x[0] ^ x[i]) & p;
x[0] ^= t;
x[i] ^= t;
}
} // exchange
// Gray encode
for (i = 1; i < n; i++)
x[i] ^= x[i - 1];
t = 0;
for (q = M; q > 1; q >>= 1)
if ((x[n - 1] & q) != 0)
t ^= q - 1;
for (i = 0; i < n; i++)
x[i] ^= t;
return x;
}
开发者ID:davidmoten,项目名称:hilbert-curve,代码行数:50,代码来源:HilbertCurve.java
示例7:
import com.github.davidmoten.guavamini.annotations.VisibleForTesting; //导入依赖的package包/类
@VisibleForTesting
Options(Callable<File> filefactory, int pageSizeBytes, Scheduler scheduler) {
Preconditions.checkNotNull(filefactory);
Preconditions.checkArgument(pageSizeBytes > 0, "bufferSizeBytes must be greater than 0");
Preconditions.checkNotNull(scheduler);
this.fileFactory = filefactory;
this.pageSizeBytes = pageSizeBytes;
this.scheduler = scheduler;
}
开发者ID:davidmoten,项目名称:rxjava2-extras,代码行数:10,代码来源:Options.java
示例8: closeQuietly
import com.github.davidmoten.guavamini.annotations.VisibleForTesting; //导入依赖的package包/类
@VisibleForTesting
static void closeQuietly(Socket socket) {
try {
socket.close();
} catch (IOException e) {
// ignore exception
}
}
开发者ID:davidmoten,项目名称:rxjava2-extras,代码行数:9,代码来源:FlowableServerSocket.java
示例9: close
import com.github.davidmoten.guavamini.annotations.VisibleForTesting; //导入依赖的package包/类
@VisibleForTesting
public static void close(PagedQueue queue) {
try {
queue.close();
} catch (Throwable err) {
Exceptions.throwIfFatal(err);
RxJavaPlugins.onError(err);
}
}
开发者ID:davidmoten,项目名称:rxjava2-extras,代码行数:10,代码来源:FlowableOnBackpressureBufferToFile.java
示例10: getMethod
import com.github.davidmoten.guavamini.annotations.VisibleForTesting; //导入依赖的package包/类
@VisibleForTesting
static Method getMethod(Class<?> cls, String name, Class<?>... params) {
Method m;
try {
m = cls.getDeclaredMethod(name, params);
} catch (Exception e) {
throw new RuntimeException(e);
}
m.setAccessible(true);
return m;
}
开发者ID:davidmoten,项目名称:rxjava2-extras,代码行数:12,代码来源:MemoryMappedFile.java
示例11: capacity
import com.github.davidmoten.guavamini.annotations.VisibleForTesting; //导入依赖的package包/类
/**
* Returns a capacity that is sufficient to keep the map from being resized
* as long as it grows no larger than expectedSize and the load factor is >=
* its default (0.75).
*/
@VisibleForTesting
static int capacity(int expectedSize) {
if (expectedSize < 3) {
checkNonnegative(expectedSize, "expectedSize");
return expectedSize + 1;
}
if (expectedSize < MAX_POWER_OF_TWO) {
return expectedSize + expectedSize / 3;
}
return Integer.MAX_VALUE; // any large value
}
开发者ID:davidmoten,项目名称:guava-mini,代码行数:17,代码来源:Sets.java
示例12: checkNonnegative
import com.github.davidmoten.guavamini.annotations.VisibleForTesting; //导入依赖的package包/类
@VisibleForTesting
static int checkNonnegative(int value, String name) {
if (value < 0) {
throw new IllegalArgumentException(name + " cannot be negative but was: " + value);
}
return value;
}
开发者ID:davidmoten,项目名称:guava-mini,代码行数:8,代码来源:Sets.java
示例13: computeArrayListCapacity
import com.github.davidmoten.guavamini.annotations.VisibleForTesting; //导入依赖的package包/类
@VisibleForTesting
static int computeArrayListCapacity(int arraySize) {
Preconditions.checkArgument(arraySize >= 0, "arraySize must be non-negative");
// TODO(kevinb): Figure out the right behavior, and document it
return saturatedCast(5L + arraySize + (arraySize / 10));
}
开发者ID:davidmoten,项目名称:guava-mini,代码行数:8,代码来源:Lists.java
示例14: saturatedCast
import com.github.davidmoten.guavamini.annotations.VisibleForTesting; //导入依赖的package包/类
/**
* Returns the {@code int} nearest in value to {@code value}.
*
* @param value
* any {@code long} value
* @return the same value cast to {@code int} if it is in the range of the
* {@code int} type, {@link Integer#MAX_VALUE} if it is too large,
* or {@link Integer#MIN_VALUE} if it is too small
*/
@VisibleForTesting
static int saturatedCast(long value) {
if (value > Integer.MAX_VALUE) {
return Integer.MAX_VALUE;
}
if (value < Integer.MIN_VALUE) {
return Integer.MIN_VALUE;
}
return (int) value;
}
开发者ID:davidmoten,项目名称:guava-mini,代码行数:20,代码来源:Lists.java
示例15: height
import com.github.davidmoten.guavamini.annotations.VisibleForTesting; //导入依赖的package包/类
@VisibleForTesting
int height() {
return height;
}
开发者ID:davidmoten,项目名称:geotemporal,代码行数:5,代码来源:BTree.java
示例16: visitPerimeter
import com.github.davidmoten.guavamini.annotations.VisibleForTesting; //导入依赖的package包/类
@VisibleForTesting
void visitPerimeter(Box box, Consumer<long[]> visitor) {
for (int i = 0; i < box.dimensions(); i++) {
visitPerimeter(box, i, visitor);
}
}
开发者ID:davidmoten,项目名称:hilbert-curve,代码行数:7,代码来源:SmallHilbertCurve.java
示例17: BufferToFileSubscriberFlowable
import com.github.davidmoten.guavamini.annotations.VisibleForTesting; //导入依赖的package包/类
@VisibleForTesting
public BufferToFileSubscriberFlowable(Subscriber<? super T> child, PagedQueue queue,
Serializer<T> serializer, Worker worker) {
super(child, queue, serializer, worker);
}
开发者ID:davidmoten,项目名称:rxjava2-extras,代码行数:6,代码来源:FlowableOnBackpressureBufferToFile.java
示例18: searchPosition
import com.github.davidmoten.guavamini.annotations.VisibleForTesting; //导入依赖的package包/类
@VisibleForTesting
int searchPosition() {
return searchPosition;
}
开发者ID:davidmoten,项目名称:rxjava2-extras,代码行数:5,代码来源:DelimitedStringLinkedList.java
示例19: toLegs
import com.github.davidmoten.guavamini.annotations.VisibleForTesting; //导入依赖的package包/类
@VisibleForTesting
static Observable<TimedLeg> toLegs(Shapefile eezLine, Shapefile eezPolygon, Collection<Port> ports,
Collection<EezWaypoint> eezWaypoints, Observable<Fix> fixes) {
return Observable.defer(() -> //
{
State[] state = new State[1];
state[0] = new State(null, null, EezStatus.UNKNOWN);
return fixes //
.flatMap(fix -> {
List<TimedLeg> legs = null; // only create when needed to reduce
// allocations
boolean inEez = eezPolygon.contains(fix.lat(), fix.lon());
State current = state[0];
Preconditions.checkArgument(current.latestFix == null || fix.time() >= current.latestFix.time(),
"fixes out of time order!");
boolean crossed = (inEez && current.fixStatus == EezStatus.OUT)
|| (!inEez && current.fixStatus == EezStatus.IN);
if (crossed) {
TimedWaypoint closestWaypoint = findClosestWaypoint(eezLine, eezWaypoints, fix, current);
if (current.timedWaypoint != null) {
if (legs == null) {
legs = new ArrayList<>(2);
}
legs.add(new TimedLeg(fix.mmsi(), current.timedWaypoint, closestWaypoint));
}
current = new State(closestWaypoint, fix, EezStatus.from(inEez));
}
// Note that may have detected eez crossing but also
// have arrived in port so may need to return both
// waypoints
if (inEez) {
Optional<Port> port = findPort(ports, fix.lat(), fix.lon());
if (port.isPresent()) {
TimedWaypoint portTimedWaypoint = new TimedWaypoint(port.get(), fix.time());
state[0] = new State(portTimedWaypoint, fix, EezStatus.IN);
if (current.fixStatus != EezStatus.UNKNOWN && current.timedWaypoint != null
&& current.timedWaypoint.waypoint != port.get()) {
if (current.timedWaypoint != null) {
if (legs == null) {
legs = new ArrayList<>(2);
}
legs.add(new TimedLeg(fix.mmsi(), current.timedWaypoint, portTimedWaypoint));
}
}
} else {
state[0] = new State(current.timedWaypoint, fix, EezStatus.IN);
}
} else {
state[0] = new State(current.timedWaypoint, fix, EezStatus.OUT);
}
if (legs == null) {
return Observable.empty();
} else {
return Observable.from(legs);
}
});
});
}
开发者ID:amsa-code,项目名称:risky,代码行数:61,代码来源:VoyageDatasetProducer.java
示例20: transpose
import com.github.davidmoten.guavamini.annotations.VisibleForTesting; //导入依赖的package包/类
/**
* Returns the transposed representation of the Hilbert curve index.
*
* <p>
* The Hilbert index is expressed internally as an array of transposed bits.
*
* <pre>
Example: 5 bits for each of n=3 coordinates.
15-bit Hilbert integer = A B C D E F G H I J K L M N O is stored
as its Transpose ^
X[0] = A D G J M X[2]| 7
X[1] = B E H K N <-------> | /X[1]
X[2] = C F I L O axes |/
high low 0------> X[0]
* </pre>
*
* @param index
* index to be tranposed
* @return transposed index
*/
@VisibleForTesting
long[] transpose(BigInteger index) {
long[] x = new long[dimensions];
transpose(index, x);
return x;
}
开发者ID:davidmoten,项目名称:hilbert-curve,代码行数:27,代码来源:HilbertCurve.java
注:本文中的com.github.davidmoten.guavamini.annotations.VisibleForTesting类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论