Example usage for java.util TreeMap values

List of usage examples for java.util TreeMap values

Introduction

In this page you can find the example usage for java.util TreeMap values.

Prototype

public Collection<V> values() 

Source Link

Document

Returns a Collection view of the values contained in this map.

Usage

From source file:com.joliciel.jochre.boundaries.SplitCandidateFinderImpl.java

@Override
public List<Split> findSplitCandidates(Shape shape) {
    List<Split> splitCandidates = new ArrayList<Split>();

    // generate a list giving the total distance from the top and bottom to the shape's edge
    // the hypothesis is that splits almost always occur at x-coordinates
    // where there's a summit in the distance to the shape's edge, between two valleys
    int[] edgeDistances = new int[shape.getWidth()];
    int[][] verticalContour = shape.getVerticalContour();
    for (int x = 0; x < shape.getWidth(); x++) {
        int edgeDistance = verticalContour[x][0] + ((shape.getHeight() - 1) - verticalContour[x][1]);
        if (edgeDistance > shape.getHeight() - 1)
            edgeDistance = shape.getHeight() - 1;

        edgeDistances[x] = edgeDistance;
    }//from ww  w.j av  a  2  s.  c  o m

    int[] maximaMinima = new int[shape.getWidth()];
    int lastDistance = -1;
    boolean rising = true;
    int i = 0;
    for (int edgeDistance : edgeDistances) {
        if (lastDistance >= 0) {
            if (edgeDistance < lastDistance && rising) {
                maximaMinima[i - 1] = 1;
            }
            if (edgeDistance > lastDistance && !rising) {
                maximaMinima[i - 1] = -1;
            }
        }
        if (edgeDistance > lastDistance) {
            rising = true;
        } else if (edgeDistance < lastDistance) {
            rising = false;
        }

        lastDistance = edgeDistance;
        i++;
    }
    maximaMinima[0] = 1;
    if (rising)
        maximaMinima[shape.getWidth() - 1] = 1;
    else
        maximaMinima[shape.getWidth() - 1] = -1;

    for (int x = 0; x < shape.getWidth(); x++) {
        String maxMin = "";
        if (maximaMinima[x] < 0)
            maxMin = " min";
        if (maximaMinima[x] > 0)
            maxMin = " max";
        LOG.trace("edgeDistance[" + x + "]: " + edgeDistances[x] + maxMin);
    }

    boolean haveMinimum = false;
    int lastMaximum = -1;
    int lastMinValue = 0;
    int lastMaxValue = 0;
    TreeSet<SplitCandidateValue> splitCandidateValues = new TreeSet<SplitCandidateFinderImpl.SplitCandidateValue>();
    for (i = 0; i < shape.getWidth(); i++) {
        if (maximaMinima[i] < 0) {
            haveMinimum = true;
            if (lastMaximum > 0) {
                double diff = (double) ((lastMaxValue - lastMinValue) + (lastMaxValue - edgeDistances[i]))
                        / 2.0;
                splitCandidateValues.add(new SplitCandidateValue(lastMaximum, diff));
            }
            lastMinValue = edgeDistances[i];
        }
        if (maximaMinima[i] > 0) {
            if (haveMinimum) {
                lastMaximum = i;
                lastMaxValue = edgeDistances[i];
            }
            haveMinimum = false;
        }
    }

    List<SplitCandidateValue> candidatesToRemove = new ArrayList<SplitCandidateFinderImpl.SplitCandidateValue>();
    for (SplitCandidateValue thisValue : splitCandidateValues) {
        if (candidatesToRemove.contains(thisValue))
            continue;
        for (SplitCandidateValue otherValue : splitCandidateValues) {
            if (candidatesToRemove.contains(otherValue))
                continue;
            if (otherValue.equals(thisValue))
                break;
            int distance = thisValue.getPosition() - otherValue.getPosition();
            if (distance < 0)
                distance = 0 - distance;
            if (distance < this.minDistanceBetweenSplits) {
                LOG.trace("Removing candidate " + otherValue.getPosition() + ", distance=" + distance);
                candidatesToRemove.add(otherValue);
            }
        }
    }
    splitCandidateValues.removeAll(candidatesToRemove);

    TreeMap<Integer, Split> splitCandidateMap = new TreeMap<Integer, Split>();
    for (SplitCandidateValue candidateValue : splitCandidateValues) {
        Split splitCandidate = boundaryServiceInternal.getEmptySplit(shape);
        splitCandidate.setPosition(candidateValue.getPosition());
        splitCandidateMap.put(candidateValue.getPosition(), splitCandidate);
    }

    for (Split split : splitCandidateMap.values())
        splitCandidates.add(split);
    return splitCandidates;
}

