head     1.2;
branch   ;
access   ;
symbols  ;
locks    ; strict;
comment  @// @;


1.2
date     92.08.14.15.48.07;  author thoth;  state Exp;
branches ;
next     1.1;

1.1
date     92.07.26.16.48.32;  author thoth;  state Exp;
branches ;
next     ;


desc
@implementation of the Yoder point set iterator.
@


1.2
log
@Iterators no longer use multiple inheritance.  They now use
IntPointSets (and the hashing that implies).
@
text
@// Emacs: -*- C++ -*-
static char rcsid[] = "$Id: YoderIPSIter.cc,v 1.1 92/07/26 16:48:32 thoth Exp Locker: thoth $";

// 
// $Log:	YoderIPSIter.cc,v $
// Revision 1.1  92/07/26  16:48:32  thoth
// Initial revision
// 
// 

#include "IPSIter.h"
#include "YoderIPSIter.h"

#pragma implementation

YoderIPSIter::YoderIPSIter(const IntPointSet &ips, YoderIPS *y)
:BaseIPSIter(ips)
{
    yoder = y;

    curr = yoder->lastbefore+1;
    sliceidx = 0;
    subiter = 0;
}

YoderIPSIter::YoderIPSIter(const YoderIPSIter &x)
:BaseIPSIter(x.domain)
{
    yoder = x.yoder;
    curr = x.curr;
    sliceidx = x.sliceidx;
    subiter = x.subiter ? (new IPSIter(*x.subiter)) : 0;
}

int YoderIPSIter::next(IntPoint& ip)
{
    while (sliceidx < yoder->nslices) {
	if (!subiter) {
	    // cout << "\n [" << yoder->dimen << "]new slice at " << curr << " index " << sliceidx << ' ';
	    subiter = new IPSIter(yoder->slices[sliceidx].shadow);
	}

	if ((*subiter)(ip)) {
	    ip = concat(curr,ip);
	    return 1;
	}

	curr++;
	// empty() optimization
	
	if (curr<= yoder->slices[sliceidx].last) {
	    // cout << "\n [" << yoder->dimen << "]resetting slice iter for new curr" << curr << ' ';
	    subiter->reset();
	    continue;
	}

	delete subiter;
	subiter=0;

	sliceidx++;
    }
#if 0
    // gratuitous
    if (subiter) {
	delete subiter;
	subiter=0;
    }
#endif
    return 0;
}
@


1.1
log
@Initial revision
@
text
@d2 1
a2 1
static char rcsid[] = "$Id$";
d5 3
a7 1
// $Log$
d9 1
d16 2
a17 2
YoderIPSIter::YoderIPSIter(const YoderIPS &yps)
:YoderIPS(yps)
d19 3
a21 1
    curr = this->lastbefore+1;
d26 9
d37 1
a37 1
    while (sliceidx < this->nslices) {
d39 2
a40 2
	    // cout << "\n [" << this->dimen << "]new slice at " << curr << " index " << sliceidx << ' ';
	    subiter = new IPSIter(this->slices[sliceidx].shadow);
d49 4
a52 2
	if (curr<= this->slices[sliceidx].last) {
	    // cout << "\n [" << this->dimen << "]resetting slice iter for new curr" << curr << ' ';
d62 2
d68 1
@
