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:org.openmrs.module.webservices.rest.web.v1_0.controller.PersonAttributeControllerTest.java

@Test
public void shouldPurgeAttribute() throws Exception {
    // I'm using sql queries and a flush-session because if I try to test this the natural way, hibernate
    // complains that the attribute will be re-created since the person is in the session.
    Number before = (Number) Context.getAdministrationService()
            .executeSQL("select count(*) from person_attribute where person_id = 2", true).get(0).get(0);

    controller.purge(personUuid, attributeUuid, request, response);
    Context.flushSession();/*from  w  w w.  j a va2s.co  m*/
    Number after = (Number) Context.getAdministrationService()
            .executeSQL("select count(*) from person_attribute where person_id = 2", true).get(0).get(0);
    Assert.assertEquals(before.intValue() - 1, after.intValue());
    Assert.assertNull(service.getPersonAttributeByUuid(attributeUuid));
}

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

/**
 * Set the component1 from a Number object.
 * <br />/*from  w  w  w . j a v  a 2  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 Field28 setComponent1(java.lang.Number component1) {
    if (component1 != null) {
        setComponent(1, "" + component1.intValue());
    }
    return this;
}

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

/**
 * Set the component2 from a Number object.
 * <br />//w  w  w  . j av  a 2  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 setComponent2(String) 
 * method.
 * 
 * @see #setComponent2(String)
 *
 * @param component2 the Number with the component2 content to set
 */
public Field28 setComponent2(java.lang.Number component2) {
    if (component2 != null) {
        setComponent(2, "" + component2.intValue());
    }
    return this;
}

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

/**
 * Set the component1 from a Number object.
 * <br />//from w  w w.  j  a v a  2s  .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 Field28C setComponent1(java.lang.Number component1) {
    if (component1 != null) {
        setComponent(1, "" + component1.intValue());
    }
    return this;
}

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

/**
 * Set the component2 from a Number object.
 * <br />//from   w  w  w .  ja  v a2  s  .  com
 * <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 setComponent2(String) 
 * method.
 * 
 * @see #setComponent2(String)
 *
 * @param component2 the Number with the component2 content to set
 */
public Field28C setComponent2(java.lang.Number component2) {
    if (component2 != null) {
        setComponent(2, "" + component2.intValue());
    }
    return this;
}

From source file:it.drwolf.ridire.index.cwb.CWBSketchExtractor.java

private boolean isSemanticMetadatum(String secondMetadatum2) {
    Number n = (Number) this.entityManager
            .createQuery("select count(fm.id) from FunctionalMetadatum fm where fm.description=:des")
            .setParameter("des", secondMetadatum2).getSingleResult();
    if (n.intValue() > 0) {
        return false;
    }/*  w ww.j  av  a2s  .  c o  m*/
    return true;
}

From source file:com.opengamma.financial.analytics.volatility.surface.BloombergCommodityFuturePriceCurveInstrumentProvider.java

@Override
/**/*from   w w w. ja v a2s  .  c  o  m*/
 * Provides an ExternalID for Bloomberg ticker,
 * given a reference date and an integer offset, the n'th subsequent option <p>
 * The format is prefix + postfix <p>
 * e.g. S U3 Comdty
 * <p>
 * @param futureOptionNumber n'th future following curve date, not null
 * @param curveDate date of future validity; valuation date, not null
 * @return the id of the Bloomberg ticker
 */
public ExternalId getInstrument(final Number futureNumber, final LocalDate curveDate) {
    ArgumentChecker.notNull(futureNumber, "futureOptionNumber");
    ArgumentChecker.notNull(curveDate, "curve date");
    final StringBuffer ticker = new StringBuffer();
    ticker.append(getFuturePrefix());
    final ExchangeTradedInstrumentExpiryCalculator expiryRule = getExpiryRuleCalculator();
    final LocalDate expiryDate = expiryRule.getExpiryMonth(futureNumber.intValue(), curveDate);
    final String expiryCode = BloombergFutureUtils.getShortExpiryCode(expiryDate);
    ticker.append(expiryCode);
    ticker.append(" ");
    ticker.append(getPostfix());
    return ExternalId.of(getTickerScheme(), ticker.toString());
}

From source file:com.parse.ParseConfig.java

/**
 * Access an {@code int} value, returning a default value if it doesn't exist.
 *
 * @param key/*from   www.  j a v  a2s  .c o  m*/
 *          The key to access the value for.
 * @param defaultValue
 *          The value to return if the key is not present or has the wrong type.
 * @return The default value if there is no such key or if it is not a number.
 */
public int getInt(String key, int defaultValue) {
    Number number = getNumber(key);
    return number != null ? number.intValue() : defaultValue;
}

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

@Override
public RandomNumberDistribution<Integer> getHypergeometric(final RandomNumberStream rng,
        final Number populationSize, final Number numberOfSuccesses, final Number sampleSize) {
    final IntegerDistribution dist = new HypergeometricDistribution(
            RandomNumberStream.Util.asCommonsRandomGenerator(rng), populationSize.intValue(),
            numberOfSuccesses.intValue(), sampleSize.intValue());
    return new RandomNumberDistribution<Integer>() {
        @Override//from   w w w .  jav a  2 s .c o  m
        public Integer draw() {
            return dist.sample();
        }
    };
}

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

/**
 * Set the component2 from a Number object.
 * <br />/* w  w w. j av  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 setComponent2(String) 
 * method.
 * 
 * @see #setComponent2(String)
 *
 * @param component2 the Number with the component2 content to set
 */
public Field336 setComponent2(java.lang.Number component2) {
    if (component2 != null) {
        setComponent(2, "" + component2.intValue());
    }
    return this;
}