205 lines
6.0 KiB
Java
205 lines
6.0 KiB
Java
/*
|
|
* Decompiled with CFR 0.152.
|
|
*/
|
|
package com.tridium.collection;
|
|
|
|
import com.tridium.collection.BISortableTable;
|
|
import com.tridium.collection.GenericColumn;
|
|
import com.tridium.collection.GenericColumnList;
|
|
import com.tridium.collection.GenericCursor;
|
|
import com.tridium.util.ClassUtil;
|
|
import java.util.Comparator;
|
|
import javax.baja.collection.BICollection;
|
|
import javax.baja.collection.BIList;
|
|
import javax.baja.collection.BITable;
|
|
import javax.baja.collection.Column;
|
|
import javax.baja.collection.ColumnList;
|
|
import javax.baja.sys.BBoolean;
|
|
import javax.baja.sys.BComponent;
|
|
import javax.baja.sys.BFacets;
|
|
import javax.baja.sys.BNumber;
|
|
import javax.baja.sys.BObject;
|
|
import javax.baja.sys.BValue;
|
|
import javax.baja.sys.Cursor;
|
|
import javax.baja.sys.Sys;
|
|
import javax.baja.sys.Type;
|
|
import javax.baja.util.Array;
|
|
import javax.baja.util.IFilter;
|
|
|
|
/*
|
|
* Illegal identifiers - consider using --renameillegalidents true
|
|
*/
|
|
public class BGenericTable
|
|
extends BObject
|
|
implements BISortableTable {
|
|
public static final Type TYPE;
|
|
BComponent[] comps;
|
|
private GenericColumnList columns;
|
|
static /* synthetic */ Class class$com$tridium$collection$BGenericTable;
|
|
|
|
public Type getType() {
|
|
return TYPE;
|
|
}
|
|
|
|
public Cursor cursor() {
|
|
return new GenericCursor(this);
|
|
}
|
|
|
|
public BICollection filter(IFilter iFilter) {
|
|
return new BGenericTable((BComponent[])new Array(this.comps).filter(iFilter).trim(), this.columns);
|
|
}
|
|
|
|
public BIList toList() {
|
|
return this;
|
|
}
|
|
|
|
public int size() {
|
|
return this.comps.length;
|
|
}
|
|
|
|
public BObject get(int n) {
|
|
return this.comps[n];
|
|
}
|
|
|
|
public BObject[] list() {
|
|
BObject[] bObjectArray = new BComponent[this.comps.length];
|
|
System.arraycopy(this.comps, 0, bObjectArray, 0, this.comps.length);
|
|
return bObjectArray;
|
|
}
|
|
|
|
public BObject[] list(BObject[] bObjectArray) {
|
|
return this.list();
|
|
}
|
|
|
|
public BITable toTable() {
|
|
return this;
|
|
}
|
|
|
|
public ColumnList getColumns() {
|
|
return this.columns;
|
|
}
|
|
|
|
public BObject get(int n, Column column) {
|
|
return this.comps[n].get(column.getName());
|
|
}
|
|
|
|
public String getString(int n, Column column) {
|
|
return this.comps[n].get(column.getName()).toString();
|
|
}
|
|
|
|
public double getDouble(int n, Column column) {
|
|
return this.number(n, column).getDouble();
|
|
}
|
|
|
|
public float getFloat(int n, Column column) {
|
|
return this.number(n, column).getFloat();
|
|
}
|
|
|
|
public int getInt(int n, Column column) {
|
|
return this.number(n, column).getInt();
|
|
}
|
|
|
|
public long getLong(int n, Column column) {
|
|
return this.number(n, column).getLong();
|
|
}
|
|
|
|
public boolean getBoolean(int n, Column column) {
|
|
return this.bool(n, column).getBoolean();
|
|
}
|
|
|
|
public int getFlags(int n, Column column) {
|
|
return 0;
|
|
}
|
|
|
|
public BFacets getFacets(int n, Column column) {
|
|
return BFacets.NULL;
|
|
}
|
|
|
|
public BFacets getTableFacets() {
|
|
return BFacets.NULL;
|
|
}
|
|
|
|
public BITable sort(Column column, boolean bl) {
|
|
if (this.comps.length == 0) {
|
|
return this;
|
|
}
|
|
return new BGenericTable((BComponent[])new Array(this.comps).sort(new GenericTableComparator(column, bl)).trim(), this.columns);
|
|
}
|
|
|
|
private final BNumber number(int n, Column column) {
|
|
return (BNumber)this.comps[n].get(column.getName());
|
|
}
|
|
|
|
private final BBoolean bool(int n, Column column) {
|
|
return (BBoolean)this.comps[n].get(column.getName());
|
|
}
|
|
|
|
static /* synthetic */ Class class(String string, boolean bl) {
|
|
try {
|
|
Class<?> clazz = Class.forName(string);
|
|
if (!bl) {
|
|
clazz = clazz.getComponentType();
|
|
}
|
|
return clazz;
|
|
}
|
|
catch (ClassNotFoundException classNotFoundException) {
|
|
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
|
}
|
|
}
|
|
|
|
public BGenericTable(BComponent[] bComponentArray, GenericColumnList genericColumnList) {
|
|
if (bComponentArray.length > 0 && !ClassUtil.sameClass(bComponentArray)) {
|
|
throw new IllegalArgumentException();
|
|
}
|
|
this.comps = bComponentArray;
|
|
this.columns = genericColumnList;
|
|
}
|
|
|
|
public BGenericTable(BComponent[] bComponentArray) {
|
|
if (bComponentArray.length > 0 && !ClassUtil.sameClass(bComponentArray)) {
|
|
throw new IllegalArgumentException();
|
|
}
|
|
this.comps = bComponentArray;
|
|
this.columns = new GenericColumnList(bComponentArray);
|
|
}
|
|
|
|
public BGenericTable() {
|
|
this.comps = new BComponent[0];
|
|
this.columns = new GenericColumnList(new GenericColumn[0]);
|
|
}
|
|
|
|
static {
|
|
Class clazz = class$com$tridium$collection$BGenericTable;
|
|
if (clazz == null) {
|
|
clazz = class$com$tridium$collection$BGenericTable = BGenericTable.class("[Lcom.tridium.collection.BGenericTable;", false);
|
|
}
|
|
TYPE = Sys.loadType(clazz);
|
|
}
|
|
|
|
/*
|
|
* Illegal identifiers - consider using --renameillegalidents true
|
|
*/
|
|
private class GenericTableComparator
|
|
implements Comparator {
|
|
private Column col;
|
|
private boolean ascending;
|
|
|
|
public int compare(Object object, Object object2) {
|
|
BComponent bComponent = (BComponent)object;
|
|
BComponent bComponent2 = (BComponent)object2;
|
|
BValue bValue = bComponent.get(this.col.getName());
|
|
BValue bValue2 = bComponent2.get(this.col.getName());
|
|
if (bValue instanceof Comparable) {
|
|
return this.ascending ? ((Comparable)((Object)bValue)).compareTo(bValue2) : -((Comparable)((Object)bValue)).compareTo(bValue2);
|
|
}
|
|
return this.ascending ? bValue.toString().compareTo(bValue2.toString()) : -bValue.toString().compareTo(bValue2.toString());
|
|
}
|
|
|
|
private GenericTableComparator(Column column, boolean bl) {
|
|
this.col = column;
|
|
this.ascending = bl;
|
|
}
|
|
}
|
|
}
|
|
|