From source file:de.vandermeer.skb.interfaces.application.IsApplication.java

/**
 * Prints a help screen for the application, to be used by an executing component.
 *///w w w.ja  va  2 s . co  m
default void appHelpScreen() {
    STGroupFile stg = new STGroupFile("de/vandermeer/skb/interfaces/application/help.stg");
    ST st = stg.getInstanceOf("usage");
    st.add("appName", this.getAppName());
    st.add("appDisplayName", this.getAppDisplayName());
    st.add("appVersion", this.getAppVersion());
    st.add("appDescription", Text_To_FormattedText.left(this.getAppDescription(), this.getConsoleWidth()));
    st.add("required", CliOptionList.getRequired(getCLiALlOptions()));
    for (StrBuilder sb : this.getCliParser().usage(this.getConsoleWidth())) {
        st.add("cliOptions", sb);
    }

    if (this.getEnvironmentOptions().size() > 0) {
        TreeMap<String, Apo_TypedE<?>> map = EnvironmentOptionsList.sortedMap(this.getEnvironmentOptions());
        Map<String, String> envMap = new LinkedHashMap<>();
        int length = 0;
        for (Apo_TypedE<?> te : map.values()) {
            if (te.getEnvironmentKey().length() > length) {
                length = te.getEnvironmentKey().length();
            }
            envMap.put(te.getEnvironmentKey(), te.getDescription());
        }
        length += 2;

        for (Entry<String, String> entry : envMap.entrySet()) {
            StrBuilder argLine = new StrBuilder();
            argLine.append(entry.getKey()).appendPadding(length - argLine.length(), ' ').append("  - ");
            StrBuilder padLine = new StrBuilder();
            padLine.appendPadding(length + 4, ' ');

            Collection<StrBuilder> text = Text_To_FormattedText.left(entry.getValue(),
                    this.getConsoleWidth() - length);
            int i = 0;
            for (StrBuilder b : text) {
                if (i == 0) {
                    st.add("envOptions", argLine + b.build());
                } else {
                    st.add("envOptions", padLine + b.build());
                }
                i++;
            }
        }
    }

    if (this.getPropertyOptions().size() > 0) {
        TreeMap<String, Apo_TypedP<?>> map = PropertyOptionsList.sortedMap(this.getPropertyOptions());
        Map<String, String> envMap = new LinkedHashMap<>();
        int length = 0;
        for (Apo_TypedP<?> te : map.values()) {
            if (te.getPropertyKey().length() > length) {
                length = te.getPropertyKey().length();
            }
            envMap.put(te.getPropertyKey(), te.getDescription());
        }
        length += 2;

        for (Entry<String, String> entry : envMap.entrySet()) {
            StrBuilder argLine = new StrBuilder();
            argLine.append(entry.getKey()).appendPadding(length - argLine.length(), ' ').append("  - ");
            StrBuilder padLine = new StrBuilder();
            padLine.appendPadding(length + 4, ' ');

            Collection<StrBuilder> text = Text_To_FormattedText.left(entry.getValue(),
                    this.getConsoleWidth() - length);
            int i = 0;
            for (StrBuilder b : text) {
                if (i == 0) {
                    st.add("propOptions", argLine + b.build());
                } else {
                    st.add("propOptions", padLine + b.build());
                }
                i++;
            }
        }
    }
    System.out.println(st.render());
}

From source file:ffx.potential.nonbonded.VanDerWaalsForm.java

