Changeset 90 for java/main/src/main/java/com/framsticks/params/Group.java
- Timestamp:
- 07/02/13 16:20:07 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
java/main/src/main/java/com/framsticks/params/Group.java
r87 r90 1 1 package com.framsticks.params; 2 2 3 import java.util.ArrayList;4 3 import java.util.List; 4 5 import javax.annotation.concurrent.Immutable; 5 6 6 7 import com.framsticks.params.annotations.FramsClassAnnotation; 7 8 import com.framsticks.params.annotations.ParamAnnotation; 9 import com.framsticks.util.lang.Containers; 8 10 9 11 /** … … 11 13 */ 12 14 @FramsClassAnnotation 15 @Immutable 13 16 public class Group { 14 17 15 18 @ParamAnnotation 16 protected String name;19 protected final String name; 17 20 18 21 /** 19 22 * Group members. 20 23 */ 21 List<Param> params = new ArrayList<Param>();24 protected final List<Param> params; 22 25 23 public Group(String name) { 24 this.name = name; 25 } 26 27 /** 28 * Adds new group member. 29 * 30 * @param p the new group member 31 */ 32 void addProperty(Param p) { 33 params.add(p); 26 public Group(GroupBuilder builder) { 27 this.name = builder.getName(); 28 this.params = builder.getParams(); 34 29 } 35 30 … … 40 35 * @return the property 41 36 */ 42 Param getProperty(int i) { 43 if (i < 0 || i >= params.size()) 44 return null; 45 return params.get(i); 37 public Param getParam(int number) { 38 return Containers.getFromList(params, number, "param", this); 46 39 } 47 40 48 41 @Override 49 42 public String toString() { 50 return name;43 return "group" + name; 51 44 } 52 45 … … 59 52 } 60 53 54 public int getCount() { 55 return params.size(); 56 } 57 61 58 }
Note: See TracChangeset
for help on using the changeset viewer.