本文整理汇总了C#中IFunction4类的典型用法代码示例。如果您正苦于以下问题:C# IFunction4类的具体用法?C# IFunction4怎么用?C# IFunction4使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IFunction4类属于命名空间,在下文中一共展示了IFunction4类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: 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];
}
开发者ID:Orvid,项目名称:SQLInterfaceCollection,代码行数:26,代码来源:LRU2QXCache.cs
示例2: 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;
}
开发者ID:erdincay,项目名称:db4o,代码行数:26,代码来源:LRU2QCache.cs
示例3: 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);
}
开发者ID:bvangrinsven,项目名称:db4o-net,代码行数:7,代码来源:CacheStatistics.cs
示例4: 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;
}
开发者ID:Orvid,项目名称:SQLInterfaceCollection,代码行数:28,代码来源:LRUCache.cs
示例5: SequentialIdGenerator
public SequentialIdGenerator(IFunction4 findFreeId, int initialValue, int minValidId
, int maxValidId)
{
_findFreeId = findFreeId;
_minValidId = minValidId;
_maxValidId = maxValidId;
InitializeGenerator(initialValue);
}
开发者ID:masroore,项目名称:db4o,代码行数:8,代码来源:SequentialIdGenerator.cs
示例6: FunctionApplicationIterator
public FunctionApplicationIterator(IEnumerator iterator, IFunction4 function) : base
(iterator)
{
if (null == function)
{
throw new ArgumentNullException();
}
_function = function;
}
开发者ID:masroore,项目名称:db4o,代码行数:9,代码来源:FunctionApplicationIterator.cs
示例7: 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();
}
开发者ID:masroore,项目名称:db4o,代码行数:12,代码来源:CachingBin.cs
示例8: WithContainer
private static object WithContainer(string filename, IFunction4 block)
{
IObjectContainer container = Db4oFactory.OpenFile(filename);
try
{
return block.Apply(container);
}
finally
{
container.Close();
}
}
开发者ID:bvangrinsven,项目名称:db4o-net,代码行数:12,代码来源:MigrationHopsTestCase.cs
示例9: Produce
public virtual object Produce(object key, IFunction4 producer, IProcedure4 finalizer
)
{
if (_am.Remove((((long)key))))
{
_am.AddFirst((((long)key)));
return _slots[((long)key)];
}
if (_a1.Remove((((long)key))))
{
_am.AddFirst((((long)key)));
return _slots[((long)key)];
}
if (_slots.Count >= _maxSize)
{
DiscardPage(finalizer);
}
object value = producer.Apply(((long)key));
_slots[((long)key)] = value;
_a1.AddFirst((((long)key)));
return value;
}
开发者ID:bvangrinsven,项目名称:db4o-net,代码行数:22,代码来源:LRU2QLongCache.cs
示例10: ReclaimFor
private void ReclaimFor(object key, IFunction4 producer, IProcedure4 finalizer)
{
if (_slots.Count < _maxSize)
{
_slots[key] = producer.Apply(key);
return;
}
if (_a1in.Size() > _inSize)
{
object lastKey = _a1in.RemoveLast();
Discard(lastKey, finalizer);
if (_a1out.IsFull())
{
_a1out.RemoveLast();
}
_a1out.AddFirst(lastKey);
}
else
{
object lastKey = _am.RemoveLast();
Discard(lastKey, finalizer);
}
_slots[key] = producer.Apply(key);
}
开发者ID:Orvid,项目名称:SQLInterfaceCollection,代码行数:24,代码来源:LRU2QXCache.cs
示例11: Series
public static IEnumerable Series(object seed, IFunction4 function)
{
return new _IEnumerable_356(seed, function);
}
开发者ID:Orvid,项目名称:SQLInterfaceCollection,代码行数:4,代码来源:Iterators.cs
示例12: _IEnumerable_253
public _IEnumerable_253(IEnumerable iterable, IFunction4 function)
{
this.iterable = iterable;
this.function = function;
}
开发者ID:Orvid,项目名称:SQLInterfaceCollection,代码行数:5,代码来源:Iterators.cs
示例13: Map
public static IEnumerable Map(IEnumerable iterable, IFunction4 function)
{
return new _IEnumerable_253(iterable, function);
}
开发者ID:Orvid,项目名称:SQLInterfaceCollection,代码行数:4,代码来源:Iterators.cs
示例14: MapPersistentFields
private IEnumerator MapPersistentFields(object obj, IFunction4 function)
{
return Iterators.Map(IteratePersistentFields(obj), function);
}
开发者ID:erdincay,项目名称:db4o,代码行数:4,代码来源:SampleTestCase.cs
示例15: Transmogrify
public virtual ITest Transmogrify(IFunction4 fun)
{
return ((ITest)fun.Apply(this));
}
开发者ID:Orvid,项目名称:SQLInterfaceCollection,代码行数:4,代码来源:FailingTest.cs
示例16: WithDatabase
private void WithDatabase(string file, IFunction4 function)
{
Configure();
IExtObjectContainer objectContainer = Db4oFactory.OpenFile(file).Ext();
try
{
function.Apply(objectContainer);
}
finally
{
objectContainer.Close();
}
IObjectServer server = Db4oFactory.OpenServer(ClientServerFileName(file), -1);
server.GrantAccess(Username, Password);
objectContainer = Db4oFactory.OpenClient("localhost", server.Ext().Port(), Username
, Password).Ext();
try
{
function.Apply(objectContainer);
}
finally
{
objectContainer.Close();
server.Close();
}
}
开发者ID:superyfwy,项目名称:db4o,代码行数:26,代码来源:FormatMigrationTestCaseBase.cs
示例17: Transmogrify
public ITest Transmogrify(IFunction4 fun)
{
return (ITest) fun.Apply(this);
}
开发者ID:erdincay,项目名称:db4o,代码行数:4,代码来源:VerifyAssemblyTest.cs
示例18: TestPuppet
public TestPuppet()
{
producer = new _IFunction4_50(this);
}
开发者ID:bvangrinsven,项目名称:db4o-net,代码行数:4,代码来源:CacheTestUnit.cs
示例19: AsTopLevelStore
private object AsTopLevelStore(IFunction4 block, Transaction trans)
{
trans = CheckTransaction(trans);
object result = AsTopLevelCall(block, trans);
if (_stackDepth == 0)
{
trans.ProcessDeletes();
}
return result;
}
开发者ID:erdincay,项目名称:db4o,代码行数:10,代码来源:ObjectContainerBase.cs
示例20: _IEnumerable_356
public _IEnumerable_356(object seed, IFunction4 function)
{
this.seed = seed;
this.function = function;
}
开发者ID:Orvid,项目名称:SQLInterfaceCollection,代码行数:5,代码来源:Iterators.cs
注:本文中的IFunction4类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论