Package bb.util

Provides miscellaneous utility classes and interfaces.

See:
          Description

Interface Summary
MemoryMonitorListener Interface for receiving events from MemoryMonitor.
ObjectState.Filter Interface for types which accept/reject Classes/Fields.
ObjectState.UnitTest.SubInterface2  
ObjectState.UnitTest.SubInterface4  
ObjectState.UnitTest.SuperInterface1  
ObjectState.UnitTest.SuperInterface3  
ThreadMonitorListener Interface for receiving events from ThreadMonitor.
 

Class Summary
ArrayUtil Provides static utility methods that deal with arrays.
ArrayUtil.UnitTest See the Overview page of the project's javadocs for a general description of this unit test class.
Benchmark Benchmarks the performance of a "task", defined here as arbitrary Java code that is contained inside either a Callable or Runnable.
Benchmark.JvmState Records some characteristics of the JVM state.
Benchmark.LfsrAdvancer The run method of this class simply advances the internal state of an Lfsr instance.
Benchmark.Measurement Records information about an execution time measurement.
Benchmark.Params Holds parameters which specify how the benchmarking is carried out.
Benchmark.Stats Holds execution time statistics.
Benchmark.UnitTest See the Overview page of the project's javadocs for a general description of this unit test class.
BidirectionalMap An object that provides a way to associate pairs of Objects.
BidirectionalMap.UnitTest See the Overview page of the project's javadocs for a general description of this unit test class.
BufferFixed<E> Simple data structure whose maximum number of elements stored is fixed to a constant value.
BufferFixed.State<E> Used to record a snapshot of the state of a BufferFixed instance.
CaseInsensitiveComparator Imposes an ordering on Strings that is inconsistent with equals; see compare for details.
CaseInsensitiveComparator.UnitTest See the Overview page of the project's javadocs for a general description of this unit test class.
CharUtil Provides static utility methods for dealing with chars.
CharUtil.UnitTest See the Overview page of the project's javadocs for a general description of this unit test class.
Check Contains methods that perform various checks on data.
Check.Arg Concrete subclass of Check which is meant for checking method arguments.
Check.Assert Concrete subclass of Check which is meant for checking arbitrary state.
Check.CheckAdaptor Abstract subclass of Check which merely implements Check.onFailure(String) to forward to Check.onFailure(String, Throwable).
Check.State Concrete subclass of Check which is meant for checking arbitrary state.
Check.UnitTest See the Overview page of the project's javadocs for a general description of this unit test class.
ClassUtil Provides static utility methods that deal with the Class of an object.
ClassUtil.UnitTest See the Overview page of the project's javadocs for a general description of this unit test class.
Collections2 Adds functionality that is missing from Collections.
Collections2.UnitTest See the Overview page of the project's javadocs for a general description of this unit test class.
Collections2.UnmodifiableNavigableSet<E>  
CommandLineInterface Illustrates one way to quickly implement a simple command line interface (CLI).
CommandLineInterface.Commands Whenever you wish to add a command to the CommandLineInterface class, all that you need to do is add it as a method of this class.
CommandLineInterface.StdinReader  
ConcurrentHashSet<E> Set implementation backed by a concurrent hash table (a ConcurrentHashMap instance).
Date2 A replacement for Date which corrects all its design mistakes.
DateConstraint Stores information which defines date constraints, and offers the accepts method to test a given Date.
DateConstraint.UnitTest See the Overview page of the project's javadocs for a general description of this unit test class.
DateUtil Provides static utility methods relating to Dates.
DateUtil.DateInfo Stores various calendar related qualities of a Date, such as its era, year, etc.
DateUtil.DateInfoBin Stores all the DateUtil.DateInfo instances which have a common day number key (as calculated by getDateInfo).
DateUtil.DateStringCache Stores Date <--> String mappings (i.e. from the user's perspective, it is a bidirectional map).
DateUtil.IsoDateFormat Formats/parses dates that are ISO 8601 compliant.
DateUtil.TimeZoneChange Stores information about a time zone change.
DateUtil.UnitTest See the Overview page of the project's javadocs for a general description of this unit test class.
Execute Executes a "task", defined here as arbitrary Java code that is contained inside either a Callable or Runnable instance.
Execute.Caller Records information about the class that is calling Execute: its class name, method name, and whether or not it is the actual program entry point of the current Java process.
Execute.TestGui  
Execute.UnitTest See the Overview page of the project's javadocs for a general description of this unit test class.
HashUtil Provides various static utility methods for dealing with hashes.
HashUtil.UnitTest See the Overview page of the project's javadocs for a general description of this unit test class.
JUnitExecutor Discovers and autoexecutes all the JUnit 4 test methods (i.e. those annotated Test) found in the class files of some directory tree.
JUnitExecutor.AudioFeedback Provides audio feedback for test events.
JUnitExecutor.BufferWithEcho Modifies superclass to echo the last line stored in the buffer to the console after byte(s) are written to it.
JUnitExecutor.DescriptionFields Parses and stores fields from a Description.
JUnitExecutor.FindTestEvents Stores all events that occur while finding classes with JUnit tests, from which it can generate a report.
JUnitExecutor.PcmFilter Filters on the basis of package, class, and method names (pcm).
JUnitExecutor.PrintStreamFeedback Provides console feedback for test events.
JUnitExecutor.RunListenerAbstract Defines some common functionality used by a couple of (otherwise very different) RunListener implementations.
JUnitExecutor.StdStreams Swaps and unswaps the standard streams (System.out and System.err) for a pair of JUnitExecutor.BufferWithEcho instances.
JUnitExecutor.StdStreamSwapper Every time that a test method is about to be executed, this intercepts the standard streams (out and err) and captures any output.
JUnitExecutor.TestRunEvents Stores all events which occur during a test run, from which it can generate a report.
ListWithIndex Contains an internal List, as well as keeps track of the current position (index) in the List.
LocaleTimeZoneUtil The original version of this class did Locale and TimeZone checking code for another project.
LocaleTimeZoneUtil.LocaleComparator Imposes an ordering on Locales that is consistent with equals; see compare for details.
MemoryMeasurer Class which measures memory state in a JVM.
MemoryMeasurer.UnitTest See the Overview page of the project's javadocs for a general description of this unit test class.
MemoryMeasurer.UnitTest.MemoryFiller Class which attempts to fill up memory to a specified point.
MemoryMonitor Class which actively monitors the memory state of a JVM looking for issues.
MemoryMonitor.UnitTest See the Overview page of the project's javadocs for a general description of this unit test class.
MemoryMonitor.UnitTest.ListenerTest Simple subclass of MemoryMonitorListenerImpl which can be interrogated to see if events have occured.
MemoryMonitorListenerImpl Simple implementation of MemoryMonitorListener which logs most events to its own internal Logger.
MemoryState Class which records data describing the memory state of a JVM.
MemoryState.UnitTest See the Overview page of the project's javadocs for a general description of this unit test class.
NumberUtil Provides static utility methods related to numbers.
NumberUtil.UnitTest See the Overview page of the project's javadocs for a general description of this unit test class.
ObjectCounter<E> Class to which arbitrary objects may be added, and statistical inquiries may be made about (e.g.
ObjectCounter.UnitTest See the Overview page of the project's javadocs for a general description of this unit test class.
ObjectState Determines the state of some other object.
ObjectState.AcceptOnlyImmediateClass Accepts a Class only if it is object's class.
ObjectState.AcceptOnlyPublicProtectedFields Accepts a Field only if it is public or protected.
ObjectState.ClassFilterAbstract Base class for Filters which care only about Classes.
ObjectState.FieldFilterAbstract Base class for Filters which care only about Fields.
ObjectState.RejectInterfaces Rejects a Class if it is an interface.
ObjectState.RejectObjectClass Rejects a Class if it is Object.class.
ObjectState.RejectStaticFields Rejects a Field if it is static.
ObjectState.UnitTest See the Overview page of the project's javadocs for a general description of this unit test class.
ObjectState.UnitTest.CompoundClass  
ObjectState.UnitTest.CompoundClass.InnerClass1  
ObjectState.UnitTest.InterfaceImplementingClass  
ObjectState.UnitTest.NoFields  
ObjectState.UnitTest.ReferringClass  
ObjectState.UnitTest.SubClass Has fields which provide similar complete coverage and distinct values as ObjectState.UnitTest.SuperClass.
ObjectState.UnitTest.SuperClass Has fields which provide complete coverage of: all modifier permutations public protected private static final many field types primitives arrays, Collection, Map java.lang and CharSequence Also, all the values are distinct, both within this class and from ObjectState.UnitTest.SubClass below.
OsUtil Provides static utility methods relating to the operating system that the JVM is running on.
OsUtil.ExecTask Encapsulates all the work carried out by both the execSynch and execAsynch methods.
OsUtil.UnitTest See the Overview page of the project's javadocs for a general description of this unit test class.
PreferencesUtil Provides static utility methods for dealing with Preferences.
ProgressIndicator Class that stores the amount of progress completed by some other process.
Properties2 This class is what Properties ought to have been, namely, a Map<String, String> implementation with additional constraints and convenience methods.
Properties2.UnitTest See the Overview page of the project's javadocs for a general description of this unit test class.
RandomUtil Provides static utility methods relating to Random.
RandomUtil.UnitTest See the Overview page of the project's javadocs for a general description of this unit test class.
RandomUtil.UnitTest.SingleThread_MersenneTwisterFast  
RandomUtil.UnitTest.SingleThread_RandomPerThread  
ReflectUtil Provides static utility methods related to reflection.
ReflectUtil.FieldComparator Imposes an ordering on Fields that is consistent with equals; see compare for details.
ReflectUtil.UnitTest See the Overview page of the project's javadocs for a general description of this unit test class.
SetUtil Provides static utility methods for Sets.
SetUtil.UnitTest See the Overview page of the project's javadocs for a general description of this unit test class.
State This class is meant to represent named states.
StateMachine<E extends Enum<E>> Simple implementation of a software state machine.
StateMachine.UnitTest See the Overview page of the project's javadocs for a general description of this unit test class.
StringUtil Provides various static String (and sometimes char[]) utility methods.
StringUtil.UnitTest See the Overview page of the project's javadocs for a general description of this unit test class.
ThreadMeasurer Class which measures the threads of a JVM.
ThreadMeasurer.UnitTest See the Overview page of the project's javadocs for a general description of this unit test class.
ThreadMeasurer.UnitTest.DoubleLockAquirer  
ThreadMonitor Class which actively monitors the thread state of a JVM looking for issues.
ThreadMonitor.UnitTest See the Overview page of the project's javadocs for a general description of this unit test class.
ThreadMonitor.UnitTest.ListenerTest Simple ThreadMonitorListener implementation meant for test purposes: it prints all events to System.out (except for onThreadState, which outputs to ThreadMonitor.UnitTest.ListenerTest.pw), it uses ThreadMonitor.UnitTest.ListenerTest.barrier to coordinate actions with the main thread, and onThreadState can be configured to deliberately throw a RuntimeException when makeFail called.
ThreadMonitor.UnitTest.ThreadMeasurerTest Extends ThreadMeasurer to deliberately throw a RuntimeException when makeFail called.
ThreadPoolExecutor2 Extension of ThreadPoolExecutor that makes it more convenient to construct instances suited for a specific concurrent scenario.
ThreadUtil Provides static utility methods for Threads.
ThreadUtil.UnitTest See the Overview page of the project's javadocs for a general description of this unit test class.
ThrowableUtil Provides static utility methods for Throwables.
ThrowableUtil.UnitTest See the Overview page of the project's javadocs for a general description of this unit test class.
TimeElapsedLatch This class provides a simple latch that is set once a specified amount of time has elapsed.
TimeLength Provides fields and methods related to lengths of some common periods of time.
UncaughtThrowableLogger Logs all otherwise uncaught Throwables to a Logger.
UncaughtThrowableLogger.UnitTest See the Overview page of the project's javadocs for a general description of this unit test class.
Unmodifiables  
Unmodifiables.UnmodifiableCollection<E>  
Unmodifiables.UnmodifiableList<E>  
Unmodifiables.UnmodifiableMap<K,V>  
Unmodifiables.UnmodifiableMap.UnmodifiableEntrySet<K,V> We need this class in addition to UnmodifiableSet as Map.Entries themselves permit modification of the backing Map via their setValue operation.
Unmodifiables.UnmodifiableMap.UnmodifiableEntrySet.UnmodifiableEntry<K,V> This "wrapper class" serves two purposes: it prevents the client from modifying the backing Map, by short-circuiting the setValue method, and it protects the backing Map against an ill-behaved Map.Entry that attempts to modify another Map Entry when asked to perform an equality check.
Unmodifiables.UnmodifiableRandomAccessList<E>  
Unmodifiables.UnmodifiableSet<E>  
Unmodifiables.UnmodifiableSortedMap<K,V>  
Unmodifiables.UnmodifiableSortedSet<E>  
 

Enum Summary
ReflectUtil.UnitTest.Planet  
StateMachine.UnitTest.Numbers  
 

Package bb.util Description

Provides miscellaneous utility classes and interfaces.