ps4
Class StreetNumberSet

java.lang.Object
  extended by ps4.StreetNumberSet

public class StreetNumberSet
extends Object

Class overview to be written by student.


Constructor Summary
StreetNumberSet(String numbers)
          Creates a StreetNumberSet containing the numbers indicated in the argument.
 
Method Summary
 boolean contains(int i)
           
 int orderStatistic(int i)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StreetNumberSet

public StreetNumberSet(String numbers)
Creates a StreetNumberSet containing the numbers indicated in the argument.

Requires:
numbers != null && numbers is a space-free comma-delimited list of zero or more non-overlapping parity ranges. A parity range is only considered overlapping if it shares elements with another range. For example 10-20,19-21 are not overlapping as one only contains even elements and the other contains odd.

A parity range is either a single nonnegative integer "n" or a hyphen-separated pair of nonnegative integers "m-n", where m and n have the same parity and m is no greater than n. A range m-n represents the set of all numbers from m to n, inclusive, which are the same parity as m and n.

For instance, legal arguments to this constructor include "", "5", "22,253", "3-101", and "1914-1918,1939-1945".

Method Detail

contains

public boolean contains(int i)
Returns:
true iff i is in this

orderStatistic

public int orderStatistic(int i)
Returns:
the number of elements less than i in this