Class ListStorage

java.lang.Object
passwordmanager.decoded.ListStorage
All Implemented Interfaces:
Cloneable, IStorage

public class ListStorage extends Object implements IStorage
Implementation of a data structure with decrypted records in the form of array list
Since:
2023-12-14
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private String
    Name of an decrypted data structure
    private List<IRecord>
    List of decrypted records
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructor initializing the list of encrypted records and the name of the structure
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Method for cleaning up the data structure
    Method for cloning a data structure with decrypted records
    void
    create(IRecord record)
    A method that creates a new entry in the repository
    void
    delete(int index)
    Method removing information about a record in the repository
    Method for filtering structure records
    getByIndex(int index)
    Method that reads an entry from the repository
    Method for getting the name of an decrypted data structure
    boolean
    Method for checking a structure for missing values
    Method to get list iterator
    void
    setName(String newName)
    Method for setting the name of an encrypted data structure
    int
    Method for getting the number of elements in a data structure
    void
    update(IRecord record)
    Method updating information about a record in the repository

    Methods inherited from class java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • storage

      private List<IRecord> storage
      List of decrypted records
    • name

      private String name
      Name of an decrypted data structure
  • Constructor Details

    • ListStorage

      public ListStorage()
      Constructor initializing the list of encrypted records and the name of the structure
  • Method Details

    • create

      public void create(IRecord record)
      A method that creates a new entry in the repository
      Specified by:
      create in interface IStorage
      Parameters:
      record - decoded record
    • getByIndex

      public IRecord getByIndex(int index)
      Method that reads an entry from the repository
      Specified by:
      getByIndex in interface IStorage
      Parameters:
      index - Index of entry to read in structure
    • update

      public void update(IRecord record)
      Method updating information about a record in the repository
      Specified by:
      update in interface IStorage
      Parameters:
      record - decrypted record to be updated
    • delete

      public void delete(int index)
      Method removing information about a record in the repository
      Specified by:
      delete in interface IStorage
      Parameters:
      index - decrypted record index to be removed
    • isEmpty

      public boolean isEmpty()
      Method for checking a structure for missing values
      Specified by:
      isEmpty in interface IStorage
      Returns:
      whether the data structure is empty or not
    • clear

      public void clear()
      Method for cleaning up the data structure
      Specified by:
      clear in interface IStorage
    • size

      public int size()
      Method for getting the number of elements in a data structure
      Specified by:
      size in interface IStorage
      Returns:
      number of elements in a data structure
    • getName

      public String getName()
      Method for getting the name of an decrypted data structure
      Specified by:
      getName in interface IStorage
      Returns:
      data structure name
    • setName

      public void setName(String newName)
      Method for setting the name of an encrypted data structure
      Specified by:
      setName in interface IStorage
      Parameters:
      newName - new data structure name
    • clone

      public ListStorage clone()
      Method for cloning a data structure with decrypted records
      Specified by:
      clone in interface IStorage
      Overrides:
      clone in class Object
      Returns:
      cloned structure
    • iterator

      public Iterator<IRecord> iterator()
      Method to get list iterator
      Returns:
      list iterator
    • filterByInfo

      public ListStorage filterByInfo(String query)
      Method for filtering structure records
      Specified by:
      filterByInfo in interface IStorage
      Parameters:
      query - filter string