#include "visman.h"
#include "kdtreelog.h"

class KDTreeFindPointVis : public Vis {
protected:
  const LogEntry *_start;
  const LogEntry *_end;
  int isAparentofB(const LogEntry *A, const LogEntry *B);

public:
  KDTreeFindPointVis (const Vis *parent, const LogEntry *someevent) : Vis (parent, someevent) {
    strcpy (_type, "KDTreeFindPointVis");

    const LogEntry* temp = someevent;
    _start = temp;

    while (isAparentofB(temp->_prev, temp)) {
      _start = temp->_prev;
      temp = temp->_prev;
    }

    const LogEntry* temp2 = someevent;
    _end = temp2;

    while (isAparentofB(temp2, temp2->_next)) {
      _end = temp2->_next;
      temp2 = temp2->_next;
    }
  }


  const LogEntry *GetStartEntry (void) const {return _start;}

  void Display (const LogEntry *upto) const; 

  char *StatusLine (const LogEntry *ours) const;

  int IsOurs (const LogEntry *en) const;
  int IsStartEvent (const LogEntry *en) const {return (en == _start);}
  int IsEndEvent (const LogEntry *en) const {return (en == _end);}

};



                                                         
                                                                                                                                                           
