本文整理汇总了C#中ImmutableHashSet类的典型用法代码示例。如果您正苦于以下问题:C# ImmutableHashSet类的具体用法?C# ImmutableHashSet怎么用?C# ImmutableHashSet使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ImmutableHashSet类属于命名空间,在下文中一共展示了ImmutableHashSet类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ClusterRouterGroupSettings
public ClusterRouterGroupSettings(int totalInstances, bool allowLocalRoutees, string useRole, ImmutableHashSet<string> routeesPaths) : base(totalInstances, allowLocalRoutees, useRole)
{
RouteesPaths = routeesPaths;
if(routeesPaths == null || routeesPaths.IsEmpty || string.IsNullOrEmpty(routeesPaths.First())) throw new ArgumentException("routeesPaths must be defined", "routeesPaths");
//todo add relative actor path validation
}
示例2: OnReceive
protected override void OnReceive(object message)
{
var state = message as ClusterEvent.CurrentClusterState;
if (state != null)
{
_clusterNodes =
state.Members.Select(m => m.Address).Where(a => a != _cluster.SelfAddress).ToImmutableHashSet();
foreach(var node in _clusterNodes) TakeOverResponsibility(node);
Unreachable.ExceptWith(_clusterNodes);
return;
}
var memberUp = message as ClusterEvent.MemberUp;
if (memberUp != null)
{
MemberUp(memberUp);
return;
}
var memberRemoved = message as ClusterEvent.MemberRemoved;
if (memberRemoved != null)
{
MemberRemoved(memberRemoved);
return;
}
if (message is ClusterEvent.IMemberEvent) return; // not interesting
base.OnReceive(message);
}
示例3: GetNewRootWithAddedNamespaces
static async Task<SyntaxNode> GetNewRootWithAddedNamespaces(Document document, SyntaxNode relativeToNode,
CancellationToken cancellationToken, ImmutableHashSet<string> namespaceQualifiedStrings)
{
var namespaceWithUsings = relativeToNode
.GetAncestorsOrThis<NamespaceDeclarationSyntax>()
.FirstOrDefault(ns => ns.DescendantNodes().OfType<UsingDirectiveSyntax>().Any());
var root = await document.GetSyntaxRootAsync(cancellationToken);
SyntaxNode newRoot;
var usings = namespaceQualifiedStrings
.Select(ns => UsingDirective(ParseName(ns).WithAdditionalAnnotations(Simplifier.Annotation)));
if (namespaceWithUsings != null)
{
var newNamespaceDeclaration = namespaceWithUsings.WithUsings(namespaceWithUsings.Usings.AddRange(usings));
newRoot = root.ReplaceNode(namespaceWithUsings, newNamespaceDeclaration);
}
else
{
var compilationUnit = (CompilationUnitSyntax)root;
newRoot = compilationUnit.WithUsings(compilationUnit.Usings.AddRange(usings));
}
return newRoot;
}
示例4: GetProviders
protected ImmutableArray<CompletionProvider> GetProviders(ImmutableHashSet<string> roles)
{
roles = roles ?? ImmutableHashSet<string>.Empty;
RoleProviders providers;
if (!_roleProviders.TryGetValue(roles, out providers))
{
providers = _roleProviders.GetValue(roles, _ =>
{
var builtin = GetBuiltInProviders();
var imported = GetImportedProviders()
.Where(lz => lz.Metadata.Roles == null || lz.Metadata.Roles.Length == 0 || roles.Overlaps(lz.Metadata.Roles))
.Select(lz => lz.Value);
return new RoleProviders { Providers = builtin.Concat(imported).ToImmutableArray() };
});
}
if (_testProviders.Length > 0)
{
return providers.Providers.Concat(_testProviders);
}
else
{
return providers.Providers;
}
}
示例5: ImmutableConstantChecker
private readonly MultiDictionary<ISentenceForm, Fact> _sentencesByForm; //TODO: Immutable
#endregion Fields
#region Constructors
private ImmutableConstantChecker(ImmutableSentenceFormModel sentenceModel, MultiDictionary<ISentenceForm, Fact> sentencesByForm)
{
Debug.Assert(sentenceModel.ConstantSentenceForms.IsSupersetOf(sentencesByForm.Keys));
_sentenceModel = sentenceModel;
_sentencesByForm = sentencesByForm;
_allSentences = sentencesByForm.SelectMany(s => s.Value).ToImmutableHashSet();
}
示例6: GetCompletionsAsync
/// <summary>
/// Gets the completions available at the caret position.
/// </summary>
/// <param name="document">The document that completion is occuring within.</param>
/// <param name="caretPosition">The position of the caret after the triggering action.</param>
/// <param name="trigger">The triggering action.</param>
/// <param name="roles">Optional set of roles associated with the editor state.</param>
/// <param name="options">Optional options that override the default options.</param>
/// <param name="cancellationToken"></param>
public abstract Task<CompletionList> GetCompletionsAsync(
Document document,
int caretPosition,
CompletionTrigger trigger = default(CompletionTrigger),
ImmutableHashSet<string> roles = null,
OptionSet options = null,
CancellationToken cancellationToken = default(CancellationToken));
示例7: EEAssemblyBuilder
public EEAssemblyBuilder(
SourceAssemblySymbol sourceAssembly,
EmitOptions emitOptions,
ImmutableArray<MethodSymbol> methods,
ModulePropertiesForSerialization serializationProperties,
ImmutableArray<NamedTypeSymbol> additionalTypes,
NamedTypeSymbol dynamicOperationContextType,
CompilationTestData testData) :
base(
sourceAssembly,
emitOptions,
outputKind: OutputKind.DynamicallyLinkedLibrary,
serializationProperties: serializationProperties,
manifestResources: SpecializedCollections.EmptyEnumerable<ResourceDescription>(),
additionalTypes: additionalTypes)
{
Methods = ImmutableHashSet.CreateRange(methods);
_dynamicOperationContextType = dynamicOperationContextType;
if (testData != null)
{
this.SetMethodTestData(testData.Methods);
testData.Module = this;
}
}
示例8: DiagnosticService
public DiagnosticService()
{
// we use registry service rather than doing MEF import since MEF import method can have race issue where
// update source gets created before aggregator - diagnostic service - is created and we will lose events fired before
// the aggregator is created.
_updateSources = ImmutableHashSet<IDiagnosticUpdateSource>.Empty;
}
示例9: MemberCreate
/// <summary>
/// Creates a member from internal Akka method
/// </summary>
/// <returns>The new member</returns>
public static Member MemberCreate(UniqueAddress uniqueAddress, int upNumber, MemberStatus status, ImmutableHashSet<string> roles)
{
var createMethod =
typeof(Member).GetMethods(BindingFlags.NonPublic | BindingFlags.Static)
.First(m => m.Name == "Create" && m.GetParameters().Length == 4);
return (Member)createMethod.Invoke(null, new object[] { uniqueAddress, upNumber, status, roles });
}
示例10: GetFix
private async Task<Solution> GetFix(TextDocument publicSurfaceAreaDocument, string newSymbolName, ImmutableHashSet<string> siblingSymbolNamesToRemove, CancellationToken cancellationToken)
{
SourceText sourceText = await publicSurfaceAreaDocument.GetTextAsync(cancellationToken).ConfigureAwait(false);
SourceText newSourceText = AddSymbolNamesToSourceText(sourceText, new[] { newSymbolName });
newSourceText = RemoveSymbolNamesFromSourceText(newSourceText, siblingSymbolNamesToRemove);
return publicSurfaceAreaDocument.Project.Solution.WithAdditionalDocumentText(publicSurfaceAreaDocument.Id, newSourceText);
}
示例11: TradeGood
/// <summary>
/// Initializes a new instance of the <see cref="TradeGood"/> class.
/// </summary>
public TradeGood()
{
m_AvailabilityList = ImmutableHashSet<string>.Empty;
DetailRoll = "2D6";
Legal = true;
m_PurchaseDMs = new List<TradeGoodPurchase>();
m_SaleDMs = new List<TradeGoodSale>();
}
示例12: GetConstantSentenceForms
/// <summary>
/// Contant sentences are those that do not have a dependency on 'true' or 'does' facts
/// </summary>
/// <param name="sentenceForms"></param>
/// <param name="dependencyGraph"></param>
/// <returns></returns>
private static ImmutableHashSet<ISentenceForm> GetConstantSentenceForms(ImmutableHashSet<ISentenceForm> sentenceForms,
MultiDictionary<ISentenceForm, ISentenceForm> dependencyGraph)
{
MultiDictionary<ISentenceForm, ISentenceForm> augmentedGraph = AugmentGraphWithLanguageRules(dependencyGraph, sentenceForms);
ImmutableHashSet<ISentenceForm> changingSentenceForms =
DependencyGraphs.GetMatchingAndDownstream(sentenceForms, augmentedGraph,
d => SentenceForms.TruePred(d) || SentenceForms.DoesPred(d));
return sentenceForms.SymmetricExcept(changingSentenceForms).ToImmutableHashSet();
}
示例13: ShouldTriggerCompletion
/// <summary>
/// Returns true if the character recently inserted or deleted in the text should trigger completion.
/// </summary>
/// <param name="text">The document text to trigger completion within </param>
/// <param name="caretPosition">The position of the caret after the triggering action.</param>
/// <param name="trigger">The potential triggering action.</param>
/// <param name="roles">Optional set of roles associated with the editor state.</param>
/// <param name="options">Optional options that override the default options.</param>
/// <remarks>
/// This API uses SourceText instead of Document so implementations can only be based on text, not syntax or semantics.
/// </remarks>
public virtual bool ShouldTriggerCompletion(
SourceText text,
int caretPosition,
CompletionTrigger trigger,
ImmutableHashSet<string> roles = null,
OptionSet options = null)
{
return false;
}
示例14: FixAllDiagnosticProvider
public FixAllDiagnosticProvider(
ImmutableHashSet<string> diagnosticIds,
Func<Document, ImmutableHashSet<string>, CancellationToken, Task<IEnumerable<Diagnostic>>> getDocumentDiagnosticsAsync,
Func<Project, bool, ImmutableHashSet<string>, CancellationToken, Task<IEnumerable<Diagnostic>>> getProjectDiagnosticsAsync)
{
this.diagnosticIds = diagnosticIds;
this.getDocumentDiagnosticsAsync = getDocumentDiagnosticsAsync;
this.getProjectDiagnosticsAsync = getProjectDiagnosticsAsync;
}
示例15: RendererState
/// <summary>
///
/// </summary>
public RendererState()
{
_panX = 0.0;
_panY = 0.0;
_zoom = 1.0;
_enableAutofit = true;
_drawShapeState = ShapeState.Create(ShapeStateFlags.Visible | ShapeStateFlags.Printable);
_selectedShape = default(BaseShape);
_selectedShapes = default(ImmutableHashSet<BaseShape>);
}