source: java/main/src/main/java/com/framsticks/params/ListSource.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: 1.1 KB
Line 
1package com.framsticks.params;
2
3import java.util.ArrayList;
4import java.util.Iterator;
5import java.util.List;
6
7public class ListSource implements SourceInterface {
8
9        private Iterator<String> iterator = null;
10        //private final List<String> source;
11
12        public ListSource(List<String> source) {
13                //this.source = source;
14                iterator = source.iterator();
15        }
16
17        @Override
18        public String getFilename() {
19                return "<net>";
20        }
21
22        @Override
23        public String readLine() {
24                // if (iterator == null) {
25                //      return null;
26                // }
27                assert iterator != null;
28                if (iterator.hasNext()) {
29                        return iterator.next();
30                }
31                return null;
32        }
33
34        @Override
35        public String demangleInclude(String include) {
36                return null;
37        }
38
39        @Override
40        public SourceInterface openInclude(String include) {
41                return null;
42        }
43
44        @Override
45        public void close() {
46                iterator = null;
47        }
48
49        public static ListSource createFrom(String... lines) {
50                List<String> list = new ArrayList<String>();
51                for (String l : lines) {
52                        list.add(l);
53                }
54                return new ListSource(list);
55        }
56
57        @Override
58        public boolean isClosed() {
59                return iterator == null;
60        }
61}
Note: See TracBrowser for help on using the repository browser.