/** * Returns the {@link Node} corresponding to a given {@link Variable} at time T. * @param variable a given {@link Variable} object. * @param slice an {@code int} that represents the slice value. * @return a {@link Node} object. */ public Node getNodeOfVarTimeT(Variable variable, int slice) { if (variable.isParameterVariable()) { return this.parametersToNodeTimeT.get(variable); } else if (!variable.isInterfaceVariable()){ return this.variablesToNodeTimeT.get(slice).get(variable); }else if (variable.isInterfaceVariable() && slice>0){ return this.variablesToNodeTimeT.get(slice - 1).get(this.dbnModel.getDynamicVariables().getVariableFromInterface(variable)); }else if (variable.isInterfaceVariable() && slice==0){ return this.cloneVariablesToNode.get(variable); }else{ throw new IllegalArgumentException(); } }
/** * Sets a new set of attributes. It links current variables with this new set by matching * variable names with attributes names. * @param attributes an object of class {@link Attributes}. */ public void setAttributes(Attributes attributes){ for (Variable variable : nonInterfaceVariables) { VariableImplementation variableImplementation = (VariableImplementation)variable; variableImplementation.setAttribute(attributes.getAttributeByName(variable.getName())); } for (Variable variable : interfaceVariables) { VariableImplementation variableImplementation = (VariableImplementation)variable; variableImplementation.setAttribute(attributes.getAttributeByName(getVariableFromInterface(variable).getName())); } }
Variable mainMultinomialVar = variables.getVariableFromInterface(multinomialVarInt);
.flatMap(p -> p.getParents().stream()) .filter(v -> v.isInterfaceVariable()) .map( v -> this.dynamicDAG.getDynamicVariables().getVariableFromInterface(v)) .map(v -> v.getName()) .collect(Collectors.toList());