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:net.sf.firemox.xml.XmlTools.java

/**
 * Return the corresponding code to the specified target mode.
 * /*w  ww  . ja va 2 s . c  o m*/
 * @param modeAlias
 *          the alias of mode
 * @return the corresponding code to the specified target mode.
 * @see IdTargets#MODE_NAMES
 */
public static int getTargetMode(String modeAlias) {
    if (modeAlias == null) {
        return IdTargets.CHOOSE;
    }
    final Integer obj = XmlTools.targetMode.get(modeAlias);
    if (obj != null) {
        return obj.intValue();
    }
    XmlConfiguration.error("Unknown target mode : '" + modeAlias + "'");
    return 0;
}

From source file:net.sf.firemox.xml.XmlTools.java

/**
 * Return the corresponding code to the card color name
 * //from   w w w  .j a v a  2s  .  c o m
 * @param colorName
 *          the color alias
 * @return the corresponding code to the card color name
 */
public static int getColor(String colorName) {
    final Integer obj = XmlTools.cardColorsName.get(colorName);
    if (obj != null) {
        return obj.intValue();
    }
    XmlConfiguration.error("Unknown color : '" + colorName + "'");
    return 0;
}

From source file:bammerbom.ultimatecore.bukkit.resources.utils.BossbarUtil.java

private static void cancelTimer(Player player) {
    Integer timerID = timers.remove(player.getUniqueId());
    if (timerID != null) {
        Bukkit.getScheduler().cancelTask(timerID.intValue());
    }/*w  w  w .  ja va  2 s .  c o m*/
}

From source file:net.sf.firemox.xml.XmlTools.java

/**
 * Return the corresponding code to the specified string register index.
 * //from  ww w.j a v a  2s .  c  o m
 * @param alias
 *          the alias of value in it's string form
 * @return the corresponding code to the specified string register index.
 */
public static int getValue(String alias) {
    final Integer value = getIntPriv(alias);
    if (value == null) {
        Integer obj = XmlTools.definedValuesName.get(alias);
        if (obj != null) {
            return obj.intValue();
        }
        obj = XmlTools.registerIndexName.get(alias);
        if (obj != null) {
            return obj.intValue();
        }
        // Thread.dumpStack();
        XmlConfiguration.error("Unknown alias : '" + alias + "'");
        return 0;
    }
    return value;
}

From source file:com.aurel.track.linkType.MsProjectLinkType.java

/**
 * Gets the localized dependency name/*from   w  ww  .jav a2  s  .c o m*/
 * @param dependencyType
 * @param locale
 * @return
 */
private static String getDependencyTypeName(Integer dependencyType, Locale locale) {
    if (dependencyType != null) {
        switch (dependencyType.intValue()) {
        case PREDECESSOR_ELEMENT_TYPE.FS:
            return LocalizeUtil.getLocalizedTextFromApplicationResources(
                    "admin.actions.importMSProject.opt.finishToStart", locale);
        case PREDECESSOR_ELEMENT_TYPE.SS:
            return LocalizeUtil.getLocalizedTextFromApplicationResources(
                    "admin.actions.importMSProject.opt.startToStart", locale);
        case PREDECESSOR_ELEMENT_TYPE.FF:
            return LocalizeUtil.getLocalizedTextFromApplicationResources(
                    "admin.actions.importMSProject.opt.finishToFinish", locale);
        case PREDECESSOR_ELEMENT_TYPE.SF:
            return LocalizeUtil.getLocalizedTextFromApplicationResources(
                    "admin.actions.importMSProject.opt.startToFinish", locale);
        }
    }
    return LocalizeUtil.getLocalizedTextFromApplicationResources(
            "admin.actions.importMSProject.opt.finishToStart", locale);
}

From source file:com.modeln.build.ctrl.charts.CMnBuildListChart.java

/**
 * Generate a pie graph representing average test counts for each type of test for 
 * all builds in the list. /*  w  ww. ja  v  a 2  s .c  o m*/
 *
 * @param   builds  List of builds 
 * 
 * @return  Pie graph representing build execution times across all builds 
 */
public static final JFreeChart getAverageTestCountChart(Vector<CMnDbBuildData> builds) {
    JFreeChart chart = null;

    // Collect the average of all test types 
    Hashtable countAvg = new Hashtable();

    DefaultPieDataset dataset = new DefaultPieDataset();
    if ((builds != null) && (builds.size() > 0)) {

        // Collect build metrics for each of the builds in the list 
        Enumeration buildList = builds.elements();
        while (buildList.hasMoreElements()) {
            // Process the build metrics for the current build
            CMnDbBuildData build = (CMnDbBuildData) buildList.nextElement();
            Hashtable testSummary = build.getTestSummary();
            if ((testSummary != null) && (testSummary.size() > 0)) {
                Enumeration keys = testSummary.keys();
                while (keys.hasMoreElements()) {
                    String testType = (String) keys.nextElement();
                    CMnDbTestSummaryData tests = (CMnDbTestSummaryData) testSummary.get(testType);

                    Integer avgValue = null;
                    if (countAvg.containsKey(testType)) {
                        Integer oldAvg = (Integer) countAvg.get(testType);
                        avgValue = oldAvg + tests.getTotalCount();
                    } else {
                        avgValue = tests.getTotalCount();
                    }
                    countAvg.put(testType, avgValue);

                }
            }

        } // while list has elements

        // Populate the data set with the average values for each metric
        Enumeration keys = countAvg.keys();
        while (keys.hasMoreElements()) {
            String key = (String) keys.nextElement();
            Integer total = (Integer) countAvg.get(key);
            Integer avg = new Integer(total.intValue() / builds.size());
            dataset.setValue(key, avg);
        }

    } // if list has elements

    // API: ChartFactory.createPieChart(title, data, legend, tooltips, urls)
    chart = ChartFactory.createPieChart("Avg Test Count by Type", dataset, true, true, false);

    // get a reference to the plot for further customization...
    PiePlot plot = (PiePlot) chart.getPlot();
    chartFormatter.formatTypeChart(plot, "tests");

    return chart;
}

