System.Collections.Generic.Stack.Clear()

Here are the examples of the csharp api System.Collections.Generic.Stack.Clear() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

584 Examples 7

19 Source : HistoryList.cs
with MIT License
from Elem8100

public void Add(T item)
        {
            this.stackPrev.Push(item);
            this.stackNext.Clear();
        }

19 Source : HistoryList.cs
with MIT License
from Elem8100

public void AddRange(IEnumerable<T> collection)
        {
            foreach (T item in collection)
            {
                this.stackPrev.Push(item);
            }
            this.stackNext.Clear();
        }

19 Source : HistoryList.cs
with MIT License
from Elem8100

public void Clear()
        {
            this.stackPrev.Clear();
            this.stackNext.Clear();
        }

19 Source : WcR2Renderer.cs
with MIT License
from Elem8100

public void Dispose()
        {
            this.activeEffects.Clear();

            this.clippingRasterizeState?.Dispose();
            this.rasterizeStateGeometry?.Dispose();
            this.spriteBatch?.Dispose();
            this.basicEffect?.Dispose();
        }

19 Source : MeshBatcher.cs
with MIT License
from Elem8100

public void Dispose()
        {
            this.sprite?.Dispose();
            this.spineRender?.Effect.Dispose();
            this.alphaBlendState.Dispose();
            this.meshPool.Clear();
        }

19 Source : JsonFormatter.cs
with BSD 2-Clause "Simplified" License
from emilianavt

public void Clear()
        {
            m_w.Clear();
            m_stack.Clear();
            m_stack.Push(new Context(Current.ROOT));
        }

19 Source : AddMany.cs
with BSD 3-Clause "New" or "Revised" License
from Entomy

[IterationCleanup]
		public void IterationCleanup() {
			c5_arraylist.Clear();
			while (c5_circularqueue.Count > 0) {
				_ = c5_circularqueue.Dequeue(); // There's no Clear() so we have to do this
			}
			c5_hashbag.Clear();
			c5_hashedarraylist.Clear();
			c5_hashedlinkedlist.Clear();
			c5_hashset.Clear();
			while (c5_intervalheap.Count > 0) {
				_ = c5_intervalheap.DeleteMax(); // There's no Clear() so we have to do this
			}
			c5_linkedlist.Clear();
			c5_sortedarray.Clear();
			c5_treebag.Clear();
			c5_treeset.Clear();
			collectathon_boundedarray.Clear();
			collectathon_dynamicarray.Clear();
			collectathon_singlylinkedlist.Clear();
			msft_hashset.Clear();
			msft_linkedlist.Clear();
			msft_list.Clear();
			msft_queue.Clear();
			msft_segmentedlist.Clear();
			msft_sortedset.Clear();
			msft_stack.Clear();
		}

19 Source : AddSingle.cs
with BSD 3-Clause "New" or "Revised" License
from Entomy

[IterationCleanup]
		public void IterationCleanup() {
			c5_arraylist.Clear();
			if (c5_circularqueue.Count > 0) {
				_ = c5_circularqueue.Dequeue(); // There's no Clear() so we have to do this
			}
			c5_hashbag.Clear();
			c5_hashedarraylist.Clear();
			c5_hashedlinkedlist.Clear();
			c5_hashset.Clear();
			if (c5_intervalheap.Count > 0) {
				_ = c5_intervalheap.DeleteMax(); // There's no Clear() so we have to do this
			}
			c5_linkedlist.Clear();
			c5_sortedarray.Clear();
			c5_treebag.Clear();
			c5_treeset.Clear();
			collectathon_boundedarray.Clear();
			collectathon_dynamicarray.Clear();
			collectathon_singlylinkedlist.Clear();
			msft_hashset.Clear();
			msft_linkedlist.Clear();
			msft_list.Clear();
			msft_queue.Clear();
			msft_segmentedlist.Clear();
			msft_sortedset.Clear();
			msft_stack.Clear();
		}

19 Source : EpiInfo7EventGrammar.cs
with Apache License 2.0
from Epi-Info

private void TokenReadEvent(LALRParser parser, TokenReadEventArgs args)
        {

            

            try
            {
                args.Token.UserObject = CreateObject(args.Token);
            }
            catch (ApplicationException ex)
            {
                args.Continue = false;
                tokenStack.Clear();
                Logger.Log(DateTime.Now + ":  " + ex.Message);
                throw ex;
            }
        }

19 Source : EpiMenuEventGrammar.cs
with Apache License 2.0
from Epi-Info

private void TokenReadEvent(LALRParser parser, TokenReadEventArgs args)
        {
            try
            {
                args.Token.UserObject = CreateObject(args.Token);
            }
            catch (ApplicationException ex)
            {
                args.Continue = false;
                tokenStack.Clear();
                //Logger.Log(DateTime.Now + ":  " + ex.Message);
                throw ex;
            }
        }

