DALine.cpp #1

  • //
  • guest/
  • sam_stafford/
  • deepannotate/
  • DALine.cpp
  • View
  • Commits
  • Open Download .zip Download (1 KB)
#include "DALine.h"

#include <stdio.h>

DALine::DALine( DAFile* f, int ID, int up, int lo )
:textID( ID ), upper( up ), lower( lo ), file( f )
{
	prev = this;
	next = this;
	tooth = 0x0;
	anc = 0x0;
}

DALine::~DALine(void)
{
	prev->next = next;
	next->prev = prev;
}

void DALine::prependLine( DALine* line )
{
	line->next = this;
	line->prev = prev;
	prev->next = line;
	this->prev = line;
}

DALine* DALine::ancestor()
{
	if ( anc == this ) return 0x0;

	return anc;
}

DALine* DALine::nextAsOf( int rev )
{
	//Next line did not exist yet at rev?
	if ( next->lowerRev() && next->lowerRev() > rev )
		return next->nextAsOf( rev );

	//Next line removed at or before rev?
	if ( next->upperRev() && next->upperRev() < rev )
		return next->nextAsOf( rev );

	return next;
}

DALine* DALine::prevAsOf( int rev )
{
	//Prev line did not exist yet at rev?
	if ( prev->lowerRev() && prev->lowerRev() > rev )
		return prev->prevAsOf( rev );

	//Prev line removed at or before rev?
	if ( prev->upperRev() && prev->upperRev() < rev )
		return prev->prevAsOf( rev );

	return prev;
}

DALine* DALine::nextToothed()
{
	if ( next->text() && !next->getTooth() )
		return next->nextToothed();

	return next;
}

DALine* DALine::prevToothed()
{
	if ( prev->text() && !prev->getTooth() )
		return prev->prevToothed();

	return prev;
}
# Change User Description Committed
#1 6297 Sam Stafford Work so far on "deep annotate".
 Been getting a lot of questions on
this lately from other people working on the same thing; might as well
pool efforts.