Example usage for java.lang Integer intValue

List of usage examples for java.lang Integer intValue

Introduction

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

Prototype

@HotSpotIntrinsicCandidate
public int intValue() 

Source Link

Document

Returns the value of this Integer as an int .

Usage

From source file:org.codehaus.grepo.procedure.repository.ProcedureRepositoryOracleTest.java

/** Tests repo with inout param. */
@Test//from  w w w. ja  v  a 2  s  .com
public void testSimpleProcWithInOutParam() {
    Integer result = repo.executeSimpleProcWithInOutParam("value", 42);
    Assert.assertNotNull(result);
    Assert.assertEquals(99, result.intValue());
}

From source file:com.cburch.draw.shapes.Text.java

@Override
public void updateValue(Attribute<?> attr, Object value) {
    if (attr == DrawAttr.FONT) {
        label.setFont((Font) value);
    } else if (attr == DrawAttr.FILL_COLOR) {
        label.setColor((Color) value);
    } else if (attr == DrawAttr.ALIGNMENT) {
        Integer intVal = (Integer) ((AttributeOption) value).getValue();
        label.setHorizontalAlignment(intVal.intValue());
    }//w  ww .  j  a va 2 s.  c  o m
}

From source file:org.springmodules.validation.valang.functions.FunctionTests.java

public void testLengthOfFunctionSuccess() {

    // testing the length function on a string object
    Integer result = (Integer) getLengthOfFunction("test").getResult(null);
    assertEquals("length of stringt 'test' is 4", result.intValue(), 4);

    // testing the length function on a collection
    List list = new ArrayList();
    list.add("1");
    list.add("2");
    list.add("3");
    result = (Integer) getLengthOfFunction(list).getResult(null);
    assertEquals("length of the collection should be 3", result.intValue(), 3);

    // testing the length function on an array
    Object[] array = new Object[] { "1", "2", "3", "4", "5" };
    result = (Integer) getLengthOfFunction(array).getResult(null);
    assertEquals("length of the array should be 5", result.intValue(), 5);
}

From source file:edu.osu.netmotifs.warswap.ui.TransformerMotif.java

@Override
public Point2D transform(Integer vertex) {
    if (motifSize <= 3) {
        switch (vertex.intValue()) {
        case 0://from   w ww .j  a va 2  s  .c  o m
            return new Point2D.Double(60, 20);
        case 1:
            return new Point2D.Double(30, 80);
        case 2:
            return new Point2D.Double(90, 80);

        }
    } else if (motifSize == 4) {
        switch (vertex.intValue()) {
        case 0:
            return new Point2D.Double(30, 20);
        case 1:
            return new Point2D.Double(90, 20);
        case 2:
            return new Point2D.Double(30, 80);
        case 3:
            return new Point2D.Double(90, 80);
        }
    } else if (motifSize == 5) {
        switch (vertex.intValue()) {
        case 0:
            return new Point2D.Double(60, 15);
        case 1:
            return new Point2D.Double(30, 45);
        case 2:
            return new Point2D.Double(90, 45);
        case 3:
            return new Point2D.Double(30, 85);
        case 4:
            return new Point2D.Double(90, 85);
        }
    } else if (motifSize == 6) {
        switch (vertex.intValue()) {
        case 0:
            return new Point2D.Double(15, 20);
        case 1:
            return new Point2D.Double(55, 20);
        case 2:
            return new Point2D.Double(95, 20);
        case 3:
            return new Point2D.Double(15, 80);
        case 4:
            return new Point2D.Double(55, 80);
        case 5:
            return new Point2D.Double(95, 80);
        }
    } else if (motifSize == 7) {
        switch (vertex.intValue()) {
        case 0:
            return new Point2D.Double(35, 15);
        case 1:
            return new Point2D.Double(75, 15);
        case 2:
            return new Point2D.Double(15, 45);
        case 3:
            return new Point2D.Double(55, 45);
        case 4:
            return new Point2D.Double(95, 45);
        case 5:
            return new Point2D.Double(35, 85);
        case 6:
            return new Point2D.Double(75, 85);
        }
    } else if (motifSize == 8) {
        switch (vertex.intValue()) {
        case 0:
            return new Point2D.Double(35, 15);
        case 1:
            return new Point2D.Double(75, 15);
        case 2:
            return new Point2D.Double(15, 45);
        case 3:
            return new Point2D.Double(55, 45);
        case 4:
            return new Point2D.Double(95, 45);
        case 5:
            return new Point2D.Double(15, 85);
        case 6:
            return new Point2D.Double(55, 85);
        case 7:
            return new Point2D.Double(95, 85);
        }
    }
    return null;
}

