#ifndef _LADDER_NODE_H_
#define _LADDER_NODE_H_

#include <string>
using namespace std;


struct LadderNode
{
  public:
    LadderNode (const string & newWord);

    bool IsEqual (const LadderNode & rhs) const;
    bool IsOneApart (const LadderNode & rhs) const;
    bool IsVisited () const;
    void Print (ostream & output) const;

    void Visit ();
    void DeriveFrom (LadderNode * ancestor);
    void Clear ();

  private:
    string myWord;
    bool myVisited;
    LadderNode * myAncestor;

};


inline
bool operator== (const LadderNode & lhs, const LadderNode & rhs)
{
    return lhs.isEqual(rhs);
}


inline
bool operator!= (const LadderNode & lhs, const LadderNode & rhs)
{
    return !(lhs == rhs);
}


inline
ostream & operator<< (ostream & output, const LadderNode & l)
{
    l.print(output);
    return output;
}


#endif