19 Source : CommandManager.cs
with MIT License
from EverestAPI

public void ExecuteCommand(Command cmd) {
            if (disabledCommands > 0) {
                return;
            }

            //multirange ?
            if (cmd.ts.CurrentTB.Selection.ColumnSelectionMode) {
                if (cmd is UndoableCommand)
                    //make wrapper
                {
                    cmd = new MultiRangeCommand((UndoableCommand) cmd);
                }
            }


            if (cmd is UndoableCommand) {
                //if range is ColumnRange, then create wrapper
                (cmd as UndoableCommand).autoUndo = autoUndoCommands > 0;
                history.Push(cmd as UndoableCommand);
            }

            try {
                cmd.Execute();
            } catch (ArgumentOutOfRangeException) {
                //OnTextChanging cancels enter of the text
                if (cmd is UndoableCommand) {
                    history.Pop();
                }
            }

            //
            redoStack.Clear();
            //
            TextSource.CurrentTB.OnUndoRedoStateChanged();
        }

19 Source : CommandManager.cs
with MIT License
from EverestAPI

internal void ClearHistory() {
            history.Clear();
            redoStack.Clear();
            TextSource.CurrentTB.OnUndoRedoStateChanged();
        }

19 Source : OuiOOBE.cs
with MIT License
from EverestAPI

public override IEnumerator Enter(Oui from) {
            Overworld.ShowInputUI = true;
            fromModOptions = from is OuiModOptions;

            if (fromModOptions)
                Add(new Coroutine(FadeBgTo(1f)));
            else
                fade = 1f;

            steps.Clear();
            step = 0;
            ReloadMenu();

            menu.Visible = Visible = true;
            menu.Focused = false;

            for (float p = 0f; p < 1f; p += Engine.DeltaTime * 4f) {
                menu.X = offScreenRightX - 1920f * Ease.CubeOut(p);
                yield return null;
            }

            menu.Focused = true;
        }

19 Source : UpdateContext.cs
with MIT License
from fairygui

public void Begin()
		{
			current = this;

			alpha = 1;
			grayed = false;
			blendMode = BlendMode.Normal;

			clipped = false;
			_clipStack.Clear();

			_renderTargetCount = 0;

			Stats.ObjectCount = 0;
			Stats.GraphicsCount = 0;

#if !CE_5_5
			Global.gEnv.pRenderer.SetViewport(0, 0, (int)Stage.inst.width, (int)Stage.inst.height);
#endif
		}

19 Source : FairyBatch.cs
with MIT License
from fairygui

public void Begin()
		{
			grayed = false;
			alpha = 1;

			_blendMode = BlendMode.Normal;
			_texture = null;
			_grayed = false;
			_clipped = false;
			_clipStack.Clear();
			_renderTargets.Clear();
			_hasRenderTarget = false;

			Stats.ObjectCount = 0;
			Stats.GraphicsCount = 0;

			_originalViewPort = _device.Viewport;
			_device.BlendState = BlendState.NonPremultiplied;
			_device.DepthStencilState = DepthStencilState.None;
			_device.RasterizerState = RasterizerState.CullNone;
			_device.SamplerStates[0] = SamplerState.PointClamp;

			_spritePreplaced.Apply();
			_defaultPreplaced.Apply();
		}

19 Source : GoalMap.cs
with MIT License
from FaronBracy

public ReadOnlyCollection<Path> FindPaths( int x, int y )
         {
            _paths.Clear();
            _currentPath.Clear();
            _visited.Clear();
            RecursivelyFindPaths( x, y );
            var paths = new List<Path>();
            foreach ( Path path in _paths )
            {
               paths.Add( path );
            }
            return new ReadOnlyCollection<Path>( paths );
         }

19 Source : RTFParserBase.cs
with MIT License
from FenPhoenix

protected void ResetStreamBase(long streamLength)
        {
            Length = streamLength;

            CurrentPos = 0;

            // Don't clear the buffer; we don't need to and it wastes time
            _bufferPos = _bufferLen - 1;

            _unGetBuffer.Clear();
            _unGetBufferEmpty = true;
        }

19 Source : Agent_GS.cs
with MIT License
from ferranmartinvila

