/* 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.ds;

import iitb.con.core.Instance;

import java.nio.ByteBuffer;


/**
 * InstanceMetaItem holds the meta-information about the instance.
 * It has the type id, instance id and its location in the concept-net file.
 * 
 * @author Prathab K
 */
public class InstanceMetaItem {
    
    /** Type Id */
    public short typeId;
    
    /** Cluster Id */
    public short clusterId = 0; //default value is 0 denoting does everything as a single cluster
    
    /** Instance Id */
    public int instanceId;
    
    /** Instance location in the concept-net file */
    public long location; // instance's location in .net file
    
    /** Size of the instance */
    public int size;
    
    /** Location of InstanceItem in the InstanceTable */
    public transient long itemLocation = -1; //Location of the item in .ntab file
    
    /** Instance object*/
    public transient Instance instance;
    
    /** Instance as bytes */
    public transient ByteBuffer instanceBytes;
    
    //structSize = typeId(2) + clusterId(2) + instanceId (4) + location (8) + size (4) = 20 bytes
    private static short structSize = 20;
    
    public static short headerSize(){
        return structSize;
    }
    
    public InstanceMetaItem() {}
    
    public InstanceMetaItem(InstanceMetaItem item) {
        this.typeId = item.typeId;
        this.clusterId = item.clusterId;
        this.instanceId = item.instanceId;
        this.location = item.location;
        this.size = item.size;
        this.itemLocation = item.itemLocation;
        //this.instanceBytes = item.instanceBytes;
        //this.instance = item.instance;
    }
    

}