java key value pair_Java Pair.getKey方法代碼示例

本文整理匯總了Java中org.apache.commons.math3.util.Pair.getKey方法的典型用法代碼示例。如果您正苦於以下問題:Java Pair.getKey方法的具體用法?Java Pair.getKey怎麽用?Java Pair.getKey使用的例子?那麽恭喜您, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.commons.math3.util.Pair的用法示例。

在下文中一共展示了Pair.getKey方法的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於我們的係統推薦出更棒的Java代碼示例。

示例1: inverseCumulativeProbability

​點讚 3

import org.apache.commons.math3.util.Pair; //導入方法依賴的package包/類

/**

* {@inheritDoc}

*/

@Override

public double inverseCumulativeProbability(final double p) throws OutOfRangeException {

if (p < 0.0 || p > 1.0) {

throw new OutOfRangeException(p, 0, 1);

}

double probability = 0;

double x = getSupportLowerBound();

for (final Pair sample : innerDistribution.getPmf()) {

if (sample.getValue() == 0.0) {

continue;

}

probability += sample.getValue();

x = sample.getKey();

if (probability >= p) {

break;

}

}

return x;

}

開發者ID:biocompibens,項目名稱:SME,代碼行數:27,

示例2: getWordIndexAndRelativePosition

​點讚 3

import org.apache.commons.math3.util.Pair; //導入方法依賴的package包/類

/** Returns a pair of indices specifying the word index for the given caretOffset and the

* index of caretOffset relative to this word. (-1, -1) is returned if no word is found for xIndex. */

private Pair getWordIndexAndRelativePosition(int caretOffset) {

TrpTextLineType tl = getLineObject(text.getLineAtOffset(caretOffset));

//logger.debug("tl = "+tl);

int xIndex = getXIndex(caretOffset);

//String lineText = text.getLine(currentLineIndex);

int i=0; // the current word index

int l=0; // the length of the text already parsed through

for (Pair p : getWordRanges(tl).values()) {

if (xIndex >= p.getKey() && xIndex <= p.getValue()) {

return Pair.of(i, xIndex-l);

}

l += (p.getValue()-p.getKey())+1;

++i;

}

return Pair.of(-1, -1);

}

開發者ID:Transkribus,項目名稱:TranskribusSwtGui,代碼行數:23,

示例3: getNumRepresentation

​點讚 2

import org.apache.commons.math3.util.Pair; //導入方法依賴的package包/類

/**

* Get a number representation from the object provided.

*

* @param att object to try and represent

* @return number that represents

*/

public static Double getNumRepresentation(final Object att) {

// is an Numeric value

if (Number.class.isAssignableFrom(att.getClass())) {

return ((Number) att).doubleValue();

} else { // is a String

Pair num1 = LoomQueryUtils.isNumber(att.toString().trim());

String s1 = att.toString().trim();

if (num1.getKey()) {

return Double.parseDouble(s1);

} else {

return Double.valueOf(s1);

}

}

}

開發者ID:HewlettPackard,項目名稱:loom,代碼行數:21,

示例4: cumulativeProbability

​點讚 2

import org.apache.commons.math3.util.Pair; //導入方法依賴的package包/類

/**

* {@inheritDoc}

*/

public double cumulativeProbability(final int x) {

double probability = 0;

for (final Pair sample : innerDistribution.getPmf()) {

if (sample.getKey() <= x) {

probability += sample.getValue();

}

}

return probability;

}

開發者ID:biocompibens,項目名稱:SME,代碼行數:15,

示例5: getNumericalMean

​點讚 2

import org.apache.commons.math3.util.Pair; //導入方法依賴的package包/類

/**

* {@inheritDoc}

*

* @return {@code sum(singletons[i] * probabilities[i])}

*/

public double getNumericalMean() {

double mean = 0;

for (final Pair sample : innerDistribution.getPmf()) {

mean += sample.getValue() * sample.getKey();

}

return mean;

}

開發者ID:biocompibens,項目名稱:SME,代碼行數:15,

示例6: getNumericalVariance

​點讚 2

import org.apache.commons.math3.util.Pair; //導入方法依賴的package包/類

/**

* {@inheritDoc}

*

* @return {@code sum((singletons[i] - mean) ^ 2 * probabilities[i])}

*/

public double getNumericalVariance() {

double mean = 0;

double meanOfSquares = 0;

for (final Pair sample : innerDistribution.getPmf()) {

mean += sample.getValue() * sample.getKey();

meanOfSquares += sample.getValue() * sample.getKey() * sample.getKey();

}

return meanOfSquares - mean * mean;

}

