package ru.job4j;

/**
 * Task 5.2.2
 * This is basis for outher containers
 * @author  Anton Vasilyuk on 10.06.2017.
 * @version 1.0
 */
public class BaseStore<T extends Base> implements Store<T> {

    /**.
     * capacityArray is size container
     */
    private static final int capacityArray = 10;

    /**.
     * aList is object for class SimpleList
     */
    SimpleList sList = new SimpleList(capacityArray);

    /**.
     * Method for add element to containers
     * @param t is element
     */
    @Override
    public void add(T t) {
        sList.add(t);
    }

    /**.
     * Method for update element on this position
     * @param position is position in array
     * @param t is element
     */
    @Override
    public void update(int position, T t) {
        sList.update(position, t);
    }

    /**.
     * Method for delete element from container
     * @param position is position for removing
     */
    @Override
    public void remove(int position) {
        sList.delete(position);
    }

    /**.
     * Method for show element on this position
     * @param position is position in container
     * @return element
     */
    public Base showByPosition(int position) {
        return (Base) sList.get(position);
    }
}

@@ -374,16 +374,19 @@
 mpleList
+%3CT%3E
  sList =
@@ -417,16 +417,16 @@
 Array);%0A
-
 %0A    /**
@@ -639,52 +639,8 @@
 ion%0A
-     * @param position is position in array%0A
     
@@ -711,29 +711,126 @@
 ate(
-int position, T t) %7B%0A
+String id, T t) %7B%0A        int position = findValueById(t);%0A        if (position != 99) %7B%0A            t.setId(id);%0A    
     
@@ -856,24 +856,34 @@
 sition, t);%0A
+        %7D%0A
     %7D%0A%0A    /
@@ -1284,15 +1284,8 @@
 urn 
-(Base) 
 sLis
@@ -1291,26 +1291,398 @@
 st.get(position)
+;%0A    %7D%0A%0A    public int findValueById(T t) %7B%0A        int position = 99;%0A        for (int i = 0; i %3C capacityArray; i++) %7B%0A            T value = sList.get(i);%0A            if (value != null) %7B%0A                if (value.getId().equals(t.getId())) %7B%0A                    position = i;%0A                    break;%0A                %7D%0A            %7D%0A        %7D%0A        return position
 ;%0A    %7D%0A%7D%0A

add file for chapter_003_5.2.2