当前位置: 首页>>代码示例>>C#>>正文


C# LinkedListNode类代码示例

本文整理汇总了C#中LinkedListNode的典型用法代码示例。如果您正苦于以下问题:C# LinkedListNode类的具体用法?C# LinkedListNode怎么用?C# LinkedListNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


LinkedListNode类属于命名空间,在下文中一共展示了LinkedListNode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Put

        public override void Put(object Key, object Value)
        {
            if (Get(Key) == null)
            {
                this.openNode.Value.ItemKey = Key;
                this.openNode.Value.ItemValue = Value;
                this.list.AddFirst(this.openNode);
                this.lookup.Add(Key, this.openNode);

                if (this.list.Count > this.capacity)
                {
                    // last node is to be removed and saved for the next addition to the cache
                    this.openNode = this.list.Last;

                    // remove from list & dictionary
                    this.list.RemoveLast();
                    this.lookup.Remove(this.openNode.Value.ItemKey);
                }
                else
                {
                    // still filling the cache, create a new open node for the next time
                    this.openNode = new LinkedListNode<ListValueEntry>(new ListValueEntry(null, null));
                }
            }
        }
开发者ID:Rationalle,项目名称:ravendb,代码行数:25,代码来源:SimpleLRUCache.cs

示例2: GetLastNode

 public override LinkedListNode<Token> GetLastNode(LinkedList<Token> lToken, LinkedListNode<Token> current)
 {
     //Find the partner
     if(current.Previous.Value.Type == TokenType.ROUND_BRANCE_OPEN)
         return current.Previous.Value.Partner;
     return current;
 }
开发者ID:ninox92,项目名称:DP2-Compiler,代码行数:7,代码来源:CompiledCondition.cs

示例3: IntersectionTestsNoSet

        public void IntersectionTestsNoSet()
        {
            var inputOne = new LinkedListNode<int>(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);

            for (var currentInt = inputOne; currentInt.Next != null; currentInt = currentInt.Next)
            {
                for (var i = 0; i < 10; i++)
                {
                    var inputTwo = new LinkedListNode<int>(11, 12, 13, 14, 15, 16, 17, 18, 19, 20);

                    var currentRepl = inputTwo;
                    for (var j = 0; j < i; j++, currentRepl = currentRepl.Next) ;

                    if (currentRepl.Last == null)
                    {
                        inputTwo = currentInt;
                    }
                    else
                    {
                        currentRepl.Last.Next = currentInt;
                    }

                    Assert.AreSame(currentInt, Answer.GetIntersectionNoSet(inputOne, inputTwo));
                }
            }
        }
开发者ID:EricSquires,项目名称:Cracking-the-Coding-Interview,代码行数:26,代码来源:AnswerTests.cs

示例4: TryParse

 public override bool TryParse(IDictionary<string, string> properties, LinkedListNode<PathSegment> currentParser, ref LinkedListNode<string> currentSegment)
 {
     bool success = currentSegment != null && currentSegment.Value.EqualsNoCase(_path);
     if (success)
         currentSegment = currentSegment.Next;
     return success;
 }
开发者ID:modulexcite,项目名称:openwrap,代码行数:7,代码来源:LiteralPathSegment.cs

示例5: Main

        static void Main(string[] args)
        {
            Stack<int> s = new Stack<int>();
            Queue<int> q = new Queue<int>();

            for (int i = 0; i < 10; ++i)
            {
                s.Push(i);
                q.Enqueue(i);
            }

            while (s.Count > 0)
                Console.WriteLine(s.Pop()); //Writes them out in reverse order (9-0). 'Cause FILO

            while (q.Count > 0)
                Console.WriteLine(q.Dequeue()); //Writes them in order (FIFO).
            //New list
            LinkedList<Student> TwoKay = new LinkedList<Student>();
            //New node with a new student
            LinkedListNode<Student> Current = new LinkedListNode<Student>(new Student("AJ", 123432)); 
            //Take that node and add it to my list.
            TwoKay.AddFirst(Current);
            //Add a student without creating a node first
            TwoKay.AddBefore(TwoKay.First, new Student("Caleb", 123456));
            //Show it
            PrintList(TwoKay);
            //Change AJ
            TwoKay.First.Next.Value = new Student("AJ the Mighty", 333);
            //Print the list again
            PrintList(TwoKay);
            //Now, note that the value of current changed, too, because reference.
            Console.WriteLine(Current.Value);
        }