開發者ID:biocompibens,項目名稱:SME,代碼行數:17,

示例7: getSupportLowerBound

​點讚 2

import org.apache.commons.math3.util.Pair; //導入方法依賴的package包/類

/**

* {@inheritDoc}

*

* Returns the lowest value with non-zero probability.

*

* @return the lowest value with non-zero probability.

*/

public int getSupportLowerBound() {

int min = Integer.MAX_VALUE;

for (final Pair sample : innerDistribution.getPmf()) {

if (sample.getKey() < min && sample.getValue() > 0) {

min = sample.getKey();

}

}

return min;

}

開發者ID:biocompibens,項目名稱:SME,代碼行數:18,

示例8: getSupportUpperBound

​點讚 2

import org.apache.commons.math3.util.Pair; //導入方法依賴的package包/類

/**

* {@inheritDoc}

*

* Returns the highest value with non-zero probability.

*

* @return the highest value with non-zero probability.

*/

public int getSupportUpperBound() {

int max = Integer.MIN_VALUE;

for (final Pair sample : innerDistribution.getPmf()) {

if (sample.getKey() > max && sample.getValue() > 0) {

max = sample.getKey();

}

}

return max;

}

開發者ID:biocompibens,項目名稱:SME,代碼行數:18,

示例9: cumulativeProbability

​點讚 2

import org.apache.commons.math3.util.Pair; //導入方法依賴的package包/類

/**

* {@inheritDoc}

*/

public double cumulativeProbability(final double x) {

double probability = 0;

for (final Pair sample : innerDistribution.getPmf()) {

if (sample.getKey() <= x) {

probability += sample.getValue();

}

}

return probability;

}

開發者ID:biocompibens,項目名稱:SME,代碼行數:15,

示例10: getNumericalMean

​點讚 2

import org.apache.commons.math3.util.Pair; //導入方法依賴的package包/類

/**

* {@inheritDoc}

*

* @return {@code sum(singletons[i] * probabilities[i])}

*/

public double getNumericalMean() {

double mean = 0;

for (final Pair sample : innerDistribution.getPmf()) {

mean += sample.getValue() * sample.getKey();

}

return mean;

}

開發者ID:biocompibens,項目名稱:SME,代碼行數:15,

示例11: getNumericalVariance

​點讚 2

import org.apache.commons.math3.util.Pair; //導入方法依賴的package包/類

/**

* {@inheritDoc}

*

* @return {@code sum((singletons[i] - mean) ^ 2 * probabilities[i])}

*/

public double getNumericalVariance() {

double mean = 0;

double meanOfSquares = 0;

for (final Pair sample : innerDistribution.getPmf()) {

mean += sample.getValue() * sample.getKey();

meanOfSquares += sample.getValue() * sample.getKey() * sample.getKey();

}

return meanOfSquares - mean * mean;

}

開發者ID:biocompibens,項目名稱:SME,代碼行數:17,

示例12: getSupportLowerBound

​點讚 2

import org.apache.commons.math3.util.Pair; //導入方法依賴的package包/類

/**

* {@inheritDoc}

*

* Returns the lowest value with non-zero probability.

*

* @return the lowest value with non-zero probability.

*/

public double getSupportLowerBound() {

double min = Double.POSITIVE_INFINITY;

for (final Pair sample : innerDistribution.getPmf()) {

if (sample.getKey() < min && sample.getValue() > 0) {

min = sample.getKey();

}

}

return min;

}

開發者ID:biocompibens,項目名稱:SME,代碼行數:18,

示例13: getSupportUpperBound

​點讚 2

import org.apache.commons.math3.util.Pair; //導入方法依賴的package包/類

/**

* {@inheritDoc}

*

* Returns the highest value with non-zero probability.

*

* @return the highest value with non-zero probability.

*/

public double getSupportUpperBound() {

double max = Double.NEGATIVE_INFINITY;

for (final Pair sample : innerDistribution.getPmf()) {

if (sample.getKey() > max && sample.getValue() > 0) {

max = sample.getKey();

}

}

return max;

}

開發者ID:biocompibens,項目名稱:SME,代碼行數:18,

示例14: bothAreNumbers

​點讚 2

import org.apache.commons.math3.util.Pair; //導入方法依賴的package包/類

private static boolean bothAreNumbers(final Pair num1, final Pair num2) {

return num1.getKey() && num2.getKey();

}

開發者ID:HewlettPackard,項目名稱:loom,代碼行數:4,

注:本文中的org.apache.commons.math3.util.Pair.getKey方法示例整理自Github/MSDocs等源碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值