package com.dbxml.xml.dtsm;

/*
 * dbXML - Native XML Database
 * Copyright (C) 1999-2004  The dbXML Group, L.L.C.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program 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.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *
 * $Id: Constants.java,v 1.3 2004/02/12 00:17:58 bradford Exp $
 */

/**
 * Constants defines all integer constants for the DTSM stream
 * format.
 */

public final class Constants {
   public static final int DOC_ENTRY_SIZE = DocumentTableEntry.SIZE;
   public static final int VAL_ENTRY_SIZE = ValueTableEntry.SIZE;
   public static final int INT_SIZE = 4;

   public static final int PAIR_COUNT = 7;
   public static final int SYMBOL_COUNT = 8;

   public static final byte OBJ_BEGIN_DOCUMENT = 1;
   public static final byte OBJ_END_DOCUMENT = -1;
   public static final byte OBJ_BEGIN_ELEMENT = 2;
   public static final byte OBJ_END_ELEMENT = -2;
   public static final byte OBJ_BEGIN_ATTRIBUTE = 3;
   public static final byte OBJ_END_ATTRIBUTE = -3;
   public static final byte OBJ_BEGIN_PROCINST = 4;
   public static final byte OBJ_END_PROCINST = -4;
   public static final byte OBJ_BEGIN_NOTATION = 5;
   public static final byte OBJ_END_NOTATION = -5;
   public static final byte OBJ_BEGIN_ENTITY = 6;
   public static final byte OBJ_END_ENTITY = -6;
   public static final byte OBJ_BEGIN_DOCTYPE = 7;
   public static final byte OBJ_END_DOCTYPE = -7;

   public static final byte OBJ_ENTITY_REF = 8;
   public static final byte OBJ_COMMENT = 9;
   public static final byte OBJ_TEXT = 10;
   public static final byte OBJ_CDATA = 11;

   public static final byte VAL_STRING = 13;
   public static final byte VAL_BOOLEAN = 14;
   public static final byte VAL_DECIMAL = 15;
   public static final byte VAL_FLOAT = 16;
   public static final byte VAL_DOUBLE = 17;
   public static final byte VAL_DURATION = 18;
   public static final byte VAL_DATETIME = 19;
   public static final byte VAL_TIME = 20;
   public static final byte VAL_DATE = 21;
   public static final byte VAL_GYEARMONTH = 22;
   public static final byte VAL_GYEAR = 23;
   public static final byte VAL_GMONTHDAY = 24;
   public static final byte VAL_GDAY = 25;
   public static final byte VAL_GMONTH = 26;
   public static final byte VAL_HEXBINARY = 27;
   public static final byte VAL_BASE64BINARY = 28;
   public static final byte VAL_ANYURI = 29;
   public static final byte VAL_QNAME = 30;

   public static final int NO_ID = -1;
   public static final int NO_SYMBOL_ID = NO_ID;
   public static final int NO_VALUE_ID = NO_ID;

   private Constants() {
   }

   public static final boolean isTypePaired(byte typeID) {
      return typeID <= PAIR_COUNT;
   }

   public static final boolean isPayloadSymbol(byte typeID) {
      return typeID <= SYMBOL_COUNT;
   }

   public static final boolean isPayloadValue(byte typeID) {
      return typeID > SYMBOL_COUNT;
   }
}
