remove connections, get number of connections, get list of input/output connections, get input/output connection by name
import org.terasology.rendering.opengl.FBOConfig;
import org.terasology.utilities.Assets;
+import java.util.ArrayList;
+import java.util.List;
import java.util.Map;
import java.util.Set;
protected boolean enabled = true;
private Set<StateChange> desiredStateChanges = Sets.newLinkedHashSet();
private Map<SimpleUri, BaseFBOsManager> fboUsages = Maps.newHashMap();
- private final SimpleUri nodeUri;
private Map<Name,EdgeConnection> inputConnections = Maps.newHashMap();
private Map<Name,EdgeConnection> outputConnections = Maps.newHashMap();
+ private final SimpleUri nodeUri;
private void addInputConnection(EdgeConnection input){
this.inputConnections.putIfAbsent(input.getName(),input);
@@ -79,6 +81,42 @@ protected void addOutputMaterialConnection(Name name, EdgeConnection.Type type,
addOutputConnection(materialConnection);
}
+ protected void removeInputConnection(Name name){
+ inputConnections.remove(name);
+ }
+
+ protected void removeOutputConnection(Name name){
+ outputConnections.remove(name);
+ }
+
+ public int getNumberOfInputConnections(){
+ return this.inputConnections.size();
+ }
+
+ public int getNumberOfOutputConnections(){
+ return this.outputConnections.size();
+ }
+
+ public EdgeConnection getInputConnection(Name name){
+ return inputConnections.get(name);
+ }
+
+ public EdgeConnection getOutputConnection(Name name){
+ return inputConnections.get(name);
+ }
+
+ public List<Name> getInputConnections(){
+ List<Name> inputConnectionNameList = new ArrayList<>();
+ this.inputConnections.forEach((name,connection) -> inputConnectionNameList.add(name));
+ return inputConnectionNameList;
+ }
+
+ public List<Name> getOutputConnections(){
+ List<Name> outputConnectionNameList = new ArrayList<>();
+ this.inputConnections.forEach((name,connection) -> outputConnectionNameList.add(name));
+ return outputConnectionNameList;
+ }
+
/**
* Constructor to be used by inheriting classes.
*
