private GLListProperty(GLStateType type, List<IGLProperty> props) { mList = props; mType = type; for (IGLProperty p : mList) { p.setParent(this); } }
@Override public GLListProperty clone() { List<IGLProperty> props = new ArrayList<IGLProperty>(mList.size()); for (IGLProperty p : mList) { props.add(p.clone()); } return new GLListProperty(getType(), props); }
@Override public void prettyPrint(StatePrettyPrinter pp) { pp.prettyPrint(mType, null); pp.incrementIndentLevel(); for (int i = 0; i < mList.size(); i++) { pp.prettyPrint(String.format(Locale.US, "Index %d:", i)); IGLProperty p = mList.get(i); p.prettyPrint(pp); } pp.decrementIndentLevel(); }
/** * Construct a list of properties of given size from the provided template. * * @param template property that will be cloned and used as members of the list * @param size size of the list */ public GLListProperty(GLStateType type, IGLProperty template, int size) { mType = type; mTemplate = template; mList = new ArrayList<IGLProperty>(size); for (int i = 0; i < size; i++) { IGLProperty p = template.clone(); mList.add(p); p.setParent(this); } }
@Override public String toString() { StringBuffer sb = new StringBuffer(); sb.append("GLListProperty ["); // $NON-NLS-1$ int i = 0; for (IGLProperty p : mList) { sb.append(i); sb.append(':'); sb.append(p.toString()); sb.append(", "); // $NON-NLS-1$ i++; } sb.append("]"); return sb.toString(); }
public void set(int index, IGLProperty property) { ensureCapacity(index + 1); mList.set(index, property); property.setParent(this); }
public boolean add(IGLProperty property) { property.setParent(this); return mList.add(property); }