public class Branch extends Expander<java.lang.Double>
Branch
has a fixed initial number of ports that can be defined
on construction. The port probability can be defined by
SetProbability
. The ports are called "output 1", "output 2", ...
. Moreover, it is possible to add and remove ports dynamically.
Expander
,
BinaryBranch
Entity.PortAlias
Modifier and Type | Field and Description |
---|---|
protected boolean |
isNormalized |
protected RandomNumberGenerator |
rng |
inputPort, outputPorts, portParameters
portAliases, ports, simNode
Constructor and Description |
---|
Branch(int nrOfPorts,
java.lang.String name,
SimNode parentNode) |
Branch(java.lang.String name,
SimNode parentNode) |
Modifier and Type | Method and Description |
---|---|
void |
addPort(java.lang.Double prob) |
void |
addPort(java.lang.String portName,
java.lang.Double prob) |
void |
equalize() |
double |
getProbabilitySum() |
protected SynchronousOutputPort |
getRandomPort() |
void |
handleMessageIndication(Message msg) |
void |
normalize() |
void |
removePort(java.lang.String portName) |
void |
setProbability(int portNr,
double prob) |
portName2Index, setPortParameter
addPort, aliasPort, aliasPort, connect, disconnect, getName, getNode, getPortByName, getPorts, isPortKnown, unaliasPort
protected boolean isNormalized
protected RandomNumberGenerator rng
public Branch(int nrOfPorts, java.lang.String name, SimNode parentNode)
public Branch(java.lang.String name, SimNode parentNode)
protected SynchronousOutputPort getRandomPort()
public void handleMessageIndication(Message msg)
handleMessageIndication
in class Expander<java.lang.Double>
public void addPort(java.lang.Double prob)
public void addPort(java.lang.String portName, java.lang.Double prob)
public void removePort(java.lang.String portName)
removePort
in class Expander<java.lang.Double>
public void setProbability(int portNr, double prob)
public double getProbabilitySum()
public void normalize()
public void equalize()