private void Update()
        {
            //Switch between agent idle and action state
            switch (_state)
            {
                case AGENT_STATE.AG_IDLE:
                    {
                        if (_current_plan.Count == 0)
                        {
                            //The behaviour basically defines the goal world state
                            _behaviour.Update();

                            //Generate the plan
                            _current_plan = planner.GeneratePlan(this);

                            //In avaliable plan case
                            if (_current_plan.Count > 0)
                            {
                                if (on_agent_plan_change_delegate != null)
                                {
                                    on_agent_plan_change_delegate();
                                }
                            }
                            //In no action to execute case we execute the agent idle action
                            else
                            {
                                _idle_action.Execute();
                                //At this point the idle action is exectued in an endless update
                                if (_idle_action.state > Action_GS.ACTION_STATE.A_UPDATE)
                                {
                                    _idle_action.state = Action_GS.ACTION_STATE.A_UPDATE;
                                }
                            }
                        }
                        else
                        {
                            //We need to finish the idle action
                            _idle_action.Execute();

                            //WHen the idle action ends we can execute the agent plan
                            if (_idle_action.state == Action_GS.ACTION_STATE.A_COMPLETE)
                            {
                                //Avoid lag on actions planning
                                if(Time.deltaTime > 1.0f / 30.0f)
                                {
                                    Debug.LogError("Performance is probably beeing afected by simultanious agents planning");
                                    break;
                                }


                                //Agent state is setted to action state
                                _state = AGENT_STATE.AG_ACTION;

                                //Awake all the plan actions
                                ActionNode_GS[] plan_actions = _current_plan.ToArray();
                                foreach (ActionNode_GS action_node in plan_actions)
                                {
                                    action_node.action.ActionAwake();
                                }

                                //Focus first plan action
                                _current_action = _current_plan.Pop();
                                _current_action.agent = this;
                                _popped_actions.Add(_current_action);
                            }
                        }
                    }
                    break;
                case AGENT_STATE.AG_ACTION:
                    {
                        //Current action execution result
                        Action_GS.ACTION_RESULT execution_result = _current_action.action.Execute();

                        //Behaviour in action update
                        if(_behaviour.InActionUpdate(execution_result, _current_action.action.state) == false)
                        {
                            execution_result = Action_GS.ACTION_RESULT.A_ERROR;
                        }

                        //React with the action result
                        if (execution_result == Action_GS.ACTION_RESULT.A_NEXT && _current_action.action.state == Action_GS.ACTION_STATE.A_COMPLETE)
                        {
                            //Apply action effects
                            _current_action.ApplyActionNodeEffects();

                            //Check current plan
                            if (_current_plan.Count > 0)
                            {
                                //Avaliable action case
                                _current_action = _current_plan.Pop();
                                _current_action.agent = this;
                                _popped_actions.Add(_current_action);
                            }
                            else
                            {
                                //Plan completed case
                                _current_action = null;
                                _current_plan.Clear();
                                _popped_actions.Clear();
                                _state = AGENT_STATE.AG_IDLE;

                                if (on_agent_plan_change_delegate != null)
                                {
                                    on_agent_plan_change_delegate();
                                }
                                return;
                            }
                        }
                        else if (execution_result == Action_GS.ACTION_RESULT.A_ERROR)
                        {
                            //In action error the plan is cancelled
                            _current_action = null;
                            _current_plan.Clear();
                            _popped_actions.Clear();
                            _state = AGENT_STATE.AG_IDLE;

                            if (on_agent_plan_change_delegate != null)
                            {
                                on_agent_plan_change_delegate();
                            }
                        }
                    }
                    break;
            }
        }

19 Source : Pool.cs
with Mozilla Public License 2.0
from finol-digital

public void Clear() => objects.Clear();

19 Source : Context.cs
with GNU General Public License v3.0
from FNGgames

public void ClearComponentPool(int index) {
            var componentPool = _componentPools[index];
            if(componentPool != null) {
                componentPool.Clear();
            }
        }

19 Source : ChartControl.cs
with MIT License
from funwaywang

protected void ClearCommandHistory()
        {
            CommandHistory.Clear();
            UndoCommandHistory.Clear();
            OnCommandHistoryChanged();
        }

19 Source : ChartControl.cs
with MIT License
from funwaywang

public bool ExecuteCommand(Command command)
        {
            if (command == null)
                throw new ArgumentNullException("command");

            if (command.Execute())
            {
                if (command.NoteHistory)
                {
                    CommandHistory.Push(command);
                    UndoCommandHistory.Clear();
                    OnCommandHistoryChanged();
                }

                if (command.AfterSelection != null)
                    Select(command.AfterSelection);
            }

            return true;
        }

19 Source : CacheIndentEngine.cs
with MIT License
from fuse-open

public void Reset()
		{
			currentEngine.Reset();
			cachedEngines.Clear();
		}

19 Source : TagReader.cs
with MIT License
from fuse-open

