Class VerifyCommand


  • public class VerifyCommand
    extends Command
    This Command class represents the VERIFY SQL command, which verifies a table's representation (along with any indexes) to ensure that all structural details are valid. This is not a standard SQL command, but it is very useful for verifying student implementations of file structures.
    • Nested Class Summary

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static org.apache.logging.log4j.Logger logger
      A logging object for reporting anything interesting that happens.
      private java.util.LinkedHashSet<java.lang.String> tableNames
      Table names are kept in a set so that we don't need to worry about a particular table being specified multiple times.
      • Fields inherited from class edu.caltech.nanodb.commands.Command

        out
    • Constructor Summary

      Constructors 
      Constructor Description
      VerifyCommand()
      Construct a new VERIFY command with an empty table list.
      VerifyCommand​(java.lang.String tableName)
      Construct a new VERIFY command to verify the specified table.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addTable​(java.lang.String tableName)
      Add a table to the list of tables to verify.
      void execute​(NanoDBServer server)
      Actually performs the command.
      java.util.Set<java.lang.String> getTableNames()
      Returns the set of tables to verify in an unmodifiable set.
      java.lang.String toString()
      Prints a simple representation of the verify command, including the names of the tables to be verified.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • logger

        private static org.apache.logging.log4j.Logger logger
        A logging object for reporting anything interesting that happens.
      • tableNames

        private java.util.LinkedHashSet<java.lang.String> tableNames
        Table names are kept in a set so that we don't need to worry about a particular table being specified multiple times.
    • Constructor Detail

      • VerifyCommand

        public VerifyCommand()
        Construct a new VERIFY command with an empty table list. Tables can be added to the internal list using the addTable(java.lang.String) method.
      • VerifyCommand

        public VerifyCommand​(java.lang.String tableName)
        Construct a new VERIFY command to verify the specified table.
        Parameters:
        tableName - the name of the table to verify.
    • Method Detail

      • addTable

        public void addTable​(java.lang.String tableName)
        Add a table to the list of tables to verify.
        Parameters:
        tableName - the name of the table to verify.
      • getTableNames

        public java.util.Set<java.lang.String> getTableNames()
        Returns the set of tables to verify in an unmodifiable set.
        Returns:
        the set of tables to verify in an unmodifiable set.
      • toString

        public java.lang.String toString()
        Prints a simple representation of the verify command, including the names of the tables to be verified.
        Overrides:
        toString in class java.lang.Object
        Returns:
        a string representing this verify command