/*
 * OIDProperty Class
 * OID configuration information
 */

package graphbrowser;

class OIDProperty implements java.io.Serializable {
  /** Default number of bits of each part */
  public final static int DEFAULT_HOST_LEN = 16;
  public final static int DEFAULT_USER_LEN = 16;
  public final static int DEFAULT_GRAPH_LEN = 16;
  public final static int DEFAULT_OBJECT_LEN = 16;

  public final static int LENGTH=64;
  public int hostLength;
  public int partLength;
  public int graphLength;
  public int objectLength;

  public long hostBegin;
  public long partBegin;
  public long graphBegin;

  /** Default Configuration*/
  public OIDProperty() {

    this.hostLength=DEFAULT_HOST_LEN;
    this.partLength=DEFAULT_USER_LEN;
    this.graphLength=DEFAULT_GRAPH_LEN;
    this.objectLength=DEFAULT_OBJECT_LEN;

    try {

     this.hostBegin= (long) Math.pow(2, this.LENGTH-this.hostLength);
     this.partBegin= (long) Math.pow(2, this.LENGTH-this.hostLength-this.partLength);
     this.graphBegin= (long) Math.pow(2, this.objectLength);
     //this.objectMask= ;
    } catch (ArithmeticException e) {
        System.out.println("Mask Building error!");
      }

  }

  /** User Defined Configuration*/
  public OIDProperty(int host,int part, int graph, int object) {

    this.hostLength=host;
    this.partLength=part;
    this.graphLength=graph;
    this.objectLength=object;

    try {

     this.hostBegin= (long) Math.pow(2, this.LENGTH-this.hostLength);
     this.partBegin= (long) Math.pow(2, this.LENGTH-this.hostLength-this.partLength);
     this.graphBegin= (long) Math.pow(2, this.objectLength);
     //this.objectMask= ;
    } catch (ArithmeticException e) {
        System.out.println("Mask Building error!");
      }

    /** build mask value */
/*  try {

    this.hostMask= Math.pow();
    this.partMask=;
    this.graphMask=;
    this.objectMask= ;
    } catch (ArithmeticException e) {
        System.out.println("Mask Building error!");
      }
*/
  }


} /** end of OID Property Class */

/*

class Mask { */

    /** total: the length of whole long value
     *  maskbegin: 1..total
     *  maskend:   1..total
     *
     */
/*  public static long buildMask(int total, int maskbegin, int maskend) {
      int len1=maskend-maskbegin+2;

      long temp1=Math.pow(2,len1)-1;

    }

}

*/