/* Copyright (C) 2009  CSE,IIT Bombay  http://www.cse.iitb.ac.in

This file is part of the ConStore open source storage facility for concept-nets.

ConStore is free software and distributed under the 
Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 Unported License;
you can copy, distribute and transmit the work
with the work attribution in the manner specified by the author or licensor.
You may not use this work for commercial purposes and may not alter, 
transform, or build upon this work.

Please refer the legal code of the license, available at
http://creativecommons.org/licenses/by-nc-nd/3.0/legalcode

ConStore is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  */

package iitb.con.core;

/**
 * Attribute class used to model the <code>Entity</code> and <code>Relation</code>attributes.<br>
 * Attributes can be of two types:<br>
 *  - Single-valued<br>
 *  - Multi-valued (or) Repeating<br><br>
 *  {@link DataType} - for the attribute data types.<br><br>
 *  
 * @author Prathab K
 *
 */
public class Attribute {
    
    /** Attribute Id */
    public short id;
    
    /** Name of the attribute */
    public String name;
    
    /** Data type of the attribute */
    public byte dataType;
    
    /* Position of the attribute in the <code>Entity</code> */
    //public byte position;
    
    /** Default value of the attribute*/
    public String defaultValue;
    
    /** Is the attribute is repeating? */
    public boolean repeating;
    
    /* Is the attribute is indexed */
    //public boolean indexed;
    
    public Attribute(){
    }
    
    /**
     * Initializes the newly created <code>Attribute</code> 
     * with the attribute name.
     * @param name attribute name
     */
    public Attribute(String name) {
        this.name = name;
    }

    /**
     * Initializes the newly created <code>Attribute</code> 
     * with the attribute name and data type.
     * @param name attribute name
     * @param dataType data type
     * @see DataType
     */
    public Attribute(String name, byte dataType) {
        this.name = name;
        this.dataType = dataType;
    }

    /**
     * Initializes the newly created <code>Attribute</code> 
     * with the attribute name, data type and repeating info.
     * @param name attribute name
     * @param dataType data type
     * @param repeating is-repeating
     */
    public Attribute(String name, byte dataType, boolean repeating) {
        this.name = name;
        this.dataType = dataType;
        this.repeating = repeating;
    }
}