package ru.pravvich.generic.store.repo;

import ru.pravvich.generic.store.Base;
import ru.pravvich.generic.store.simple_array.Simple;
import ru.pravvich.generic.store.simple_array.SimpleArray;

public class GenericStore<T extends Base> implements Store<T> {
    private Simple<T> users = new SimpleArray<>();

    @Override
    public void add(T subject) {
        users.add(subject);
    }

    public Simple<T> getStore() {
        return users;
    }

    @Override
    public boolean delete(T subject) {
        for (int i = 0; i < users.getSize(); i++) {
            if (subject.getId().equals(users.get(i).getId())) {
                users.delete(i);
                return true;
            }
        }
        return false;
    }

    @Override
    public boolean update(T oldObj, T newObj) {
        for (int i = 0; i < users.getSize(); i++) {
            if (oldObj.getId().equals(users.get(i).getId())) {
                users.update(i, newObj);
                return true;
            }
        }
        return false;
    }
}

@@ -273,20 +273,23 @@
 mple%3CT%3E 
-user
+subject
 s = new 
@@ -361,20 +361,23 @@
         
-user
+subject
 s.add(su
@@ -440,20 +440,23 @@
  return 
-user
+subject
 s;%0A    %7D
@@ -530,36 +530,39 @@
 (int i = 0; i %3C 
-user
+subject
 s.getSize(); i++
@@ -596,36 +596,39 @@
 .getId().equals(
-user
+subject
 s.get(i).getId()
@@ -648,20 +648,23 @@
         
-user
+subject
 s.delete
@@ -840,20 +840,23 @@
  0; i %3C 
-user
+subject
 s.getSiz
@@ -905,20 +905,23 @@
 .equals(
-user
+subject
 s.get(i)
@@ -953,12 +953,15 @@
     
-user
+subject
 s.up

add new decision for Store with generics