Example usage for java.lang Number intValue

List of usage examples for java.lang Number intValue

Introduction

In this page you can find the example usage for java.lang Number intValue.

Prototype

public abstract int intValue();

Source Link

Document

Returns the value of the specified number as an int .

Usage

From source file:io.coala.random.impl.RandomDistributionFactoryImpl.java

@Override
public RandomNumberDistribution<Integer> getBinomial(final RandomNumberStream rng, final Number trials,
        final Number p) {
    final IntegerDistribution dist = new BinomialDistribution(
            RandomNumberStream.Util.asCommonsRandomGenerator(rng), trials.intValue(), p.doubleValue());
    return new RandomNumberDistribution<Integer>() {
        @Override//from w w w  .j  a  v  a  2  s .c o m
        public Integer draw() {
            return dist.sample();
        }
    };
}

From source file:com.weibo.api.motan.rpc.URL.java

public Integer getIntParameter(String name, int defaultValue) {
    Number n = getNumbers().get(name);
    if (n != null) {
        return n.intValue();
    }/* w  w  w .  j av a  2  s .co m*/
    String value = parameters.get(name);
    if (value == null || value.length() == 0) {
        return defaultValue;
    }
    int i = Integer.parseInt(value);
    getNumbers().put(name, i);
    return i;
}

From source file:com.weibo.api.motan.rpc.URL.java

public Integer getMethodParameter(String methodName, String paramDesc, String name, int defaultValue) {
    String key = methodName + "(" + paramDesc + ")." + name;
    Number n = getNumbers().get(key);
    if (n != null) {
        return n.intValue();
    }/*  ww  w . j  av  a2s  . co m*/
    String value = getMethodParameter(methodName, paramDesc, name);
    if (value == null || value.length() == 0) {
        return defaultValue;
    }
    int i = Integer.parseInt(value);
    getNumbers().put(key, i);
    return i;
}

From source file:de.tuberlin.uebb.jbop.optimizer.controlflow.ConstantIfInliner.java

private boolean evalTwoOpValue(final Number op1, final Number op2, final int opcode) {
    switch (opcode) {
    case Opcodes.IF_ICMPEQ:
        return op1.intValue() == op2.intValue();
    case Opcodes.IF_ICMPNE:
        return op1.intValue() != op2.intValue();
    case Opcodes.IF_ICMPLT:
        return op1.intValue() < op2.intValue();
    case Opcodes.IF_ICMPGE:
        return op1.intValue() >= op2.intValue();
    case Opcodes.IF_ICMPGT:
        return op1.intValue() > op2.intValue();
    case Opcodes.IF_ICMPLE:
        return op1.intValue() <= op2.intValue();
    case Opcodes.IF_ACMPEQ:
        return op1 == op2;
    case Opcodes.IF_ACMPNE:
        return op1 != op2;
    default://from  w ww . j a v a 2 s  .  co m
        return false;
    }
}

From source file:io.coala.random.impl.RandomDistributionFactoryImpl.java

@Override
public RandomNumberDistribution<Integer> getPoisson(final RandomNumberStream rng, final Number alpha,
        final Number beta) {
    final IntegerDistribution dist = new BinomialDistribution(
            RandomNumberStream.Util.asCommonsRandomGenerator(rng), alpha.intValue(), beta.doubleValue());
    return new RandomNumberDistribution<Integer>() {
        @Override/*from www.  j  a  va2s. c  o m*/
        public Integer draw() {
            return dist.sample();
        }
    };
}

From source file:io.coala.random.impl.RandomDistributionFactoryImpl.java

@Override
public RandomNumberDistribution<Integer> getUniformInteger(final RandomNumberStream rng, final Number lower,
        final Number upper) {
    final IntegerDistribution dist = new UniformIntegerDistribution(
            RandomNumberStream.Util.asCommonsRandomGenerator(rng), lower.intValue(), upper.intValue());
    return new RandomNumberDistribution<Integer>() {
        @Override//from w ww. ja v a2  s .c  om
        public Integer draw() {
            return dist.sample();
        }
    };
}

From source file:com.prowidesoftware.swift.model.field.Field38G.java

/**
 * Set the component1 from a Number object.
 * <br />//from   ww  w . j a  v  a2  s .  c o  m
 * <em>If the component being set is a fixed length number, the argument will not be 
 * padded.</em> It is recommended for these cases to use the setComponent1(String) 
 * method.
 * 
 * @see #setComponent1(String)
 *
 * @param component1 the Number with the component1 content to set
 */
public Field38G setComponent1(java.lang.Number component1) {
    if (component1 != null) {
        setComponent(1, "" + component1.intValue());
    }
    return this;
}

From source file:com.prowidesoftware.swift.model.field.Field38G.java

/**
 * Set the component3 from a Number object.
 * <br />// w  w  w.j ava 2s.c  o m
 * <em>If the component being set is a fixed length number, the argument will not be 
 * padded.</em> It is recommended for these cases to use the setComponent3(String) 
 * method.
 * 
 * @see #setComponent3(String)
 *
 * @param component3 the Number with the component3 content to set
 */
public Field38G setComponent3(java.lang.Number component3) {
    if (component3 != null) {
        setComponent(3, "" + component3.intValue());
    }
    return this;
}

From source file:com.prowidesoftware.swift.model.field.Field38H.java

/**
 * Set the component1 from a Number object.
 * <br />//w  w  w.  ja  v a2  s. co m
 * <em>If the component being set is a fixed length number, the argument will not be 
 * padded.</em> It is recommended for these cases to use the setComponent1(String) 
 * method.
 * 
 * @see #setComponent1(String)
 *
 * @param component1 the Number with the component1 content to set
 */
public Field38H setComponent1(java.lang.Number component1) {
    if (component1 != null) {
        setComponent(1, "" + component1.intValue());
    }
    return this;
}

From source file:com.prowidesoftware.swift.model.field.Field38H.java

/**
 * Set the component3 from a Number object.
 * <br />/*  w  ww  . ja v  a2s.c om*/
 * <em>If the component being set is a fixed length number, the argument will not be 
 * padded.</em> It is recommended for these cases to use the setComponent3(String) 
 * method.
 * 
 * @see #setComponent3(String)
 *
 * @param component3 the Number with the component3 content to set
 */
public Field38H setComponent3(java.lang.Number component3) {
    if (component3 != null) {
        setComponent(3, "" + component3.intValue());
    }
    return this;
}