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


C# BlockList类代码示例

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


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

示例1: GameState

 public GameState()
 {
     Blocks = new BlockList();
     Effects = new EffectList();
     Units = new UnitList();
     Projectiles = new ProjectileList();
 }
开发者ID:EttienneS,项目名称:Contingency,代码行数:7,代码来源:GameState.cs

示例2: GameWorld

    public GameWorld(int width, int height, ContentManager Content)
    {
        screenWidth = width;
        screenHeight = height;
        random = new Random();
        gameState = GameState.Menu;
        inputHelper = new InputHelper();
        block = Content.Load<Texture2D>("block");
        reset = Content.Load<Texture2D>("reset");
        font = Content.Load<SpriteFont>("SpelFont");
        font2 = Content.Load<SpriteFont>("SpriteFont1");
        font3 = Content.Load<SpriteFont>("SpriteFont2");
        playButton = Content.Load<Texture2D>("Play");
        optionsButton = Content.Load<Texture2D>("Options");
        backButton = Content.Load<Texture2D>("Back");
        polytris = Content.Load<Texture2D>("Polytris");
        grid = new TetrisGrid(block);
        level = 1;
        levelspeed = 1;
        score = 0;
        i = (int)random.Next(7) + 1;
        i2 = (int)random.Next(7) + 1;
        blockcounter = 1;

        blocks = new BlockList(block, Content);          //Voegen de verschillende blockobjecten toe aan de lijst
        block1 = new Block1(block, Content);
        blocks.Add(block1, 1);
        block2 = new Block2(block, Content);
        blocks.Add(block2, 2);
        block3 = new Block3(block, Content);
        blocks.Add(block3, 3);
        block4 = new Block4(block, Content);
        blocks.Add(block4, 4);
        block5 = new Block5(block, Content);
        blocks.Add(block5, 5);
        block6 = new Block6(block, Content);
        blocks.Add(block6, 6);
        block7 = new Block7(block, Content);
        blocks.Add(block7, 7);

        //Voegen de verschillende blockobjecten toe aan een tweede lijst voor het tekenen van het volgende blokje
        block1res = new Block1(block, Content);
        blocks.AddToReserve(block1res, 1);
        block2res = new Block2(block, Content);
        blocks.AddToReserve(block2res, 2);
        block3res = new Block3(block, Content);
        blocks.AddToReserve(block3res, 3);
        block4res = new Block4(block, Content);
        blocks.AddToReserve(block4res, 4);
        block5res = new Block5(block, Content);
        blocks.AddToReserve(block5res, 5);
        block6res = new Block6(block, Content);
        blocks.AddToReserve(block6res, 6);
        block7res = new Block7(block, Content);
        blocks.AddToReserve(block7res, 7);

        options = new Options(block, reset, backButton, width, height, font, blocks);
        menu = new Menu(playButton, optionsButton, polytris, width, height);
        gameOver = new GameOver(backButton, width, height);
    }
开发者ID:Supercarlijn,项目名称:Tetris,代码行数:60,代码来源:GameWorld.cs

示例3: TestGet

		public virtual void TestGet()
		{
			BlockList<string> list = new BlockList<string>(4);
			string b;
			try
			{
				b = list[-1];
			}
			catch (IndexOutOfRangeException badIndex)
			{
				NUnit.Framework.Assert.AreEqual((-1).ToString(), badIndex.Message);
			}
			try
			{
				b = list[0];
			}
			catch (IndexOutOfRangeException badIndex)
			{
				NUnit.Framework.Assert.AreEqual(0.ToString(), badIndex.Message);
			}
			try
			{
				b = list[4];
			}
			catch (IndexOutOfRangeException badIndex)
			{
				NUnit.Framework.Assert.AreEqual(4.ToString(), badIndex.Message);
			}
			string fooStr = "foo";
			string barStr = "bar";
			string foobarStr = "foobar";
			list.AddItem(fooStr);
			list.AddItem(barStr);
			list.AddItem(foobarStr);
			NUnit.Framework.Assert.AreSame(fooStr, list[0]);
			NUnit.Framework.Assert.AreSame(barStr, list[1]);
			NUnit.Framework.Assert.AreSame(foobarStr, list[2]);
			try
			{
				b = list[3];
			}
			catch (IndexOutOfRangeException badIndex)
			{
				NUnit.Framework.Assert.AreEqual(3.ToString(), badIndex.Message);
			}
		}
