Example usage for java.lang Comparable toString

List of usage examples for java.lang Comparable toString

Introduction

In this page you can find the example usage for java.lang Comparable toString.

Prototype

public String toString() 

Source Link

Document

Returns a string representation of the object.

Usage

From source file:Main.java

/**
 * Takes an object of a CPC supported data type and returns its string representation.<br/>
 * In most cases this method will simply call {@link Object#toString()}.<br/>
 * Special handling is implemented for dates.<br/>
 * <br/>//from  w w w . ja  v  a2 s .  c om
 * All return values are properly escaped. 
 * 
 * @param value the value to convert into an XML string value, may be NULL.
 * @return the escaped string value of the given object, empty string if object is NULL.
 */
public static String mapToXMLValue(Comparable<? extends Object> value) {
    if (value == null)
        return "";

    if (value instanceof Date)
        return simpleDateFormat.format((Date) value);

    return escapeData(value.toString());
}

From source file:io.coala.bind.persist.LocalIdDao.java

public static LocalIdDao create(final EntityManager em, final LocalId id) {
    final Comparable<?> value = Objects.requireNonNull(id.unwrap());
    final LocalIdDao parentRef = Objects.requireNonNull(id.parentRef()).parentRef() == null ? null
            : id.parentRef().persist(em);
    final UUID contextRef = Objects.requireNonNull(id.contextRef());

    final LocalIdDao result = new LocalIdDao();
    result.contextRef = contextRef;//from  ww  w.  j  a v a  2 s. com
    result.parentRef = parentRef;
    result.value = value.toString();
    //         em.persist( result );
    return result;
}

From source file:net.sourceforge.jabm.report.CategoryDatasetFrequencyAdaptor.java

public void updateCategories() {
    columnMap = new HashMap<String, Integer>();
    objectMap = new HashMap<String, Comparable<?>>();
    columns = new ArrayList<String>();
    Iterator<Comparable<?>> it = frequency.valuesIterator();
    int i = 0;//from   w ww .  j  av  a2 s .c  o  m
    while (it.hasNext()) {
        Comparable<?> value = it.next();
        objectMap.put(value.toString(), value);
        columns.add(i, value.toString());
        columnMap.put(value.toString(), i);
        i++;
    }
}

From source file:edu.ucla.stat.SOCR.chart.gui.CustomPieSectionLabelGenerator.java

/**
 * Generates a label for a pie section.//www .j av a2  s. co m
 * 
 * @param dataset  the dataset (<code>null</code> not permitted).
 * @param key  the section key (<code>null</code> not permitted).
 * 
 * @return the label (possibly <code>null</code>).
 */
public String generateSectionLabel(PieDataset dataset, Comparable key) {
    String result = null;
    if (dataset != null) {
        if (!key.equals("PHP")) {
            result = key.toString();
        }
    }
    return result;
}

From source file:unikn.dbis.univis.visualization.chart.LabelGenerator.java

/**
 * Makes a own legend.//from   w ww  .  j av a 2 s  .  co  m
 *
 * @param dataset
 * @param series
 * @return String for nice legend.
 */
public String generateLabel(CategoryDataset dataset, int series) {
    Integer value = dataset.getValue(series, 0).intValue();
    Comparable name = dataset.getRowKey(series);
    Double percent = ((full / total) * value);

    return name.toString() + " = " + value.toString() + " -> " + decimalFormat.format(percent) + "%";
}

From source file:unikn.dbis.univis.visualization.chart.LabelGenerator.java

/**
 * Generates a label for a pie section./*from w  w w .  j a v a2s  .c  o m*/
 *
 * @param dataset the dataset (<code>null</code> not permitted).
 * @param key     the section key (<code>null</code> not permitted).
 * @return The label (possibly <code>null</code>).
 */
public String generateSectionLabel(PieDataset dataset, Comparable key) {
    Integer value = dataset.getValue(key).intValue();
    Comparable name = dataset.getKey(dataset.getIndex(key));
    Double percent = ((full / total) * value);

    return name.toString() + " = " + value.toString() + " -> " + decimalFormat.format(percent) + "%";
}

From source file:com.bdaum.zoom.report.internal.jfree.custom.SparseCategoryAxis.java

@Override
protected TextBlock createLabel(@SuppressWarnings("rawtypes") Comparable category, float width,
        RectangleEdge edge, Graphics2D g2) {
    return TextUtilities.createTextBlock(category.toString(), getTickLabelFont(category),
            getTickLabelPaint(category), width * nth, 1, new G2TextMeasurer(g2));
}

From source file:com.graphhopper.jsprit.core.util.UnassignedJobReasonTracker.java

private String getMostLikely(Frequency reasons) {
    Iterator<Map.Entry<Comparable<?>, Long>> entryIterator = reasons.entrySetIterator();
    int maxCount = 0;
    String mostLikely = null;/*from   ww w .  jav a2 s  .c o  m*/
    while (entryIterator.hasNext()) {
        Map.Entry<Comparable<?>, Long> entry = entryIterator.next();
        if (entry.getValue() > maxCount) {
            Comparable<?> key = entry.getKey();
            mostLikely = key.toString();
        }
    }
    return mostLikely;
}

From source file:com.vaadin.tests.tb3.AbstractTB3Test.java

private static <T> String decorate(String message, Comparable<T> a, T b) {
    message = message.replace("{0}", a.toString());
    message = message.replace("{1}", b.toString());
    return message;
}

From source file:edu.smc.mediacommons.panels.PasswordPanel.java

public String generateSectionLabel(final PieDataset dataset, final Comparable key) {
    String result = null;/*from   www  . jav  a2  s .co  m*/
    if (dataset != null) {
        result = key.toString();
    }
    return result;
}