开发者ID:Hailieu,项目名称:CMPE1700.Public,代码行数:33,代码来源:Program.cs

示例6: compile

        public override NodeLinkedList compile(ref LinkedListNode<Token> currentToken)
        {
            Token leftToken = currentToken.Value;
            string leftName = leftToken.value;
            Token rightToken = currentToken.Next.Next.Value;
            string rightName = rightToken.value;
            //Compile left of +
            //var leftCompiled = CompilerFactory.Instance.CreateCompiledStatement(currentToken);

            //Temp variable for left
            if(leftToken.type == VariableType.Number) {
                leftName = CompiledStatement.getUniqueId();
                Compiled.Add(new DirectFunctionCallNode("ConstantToReturn", leftToken.value));
                Compiled.Add(new DirectFunctionCallNode("ReturnToVariable", leftName));
            }

            //Temp variable for right
            if(rightToken.type == VariableType.Number) {
                rightName = CompiledStatement.getUniqueId();
                Compiled.Add(new DirectFunctionCallNode("ConstantToReturn", rightToken.value));
                Compiled.Add(new DirectFunctionCallNode("ReturnToVariable", rightName));
            }
            currentToken = currentToken.Next;

            if(currentToken.Value.type == VariableType.Add){
                Compiled.Add(new FunctionCallNode("Add", leftName, rightName));
            }

            currentToken = currentToken.Next.Next;
            return Compiled;
        }
开发者ID:TerrorEdje,项目名称:GeenCompilerOfzo,代码行数:31,代码来源:CompiledPlus.cs

示例7: isMatch

 public override bool isMatch(LinkedListNode<Token> currentToken)
 {
     // matched if current is a variable or number, next is a plus en third is also a number or variable.
     return (currentToken.Value.type == VariableType.Variable || currentToken.Value.type == VariableType.Number)
         && currentToken.Next.Value.type == VariableType.Add
         && (currentToken.Next.Next.Value.type == VariableType.Variable || currentToken.Next.Next.Value.type == VariableType.Number);
 }
开发者ID:TerrorEdje,项目名称:GeenCompilerOfzo,代码行数:7,代码来源:CompiledPlus.cs

示例8: MoveNext

 public void MoveNext()
 {
     bool final = enumer.MoveNext();
     if (final)
     {
         if (enumer.Current is Coroutine)
         {
             var co = enumer.Current as Coroutine;
             LinkedListNode<Action> node = new LinkedListNode<Action>(co.MoveNext);
             stack.AddLast(node);
             co.MoveNext();
         }
         if (enumer.Current is IEnumerator)
         {
             var co = new Coroutine(enumer.Current as IEnumerator);
             LinkedListNode<Action> node = new LinkedListNode<Action>(co.MoveNext);
             stack.AddLast(node);
             co.MoveNext();
         }
     }
     else
     {
         stack.Last.Value -= MoveNext;
         if (stack.Last.Value == null)
         {
             stack.RemoveLast();
             Run();
         }
     }
 }
开发者ID:zardlee1937,项目名称:CBT,代码行数:30,代码来源:Coroutine.cs

示例9: GetUntilPartner

        private static List<LinkedListNode<Token>> GetUntilPartner(ref LinkedListNode<Token> fromToken)
        {
            List<LinkedListNode<Token>> l = new List<LinkedListNode<Token>>();

            Token toToken = fromToken.Value.Partner;
            fromToken = fromToken.Next;
            while (fromToken.Value != toToken)
            {
                l.Add(fromToken);
                fromToken = fromToken.Next;
            }

            return l;
            //Token toToken = fromToken.Value.Partner;
            //fromToken = fromToken.Next;
            //string code = "";
            //while (fromToken.Value != toToken)
            //{
            //    code += fromToken.Value.Text;

            //    fromToken = fromToken.Next;
            //}

            //return code;
        }
