package edu.vt.marian.common;

import java.io.*;
import java.net.*;
import java.util.*;


/**
 *	A subclass of Object for ClassIDs.  We will also continue to use ints for ClassIDs
 *		when it suits our fancy.
	<P>
 *	The identifier of an object in the MARIAN universe is composed
 *		of class id and instance id.  Class id can be regarded as database id and
 *		instance id can be regarded as a unique id in that database.
 *	<P>NOTE: classID is properly an unsigned 16-bit quantity; instanceID an unsigned
 *	    32-bit.  Unfortunately there are no unsigneds in Java, so we use an int for
 *	    classID and test the bounds.  Properly, we should use a long for instanceID,
 *	    but that's a lot of unused bits so we'll use an int and keep our fingers
 *	    crossed.
 *
 *	@author	Robert France
 *	@see	ClassIDs	Table of defined IDs.
 *	@see	FullID
 *	<P>designer(s): Robert France (france@vt.edu)
 *	<P>implementator(s): Jianxin Zhao (jxzhao@csgrad.cs.vt.edu), Robert France
 */
public class ClassID		// extends Integer, if only JDK would let you.
{
	int value;

	public ClassID(int c)
	{
		if ( (c < 0) || (c > FullID.MAX_CLASS_ID) )
			value = 0;
		else
			value = c;
	}

	public boolean isValid()
	{
		return( value > 0 );
	}

	public int intValue()
	{
		return( value );
	}
			
}

