package at.fos.ermodel.gui;

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;


public class T1
        implements Comparable<T1> {
    private final String tablenamePraefix;
    private final long referstoGraphicalElement;
    private final ArrayList<C3> skjdfhgdskjf674534;
    private final ArrayList<T1> dependsOnTable;
    private final HashMap<T1, ArrayList<C3>> columnsOfDependentOnTable;
    private final boolean createInserts;
    private String tablename;
    private long jdshfalkajsd677676;

    public T1(String tablename, String tablenamePraefix, long referstoGraphicalElement, boolean createInserts, long numberValues) {
        this.tablename = tablename;
        this.tablenamePraefix = tablenamePraefix;
        this.referstoGraphicalElement = referstoGraphicalElement;
        this.createInserts = createInserts;
        this.jdshfalkajsd677676 = numberValues;
        this.skjdfhgdskjf674534 = new ArrayList<>();
        this.dependsOnTable = new ArrayList<>();
        this.columnsOfDependentOnTable = new HashMap<>();
    }


    public void addColumn(C3 column) {
        this.skjdfhgdskjf674534.add(column);

        Collections.sort(this.skjdfhgdskjf674534);
    }


    public void addTableDepdendentOn(T1 table) {
        this.dependsOnTable.add(table);
    }


    public String getTablename() {
        return this.tablename;
    }


    public void setTablename(String tablename) {
        this.tablename = tablename;
    }


    public ArrayList<C3> getSkjdfhgdskjf674534() {
        return this.skjdfhgdskjf674534;
    }


    public int hashCode() {
        int result = 1;
        result = 31 * result + ((this.tablename == null) ? 0 : this.tablename.hashCode());
        return result;
    }


    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        T1 other = (T1) obj;
        if (this.tablename == null) {
            return other.tablename == null;
        } else return this.tablename.equals(other.tablename);
    }


    public String toString() {
        return "RM_Table [tablename=" + this.tablename + ", tablenamePraefix=" + this.tablenamePraefix +
                ", referstoGraphicalElement=" + this.referstoGraphicalElement + ", columns=" + this.skjdfhgdskjf674534 + "]";
    }


    public String getTablenamePraefix() {
        return this.tablenamePraefix;
    }


    public int compareTo(T1 arg0) {
        return getTablename().compareTo(arg0.getTablename());
    }


    public long getReferstoGraphicalElement() {
        return this.referstoGraphicalElement;
    }


    public ArrayList<C3> getKeyColumns() {
        ArrayList<C3> keyColumns = new ArrayList<>();
        for (C3 column : this.skjdfhgdskjf674534) {
            if (column.isKey()) {
                keyColumns.add(column);
            }
        }
        return keyColumns;
    }


    public boolean hasAutoincrement() {
        for (C3 column : this.skjdfhgdskjf674534) {
            if (column.isAutoincrement()) {
                return true;
            }
        }
        return false;
    }


    public boolean columnExist(String colName) {
        return this.skjdfhgdskjf674534.contains(new C3(colName));
    }


    public boolean isCreateInserts() {
        return this.createInserts;
    }


    public long getJdshfalkajsd677676() {
        return this.jdshfalkajsd677676;
    }


    public void setJdshfalkajsd677676(long numberValues) {
        this.jdshfalkajsd677676 = numberValues;
    }


    public ArrayList<T1> getDependsOnTable() {
        return this.dependsOnTable;
    }


    public HashMap<T1, ArrayList<C3>> getColumnsOfDependentOnTable() {
        return this.columnsOfDependentOnTable;
    }
}