开发者ID:LunarLanding,项目名称:ngit,代码行数:46,代码来源:BlockListTest.cs

示例4: Options

 public Options(Texture2D blockSprite, Texture2D resetSprite, Texture2D backSprite, int screenWidth, int screenHeight, SpriteFont spriteFont, BlockList blocks)
 {
     block = blockSprite;
     reset = resetSprite;
     back = backSprite;
     this.screenWidth = screenWidth;
     this.screenHeight = screenHeight;
     this.blocks = blocks;
     block1 = blocks.Find(1);
     block2 = blocks.Find(2);
     block3 = blocks.Find(3);
     block4 = blocks.Find(4);
     block5 = blocks.Find(5);
     block6 = blocks.Find(6);
     block7 = blocks.Find(7);
     font = spriteFont;
     backRect = new Rectangle(screenWidth / 2 - backSprite.Width / 2, screenHeight - backSprite.Height - 100, backSprite.Width, backSprite.Height);
 }
开发者ID:Supercarlijn,项目名称:Tetris,代码行数:18,代码来源:Options.cs

示例5: TestEmptyList

		public virtual void TestEmptyList()
		{
			BlockList<string> empty;
			empty = new BlockList<string>();
			NUnit.Framework.Assert.AreEqual(0, empty.Count);
			NUnit.Framework.Assert.IsTrue(empty.IsEmpty());
			NUnit.Framework.Assert.IsFalse(empty.Iterator().HasNext());
			empty = new BlockList<string>(0);
			NUnit.Framework.Assert.AreEqual(0, empty.Count);
			NUnit.Framework.Assert.IsTrue(empty.IsEmpty());
			NUnit.Framework.Assert.IsFalse(empty.Iterator().HasNext());
			empty = new BlockList<string>(1);
			NUnit.Framework.Assert.AreEqual(0, empty.Count);
			NUnit.Framework.Assert.IsTrue(empty.IsEmpty());
			NUnit.Framework.Assert.IsFalse(empty.Iterator().HasNext());
			empty = new BlockList<string>(64);
			NUnit.Framework.Assert.AreEqual(0, empty.Count);
			NUnit.Framework.Assert.IsTrue(empty.IsEmpty());
			NUnit.Framework.Assert.IsFalse(empty.Iterator().HasNext());
		}
开发者ID:LunarLanding,项目名称:ngit,代码行数:20,代码来源:BlockListTest.cs

示例6: Run

        public double Run(double[] data, int detailLevel)
        {
            var sb = new StringBuilder();
            for (int i = 0; i < data.Length; i++)
            {
                sb.Append(data[i]);
                if (i < data.Length - 1) sb.Append(",");
            }

            string datastring = sb.ToString();

            var textBlock = new ImportFromTextBlock
            {
                Text = datastring,
                ColumnSeparator = ",",
                SignalStart = 0,
                SignalNameInFirstColumn = false
            };

            var dwtBlock = new DWTBlock
            {
                WaveletName = "db10",
                Level = detailLevel,
                ExtensionMode = SignalExtension.ExtensionMode.ZeroPadding
            };


            var b = new BlockList();
            b.Add(textBlock);
            b.Add(dwtBlock);

            textBlock.ConnectTo(dwtBlock);

            b.ExecuteAll();

            int length = dwtBlock.OutputNodes[dwtBlock.OutputNodes.Count-1].Object[detailLevel - 1].Samples.Length;

            double val = dwtBlock.OutputNodes[dwtBlock.OutputNodes.Count-1].Object[detailLevel - 1].Samples[length - 1];

            return val;
        }
