Example usage for java.lang Double intValue

List of usage examples for java.lang Double intValue

Introduction

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

Prototype

public int intValue() 

Source Link

Document

Returns the value of this Double as an int after a narrowing primitive conversion.

Usage

From source file:org.springfield.mojo.linkedtv.Episode.java

public Episode(String mediaResourceId) {
    this.mediaResourceId = mediaResourceId;

    // try reading it from disk
    String readpath = "/springfield/lisa/data/linkedtv/" + mediaResourceId + "/episode.xml";
    System.out.println("READPATH=" + readpath);
    String body = readFile(readpath);
    if (body == null) {
        //Ask Maggie for some details
        Response response = HttpHelper.sendRequest("GET", MAGGIE + "&id=" + mediaResourceId);
        //System.out.println("BART2="+response.toString());
        if (response.getStatusCode() == 200) {
            body = response.getResponse();
        } else {/*from  w w  w  .  ja  v  a  2 s. c o  m*/
            System.out.println("Statuscode = " + response.getStatusCode());
        }

    } else {
        System.out.println("READING FROM LISA DISK CACHE " + readpath);
    }
    try {
        Document doc = DocumentHelper.parseText(body);

        title = doc.selectSingleNode("//properties/presentationtitle") == null ? ""
                : doc.selectSingleNode("//properties/presentationtitle").getText();
        baseLocator = doc.selectSingleNode("//locator/@href") == null ? ""
                : doc.selectSingleNode("//locator/@href").getText();
        presentationId = doc.selectSingleNode("//properties/presentation") == null ? ""
                : doc.selectSingleNode("//properties/presentation").getText();

        //Ask video for some details
        if (baseLocator.indexOf("/domain/") != -1) {
            String videoLocation = baseLocator.substring(baseLocator.indexOf("/domain/"));

            try {
                Response r = HttpHelper.sendRequest("GET", BART + videoLocation);
                System.out.println("BARTVIDEO=" + r.getResponse());
                Document d = DocumentHelper.parseText(r.toString());

                Double dur = d.selectSingleNode("//rawvideo[@id='1']/properties/duration") == null ? -1.0
                        : Double.parseDouble(
                                d.selectSingleNode("//rawvideo[@id='1']/properties/duration").getText());
                dur = dur < 0.0 ? -1.0 : dur * 1000;
                duration = dur.intValue();
                System.out.println("D=" + duration);
                stillsUri = d.selectSingleNode("//screens[@id='1']/properties/uri") == null ? null
                        : d.selectSingleNode("//screens[@id='1']/properties/uri").getText();
                System.out.println("S=" + stillsUri);
                width = d.selectSingleNode("//rawvideo[@id='1']/properties/width") == null ? -1
                        : Integer
                                .parseInt(d.selectSingleNode("//rawvideo[@id='1']/properties/width").getText());
                height = d.selectSingleNode("//rawvideo[@id='1']/properties/height") == null ? -1
                        : Integer.parseInt(
                                d.selectSingleNode("//rawvideo[@id='1']/properties/height").getText());
                System.out.println("W=" + width + " H=" + height);
            } catch (Exception e) {
                duration = 1730470;
                stillsUri = "http://images1.noterik.com/domain/linkedtv/user/rbb/video/1633/shots/1";
                width = 512;
                height = 288;
            }
        }
    } catch (DocumentException e) {
        System.out.println("What? " + e.getMessage());
    }
}

From source file:com.softwarementors.extjs.djn.router.processor.standard.json.JsonRequestProcessor.java

private void getDirectOptions(JsonRequestData request) {
    @SuppressWarnings("unchecked")
    Map<String, Object> directOptions = (Map<String, Object>) toSimpleJavaType(request.getJsonDirectOptions());

    DirectOptions.setOptions(directOptions);

    Double d = (Double) DirectOptions.getOption("start");
    if (d != null)
        DirectOptions.setOption("start", new Integer(d.intValue()));
    d = (Double) DirectOptions.getOption("limit");
    if (d != null)
        DirectOptions.setOption("limit", new Integer(d.intValue()));
    d = (Double) DirectOptions.getOption("page");
    if (d != null)
        DirectOptions.setOption("page", new Integer(d.intValue()));
}

From source file:regresiones.EstadisticaDescriptiva.java