public VanDerWaalsForm(ForceField forceField) {

    /**/*from   w  w w.j  a v  a 2s . com*/
     * Set-up default rules.
     */
    vdwType = VDW_TYPE.BUFFERED_14_7;
    epsilonRule = EPSILON_RULE.HHG;
    radiusRule = RADIUS_RULE.CUBIC_MEAN;
    radiusSize = RADIUS_SIZE.DIAMETER;
    radiusType = RADIUS_TYPE.R_MIN;

    /**
     * Define functional form.
     */
    String value = forceField.getString(VDWTYPE, vdwType.toString());
    try {
        vdwType = VDW_TYPE.valueOf(toEnumForm(value));
    } catch (Exception e) {
        logger.info(format(" Unrecognized VDWTYPE %s; defaulting to %s.", value, vdwType));
    }

    switch (vdwType) {
    case BUFFERED_14_7:
        vdwPowers = new Buffered_14_7();
        break;
    case LENNARD_JONES:
        vdwPowers = new LJ_6_12();
        break;
    default:
        vdwPowers = new VDWPowers();
        break;
    }

    /**
     * Define epsilon combining rule.
     */
    value = forceField.getString(EPSILONRULE, epsilonRule.toString());
    try {
        epsilonRule = EPSILON_RULE.valueOf(toEnumForm(value));
    } catch (Exception e) {
        logger.info(format(" Unrecognized EPSILONRULE %s; defaulting to %s.", value, epsilonRule));
    }

    /**
     * Define radius combining rule.
     */
    value = forceField.getString(RADIUSRULE, radiusRule.toString());
    try {
        radiusRule = RADIUS_RULE.valueOf(toEnumForm(value));
    } catch (Exception e) {
        logger.info(format(" Unrecognized RADIUSRULE %s; defaulting to %s.", value, radiusRule));
    }

    /**
     * Define radius size.
     */
    value = forceField.getString(RADIUSSIZE, radiusSize.toString());
    try {
        radiusSize = RADIUS_SIZE.valueOf(toEnumForm(value));
    } catch (Exception e) {
        logger.info(format(" Unrecognized RADIUSSIZE %s; defaulting to %s.", value, radiusSize));
    }

    /**
     * Define radius type.
     */
    value = forceField.getString(RADIUSTYPE, radiusType.toString());
    try {
        radiusType = RADIUS_TYPE.valueOf(toEnumForm(value));
    } catch (Exception e) {
        logger.info(format(" Unrecognized RADIUSTYPE %s; defaulting to %s", value, radiusType));
    }

    /**
     * Configure van der Waals well shape parameters.
     */
    switch (vdwType) {
    case LENNARD_JONES:
        repulsivePower = 12;
        dispersivePower = 6;
        delta = 0.0;
        gamma = 0.0;
        break;
    case BUFFERED_14_7:
    default:
        repulsivePower = 14;
        dispersivePower = 7;
        delta = 0.07;
        gamma = 0.12;
        break;
    }

    repDispPower = repulsivePower - dispersivePower;
    dispersivePower1 = dispersivePower - 1;
    repDispPower1 = repDispPower - 1;
    delta1 = 1.0 + delta;
    t1n = pow(delta1, dispersivePower);
    gamma1 = 1.0 + gamma;

    scale12 = forceField.getDouble(ForceField.ForceFieldDouble.VDW_12_SCALE, 0.0);
    scale13 = forceField.getDouble(ForceField.ForceFieldDouble.VDW_13_SCALE, 0.0);
    scale14 = forceField.getDouble(ForceField.ForceFieldDouble.VDW_14_SCALE, 1.0);
    scale15 = forceField.getDouble(ForceField.ForceFieldDouble.VDW_15_SCALE, 1.0);

    /**
     * The convention in TINKER is a vdw-14-scale factor of 2.0 means to
     * scale by 0.5.
     */
    if (scale12 > 1.0) {
        scale12 = 1.0 / scale12;
    }
    if (scale13 > 1.0) {
        scale13 = 1.0 / scale13;
    }
    if (scale14 > 1.0) {
        scale14 = 1.0 / scale14;
    }
    if (scale15 != 1.0) {
        logger.severe(" Van Der Waals 1-5 masking rules are not supported.");
    }

    Map<String, VDWType> map = forceField.getVDWTypes();
    TreeMap<String, VDWType> vdwTypes = new TreeMap<>(map);
    maxClass = 0;
    for (VDWType currentType : vdwTypes.values()) {
        if (currentType.atomClass > maxClass) {
            maxClass = currentType.atomClass;
        }
    }
    radEps = new double[maxClass + 1][2 * (maxClass + 1)];

    /**
     * Scale factor to convert to vdW size to Rmin.
     */
    double radScale;
    switch (radiusSize) {
    case DIAMETER:
        radScale = 0.5;
        break;
    case RADIUS:
    default:
        radScale = 1.0;
        break;
    }
    switch (radiusType) {
    case SIGMA:
        radScale *= 1.122462048309372981;
        break;
    case R_MIN:
    default:
        break;

    }

    /**
     * Atom Class numbering starts at 1.
     */
    for (VDWType vdwi : vdwTypes.values()) {
        int i = vdwi.atomClass;
        double ri = radScale * vdwi.radius;
        double ri2 = ri * ri;
        double ri3 = ri * ri2;
        double e1 = vdwi.wellDepth;
        double se1 = sqrt(e1);
        for (VDWType vdwj : vdwTypes.tailMap(vdwi.getKey()).values()) {
            int j = vdwj.atomClass;
            double rj = radScale * vdwj.radius;
            double rj2 = rj * rj;
            double rj3 = rj * rj2;
            double e2 = vdwj.wellDepth;
            double se2 = sqrt(e2);
            double radmin;
            double eps;
            switch (radiusRule) {
            case ARITHMETIC:
                radmin = ri + rj;
                break;
            case GEOMETRIC:
                radmin = 2.0 * sqrt(ri) * sqrt(rj);
                break;
            default:
            case CUBIC_MEAN:
                radmin = 2.0 * (ri3 + rj3) / (ri2 + rj2);
            }
            switch (epsilonRule) {
            case GEOMETRIC:
                eps = se1 * se2;
                break;
            default:
            case HHG:
                eps = 4.0 * (e1 * e2) / ((se1 + se2) * (se1 + se2));
                break;
            }
            if (radmin > 0) {
                radEps[i][j * 2 + RADMIN] = 1.0 / radmin;
            } else {
                radEps[i][j * 2 + RADMIN] = 0.0;
            }

            radEps[i][j * 2 + EPS] = eps;
            if (radmin > 0) {
                radEps[j][i * 2 + RADMIN] = 1.0 / radmin;
            } else {
                radEps[j][i * 2 + RADMIN] = 0.0;
            }
            radEps[j][i * 2 + EPS] = eps;
        }
    }

}

