/* * Decompiled with CFR 0.152. */ package com.tridium.collection; import com.tridium.collection.GenericColumn; import com.tridium.util.ClassUtil; import java.util.HashMap; import java.util.Map; import javax.baja.collection.Column; import javax.baja.collection.ColumnList; import javax.baja.sys.BComponent; import javax.baja.sys.Property; import javax.baja.sys.Type; /* * Illegal identifiers - consider using --renameillegalidents true */ public class GenericColumnList implements ColumnList { private GenericColumn[] columns; private Map getHash; private Map idxHash; public int size() { return this.columns.length; } public Column get(int n) { return this.columns[n]; } public Column get(String string) { return (Column)this.getHash.get(string); } public int indexOf(String string) { Integer n = (Integer)this.idxHash.get(string); return n == null ? -1 : n; } public Column[] list() { return this.columns; } private final /* synthetic */ void this() { this.getHash = new HashMap(); this.idxHash = new HashMap(); } public GenericColumnList(GenericColumn[] genericColumnArray) { this.this(); this.columns = genericColumnArray; int n = 0; while (n < genericColumnArray.length) { String string = genericColumnArray[n].getName(); this.getHash.put(string, genericColumnArray[n]); this.idxHash.put(string, new Integer(n)); ++n; } } public GenericColumnList(BComponent[] bComponentArray) { this.this(); if (bComponentArray.length > 0 && !ClassUtil.sameClass(bComponentArray)) { throw new IllegalArgumentException(); } if (bComponentArray.length == 0) { this.columns = new GenericColumn[0]; } else { BComponent bComponent = bComponentArray[0]; Property[] propertyArray = bComponent.getPropertiesArray(); int n = propertyArray.length; String[] stringArray = new String[n]; String[] stringArray2 = new String[n]; int n2 = 0; while (n2 < n) { stringArray[n2] = propertyArray[n2].getName(); stringArray2[n2] = bComponent.getDisplayName(propertyArray[n2], null); ++n2; } Type[] typeArray = new Type[n]; int n3 = 0; while (n3 < n) { typeArray[n3] = propertyArray[n3].getType(); ++n3; } this.columns = new GenericColumn[n]; n3 = 0; while (n3 < n) { this.columns[n3] = new GenericColumn(stringArray[n3], stringArray2[n3], typeArray[n3]); this.getHash.put(stringArray[n3], this.columns[n3]); this.idxHash.put(stringArray[n3], new Integer(n3)); ++n3; } } } }