package ru.matevosyan;

/**
 * SimpleArray class.
 * Created on 14.05.2017.
 * @author Matevosyan Vardan
 * @version 1.0
 */

public class SimpleArray<T> {

    private Object[] object;
    private int index = 0;

    /**
     * SimpleArray constructor.
     * @param size array length.
     */

    public SimpleArray(int size) {
        this.object = new Object[size];
    }

    /**
     * Method add() add value, defined in the instance of SimpleArray class to the array.
     * @param value  that would be added to array.
     */

    public void add(T value) {
        this.object[index++] = value;
    }

    /**
     * Method update change first pass value to second pass value.
     * @param currentValue value that going to be changed.
     * @param updateValue value that going to be added instead of first pass value.
     */

    public void update(T currentValue, T updateValue) {
        for (int i = 0; i < this.object.length; i++) {
            if (this.object[i].equals(currentValue)) {
                this.object[i] = updateValue;
            }
        }
    }

    /**
     * Method delete() created to delete value from the array.
     * @param value that going to be deleted from the array.
     */

    public void delete(T value) {
        for (int i = 0; i < this.object.length; i++) {
            if (this.object[i] != null && this.object[i].equals(value)) {
                int size = this.object.length - i - 1;
                System.arraycopy(this.object, i + 1 ,this.object, i, size);
            }
            this.object[this.object.length - 1] = null;
        }

    }

    /**
     * Method get() created to get the value from the array passing the index.
     * @param position in array, which value going to get.
     * @return value from index was passed to the method.
     */

    @SuppressWarnings("unchecked")
    public T get(int position) {
        return (T) this.object[position];
    }

    /**
     * Array getter.
     * @return object holder.
     */

    public Object[] getObject() {
        return this.object;
    }
}

@@ -17,16 +17,58 @@
 osyan;%0A%0A
+import java.util.NoSuchElementException;%0A%0A
 /**%0A * S
@@ -1269,20 +1269,23 @@
  public 
-void
+boolean
  delete(
@@ -1287,32 +1287,85 @@
 lete(T value) %7B%0A
+        boolean isDeleted = false;%0A        try %7B%0A    
         for (int
@@ -1395,32 +1395,36 @@
 .length; i++) %7B%0A
+    
             if (
@@ -1497,16 +1497,20 @@
         
+ 
+   
 int size
@@ -1540,16 +1540,20 @@
  i - 1;%0A
+    
         
@@ -1599,10 +1599,10 @@
  + 1
- 
 ,
+ 
 this
@@ -1624,34 +1624,42 @@
 e);%0A            
-%7D%0A
+    %7D%0A    
             this
@@ -1702,26 +1702,176 @@
 ll;%0A        
-%7D%0A
+        isDeleted = true;%0A            %7D%0A        %7D catch (NoSuchElementException nse) %7B%0A            nse.getMessage();%0A        %7D%0A        return isDeleted;
 %0A    %7D%0A%0A    
@@ -2144,16 +2144,44 @@
 osition)
+ throws NullPointerException
  %7B%0A     

change delete method in SimpleStore.java