开发者ID:ifzz,项目名称:QuantSys,代码行数:41,代码来源:SignalTransform.cs

示例7: TestAddRejectsBadIndexes

 public virtual void TestAddRejectsBadIndexes()
 {
     BlockList<int> list = new BlockList<int>(4);
     list.AddItem(Sharpen.Extensions.ValueOf(41));
     try
     {
         list.Add(-1, Sharpen.Extensions.ValueOf(42));
     }
     catch (IndexOutOfRangeException badIndex)
     {
         NUnit.Framework.Assert.AreEqual((-1).ToString(), badIndex.Message);
     }
     try
     {
         list.Add(4, Sharpen.Extensions.ValueOf(42));
     }
     catch (IndexOutOfRangeException badIndex)
     {
         NUnit.Framework.Assert.AreEqual(4.ToString(), badIndex.Message);
     }
 }
开发者ID:ashmind,项目名称:ngit,代码行数:21,代码来源:BlockListTest.cs

示例8: FFTTransform

 public static List<double> FFTTransform(List<double> serie)
 {
     //Declaring the blocks
     var inputSeriesBlock = new InputSeriesBlock();
     inputSeriesBlock.SetSeries(serie);
     var outputSeriesBlock = new OutputSeriesBlock();
     var fFTBlock = new FFTBlock
     {
         Mode = ManagedFFTModeEnum.UseLookupTable
     };
     //Connecting the blocks
     inputSeriesBlock.OutputNodes[0].ConnectTo(fFTBlock.InputNodes[0]);
     fFTBlock.OutputNodes[1].ConnectTo(outputSeriesBlock.InputNodes[0]);
     //Appending the blocks to a block list and execute all
     var blockList = new BlockList();
     blockList.Add(inputSeriesBlock);
     blockList.Add(fFTBlock);
     blockList.Add(outputSeriesBlock);
     blockList.ExecuteAll();
     return outputSeriesBlock.GetSeries();
 }
开发者ID:Bruhankovi4,项目名称:Emotyper,代码行数:21,代码来源:DataTransformations.cs

示例9: BlockAllocationTableReader

        /// <summary>
        /// create a BlockAllocationTableReader for an existing filesystem. Side
        /// effect: when this method finishes, the BAT blocks will have
        /// been Removed from the raw block list, and any blocks labeled as
        /// 'unused' in the block allocation table will also have been
        /// Removed from the raw block list. </summary>
        /// <param name="bigBlockSizse">the poifs bigBlockSize</param>
        /// <param name="block_count">the number of BAT blocks making up the block allocation table</param>
        /// <param name="block_array">the array of BAT block indices from the
        /// filesystem's header</param>
        /// <param name="xbat_count">the number of XBAT blocks</param>
        /// <param name="xbat_index">the index of the first XBAT block</param>
        /// <param name="raw_block_list">the list of RawDataBlocks</param>
        public BlockAllocationTableReader(POIFSBigBlockSize bigBlockSizse,
                                          int block_count,
                                          int[] block_array,
                                          int xbat_count,
                                          int xbat_index,
                                          BlockList raw_block_list)
            : this(bigBlockSizse)
        {
            SanityCheckBlockCount(block_count);

            RawDataBlock[] blocks = new RawDataBlock[block_count];
            int limit = Math.Min(block_count, block_array.Length);
            int block_index;

            for (block_index = 0; block_index < limit; block_index++)
            {
                int nextOffset = block_array[block_index];
                if (nextOffset > raw_block_list.BlockCount())
                {
                    throw new IOException("Your file contains " + raw_block_list.BlockCount() +
                                           " sectors, but the initial DIFAT array at index " + block_index +
                                           " referenced block # " + nextOffset + ". This isn't allowed and " +
                                           " your file is corrupt");
                }

                blocks[block_index] = (RawDataBlock)raw_block_list.Remove(nextOffset);
            }
            if (block_index < block_count)
            {

                // must have extended blocks
                if (xbat_index < 0)
                {
                    throw new IOException(
                        "BAT count exceeds limit, yet XBAT index indicates no valid entries");
                }
                int chain_index = xbat_index;
                int max_entries_per_block = BATBlock.EntriesPerXBATBlock;
                int chain_index_offset = BATBlock.XBATChainOffset;

                // Each XBAT block contains either:
                //  (maximum number of sector indexes) + index of next XBAT
                //  some sector indexes + FREE sectors to max # + EndOfChain
                for (int j = 0; j < xbat_count; j++)
                {
                    limit = Math.Min(block_count - block_index,
                                     max_entries_per_block);
                    byte[] data = raw_block_list.Remove(chain_index).Data;
                    int offset = 0;

                    for (int k = 0; k < limit; k++)
                    {
                        blocks[block_index++] =
                            (RawDataBlock)raw_block_list.Remove(LittleEndian.GetInt(data, offset));
                        offset += LittleEndianConsts.INT_SIZE;
                    }
                    chain_index = LittleEndian.GetInt(data, chain_index_offset);
                    if (chain_index == POIFSConstants.END_OF_CHAIN)
                    {
                        break;
                    }
                }
            }
            if (block_index != block_count)
            {
                throw new IOException("Could not find all blocks");
            }

            // now that we have all of the raw data blocks, go through and
            // create the indices
            SetEntries((ListManagedBlock[])blocks, raw_block_list);
        }