void StoreObject(InternalObject obj)
		{
			objects.Add(obj);
			
			// Now combine properly-nested elements:
			if (elementNameStack == null)
				return; // parsing tag soup
			InternalTag tag = obj as InternalTag;
			if (tag == null)
				return;
			if (tag.IsEmptyTag) {
				// the tag is its own element
				objects[objects.Count - 1] = new InternalElement(tag) {
					Length = tag.Length,
					LengthTouched = tag.LengthTouched,
					IsPropertyNested = true,
					StartRelativeToParent = tag.StartRelativeToParent,
					NestedObjects = new [] { tag.SetStartRelativeToParent(0) }
				};
			} else if (tag.IsStartTag) {
				elementNameStack.Push(tag.Name);
			} else if (tag.IsEndTag && elementNameStack.Count > 0) {
				// Now look for the start element:
				int startIndex = objects.Count - 2;
				bool ok = false;
				string expectedName = elementNameStack.Pop();
				if (tag.Name == expectedName) {
					while (startIndex > 0) {
						var startTag = objects[startIndex] as InternalTag;
						if (startTag != null) {
							if (startTag.IsStartTag) {
								ok = (startTag.Name == expectedName);
								break;
							} else if (startTag.IsEndTag) {
								break;
							}
						}
						startIndex--;
					}
				}
				if (ok) {
					// We found a correct nesting, let's create an element:
					InternalObject[] nestedObjects = new InternalObject[objects.Count - startIndex];
					int oldStartRelativeToParent = objects[startIndex].StartRelativeToParent;
					int pos = 0;
					int maxLengthTouched = 0;
					for (int i = 0; i < nestedObjects.Length; i++) {
						nestedObjects[i] = objects[startIndex + i].SetStartRelativeToParent(pos);
						maxLengthTouched = Math.Max(maxLengthTouched, pos + nestedObjects[i].LengthTouched);
						pos += nestedObjects[i].Length;
					}
					objects.RemoveRange(startIndex, nestedObjects.Length);
					objects.Add(
						new InternalElement((InternalTag)nestedObjects[0]) {
							HasEndTag = true,
							IsPropertyNested = true,
							Length = pos,
							LengthTouched = maxLengthTouched,
							StartRelativeToParent = oldStartRelativeToParent,
							NestedObjects = nestedObjects
						});
				} else {
					// Mismatched name - the nesting isn't properly;
					// clear the whole stack so that none of the currently open elements are closed as properly-nested.
					elementNameStack.Clear();
				}
			}
		}

19 Source : ClosureConversionTransform.cs
with MIT License
from fuse-open

public override bool Begin(Function f)
        {
            if (f.HasBody && HasLambda(f.Body))
            {
                _occurrences.Clear();
                _occurrences.Push(new Variables());
                _lambdasToLift.Clear();
                _locals.Clear();
                _locals.Push(Tree.Create(new HashSet<Variable>()));
                return true;
            }

            return false; // Ignore function bodies without lambdas to save some work
        }

19 Source : UpdateContext.cs
with Apache License 2.0
from fy0

public void Begin()
        {
            current = this;

            renderingOrder = 0;
            batchingDepth = 0;
            rectMaskDepth = 0;
            stencilReferenceValue = 0;
            alpha = 1;
            grayed = false;

            clipped = false;
            _clipStack.Clear();

            Stats.ObjectCount = 0;
            Stats.GraphicsCount = 0;

            _tmpBegin = OnBegin;
            OnBegin = null;

            //允许OnBegin里再次Add,这里没有做死锁检查
            while (_tmpBegin != null)
            {
                _tmpBegin.Invoke();
                _tmpBegin = OnBegin;
                OnBegin = null;
            }

            working = true;
        }

19 Source : XML.cs
with Apache License 2.0
from fy0

public void Parse(string aSource)
        {
            Reset();
            
            XML lastOpenNode = null;
            sNodeStack.Clear();

            XMLIterator.Begin(aSource);
            while (XMLIterator.NextTag())
            {
                if (XMLIterator.tagType == XMLTagType.Start || XMLIterator.tagType == XMLTagType.Void)
                {
                    XML childNode;
                    if (lastOpenNode != null)
                        childNode = new XML();
                    else
                    {
                        if (this.name != null)
                        {
                            Reset();
                            throw new Exception("Invalid xml format - no root node.");
                        }
                        childNode = this;
                    }

                    childNode.name = XMLIterator.tagName;
                    childNode._attributes = XMLIterator.GetAttributes(childNode._attributes);

                    if (lastOpenNode != null)
                    {
                        if (XMLIterator.tagType != XMLTagType.Void)
                            sNodeStack.Push(lastOpenNode);
                        if (lastOpenNode._children == null)
                            lastOpenNode._children = new XMLList();
                        lastOpenNode._children.Add(childNode);
                    }
                    if (XMLIterator.tagType != XMLTagType.Void)
                        lastOpenNode = childNode;
                }
                else if (XMLIterator.tagType == XMLTagType.End)
                {
                    if (lastOpenNode == null || lastOpenNode.name != XMLIterator.tagName)
                    {
                        Reset();
                        throw new Exception("Invalid xml format - <" + XMLIterator.tagName + "> dismatched.");
                    }

                    if (lastOpenNode._children == null || lastOpenNode._children.Count == 0)
                    {
                        lastOpenNode.text = XMLIterator.GetText();
                    }

                    if (sNodeStack.Count > 0)
                        lastOpenNode = sNodeStack.Pop();
                    else
                        lastOpenNode = null;
                }
            }
        }