开发者ID:acdoorn,项目名称:tokenizer,代码行数:25,代码来源:BaseCompiler.cs

示例10: compile

        public override NodeLinkedList compile(ref LinkedListNode<Token> currentToken)
        {
            Token leftToken = currentToken.Value;
            string leftName = leftToken.value;
            Token rightToken = currentToken.Next.Next.Value;
            string rightName = rightToken.value;
            //Compile left of +
            //var leftCompiled = CompilerFactory.Instance.CreateCompiledStatement(currentToken);

            //Temp variable for left
            if(leftToken.type == TokenType.Number) {
                leftName = CompiledStatement.getUniqueId();
                Compiled.Add(new DirectFunctionCallNode(DirectFunctionCallNode.CONSTANTTORETURN, leftToken));
                Compiled.Add(new DirectFunctionCallNode(DirectFunctionCallNode.RETURNTOVARIABLE, leftName));
            }

            //Temp variable for right
            if(rightToken.type == TokenType.Number) {
                rightName = CompiledStatement.getUniqueId();
                Compiled.Add(new DirectFunctionCallNode(DirectFunctionCallNode.CONSTANTTORETURN, rightToken));
                Compiled.Add(new DirectFunctionCallNode(DirectFunctionCallNode.RETURNTOVARIABLE, rightName));
            }
            currentToken = currentToken.Next;

            if(currentToken.Value.type == TokenType.Multiply) {
                Compiled.Add(new FunctionCallNode("Multiply", leftName, rightName));
            }

            currentToken = currentToken.Next.Next;
            return Compiled;
        }
开发者ID:armed10,项目名称:GeenCompilerOfzo,代码行数:31,代码来源:CompiledMultiply.cs

示例11: Translate

        public override LinkedListNode<Tag> Translate(TranslateContext context, LinkedListNode<Tag> self) {
            var cellCount = self.AsEnumerable().Skip(1).TakeWhile(x => !(x.Value is NewLineTag)).Count(x => x.Value is TableCellTag);

            // only start tables if this tag appears on start of line
            if (cellCount > 0 && self.AsReverseEnumerable().TakeWhile(x => !(x.Value is NewLineTag)).All(x => x.Value is SpaceTag)) 
            {
                context.Append("<table class='wikitable'>");

                var n = self;
                while (n?.Value is TableCellTag)
                {
                    if (cellCount != n.AsEnumerable().Skip(1).TakeWhile(x => !(x.Value is NewLineTag)).Count(x => x.Value is TableCellTag)) break;

                    context.Append("<tr>");

                    LinkedListNode<Tag> nextStop;
                    while ((nextStop = n.Next.FirstNode(x => x.Value is NewLineTag || x.Value is TableCellTag))?.Value is TableCellTag)
                    {
                        context.Append("<td>");
                        n.Next.TranslateUntilNode(context, nextStop);
                        context.Append("</td>");
                        n = nextStop;
                    }

                    context.Append("</tr>");

                    n = n.FirstNode(x => x.Value is NewLineTag)?.Next; // move after nextline
                }
                context.Append("</table>");
                return n;
            }
            context.Append(Text);
            
            return self.Next;
        }
开发者ID:DeinFreund,项目名称:Zero-K-Infrastructure,代码行数:35,代码来源:TableCellTag.cs

示例12: loadData

    public void loadData(Action<CachedDS> callback, LinkedListNode<CachedDS> next) {
      var v_cli = new JsonStoreClient {
        AjaxMng = ajaxMng,
        BioCode = bioCode
      };
      v_cli.Load(bioParams, (s, a) => {
        if (a.Response.Success) {
          if (v_cli.JSMetadata.Fields.Count > 1) {
            this.metadata = v_cli.JSMetadata;
            this.data = v_cli.DS;
          }
          
          var eve = this.OnLoaded;
          if (eve != null)
            eve(this, new EventArgs());
          
          if (callback != null)
            callback(this);

          if (next != null)
            next.Value.loadData(callback, next.Next);

        }
      });
    }