From source file:com.almende.dht.Bucket.java

/**
 * Gets the closest nodes./*  ww w  .  j  a  va2s .  co m*/
 *
 * @param near
 *            the near
 * @param limit
 *            the limit
 * @param filter
 *            the filter
 * @return the closest nodes
 */
public List<Node> getClosestNodes(final Key near, final int limit, final Collection<Key> filter) {
    synchronized (nodes) {
        final TreeMap<Key, Node> distMap = new TreeMap<Key, Node>();
        final Iterator<Entry<Key, Node>> iter = nodes.entrySet().iterator();
        while (iter.hasNext()) {
            Entry<Key, Node> entry = iter.next();
            if (filter != null && filter.contains(entry.getKey())) {
                continue;
            }
            distMap.put(near.dist(entry.getKey()), entry.getValue());
        }
        final Node[] values = distMap.values().toArray(new Node[0]);
        return Arrays.asList(Arrays.copyOf(values, Math.min(limit, distMap.size())));
    }
}

From source file:edu.utexas.cs.tactex.subscriptionspredictors.LWRCustOldAppache.java

/**
 * @param candidateEval/* w  w w .ja  va  2s  .c  o m*/
 * @param e2n
 * @return
 */
@Override
public Double predictNumSubs(double candidateEval, TreeMap<Double, Double> e2n, CustomerInfo customer,
        int timeslot) {
    // tree map guarantees that keys are unique
    // so we are suppose to be able to run LWR
    // if there are at least 3 entries (even 2)

    // LWR, run n-fold cross validation with different bandwidth

    double min = e2n.firstKey();
    double max = e2n.lastKey();
    ArrayRealVector xVec = createNormalizedXVector(e2n.keySet(), min, max);
    ArrayRealVector yVec = createYVector(e2n.values());

    double bestTau = Double.MAX_VALUE;
    double bestMSE = Double.MAX_VALUE;

    ArrayList<Double> candidateTaus = new ArrayList<Double>();
    //candidateTaus.add(0.025 * SQUEEZE);
    candidateTaus.add(0.05);// * SQUEEZE);
    candidateTaus.add(0.1);// * SQUEEZE);
    candidateTaus.add(0.2);// * SQUEEZE);
    candidateTaus.add(0.3);// * SQUEEZE);
    candidateTaus.add(0.4);// * SQUEEZE);
    candidateTaus.add(0.5);// * SQUEEZE);
    candidateTaus.add(0.6);// * SQUEEZE);
    candidateTaus.add(0.7);// * SQUEEZE);
    candidateTaus.add(0.8);// * SQUEEZE);
    candidateTaus.add(0.9);// * SQUEEZE);
    candidateTaus.add(1.0);// * SQUEEZE);
    for (Double tau : candidateTaus) {
        Double mse = CrossValidationError(tau, xVec, yVec);
        if (null == mse) {
            log.error(" cp cross-validation failed, return null");
            return null;
        }
        if (mse < bestMSE) {
            bestMSE = mse;
            bestTau = tau;
        }
    }
    log.info(" cp LWR bestTau " + bestTau);
    double x0 = candidateEval;
    Double prediction = LWRPredict(xVec, yVec, normalizeX(x0, min, max), bestTau);
    if (null == prediction) {
        log.error("LWR passed CV but cannot predict on new point. falling back to interpolateOrNN()");
        log.error("e2n: " + e2n.toString());
        log.error("candidateEval " + candidateEval);
        return null;
    }
    // cast to int, and cannot be negative
    return Math.max(0, (double) (int) (double) prediction);
}

