// 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: HollowRootObject.java
package hep.rootio.implementation;
import hep.rootio.*;
import hep.rootio.interfaces.TBranch;
import java.io.IOException;
import java.lang.reflect.Array;
// Referenced classes of package hep.rootio.implementation:
// AbstractRootObject
public abstract class HollowRootObject extends AbstractRootObject
{
public HollowRootObject()
{
cloneIndex = -1;
result = null;
}
public void setHollow(TBranch branch)
{
this.branch = branch;
}
public void setHollowIndex(int index)
{
this.index = index;
}
public void setCloneIndex(int index)
{
cloneIndex = index;
}
public Object get(String name)
{
if(branch == null)
return super.get(name);
try
{
TBranch sub = branch.getBranchForName(name);
if(sub != null)
{
Object result = sub.getEntry(index);
if(cloneIndex >= 0 && result.getClass().isArray())
return Array.get(result, cloneIndex);
else
return result;
}
RootMember members[] = getRootClass().getMembers();
for(int j = 0; j < members.length; j++)
if(members[j].getName().equals(name))
{
RootClass k = members[j].getType();
HollowRootObject ho = (HollowRootObject)k.newInstance();
ho.setHollow(branch);
ho.setHollowIndex(index);
if(cloneIndex >= 0)
ho.setCloneIndex(cloneIndex);
return ho;
}
return null;
}
catch(IOException x)
{
x.printStackTrace();
}
throw new RuntimeException("IOException while accessing " + name);
}
public Object getMangled(String name)
{
if(branch == null)
return super.getMangled(name);
try
{
TBranch sub = branch.getBranchForMangledName(name);
if(sub != null)
{
Object result = sub.getEntry(index);
if(cloneIndex >= 0 && result.getClass().isArray())
return Array.get(result, cloneIndex);
else
return result;
}
RootMember members[] = getRootClass().getMembers();
for(int j = 0; j < members.length; j++)
if(nameMangler.mangleMember(members[j].getName()).equals(name))
{
RootClass k = members[j].getType();
HollowRootObject ho = (HollowRootObject)k.newInstance();
ho.setHollow(branch);
ho.setHollowIndex(index);
if(cloneIndex >= 0)
ho.setCloneIndex(cloneIndex);
return ho;
}
return null;
}
catch(IOException x)
{
x.printStackTrace();
}
throw new RuntimeException("IOException while accessing " + name);
}
private TBranch branch;
private int index;
private int cloneIndex;
private Object result;
private static final NameMangler nameMangler = NameMangler.instance();
}
Ads help maintain this website.