package oracle.toplink.essentials.internal.ejb.cmp3.xml.sequencing;

import oracle.toplink.essentials.internal.ejb.cmp3.xml.TableInfo;

public class TableGenerator {
    private String name;
    private String pkColumnName;
    private String valueColumnName;
    private String pkColumnValue;
    private TableInfo table;
    private int initialValue;
    private int allocationSize;

    public TableGenerator(String name, String pkColumnName, String valueColumnName, String pkColumnValue, TableInfo table, int initialValue, int allocationSize) {
        this.name = name;
        this.pkColumnName = pkColumnName;
        this.valueColumnName = valueColumnName;
        this.pkColumnValue = pkColumnValue;
        this.table = table;
        this.initialValue = initialValue;
        this.allocationSize = allocationSize;
    }
    
    public String name() {
        return name;
    }
    
    public TableInfo table() {
        return table;
    }
    
    public String pkColumnName() {
        return pkColumnName;
    }
    
    public String valueColumnName() {
        return valueColumnName;
    }
    
    public String pkColumnValue() {
        return pkColumnValue;
    }
    
    public int initialValue() {
        return initialValue;
    }
    
    public int allocationSize() {
        return allocationSize;
    }
    
    public boolean equals(Object objectToCompare) {
        if (objectToCompare instanceof TableGenerator) {
            TableGenerator generator = (TableGenerator) objectToCompare;
            
            if (!generator.name().equals(this.name())) { 
                return false;
            }
            if (!generator.pkColumnName().equals(this.pkColumnName())) {
                return false;
            }
            if (!generator.valueColumnName().equals(this.valueColumnName())) {
                return false;
            }
            if (!generator.pkColumnValue().equals(this.pkColumnValue())) {
                return false;
            }
            if (!generator.table().equals(this.table())) {
                return false;
            }
            if (generator.initialValue() != this.initialValue()) {
                return false;
            }
            if (generator.allocationSize() != this.allocationSize()) {
                return false;
            }
            return true;
        }
        return false;
    }
}
