source: java/main/src/main/java/com/framsticks/params/SimpleSource.java @ 86

Last change on this file since 86 was 86, checked in by psniegowski, 11 years ago

HIGHLIGHTS:

  • use java annotations to mark classes and fields to be used when:
    • using java classes with ReflectionAccess? to represent remote objects with FramsClass? description found by "info ..." requests
    • to build up FramsClass? representation of objects not present at remote server
  • allow using primitive types (instead of wraping counterparts) in reflected classes
  • rework FramsClass? creation process (add FramsClassBuilder?)
  • add more tests

CHANGELOG:
Prepare model.World class.

Minor change.

Use primitive types for Genotype and Creature classes.

Use primitive types in model.Neuro* classes.

Use primitive types in model.Joint* classes.

Use primitive types in model.Part* classes.

Fix primitive values.

Extract FramsClassBuilder?.

Add tests of Model classes.

More fixes.

Refactorize out ParamCandidate?.

Several fixes.

Fix all regressions after introducing annotations.

Use annotations throughout the project.

Add exception classes.

Improve creation of FramsClass?.

More changes.

Many changes regarding annotations.

Annotate classes in com.framsticks.model package.

Remove manual FramsClass? constructor.

Construct FramsClass? for Creature. Add test.

Add default values to the ParamAnnotation?.

Add ParamBuilderTest? and ParamAnnotation?.

Add FramsClassAnnotation?.

File size: 962 bytes
Line 
1package com.framsticks.params;
2
3/**
4 * @author Piotr Sniegowski
5 */
6public class SimpleSource implements SourceInterface {
7
8        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                assert !isClosed();
24                if (cursor >= content.length()) {
25                        return null;
26                }
27                int nextEndLine = content.indexOf('\n', cursor);
28                if (nextEndLine == -1) {
29                        nextEndLine = content.length();
30                }
31                String result = content.substring(cursor, nextEndLine);
32                cursor = nextEndLine + 1;
33                return result;
34        }
35
36        @Override
37        public String demangleInclude(String include) {
38                return null;
39        }
40
41        @Override
42        public SourceInterface openInclude(String include) {
43                return null;
44        }
45
46        @Override
47        public void close() {
48                content = null;
49        }
50
51        //TODO no magic numbers
52        @Override
53        public boolean isClosed() {
54                return content != null;
55        }
56
57}
Note: See TracBrowser for help on using the repository browser.