public Integer Intervalo() {

    //intervalo = floor(1+3.3*LOG(N));
    N = datos.length;//from   w  ww  .j a  v  a 2s  . co m
    Double tres = 3.3;
    Double M = 0.0;
    Double logaN = 0.0;

    logaN = log10(N);
    M = floor(1 + (tres * logaN));

    //System.out.println("-N- = " + N);
    //System.out.println("Log" + logaN);
    //   System.out.println("intervalos " + M);
    return M.intValue();
}

From source file:edu.berkeley.boinc.PrefsFragment.java

private void setupSliderDialog(PrefsListItemWrapper item, final Dialog dialog) {
    final PrefsListItemWrapperValue valueWrapper = (PrefsListItemWrapperValue) item;
    dialog.setContentView(R.layout.prefs_layout_dialog_pct);
    TextView sliderProgress = (TextView) dialog.findViewById(R.id.seekbar_status);
    SeekBar slider = (SeekBar) dialog.findViewById(R.id.seekbar);

    if (valueWrapper.ID == R.string.battery_charge_min_pct_header
            || valueWrapper.ID == R.string.prefs_disk_max_pct_header
            || valueWrapper.ID == R.string.prefs_cpu_time_max_header
            || valueWrapper.ID == R.string.prefs_cpu_other_load_suspension_header
            || valueWrapper.ID == R.string.prefs_memory_max_idle_header) {
        Double seekBarDefault = valueWrapper.status / 10;
        slider.setProgress(seekBarDefault.intValue());
        final SeekBar.OnSeekBarChangeListener onSeekBarChangeListener;
        slider.setOnSeekBarChangeListener(onSeekBarChangeListener = new SeekBar.OnSeekBarChangeListener() {
            public void onProgressChanged(final SeekBar seekBar, final int progress, final boolean fromUser) {
                final String progressString = NumberFormat.getPercentInstance().format(progress / 10.0);
                TextView sliderProgress = (TextView) dialog.findViewById(R.id.seekbar_status);
                sliderProgress.setText(progressString);
            }//from w w  w. j a v a 2 s  . c  om

            @Override
            public void onStartTrackingTouch(SeekBar seekBar) {
            }

            @Override
            public void onStopTrackingTouch(SeekBar seekBar) {
            }
        });
        onSeekBarChangeListener.onProgressChanged(slider, seekBarDefault.intValue(), false);
    } else if (valueWrapper.ID == R.string.prefs_cpu_number_cpus_header) {
        if (!getHostInfo()) {
            if (Logging.WARNING)
                Log.w(Logging.TAG, "onItemClick missing hostInfo");
            return;
        }
        slider.setMax(hostinfo.p_ncpus <= 1 ? 0 : hostinfo.p_ncpus - 1);
        final int statusValue;
        slider.setProgress((statusValue = valueWrapper.status.intValue()) <= 0 ? 0
                : statusValue - 1 > slider.getMax() ? slider.getMax() : statusValue - 1);
        Log.d(Logging.TAG, String.format("statusValue == %,d", statusValue));
        final SeekBar.OnSeekBarChangeListener onSeekBarChangeListener;
        slider.setOnSeekBarChangeListener(onSeekBarChangeListener = new SeekBar.OnSeekBarChangeListener() {
            public void onProgressChanged(final SeekBar seekBar, final int progress, final boolean fromUser) {
                final String progressString = NumberFormat.getIntegerInstance()
                        .format(progress <= 0 ? 1 : progress + 1); // do not allow 0 cpus
                TextView sliderProgress = (TextView) dialog.findViewById(R.id.seekbar_status);
                sliderProgress.setText(progressString);
            }

            @Override
            public void onStartTrackingTouch(SeekBar seekBar) {
            }

            @Override
            public void onStopTrackingTouch(SeekBar seekBar) {
            }
        });
        onSeekBarChangeListener.onProgressChanged(slider, statusValue - 1, false);
    } else if (valueWrapper.ID == R.string.prefs_gui_log_level_header) {
        slider.setMax(5);
        slider.setProgress(valueWrapper.status.intValue());
        final SeekBar.OnSeekBarChangeListener onSeekBarChangeListener;
        slider.setOnSeekBarChangeListener(onSeekBarChangeListener = new SeekBar.OnSeekBarChangeListener() {
            public void onProgressChanged(final SeekBar seekBar, final int progress, final boolean fromUser) {
                String progressString = NumberFormat.getIntegerInstance().format(progress);
                TextView sliderProgress = (TextView) dialog.findViewById(R.id.seekbar_status);
                sliderProgress.setText(progressString);
            }

            @Override
            public void onStartTrackingTouch(SeekBar seekBar) {
            }

            @Override
            public void onStopTrackingTouch(SeekBar seekBar) {
            }
        });
        onSeekBarChangeListener.onProgressChanged(slider, valueWrapper.status.intValue(), false);
    }

    setupDialogButtons(item, dialog);
}

