private static ILexicalContextmenu CreateForVerbal(IVerbal verbal) { Validate.NotNull(verbal, nameof(verbal)); return(new LexicalContextmenu { LexicalId = verbal.GetSerializationId(), SubjectIds = verbal.HasSubject() ? verbal.Subjects.Select(e => e.GetSerializationId()).ToArray() : null, DirectObjectIds = verbal.HasDirectObject() ? verbal.DirectObjects.Select(e => e.GetSerializationId()).ToArray() : null, IndirectObjectIds = verbal.HasIndirectObject() ? verbal.IndirectObjects.Select(e => e.GetSerializationId()).ToArray() : null, }); }
/// <summary> /// Return a value indicating if the Verbal has any direct OR indirect objects bound to it which match the given predicate function. /// </summary> /// <param name="verbal">The verbal to test.</param> /// <param name="predicate">The predicate to test match objects.</param> /// <returns><c>true</c> if the Verbal has any direct OR indirect objects bound to it which match the given predicate function; otherwise, <c>false</c>.</returns> public static bool HasObject(this IVerbal verbal, Func <IEntity, bool> predicate) => verbal.HasDirectObject(predicate) || verbal.HasIndirectObject(predicate);
/// <summary> /// Return a value indicating if the Verbal has any direct OR indirect objects bound to it. /// </summary> /// <param name="verbal">The verbal to test.</param> /// <returns><c>true</c> if the Verbal has any direct OR indirect objects bound to it; otherwise, <c>false</c>.</returns> public static bool HasObject(this IVerbal verbal) => verbal.HasDirectObject() || verbal.HasIndirectObject();