From source file:flex.messaging.services.http.proxy.RequestFilter.java

/**
 * Before calling the endpoint, set up the cookies found in the request.
 * @param context the context//from  www . j a va2  s.c om
 */
public static void copyCookiesToEndpoint(ProxyContext context) {
    HttpServletRequest clientRequest = FlexContext.getHttpRequest();
    context.clearRequestCookies();
    if (clientRequest != null) {
        javax.servlet.http.Cookie[] cookies = clientRequest.getCookies();
        HttpState initState = context.getHttpClient().getState();

        if (cookies != null) {
            // Gather up the cookies keyed on the length of the path.
            // This is done so that if we have two cookies with the same name,
            // we pass the cookie with the longest path first to the endpoint
            TreeMap cookieMap = new TreeMap();
            for (javax.servlet.http.Cookie cookie : cookies) {
                CookieInfo origCookie = new CookieInfo(cookie.getName(), cookie.getDomain(), cookie.getName(),
                        cookie.getValue(), cookie.getPath(), cookie.getMaxAge(), null, cookie.getSecure());
                CookieInfo newCookie = RequestUtil.createCookie(origCookie, context,
                        context.getTarget().getUrl().getHost(), context.getTarget().getUrl().getPath());

                if (newCookie != null) {
                    Integer pathInt = Integer.valueOf(0 - newCookie.path.length());
                    ArrayList list = (ArrayList) cookieMap.get(pathInt);
                    if (list == null) {
                        list = new ArrayList();
                        cookieMap.put(pathInt, list);
                    }
                    list.add(newCookie);
                }
            }

            // loop through (in order) the cookies we've gathered
            for (Object mapValue : cookieMap.values()) {
                ArrayList list = (ArrayList) mapValue;
                for (Object aList : list) {
                    CookieInfo cookieInfo = (CookieInfo) aList;
                    if (Log.isInfo()) {
                        String str = "-- Cookie in request: " + cookieInfo;
                        Log.getLogger(HTTPProxyService.LOG_CATEGORY).debug(str);
                    }

                    Cookie cookie = new Cookie(cookieInfo.domain, cookieInfo.name, cookieInfo.value,
                            cookieInfo.path, cookieInfo.maxAge, cookieInfo.secure);

                    // If this is a session cookie and we're dealing with local domain, make sure the session
                    // cookie has the latest session id. This check is needed when the session was invalidated
                    // and then recreated in this request; we shouldn't be sending the old session id to the endpoint.
                    if (context.isLocalDomain() && STRING_JSESSIONID.equalsIgnoreCase(cookieInfo.clientName)) {
                        FlexSession flexSession = FlexContext.getFlexSession();
                        if (flexSession != null && flexSession.isValid()) {
                            String sessionId = flexSession.getId();
                            String cookieValue = cookie.getValue();
                            if (!cookieValue.contains(sessionId)) {
                                int colonIndex = cookieValue.indexOf(':');
                                if (colonIndex != -1) {
                                    // Websphere changes jsession id to the following format:
                                    // 4 digit cacheId + jsessionId + ":" + cloneId.
                                    ServletContext servletContext = FlexContext.getServletContext();
                                    String serverInfo = servletContext != null ? servletContext.getServerInfo()
                                            : null;
                                    boolean isWebSphere = serverInfo != null
                                            && serverInfo.contains("WebSphere");
                                    if (isWebSphere) {
                                        String cacheId = cookieValue.substring(0, 4);
                                        String cloneId = cookieValue.substring(colonIndex);
                                        String wsSessionId = cacheId + sessionId + cloneId;
                                        cookie.setValue(wsSessionId);
                                    } else {
                                        cookie.setValue(sessionId);
                                    }
                                } else {
                                    cookie.setValue(sessionId);
                                }
                            }
                        }
                    }
                    // finally add the cookie to the current request
                    initState.addCookie(cookie);
                    context.addRequestCookie(cookie);
                }
            }
        }
    }
}