From source file:org.polymap.kaps.exporter.VertragGewosExporter.java

private void export(FeatureCollection features, List<String> lines, IProgressMonitor monitor,
        List<String> errors) throws IOException {

    final KapsRepository repo = KapsRepository.instance();

    FeatureIterator it = null;/*from   w w w .  j a  v  a 2  s.c  o m*/

    try {
        // reload the iterator
        it = features.features();
        int count = 0;
        int berichtsjahr = -1;

        int vertraege1 = 0;
        int vertraegeMitKz2 = 0;
        Map<String, Output> zeilen = new HashMap<String, Output>();
        for (int i = 3; i <= 21; i++) {
            zeilen.put(String.valueOf(i), new Output());
        }
        while (it.hasNext()) {
            if (monitor.isCanceled()) {
                throw new OperationCanceledException();
            }
            if ((++count % 100) == 0) {
                monitor.subTask("Objekte: " + count++);
                monitor.worked(100);
            }
            Feature feature = it.next();

            VertragComposite vertrag = repo.findEntity(VertragComposite.class, feature.getIdentifier().getID());
            vertraege1++;
            if (vertrag.fuerAuswertungGeeignet().get()) {
                vertraegeMitKz2++;
            }
            if (berichtsjahr == -1) {
                Date vertragsDatum = vertrag.vertragsDatum().get();
                if (vertragsDatum != null) {
                    Calendar calendar = Calendar.getInstance();
                    calendar.setTime(vertragsDatum);
                    berichtsjahr = calendar.get(Calendar.YEAR);
                }
            }

            VertragsdatenErweitertComposite ew = vertrag.erweiterteVertragsdaten().get();
            Double preis = vertrag.vollpreis().get();
            if (ew != null && ew.bereinigterVollpreis().get() != null) {
                preis = ew.bereinigterVollpreis().get();
            }

            Output current = new Output();
            current.umsatz = preis != null ? preis.intValue() : 0;
            current.anzahl = 1;

            VertragsArtComposite vertragsArtC = vertrag.vertragsArt().get();
            if (vertragsArtC != null) {
                int vertragsArt = Integer.parseInt(vertragsArtC.schl().get());
                if (vertragsArt == 13) {
                    // erbbaurecht
                    current.flaeche = calculateVerkaufteFlaeche(vertrag);
                    zeilen.get("10").add(current);
                } else if (vertragsArt == 2 || vertragsArt == 3) {
                    Set<String> addTo = new HashSet<String>();
                    // mehrere flurstuecke mussen summiert werden
                    for (FlurstueckComposite flurstueck : FlurstueckComposite.Mixin.forEntity(vertrag)) {
                        if (flurstueck != null) {
                            NutzungComposite nutzungC = flurstueck.nutzung().get();
                            int nutzung = nutzungC != null ? Integer.parseInt(nutzungC.schl().get()) : -1;
                            GebaeudeArtComposite gebartC = flurstueck.gebaeudeArt().get();
                            int gebArt = gebartC != null ? Integer.parseInt(gebartC.schl().get()) : -1;

                            double flaeche = 0d;
                            if (((gebArt >= 70 && gebArt <= 203) && nutzung == 29)
                                    || ((gebArt >= 70 && gebArt <= 203) && (nutzung >= 30 && nutzung <= 32))) {
                                calculateVerkaufteFlaecheEigentumswohnung(flurstueck, current);
                            } else {
                                flaeche = calculateVerkaufteFlaeche(flurstueck);
                                current.flaeche += flaeche;
                            }

                            if (gebArt == 0 && nutzung == 16) {
                                addTo.add("3");
                            }
                            if (gebArt == 0 && nutzung == 17) {
                                addTo.add("4");
                            }
                            if (gebArt == 0 && (nutzung == 2 || nutzung == 6 || nutzung == 11)) {
                                addTo.add("5");
                            }
                            if (gebArt == 0 && (nutzung >= 12 && nutzung <= 15)) {
                                addTo.add("6");
                            }
                            if (gebArt == 0 && (nutzung == 7)) {
                                addTo.add("7");
                            }
                            if (gebArt == 0 && (nutzung >= 8 && nutzung <= 10)) {
                                addTo.add("8");
                            }
                            if (gebArt == 0 && (nutzung == 5)) {
                                addTo.add("9");
                            }
                            if ((gebArt == 70 || gebArt == 80) && (nutzung == 1 || nutzung == 16)) {
                                addTo.add("11");
                            }
                            if (((gebArt >= 71 && gebArt <= 73) || (gebArt >= 81 && gebArt <= 83))
                                    && (nutzung == 1 || nutzung == 16)) {
                                addTo.add("12");
                            }
                            if (gebArt >= 70 && gebArt <= 83 && nutzung == 1) {
                                // baujahr check
                                VertragsdatenBaulandComposite vdc = VertragsdatenBaulandComposite.Mixin
                                        .forVertrag(vertrag);
                                if (vdc != null) {
                                    Integer baujahr = vdc.baujahr().get();
                                    if (baujahr != null && baujahr == berichtsjahr) {
                                        addTo.add("13");
                                    }
                                }
                            }
                            if (((gebArt >= 120 && gebArt <= 143) || (gebArt >= 200 && gebArt <= 203))
                                    && (nutzung == 1)) {
                                addTo.add("14");
                            }
                            if ((gebArt == 190 || gebArt == 210) && (nutzung == 3 || nutzung == 4)) {
                                addTo.add("15");
                            }
                            if ((gebArt == 240 || gebArt == 250 || gebArt == 260 || gebArt == 270
                                    || gebArt == 300 || gebArt == 400 || gebArt == 410 || gebArt == 420)
                                    && (nutzung == 3 || nutzung == 4)) {
                                addTo.add("16");
                            }
                            if ((gebArt >= 330 && gebArt <= 370) || (gebArt >= 450 && gebArt <= 890)) {
                                addTo.add("17");
                            }
                            if ((gebArt >= 70 && gebArt <= 203) && nutzung == 29) {
                                addTo.add("18");
                            }
                            if ((gebArt >= 70 && gebArt <= 203) && (nutzung >= 30 && nutzung <= 32)) {
                                addTo.add("19");
                            }
                            if (vertragsArt == 2 && (gebArt >= 70 && gebArt <= 203) && nutzung == 29) {
                                // baujahr check
                                VertragsdatenBaulandComposite vdc = VertragsdatenBaulandComposite.Mixin
                                        .forVertrag(vertrag);
                                if (vdc != null) {
                                    Integer baujahr = vdc.baujahr().get();
                                    if (baujahr != null && baujahr == berichtsjahr) {
                                        addTo.add("20");
                                    }
                                }
                            }
                            if (vertragsArt == 3 && (gebArt >= 70 && gebArt <= 203) && nutzung == 29) {
                                addTo.add("21");
                            }
                        }
                    }
                    //                        if (addTo.isEmpty()) {
                    //                            errors.add( "Vertrag " + EingangsNummerFormatter.format( vertrag.eingangsNr().get() )
                    //                                    + " konnte nicht bercksichtigt werden." );
                    //                        }
                    Set<String> reduced = new HashSet<String>(addTo);
                    // die einzigen 3 die doppelt sein duerfen
                    reduced.remove("13");
                    reduced.remove("20");
                    reduced.remove("21");
                    if (reduced.size() > 1) {
                        errors.add("Vertrag " + EingangsNummerFormatter.format(vertrag.eingangsNr().get())
                                + " enthlt verschiedene Nutzungs- oder Gebudearten.");
                    }
                    // direkt an den 1. setzen
                    for (String key : addTo) {
                        zeilen.get(key).add(current);
                    }
                }
            }
        }

        lines.add(
                new StringBuilder().append("Geschaeftsjahr").append(DELIMITER).append(berichtsjahr).toString());
        lines.add(new StringBuilder().append("Anzahl Grundstuecksvertraege").append(DELIMITER)
                .append(vertraege1).toString());
        lines.add(new StringBuilder().append("Vert. gewoehnlicher Geschaeftsverkehr").append(DELIMITER)
                .append(vertraegeMitKz2).toString());
        lines.add(new StringBuilder().append(DELIMITER).append(DELIMITER).append(DELIMITER).toString());
        lines.add(new StringBuilder().append(DELIMITER).append("Anzahl").append(DELIMITER)
                .append("Flaeche in qm").append(DELIMITER).append("Geldumsatz in EUR").toString());
        lines.add(createLine("1.1 Baureifes Wohnbauland", zeilen, true, true, DELIMITER, 3));
        lines.add(createLine("1.2 Industrie- und Gewerbeland", zeilen, true, true, DELIMITER, 4));
        lines.add(createLine("1.3 Sonstiges Bauland", zeilen, true, true, DELIMITER, 5));
        lines.add(createLine("                Zwischensumme Bauland", zeilen, true, true, DELIMITER, 3, 4, 5));
        lines.add(createLine("1.4 Uebrige Flaeche", zeilen, true, true, DELIMITER, 6, 7, 8, 9));
        lines.add(createLine("        davon Gemeinbedarfsflaechen", zeilen, true, true, DELIMITER, 7));
        lines.add(createLine("        davon Verkehrsflaechen", zeilen, true, true, DELIMITER, 8));
        lines.add(createLine("        davon Agrarland", zeilen, true, true, DELIMITER, 9));
        lines.add(createLine("        davon BWL + RBL", zeilen, true, true, DELIMITER, 6));
        lines.add(createLine("                Summe unbebaute Grundstuecke", zeilen, true, true, DELIMITER, 3,
                4, 5, 6, 7, 8, 9));
        lines.add(createLine("Erbbaurechtsvertraege", zeilen, true, false, DELIMITER, 10));
        lines.add(createLine("2.1 EFH + ZFH", zeilen, false, true, DELIMITER, 11, 12));
        lines.add(createLine("        davon Neubau", zeilen, false, true, DELIMITER, 13));
        lines.add(createLine("        davon RH und DHH", zeilen, false, true, DELIMITER, 12));
        lines.add(createLine("2.2 MFH", zeilen, false, true, DELIMITER, 14));
        lines.add(createLine("2.3 Buero-, Verw.-,GH", zeilen, false, true, DELIMITER, 15));
        lines.add(createLine("2.4 Ind.-, Gewerbeobjekte", zeilen, false, true, DELIMITER, 16));
        lines.add(createLine("2.5 Sonstiges Objekte", zeilen, false, true, DELIMITER, 17));
        lines.add(createLine("                Summe bebaute Grundstuecke", zeilen, false, true, DELIMITER, 11,
                12, 14, 15, 16, 17));
        lines.add(createLine("3. ETW/TE", zeilen, false, true, DELIMITER, 18, 19));
        lines.add(createLine("        davon ETW", zeilen, false, true, DELIMITER, 18));
        lines.add(createLine("Erstverkaeufe aus Neubauten", zeilen, false, true, DELIMITER, 20));
        lines.add(createLine("Wiederverkauf", zeilen, false, true, DELIMITER, 21));
        lines.add(new StringBuilder().append(DELIMITER).append(DELIMITER).append(DELIMITER).toString());

        // TODO
        Output dpw = zeilen.get("20");
        NumberFormat numberFormat = NumberFormatter.getFormatter(2, true);
        lines.add(new StringBuilder().append("Durchschnittspreis in Euro/qm (Erstverkaeufe aus Neubauten)")
                .append(DELIMITER)
                .append(dpw.flaeche > 0.0d ? numberFormat.format(dpw.umsatz / dpw.flaeche) : "").toString());
        lines.add(new StringBuilder().append("Durchschnittsgroesse der WE in qm (Erstverkaeufe aus Neubauten)")
                .append(DELIMITER)
                .append(dpw.anzahl > 0.0d ? numberFormat.format(dpw.flaeche / dpw.anzahl) : "").toString());

    } finally {
        if (it != null) {
            it.close();
        }
    }
}

