Package strategy

Class FileLog

  • All Implemented Interfaces:
    FileHandler

    public class FileLog
    extends java.lang.Object
    implements FileHandler
    Class that is responsible to save and parse log of executed commands.
    • Method Detail

      • save

        public void save​(java.io.File file)
        Save forwarded file as log of commands.
        Specified by:
        save in interface FileHandler
      • open

        public void open​(java.io.File file)
        Open forwarded log file and execute it command by command in interaction with user.
        Specified by:
        open in interface FileHandler
      • readLine

        public void readLine​(java.lang.String command)
        Read one line from log file and parse it.
        Parameters:
        command - Represent command that need to be parsed.
      • parseShape

        private Shape parseShape​(java.lang.String shape,
                                 java.lang.String shapeParameters)
        Determine which type of shape need to be parsed and call appropriate method.
        Parameters:
        shape - Represent type of shape which need to be parsed.
        shapeParameters - Represent values of that shape.
        Returns:
        Represent parsed shape.
      • parsePoint

        private Point parsePoint​(java.lang.String string)
        Method that parse Point from log file.
        Parameters:
        string - Represent Point that need to be parsed.
        Returns:
        Represent parsed Point.
      • parseCircle

        private Circle parseCircle​(java.lang.String string)
        Method that parse Circle from log file.
        Parameters:
        string - Represent Circle that need to be parsed.
        Returns:
        Represent parsed Circle.
      • parseSquare

        private Square parseSquare​(java.lang.String string)
        Method that parse Square from log file.
        Parameters:
        string - Represent Square that need to be parsed.
        Returns:
        Represent parsed Square.
      • parseRectangle

        private Rectangle parseRectangle​(java.lang.String string)
        Method that parse Rectangle from log file.
        Parameters:
        string - Represent Rectangle that need to be parsed.
        Returns:
        Represent parsed Rectangle.
      • parseLine

        private Line parseLine​(java.lang.String string)
        Method that parse Line from log file.
        Parameters:
        string - Represent Line that need to be parsed.
        Returns:
        Represent parsed Line.