예제 #1
0
 /// <summary>
 /// Creates the head of list.
 /// </summary>
 public List()
 {
     Head = new ListElement();
     Head.Next = null;
     Head.Str = "";
     Head.Count = 0;
 }
예제 #2
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;
            }
        }
예제 #3
0
 /// <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;
 }
예제 #4
0
 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);
            }
        }
예제 #6
0
        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++;
        }
예제 #7
0
		protected override void OnInitElements () {

			peerList = new ListElement<AvatarElement> ();
			Elements.Add ("peer_list", peerList);

			Elements.Add ("back", new BackButtonElement ("", () => { Game.Multiplayer.Disconnect (); }));
		}
예제 #8
0
 public override void Insert(int value, ListElement pos)
 {
     if (this.Find(value))
     {
             throw new AddExistingNumberException();
     }
     base.Insert(value, pos);
 }
예제 #9
0
파일: List.cs 프로젝트: 0x0all/MyProgram
 // 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);
 }
예제 #10
0
    void OnListSelectChange(ListElement data)
    {
        mSelectNodel = data;
        //var hierarchyData = (HierarchyListWindow.HierarchyElementData) data.ElementData;

        mSelectElement = InspectorElement.GetInspectorElement(data);

        if (mSelectElement != null)
        {
            infoWindow.Refresh(mSelectElement);
        }
    }
예제 #11
0
 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;
     }
 }
예제 #12
0
 public int Pop()
 {
     if (!this.IsEmpty())
     {
         int result = this.head.Value;
         this.head = this.head.Next;
         return result;
     }
     else
     {
         throw new StackEmptyException();
     }
 }
예제 #13
0
    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);
        }
    }
예제 #14
0
 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);
     }
 }
예제 #15
0
 /// <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;
 }
예제 #16
0
        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;
        }
예제 #17
0
 /// <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;
 }
예제 #18
0
파일: List.cs 프로젝트: 0x0all/MyProgram
 // 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);
 }
예제 #19
0
        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)));
            }
        }
예제 #20
0
        /// <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;
        }
예제 #21
0
 /// <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;
 }
예제 #22
0
 /// <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;
 }
예제 #23
0
        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();
            }
        }
예제 #24
0
        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;
            }
        }
예제 #25
0
 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;
 }
예제 #26
0
        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));
            }
        }
예제 #27
0
 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;
 }
예제 #28
0
        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;
        }
예제 #29
0
        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();
        }
예제 #30
0
        /// <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");
        }
예제 #31
0
    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);
    }
예제 #32
0
 /// <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;
 }
예제 #33
0
 public ForwardEnumerator(LinkedList <T> list, ListElement start)
 {
     _list    = list;
     _current = start;
 }
예제 #34
0
 protected override void Awake()
 {
     base.Awake();
     m_myElement     = transform.parent.parent; //Reaches up to OverViewTreeElement
     m_myListElement = GetComponent <ListElement>();
 }
예제 #35
0
 public void OnTriggerDeSelect(ListElement element)
 {
 }
예제 #36
0
 public ListElement(T value, ListElement <T> previous = null)
 {
     Value    = value;
     Previous = previous;
 }
예제 #37
0
 public void SetNext(ListElement value)
 {
     this.next = value;
 }
예제 #38
0
        /**
         * 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);
                }
            }
        }
예제 #39
0
 public ListElement(int newData, ListElement listElement)
 {
     this.data = newData;
     this.next = listElement;
 }
예제 #40
0
        /**
         * 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);
        }
예제 #41
0
        /**
         * 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);
            }
        }
예제 #42
0
 public void MouseUp()
 {
     m_held = null;
 }
예제 #43
0
 public ListElement(string value, ListElement next)
 {
     this.value = value;
     this.next  = next;
 }
예제 #44
0
 // moves to the next list element
 public bool MoveNext()
 {
     position++;
     current = current == null ? list.top : current.Next;
     return(position < list.Length());
 }
예제 #45
0
 public void Reset()
 {
     _current = null;
 }
예제 #46
0
 public void MouseCaptureChanged()
 {
     m_held    = null;
     m_hovered = null;
 }
예제 #47
0
 public void OnAddNewElement(ListElement element)
 {
     BundleDataManager.Instance.OnAddNewElement(element);
 }
예제 #48
0
 /// <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));
 }
예제 #49
0
 /// <summary>
 /// удалить список
 /// </summary>
 public void DeleteList()
 {
     head = null;
 }
예제 #50
0
파일: List.cs 프로젝트: tara-sova/HOMEWORK
 /// <summary>
 /// Delete List.
 /// </summary>
 /// <param name="value">Value to be pushed.</param>
 public void Removing()
 {
     head = null;
 }
예제 #51
0
 public ReverseEnumerator(LinkedList <T> list, ListElement start)
 {
     _list    = list;
     _current = start;
 }
예제 #52
0
 public void Visit(ListElement element)
 {
     // Lists cannot be converted to a span => ignore element
     //TODO: Log warning for ignored element
 }
예제 #53
0
 //constructor
 public ListElement(int value, ListElement nextElement)
 {
     Value = value;
     Next  = nextElement;
 }
예제 #54
0
 public ListElement(int length, ListElement next)
 {
     this.length = length;
     this.next   = next;
 }
예제 #55
0
 // returns the enumerator to the position previous to the first element
 public void Reset()
 {
     position = -1;
     current  = null;
 }
예제 #56
0
파일: List.cs 프로젝트: Ususucsus/hw
 /// <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;
 }
예제 #57
0
 // constructor
 public ListEnumerator(List <T> newList)
 {
     list    = newList;
     current = null;
 }
예제 #58
0
 /// <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);
 }
예제 #59
0
 public ListTimelineTabModel(string tabName, ListElement list)
     : base(tabName)
 {
     this.ListInfo = list;
 }
예제 #60
0
 /// <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);
 }