// Finger.H
//

//	JR
//	4/16/96	Written and tested.


class Finger
{
	// The nth point on a directed edge, e, that gets mapped by g
	// to a vertex.
	// (e,0) is the origin of e.
	// (e,|image of e|) is the terminus of e.
	
	private:
		DE mye;
		int myn;

	public:

   public:
	Finger()					// non-initializing constructor
	   : mye(0,0), myn(0)
	{ //  	assert(0); 			// This should never be called.
	  // Had to allow this because new LinList has 2 dummy nodes. 10/16/95
	}

   	Finger(const Finger& f)				// copy constructor
	   : mye(f.mye), myn(f.myn)
	{}	
							
   	Finger(const DE& ee, int nn)				//constructor
	   : mye(ee), myn(nn)
	{}	
       ~Finger()
	{}

	const DE& e() const
	{	return mye;
	}

	DE& e()
	{	return mye;
	}

	int n() const
	{	return myn;
	}

	int& n()
	{	return myn;
	}

	Finger& operator=(const Finger& f);

	Boolean operator==(const Finger& f) const
	{	return ( ((*this).myn==f.myn) && ((*this).mye==f.mye) );
	}

	Boolean operator!=(const Finger& f) const
	{	return ( ((*this).myn!=f.myn) || ((*this).mye!=f.mye) );
	}

	friend ostream& operator << ( ostream& out, const Finger& f );
	friend istream& operator >> ( istream& in, Finger& f );   

};

Finger& Finger::operator=(const Finger& f)
{
	if(this==&f) return *this;
	mye=f.mye;
	myn=f.myn;
	return *this;
}

ostream& operator << ( ostream& out, const Finger& f )
{	out <<  f.mye << "." << f.myn;
	return out;
}

istream& operator >> ( istream& in, Finger& f )
{
	char c;
/**
	while( in.get(c) )	// eat white space and (
	{
		if( c!=' ' && c!='\t' && c!='\n' )
		{
			in.putback(c);
			break;
		}
	}
**/
	in >> f.mye;

	while( in.get(c) )	// eat comma
	{
		if( c=='.' ) break;
	}
	in >> f.myn;

/**
	while( in.get(c) )	// eat white space and )
	{
		if( c==')' ) break;
	}
**/
	return in;
}