From source file:com.capitalone.dashboard.client.story.StoryDataClientImpl.java

@SuppressWarnings({ "PMD.ExcessiveMethodLength", "PMD.NPathComplexity" })
private void processFeatureData(Feature feature, Issue issue, Map<String, IssueField> fields) {
    BasicProject project = issue.getProject();
    String status = this.toCanonicalFeatureStatus(issue.getStatus().getName());
    String changeDate = issue.getUpdateDate().toString();

    // sNumber//from  www . j  a v a 2s .c  o m
    feature.setsNumber(TOOLS.sanitizeResponse(issue.getKey()));

    // sName
    feature.setsName(TOOLS.sanitizeResponse(issue.getSummary()));

    // sStatus
    feature.setsStatus(TOOLS.sanitizeResponse(status));

    // sState
    feature.setsState(TOOLS.sanitizeResponse(status));

    // sUrl (Example: 'http://my.jira.com/browse/KEY-1001')
    feature.setsUrl(featureSettings.getJiraBaseUrl() + (featureSettings.getJiraBaseUrl()
            .substring(featureSettings.getJiraBaseUrl().length() - 1).equals("/") ? "" : "/") + "browse/"
            + TOOLS.sanitizeResponse(issue.getKey()));

    int originalEstimate = 0;

    // Tasks use timetracking, stories use aggregatetimeoriginalestimate and aggregatetimeestimate
    if (issue.getTimeTracking() != null && issue.getTimeTracking().getOriginalEstimateMinutes() != null) {
        originalEstimate = issue.getTimeTracking().getOriginalEstimateMinutes();
    } else if (fields.get("aggregatetimeoriginalestimate") != null
            && fields.get("aggregatetimeoriginalestimate").getValue() != null) {
        // this value is in seconds
        originalEstimate = ((Integer) fields.get("aggregatetimeoriginalestimate").getValue()) / 60;
    }

    feature.setsEstimateTime(originalEstimate);

    // sStoryPoints
    IssueField storyPointsField = fields.get(featureSettings.getJiraStoryPointsFieldName());
    if (storyPointsField != null && storyPointsField.getValue() != null
            && !TOOLS.sanitizeResponse(storyPointsField.getValue()).isEmpty()) {
        Double value = Double.parseDouble(TOOLS.sanitizeResponse(storyPointsField.getValue()));
        feature.setsEstimate(String.valueOf(value.intValue()));
    } else {
        feature.setsEstimate("0");
    }

    // sChangeDate
    feature.setChangeDate(TOOLS.toCanonicalDate(TOOLS.sanitizeResponse(changeDate)));

    // IsDeleted - does not exist for Jira
    feature.setIsDeleted("False");

    // sProjectID
    feature.setsProjectID(TOOLS.sanitizeResponse(project.getId()));

    // sProjectName
    feature.setsProjectName(TOOLS.sanitizeResponse(project.getName()));

    // sProjectBeginDate - does not exist in Jira
    feature.setsProjectBeginDate("");

    // sProjectEndDate - does not exist in Jira
    feature.setsProjectEndDate("");

    // sProjectChangeDate - does not exist for this asset level in Jira
    feature.setsProjectChangeDate("");

    // sProjectState - does not exist in Jira
    feature.setsProjectState("");

    // sProjectIsDeleted - does not exist in Jira
    feature.setsProjectIsDeleted("False");

    // sProjectPath - does not exist in Jira
    feature.setsProjectPath("");

    IssueField team = fields.get(featureSettings.getJiraTeamFieldName());
    if (team != null && team.getValue() != null && !TOOLS.sanitizeResponse(team.getValue()).isEmpty()) {
        String teamID = TOOLS.sanitizeResponse(team.getValue());

        Team scopeOwner = teamRepository.findByTeamId(teamID);
        // sTeamID
        feature.setsTeamID(teamID);
        if (scopeOwner != null && StringUtils.isNotEmpty(scopeOwner.getName())) {
            // sTeamName
            feature.setsTeamName(TOOLS.sanitizeResponse(scopeOwner.getName()));
        }
    }

    // sTeamChangeDate - not able to retrieve at this asset level from Jira
    feature.setsTeamChangeDate("");

    // sTeamAssetState
    feature.setsTeamAssetState("");

    // sTeamIsDeleted
    feature.setsTeamIsDeleted("False");

    // sOwnersState - does not exist in Jira at this level
    feature.setsOwnersState(Arrays.asList("Active"));

    // sOwnersChangeDate - does not exist in Jira
    feature.setsOwnersChangeDate(TOOLS.toCanonicalList(Collections.<String>emptyList()));

    // sOwnersIsDeleted - does not exist in Jira
    feature.setsOwnersIsDeleted(TOOLS.toCanonicalList(Collections.<String>emptyList()));
}

