Skip to content

Commit

Permalink
More descriptive method names in ObjectTree.
Browse files Browse the repository at this point in the history
  • Loading branch information
altaite committed Mar 28, 2017
1 parent 07425c1 commit 72e468e
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 66 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,45 +19,45 @@ public class MmtfStructureFactory {

public MmtfStructure create(ObjectTree tree) {
MmtfStructure s = new MmtfStructure();
s.setxCoordList(tree.ba("xCoordList"));
s.setyCoordList(tree.ba("yCoordList"));
s.setzCoordList(tree.ba("zCoordList"));
s.setbFactorList(tree.ba("bFactorList"));
s.setOccupancyList(tree.ba("occupancyList"));
s.setNumAtoms(tree.i("numAtoms"));
s.setAtomIdList(tree.ba("atomIdList"));
s.setAltLocList(tree.ba("altLocList"));
s.setInsCodeList(tree.ba("insCodeList"));
s.setGroupIdList(tree.ba("groupIdList"));
s.setGroupList(createGroupList(tree.oa("groupList")));
s.setSequenceIndexList(tree.ba("sequenceIndexList"));
s.setGroupTypeList(tree.ba("groupTypeList"));
s.setChainNameList(tree.ba("chainNameList"));
s.setChainIdList(tree.ba("chainIdList"));
s.setNumBonds(tree.i("numBonds"));
s.setBondAtomList(tree.ba("bondAtomList"));
s.setBondOrderList(tree.ba("bondOrderList"));
s.setSecStructList(tree.ba("secStructList"));
s.setChainsPerModel(tree.ia("chainsPerModel"));
s.setGroupsPerChain(tree.ia("groupsPerChain"));
s.setSpaceGroup(tree.s("spaceGroup"));
s.setUnitCell(tree.fa("unitCell"));
s.setBioAssemblyList(createBioAssemblyList(tree.oa("bioAssemblyList")));
s.setMmtfVersion(tree.s("mmtfVersion"));
s.setMmtfProducer(tree.s("mmtfProducer"));
s.setEntityList(createEntityList(tree.oa("entityList")));
s.setStructureId(tree.s("structureId"));
s.setrFree(tree.f("rFree"));
s.setrWork(tree.f("rWork"));
s.setResolution(tree.f("resolution"));
s.setTitle(tree.s("title"));
s.setExperimentalMethods(tree.sa("experimentalMethods"));
s.setDepositionDate(tree.s("depositionDate"));
s.setReleaseDate(tree.s("releaseDate"));
s.setNumGroups(tree.i("numGroups"));
s.setNumChains(tree.i("numChains"));
s.setNumModels(tree.i("numModels"));
s.setNcsOperatorList(tree.daa("ncsOperatorList"));
s.setxCoordList(tree.getByteArray("xCoordList"));
s.setyCoordList(tree.getByteArray("yCoordList"));
s.setzCoordList(tree.getByteArray("zCoordList"));
s.setbFactorList(tree.getByteArray("bFactorList"));
s.setOccupancyList(tree.getByteArray("occupancyList"));
s.setNumAtoms(tree.getInt("numAtoms"));
s.setAtomIdList(tree.getByteArray("atomIdList"));
s.setAltLocList(tree.getByteArray("altLocList"));
s.setInsCodeList(tree.getByteArray("insCodeList"));
s.setGroupIdList(tree.getByteArray("groupIdList"));
s.setGroupList(createGroupList(tree.getObjectArray("groupList")));
s.setSequenceIndexList(tree.getByteArray("sequenceIndexList"));
s.setGroupTypeList(tree.getByteArray("groupTypeList"));
s.setChainNameList(tree.getByteArray("chainNameList"));
s.setChainIdList(tree.getByteArray("chainIdList"));
s.setNumBonds(tree.getInt("numBonds"));
s.setBondAtomList(tree.getByteArray("bondAtomList"));
s.setBondOrderList(tree.getByteArray("bondOrderList"));
s.setSecStructList(tree.getByteArray("secStructList"));
s.setChainsPerModel(tree.getIntArray("chainsPerModel"));
s.setGroupsPerChain(tree.getIntArray("groupsPerChain"));
s.setSpaceGroup(tree.getString("spaceGroup"));
s.setUnitCell(tree.getFloatArray("unitCell"));
s.setBioAssemblyList(createBioAssemblyList(tree.getObjectArray("bioAssemblyList")));
s.setMmtfVersion(tree.getString("mmtfVersion"));
s.setMmtfProducer(tree.getString("mmtfProducer"));
s.setEntityList(createEntityList(tree.getObjectArray("entityList")));
s.setStructureId(tree.getString("structureId"));
s.setrFree(tree.getFloat("rFree"));
s.setrWork(tree.getFloat("rWork"));
s.setResolution(tree.getFloat("resolution"));
s.setTitle(tree.getString("title"));
s.setExperimentalMethods(tree.getStringArray("experimentalMethods"));
s.setDepositionDate(tree.getString("depositionDate"));
s.setReleaseDate(tree.getString("releaseDate"));
s.setNumGroups(tree.getInt("numGroups"));
s.setNumChains(tree.getInt("numChains"));
s.setNumModels(tree.getInt("numModels"));
s.setNcsOperatorList(tree.getDoubleArray2d("ncsOperatorList"));
return s;
}

Expand All @@ -72,14 +72,14 @@ private Group[] createGroupList(Object[] array) {
private Group createGroup(Object o) {
ObjectTree t = new ObjectTree((Hashtable<String, Object>) o);
Group g = new Group();
g.setGroupName(t.s("groupName"));
g.setAtomNameList(t.sa("atomNameList"));
g.setElementList(t.sa("elementList"));
g.setBondOrderList(t.ia("bondOrderList"));
g.setBondAtomList(t.ia("bondAtomList"));
g.setFormalChargeList(t.ia("formalChargeList"));
g.setSingleLetterCode(t.s("singleLetterCode").charAt(0));
g.setChemCompType(t.s("chemCompType"));
g.setGroupName(t.getString("groupName"));
g.setAtomNameList(t.getStringArray("atomNameList"));
g.setElementList(t.getStringArray("elementList"));
g.setBondOrderList(t.getIntArray("bondOrderList"));
g.setBondAtomList(t.getIntArray("bondAtomList"));
g.setFormalChargeList(t.getIntArray("formalChargeList"));
g.setSingleLetterCode(t.getString("singleLetterCode").charAt(0));
g.setChemCompType(t.getString("chemCompType"));
return g;
}

Expand All @@ -94,9 +94,9 @@ private List<BioAssemblyData> createBioAssemblyList(Object[] array) {
private BioAssemblyData createBioAssemblyData(Object o) {
ObjectTree t = new ObjectTree((Hashtable<String, Object>) o);
BioAssemblyData data = new BioAssemblyData();
data.setName(t.s("name"));
data.setName(t.getString("name"));
List<BioAssemblyTransformation> ts = new ArrayList<>();
Object[] tls = t.oa("transformList");
Object[] tls = t.getObjectArray("transformList");
for (Object tl : tls) {
ts.add(createBioAssemblyTransformation(tl));
}
Expand All @@ -107,8 +107,8 @@ private BioAssemblyData createBioAssemblyData(Object o) {
private BioAssemblyTransformation createBioAssemblyTransformation(Object o) {
ObjectTree t = new ObjectTree((Hashtable<String, Object>) o);
BioAssemblyTransformation bat = new BioAssemblyTransformation();
bat.setChainIndexList(t.ia("chainIndexList"));
double[] ds = t.da("matrix");
bat.setChainIndexList(t.getIntArray("chainIndexList"));
double[] ds = t.getDoubleArray("matrix");
bat.setMatrix(ds);
return bat;
}
Expand All @@ -124,10 +124,10 @@ private Entity[] createEntityList(Object[] array) {
private Entity createEntity(Object o) {
ObjectTree t = new ObjectTree((Hashtable<String, Object>) o);
Entity e = new Entity();
e.setChainIndexList(t.ia("chainIndexList"));
e.setDescription(t.s("description"));
e.setSequence(t.s("sequence"));
e.setType(t.s("type"));
e.setChainIndexList(t.getIntArray("chainIndexList"));
e.setDescription(t.getString("description"));
e.setSequence(t.getString("sequence"));
e.setType(t.getString("type"));
return e;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public Object get(String s) {
return root.get(s);
}

public String s(String s) {
public String getString(String s) {
Object o = root.get(s);
if (o == null) {
return "";
Expand All @@ -37,7 +37,7 @@ public String s(String s) {
}
}

public int i(String s) {
public int getInt(String s) {
Object o = root.get(s);
if (o == null) {
return 0;
Expand All @@ -46,7 +46,7 @@ public int i(String s) {
}
}

public float f(String s) {
public float getFloat(String s) {
Object o = root.get(s);
if (o == null) {
return 0;
Expand All @@ -55,7 +55,7 @@ public float f(String s) {
}
}

public byte[] ba(String s) {
public byte[] getByteArray(String s) {
Object o = root.get(s);
if (o == null) {
return new byte[0];
Expand All @@ -64,7 +64,7 @@ public byte[] ba(String s) {
}
}

public int[] ia(String s) {
public int[] getIntArray(String s) {
Object o = root.get(s);
if (o == null) {
return new int[0];
Expand All @@ -73,15 +73,15 @@ public int[] ia(String s) {
}
}

public float[] fa(String s) {
public float[] getFloatArray(String s) {
return (float[]) root.get(s);
}

public double[] da(String s) {
public double[] getDoubleArray(String s) {
return (double[]) root.get(s);
}

public double[][] daa(String s) {
public double[][] getDoubleArray2d(String s) {
Object o = root.get(s);
double[][] aa;
if (o == null) {
Expand All @@ -96,7 +96,7 @@ public double[][] daa(String s) {
return aa;
}

public char c(String s) {
public char getChar(String s) {
Object o = root.get(s);
if (o == null) {
return 0;
Expand All @@ -105,11 +105,11 @@ public char c(String s) {
}
}

public String[] sa(String s) {
public String[] getStringArray(String s) {
return (String[]) root.get(s);
}

public Object[] oa(String s) {
public Object[] getObjectArray(String s) {
Object o = root.get(s);
if (o == null) {
return new Object[0];
Expand Down

0 comments on commit 72e468e

Please sign in to comment.