/// <summary> /// Gets a value indicating whether the given computation has a compliant input to be instantiated by the current transformation rule /// </summary> /// <param name="computation">The computation that is a candidate for instantiation</param> /// <returns>True, if the input arguments match the input types of the current transformation rule, otherwise false</returns> public bool HasCompliantInput(Computation computation) { if (computation == null) { return(false); } var inputTypes = InputType; if (computation.InputArguments != inputTypes.Length) { return(false); } for (int i = 0; i < inputTypes.Length; i++) { var instance = computation.GetInput(i); if (instance != null && !inputTypes[i].IsInstanceOfType(instance)) { return(false); } } return(true); }
/// <summary> /// Gets a value indicating whether the given computation has a compliant input to be instantiated by the current transformation rule /// </summary> /// <param name="computation">The computation that is a candidate for instantiation</param> /// <returns>True, if the input arguments match the input types of the current transformation rule, otherwise false</returns> public bool HasCompliantInput(Computation computation) { if (computation == null) return false; var inputTypes = InputType; if (computation.InputArguments != inputTypes.Length) return false; for (int i = 0; i < inputTypes.Length; i++) { var instance = computation.GetInput(i); if (instance != null && !inputTypes[i].IsInstanceOfType(instance)) return false; } return true; }
private static string PrintInputs(Computation createRule) { return(string.Join(", ", Enumerable.Range(0, createRule.InputArguments).Select(i => createRule.GetInput(i) != null ? createRule.GetInput(i).ToString() : "(null)"))); }