From source file:com.modeln.build.ctrl.charts.CMnBuildListChart.java

/**
 * Generate a pie graph representing test counts for each product area. 
 *
 * @param   suites   List of test suites
 * @param   areas    List of product areas 
 * /* w  w  w .  ja v  a2 s . c om*/
 * @return  Pie graph representing build execution times across all builds 
 */
public static final JFreeChart getAverageAreaTestCountChart(Vector<CMnDbBuildData> builds,
        Vector<CMnDbTestSuite> suites, Vector<CMnDbFeatureOwnerData> areas) {
    JFreeChart chart = null;

    // Collect the average of all test types 
    Hashtable countAvg = new Hashtable();

    DefaultPieDataset dataset = new DefaultPieDataset();
    if ((suites != null) && (suites.size() > 0)) {

        // Collect test data for each of the suites in the list 
        Enumeration suiteList = suites.elements();
        while (suiteList.hasMoreElements()) {

            // Process the data for the current suite
            CMnDbTestSuite suite = (CMnDbTestSuite) suiteList.nextElement();
            Integer testCount = new Integer(suite.getTestCount());
            CMnDbFeatureOwnerData area = null;

            // Iterate through each product area to determine who owns this suite
            CMnDbFeatureOwnerData currentArea = null;
            Iterator iter = areas.iterator();
            while (iter.hasNext()) {
                currentArea = (CMnDbFeatureOwnerData) iter.next();
                if (currentArea.hasFeature(suite.getGroupName())) {
                    Integer avgValue = null;
                    String areaName = currentArea.getDisplayName();
                    if (countAvg.containsKey(areaName)) {
                        Integer oldAvg = (Integer) countAvg.get(areaName);
                        avgValue = oldAvg + testCount;
                    } else {
                        avgValue = testCount;
                    }
                    countAvg.put(areaName, avgValue);

                }
            }

        } // while list has elements

        // Populate the data set with the average values for each metric
        Enumeration keys = countAvg.keys();
        while (keys.hasMoreElements()) {
            String key = (String) keys.nextElement();
            Integer total = (Integer) countAvg.get(key);
            Integer avg = new Integer(total.intValue() / builds.size());
            dataset.setValue(key, avg);
        }

    } // if list has elements

    // API: ChartFactory.createPieChart(title, data, legend, tooltips, urls)
    chart = ChartFactory.createPieChart("Avg Test Count by Area", dataset, true, true, false);

    // get a reference to the plot for further customization...
    PiePlot plot = (PiePlot) chart.getPlot();
    chartFormatter.formatAreaChart(plot, "tests");

    return chart;
}

From source file:com.aurel.track.linkType.MsProjectLinkType.java

/**
 * Translate the internal link type to the link type expected by Gantt
 * @param linkType/*from ww w. j  a  va2  s. c om*/
 * @return
 */
private static int decodeLinkTypeForGantt(Integer linkType) {
    int ganttDependencyType = 2;
    if (linkType != null) {
        switch (linkType.intValue()) {
        case PREDECESSOR_ELEMENT_TYPE.FF:
            ganttDependencyType = 3;
            break;
        case PREDECESSOR_ELEMENT_TYPE.FS:
            ganttDependencyType = 2;
            break;
        case PREDECESSOR_ELEMENT_TYPE.SF:
            ganttDependencyType = 1;
            break;
        case PREDECESSOR_ELEMENT_TYPE.SS:
            ganttDependencyType = 0;
            break;
        }
    }
    return ganttDependencyType;
}

From source file:com.aurel.track.admin.projectCopy.ProjectCopyBL.java

public static Integer getProjectStatusActive() {
    List<TSystemStateBean> statusOptions = LookupContainer
            .getSystemStateList(TSystemStateBean.ENTITYFLAGS.PROJECTSTATE);
    for (TSystemStateBean status : statusOptions) {
        Integer projectStatus = status.getStateflag();
        if (projectStatus.intValue() == TSystemStateBean.STATEFLAGS.ACTIVE) {
            return status.getObjectID();
        }//ww w.ja  v a 2  s  .co m
    }
    return null;
}

From source file:com.aurel.track.linkType.MsProjectLinkType.java

/**
 * Translate the internal link type to the link type expected by Gantt
 * @param linkType//from w  ww . j  a v  a 2s . c  om
 * @return
 */
private static int encodeLinkTypeFromGantt(Integer linkType) {
    int dependencyType = PREDECESSOR_ELEMENT_TYPE.FS;
    if (linkType != null) {
        switch (linkType.intValue()) {
        case 3:
            dependencyType = PREDECESSOR_ELEMENT_TYPE.FF;
            break;
        case 2:
            dependencyType = PREDECESSOR_ELEMENT_TYPE.FS;
            break;
        case 1:
            dependencyType = PREDECESSOR_ELEMENT_TYPE.SF;
            break;
        case 0:
            dependencyType = PREDECESSOR_ELEMENT_TYPE.SS;
            break;
        }
    }
    return dependencyType;
}