/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package real.estate.dao;

/**
 *
 * @author User
 */
public class ListHouse implements Listable {

    public int no_of_item;
    public int[] list;
    private static final int max_list = 5;
    public int size;
    public int position;

    private String lastName;
    private String firstName;
    private int lotNumber;
    private int price;
    private int squareFeet;
    private int bedRooms;


    public ListHouse(String lastName, String firstName, int lotNumber,
            int price, int squareFeet, int bedRooms) {
        this.lastName = lastName;
        this.firstName = firstName;
        this.lotNumber = lotNumber;
        this.price = price;
        this.squareFeet = squareFeet;
        this.bedRooms = bedRooms;
    }

    public int getNo_of_item() {
        return no_of_item;
    }

    public void setNo_of_item(int no_of_item) {
        this.no_of_item = no_of_item;
    }

    public int[] getList() {
        return list;
    }

    public void setList(int[] list) {
        this.list = list;
    }

    public int getSize() {
        return size;
    }

    public void setSize(int size) {
        this.size = size;
    }

    public int getPosition() {
        return position;
    }

    public void setPosition(int position) {
        this.position = position;
    }

   

    public int generateList(int max_list) {

        for (int i = 1; i <= max_list; i++) {

        }

        return no_of_item;

    }

    public void insert(int item) {
        if (max_list < 30) {
            list[no_of_item] = item;
        }
        no_of_item++;
        position++;

    }

    public void delete(int index) {
        if (index <= position) {
            for (int i = 0; i <= max_list; i++) {
                list[i] = list[i + 1];

            }
        }
        no_of_item--;
        position--;

    }

    public boolean isEmpty() {
        if (no_of_item == 5) {
            return true;
        } else {
            return false;
        }
    }

    public int find(int item) {
        boolean valueInList = true;
        for (int i = 0; i < no_of_item; i++) {

            if (list[i] == item) {

                System.out.print(i + " ");

            }
            if (valueInList != true) {
                System.out.println("The value not in the list");
            }

        }

        System.out.println();

        return position;
    }

   

    public Listable copy() {
        ListHouse list1 = new ListHouse(lastName, firstName, lotNumber, price, squareFeet, bedRooms);
        return list1;
    }


    @Override
    public int compareTo(Listable other) {
      ListHouse other1 = (ListHouse)other;
       return (this.lotNumber-other1.lotNumber); 
    }
    public String firstName(){
        return firstName;
    }
    public String lastName(){
        return lastName;
    }
    public int lotNumber(){
        return lotNumber;
    }
    public int price(){
        return price;
    }
    public int squareFeet(){
        return squareFeet;
    }
    public int bedRooms(){
        return bedRooms;
    }

  
}

@@ -581,17 +581,16 @@
 Rooms;%0A%0A
-%0A
     publ
@@ -1472,37 +1472,32 @@
 osition;%0A    %7D%0A%0A
-   %0A%0A
     public int g
@@ -1622,957 +1622,8 @@
  %7D%0A%0A
-    public void insert(int item) %7B%0A        if (max_list %3C 30) %7B%0A            list%5Bno_of_item%5D = item;%0A        %7D%0A        no_of_item++;%0A        position++;%0A%0A    %7D%0A%0A    public void delete(int index) %7B%0A        if (index %3C= position) %7B%0A            for (int i = 0; i %3C= max_list; i++) %7B%0A                list%5Bi%5D = list%5Bi + 1%5D;%0A%0A            %7D%0A        %7D%0A        no_of_item--;%0A        position--;%0A%0A    %7D%0A%0A    public boolean isEmpty() %7B%0A        if (no_of_item == 5) %7B%0A            return true;%0A        %7D else %7B%0A            return false;%0A        %7D%0A    %7D%0A%0A    public int find(int item) %7B%0A        boolean valueInList = true;%0A        for (int i = 0; i %3C no_of_item; i++) %7B%0A%0A            if (list%5Bi%5D == item) %7B%0A%0A                System.out.print(i + %22 %22);%0A%0A            %7D%0A            if (valueInList != true) %7B%0A                System.out.println(%22The value not in the list%22);%0A            %7D%0A%0A        %7D%0A%0A        System.out.println();%0A%0A        return position;%0A    %7D%0A%0A   %0A%0A
     
@@ -1778,17 +1778,16 @@
 %0A    %7D%0A%0A
-%0A
     @Ove
@@ -1837,24 +1837,26 @@
 er) %7B%0A      
+  
 ListHouse ot
@@ -1873,16 +1873,17 @@
 stHouse)
+ 
 other;%0A 
@@ -1884,24 +1884,25 @@
 her;%0A       
+ 
 return (this
@@ -1915,9 +1915,11 @@
 mber
--
+ - 
 othe
@@ -1936,16 +1936,16 @@
 er);
- 
 %0A    %7D%0A
+%0A
     
@@ -1961,32 +1961,33 @@
 ring firstName()
+ 
 %7B%0A        return
@@ -1996,32 +1996,33 @@
 irstName;%0A    %7D%0A
+%0A
     public Strin
@@ -2033,16 +2033,17 @@
 stName()
+ 
 %7B%0A      
@@ -2059,32 +2059,33 @@
 lastName;%0A    %7D%0A
+%0A
     public int l
@@ -2094,16 +2094,17 @@
 Number()
+ 
 %7B%0A      
@@ -2121,32 +2121,33 @@
 otNumber;%0A    %7D%0A
+%0A
     public int p
@@ -2152,16 +2152,17 @@
  price()
+ 
 %7B%0A      
@@ -2175,32 +2175,33 @@
 rn price;%0A    %7D%0A
+%0A
     public int s
@@ -2211,16 +2211,17 @@
 reFeet()
+ 
 %7B%0A      
@@ -2247,16 +2247,17 @@
 ;%0A    %7D%0A
+%0A
     publ
@@ -2273,16 +2273,17 @@
 dRooms()
+ 
 %7B%0A      
@@ -2312,9 +2312,6 @@
  %7D%0A%0A
-  %0A
 %7D%0A

remove list ADT from ListHouse class