Class PhoneDurationsImpl

  • All Implemented Interfaces:
    PhoneDurations

    public class PhoneDurationsImpl
    extends java.lang.Object
    implements PhoneDurations
    Maintains set of PhoneDuration instances read in from a file. The format of the file is as follows:
     phone mean stddev
     phone mean stddev
     phone mean stddev
     ...
     
    Where phone is the phone name, mean is a float representing the mean duration of the phone (typically in seconds), and stddev is a float representing the standard deviation from the mean.
    • Constructor Summary

      Constructors 
      Constructor Description
      PhoneDurationsImpl​(java.net.URL url)
      Creates a new PhoneDurationsImpl by reading from the given URL.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      PhoneDuration getPhoneDuration​(java.lang.String phone)
      Gets the PhoneDuration for the given phone.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PhoneDurationsImpl

        public PhoneDurationsImpl​(java.net.URL url)
                           throws java.io.IOException
        Creates a new PhoneDurationsImpl by reading from the given URL.
        Parameters:
        url - the input source
        Throws:
        java.io.IOException - if an error occurs
    • Method Detail

      • getPhoneDuration

        public PhoneDuration getPhoneDuration​(java.lang.String phone)
        Gets the PhoneDuration for the given phone. If no duration is applicable, returns null.
        Specified by:
        getPhoneDuration in interface PhoneDurations
        Parameters:
        phone - the phone
        Returns:
        the PhoneDuration for phone