From source file:com.google.android.apps.santatracker.doodles.tilt.SwimmingFragment.java

private void addBestTimeLine(SwimmingModel level) {
    Double bestDistance = historyManager.getBestDistance(GameType.SWIMMING);
    if (bestDistance != null) {
        level.addActor(new DistanceMarkerActor(bestDistance.intValue(), ColoredRectangleActor.DISTANCE_PR));
    }//from w  ww.  j  av  a  2 s  . c o m
}

From source file:edu.berkeley.boinc.PrefsActivity.java

public void onItemClick(View view) {
    final Dialog dialog = new Dialog(this);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    Object item = view.getTag();/* w  w  w  .j  a v a 2s.  com*/

    if (item instanceof PrefsListItemWrapperValue) {
        final PrefsListItemWrapperValue valueWrapper = (PrefsListItemWrapperValue) item;
        if (Logging.DEBUG)
            Log.d(Logging.TAG, "PrefsActivity onItemClick Value " + valueWrapper.ID);

        if (valueWrapper.isPct) {
            // show dialog with slider
            dialog.setContentView(R.layout.prefs_layout_dialog_pct);
            // setup slider
            TextView sliderProgress = (TextView) dialog.findViewById(R.id.seekbar_status);
            sliderProgress.setText(valueWrapper.status.intValue() + " " + getString(R.string.prefs_unit_pct));
            Double seekBarDefault = valueWrapper.status / 10;
            SeekBar slider = (SeekBar) dialog.findViewById(R.id.seekbar);
            slider.setProgress(seekBarDefault.intValue());
            slider.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
                public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
                    String progressString = (progress * 10) + " " + getString(R.string.prefs_unit_pct);
                    TextView sliderProgress = (TextView) dialog.findViewById(R.id.seekbar_status);
                    sliderProgress.setText(progressString);
                }

                @Override
                public void onStartTrackingTouch(SeekBar seekBar) {
                }

                @Override
                public void onStopTrackingTouch(SeekBar seekBar) {
                }
            });
        } else if (valueWrapper.isNumber) {
            if (!getHostInfo()) {
                if (Logging.WARNING)
                    Log.w(Logging.TAG, "onItemClick missing hostInfo");
                return;
            }

            // show dialog with slider
            dialog.setContentView(R.layout.prefs_layout_dialog_pct);
            TextView sliderProgress = (TextView) dialog.findViewById(R.id.seekbar_status);
            sliderProgress.setText("" + valueWrapper.status.intValue());
            SeekBar slider = (SeekBar) dialog.findViewById(R.id.seekbar);

            // slider setup depending on actual preference
            if (valueWrapper.ID == R.string.prefs_cpu_number_cpus_header) {
                slider.setMax(hostinfo.p_ncpus);
                slider.setProgress(valueWrapper.status.intValue());
                slider.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
                    public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
                        if (progress == 0)
                            progress = 1; // do not allow 0 cpus
                        String progressString = String.valueOf(progress);
                        TextView sliderProgress = (TextView) dialog.findViewById(R.id.seekbar_status);
                        sliderProgress.setText(progressString);
                    }

                    @Override
                    public void onStartTrackingTouch(SeekBar seekBar) {
                    }

                    @Override
                    public void onStopTrackingTouch(SeekBar seekBar) {
                    }
                });
            } else if (valueWrapper.ID == R.string.prefs_gui_log_level_header) {
                slider.setMax(5);
                slider.setProgress(valueWrapper.status.intValue());
                slider.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
                    public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
                        String progressString = String.valueOf(progress);
                        TextView sliderProgress = (TextView) dialog.findViewById(R.id.seekbar_status);
                        sliderProgress.setText(progressString);
                    }

                    @Override
                    public void onStartTrackingTouch(SeekBar seekBar) {
                    }

                    @Override
                    public void onStopTrackingTouch(SeekBar seekBar) {
                    }
                });
            }
        } else {
            // show dialog with edit text
            dialog.setContentView(R.layout.prefs_layout_dialog);
        }
        // show preference name
        ((TextView) dialog.findViewById(R.id.pref)).setText(valueWrapper.ID);

        // setup buttons
        Button confirm = (Button) dialog.findViewById(R.id.confirm);
        confirm.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                double value = 0.0;
                Boolean clientPref = true;
                if (valueWrapper.isPct) {
                    SeekBar slider = (SeekBar) dialog.findViewById(R.id.seekbar);
                    value = slider.getProgress() * 10;
                } else if (valueWrapper.isNumber) {
                    SeekBar slider = (SeekBar) dialog.findViewById(R.id.seekbar);
                    int sbProgress = slider.getProgress();
                    if (valueWrapper.ID == R.string.prefs_cpu_number_cpus_header) {
                        if (sbProgress == 0)
                            sbProgress = 1;
                        value = numberCpuCoresToPct(sbProgress);
                    } else if (valueWrapper.ID == R.string.prefs_gui_log_level_header) {
                        appPrefs.setLogLevel(sbProgress);
                        updateValuePref(valueWrapper.ID, (double) sbProgress);
                        clientPref = false; // avoid writing client prefs via rpc
                        updateLayout();
                    }
                } else {
                    EditText edit = (EditText) dialog.findViewById(R.id.Input);
                    String input = edit.getText().toString();
                    Double valueTmp = parseInputValueToDouble(input);
                    if (valueTmp == null)
                        return;
                    value = valueTmp;
                }
                if (clientPref)
                    writeClientValuePreference(valueWrapper.ID, value);
                dialog.dismiss();
            }
        });
        Button cancel = (Button) dialog.findViewById(R.id.cancel);
        cancel.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                dialog.dismiss();
            }
        });

        dialog.show();

    } else {
        // instance of PrefsListItemWrapper, i.e. client log flags
        PrefsListItemWrapper wrapper = (PrefsListItemWrapper) item;
        if (Logging.DEBUG)
            Log.d(Logging.TAG, "PrefsActivity onItemClick super " + wrapper.ID);

        dialog.setContentView(R.layout.prefs_layout_dialog_selection);
        final ArrayList<ClientLogOption> options = new ArrayList<ClientLogOption>();
        String[] array = getResources().getStringArray(R.array.prefs_client_log_flags);
        for (String option : array)
            options.add(new ClientLogOption(option));
        ListView lv = (ListView) dialog.findViewById(R.id.selection);
        new PrefsLogOptionsListAdapter(this, lv, R.id.selection, options);

        // setup buttons
        Button confirm = (Button) dialog.findViewById(R.id.confirm);
        confirm.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                ArrayList<String> selectedOptions = new ArrayList<String>();
                for (ClientLogOption option : options)
                    if (option.selected)
                        selectedOptions.add(option.name);
                if (Logging.DEBUG)
                    Log.d(Logging.TAG, selectedOptions.size() + " log flags selected");
                new SetCcConfigAsync().execute(formatOptionsToCcConfig(selectedOptions));
                dialog.dismiss();
            }
        });
        Button cancel = (Button) dialog.findViewById(R.id.cancel);
        cancel.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                dialog.dismiss();
            }
        });

        dialog.show();
    }
}

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

