Example usage for java.util TreeMap TreeMap

List of usage examples for java.util TreeMap TreeMap

Introduction

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

Prototype

public TreeMap() 

Source Link

Document

Constructs a new, empty tree map, using the natural ordering of its keys.

Usage

From source file:com.espertech.esper.epl.metric.MetricScheduleService.java

/**
 * Constructor.
 */
public MetricScheduleService() {
    this.timeHandleMap = new TreeMap<Long, List<MetricExec>>();
}

From source file:psiprobe.controllers.threads.ListThreadsController.java

@Override
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response)
        throws Exception {

    /*//  ww  w . j a  v  a 2 s  .  c  om
     * Create a list of webapp classloaders. This will help us to associate threads with
     * applications.
     */
    List<Context> contexts = getContainerWrapper().getTomcatContainer().findContexts();
    Map<String, String> classLoaderMap = new TreeMap<>();
    for (Context context : contexts) {
        if (context.getLoader() != null && context.getLoader().getClassLoader() != null) {
            classLoaderMap.put(toUid(context.getLoader().getClassLoader()), context.getName());
        }
    }

    return new ModelAndView(getViewName(), "threads", enumerateThreads(classLoaderMap));
}

From source file:eu.trentorise.smartcampus.unidataservice.listener.Subscriber.java

public Subscriber(ServiceBusClient client) {
    try {/*from w ww .  ja  v a 2  s. com*/
        System.out.println("SUBSCRIBE");
        Map<String, Object> params = new TreeMap<String, Object>();
        client.subscribeService(OPERA, GET_MENU, params);
        client.subscribeService(OPERA, GET_APERTURE, params);
    } catch (InvocationException e) {
        logger.error("Failed to subscribe for service events: " + e.getMessage());
    }
}

From source file:net.dv8tion.discord.commands.HelpCommand.java

public HelpCommand() {
    commands = new TreeMap<>();
}

From source file:ddf.catalog.transformer.html.models.HtmlCategoryModel.java

public HtmlCategoryModel(String title, List<String> attributes) {
    this.title = title;
    this.attributes = attributes;
    this.attributeMappings = new TreeMap<>();
}

From source file:org.ambraproject.admin.service.impl.CacheServiceImpl.java

/**
 * get cache stats data for display by manageCaches.ftl
 *
 * @return SortedMap of strings//from   w  ww  . j  av  a  2s .  c  o  m
 */
public SortedMap<String, String[]> getCacheData() {
    SortedMap<String, String[]> cacheStats = new TreeMap<String, String[]>();
    // header row
    cacheStats.put("", new String[] { "Size #/Objects", "Hits (Memory/Disk)", "Misses", "Eternal (TTI/TTL)",
            "Disk Overflow/Persistent", });

    final String[] cacheNames = cacheManager.getCacheNames();
    for (final String displayName : cacheNames) {
        final Ehcache cache = cacheManager.getEhcache(displayName);
        final Statistics statistics = cache.getStatistics();
        cacheStats.put(displayName, new String[] {
                String.valueOf(cache.getSize()) + " / " + String.valueOf(statistics.getObjectCount()),
                String.valueOf(statistics.getCacheHits()) + " ( " + String.valueOf(statistics.getInMemoryHits())
                        + " / " + String.valueOf(statistics.getOnDiskHits()) + " )",
                String.valueOf(statistics.getCacheMisses()),
                String.valueOf(cache.getCacheConfiguration().isEternal()) + " ( "
                        + String.valueOf(cache.getCacheConfiguration().getTimeToIdleSeconds()) + " / "
                        + String.valueOf(cache.getCacheConfiguration().getTimeToLiveSeconds()) + " )",
                String.valueOf(cache.getCacheConfiguration().isOverflowToDisk()) + " / "
                        + String.valueOf(cache.getCacheConfiguration().isDiskPersistent()) });
    }

    return cacheStats;
}

From source file:jhttpp2.Jhttpp2Launcher.java

public Jhttpp2Launcher() {
    server = new Jhttpp2Server(true);
    server.setServerProperties(loadServerProperties());
    restoreSettings();/*from w w  w  . j  av a 2s.  co m*/
    server.setSettingsSaver(this);
    SortedMap<String, URL> hostRedirects = new TreeMap<String, URL>();
    try {
        hostRedirects.put("redirect.me.com", new URL("http://localhost:80/"));
    } catch (MalformedURLException e) {
        e.printStackTrace();
    }
    server.setHostRedirects(hostRedirects);
    server.init();
    if (Jhttpp2Server.error) {
        System.out.println("Error: " + Jhttpp2Server.error_msg);
    } else {
        new Thread(server).start();
        log.info("Running on port " + server.port);
    }
}

From source file:com.itemanalysis.psychometrics.statistics.TwoWayTable.java

public TwoWayTable() {
    tableRows = new TreeMap<Comparable<?>, Frequency>();
    colMargin = new Frequency();
    rowMargin = new Frequency();
}

From source file:com.adito.core.CoreJAASConfiguration.java

/**
 * Constructor/*from   www.ja  v a 2 s  .c o m*/
 */
public CoreJAASConfiguration() {
    super();
    entries = new TreeMap();
    Configuration.setConfiguration(this);
}

From source file:com.webcohesion.ofx4j.io.tagsoup.TestTagSoupOFXReader.java

/**
 * tests using sax to parse an OFX doc./* w  w w  .  jav  a  2  s. c o  m*/
 */
public void testVersion1() throws Exception {
    TagSoupOFXReader reader = new TagSoupOFXReader();
    final Map<String, String> headers = new HashMap<String, String>();
    final Stack<Map<String, Object>> aggregateStack = new Stack<Map<String, Object>>();
    TreeMap<String, Object> root = new TreeMap<String, Object>();
    aggregateStack.push(root);

    reader.setContentHandler(new DefaultHandler() {

        @Override
        public void onHeader(String name, String value) {
            LOG.debug(name + ":" + value);
            headers.put(name, value);
        }

        @Override
        public void onElement(String name, String value) {
            char[] tabs = new char[aggregateStack.size() * 2];
            Arrays.fill(tabs, ' ');
            LOG.debug(new String(tabs) + name + "=" + value);

            aggregateStack.peek().put(name, value);
        }

        @Override
        public void startAggregate(String aggregateName) {
            char[] tabs = new char[aggregateStack.size() * 2];
            Arrays.fill(tabs, ' ');
            LOG.debug(new String(tabs) + aggregateName + " {");

            TreeMap<String, Object> aggregate = new TreeMap<String, Object>();
            aggregateStack.peek().put(aggregateName, aggregate);
            aggregateStack.push(aggregate);
        }

        @Override
        public void endAggregate(String aggregateName) {
            aggregateStack.pop();

            char[] tabs = new char[aggregateStack.size() * 2];
            Arrays.fill(tabs, ' ');
            LOG.debug(new String(tabs) + "}");
        }
    });
    reader.parse(TestNanoXMLOFXReader.class.getResourceAsStream("example-response.ofx"));
    assertEquals(9, headers.size());
    assertEquals(1, aggregateStack.size());
    assertSame(root, aggregateStack.pop());
}