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


C# Bucket类代码示例

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


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

示例1: ClearBucket

    private IEnumerator ClearBucket(Bucket bucket)
    {
        // Get all keys in the given bucket.
        var getKeysRequest = bucket.GetKeys();
        yield return getKeysRequest.WaitUntilDone();
        if (getKeysRequest.hasFailed)
        {
            Debug.LogError("Unable to clear " + bucket + ". " + getKeysRequest.GetErrorString());
            yield break;
        }

        // Remove each one of the keys. Issue the requests all at once.
        var removeRequests = new List<RemoveRequest>();
        foreach (var key in getKeysRequest.GetKeyEnumerable())
        {
            removeRequests.Add(bucket.Remove(key));
        }

        // Then wait for each request to finish.
        foreach (var removeRequest in removeRequests)
        {
            yield return removeRequest.WaitUntilDone();
            if (removeRequest.hasFailed)
                Debug.LogError("Unable to remove '" + removeRequest.key + "' from " + removeRequest.bucket + ". " +
                               removeRequest.GetErrorString());
        }

        // Finally refresh the list.
        StartCoroutine(RefreshList());
    }
开发者ID:judah4,项目名称:battle-of-mages,代码行数:30,代码来源:uGameDBAdminInterface.cs

示例2: put

        /**
         * Add an object to the tail of the queue.
         * 
         * @param o
         *                Object to insert in the queue
         */
        public void put(Object o)
        {
            Monitor.Enter(this);
            try
            {
                Bucket b = new Bucket(o);

                if (tail != null)
                {
                    tail.setNext(b);
                    tail = b;
                }
                else
                {
                    // queue was empty but has one element now
                    head = tail = b;
                }
                count++;

                // notify any waiting tasks
                Monitor.Pulse(this);
            }
            finally
            {
                Monitor.Exit(this);
            }
        }
开发者ID:takayuki,项目名称:Erlang.NET,代码行数:33,代码来源:GenericQueue.cs

示例3: BucketStream

        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="buffer">A <see cref="Bucket"/> object.</param>
        public BucketStream(Bucket buffer)
        {
            if (buffer == null)
                throw new ArgumentNullException("buffer");

            _targetBuffer = buffer;
        }
开发者ID:KCL5South,项目名称:PTPDevelopmentLibrary,代码行数:11,代码来源:BucketStream.cs

示例4: Collect

			public override void  Collect(int doc)
			{
				BucketTable table = bucketTable;
				int i = doc & Mono.Lucene.Net.Search.BooleanScorer.BucketTable.MASK;
				Bucket bucket = table.buckets[i];
				if (bucket == null)
					table.buckets[i] = bucket = new Bucket();
				
				if (bucket.doc != doc)
				{
					// invalid bucket
					bucket.doc = doc; // set doc
					bucket.score = scorer.Score(); // initialize score
					bucket.bits = mask; // initialize mask
					bucket.coord = 1; // initialize coord
					
					bucket.next = table.first; // push onto valid list
					table.first = bucket;
				}
				else
				{
					// valid bucket
					bucket.score += scorer.Score(); // increment score
					bucket.bits |= mask; // add bits in mask
					bucket.coord++; // increment coord
				}
			}
开发者ID:carrie901,项目名称:mono,代码行数:27,代码来源:BooleanScorer.cs

示例5: DifferentPathsNoRevisions

 public static void DifferentPathsNoRevisions(Bucket bucket)
 {
     bucket.Upload("/monkey.mp4", TestBytes.NoChunks);
     bucket.Upload("/animals/dog.mp4", TestBytes.NoChunks);
     bucket.Upload("/animals/cat.mp4", TestBytes.NoChunks);
     bucket.Upload("/animals/fish.mp4", TestBytes.NoChunks);
     bucket.Upload("/people/father.mp4", TestBytes.NoChunks);
     bucket.Upload("/people/mother.mp4", TestBytes.NoChunks);
 }
开发者ID:fjsnogueira,项目名称:RethinkDb.Driver,代码行数:9,代码来源:TestUploader.cs

示例6: Init

        public void Init()
        {
            bucket = Bucket.Instance;

            bucket.Register<XmlModelBinder>(() => new XmlModelBinder());
            bucket.Register<XmlSerializer>(() => new XmlSerializer());
            bucket.Register<JsonModelBinder>(() => new JsonModelBinder());
            bucket.Register<JsonSerializer>(() => new JsonSerializer());
            bucket.Register<StringSerializer>(() => new StringSerializer());
        }
开发者ID:crosbymichael,项目名称:RestfulMVC,代码行数:10,代码来源:RestfulMVC.cs

示例7: Start

    // Use this for initialization
    void Start()
    {
        transform = GetComponent<Transform>();
        bucketScript = GetComponentInChildren<Bucket>();
        prenableScript = GetComponent<PrenableObject>();
        size = transform.localScale.y;
        gravityEmpty = new Vector3(0, -3.0F * size, 0);
        gravityFull  = new Vector3(0, -6.2F * size, 0);

        Debug.Log(name + "--> " + prenableScript.m_Gravity);
    }
开发者ID:FuriousCatInteractive,项目名称:MarmotteWorld,代码行数:12,代码来源:BucketWeight.cs

