Top Description Fields Constructors Methods
org.python.core.util

public Class StringCounter

extends Object
Class Inheritance
Imports
java.io.PrintStream, java.util.ArrayList, .HashMap, .LinkedHashMap, .Map

Not for application use, this class may be used to count how many times a String occurs a point in the runtime. We use this to investigate optimisations of the handling of strings in the runtime, principally to avoid checks for byte-nature where that is already known.

Field Summary

Modifier and TypeField and Description
private static HashMap<String, Integer>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public synchronized void
count(String
to count
s
)

Count this occurrence.

public synchronized Map<String, Integer>

Returns:

counts of the top n strings.
top
(int
number of counts to retrieve
n
)

Report the top n counts.

public void
top(int n, PrintStream out)

Report the top n counts.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

countsback to summary
private static HashMap<String, Integer> counts

Constructor Detail

StringCounterback to summary
public StringCounter()

Method Detail

countback to summary
public synchronized void count(String s)

Count this occurrence.

Parameters
s:String

to count

topback to summary
public synchronized Map<String, Integer> top(int n)

Report the top n counts.

Parameters
n:int

number of counts to retrieve

Returns:Map<String, Integer>

counts of the top n strings.

topback to summary
public void top(int n, PrintStream out)

Report the top n counts.