/**
 * In Gantt we are handling link lags: day, week, month,
 * This method returns link lag in days.
 * Foe ex: -1) 1 mo link lag is 20 work day.
 *          -2) 1 w link lag is 5 work days
 * @param actualLinkBean/*from w  ww  .  j  a va 2  s .co m*/
 * @param workItemID
 * @return
 */
public static int getLinkLagInDays(TWorkItemLinkBean actualLinkBean, Integer workItemID) {
    Double hoursPerWorkday = MsProjectLinkType.getHoursPerWorkingDayForWorkItem(workItemID);
    Double convertedLinkLag = LinkLagBL.getUILinkLagFromMinutes(actualLinkBean.getLinkLag(),
            actualLinkBean.getLinkLagFormat(), hoursPerWorkday);
    int linkLagInDays = 0;
    Integer actualLinkLagFormat = actualLinkBean.getLinkLagFormat();
    if (actualLinkLagFormat == null) {
        actualLinkLagFormat = MsProjectExchangeDataStoreBean.LAG_FORMAT.d;
    }
    switch (actualLinkLagFormat) {
    case MsProjectExchangeDataStoreBean.LAG_FORMAT.d:
    case MsProjectExchangeDataStoreBean.LAG_FORMAT.ed:
        linkLagInDays = convertedLinkLag.intValue();
        break;
    case MsProjectExchangeDataStoreBean.LAG_FORMAT.mo:
    case MsProjectExchangeDataStoreBean.LAG_FORMAT.emo:
        linkLagInDays = convertedLinkLag.intValue() * 20;
        break;
    case MsProjectExchangeDataStoreBean.LAG_FORMAT.w:
    case MsProjectExchangeDataStoreBean.LAG_FORMAT.ew:
        linkLagInDays = convertedLinkLag.intValue() * 5;
        break;
    }
    return linkLagInDays;
}

From source file:org.mifos.application.importexport.xls.XlsClientsImporter.java

private Integer getCellIntegerValue(final HSSFRow row, final XlsImportConstants xlsImportConstant) {
    final HSSFCell cell = row.getCell(xlsImportConstant.value(), HSSFRow.RETURN_BLANK_AS_NULL);
    if (cell == null) {
        return null;
    } else {/*from   w  w w.  j  a v a2s.  c  om*/
        Double val = cell.getNumericCellValue();
        return val.intValue();
    }
}