c16947d24f18600ae7b0c4ee0bd0e76fa0fd1e49
[sbp.git] / src / edu / berkeley / sbp / Input.java
1 // Copyright 2006 all rights reserved; see LICENSE file for BSD-style license
2
3 package edu.berkeley.sbp;
4 import java.io.*;
5 import java.util.*;
6 import java.lang.reflect.*;
7 import java.lang.ref.*;
8 import edu.berkeley.sbp.*;
9 import edu.berkeley.sbp.util.*;
10
11 /** <font color=purple>a stream of <tt>Token</tt>s to be parsed</font> */
12 public interface Input<Token> {
13
14     /** returns the token just beyond the current location and advances beyond it */
15     public Token           next() throws IOException;
16
17     /** returns the location the input stream is currently at */
18     public Location<Token> getLocation();
19
20     /** <font color=purple>a location (position) in the input stream -- <i>between tokens</i></font> */
21     public static interface Location<Token> extends Comparable<Location> {
22
23         /** return the region between this location and <tt>loc</tt> */
24         public Region<Token> createRegion(Location<Token> loc);
25
26         public String toString();
27     }
28
29     /** <font color=purple>a contiguous set of <tt>Location</tt>s</font> */
30     public static interface Region<Token> /* implements Topology<Location<Tok>> */ {
31     }
32
33 }
34
35