19 Source : GroupBrush.cs
with MIT License
from game-ci

public override void Pick(GridLayout gridLayout, GameObject brushTarget, BoundsInt position, Vector3Int pickStart)
        {
            // Do standard pick if user has selected a custom bounds
            if (position.size.x > 1 || position.size.y > 1 || position.size.z > 1)
            {
                base.Pick(gridLayout, brushTarget, position, pickStart);
                return;
            }

            Tilemap tilemap = brushTarget.GetComponent<Tilemap>();
            if (tilemap == null)
                return;

            Reset();

            // Determine size of picked locations based on gap and limit
            Vector3Int limitOrigin = position.position - limit;
            Vector3Int limitSize = Vector3Int.one + limit * 2;
            BoundsInt limitBounds = new BoundsInt(limitOrigin, limitSize);
            BoundsInt pickBounds = new BoundsInt(position.position, Vector3Int.one);
 
            m_VisitedLocations.SetAll(false);
            m_VisitedLocations.Set(GetIndex(position.position, limitOrigin, limitSize), true);
            m_NextPosition.Clear();
            m_NextPosition.Push(position.position);

            while (m_NextPosition.Count > 0)
            {
                Vector3Int next = m_NextPosition.Pop();
                if (tilemap.GetTile(next) != null)
                {
                    Encapsulate(ref pickBounds, next);
                    BoundsInt gapBounds = new BoundsInt(next - gap, Vector3Int.one + gap * 2);
                    foreach (var gapPosition in gapBounds.allPositionsWithin)
                    {
                        if (!limitBounds.Contains(gapPosition))
                            continue;
                        int index = GetIndex(gapPosition, limitOrigin, limitSize);
                        if (!m_VisitedLocations.Get(index))
                        {
                            m_NextPosition.Push(gapPosition);
                            m_VisitedLocations.Set(index, true);
                        }
                    }
                }
            }

            UpdateSizeAndPivot(pickBounds.size, position.position - pickBounds.position);

            foreach (Vector3Int pos in pickBounds.allPositionsWithin)
            {
                Vector3Int brushPosition = new Vector3Int(pos.x - pickBounds.x, pos.y - pickBounds.y, pos.z - pickBounds.z);
                if (m_VisitedLocations.Get(GetIndex(pos, limitOrigin, limitSize)))
                {
                    PickCell(pos, brushPosition, tilemap);
                }
            }
        }

19 Source : JsonFormatter.cs
with MIT License
from GameBuildingBlocks

public static string PrettyPrint(string input)
    {
		// Clear all states
	    inDoubleString = false;
	    inSingleString = false;
	    inVariablereplacedignment = false;
	    prevChar = '\0';
	    context.Clear();
		
        var output = new StringBuilder(input.Length * 2);
        char c;

        for (int i = 0; i < input.Length; i++)
        {
            c = input[i];

            switch (c)
            {
                case '[':
                case '{':
                    if (!InString())
                    {
                        if (inVariablereplacedignment || (context.Count > 0 && context.Peek() != JsonContextType.Array))
                        {
                            output.Append(NewLine);
                            BuildIndents(context.Count, output);
                        }
                        output.Append(c);
                        context.Push(JsonContextType.Object);
                        output.Append(NewLine);
                        BuildIndents(context.Count, output);
                    }
                    else
                        output.Append(c);

                    break;

                case ']':
                case '}':
                    if (!InString())
                    {
                        output.Append(NewLine);
                        context.Pop();
                        BuildIndents(context.Count, output);
                        output.Append(c);
                    }
                    else
                        output.Append(c);

                    break;
                case '=':
                    output.Append(c);
                    break;

                case ',':
                    output.Append(c);

                    if (!InString())
                    {
                        BuildIndents(context.Count, output);
                        output.Append(NewLine);
                        BuildIndents(context.Count, output);
                        inVariablereplacedignment = false;
                    }

                    break;

                case '\'':
                    if (!inDoubleString && prevChar != '\\')
                        inSingleString = !inSingleString;

                    output.Append(c);
                    break;

                case ':':
                    if (!InString())
                    {
                        inVariablereplacedignment = true;
                        output.Append(Space);
                        output.Append(c);
                        output.Append(Space);
                    }
                    else
                        output.Append(c);

                    break;

                case '"':
                    if (!inSingleString && prevChar != '\\')
                        inDoubleString = !inDoubleString;

                    output.Append(c);
                    break;
                case ' ':
                    if (InString())
                        output.Append(c);
                    break;

                default:
                    output.Append(c);
                    break;
            }
            prevChar = c;
        }

        return output.ToString();
    }

