org.opensha.gem.GEM1.calc.gemLogicTree
Class GemLogicTree<Element>

java.lang.Object
  extended by org.opensha.gem.GEM1.calc.gemLogicTree.GemLogicTree<Element>
All Implemented Interfaces:
Serializable, Iterable<Element>, GemLogicTreeAPI<Element>

public class GemLogicTree<Element>
extends Object
implements GemLogicTreeAPI<Element>, Serializable

See Also:
Serialized Form

Field Summary
protected  HashMap<String,Element> ebMap
           
 
Constructor Summary
GemLogicTree()
           
GemLogicTree(String fileName)
           
 
Method Summary
 void addBranchingLevel(GemLogicTreeBranchingLevel branLev)
           
 void addEBMapping(String str, Element obj)
           
 GemLogicTreeBranchingLevel getBranchingLevel(int idx)
           
 ArrayList<GemLogicTreeBranchingLevel> getBranchingLevelsList()
           
 HashMap<String,Element> getEBMap()
           
 String getModelName()
           
 double getTotWeight(String lab)
           
 double getWeight(String lab)
           
 Iterator<Element> iterator()
           
 void printGemLogicTreeStructure()
          print logic tree structure on standard output
 int sampleBranchingLevel(int branchingLevelIndex)
          This method samples a branching level and return the index of a branch.
 void saveGemLogicTreeModel(String fileName)
           
 void setModelName(String str)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ebMap

protected HashMap<String,Element> ebMap
Constructor Detail

GemLogicTree

public GemLogicTree()

GemLogicTree

public GemLogicTree(String fileName)
             throws IOException,
                    ClassNotFoundException
Throws:
IOException
ClassNotFoundException
Method Detail

addBranchingLevel

public void addBranchingLevel(GemLogicTreeBranchingLevel branLev)
Specified by:
addBranchingLevel in interface GemLogicTreeAPI<Element>

addEBMapping

public void addEBMapping(String str,
                         Element obj)
Specified by:
addEBMapping in interface GemLogicTreeAPI<Element>

getBranchingLevelsList

public ArrayList<GemLogicTreeBranchingLevel> getBranchingLevelsList()
Specified by:
getBranchingLevelsList in interface GemLogicTreeAPI<Element>

getBranchingLevel

public GemLogicTreeBranchingLevel getBranchingLevel(int idx)
Specified by:
getBranchingLevel in interface GemLogicTreeAPI<Element>

setModelName

public void setModelName(String str)
Specified by:
setModelName in interface GemLogicTreeAPI<Element>

getModelName

public String getModelName()
Specified by:
getModelName in interface GemLogicTreeAPI<Element>

getWeight

public double getWeight(String lab)
Specified by:
getWeight in interface GemLogicTreeAPI<Element>

getTotWeight

public double getTotWeight(String lab)
Specified by:
getTotWeight in interface GemLogicTreeAPI<Element>

getEBMap

public HashMap<String,Element> getEBMap()
Specified by:
getEBMap in interface GemLogicTreeAPI<Element>

iterator

public Iterator<Element> iterator()
Specified by:
iterator in interface Iterable<Element>

saveGemLogicTreeModel

public void saveGemLogicTreeModel(String fileName)
                           throws Exception
Specified by:
saveGemLogicTreeModel in interface GemLogicTreeAPI<Element>
Throws:
Exception

printGemLogicTreeStructure

public void printGemLogicTreeStructure()
print logic tree structure on standard output


sampleBranchingLevel

public int sampleBranchingLevel(int branchingLevelIndex)
This method samples a branching level and return the index of a branch. The sampling is done using the inverse transform method. (For the algorithm description see "Computational Statistics Handbook with Matlab", Martinez & Martinez, Champman & all, pag.83)

Specified by:
sampleBranchingLevel in interface GemLogicTreeAPI<Element>