From source file:com.liangc.hq.base.utils.MonitorUtils.java

/**
 * Method findServiceTypes./*w  ww. jav a2  s.  c o m*/
 * 
 * Given a List of services associated with an application or server, 
 * filter through them for the  service types so we can link to showing 
 * selections by type. The returned List has the ServiceTypeValue as 
 * elements.
 * 
 * This should eventually get pushed into the bizapp
 * 
 * @param services
 * @return List
 */
public static List<ServiceTypeValue> findServiceTypes(List services, Boolean internal) {
    TreeMap<String, ServiceTypeValue> serviceTypeSet = new TreeMap<String, ServiceTypeValue>();
    for (Iterator i = services.iterator(); i.hasNext();) {
        AppdefResourceValue svcCandidate = (AppdefResourceValue) i.next();
        final AppdefEntityID aeid = svcCandidate.getEntityId();
        if (aeid.isService() || aeid.isGroup()) {
            AppdefResourceValue service = (AppdefResourceValue) svcCandidate;
            if (service != null && service.getAppdefResourceTypeValue() != null) {
                // if we don't have a group that is a compat group of services, then this
                // better throw a ClassCastException
                ServiceTypeValue svcType = (ServiceTypeValue) service.getAppdefResourceTypeValue();
                if (internal == null) {
                    // if we're not discriminating between internal and deployed, we'll just
                    // return them all
                    serviceTypeSet.put(svcType.getName(), svcType);
                } else if (internal != null && new Boolean(svcType.getIsInternal()).equals(internal)) {
                    serviceTypeSet.put(svcType.getName(), svcType);
                }
            }
        } else {
            throw new IllegalStateException("Did not get a valid service: " + svcCandidate);
        }
    }
    return new ArrayList(serviceTypeSet.values());
}

From source file:de.suse.swamp.core.workflow.WorkflowTemplate.java

/**
 * @return a list of templates that refer to this template as parentworkflow
 *//*from w w  w. j  ava 2 s  . c om*/
public List getSubworkflowTemplates() {
    List templates = new ArrayList();
    HashMap templateMap = WorkflowManager.getInstance().getWorkflowTemplates();
    for (Iterator it = templateMap.values().iterator(); it.hasNext();) {
        TreeMap wfversions = (TreeMap) it.next();
        for (Iterator tempIt = wfversions.values().iterator(); tempIt.hasNext();) {
            WorkflowTemplate temp = (WorkflowTemplate) tempIt.next();
            if (temp.getParentWfName() != null && temp.getParentWfName().equals(this.name)
                    && temp.getParentWfVersion().equals(this.version)) {
                templates.add(temp);
            }
        }
    }

    return templates;
}

From source file:org.cloudata.core.client.Row.java

@Override
public void write(DataOutput out) throws IOException {
    key.write(out);/*from w w w .  java 2s  . c o  m*/

    out.writeInt(cells.size());

    for (Map.Entry<String, TreeMap<Cell.Key, Cell>> entry : cells.entrySet()) {
        String columnName = entry.getKey();
        CWritableUtils.writeString(out, columnName);
        TreeMap<Cell.Key, Cell> columnCells = entry.getValue();

        int columnCellsSize = columnCells == null ? 0 : columnCells.size();
        out.writeInt(columnCellsSize);
        if (columnCellsSize > 0) {
            for (Cell eachCell : columnCells.values()) {
                //System.out.println(columnName + ">" + eachCell.getKey() + ">" + eachCell.getValueAsString());
                eachCell.write(out);
            }
        }
    }
}

From source file:com.urswolfer.intellij.plugin.gerrit.rest.GerritUtil.java

public String getRef(ChangeInfo changeDetails) {
    String ref = null;/*from   www  .j av  a  2  s.c o  m*/
    final TreeMap<String, RevisionInfo> revisions = changeDetails.getRevisions();
    for (RevisionInfo revisionInfo : revisions.values()) {
        final TreeMap<String, FetchInfo> fetch = revisionInfo.getFetch();
        for (FetchInfo fetchInfo : fetch.values()) {
            ref = fetchInfo.getRef();
        }
    }
    return ref;
}