From source file:ArrayMap.java

@Override
public Object get(Object key) {
    Integer i = index(key);
    if (i == null) {
        return null;
    }//w  ww. j av a 2s.  c  o  m
    return data[i.intValue()];
}

From source file:com.google.example.games.catt.SaveGame.java

/**
 * Gets how many stars the player has on the given level. If the level does not exist
 * in the save game, will return 0./* ww w  .  ja v a2 s. c  o m*/
 */
public int getLevelStars(String levelName) {
    Integer r = mLevelStars.get(levelName);
    return r == null ? 0 : r.intValue();
}

From source file:com.kulik.android.jaxb.library.composer.providers.jsonProvider.JSONObjectProvider.java

@Override
public void putAttributeInt(String annotationName, Integer value) {
    try {//from w w  w.jav a2 s .  c  om
        mJSONObject.put(annotationName, value.intValue());
    } catch (JSONException e) {
        Log.e(TAG, e.toString());
    }
}

From source file:com.aurel.track.fieldType.runtime.matchers.converter.MultipleSelectMatcherConverter.java

/**
 * Convert the object value to xml string for save
 * @param value/*  w  ww  .j ava2s .  c o m*/
 * @param matcherRelation
 * @return
 */
@Override
public String toXMLString(Object value, Integer matcherRelation) {
    if (value == null || matcherRelation == null) {
        return null;
    }
    switch (matcherRelation.intValue()) {
    case MatchRelations.EQUAL:
    case MatchRelations.NOT_EQUAL:
        Integer[] intArr = null;
        try {
            intArr = (Integer[]) value;
        } catch (Exception e) {
            LOGGER.warn(
                    "Converting the " + value + " to Integer[] for XML string failed with " + e.getMessage());
            LOGGER.debug(ExceptionUtils.getStackTrace(e));
        }
        if (intArr != null && intArr.length > 0) {
            return GeneralUtils.createCommaSeparatedStringFromIntegerArr(intArr);
        }
    }
    return "";
}

From source file:org.iwethey.forums.web.post.NewPostController.java

/**
 * Load a blank post object for the form backing.
 * <p>/*from w w w  .  j av  a 2s  .  c o m*/
 * @param request The servlet request object.
 * @return A prepopulated Post object for use in the JSP form.
 */
protected Object formBackingObject(HttpServletRequest request) throws ServletException {
    Integer id = (Integer) WebUtils.getSessionAttribute(request, USER_ID_ATTRIBUTE);
    User user = getUserManager().getUserById(id.intValue());
    Forum forum = getForumManager().getForumById(RequestUtils.getIntParameter(request, "forumid", 0));

    Post post = new Post();
    post.setParent(null);
    post.setForum(forum);
    post.setThread(post);
    post.setCreatedBy(user);
    post.setOriginalSignature(user.getSignature());
    return post;
}

From source file:com.aurel.track.lucene.search.listFields.LocalizedListSearcher.java

/**
 * Gets the workItem field names for a type 
 *//*from  ww  w.  j  a v  a  2  s . c o  m*/
@Override
protected String[] getWorkItemFieldNames(Integer type) {
    return getWorkItemFieldNamesForLookupType(type.intValue());
}