Return-Path: Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: (qmail 71289 invoked from network); 15 Jan 2011 13:02:13 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 15 Jan 2011 13:02:13 -0000 Received: (qmail 59815 invoked by uid 500); 15 Jan 2011 13:02:13 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 59333 invoked by uid 500); 15 Jan 2011 13:02:09 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 59308 invoked by uid 99); 15 Jan 2011 13:02:07 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 15 Jan 2011 13:02:07 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.22] (HELO thor.apache.org) (140.211.11.22) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 15 Jan 2011 13:02:07 +0000 Received: from thor (localhost [127.0.0.1]) by thor.apache.org (8.13.8+Sun/8.13.8) with ESMTP id p0FD1keu004028 for ; Sat, 15 Jan 2011 13:01:46 GMT Message-ID: <5685322.385831295096506659.JavaMail.jira@thor> Date: Sat, 15 Jan 2011 08:01:46 -0500 (EST) From: "Dan Checkoway (JIRA)" To: issues@commons.apache.org Subject: [jira] Updated: (MATH-473) Frequency: new option: NON-sorted In-Reply-To: <18502181.336071294895085449.JavaMail.jira@thor> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/MATH-473?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Dan Checkoway updated MATH-473: ------------------------------- Attachment: MATH-473.patch Attached is a patch with a first stab at decoupled interface + impl. I left Frequency completely backward compatible, but there are now a few layers: - Distribution -- this is the base interface that defines a distribution of per-key counts - AbstractDistribution -- simple base class that provides tracking counts in a map (supplied by the subclass at construction) - AbstractFrequency -- adds the getPct functionality and a simple toString - Frequency -- as it was, uses TreeMap, ensures Comparable, promotes primitives to Long, provides "cumulative" functions, etc. - SimpleFrequency -- uses a simple HashMap, provides no "cumulative" functions It passes all existing tests. Please code review and integrate however you see fit. Thanks! > Frequency: new option: NON-sorted > --------------------------------- > > Key: MATH-473 > URL: https://issues.apache.org/jira/browse/MATH-473 > Project: Commons Math > Issue Type: Improvement > Affects Versions: 1.0, 1.1, 1.2, 2.0, 2.1 > Reporter: Dan Checkoway > Fix For: 3.0 > > Attachments: MATH-473.patch > > > I have a request for enhancement on org.apache.commons.math.stat.Frequency. I would like to be able to specify that the the backing map NOT be sorted. Right now it uses TreeMap. I would like to have the option of specifying that sorting is not important, and would in fact hinder performance, and a plain old HashMap should be used instead. > i.e. constructor such as: > public Frequency(boolean sorted); > If sorted is true, use a TreeMap. If sorted is false, use a HashMap. Is this feasible? I'd be happy to contribute a patch if that would help. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.