• Objective:
    • For this lab you will extending the file handler created in Lab 1 to make it implement PlotFile so so that it can be plotted with PLOT.
    • Here we are starting where the solution for Lab 1 left off (see OrangeFile.java).
  • The PlotFile interface:
    • The PlotFile interface defines the methods that must be implemented in order for PLOT to be able to plot the file.
    • On first glance, implementing PlotFile is quite daunting; however, we already have most of those methods in our OrangeFile class. Some of the methods we already wrote:
      public double getSize ()
      public double getXStart ()
      public double getXDelta ()
      public String getFormat()
      public Data getDataBuffer (int size)
      public int read (Data data, int elements)
      public int seek (double offset)
      public double seek ()
      public double avail ()
      
      Other methods are provided by BaseFile:
      public void init (Object ref, Object filename)
      public Object getQualifier (String key)
      public boolean find (int dir)
      public String getTag ()
      public boolean isStream ()
      public boolean isStreaming ()
      public String getURL ()
      public FileName getName ()
      public boolean open (int flags)
      public boolean isOpen ()
      public void close ()
      
      This leaves us with just 14 methods that we need to implement, all of which can just be one-line methods:
      public int getXUnits ()
      public int getXFrame ()
      public double getYStart ()
      public double getYDelta ()
      public int getYUnits ()
      public int getYFrame ()
      public double getStart ()
      public double getDelta ()
      public int getUnits ()
      public double getTimeAt (double offset)
      public int getType ()
      public void connect (int mode)
      public int getMode ()
      public Layer getLayer ()
      
  • continued on next page