KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > SOFA > SOFAnode > Made > CDL > LineInfo


1 /* $Id: LineInfo.java,v 1.1.1.1 2003/02/11 16:19:40 bures Exp $ */
2 package SOFA.SOFAnode.Made.CDL;
3
4 class LineInfo {
5   List lines;
6
7   public LineInfo() {
8     lines = new List();
9   }
10
11   public void add(int l, int c) {
12     if (lines.size()!=0) {
13       lines.toLast();
14       if (((linfo) lines.aktual()).lcnt == l)
15         return;
16     }
17     linfo a = new linfo(l,c);
18     lines.add(a);
19   }
20
21   public int errorLine(int c) {
22     if (lines.size()!=0) {
23       lines.toLast();
24       for(int i=0;i<lines.size();i++) {
25         if (((linfo)lines.aktual()).ccnt <= c)
26           return ((linfo)lines.aktual()).lcnt;
27         lines.toPrev();
28       }
29     }
30     return 0;
31   }
32 }
33
34 class linfo {
35   int lcnt; // line
36
int ccnt; // char
37

38   public linfo(int l, int c) {
39     lcnt = l; ccnt = c;
40   }
41 }
42
Popular Tags