开发者ID:tormoz70,项目名称:Bio.Framework.8,代码行数:25,代码来源:CachedDS.cs

示例13: FinalizeDataHolder

		public void FinalizeDataHolder()
		{
			SpawnEntry = NPCMgr.GetSpawnEntry(SpawnId);
			if (SpawnEntry == null)
			{
				ContentMgr.OnInvalidDBData("{0} had an invalid SpawnId.", this);
			}
			else
			{
				var added = false;
				var cur = SpawnEntry.Waypoints.First;
				while (cur != null)
				{
					if (cur.Value.Id > Id)
					{
						Node = cur.List.AddBefore(cur, this);
						added = true;
						break;
					}
					
					if (cur.Value.Id == Id)
					{
						ContentMgr.OnInvalidDBData("Found multiple Waypoints with the same Id {0} for SpawnEntry {1}", Id, SpawnEntry);
						return;
					}
					cur = cur.Next;
				}

				if (!added)
				{
					SpawnEntry.HasDefaultWaypoints = false;
					Node = SpawnEntry.Waypoints.AddLast(this);
				}
			}
		}
开发者ID:primax,项目名称:WCell,代码行数:35,代码来源:WaypointEntry.cs

示例14: LoadLevelSelection

 public void LoadLevelSelection(string fileAddress,ContentManager content)
 {
     levelData.Clear();
     BFFileReader reader = new BFFileReader(fileAddress);
     reader.Open();
     string line = null;
     while((line = reader.ReadLine())!= null)
     {
         LevelData levelInfo;
         string[] param = line.Split(' ');
         levelInfo.name = param[0];
         levelInfo.texture = content.Load<Texture2D>(param[1]);
         levelData.AddLast(levelInfo);
     }
     reader.Close();
     data = levelData.First;
     //load the left and right arrow textures
     leftArrowTex = content.Load<Texture2D>("Left");
     rightArrowTex = content.Load<Texture2D>("Right");
     Texture2D exit = content.Load<Texture2D>("Exit");
     Texture2D start = content.Load<Texture2D>("Resume");
     font = content.Load<SpriteFont>("Font");
     selection = new Menu(4, new Rectangle(parent.ScreenWidth/2 -(exit.Width/2),parent.ScreenHeight/2+15,exit.Width,exit.Height),start,exit);
     time = InputDelay;
 }
开发者ID:JustinWeq,项目名称:Barfight-CS-285,代码行数:25,代码来源:LevelSelection.cs

示例15: LoadDataIntoCells

 public void LoadDataIntoCells(ICell[] cells)
 {
     while (TokenNode != null)
     {
         switch (TokenNode.Value.Tag)
         {
             case Tag.FORMAT_START:
                 {
                     FAPFileVerifier verifier = new FAPFileVerifier(TokenNode);
                     if (verifier.IsAssignmentFormat() == false)
                     {
                         throw new InvalidFAPFileException("The Format type of the given assignment file is not of an \"ASSIGNMENT\" type");
                     }
                 }
                 break;
             case Tag.GENERATION_INFORMATION_START:
                 {
                     FAPFileVerifier verifier = new FAPFileVerifier(TokenNode);
                     if (verifier.ValidScenarioID(ScenarioID) == false)
                     {
                         throw new InvalidScenarioIDException("The given assignment file scenario id doesn't match the problem file scenario id");
                     }
                 }
                 break;
             case Tag.CELLS_START: FillCells(cells);
                 break;
         }
         TokenNode = TokenNode.Next;
     }
 }
开发者ID:Burmudar,项目名称:FAPPSO,代码行数:30,代码来源:FAPTestLoader.cs


注:本文中的LinkedListNode类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。