Last change
on this file since 78 was
77,
checked in by psniegowski, 11 years ago
|
Add new java codebase.
|
File size:
839 bytes
|
Line | |
---|
1 | package com.framsticks.params; |
---|
2 | |
---|
3 | /** |
---|
4 | * @author Piotr Sniegowski |
---|
5 | */ |
---|
6 | public class SimpleSource implements SourceInterface { |
---|
7 | |
---|
8 | final String content; |
---|
9 | int cursor; |
---|
10 | |
---|
11 | public SimpleSource(String content) { |
---|
12 | this.content = content; |
---|
13 | cursor = 0; |
---|
14 | } |
---|
15 | |
---|
16 | @Override |
---|
17 | public String getFilename() { |
---|
18 | return "<String>"; |
---|
19 | } |
---|
20 | |
---|
21 | @Override |
---|
22 | public String readLine() { |
---|
23 | if (cursor >= content.length()) { |
---|
24 | return null; |
---|
25 | } |
---|
26 | int nextEndLine = content.indexOf('\n', cursor); |
---|
27 | if (nextEndLine == -1) { |
---|
28 | nextEndLine = content.length(); |
---|
29 | } |
---|
30 | String result = content.substring(cursor, nextEndLine); |
---|
31 | cursor = nextEndLine + 1; |
---|
32 | return result; |
---|
33 | } |
---|
34 | |
---|
35 | @Override |
---|
36 | public String demangleInclude(String include) { |
---|
37 | return null; |
---|
38 | } |
---|
39 | |
---|
40 | @Override |
---|
41 | public SourceInterface openInclude(String include) { |
---|
42 | return null; |
---|
43 | } |
---|
44 | |
---|
45 | @Override |
---|
46 | public void close() { |
---|
47 | |
---|
48 | } |
---|
49 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.