From 957f652258b3fec2fafd7c31fde2ab6507e85d94 Mon Sep 17 00:00:00 2001 From: fdai5728 Date: Wed, 16 Feb 2022 17:39:11 +0100 Subject: [PATCH] Restructures repository class and interface --- src/main/java/CredentialRepository.java | 32 +++++++++++++------ .../java/CredentialRepositoryInterface.java | 5 +-- 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/src/main/java/CredentialRepository.java b/src/main/java/CredentialRepository.java index 9863c6f..3fe9f97 100644 --- a/src/main/java/CredentialRepository.java +++ b/src/main/java/CredentialRepository.java @@ -23,16 +23,6 @@ public class CredentialRepository implements CredentialRepositoryInterface{ return this.getListSize(); } - @Override - public void edit() { - - } - - @Override - public void delete() { - - } - @Override public Credential getCredentialsViaName(String needle) { @@ -62,6 +52,28 @@ public class CredentialRepository implements CredentialRepositoryInterface{ } + /* + The next 3 functions assume you already have successfully + pulled a credential from the repository and now want to edit it. + Thus, these functions require you to pass the desired credential's index + */ + + + @Override + public void updatePassword(int index) { + + } + + public void updateUsername(int index){ + + } + + @Override + public void delete(int index) { + + } + + private int getListSize() { return this.credentials.size(); diff --git a/src/main/java/CredentialRepositoryInterface.java b/src/main/java/CredentialRepositoryInterface.java index ff04aac..da4696c 100644 --- a/src/main/java/CredentialRepositoryInterface.java +++ b/src/main/java/CredentialRepositoryInterface.java @@ -1,9 +1,10 @@ public interface CredentialRepositoryInterface { int createNewCredential(String name, String password); - void edit(); - void delete(); Credential getCredentialsViaName(String needle); Credential getCredentialsViaId(int id); + void updatePassword(int index); + void updateUsername(int index); + void delete(int index); }