开发者ID:xiepeixing,项目名称:npoi,代码行数:85,代码来源:BlockAllocationTableReader.cs

示例10: FetchBlocks

        /// <summary>
        /// walk the entries from a specified point and return the
        /// associated blocks. The associated blocks are Removed from the block list
        /// </summary>
        /// <param name="startBlock">the first block in the chain</param>
        /// <param name="headerPropertiesStartBlock"></param>
        /// <param name="blockList">the raw data block list</param>
        /// <returns>array of ListManagedBlocks, in their correct order</returns>
        public ListManagedBlock[] FetchBlocks(int startBlock, int headerPropertiesStartBlock,
                                        BlockList blockList)
        {
            List<ListManagedBlock> blocks = new List<ListManagedBlock>();
            int currentBlock = startBlock;
            bool firstPass = true;
            ListManagedBlock dataBlock = null;

            while (currentBlock != POIFSConstants.END_OF_CHAIN)
            {
                try
                {
                    dataBlock = blockList.Remove(currentBlock);
                    blocks.Add(dataBlock);
                    currentBlock = _entries[currentBlock];
                    firstPass = false;
                }
                catch(Exception)
                {
                    if (currentBlock == headerPropertiesStartBlock)
                    {
                        // Special case where things are in the wrong order
                        _logger.Log(POILogger.WARN, "Warning, header block comes after data blocks in POIFS block listing");
                        currentBlock = POIFSConstants.END_OF_CHAIN;
                    }
                    else if (currentBlock == 0 && firstPass)
                    {
                        // Special case where the termination isn't done right
                        //  on an empty set
                        _logger.Log(POILogger.WARN, "Warning, incorrectly terminated empty data blocks in POIFS block listing (should end at -2, ended at 0)");
                        currentBlock = POIFSConstants.END_OF_CHAIN;
                    }
                    else
                    {
                        // Ripple up
                        throw;
                    }
                }
            }
            ListManagedBlock[] array = blocks.ToArray();
            return (array);
        }
开发者ID:xiepeixing,项目名称:npoi,代码行数:50,代码来源:BlockAllocationTableReader.cs

示例11: VisitSwitch

 protected override object VisitSwitch(Variable selector, BlockList targets, Statement stat, object arg) {
   InitializedVariables iv=(InitializedVariables)arg;
   CheckUse(iv, selector, stat);
   return arg;
 }
开发者ID:tapicer,项目名称:resource-contracts-.net,代码行数:5,代码来源:DefiniteAssignmentAnalysis.cs