19 Source : ObjectPool.cs
with Apache License 2.0
from gamesparks

public void Dispose()
		{
			lock (stack)
			{
				stack.Clear();
			}
		}

19 Source : Container.cs
with MIT License
from GarfieldJiang

private void Clear()
        {
            m_BindingDatasToBuild.Clear();
            m_InterfaceTypeToSingletonMap.Clear();
            m_InterfaceTypeToBindingDataMap.Clear();
        }

19 Source : Container.cs
with MIT License
from GarfieldJiang

private object MakeInternal(BindingData bindingData)
        {
            object serviceInstance;
            m_HasMadeSomething = true;
            try
            {
                serviceInstance = ResolveInternal(bindingData);
            }
            finally
            {
                m_BindingDatasToBuild.Clear();
            }

            return serviceInstance;
        }

19 Source : MarkupGUI.cs
with MIT License
from gasgiant

public void Clear()
            {
                groups.Clear();
            }

19 Source : InspectorLayoutController.cs
with MIT License
from gasgiant

public void Begin()
        {
            groupsStack.Clear();
            currentPath.Clear();
            prefsPrefix = defaultPrefsPrefix;
            localScopeStart = -1;
            activeTabName = null;
            addSpaceBeforeHeader = false;
        }

19 Source : DynamicTree.cs
with MIT License
from Genbox

public void Query(Func<int, bool> callback, ref AABB aabb)
        {
            _queryStack.Clear();
            _queryStack.Push(_root);

            while (_queryStack.Count > 0)
            {
                int nodeId = _queryStack.Pop();
                if (nodeId == NullNode)
                    continue;

                TreeNode<T> node = _nodes[nodeId];

                if (AABB.TestOverlap(ref node.AABB, ref aabb))
                {
                    if (node.IsLeaf())
                    {
                        bool proceed = callback(nodeId);
                        if (!proceed)
                            return;
                    }
                    else
                    {
                        _queryStack.Push(node.Child1);
                        _queryStack.Push(node.Child2);
                    }
                }
            }
        }

19 Source : DynamicTree.cs
with MIT License
from Genbox

public void RayCast(Func<RayCastInput, int, float> callback, ref RayCastInput input)
        {
            Vector2 p1 = input.Point1;
            Vector2 p2 = input.Point2;
            Vector2 r = p2 - p1;
            Debug.replacedert(r.LengthSquared() > 0.0f);
            r.Normalize();

            // v is perpendicular to the segment.
            Vector2 absV = MathUtils.Abs(new Vector2(-r.Y, r.X)); //Velcro: Inlined the 'v' variable

            // Separating axis for segment (Gino, p80).
            // |dot(v, p1 - c)| > dot(|v|, h)

            float maxFraction = input.MaxFraction;

            // Build a bounding box for the segment.
            AABB segmentAABB = new AABB();
            {
                Vector2 t = p1 + maxFraction * (p2 - p1);
                Vector2.Min(ref p1, ref t, out segmentAABB.LowerBound);
                Vector2.Max(ref p1, ref t, out segmentAABB.UpperBound);
            }

            _raycastStack.Clear();
            _raycastStack.Push(_root);

            while (_raycastStack.Count > 0)
            {
                int nodeId = _raycastStack.Pop();
                if (nodeId == NullNode)
                    continue;

                TreeNode<T> node = _nodes[nodeId];

                if (!AABB.TestOverlap(ref node.AABB, ref segmentAABB))
                    continue;

                // Separating axis for segment (Gino, p80).
                // |dot(v, p1 - c)| > dot(|v|, h)
                Vector2 c = node.AABB.Center;
                Vector2 h = node.AABB.Extents;
                float separation = Math.Abs(Vector2.Dot(new Vector2(-r.Y, r.X), p1 - c)) - Vector2.Dot(absV, h);
                if (separation > 0.0f)
                    continue;

                if (node.IsLeaf())
                {
                    RayCastInput subInput;
                    subInput.Point1 = input.Point1;
                    subInput.Point2 = input.Point2;
                    subInput.MaxFraction = maxFraction;

                    float value = callback(subInput, nodeId);

                    if (value == 0.0f)
                    {
                        // the client has terminated the raycast.
                        return;
                    }

                    if (value > 0.0f)
                    {
                        // Update segment bounding box.
                        maxFraction = value;
                        Vector2 t = p1 + maxFraction * (p2 - p1);
                        segmentAABB.LowerBound = Vector2.Min(p1, t);
                        segmentAABB.UpperBound = Vector2.Max(p1, t);
                    }
                }
                else
                {
                    _raycastStack.Push(node.Child1);
                    _raycastStack.Push(node.Child2);
                }
            }
        }

