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:com.example.app.repository.model.RepositoryDAO.java

/**
 * Get the RepositoryItemRelation for the given Id
 *
 * @param id the Id/*from w w  w  .ja  v a2  s .c o m*/
 *
 * @return the repository item relation
 */
public Optional<RepositoryItemRelation> getRepositoryItemRelation(Number id) {
    return Optional
            .ofNullable((RepositoryItemRelation) getSession().get(RepositoryItemRelation.class, id.intValue()));
}

From source file:edu.uci.ics.jung.algorithms.flows.EdmondsKarpMaxFlow.java

@Override
protected void finalizeIterations() {

    for (E currentEdge : mFlowGraph.getEdges()) {
        Number capacity = edgeCapacityTransformer.transform(currentEdge);

        Number residualCapacity = residualCapacityMap.get(currentEdge);
        if (capacity != null) {
            Integer flowValue = new Integer(capacity.intValue() - residualCapacity.intValue());
            this.edgeFlowMap.put(currentEdge, flowValue);
        }/*from  ww  w.j  a  v  a  2  s  .c  o m*/
    }

    Set<E> backEdges = new HashSet<E>();
    for (E currentEdge : mFlowGraph.getEdges()) {

        if (edgeCapacityTransformer.transform(currentEdge) == null) {
            backEdges.add(currentEdge);
        } else {
            residualCapacityMap.remove(currentEdge);
        }
    }
    for (E e : backEdges) {
        mFlowGraph.removeEdge(e);
    }
}

From source file:com.jaspersoft.jasperserver.api.metadata.data.snapshot.hibernate.HibernateDataSnapshotService.java

@Transactional(propagation = Propagation.REQUIRED, readOnly = true)
public boolean matchesVersion(ExecutionContext context, final long snapshotId, final int version) {
    return getHibernateTemplate().execute(new HibernateCallback<Boolean>() {
        public Boolean doInHibernate(Session session) throws HibernateException, SQLException {
            Criteria criteria = session.createCriteria(PersistentDataSnapshot.class);
            criteria.add(Restrictions.idEq(snapshotId));
            criteria.add(Restrictions.eq("version", version));
            criteria.setProjection(Projections.rowCount());
            Number count = (Number) criteria.uniqueResult();

            if (log.isDebugEnabled()) {
                log.debug("version check for " + snapshotId + " and " + version + " returned " + count);
            }/*from w w w.jav  a 2  s.  c  o m*/

            return count.intValue() > 0;
        }
    });
}

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

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

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

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

From source file:de.tuberlin.uebb.jbop.optimizer.arithmetic.ArithmeticExpressionInterpreter.java

private AbstractInsnNode handleOr(final int opcode, final Number one, final Number two) {
    final Number number;
    if (opcode == IOR) {
        number = Integer.valueOf(one.intValue() | two.intValue());
    } else {//from   ww w.  ja  va  2  s  . c  o  m
        number = Long.valueOf(one.longValue() | two.longValue());
    }
    return NodeHelper.getInsnNodeFor(number);
}

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

/**
 * Set the component2 from a Number object.
 * <br />/*ww  w.j av a2s. 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 Field344 setComponent2(java.lang.Number component2) {
    if (component2 != null) {
        setComponent(2, "" + component2.intValue());
    }
    return this;
}

From source file:de.tuberlin.uebb.jbop.optimizer.arithmetic.ArithmeticExpressionInterpreter.java

private AbstractInsnNode handleShiftLeft(final int opcode, final Number one, final Number two) {
    final Number number;
    if (opcode == ISHL) {
        number = Integer.valueOf(one.intValue() << two.intValue());
    } else {//from  w  w  w .  j  a v  a2  s .  c om
        number = Long.valueOf(one.longValue() << two.longValue());
    }
    return NodeHelper.getInsnNodeFor(number);
}

From source file:de.tuberlin.uebb.jbop.optimizer.arithmetic.ArithmeticExpressionInterpreter.java

private AbstractInsnNode handleArithmeticShiftRight(final int opcode, final Number one, final Number two) {
    final Number number;
    if (opcode == ISHR) {
        number = Integer.valueOf(one.intValue() >> two.intValue());
    } else {/*from   ww  w . ja  v  a 2  s .c  o m*/
        number = Long.valueOf(one.longValue() >> two.longValue());
    }
    return NodeHelper.getInsnNodeFor(number);
}

From source file:de.tuberlin.uebb.jbop.optimizer.arithmetic.ArithmeticExpressionInterpreter.java

private AbstractInsnNode handleAnd(final int opcode, final Number one, final Number two) {
    final Number number;
    if (opcode == IAND) {
        number = Integer.valueOf(one.intValue() & two.intValue());
    } else {//www. ja  v a2 s  . c  om
        number = Long.valueOf(one.longValue() & two.longValue());
    }
    return NodeHelper.getInsnNodeFor(number);
}