source: java/main/src/main/java/com/framsticks/util/lang/IterableIterator.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: 952 bytes
Line 
1package com.framsticks.util.lang;
2
3import java.util.Iterator;
4
5/**
6 * @author Piotr Sniegowski
7 */
8public class IterableIterator<T> implements Iterable<T> {
9
10        protected final Iterator<T> i;
11
12        // private static <T> Iterator<T> createIterator(final Iterator<? extends T> i) {
13        //      return new Iterator<T>() {
14
15        //              @Override
16        //              public boolean hasNext() {
17        //                      return i.hasNext();
18        //              }
19
20        //              @Override
21        //              public T next() {
22        //                      return i.next();
23        //              }
24
25        //              @Override
26        //              public void remove() {
27        //                      i.remove();
28        //              }
29        //      };
30        // }
31
32
33        @SuppressWarnings("unchecked")
34        public IterableIterator(Iterator<?> i) {
35                this.i = (Iterator<T>) i;
36        }
37
38        // public IterableIterator(Iterator<? extends T> i) {
39        //      this.i = createIterator(i);
40        // }
41
42        public Iterator<T> iterator() {
43                return i;
44        }
45
46
47        // @SuppressWarnings("unchecked")
48        // public static <T> IterableIterator<T> unsafe(Iterator<?> i) {
49        //      return new IterableIterator<T>((Iterator<T>) i);
50        // }
51
52}
Note: See TracBrowser for help on using the repository browser.