19 Source : GroupPostOrderIterator.cs
with MIT License
from Geotab

public IEnumerator<Group> GetEnumerator()
        {
            stack.Clear();
            foreach (var root in groupTreesToDelete)
            {
                StackNodeAndItsChildren(root);
            }
            while (stack.Count > 0)
            {
                var currentGroup = stack.Pop();
                yield return currentGroup;
            }
        }

19 Source : BitReader.cs
with zlib License
from gibbed

private void Initialize(byte[] buffer, int offset, int length)
        {
            this._Frames.Clear();
            this._ReadBits = new BitArray(length * 8);

            this._Buffer = new byte[length];
            this._Length = length * 8;
            this._Position = 0;
            Array.Copy(buffer, offset, this._Buffer, 0, length);
        }

19 Source : XPathParser.cs
with Apache License 2.0
from Ginger-Automation

public Node Parse(string xpathExpr, IXPathBuilder<Node> builder) {
            Debug.replacedert(this.scanner == null && this.builder == null);
            Debug.replacedert(builder != null);

            Node result     = default(Node);
            this.scanner    = new XPathScanner(xpathExpr);
            this.builder    = builder;
            this.posInfo.Clear();

            try {
                builder.StartBuild();
                result = ParseExpr();
                scanner.CheckToken(LexKind.Eof);
            }
            catch (XPathParserException e) {
                if (e.queryString == null) {
                    e.queryString = scanner.Source;
                    PopPosInfo(out e.startChar, out e.endChar);
                }
                throw;
            }
            finally {
                result = builder.EndBuild(result);
#if DEBUG
                this.builder = null;
                this.scanner = null;
#endif
            }
            Debug.replacedert(posInfo.Count == 0, "PushPosInfo() and PopPosInfo() calls have been unbalanced");
            return result;
        }

19 Source : GenericArgumentResolver.cs
with MIT License
from GiovanniZambiasi

bool GetGenericBaseType(TypeDefinition td, TypeReference baseType, out GenericInstanceType found)
        {
            stack.Clear();
            TypeReference parent = td.BaseType;
            found = null;

            while (parent != null)
            {
                string parentName = parent.FullName;

                // strip generic <T> parameters from clreplaced name (if any)
                parentName = Extensions.StripGenericParametersFromClreplacedName(parentName);

                if (parentName == baseType.FullName)
                {
                    found = parent as GenericInstanceType;
                    break;
                }

                try
                {
                    stack.Push(parent);
                    parent = parent.Resolve().BaseType;
                }
                catch (replacedemblyResolutionException)
                {
                    // this can happen for plugins.
                    break;
                }
            }

            return found != null;
        }

19 Source : ReferenceCollector.cs
with MIT License
from gmhevinci

public void Clear()
		{
			_collector.Clear();
			SpawnCount = 0;
		}

19 Source : GameObjectPoolController.cs
with Apache License 2.0
from googlevr

void LateUpdate() {
      if (toReparentStack.Count > 0) {
        var enumerator = toReparentStack.GetEnumerator();
        while (enumerator.MoveNext()) {
          GameObject obj = enumerator.Current;
          obj.transform.SetParent(transform, false);
        }
        toReparentStack.Clear();
      }
    }

19 Source : ObjectPool.cs
with Apache License 2.0
from googlevr

public void Clear() {
      pool.Clear();
    }

19 Source : FileSketchSet.cs
with Apache License 2.0
from googlevr

public void RequestOnlyLoadedMetadata(List<int> requests) {
    DumpIconTextures();  // This clears out any pending requests
    m_RequestedLoads.Clear();

    requests.Reverse();
    foreach (var iSketch in requests) {
      Debug.replacedert(IsSketchIndexValid(iSketch));
      m_RequestedLoads.Push(iSketch);
    }
  }

19 Source : ReferenceImageCatalog.cs
with Apache License 2.0
from googlevr