示例8: UpdateGamingConsoleHashWithBucketValues

 private void UpdateGamingConsoleHashWithBucketValues(Bucket<Game> gameBucket, int dataIndex)
 {
     gameBucket
         .Values
         .ToList()
         .ForEach(game =>
         {
             var gamingConsoleData = gamingConsoleHash[game.ConsoleName];
             gamingConsoleData[dataIndex]++;
         });
 }
开发者ID:tamizhvendan,项目名称:gameo,代码行数:11,代码来源:TrendChartEngine.cs

示例9: TestZeroDueTime

		public void TestZeroDueTime ()
		{
			Bucket bucket = new Bucket();

			Timer t = new Timer (new TimerCallback (Callback), bucket, 0, Timeout.Infinite);
			Thread.Sleep (100);
			Assert.AreEqual (1, bucket.count, "#1");
			t.Change (0, Timeout.Infinite);
			Thread.Sleep (100);
			Assert.AreEqual (2, bucket.count, "#2");
			t.Dispose ();
		}
开发者ID:radiohaktive,项目名称:mono,代码行数:12,代码来源:TimerTest.cs

示例10: TestChange

		public void TestChange ()
		{
			Bucket bucket = new Bucket();
			Timer t = new Timer (new TimerCallback (Callback), bucket, 1, 1);
			Thread.Sleep (500);
			int c = bucket.count;
			Assert.IsTrue(c > 20, "#1");
			t.Change (100, 100);
			Thread.Sleep (500);
			Assert.IsTrue(bucket.count <= c + 20, "#2");
			t.Dispose ();
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:12,代码来源:TimerTest.cs

示例11: TestZeroDueTime

		public void TestZeroDueTime ()
		{
			Bucket bucket = new Bucket();

			using (Timer t = new Timer (o => Callback (o), bucket, 0, Timeout.Infinite)) {
				Thread.Sleep (100);
				Assert.AreEqual (1, bucket.count, "#1");
				t.Change (0, Timeout.Infinite);
				Thread.Sleep (100);
				Assert.AreEqual (2, bucket.count, "#2");
			}
		}
开发者ID:ItsVeryWindy,项目名称:mono,代码行数:12,代码来源:TimerTest.cs

示例12: CollisionHashMap

        static CollisionHashMap()
        {
            int divisionSizeX = MomolikeGame.SCREEN_WIDTH / BUCKETS_PER_ROW;
            int divisionSizeY = MomolikeGame.SCREEN_HEIGHT / BUCKETS_PER_COLUMN;

            // Initialize partition coordinates
            for (int x = 0; x < BUCKETS_PER_ROW; x++)
                for (int y = 0; y < BUCKETS_PER_COLUMN; y++)
                {
                    BUCKETS[x, y] = new Bucket();
                    BUCKETS[x, y].BucketArea = new Rectangle(x * divisionSizeX, y * divisionSizeY, divisionSizeX, divisionSizeY);
                }
        }
开发者ID:GabrielWilds,项目名称:Momolike,代码行数:13,代码来源:CollisionHashMap.cs

示例13: IsDeltaPresent

        /// <param name="min">minimum delta presence threshold</param>
        /// <param name="max">maximum delta presence threshold</param>
        /// <param name="bucket">the bucket that to be examined</param>
        /// <param name="qid">QI indecies</param>
        /// <returns>Returns true, if the bucket is delta present, false otherwise.</returns>
        public bool IsDeltaPresent(double min, double max, Bucket bucket, int[] qid)
        {
            CreateAB(bucket, qid);
            double[] probabilities = Probability(A, B);

            for (int k = 0; k < probabilities.Count(); k++)
            {
                double curValue = probabilities[k];
                if (curValue < min || curValue > max)
                    return false;
            }
            return true;
        }
开发者ID:tothbalazs0920,项目名称:DataAnonymizationLibrary,代码行数:18,代码来源:DeltaPresence.cs

示例14: CreateWheel

        private static Bucket[] CreateWheel(int ticksPerWheel, ILoggingAdapter log)
        {
            if (ticksPerWheel <= 0)
                throw new ArgumentOutOfRangeException(nameof(ticksPerWheel), ticksPerWheel, "Must be greater than 0.");
            if (ticksPerWheel > 1073741824)
                throw new ArgumentOutOfRangeException(nameof(ticksPerWheel), ticksPerWheel, "Cannot be greater than 2^30.");

            ticksPerWheel = NormalizeTicksPerWheel(ticksPerWheel);
            var wheel = new Bucket[ticksPerWheel];
            for (var i = 0; i < wheel.Length; i++)
                wheel[i] = new Bucket(log);
            return wheel;
        }
开发者ID:Micha-kun,项目名称:akka.net,代码行数:13,代码来源:HashedWheelTimerScheduler.cs

示例15: SetUp

 public void SetUp()
 {
     consoleNames = new[] { "Console1", "Console2", "Console3", "Console4" };
     games = consoleNames.Take(3).Select(consoleName => new Game { ConsoleName = consoleName });
     gameBuckets = new[]
                       {
                           new Bucket<Game> {Label = "9-11", Values = games},
                           new Bucket<Game> {Label = "11-13", Values = games},
                           new Bucket<Game> {Label = "13-15", Values = games.Take(2)},
                           new Bucket<Game> {Label = "15-17", Values = new[] { new Game{ConsoleName = consoleNames.Last()}}}
                       };
     trendChartEngine = new TrendChartEngine();
 }
开发者ID:tamizhvendan,项目名称:gameo,代码行数:13,代码来源:TrendChartEngineSpec.cs


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