本文整理汇总了Java中org.apache.commons.lang3.mutable.MutableLong.setValue方法的典型用法代码示例。如果您正苦于以下问题:Java MutableLong.setValue方法的具体用法?Java MutableLong.setValue怎么用?Java MutableLong.setValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.lang3.mutable.MutableLong
的用法示例。
在下文中一共展示了MutableLong.setValue方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: bucketAccessed
import org.apache.commons.lang3.mutable.MutableLong; //导入方法依赖的package包/类
void bucketAccessed(long bucketId)
{
long now = System.currentTimeMillis();
if (accessedBucketIds.add(bucketId) || now - lastUpdateAccessTime > updateAccessTimeInterval) {
synchronized (bucketLastAccess) {
for (long id : accessedBucketIds) {
MutableLong lastAccessTime = bucketLastAccess.get(id);
if (lastAccessTime != null) {
lastAccessTime.setValue(now);
} else {
bucketLastAccess.put(id, new MutableLong(now));
}
}
}
accessedBucketIds.clear();
lastUpdateAccessTime = now;
}
}
示例2: compute_gauss_mask_0
import org.apache.commons.lang3.mutable.MutableLong; //导入方法依赖的package包/类
/**
* Compute gauss mask 0.
*
* @param num
* the num
* @param sigma
* the sigma
* @return the double[]
*/
/*
* num ist eigentlich pointer - aufrufende Funkion nimmt an, dass num geändert
* wird. Übergebe es deswegen als MutableDouble aus CommonsLang
*/
public double[] compute_gauss_mask_0(MutableLong num, double sigma) {
int i, n;
double limit;
double[] h;
limit = LinesUtil.MASK_SIZE(LinesUtil.MAX_SIZE_MASK_0, sigma); /* Error < 0.001 on each side */
n = (int) limit;
h = new double[2 * n + 1];
for (i = -n + 1; i <= n - 1; i++)
h[n + i] = phi0(-i + 0.5, sigma) - phi0(-i - 0.5, sigma);
h[0] = 1.0 - phi0(n - 0.5, sigma);
h[2 * n] = phi0(-n + 0.5, sigma);
num.setValue(n);
return h;
}
示例3: compute_gauss_mask_1
import org.apache.commons.lang3.mutable.MutableLong; //导入方法依赖的package包/类
/**
* Compute gauss mask 1.
*
* @param num
* the num
* @param sigma
* the sigma
* @return the double[]
*/
/*
* num ist eigentlich pointer - aufrufende Funkion nimmt an, dass num geändert
* wird. Übergebe es deswegen als MutableDouble aus CommonsLang
*/
public double[] compute_gauss_mask_1(MutableLong num, double sigma) {
int i, n;
double limit;
double[] h;
limit = LinesUtil.MASK_SIZE(LinesUtil.MAX_SIZE_MASK_1, sigma); /* Error < 0.001 on each side */
n = (int) limit;
h = new double[2 * n + 1];
for (i = -n + 1; i <= n - 1; i++)
h[n + i] = phi1(-i + 0.5, sigma) - phi1(-i - 0.5, sigma);
h[0] = -phi1(n - 0.5, sigma);
h[2 * n] = phi1(-n + 0.5, sigma);
num.setValue(n);
return h;
}
示例4: compute_gauss_mask_2
import org.apache.commons.lang3.mutable.MutableLong; //导入方法依赖的package包/类
/**
* Compute gauss mask 2.
*
* @param num
* the num
* @param sigma
* the sigma
* @return the double[]
*/
/*
* num ist eigentlich pointer - aufrufende Funkion nimmt an, dass num geändert
* wird. Übergebe es deswegen als MutableDouble aus CommonsLang
*/
public double[] compute_gauss_mask_2(MutableLong num, double sigma) {
int i, n;
double limit;
double[] h;
limit = LinesUtil.MASK_SIZE(LinesUtil.MAX_SIZE_MASK_2, sigma); /* Error < 0.001 on each side */
n = (int) limit;
h = new double[2 * n + 1];
for (i = -n + 1; i <= n - 1; i++)
h[n + i] = phi2(-i + 0.5, sigma) - phi2(-i - 0.5, sigma);
h[0] = -phi2(n - 0.5, sigma);
h[2 * n] = phi2(-n + 0.5, sigma);
num.setValue(n);
return h;
}
示例5: getUniqueTimestamp
import org.apache.commons.lang3.mutable.MutableLong; //导入方法依赖的package包/类
private long getUniqueTimestamp(byte[] row) {
int slot = Bytes.hashCode(row) & mask;
MutableLong lastTimestamp = lastTimestamps[slot];
long now = System.currentTimeMillis();
synchronized (lastTimestamp) {
long pt = lastTimestamp.longValue() >> 10;
if (now > pt) {
lastTimestamp.setValue(now << 10);
} else {
lastTimestamp.increment();
}
return lastTimestamp.longValue();
}
}