package Iterator;


import java.io.BufferedReader;
import java.io.InputStreamReader;

public abstract class Range<Int> extends IteratorHelper implements Runnable {
public Range(Runnable r) {
		super(r);
		// TODO Auto-generated constructor stub
	}
int low, high;
InputStreamReader ISR = new InputStreamReader(System.in); 
BufferedReader BR = new BufferedReader(ISR); 
int a [] = new int[50];
private static boolean ready;
IteratorHelper<Int> ih = new IteratorHelper();
Thread t2 = new Thread();

public void Range(int low,int high) {
this.low = low;
this.high = high;
}
public boolean hasNext() {
return ih.done();
}
public int next() {
return ih.get();
}
public void run()
{
	 try {
         for(int i = 5; i > 0; i--) {
            System.out.println("Child Thread: " + i);
              Thread.sleep(500);
               while (!ready)
            	Thread.yield();
            		
            	for (int i1 = low; i1<high; i1++) 
            	{
            		ih.yield(i1);
            	}
            	
            	}
            
            } catch (InterruptedException e) {
         System.out.println("Child interrupted.");
     }
     System.out.println("Exiting child thread.");
   }
 }

