public static bool DoCompare(Agent pAgent, VariableComparator comparator, Property opl, CMethodBase opl_m, Property opr, CMethodBase opr_m) { bool bResult = false; if (opl != null) { Agent agent_left = opl.GetParentAgent(pAgent); Agent agent_right = opr != null?opr.GetParentAgent(pAgent) : opr_m.GetParentAgent(pAgent); bResult = comparator.Execute(agent_left, agent_right); } else if (opl_m != null) { Agent agent_left = opl_m.GetParentAgent(pAgent); object returnValue = opl_m.Invoke(agent_left, pAgent); Agent agent_right = opr != null?opr.GetParentAgent(pAgent) : opr_m.GetParentAgent(pAgent); bResult = comparator.Execute(returnValue, agent_left, agent_right); } return(bResult); }