本文整理汇总了C#中IProcedure4类的典型用法代码示例。如果您正苦于以下问题:C# IProcedure4类的具体用法?C# IProcedure4怎么用?C# IProcedure4使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IProcedure4类属于命名空间,在下文中一共展示了IProcedure4类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BTreeFreespaceManager
public BTreeFreespaceManager(LocalObjectContainer file, IProcedure4 slotFreedCallback
, int discardLimit) : base(slotFreedCallback, discardLimit)
{
_file = file;
_delegate = new InMemoryFreespaceManager(slotFreedCallback, discardLimit);
_idSystem = file.SystemData().FreespaceIdSystem();
}
示例2: Produce
public virtual object Produce(object key, IFunction4 producer, IProcedure4 onDiscard
)
{
_calls++;
IFunction4 delegateProducer = new _IFunction4_26(this, producer);
return _delegate.Produce(key, delegateProducer, onDiscard);
}
示例3: Produce
public virtual object Produce(object key, IFunction4 producer, IProcedure4 finalizer
)
{
if (key == null)
{
throw new ArgumentNullException();
}
if (_am.Remove(key))
{
_am.AddFirst(key);
return _slots[key];
}
if (_a1.Remove(key))
{
_am.AddFirst(key);
return _slots[key];
}
if (_slots.Count >= _maxSize)
{
DiscardPage(finalizer);
}
object value = producer.Apply(key);
_slots[key] = value;
_a1.AddFirst(key);
return value;
}
示例4: Produce
public virtual object Produce(object key, IFunction4 producer, IProcedure4 finalizer
)
{
if (key == null)
{
throw new ArgumentNullException();
}
if (_am.Remove(key))
{
_am.AddFirst(key);
return _slots[key];
}
if (_a1out.Contains(key))
{
ReclaimFor(key, producer, finalizer);
_am.AddFirst(key);
return _slots[key];
}
if (_a1in.Contains(key))
{
return _slots[key];
}
ReclaimFor(key, producer, finalizer);
_a1in.AddFirst(key);
return _slots[key];
}
示例5: AbstractFreespaceManager
public AbstractFreespaceManager(IProcedure4 slotFreedCallback, int discardLimit,
int remainderSizeLimit)
{
_slotFreedCallback = slotFreedCallback;
_discardLimit = discardLimit;
_remainderSizeLimit = remainderSizeLimit;
}
示例6: EventInfo
public EventInfo(string eventFirerName, bool isClientServerEvent, IProcedure4 eventListenerSetter
)
{
_listenerSetter = eventListenerSetter;
_eventFirerName = eventFirerName;
_isClientServerEvent = isClientServerEvent;
}
示例7: Produce
public virtual object Produce(object key, IFunction4 producer, IProcedure4 finalizer
)
{
object value = _slots[key];
if (value == null)
{
object newValue = producer.Apply(key);
if (newValue == null)
{
return null;
}
if (_slots.Count >= _maxSize)
{
object discarded = Sharpen.Collections.Remove(_slots, _lru.RemoveLast());
if (null != finalizer)
{
finalizer.Apply(discarded);
}
}
_slots[key] = newValue;
_lru.AddFirst(key);
return newValue;
}
_lru.Remove(key);
// O(N)
_lru.AddFirst(key);
return value;
}
示例8: AssertEventThrows
private void AssertEventThrows(string eventName, ICodeBlock codeBlock, IProcedure4
listenerSetter)
{
IEventRegistry eventRegistry = EventRegistryFactory.ForObjectContainer(Db());
listenerSetter.Apply(eventRegistry);
Assert.Expect(typeof(EventException), typeof(NotImplementedException), codeBlock,
eventName);
}
示例9: Discard
private void Discard(long key, IProcedure4 finalizer)
{
if (null != finalizer)
{
finalizer.Apply(_slots[key]);
}
Sharpen.Collections.Remove(_slots, key);
}
示例10: DiscardPage
private void DiscardPage(IProcedure4 finalizer)
{
if (_a1.Size() >= _a1_threshold)
{
DiscardPageFrom(_a1, finalizer);
}
else
{
DiscardPageFrom(_am, finalizer);
}
}
示例11: Time
private static long Time(IProcedure4 procedure4)
{
var storage = new PagingMemoryStorage();
StoreItems(storage);
StopWatch stopWatch = new AutoStopWatch();
for (var i = 0; i < Iterations; ++i)
{
ApplyProcedure(storage, procedure4);
}
return stopWatch.Peek();
}
示例12: CachingBin
/// <exception cref="Db4objects.Db4o.Ext.Db4oIOException"></exception>
public CachingBin(IBin bin, ICache4 cache, int pageCount, int pageSize) : base(bin
)
{
_onDiscardPage = new _IProcedure4_22(this);
_producerFromDisk = new _IFunction4_138(this);
_producerFromPool = new _IFunction4_147(this);
_pageSize = pageSize;
_pagePool = new SimpleObjectPool(NewPagePool(pageCount));
_cache = cache;
_fileLength = _bin.Length();
}
示例13: ForEachField
public static void ForEachField(IReflectClass claxx, IProcedure4 procedure)
{
while (claxx != null)
{
IReflectField[] declaredFields = claxx.GetDeclaredFields();
for (int reflectFieldIndex = 0; reflectFieldIndex < declaredFields.Length; ++reflectFieldIndex)
{
IReflectField reflectField = declaredFields[reflectFieldIndex];
procedure.Apply(reflectField);
}
claxx = claxx.GetSuperclass();
}
}
示例14: WithCache
private void WithCache(IProcedure4 procedure)
{
IClientSlotCache clientSlotCache = null;
try
{
clientSlotCache = (IClientSlotCache) Reflection4.GetFieldValue(Container(), "_clientSlotCache"
);
}
catch (ReflectException e)
{
Assert.Fail("Can't get field _clientSlotCache on container. " + e);
}
procedure.Apply(clientSlotCache);
}
示例15: ApplyProcedure
private static void ApplyProcedure(PagingMemoryStorage storage, IProcedure4 procedure4
)
{
var config = Db4oEmbedded.NewConfiguration();
config.File.Storage = storage;
var container = Db4oEmbedded.OpenFile(config, "benchmark.db4o"
);
try
{
procedure4.Apply(container);
}
finally
{
container.Close();
}
}