示例12: Parse

		/// <summary>Parse the pack stream.</summary>
		/// <remarks>Parse the pack stream.</remarks>
		/// <param name="receiving">
		/// receives progress feedback during the initial receiving
		/// objects phase. If null,
		/// <see cref="NGit.NullProgressMonitor">NGit.NullProgressMonitor</see>
		/// will be
		/// used.
		/// </param>
		/// <param name="resolving">receives progress feedback during the resolving objects phase.
		/// 	</param>
		/// <returns>
		/// the pack lock, if one was requested by setting
		/// <see cref="SetLockMessage(string)">SetLockMessage(string)</see>
		/// .
		/// </returns>
		/// <exception cref="System.IO.IOException">the stream is malformed, or contains corrupt objects.
		/// 	</exception>
		public virtual PackLock Parse(ProgressMonitor receiving, ProgressMonitor resolving
			)
		{
			if (receiving == null)
			{
				receiving = NullProgressMonitor.INSTANCE;
			}
			if (resolving == null)
			{
				resolving = NullProgressMonitor.INSTANCE;
			}
			if (receiving == resolving)
			{
				receiving.Start(2);
			}
			try
			{
				ReadPackHeader();
				entries = new PackedObjectInfo[(int)objectCount];
				baseById = new ObjectIdOwnerMap<PackParser.DeltaChain>();
				baseByPos = new LongMap<PackParser.UnresolvedDelta>();
				deferredCheckBlobs = new BlockList<PackedObjectInfo>();
				receiving.BeginTask(JGitText.Get().receivingObjects, (int)objectCount);
				try
				{
					for (int done = 0; done < objectCount; done++)
					{
						IndexOneObject();
						receiving.Update(1);
						if (receiving.IsCancelled())
						{
							throw new IOException(JGitText.Get().downloadCancelled);
						}
					}
					ReadPackFooter();
					EndInput();
				}
				finally
				{
					receiving.EndTask();
				}
				if (!deferredCheckBlobs.IsEmpty())
				{
					DoDeferredCheckBlobs();
				}
				if (deltaCount > 0)
				{
					if (resolving is BatchingProgressMonitor)
					{
						((BatchingProgressMonitor)resolving).SetDelayStart(1000, TimeUnit.MILLISECONDS);
					}
					resolving.BeginTask(JGitText.Get().resolvingDeltas, deltaCount);
					ResolveDeltas(resolving);
					if (entryCount < objectCount)
					{
						if (!IsAllowThin())
						{
							throw new IOException(MessageFormat.Format(JGitText.Get().packHasUnresolvedDeltas
								, Sharpen.Extensions.ValueOf(objectCount - entryCount)));
						}
						ResolveDeltasWithExternalBases(resolving);
						if (entryCount < objectCount)
						{
							throw new IOException(MessageFormat.Format(JGitText.Get().packHasUnresolvedDeltas
								, Sharpen.Extensions.ValueOf(objectCount - entryCount)));
						}
					}
					resolving.EndTask();
				}
				packDigest = null;
				baseById = null;
				baseByPos = null;
			}
			finally
			{
				try
				{
					if (readCurs != null)
					{
						readCurs.Release();
					}
				}
//.........这里部分代码省略.........
开发者ID:LunarLanding,项目名称:ngit,代码行数:101,代码来源:PackParser.cs

示例13: VisitBlockList

 public virtual Differences VisitBlockList(BlockList list1, BlockList list2,
   out BlockList changes, out BlockList deletions, out BlockList insertions){
   changes = list1 == null ? null : list1.Clone();
   deletions = list1 == null ? null : list1.Clone();
   insertions = list1 == null ? new BlockList() : list1.Clone();
   //^ assert insertions != null;
   Differences differences = new Differences();
   for (int j = 0, n = list2 == null ? 0 : list2.Count; j < n; j++){
     //^ assert list2 != null;
     Block nd2 = list2[j];
     if (nd2 == null) continue;
     insertions.Add(null);
   }
   TrivialHashtable savedDifferencesMapFor = this.differencesMapFor;
   this.differencesMapFor = null;
   TrivialHashtable matchedNodes = new TrivialHashtable();
   for (int i = 0, k = 0, n = list1 == null ? 0 : list1.Count; i < n; i++){
     //^ assert list1 != null && changes != null && deletions != null;
     Block nd1 = list1[i]; 
     if (nd1 == null) continue;
     Differences diff;
     int j;
     Block nd2 = this.GetClosestMatch(nd1, list1, list2, i, ref k, matchedNodes, out diff, out j);
     if (nd2 == null || diff == null){Debug.Assert(nd2 == null && diff == null); continue;}
     matchedNodes[nd1.UniqueKey] = nd1;
     matchedNodes[nd2.UniqueKey] = nd2;
     changes[i] = diff.Changes as Block;
     deletions[i] = diff.Deletions as Block;
     insertions[i] = diff.Insertions as Block;
     insertions[n+j] = nd1; //Records the position of nd2 in list2 in case the change involved a permutation
     Debug.Assert(diff.Changes == changes[i] && diff.Deletions == deletions[i] && diff.Insertions == insertions[i]);
     differences.NumberOfDifferences += diff.NumberOfDifferences;
     differences.NumberOfSimilarities += diff.NumberOfSimilarities;
   }
   //Find deletions
   for (int i = 0, n = list1 == null ? 0 : list1.Count; i < n; i++){
     //^ assert list1 != null && changes != null && deletions != null;
     Block nd1 = list1[i]; 
     if (nd1 == null) continue;
     if (matchedNodes[nd1.UniqueKey] != null) continue;
     changes[i] = null;
     deletions[i] = nd1;
     insertions[i] = null;
     differences.NumberOfDifferences += 1;
   }
   //Find insertions
   for (int j = 0, n = list1 == null ? 0 : list1.Count, m = list2 == null ? 0 : list2.Count; j < m; j++){
     //^ assert list2 != null;
     Block nd2 = list2[j]; 
     if (nd2 == null) continue;
     if (matchedNodes[nd2.UniqueKey] != null) continue;
     insertions[n+j] = nd2;  //Records nd2 as an insertion into list1, along with its position in list2
     differences.NumberOfDifferences += 1; //REVIEW: put the size of the tree here?
   }
   if (differences.NumberOfDifferences == 0){
     changes = null;
     deletions = null;
     insertions = null;
   }
   this.differencesMapFor = savedDifferencesMapFor;
   return differences;
 }
开发者ID:tapicer,项目名称:resource-contracts-.net,代码行数:62,代码来源:Comparer.cs

示例14: VisitBlockList

 public virtual BlockList VisitBlockList(BlockList blockList)
 {
     if (blockList == null) return null;
     for (int i = 0, n = blockList.Count; i < n; i++)
         blockList[i] = this.VisitBlock(blockList[i]);
     return blockList;
 }
开发者ID:julianhaslinger,项目名称:SHFB,代码行数:7,代码来源:StandardVisitor.cs

示例15: FetchBlocks

        /// <summary>
        /// walk the entries from a specified point and return the
        /// associated blocks. The associated blocks are Removed from the block list
        /// </summary>
        /// <param name="startBlock">the first block in the chain</param>
        /// <param name="blockList">the raw data block list</param>
        /// <returns>array of ListManagedBlocks, in their correct order</returns>
        public ListManagedBlock[] FetchBlocks(int startBlock,
                                        BlockList blockList)
        {
            IList blocks = new ArrayList();
            int currentBlock = startBlock;

            while (currentBlock != POIFSConstants.END_OF_CHAIN)
            {
                blocks.Add(blockList.Remove(currentBlock));
                currentBlock = _entries[currentBlock];
            }
            ListManagedBlock[] array = new ListManagedBlock[blocks.Count];
            blocks.CopyTo(array, 0);

            return (array);
        }
开发者ID:ChiangHanLung,项目名称:PIC_VDS,代码行数:23,代码来源:BlockAllocationTableReader.cs


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