protected virtual void OnHidden(bool all) { if (!IsDisposed) { Linked.AsEnumerable().ForEach(g => g.OnLinkHidden(this)); } }
public static string ToString <T>(NodeLink <T> list) { var p = list; if (!Linked.IsCyclic(p)) { var sb = new StringBuilder(); sb.Append("["); while (p != null && p.Next != null) { if (p.Next.Value != null) { sb.Append($"{p.Next.Value.ToString()},"); } else { sb.Append($"(null)"); } p = p.Next; } if (sb[sb.Length - 1] != '[') { sb.Remove(sb.Length - 1, 1); } sb.Append("]"); return(sb.ToString()); } else { return("[cyclic]"); } }
public override int GetHashCode() { int hash = 1; if (Linked != false) { hash ^= Linked.GetHashCode(); } if (Success.Length != 0) { hash ^= Success.GetHashCode(); } if (Error.Length != 0) { hash ^= Error.GetHashCode(); } if (ActiveAuthProviderId.Length != 0) { hash ^= ActiveAuthProviderId.GetHashCode(); } if (Provider.Length != 0) { hash ^= Provider.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
protected virtual void OnSendFail() { if (IsDisposed) { return; } UnregisterInstance(); if (Parent is SuperGump) { ((SuperGump)Parent).RemoveChild(this); } if (InstancePoller != null) { InstancePoller.Dispose(); InstancePoller = null; } Linked.ForEachReverse(g => g.OnLinkSendFail(this)); if (OnActionSend != null) { OnActionSend(this, false); } }
protected virtual void OnRefreshed() { if (IsDisposed) { return; } LastAutoRefresh = DateTime.UtcNow; RegisterInstance(); if (Parent is SuperGump) { ((SuperGump)Parent).AddChild(this); } if (InstancePoller == null) { InitPollTimer(); } else if (!InstancePoller.Running) { InstancePoller.Running = EnablePolling; } Linked.AsEnumerable().ForEach(g => g.OnLinkRefreshed(this)); }
protected virtual void OnSend() { if (IsDisposed) { return; } LastAutoRefresh = DateTime.UtcNow; RegisterInstance(); if (Parent is SuperGump) { ((SuperGump)Parent).AddChild(this); } if (InstancePoller == null) { InitPollTimer(); } else { InstancePoller.Running = EnablePolling; } Linked.ForEachReverse(g => g.OnLinkSend(this)); PlaySendSound(); if (OnActionSend != null) { OnActionSend(this, true); } }
internal async Task SetAddress(Linked linked) { linked.CurrentState = LinksStates.Detection; var link = await GetLink(linked.Address); if (link != null) { Selected(linked, link); } else { var links = await GetLinks(linked.Address); if (links == null || links.Count == 0) { links.Add(new Link() { Name = linked.Address, XmlUrl = linked.Address, HtmlUrl = linked.Address }); } else { links = links.Distinct(EqualityComparer <Link> .Default).OrderBy(n => n.XmlUrl.ToString().Length).ToList(); } links.Add(new Link()); linked.DetectedLinks = links; linked.CurrentState = LinksStates.Selection; linked.IsNeedToSave = true; } }
protected virtual void OnSend() { if (IsDisposed) { return; } LastAutoRefresh = DateTime.UtcNow; RegisterInstance(); if (Parent is SuperGump) { ((SuperGump)Parent).AddChild(this); Children.TrimExcess(); } if (InstancePoller == null) { InitPollTimer(); } else if (!InstancePoller.Running) { InstancePoller.Running = EnablePolling; } Linked.AsEnumerable().ForEach(g => g.OnLinkSend(this)); Linked.TrimExcess(); if (Modal && User != null && User.Holding != null) { Timer.DelayCall(TimeSpan.FromSeconds(1.0), User.DropHolding); } }
#pragma warning restore 0414 private GroupByContext(Lookup <K, T> lookup, bool release) { this.lookup = lookup; this.release = release; this.runner = lookup.keys.head; this.bd = BacktrackDetector.Borrow(); }
#pragma warning restore 0414 private LinkedContext(LinkedHeadTail <T> list, BacktrackDetector bd, bool release) { this.list = list; runner = list.head; this.release = release; this.bd = bd; }
public void AddLink(INode node) { if (!node.Linked.Contains(this)) { node.Linked.Add(this); Linked.Add(node); } }
public void RemoveLink(INode node) { if (node.Linked.Contains(this)) { node.Linked.Remove(this); Linked.Remove(node); } }
protected virtual void OnHidden(bool all) { if (IsDisposed) { return; } Linked.AsEnumerable().ForEach(g => g.OnLinkHidden(this)); Linked.TrimExcess(); }
public void AddConnector(Id <TConnector> id) { if (!m_connectors.Any(c => c.Id == id)) { ConnectorDefinitionData data = new ConnectorDefinitionData("", Id <TConnectorDefinition> .ConvertFrom(id), new List <NodeData.ParameterData>(), ConnectorPosition.Bottom); var connector = new Output(id, data, this, new List <Parameter>(), m_rules); connector.Connected += (a) => Linked.Execute(); connector.Disconnected += (a) => Linked.Execute(); m_connectors.Add(connector); } }
// `shift` (*remove value at front*). public T Shift() { if (First == null) { return(default(T)); } var ret = First.Value; First = First.Child; return(ret); }
public void Dispose() { if (IsDisposed) { return; } IsDisposed = true; //Console.WriteLine("SuperGump Disposing: {0} (0x{1:X})", GetType(), Serial); //GC.SuppressFinalize(this); VitaNexCore.TryCatch(OnDispose); VitaNexCore.TryCatch(UnregisterInstance); NextButtonID = 1; NextSwitchID = 0; NextTextInputID = 0; if (InstancePoller != null) { VitaNexCore.TryCatch(InstancePoller.Dispose); InstancePoller = null; } VitaNexCore.TryCatch( () => { Buttons.Clear(); TileButtons.Clear(); Switches.Clear(); Radios.Clear(); TextInputs.Clear(); LimitedTextInputs.Clear(); Entries.Clear(); Entries.TrimExcess(); Layout.Clear(); }); VitaNexCore.TryCatch(() => Linked.AsEnumerable().ForEach(Unlink)); VitaNexCore.TryCatch(() => Children.AsEnumerable().ForEach(RemoveChild)); IsOpen = false; Hidden = false; Parent = null; User = null; VitaNexCore.TryCatch(OnDisposed); }
// `unshift` (*insert value at front*); public void Unshift(T value) { var add = new Linked <T>(); add.Value = value; if (First != null) { add.Child = First; } First = add; }
public virtual void Unlink(SuperGump gump) { if (gump == null) { return; } Linked.Remove(gump); if (gump.Linked.Contains(this)) { gump.Unlink(this); } }
public virtual void Link(SuperGump gump) { if (gump == null) { return; } Linked.AddOrReplace(gump); if (!gump.Linked.Contains(this)) { gump.Link(this); } }
public void MainTest() { using (Domain.OpenSession()) { using (var t = Session.Current.OpenTransaction()) { var l = new Linked(Guid.NewGuid()); var l2 = new Linked2(Guid.NewGuid()) { Entity = l }; l.Remove(); // Rollback } } }
#pragma warning restore 0414 private JoinContext(Lookup <K, T2> lookup, Slinq <T, C> outer, Func <T, K> outerSelector, Func <T, T2, U> resultSelector, bool release) { needsMove = false; this.lookup = lookup; this.outerSelector = outerSelector; this.resultSelector = resultSelector; chained = outer; this.release = release; LinkedHeadTail <T2> iht; inner = chained.current.isSome && lookup.dictionary.TryGetValue(outerSelector(chained.current.value), out iht) ? iht.head : null; bd = BacktrackDetector.Borrow(); }
protected virtual void OnHidden(bool all) { if (IsDisposed) { return; } Linked.ForEachReverse(g => g.OnLinkHidden(this)); PlayHideSound(); if (OnActionHide != null) { OnActionHide(this, all); } }
// `push` (*insert value at back*); public void Push(T value) { var set = new Linked <T>(); set.Value = value; if (First == null) { First = set; } else { var last = GetLast(First); last.Child = set; } }
protected virtual void OnClosed(bool all) { if (IsDisposed) { return; } UnregisterInstance(); if (InstancePoller != null) { InstancePoller.Dispose(); InstancePoller = null; } Linked.AsEnumerable().ForEach(g => g.OnLinkClosed(this)); }
public virtual void Link(SuperGump gump) { if (gump == null) { return; } if (!Linked.Contains(gump)) { Linked.Add(gump); } if (!gump.Linked.Contains(this)) { gump.Link(this); } }
internal void Selected(Linked linked, Link link) { if (link?.XmlUrl != null) { if (linked.Links == null) { linked.Links = new ObservableCollection <Link>(); } linked.Links.Insert(0, link); linked.Address = null; linked.DetectedLinks = null; } linked.CurrentState = LinksStates.Normal; linked.IsNeedToSave = true; }
public static int Count <T>(NodeLink <T> list) { int counter = 0; var p = list; if (!Linked.IsCyclic(list)) { while (p != null && p.Next != null) { counter++; p = p.Next; } } else { throw new Exception("List is Cyclic."); } return(counter); }
static void Main(string[] args) { var list = new SingleLinkedList(); var l = new Linked(); l.insert(4); l.insert(4); l.insert(4); l.display(); // list.insertLast(112); // list.insertLast(12); // list.insertLast(123); // list.insertLast(123); // list.removeLast(); // list.display(); }
public static NodeLink <T> CycleNode <T>(NodeLink <T> list) { if (Linked.IsCyclic(list) == false) { return(default(NodeLink <T>)); } NodeLink <T> fast = list; NodeLink <T> slow = list; NodeLink <T> prevfast = list; while (fast != null && fast.Next != null) { prevfast = fast; fast = fast.Next.Next; slow = slow.Next; if (fast == slow) { return(prevfast.Next); } } return(default(NodeLink <T>)); }
protected virtual void OnSendFail() { if (IsDisposed) { return; } UnregisterInstance(); if (Parent is SuperGump) { ((SuperGump)Parent).RemoveChild(this); } if (InstancePoller != null) { InstancePoller.Dispose(); InstancePoller = null; } Linked.AsEnumerable().ForEach(g => g.OnLinkSendFail(this)); }