本文整理汇总了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());
}
示例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);
}
}
示例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;
}
示例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
}
}
示例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);
}
示例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());
}
示例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);
}
示例8: UpdateGamingConsoleHashWithBucketValues
private void UpdateGamingConsoleHashWithBucketValues(Bucket<Game> gameBucket, int dataIndex)
{
gameBucket
.Values
.ToList()
.ForEach(game =>
{
var gamingConsoleData = gamingConsoleHash[game.ConsoleName];
gamingConsoleData[dataIndex]++;
});
}
示例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 ();
}
示例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 ();
}
示例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");
}
}
示例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);
}
}
示例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;
}
示例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;
}
示例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();
}