key0-96/
key0-96/doc/key/
key0-96/doc/key/credits/
key0-96/doc/key/developers/
key0-96/doc/key/developers/resources/
key0-96/setup/caves/
key0-96/setup/help/
key0-96/setup/ruins/
key0-96/src/
key0-96/src/commands/
key0-96/src/events/
key0-96/src/hack/
key0-96/src/sql/
key0-96/src/swing/
key0-96/src/talker/forest/
key0-96/src/talker/objects/
key0-96/src/terminals/
/*
**               j###t  ########## ####   ####
**              j###t   ########## ####   ####
**             j###T               "###L J###"
**          ######P'    ##########  #########
**          ######k,    ##########   T######T
**          ####~###L   ####
**          #### q###L  ##########   .#####
**          ####  \###L ##########   #####"
**
**  $Id$
**
**  Class History
**
**  Date        Name         Description
**  ---------|------------|-----------------------------------------------
**  19Aug98     subtle       start of recorded history
**
*/

package key.util;

/**
  * To reference the null property or the null atom, you need to just
  * specify a trailing '.' or '/', respectively.
 */
public final class SeperatedIdentifier
	implements java.io.Serializable
{
	public String id="";
	public String location="";
	public boolean property;
	
	public SeperatedIdentifier( String fullId ) throws IllegalArgumentException
	{
		int lastSlash = fullId.lastIndexOf( '/' );
		int lastAt = fullId.lastIndexOf( '@' );
		int lastPeriod = fullId.lastIndexOf( '.' );
		String prepend = "";
		
		if( lastSlash >= 0 || lastPeriod >= 0 || lastAt >= 0 )
		{
			int a = Math.max( lastSlash, lastAt );
			a = Math.max( a, lastPeriod );
			
			int skip;
			
			if( a == lastAt )
				skip = 0;
			else
				skip = 1;
			
			if( a == lastPeriod )
				property = true;
			else
				property = false;
			
			if( a == -1 )
			{
				location = "";
				id = fullId;
			}
			else if( a < (fullId.length()-1) )
			{
				id = fullId.substring( a + skip );
				
				location = fullId.substring( 0, a );
			}
			else
			{
				location = fullId;
				id = "";
			}
		}
		else
		{
			location = "";
			id = fullId;
		}

		//Log.debug( this, "From: '" + fullId + "': Location '" + location + "' Id '" + id + "'" );
	}
}