Numeric Comparision


Node Information
Compares two given numeric values, one of the events will be fired according to the condition.
General Information
• This node doesn't have other available options.
• Some of the ports of this node can change their types and accept types automatically.
Visual
Visual

Ports
Text Type DataType Accepts IsList CustomAcception
Compare IN RUN MULTIPLE FALSE FALSE
A IN Int32 ONE FALSE TRUE
B IN Int32 ONE FALSE TRUE
A==B OUT RUN MULTIPLE FALSE FALSE
A>=B OUT RUN MULTIPLE FALSE FALSE
A<> OUT RUN MULTIPLE FALSE FALSE
A!=B OUT RUN MULTIPLE FALSE FALSE
A>B OUT RUN MULTIPLE FALSE FALSE
A<> OUT RUN MULTIPLE FALSE FALSE

Source
namespace Korduene.KGraph.Nodes.Conditions
{
    [IsNode("Numeric Comparision")]
    public class NumericComparision : Node
    {
        Port run = new Port(PortType.IN, typeof(RUN), AcceptsLinks.MULTIPLE, "Compare");
        Port a = new Port(PortType.IN, typeof(int), AcceptsLinks.ONE, "A");
        Port b = new Port(PortType.IN, typeof(int), AcceptsLinks.ONE, "B");
        Port equals = new Port(PortType.OUT, typeof(RUN), AcceptsLinks.MULTIPLE, "A==B");
        Port equalsOrBigger = new Port(PortType.OUT, typeof(RUN), AcceptsLinks.MULTIPLE, "A>=B");
        Port equalsOrSmaller = new Port(PortType.OUT, typeof(RUN), AcceptsLinks.MULTIPLE, "A<=b"); port="" bigger="new" port(porttype.out,="" typeof(run),="" acceptslinks.multiple,="" "a="">B");
        Port smaller = new Port(PortType.OUT, typeof(RUN), AcceptsLinks.MULTIPLE, "A<b"); port="" notequal="new" port(porttype.out,="" typeof(run),="" acceptslinks.multiple,="" "a!="B");" public="" double="" a="" {="" set="" {="" a.value="value.ToString();" }="" get="" {="" return="" getruntimevalue(a);="" }="" }="" public="" double="" b="" {="" set="" {="" b.value="value.ToString();" }="" get="" {="" return="" getruntimevalue(b);="" }="" }="" public="" numericcomparision()="" {="" nodetype="NodeType.Method;" returntype="typeof(int);" a.value="0" ;="" b.value="0" ;="" this.name="Numeric Comparision" ;="" this.addport(run);="" this.addport(a);="" this.addport(b);="" this.addport(equals);="" this.addport(equalsorbigger);="" this.addport(equalsorsmaller);="" this.addport(notequal);="" this.addport(bigger);="" this.addport(smaller);="" a.customacception="Accepts;" b.customacception="Accepts;" information="Compares two given numeric values, one of the events will be fired according to the condition." ;="" }="" private="" bool="" accepts(port="" port)="" {="" if="" (port="=" null)="" {="" return="" false;="" }="" if="" (a.isconnected="" ||="" b.isconnected)="" {="" if="" (port.datatype="=" a.datatype)="" {="" return="" true;="" }="" }="" else="" if="" (graphcore.isnumeric(port.datatype))="" {="" returntype="port.DataType;" a.datatype="port.DataType;" a.refresh();="" b.datatype="port.DataType;" b.refresh();="" return="" true;="" }="" return="" false;="" }="" public="" override="" string="" code()="" {="" string="" code="if (val1 == val2) {" +="" getvalue(equals)="" +="" "}"="" +="" "if="" (val1="" !="val2)" {"="" +="" getvalue(notequal)="" +="" "}="" "="" +="" "if="" (val1="">= val2) {" + GetValue(equalsOrBigger) + "} " +
            "if (val1 <= val2)="" {"="" +="" getvalue(equalsorsmaller)="" +="" "}="" "="" +="" "if="" (val1=""> val2) {" + GetValue(bigger) + "} " +
            "if (val1 < val2)="" {"="" +="" getvalue(smaller)="" +="" "}="" ";="" code="code.Replace("val1"," getvalue(a)).replace("val2",="" getvalue(b));="" return="" code;="" }="" }="" }=""></=></b");></=b");>