/// <summary> /// Creates the head of list. /// </summary> public List() { Head = new ListElement(); Head.Next = null; Head.Str = ""; Head.Count = 0; }
/// <summary> /// Removes specified element from list /// </summary> /// <param name="element"></param> public void Remove(int element) { if (head == null) { throw new EmptyListException(); } if (head.Data == element) { head = head.Next; } else { ListElement temp1 = head; ListElement temp2 = head; temp1 = temp1.Next; while (temp1.Next != null && temp1.Data != element) { temp1 = temp1.Next; temp2 = temp2.Next; } temp2.Next = temp1.Next; } }
/// <summary> /// Adds new element to the list /// </summary> /// <param name="pos"></param> /// <param name="value"></param> public void AddElem(ListElement pos, string value) { ListElement tmp = new ListElement(); tmp.Str = value; tmp.Next = pos.Next; pos.Next = tmp; }
public void AddElem(ListElement pos, int value) { ListElement tmp = new ListElement(); tmp.Number = value; tmp.Next = pos.Next; pos.Next = tmp; }
public virtual void TestOverflowMaxChainLength() { int UPPERLIMIT = 100000; int lower = 0; int upper = UPPERLIMIT; while (lower + 1 < upper) { int mid = (lower + upper) / 2; try { ListElement first = new ListElement(); ListElement last = first; for (int i = 0; i < mid; i++) { last = (last.Next = new ListElement()); } RamUsageEstimator.SizeOf(first); // cause SOE or pass. lower = mid; } catch (System.StackOverflowException e) { upper = mid; } } if (lower + 1 < UPPERLIMIT) { Assert.Fail("Max object chain length till stack overflow: " + lower); } }
public virtual void Add(int position, int newElement) { ListElement newListElement = new ListElement(newElement); if (position > size) { throw new IncorrectPositionException(); } if (position == 0) { newListElement.Next = head; head = newListElement; } else { ListElement temp = head; while (temp.Next != null && position != 1) { temp = temp.Next; position--; } newListElement.Next = temp.Next; temp.Next = newListElement; } size++; }
protected override void OnInitElements () { peerList = new ListElement<AvatarElement> (); Elements.Add ("peer_list", peerList); Elements.Add ("back", new BackButtonElement ("", () => { Game.Multiplayer.Disconnect (); })); }
public override void Insert(int value, ListElement pos) { if (this.Find(value)) { throw new AddExistingNumberException(); } base.Insert(value, pos); }
// add element to end with value value. public void AddElement(ElementType value) { if (head == null) { head = new ListElement(value, null); return; } ListElement temp = head; for (temp = head; temp.Next() != null; temp = temp.Next()) ; temp.AddListElement(value); }
void OnListSelectChange(ListElement data) { mSelectNodel = data; //var hierarchyData = (HierarchyListWindow.HierarchyElementData) data.ElementData; mSelectElement = InspectorElement.GetInspectorElement(data); if (mSelectElement != null) { infoWindow.Refresh(mSelectElement); } }
public virtual void AddElement(int element) { if (this.head == null) { this.head = new ListElement(element, null); } else { ListElement temp = new ListElement(element, this.head); this.head = temp; } }
public int Pop() { if (!this.IsEmpty()) { int result = this.head.Value; this.head = this.head.Next; return result; } else { throw new StackEmptyException(); } }
public void Refresh(InspectorElement element) { mSelectNodel = ((BundleListWindow)mOwnerWindow).SelectNodel; cacheBundleObject = element; scrollVector2 = Vector2.zero; cacheFolderObject = cacheBundleObject as InspectorElementFolder; cachePrefabObject = cacheBundleObject as InspectorElementPrefab; if (cachePrefabObject != null) { LoadAsset(cachePrefabObject.Depends); } }
public void OnInit(ListElement element) { mListElement = element; ElementData = BundleDataManager.Instance.GetInspectorElement(mListElement.InstanceID); if (ElementData == null) { ElementData = BundleDataManager.Instance.CreateInspectorElement(mListElement.Path, mListElement.IsFolder); } else { ElementData.IsFolder = mListElement.IsFolder; ElementData.AssetFilePath = mListElement.Path; ElementData.AssetName = Path.GetFileNameWithoutExtension(mListElement.Path); } }
/// <summary> /// Adds value to the list /// </summary> /// <param name="value">Value to add</param> public void Add(int value) { ListElement tmp = new ListElement(value); if (this.head == null) { this.head = tmp; return; } ListElement iterator = this.head; while (iterator.Next != null) { iterator = iterator.Next; } iterator.Next = tmp; }
public void Add(int value) { var newElement = new ListElement(value); if (this.head == null) { this.head = newElement; this.tail = newElement; ++this.size; return; } this.tail.Next = newElement; this.tail = newElement; ++this.size; }
/// <summary> /// Method adds element to the list /// </summary> /// <param name="el">Element</param> public void AddToList(int el) { if (ElementExist(el)) return; if (ListIsEmpty()) { this.head = new ListElement(el); return; } ListElement iterator = this.head; while (iterator.Next != null) { iterator = iterator.Next; } ListElement tmp = new ListElement(el); iterator.Next = tmp; }
// add element after position pos. public void AddElementToPosition(ElementType value, Position pos) { if (head == null) { head = new ListElement(value, null); return; } if (pos == 0) { AddElementToHead(value); return; } ListElement temp = head; int i = 0; for (i = 0; temp.Next() != null && i != pos - 1; temp = temp.Next(), i++) ; temp.AddListElement(value); }
public void TestIfMarshallerConvertsBetweenTheSameTypeStructureOnlyArrayInsteadOfLists() { ListElement element = new ListElement(); element.stringelements = new List<string>() { "Test", "Test1" }; element.intelements = new int[] { 1, 2, 3 }; String marshalledResult = marshaller.MarshallObject(element); ArrayElement result = marshaller.UnmarshallObject<ArrayElement>(marshalledResult); foreach (String stringelement in result.stringelements) { Assert.IsNotNull(element.stringelements.Find(e => stringelement.Equals(e))); } }
/// <summary> /// Insert new element to the end. /// </summary> /// <param name="value"> Value to be insert to the end.</param> public void InsertToEnd(int value) { if (IsEmpty()) { InsertToHead(value); return; } var tempElement = head; while (tempElement.Next != null) { tempElement = tempElement.Next; } var newElement = new ListElement(value); tempElement.Next = newElement; }
/// <summary> /// Delete value from the list /// </summary> /// <param name="value">Number to delete</param> public void Delete(int value) { if (this.head == null) throw new Exception("Empty list"); if (this.head.Data == value) { this.head = this.head.Next; return; } ListElement iterator = this.head; while ((iterator.Next != null) && (iterator.Next.Data != value)) { iterator = iterator.Next; } if (iterator.Next == null) throw new Exception("No such element"); iterator.Next = iterator.Next.Next; }
/// <summary> /// Adding value to a list /// </summary> /// <param name="value">Value to add</param> public void AddToList(int value) { ListElement tmp = new ListElement(value); if (this.head == null) { this.head = tmp; return; } ListElement iterator = this.head; while (iterator != null) { if (iterator.Data == value) throw new Exception("Exists"); if (iterator.Next == null) break; iterator = iterator.Next; } iterator.Next = tmp; }
public void Draw(ListElement element) { beforRect = GUILayoutUtility.GetLastRect(); if (IsFolder) { tempRect.Set(beforRect.x + 2f, beforRect.y + 2f, 16, 16); GUI.DrawTexture(tempRect, directoryIcon); GUILayout.Space(23); } else { GUILayout.Space(13); } if (GUILayout.Button(ElementData.AssetName, "Label", GUILayout.MinWidth(150))) { element.OnSelected(); } }
public void AddWithKeepingOrder(int value) { if (this.head == null) { this.head = new ListElement(value); this.tail = this.head; ++this.size; return; } //Add to head if (this.head.Value >= value) { ListElement temp = this.head; this.head = new ListElement(value); this.head.Next = temp; ++this.size; return; } //Add to sort list ListElement i = this.head; while (i.Next != null) { if (i.Next.Value >= value) { break; } i = i.Next; } var newElement = new ListElement(value); newElement.Next = i.Next; i.Next = newElement; ++this.size; if (newElement.Next == null) { this.tail = newElement; } }
public void AddElement(string element) { if (this.head == null) { this.head = new ListElement(element, null); } else if (this.head.Next == null) { this.head.Next = new ListElement(element, null); } else { ListElement temp = this.head; while (temp.Next != null) { temp = temp.Next; } temp.Next = new ListElement(element, null); } ++this.listSize; }
public void Process2() { int N = 1000; Random r = new Random(); Point[] a = new Point[N]; G = (int)(1/d); grid = new ListElement<Point>[G+2,G+2]; for (int i = 0; i < G + 2; i++) { for (int j = 0; j < G + 2; j++) { grid[i, j] = null; } } for (int i = 0; i < N; i++) { gridinsert(r.Next(1), r.Next(1)); } }
public static int Process(int N, int M) { CyclicList lst = new CyclicList(); ListElement<int> pt = new ListElement<int>(0); lst.Add(pt, pt); for (int i = 1; i < N; i++) { var tm = new ListElement<int>(i); lst.Add(tm, pt); pt = tm; } ListElement<int> el = pt; while (el.Next != el) { for (int i = 0; i < M; i++) { el = el.Next; } Console.WriteLine("Remove {0}", el.Next.Value); el.Next = el.Next.Next; } return el.Value; }
public bool DeleteElement(string element) { if (this.IsEmpty()) { return false; } ListElement temp = this.head; if (temp.Value == element) { this.head = this.head.Next; return true; } if (temp.Next != null) { if (temp.Next.Value == element) { this.head.Next = this.head.Next.Next; return true; } } else { return false; } while (temp.Next != null) { if (temp.Next.Value == element) { temp.Next = temp.Next.Next; return true; } temp = temp.Next; } return false; }
public void DeleteElement(int element) { if (this.IsEmpty()) { throw new EmptyListException(); } ListElement temp = this.head; if (temp.Value == element) { this.head = this.head.Next; return; } if (temp.Next != null) { if (temp.Next.Value == element) { this.head.Next = this.head.Next.Next; return; } } else { throw new NonexistentElementException(); } while (temp.Next != null) { if (temp.Next.Value == element) { temp.Next = temp.Next.Next; return; } temp = temp.Next; } throw new NonexistentElementException(); }
/// <summary> /// Deleting a value from a list /// </summary> /// <param name="number"></param> public void DeleteFromList(int number) { if (head == null) { throw new Exception("List is empty"); } ListElement el = this.head; if (el.Data == number) { head = el.Next; return; } while (el.Next != null) { if (el.Next.Data == number) { el.Next = el.Next.Next; return; } el = el.Next; } throw new Exception("No such element"); }
public DotFeatures get_first_feature_obj(ListElement current) { IntPtr cPtr = modshogunPINVOKE.CombinedDotFeatures_get_first_feature_obj__SWIG_1(swigCPtr, ListElement.getCPtr(current)); DotFeatures ret = (cPtr == IntPtr.Zero) ? null : new DotFeatures(cPtr, false); if (modshogunPINVOKE.SWIGPendingException.Pending) { throw modshogunPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
/// <summary> /// Конструктор экземпляра класса <see cref="ListElement"/>. /// </summary> /// <param name="value">Значение элемента.</param> /// <param name="next">Следующий за данным элемент.</param> public ListElement(int value, ListElement next) { this.Value = value; this.Next = next; }
public ForwardEnumerator(LinkedList <T> list, ListElement start) { _list = list; _current = start; }
protected override void Awake() { base.Awake(); m_myElement = transform.parent.parent; //Reaches up to OverViewTreeElement m_myListElement = GetComponent <ListElement>(); }
public void OnTriggerDeSelect(ListElement element) { }
public ListElement(T value, ListElement <T> previous = null) { Value = value; Previous = previous; }
public void SetNext(ListElement value) { this.next = value; }
/** * Realises the specifier of the noun phrase. * * @param phrase * the <code>PhraseElement</code> representing this noun phrase. * @param parent * the parent <code>SyntaxProcessor</code> that will do the * realisation of the complementiser. * @param realisedElement * the current realisation of the noun phrase. */ private static void realiseSpecifier(PhraseElement phrase, SyntaxProcessor parent, ListElement realisedElement) { NLGElement specifierElement = phrase.getFeatureAsElement(InternalFeature.SPECIFIER); if (specifierElement != null && !phrase.getFeatureAsBoolean(InternalFeature.RAISED) && !phrase.getFeatureAsBoolean(Feature.ELIDED)) { if (!specifierElement.isA(new LexicalCategory(LexicalCategory.LexicalCategoryEnum.PRONOUN)) && specifierElement.Category != PhraseCategory.PhraseCategoryEnum.NOUN_PHRASE) { specifierElement.setFeature(Feature.NUMBER, phrase.getFeature(Feature.NUMBER)); } NLGElement currentElement = parent.realise(specifierElement); if (currentElement != null) { currentElement.setFeature(InternalFeature.DISCOURSE_FUNCTION, DiscourseFunction.SPECIFIER); realisedElement.addComponent(currentElement); } } }
public ListElement(int newData, ListElement listElement) { this.data = newData; this.next = listElement; }
/** * Realises the pre-modifiers of the noun phrase. Before being realised, * pre-modifiers undergo some basic sorting based on adjective ordering. * * @param phrase * the <code>PhraseElement</code> representing this noun phrase. * @param parent * the parent <code>SyntaxProcessor</code> that will do the * realisation of the complementiser. * @param realisedElement * the current realisation of the noun phrase. */ private static void realisePreModifiers(PhraseElement phrase, SyntaxProcessor parent, ListElement realisedElement) { IList <NLGElement> preModifiers = phrase.PreModifiers; if (phrase.getFeatureAsBoolean(Feature.ADJECTIVE_ORDERING)) { preModifiers = sortNPPreModifiers(preModifiers); } PhraseHelper.realiseList(parent, realisedElement, preModifiers, DiscourseFunction.PRE_MODIFIER); }
/** * Realises the head noun of the noun phrase. * * @param phrase * the <code>PhraseElement</code> representing this noun phrase. * @param parent * the parent <code>SyntaxProcessor</code> that will do the * realisation of the complementiser. * @param realisedElement * the current realisation of the noun phrase. */ private static void realiseHeadNoun(PhraseElement phrase, SyntaxProcessor parent, ListElement realisedElement) { NLGElement headElement = phrase.getHead(); if (headElement != null) { headElement.setFeature(Feature.ELIDED, phrase.getFeature(Feature.ELIDED)); headElement.setFeature(LexicalFeature.GENDER, phrase.getFeature(LexicalFeature.GENDER)); headElement.setFeature(InternalFeature.ACRONYM, phrase.getFeature(InternalFeature.ACRONYM)); headElement.setFeature(Feature.NUMBER, phrase.getFeature(Feature.NUMBER)); headElement.setFeature(Feature.PERSON, phrase.getFeature(Feature.PERSON)); headElement.setFeature(Feature.POSSESSIVE, phrase.getFeature(Feature.POSSESSIVE)); headElement.setFeature(Feature.PASSIVE, phrase.getFeature(Feature.PASSIVE)); headElement.setFeature(Feature.IS_CAPITALIZED, phrase.getFeature(Feature.IS_CAPITALIZED)); NLGElement currentElement = parent.realise(headElement); currentElement.setFeature(InternalFeature.DISCOURSE_FUNCTION, DiscourseFunction.SUBJECT); realisedElement.addComponent(currentElement); } }
public void MouseUp() { m_held = null; }
public ListElement(string value, ListElement next) { this.value = value; this.next = next; }
// moves to the next list element public bool MoveNext() { position++; current = current == null ? list.top : current.Next; return(position < list.Length()); }
public void Reset() { _current = null; }
public void MouseCaptureChanged() { m_held = null; m_hovered = null; }
public void OnAddNewElement(ListElement element) { BundleDataManager.Instance.OnAddNewElement(element); }
/// <summary> /// Enumerates the rest of the list starting at the specified list element. /// The starting element will the Current value of the enumerator to begin /// with and the first call to MoveNext() will advance to the next item in /// the list /// </summary> /// <param name="start">Where to start. Pass null to start from the /// beginning/end of the list</param> /// <param name="forwards">Choose whether to go forwards or backwards in /// the list</param> /// <returns>A thread-safe enumerator</returns> public IEnumerator <T> EnumerateFrom(ListElement start, bool forwards = true) { return(forwards ? (IEnumerator <T>) new ForwardEnumerator(this, start) : new ReverseEnumerator(this, start)); }
/// <summary> /// удалить список /// </summary> public void DeleteList() { head = null; }
/// <summary> /// Delete List. /// </summary> /// <param name="value">Value to be pushed.</param> public void Removing() { head = null; }
public ReverseEnumerator(LinkedList <T> list, ListElement start) { _list = list; _current = start; }
public void Visit(ListElement element) { // Lists cannot be converted to a span => ignore element //TODO: Log warning for ignored element }
//constructor public ListElement(int value, ListElement nextElement) { Value = value; Next = nextElement; }
public ListElement(int length, ListElement next) { this.length = length; this.next = next; }
// returns the enumerator to the position previous to the first element public void Reset() { position = -1; current = null; }
/// <summary> /// Initializes a new instance of the <see cref="ListElement"/> class. /// </summary> /// <param name="data">Value of the element</param> /// <param name="next">Pointer to the next element in list or null if last</param> public ListElement(int data, ListElement next) { this.Data = data; this.Next = next; }
// constructor public ListEnumerator(List <T> newList) { list = newList; current = null; }
/// <summary> /// Returns the next element in the list or null if this is the last element /// </summary> /// <param name="start">The list element to start from</param> public ListElement NextElement(ListElement start) { return(start.Next); }
public ListTimelineTabModel(string tabName, ListElement list) : base(tabName) { this.ListInfo = list; }
/// <summary> /// Returns the prior element in the list or null if this is the first element /// </summary> /// <param name="start">The list element to start from</param> public ListElement PriorElement(ListElement start) { return(start.Prior); }