void ProcessReferenceDirectory(bool userOverlay = true) {
    m_DirNeedsProcessing = false;
    var oldImagesByPath = m_Images.ToDictionary(image => image.FilePath);

    // If we changed a file, pretend like we don't have it.
    if (m_ChangedFile != null) {
      if (oldImagesByPath.ContainsKey(m_ChangedFile)) {
        oldImagesByPath.Remove(m_ChangedFile);
      }
      m_ChangedFile = null;
    }
    m_Images.Clear();

    // Changed file may be deleted from the directory so indices are invalidated.
    m_RequestedLoads.Clear();

    //look for .jpg or .png files
    try {
      // GetFiles returns full paths, surprisingly enough.
      foreach (var filePath in Directory.GetFiles(m_ReferenceDirectory)) {
        string ext = Path.GetExtension(filePath).ToLower();
        if (ext != ".jpg" && ext != ".jpeg" && ext != ".png") { continue; }
        try {
          m_Images.Add(oldImagesByPath[filePath]);
          oldImagesByPath.Remove(filePath);
        } catch (KeyNotFoundException) {
          m_Images.Add(new ReferenceImage(filePath));
        }
      }
    } catch (DirectoryNotFoundException) {}

    if (oldImagesByPath.Count > 0) {
      foreach (var entry in oldImagesByPath) {
        entry.Value.Unload();
      }
      Resources.UnloadUnusedreplacedets();
    }

    if (m_RunningImageCacheCoroutine) {
      m_ResetImageEnumeration = true;
    } else {
      m_RunningImageCacheCoroutine = true;
      if (userOverlay) {
        StartCoroutine(
            OverlayManager.m_Instance.RunInCompositor(
                OverlayType.LoadImages,
                LoadAvailableImageCaches(),
                fadeDuration: 0.25f));
      } else {
        StartCoroutine(LoadAvailableImageCaches());
      }
    }

    if (CatalogChanged != null) {
      CatalogChanged();
    }
  }

19 Source : SketchMemoryScript.cs
with Apache License 2.0
from googlevr

public void ClearRedo() {
    foreach (var command in m_RedoStack) {
      command.Dispose();
    }
    m_RedoStack.Clear();
  }

19 Source : SketchMemoryScript.cs
with Apache License 2.0
from googlevr

public void ClearMemory() {
    if (m_ScenePlayback != null) {
      // Ensure scene playback completes so that geometry is in state expected by rest of system.
      // TODO: Lift this restriction.  Artifact observed is a ghost stroke from previously deleted
      // scene appearing briefly.
      App.Instance.CurrentSketchTime = float.MaxValue;
      m_ScenePlayback.Update();
      m_ScenePlayback = null;
    }
    SelectionManager.m_Instance.ForgetStrokesInSelectionCanvas();
    ClearRedo();
    foreach (var item in m_MemoryList) {
      //skip batched strokes here because they'll all get dumped in ResetPools()
      if (item.m_Type != Stroke.Type.BatchedBrushStroke) {
        item.DestroyStroke();
      }
    }
    m_OperationStack.Clear();
    if (OperationStackChanged != null) { OperationStackChanged(); }
    m_LastOperationStackCount = 0;
    m_MemoryList.Clear();
    App.GroupManager.ResetGroups();
    SelectionManager.m_Instance.OnFinishReset();
    m_CurrentNodeByTime = null;
    foreach (var canvas in App.Scene.AllCanvases) {
      canvas.BatchManager.ResetPools();
    }
    TiltMeterScript.m_Instance.ResetMeter();
    App.Instance.CurrentSketchTime = 0;
    App.Instance.AutosaveRestoreFileExists = false;
    m_HasVisibleObjects = false;
    m_MemoryExceeded = false;
    m_LastCheckedVertCount = 0;
    MemoryWarningAccepted = false;
    App.Switchboard.TriggerMemoryExceededChanged();
    SaveLoadScript.m_Instance.MarkAsAutosaveDone();
    SaveLoadScript.m_Instance.NewAutosaveFile();
    m_xfSketchInitial_RS = TrTransform.idenreplacedy;
    Resources.UnloadUnusedreplacedets();
  }

19 Source : GameObjectPoolController.cs
with Apache License 2.0
from googlevr

void LateUpdate() {
    if (toReparentStack.Count > 0) {
      var enumerator = toReparentStack.GetEnumerator();
      while (enumerator.MoveNext()) {
        GameObject obj = enumerator.Current;
        obj.transform.SetParent(transform, false);
      }
      toReparentStack.Clear();
    }
  }

19 Source : ObjectPool.cs
with Apache License 2.0
from googlevr

public void Clear() {
    pool.Clear();
  }

19 Source : Menu.cs
with MIT License
from GroovyGiantPanda

public void OpenMenu(MenuModel menu, bool resetMenu = false)
		{
			var PreviousMenu = CurrentMenu;
			CurrentMenu = menu;
			CurrentMenu.Refresh();
			if (!menu.Initialized)
				menu.Init();
			if (!resetMenu && PreviousMenu != null)
			{ 
				ParentMenuStack.Push(PreviousMenu);
			}
			else
			{
				ParentMenuStack.Clear();
			}
		}

See More Examples