package ru.matevosyan;

/**
 * Created by Admin on 16.05.2017.
 */
public class MajorStore implements Store<Base> {

    private SimpleArray<Base> storage;

    public MajorStore(int size) {
        storage = new SimpleArray<>(size);
    }

    public MajorStore(SimpleArray<Base> storage) {
        this.storage = storage;
    }

    @Override
    public void add(Base value) {
        storage.add(value);
    }

    @Override
    public void update(String id, Base second) {

    }

    @Override
    public void delete(String id) {

    }

    @Override
    public Base get(String id) {
        return null;
    }
}

@@ -21,51 +21,151 @@
 n;%0A%0A
-/**%0A * Created by Admin on 16.05.2017.
+import java.util.NoSuchElementException;%0A%0A/**%0A * MajorStore class.%0A * Created on 16.05.2017.%0A * @author Matevosyan Vardan%0A * @version 1.0
 %0A */%0A
+%0A
 publ
@@ -218,497 +218,2492 @@
     
-private SimpleArray%3CBase%3E storage;%0A%0A    public MajorStore(int size) %7B%0A        storage = new SimpleArray%3C%3E(size);%0A    %7D%0A%0A    public MajorStore(SimpleArray%3CBase%3E storage) %7B%0A        this.storage = storage;%0A    %7D%0A%0A    @Override%0A    public void add(Base value) %7B%0A        storage.add(value);%0A    %7D%0A%0A    @Override%0A    public void update(String id, Base second) %7B%0A%0A    %7D%0A%0A    @Override%0A    public void delete(String id) %7B%0A%0A    %7D%0A%0A    @Override%0A    public Base get(String id) %7B%0A        return null;
+/**%0A     * SimpleArray storage.%0A     */%0A%0A    private SimpleArray%3CBase%3E storage;%0A%0A    /**%0A     * first constructor to initialise storage.%0A     * @param size that SimpleArray storage will ger.%0A     */%0A%0A    public MajorStore(int size) %7B%0A        storage = new SimpleArray%3C%3E(size);%0A    %7D%0A%0A    /**%0A     * second constructor to assign storage to this variable.%0A     * @param storage %7B@link SimpleArray#object%7D.%0A     */%0A%0A    public MajorStore(SimpleArray%3CBase%3E storage) %7B%0A        this.storage = storage;%0A    %7D%0A%0A    @Override%0A    public void add(Base value) %7B%0A        storage.add(value);%0A    %7D%0A%0A    /**%0A     * Update invoking %7B@link SimpleArray#update(Object, Object)%7D method and using %7B@link MajorStore#findById(String)%7D.%0A     * @param id is values id in %7B@link SimpleArray#object%7D.%0A     * @param second is all Base class child value that going to be added instead of value with id that passing.%0A     */%0A%0A    @Override%0A    public void update(String id, Base second) %7B%0A        this.storage.update(findById(id), second);%0A    %7D%0A%0A    /**%0A     * Delete invoking %7B@link SimpleArray#delete(Object)%7D method and using %7B@link MajorStore#findById(String)%7D.%0A     * @param id is values id in %7B@link SimpleArray#object%7D that going to be deleted.%0A     * @return true if value was deleted.%0A     */%0A%0A    @Override%0A    public boolean delete(String id) %7B%0A        return this.storage.delete(findById(id));%0A    %7D%0A%0A    /**%0A     * Get Base value from %7B@link SimpleArray#object%7D.%0A     * @param id is values id in %7B@link SimpleArray#object%7D that going to be return.%0A     * @return Base vale.%0A     */%0A%0A    @Override%0A    public Base get(String id) %7B%0A        return findById(id);%0A    %7D%0A%0A    /**%0A     * Method findById(String id) find Base value from id.%0A     * @param id is Base values id.%0A     * @return Base value from %7B@link SimpleArray#object%7D.%0A     */%0A%0A    public Base findById(String id) %7B%0A        boolean isThere = false;%0A        Base first = null;%0A        for (int i = 0; i %3C this.storage.getObject().length; i++) %7B%0A            try %7B%0A                String baseId = this.storage.get(i).getId();%0A                if (id.equals(baseId)) %7B%0A                    first = this.storage.get(i);%0A                    isThere = true;%0A                    break;%0A                %7D%0A            %7D catch (NullPointerException npe)%7B%0A                npe.getMessage();%0A            %7D%0A%0A        %7D%0A%0A        if (!isThere) %7B%0A            throw new NoSuchElementException(%22No such Base%22);%0A        %7D else %7B%0A            return first;%0A        %7D
 %0A   

add MajorStore.java