private static IEntity GetPresentationEntity(List <IEntity> originals, List <IEntity> presItems, int itemIndex, IEntity demo, int entityId) { try { if (presItems == null) { return(null); } // Try to find presentationList entity var presentationId = presItems.Count - 1 >= itemIndex && presItems[itemIndex] != null && originals.Has(presItems[itemIndex].EntityId) ? presItems[itemIndex].EntityId : new int?(); // If there is no presentationList entity, take default entity if (presentationId.HasValue) { return(originals.One(presentationId.Value)); } presentationId = demo != null && originals.Has(demo.EntityId) ? demo.EntityId : new int?(); return(presentationId.HasValue ? originals.One(presentationId.Value) : null); } catch (Exception ex) { throw new Exception("trouble adding presentationList of " + entityId, ex); } }
/// <summary> /// Returns a boolean value indicating whether the specified element has the specified attribute or not. /// </summary> /// <param name="name">The attributes name.</param> /// <returns>The return value of true or false.</returns> public Boolean HasAttribute(String name) { if (_namespace == Namespaces.HtmlUri) { name = name.ToLowerInvariant(); } return(_attributes.Has(name)); }
/// <summary> /// This method assumes that RemoteRepo.Load() was already called. /// </summary> /// <param name="app"></param> /// <returns></returns> public List <RemoteVsLocalFile> GroupFilesByName (string localFoldrPath, IRepository <SyncableFileRemote> repo, SyncDirection syncDirection) { var list = new List <RemoteVsLocalFile>(); var locals = _fileSeeker.GetFiles(localFoldrPath); foreach (var loc in locals) { var rem = repo.One(x => x.Name == loc.Name); list.Add(RemVsLoc(loc, rem, syncDirection)); } foreach (var rem in repo.Any(r => !list.Has(l => l.Filename == r.Name))) { var loc = locals.One(x => x.Name == rem.Name); list.Add(RemVsLoc(loc, rem, syncDirection)); } // if no files in folder, or no folder at all, // - assume that it's a first run : download all // if (locals.Count == 0) { list.ForEach(x => x.DoNext(Target.Local, FileTask.Create)); } return(list); }
public void TestCombineWithAnd() { List <AnEntity> al = CreateList1(); al.Has().All(e => e.PropertyB == "B") .And.One(e => e.PropertyA == "A").Assert(); }
/// <summary> /// This method assumes that RemoteRepo.Load() was already called. /// </summary> /// <param name="app"></param> /// <returns></returns> public List<RemoteVsLocalFile> GroupFilesByName (string localFoldrPath, IRepository<SyncableFileRemote> repo, SyncDirection syncDirection) { var list = new List<RemoteVsLocalFile>(); var locals = _fileSeeker.GetFiles(localFoldrPath); foreach (var loc in locals) { var rem = repo.One(x => x.Name == loc.Name); list.Add(RemVsLoc(loc, rem, syncDirection)); } foreach (var rem in repo.Any(r => !list.Has(l => l.Filename == r.Name))) { var loc = locals.One(x => x.Name == rem.Name); list.Add(RemVsLoc(loc, rem, syncDirection)); } // if no files in folder, or no folder at all, // - assume that it's a first run : download all // if (locals.Count == 0) list.ForEach(x => x.DoNext(Target.Local, FileTask.Create)); return list; }
public bool AddTackle(Transform tackle) { if (tackles.Has(tackle)) { return(false); } tackles.Add(tackle); return(true); }
public override bool CheckOptionString(string option_string) { if (option_string_patterns.Has(p => option_string.RegexIsMatch(p))) { return(true); } return(false); }
public override bool CheckOptionString(string option_string) { if (option_strings.Has(option_string.StyleAsWord())) { return(true); } return(false); }
public static bool AddUnique(this List <Project> projects, Project proj) { if (!projects.Has(proj)) { projects.Add(proj); return(true); } return(false); }
public override bool IsAuthority(NetworkActor to_check) { if (to_check.IsServer() || authorities.Has(to_check)) { return(true); } return(false); }
public void List_T_NoMatch() { var sut = new List<SampleType> { new SampleType { Text = "a" }, new SampleType { Text = "b" }, new SampleType { Text = "c" }, }; Assert.False(sut.Has(x => x.Text == "d")); }
public void List_T_Happy() { var sut = new List<SampleType> { new SampleType { Text = "a" }, new SampleType { Text = "b" }, new SampleType { Text = "c" }, }; Assert.True(sut.Has(x => x.Text == "b")); }
public static bool Fits(this List <Int2> data, int xPos, int yPos, int xSize, int ySize) { for (int y = yPos; y < yPos + ySize; y++) { for (int x = xPos; x < xPos + xSize; x++) { if (data.Has(x, y)) { return(false); } } } return(true); }
public void List_T_NoMatch() { var sut = new List <SampleType> { new SampleType { Text = "a" }, new SampleType { Text = "b" }, new SampleType { Text = "c" }, }; Assert.False(sut.Has(x => x.Text == "d")); }
public void List_T_Happy() { var sut = new List <SampleType> { new SampleType { Text = "a" }, new SampleType { Text = "b" }, new SampleType { Text = "c" }, }; Assert.True(sut.Has(x => x.Text == "b")); }
public bool IsLabeledAs(string label) { if (singular_name.AreSymbolInvariantsEqual(label)) { return(true); } if (plural_name.AreSymbolInvariantsEqual(label)) { return(true); } if (abbreviations.Has(a => a.AreSymbolInvariantsEqual(label))) { return(true); } return(false); }
public bool GetRawValue() { return(buttons.Has(b => b.GetRawValue())); }
/// <summary> /// 指定要素が存在しないかどうか /// </summary> /// <typeparam name="T">型</typeparam> /// <param name="list">リスト</param> /// <param name="elem">要素</param> /// <returns>存在しなければTrue</returns> static public bool DontHave <T>(this List <T> list, T elem) { return(!list.Has(elem)); }
/// <summary> /// 指定要素が存在しないかどうか /// </summary> /// <typeparam name="T">型</typeparam> /// <param name="list">リスト</param> /// <param name="match">合致条件</param> /// <returns>存在しなければTrue</returns> static public bool DontHave <T>(this List <T> list, Predicate <T> match) { return(!list.Has(match)); }
/// <summary> /// Indicates whether this instance has any exceptions. /// </summary> /// <param name="logEvents">The log events to consider.</param> /// <returns>True if this instance has the specified events. False otherwise.</returns> public static bool HasExceptions( this List <IBdoLogEvent> logEvents) { return(logEvents.Has(EventKinds.Exception)); }
public void TestFirstAll() { List <AnEntity> al = CreateList1(); al.Has().All(e => e.PropertyB == "B").Assert(); }
/// <summary> /// Indicates whether this instance has any messages. /// </summary> /// <param name="logEvents">The log events to consider.</param> /// <returns>True if this instance has the specified events. False otherwise.</returns> public static bool HasMessages( this List <IBdoLogEvent> logEvents) { return(logEvents.Has(EventKinds.Message)); }
/// <summary> /// 指定要素が存在しないかどうか /// </summary> /// <typeparam name="T">型</typeparam> /// <param name="list">リスト</param> /// <param name="match">合致条件</param> /// <returns>存在しなければTrue</returns> static public bool DontHave <T>(this List <T> list, Func <int, T, bool> match) { return(!list.Has(match)); }
/// <summary> /// Indicates whether this instance has any warnings, errors or exceptions. /// </summary> /// <param name="logEvents">The log events to consider.</param> /// <returns>True if this instance has the specified events. False otherwise.</returns> public static bool HasErrorOrExceptionOrWarnings( this List <IBdoLogEvent> logEvents) { return(logEvents.Has(EventKinds.Warning, EventKinds.Error, EventKinds.Exception)); }
/// <summary> /// Indicates whether this instance has any errors. /// </summary> /// <param name="logEvents">The log events to consider.</param> /// <returns>True if this instance has the specified events. False otherwise.</returns> public static bool HasErrors( this List <IBdoLogEvent> logEvents) { return(logEvents.Has(EventKinds.Error)); }
public bool WillAdd(Func <T, bool> filter) => _toAddNodes.Has(filter);
/// <summary> /// Indicates whether this instance has any warnings. /// </summary> /// <param name="logEvents">The log events to consider.</param> /// <returns>True if this instance has the specified events. False otherwise.</returns> public static bool HasWarnings( this List <IBdoLogEvent> logEvents) { return(logEvents.Has(EventKinds.Warning)); }