public virtual Lot <T> Repeat <T>( IEnumerable <T> source, int times) { const byte zero = 0, one = 1; var collection = new LinkedListLot <T>(); if (source == null) { return(collection); } if (times < one) { return(collection); } foreach (var item in source) { collection.AddLast(item); } var result = new ListLot <T>(); for (int i = zero; i < times; ++i) { result.AddRange(collection); } return(result); }
public virtual Lot <T> Connect <T>( params IEnumerable <T>[] finiteSources) { var connection = new LinkedListLot <T>(); if (finiteSources == null) { return(connection); } const byte zero = 0; var l = finiteSources.Length; for (int sourceIndex = zero; sourceIndex < l; ++sourceIndex) { var source = finiteSources[sourceIndex]; if (source == null) { continue; } using (var e = source.GetEnumerator()) { while (e?.MoveNext() ?? false) { connection.AddLast(e.Current); } } } return(connection); }
public override Lot <string> LocatorNames() { var lll = new LinkedListLot <string>(); foreach (var locatorName in EH.Select( this.locators, locatorHolder => locatorHolder?.Name)) { lll.AddLast( locatorName); } return(lll); }
public override Lot <string> LeechNames() { var lll = new LinkedListLot <string>(); foreach (var leechName in EH.Select( this.leeches, leechHolder => leechHolder?.Name)) { lll.AddLast( leechName); } return(lll); }
public override Lot <string> ManagerNames() { var lll = new LinkedListLot <string>(); foreach (var managerName in EH.Select( this.managers, nmh => nmh?.Name)) { lll.AddLast( managerName); } return(lll); }
public virtual TUi GetUi <TPresenter, TUi>( string presenterName = null, string fieldName = Presenter.DefaultUiFieldName) where TPresenter : Presenter { Lot <Presenter> matchingPresenters = new LinkedListLot <Presenter>( EH.Where( this.presenters, p => p is TPresenter)); const byte one = 1; if (matchingPresenters.Count < one) { return(default);
public virtual Lot <T> Rotate <T>( IEnumerable <T> finiteSource, int cycles, bool goRight = truth) { var ll = new LinkedListLot <T>(); if (finiteSource == null) { return(ll); } foreach (var item in finiteSource) { ll.AddLast(item); } const byte zero = 0, one = 1; Lot <T> lot = ll; if (lot.Count < one) { return(lot); } if (goRight) { for (int i = zero; i < cycles; ++i) { var node = ll.Last; ll.RemoveLast(); ll.AddFirst(node); } return(lot); } for (int i = zero; i < cycles; ++i) { var node = ll.First; ll.RemoveFirst(); ll.AddLast(node); } return(lot); }
public override Lot <string> WebNames() { var lll = new LinkedListLot <string>(); lock (this.locker) { foreach (var webName in EH.Select( this.webs, webHolder => webHolder?.Name)) { lll.AddLast( webName); } } return(lll); }
public virtual Lot <string> ManagerNames() { var lll = new LinkedListLot <string>(); lock (this.locker) { foreach (var managerName in EH.Select( this.managers, nmh => nmh?.Name)) { lll.AddLast( managerName); } } return(lll); }
public virtual Lot <string> LocatorNames() { var lll = new LinkedListLot <string>(); lock (this.locker) { foreach (var locatorName in EH.Select( this.locators, locatorHolder => locatorHolder?.Name)) { lll.AddLast( locatorName); } } return(lll); }
public virtual IEnumerable <XTuple <MethodWeb, string> > ViewWebs() { IEnumerable <XTuple <MethodWeb, string> > ws; lock (this.locker) { ws = new LinkedListLot <XTuple <MethodWeb, string> >( EnumerableHelpers.Select( this.webs, webHolder => { return(XTuple.Create( webHolder.Web, webHolder.Name)); })); } return(ws); }
public virtual IEnumerable <XTuple <object, string> > ViewDependencies() { IEnumerable <XTuple <object, string> > ds; lock (this.locker ?? new object()) { ds = new LinkedListLot <XTuple <object, string> >( EnumerableHelpers.Select( this.dependencies, dep => { return(XTuple.Create( dep.Content, dep.Name)); })); } return(ds); }
public virtual IEnumerable <XTuple <MethodWebManager, string> > ViewManagers() { IEnumerable <XTuple <MethodWebManager, string> > ms; lock (this.locker) { ms = new LinkedListLot <XTuple <MethodWebManager, string> >( EnumerableHelpers.Select( this.managers, man => { return(XTuple.Create( man?.Manager, man?.Name)); })); } return(ms); }
public override TUi GetUi <TPresenter, TUi>( string presenterName = null, string fieldName = Presenter.DefaultUiFieldName) { Lot <Presenter> matchingPresenters; lock (this.locker) { matchingPresenters = new LinkedListLot <Presenter>( EH.Where( this.presenters, p => p is TPresenter)); } const byte one = 1; if (matchingPresenters.Count < one) { return(default);
public PrimeGenerator( PrimeTester tester, IEnumerable <long> finiteSet) { this.tester = tester; if (finiteSet == null) { finiteSet = new LinkedListLot <long>( new long[] { firstPrimality, secondPrime }); } if (finiteSet is LinkedListLot <long> ll) { this.currentLinkedList = ll; return; } this.currentLinkedList = new LinkedListLot <long>( finiteSet); }
public virtual Lot <T>[] SplitV2 <T>( IEnumerable <T> finiteSource, long splitCount) { const byte zero = 0, one = 1, two = 2; const bool truth = true, falsity = false; if (finiteSource == null) { return(new Lot <T> [zero]); } if (splitCount < two) { return(new Lot <T>[] { new LinkedListLot <T>(finiteSource) }); } var array = new Lot <T> [splitCount]; for (long splitIndex = zero; splitIndex < splitCount; ++splitIndex) { array[splitIndex] = new LinkedListLot <T>(); } var enumerator = finiteSource.GetEnumerator(); if (enumerator == null) { return(array); } LinkedListLot <T> currentLL; if (enumerator.MoveNext()) { currentLL = array[zero] as LinkedListLot <T>; currentLL?.AddLast(enumerator.Current); } var zeroFilled = truth; while (enumerator.MoveNext()) { for (long splitIndex = zero; splitIndex < splitCount; ++splitIndex) { if (zeroFilled && splitIndex == zero) { continue; } zeroFilled = falsity; currentLL = array[splitIndex] as LinkedListLot <T>; currentLL?.AddLast(enumerator.Current); if (splitIndex < splitCount - one) { if (!enumerator.MoveNext()) { break; } } } zeroFilled = falsity; } enumerator.Dispose(); return(array); }