// Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/kpdus/jad.html
// Decompiler options: packimports(3)
// Source File Name: TBranchClones.java
package hep.rootio.reps;
import hep.rootio.*;
import hep.rootio.implementation.*;
import hep.rootio.interfaces.TBranch;
import hep.rootio.interfaces.TClonesArray;
import java.io.IOException;
import java.util.AbstractList;
import java.util.Hashtable;
// Referenced classes of package hep.rootio.reps:
// TBranch, TObjArray
public class TBranchClones extends SpecificRootObject
{
static class HollowArray extends AbstractList
implements TClonesArray
{
public int size()
{
return size;
}
public Object get(int cloneIndex)
{
HollowRootObject ho = (HollowRootObject)objectClass.newInstance();
ho.setHollow((TBranch)branch.getProxy());
ho.setHollowIndex(hollowIndex);
ho.setCloneIndex(cloneIndex);
return ho.getProxy();
}
public int getLowerBound()
{
return 0;
}
public int getUpperBound()
{
return size - 1;
}
public Object getElementAt(int index)
{
return get(index);
}
private int size;
private int hollowIndex;
private RootClass objectClass;
private TBranchClones branch;
HollowArray(int size, int hollowIndex, RootClass objectClass, TBranchClones branch)
{
this.size = size;
this.objectClass = objectClass;
this.hollowIndex = hollowIndex;
this.branch = branch;
}
}
public TBranchClones()
{
}
public void readMembers(RootInput in, int v)
throws IOException
{
super.readMembers(in, v);
count = (hep.rootio.reps.TBranch)get("fBranchCount");
try
{
RootClassFactory cf = in.getFactory();
objectClass = cf.create(get("fClassName").toString());
}
catch(RootClassNotFound x)
{
throw new IOException("Could not find BranchClones class " + x.getClassName());
}
}
public int getNEntries()
{
return ((Number)get("fEntries")).intValue();
}
public Object getEntry(int index)
throws IOException
{
int l = ((Integer)count.getEntry(index)).intValue();
return new HollowArray(l, index, objectClass, this);
}
public RootObjectRepresentation getBranchForName(String name)
{
if(map == null)
buildMap();
return (RootObjectRepresentation)map.get(name);
}
public RootObjectRepresentation getBranchForMangledName(String name)
{
if(map == null)
buildMap();
return (RootObjectRepresentation)mangledMap.get(name);
}
private void buildMap()
{
map = new Hashtable();
mangledMap = new Hashtable();
TObjArray branches = (TObjArray)get("fBranches");
int size = branches.size();
for(int i = 0; i < size; i++)
{
RootObjectRepresentation b = branches.elementAt(i);
String bName = b.get("fName").toString();
int pos = bName.indexOf('[');
if(pos > 0)
bName = bName.substring(0, pos);
pos = bName.indexOf('.');
if(pos > 0)
bName = bName.substring(pos + 1);
map.put(bName, b);
mangledMap.put(nameMangler.mangleMember(bName), b);
}
}
private RootClass objectClass;
private hep.rootio.reps.TBranch count;
private Hashtable map;
private Hashtable mangledMap;
private static final NameMangler nameMangler = NameMangler.instance();
}
Ads help maintain this website.