本文整理汇总了C#中ISet类的典型用法代码示例。如果您正苦于以下问题:C# ISet类的具体用法?C# ISet怎么用?C# ISet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ISet类属于命名空间,在下文中一共展示了ISet类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: WalkCircularDependency
private static IEnumerable<BuildItem> WalkCircularDependency(BuildItem item, IDictionary<BuildItem, List<BuildItem>> scriptsToDependencies, ISet<BuildItem> visitedItems, out bool isCircularPath)
{
if(visitedItems.Contains(item))
{
isCircularPath = true;
return Enumerable.Repeat(item, 1);
}
if (!scriptsToDependencies.ContainsKey(item))
{
isCircularPath = false;
return Enumerable.Empty<BuildItem>();
}
visitedItems.Add(item);
foreach (var d in scriptsToDependencies[item])
{
bool currentIsCircular;
var currentPath = WalkCircularDependency(d, scriptsToDependencies, visitedItems, out currentIsCircular);
if(currentIsCircular)
{
isCircularPath = true;
return Enumerable.Repeat(item, 1).Concat(currentPath);
}
}
isCircularPath = false;
return Enumerable.Empty<BuildItem>();
}
开发者ID:Zocdoc,项目名称:ZocBuild.Database,代码行数:28,代码来源:CircularDependencyError.cs
示例2: Verify
private void Verify(ISet<EmailToken> tokens,
string type1, string prop1, string type2, string prop2)
{
if (tokens.Count >= 0)
{
int i = 0;
foreach (var token in tokens)
{
switch (i)
{
case 0:
Assert.AreEqual(type1, token.TypeName);
Assert.AreEqual(prop1, token.PropertyName);
break;
case 1:
Assert.AreEqual(type2, token.TypeName);
Assert.AreEqual(prop2, token.PropertyName);
break;
default:
break;
}
i++;
}
}
}
开发者ID:rmandvikar,项目名称:EmailTemplate-component,代码行数:25,代码来源:EmailTokenReplacerTest.cs
示例3: FactsListFormatter
/// <summary>
/// Initializes a new instance of the <see cref="FactsListFormatter"/> class.
/// </summary>
/// <param name="user">The user to create this formatter for</param>
/// <param name="enumerator">The enumerator for the directory listing to format</param>
/// <param name="activeFacts">The active facts to return for the entries</param>
/// <param name="absoluteName">Returns an absolute entry name</param>
public FactsListFormatter(FtpUser user, DirectoryListingEnumerator enumerator, ISet<string> activeFacts, bool absoluteName)
{
_user = user;
_enumerator = enumerator;
_activeFacts = activeFacts;
_absoluteName = absoluteName;
}
开发者ID:FubarDevelopment,项目名称:FtpServer,代码行数:14,代码来源:FactsListFormatter.cs
示例4: SynchronizedSet
/// <summary>
/// Constructs a thread-safe <see cref="ISet" /> wrapper.
/// </summary>
/// <param name="basisSet">The <see cref="ISet" /> object that this object will wrap.</param>
public SynchronizedSet(ISet basisSet)
{
mBasisSet = basisSet;
mSyncRoot = basisSet.SyncRoot;
if (mSyncRoot == null)
throw new NullReferenceException("The Set you specified returned a null SyncRoot.");
}
开发者ID:jaundice,项目名称:nhibernate-core,代码行数:11,代码来源:SynchronizedSet.cs
示例5: Draw
public void Draw(ISet<State> states, SpriteBatch spriteBatch, XnaRectangle position, XnaColor color)
{
int rowTopHeight = _centerTop.Height;
int rowBottomHeight = _centerBottom.Height;
int rowCenterHeight = position.Height - rowTopHeight - rowBottomHeight;
int startY = position.Top;
int rowCenterTop = startY + rowTopHeight;
int rowBottomTop = startY + position.Height - rowBottomHeight;
int colLeftWidth = _leftCenter.Width;
int colRightWidth = _rightCenter.Width;
int colCenterWidth = position.Width - colLeftWidth - colRightWidth;
int startX = position.Left;
int colCenterLeft = startX + colLeftWidth;
int colRightLeft = startX + position.Width - colRightWidth;
spriteBatch.Draw(_texture, new XnaRectangle(startX, startY, colLeftWidth, rowTopHeight), _leftTop, color);
spriteBatch.Draw(_texture, new XnaRectangle(startX, rowCenterTop, colLeftWidth, rowCenterHeight), _leftCenter, color);
spriteBatch.Draw(_texture, new XnaRectangle(startX, rowBottomTop, colLeftWidth, rowBottomHeight), _leftBottom, color);
spriteBatch.Draw(_texture, new XnaRectangle(colCenterLeft, startY, colCenterWidth, rowTopHeight), _centerTop, color);
spriteBatch.Draw(_texture, new XnaRectangle(colCenterLeft, rowCenterTop, colCenterWidth, rowCenterHeight), _center, color);
spriteBatch.Draw(_texture, new XnaRectangle(colCenterLeft, rowBottomTop, colCenterWidth, rowBottomHeight), _centerBottom, color);
spriteBatch.Draw(_texture, new XnaRectangle(colRightLeft, startY, colRightWidth, rowTopHeight), _rightTop, color);
spriteBatch.Draw(_texture, new XnaRectangle(colRightLeft, rowCenterTop, colRightWidth, rowCenterHeight), _rightCenter, color);
spriteBatch.Draw(_texture, new XnaRectangle(colRightLeft, rowBottomTop, colRightWidth, rowBottomHeight), _rightBottom, color);
}
开发者ID:powerdude,项目名称:xamarin-forms-xna,代码行数:28,代码来源:NinePatchImage.cs
示例6: Glue
public Glue(TwitchBot twitchBot, SteamBot steamBot)
{
myLock = new Object();
this.twitchBot = twitchBot;
this.steamBot = steamBot;
subscriptionsUsersMap = new Dictionary<String, HashSet<SteamID>>();
usersSubscriptionsMap = new Dictionary<SteamID, ISet<String>>();
adminList = LoadAdmins();
twitchBot.OnPublicMessage += delegate (UserInfo user, String channel, String message) { log.Debug($"{user.Nick}: {message}"); };
twitchBot.OnPublicMessage += OnTwitchPublicMessage;
steamBot.OnFriendMessage += OnSteamFriendMessage;
steamBot.OnOfflineMessage += steamBot_OnOfflineMessage;
//TODO: Put into config file?
smileyTranslater = new StringMapper(new Dictionary<String, String>()
{
{ "BibleThump", ":steamsad:" },
{ "Kappa", ":steammocking:" },
{ "FailFish", ":steamfacepalm:" },
{ "PJSalt", ":steamsalty:" },
{ "ResidentSleeper", ":steambored:" }
});
}
开发者ID:CruelCow,项目名称:Twitch2Steam,代码行数:25,代码来源:Glue.cs
示例7: _MatchRecursive
private static void _MatchRecursive(Node node, ISet<string> rtn, string letters, string prefix, int? maxMatches)
{
if (maxMatches != null && rtn.Count == maxMatches)
return;
if (node == null)
{
if (!rtn.Contains(letters)) rtn.Add(letters);
return;
}
letters += node.Letter.ToString();
if (prefix.Length > 0)
{
if (node.ContainsKey(prefix[0]))
{
_MatchRecursive(node[prefix[0]], rtn, letters, prefix.Remove(0, 1), maxMatches);
}
}
else
{
foreach (char key in node.Keys)
{
_MatchRecursive(node[key], rtn, letters, prefix, maxMatches);
}
}
}
开发者ID:tzigy,项目名称:TelerikAcademy,代码行数:28,代码来源:TrieFilter.cs
示例8: GenerateXmlElements
private static IList<XElement> GenerateXmlElements(IEnumerable<PageReference> pages,
ISet<string> urlSet,
SitemapData sitemapData,
ISitemapXmlGenerator sitemapGenerator)
{
IList<XElement> sitemapXmlElements = new List<XElement>();
var baseUrl = string.IsNullOrEmpty(sitemapData.SiteUrl)
? Settings.Instance.SiteUrl.ToString()
: sitemapData.SiteUrl;
foreach (PageReference pageReference in pages)
{
var languagePages = DataFactory.Instance.GetLanguageBranches(pageReference);
foreach (var page in languagePages)
{
if (urlSet.Count >= MaxSitemapEntryCount)
{
sitemapData.ExceedsMaximumEntryCount = true;
return sitemapXmlElements;
}
AddFilteredPageElement(page, baseUrl, urlSet, sitemapData, sitemapGenerator, sitemapXmlElements);
}
}
return sitemapXmlElements;
}
开发者ID:marijorg,项目名称:SEO.Sitemaps,代码行数:29,代码来源:SitemapContentHelper.cs
示例9: ComplexDataQuerySelectionGroupImpl
public ComplexDataQuerySelectionGroupImpl(ISet<IComplexDataQuerySelection> complexSelections,
ISdmxDate dateFrom, OrderedOperator dateFromOperator,
ISdmxDate dateTo, OrderedOperator dateToOperator,
ISet<IComplexComponentValue> primaryMeasureValues)
{
//check if the operator to be applied on the time has not the 'NOT_EQUAL' value
if (dateFromOperator.Equals(OrderedOperatorEnumType.NotEqual) || dateToOperator.Equals(OrderedOperatorEnumType.NotEqual))
throw new SdmxSemmanticException(ExceptionCode.QuerySelectionIllegalOperator);
if (complexSelections == null)
{
return;
}
this._dateFrom = dateFrom;
this._dateFromOperator = dateFromOperator;
this._dateTo = dateTo;
this._dateToOperator = dateToOperator;
this._complexSelections = complexSelections;
this._primaryMeasureValues = primaryMeasureValues;
// Add each of the Component Selections to the selection concept map.
foreach (IComplexDataQuerySelection compSel in _complexSelections)
{
if (_complexSelectionForConcept.ContainsKey(compSel.ComponentId))
{
//TODO Does this require a exception, or can the code selections be merged?
throw new ArgumentException("Duplicate concept");
}
_complexSelectionForConcept.Add(compSel.ComponentId, compSel);
}
}
开发者ID:SDMXISTATFRAMEWORK,项目名称:ISTAT_ENHANCED_SDMXRI_WS,代码行数:32,代码来源:ComplexDataQuerySelectionGroupImpl.cs
示例10: CreateBaseShapeRepresentation
/// <summary>
/// Creates a shape representation and register it to shape representation layer.
/// </summary>
/// <param name="exporterIFC">The ExporterIFC object.</param>
/// <param name="contextOfItems">The context for which the different subtypes of representation are valid.</param>
/// <param name="identifier">The identifier for the representation.</param>
/// <param name="representationType">The type handle for the representation.</param>
/// <param name="items">Collection of geometric representation items that are defined for this representation.</param>
/// <returns>The handle.</returns>
public static IFCAnyHandle CreateBaseShapeRepresentation(ExporterIFC exporterIFC, IFCAnyHandle contextOfItems,
string identifier, string representationType, ISet<IFCAnyHandle> items)
{
IFCFile file = exporterIFC.GetFile();
IFCAnyHandle newShapeRepresentation = IFCInstanceExporter.CreateShapeRepresentation(file, contextOfItems, identifier, representationType, items);
return newShapeRepresentation;
}
开发者ID:whztt07,项目名称:RevitCustomIFCexporter,代码行数:16,代码来源:RepresentationUtil.cs
示例11: Test
private void Test(string word, ISet<string> dict, bool expectedResult)
{
WordBreakSolution wordBreak = new WordBreakSolution();
bool result = wordBreak.WordBreak(word, dict);
Assert.AreEqual(expectedResult, result);
}
开发者ID:alibad,项目名称:PlayGround,代码行数:7,代码来源:WordBreakTests.cs
示例12: CheckPermittedDN
private void CheckPermittedDN(ISet permitted, Asn1Sequence dns)
//throws PkixNameConstraintValidatorException
{
if (permitted == null)
{
return;
}
if ((permitted.Count == 0) && dns.Count == 0)
{
return;
}
IEnumerator it = permitted.GetEnumerator();
while (it.MoveNext())
{
Asn1Sequence subtree = (Asn1Sequence)it.Current;
if (WithinDNSubtree(dns, subtree))
{
return;
}
}
throw new PkixNameConstraintValidatorException(
"Subject distinguished name is not from a permitted subtree");
}
开发者ID:Xanagandr,项目名称:DisaOpenSource,代码行数:28,代码来源:PkixNameConstraintValidator.cs
示例13: ConstructContext
/// <summary>
/// Creates a new Construct Context
/// </summary>
/// <param name="g">Graph to construct Triples in</param>
/// <param name="s">Set to construct from</param>
/// <param name="preserveBNodes">Whether Blank Nodes bound to variables should be preserved as-is</param>
/// <remarks>
/// <para>
/// Either the <paramref name="s">Set</paramref> or <paramref name="g">Graph</paramref> parameters may be null if required
/// </para>
/// </remarks>
public ConstructContext(IGraph g, ISet s, bool preserveBNodes)
{
this._g = g;
this._factory = (this._g != null ? (INodeFactory)this._g : _globalFactory.Value);
this._s = s;
this._preserveBNodes = preserveBNodes;
}
开发者ID:jbunzel,项目名称:MvcRQ_git,代码行数:18,代码来源:ConstructContext.cs
示例14: Project
public Project(
string name,
ISet<ProjectType> projectTypes,
string info,
ProjectStatus projectStatus,
Image landingImage,
AccessLevel accessLevel,
VersionControlSystemInfo versionControlSystemInfo,
RedmineProjectInfo redmineProjectInfo,
ISet<Issue> issues,
ISet<ProjectMembership> projectDevelopers,
ISet<Image> screenshots)
{
Require.NotEmpty(name, nameof(name));
Require.NotNull(info, nameof(info));
Require.NotNull(versionControlSystemInfo, nameof(versionControlSystemInfo));
Require.NotNull(redmineProjectInfo, nameof(redmineProjectInfo));
Require.NotEmpty(projectTypes, nameof(projectTypes));
Name = name;
ProjectTypes = projectTypes;
AccessLevel = accessLevel;
Info = info;
ProjectStatus = projectStatus;
LandingImage = landingImage;
VersionControlSystemInfo = versionControlSystemInfo;
RedmineProjectInfo = redmineProjectInfo;
Issues = issues ?? new HashSet<Issue>();
ProjectMemberships = projectDevelopers ?? new HashSet<ProjectMembership>();
Screenshots = screenshots ?? new HashSet<Image>();
}
开发者ID:LeagueOfDevelopers,项目名称:LodCore,代码行数:31,代码来源:Project.cs
示例15: ModelTemplateModel
/// <summary>
/// Initializes a new instance of the ModelTemplateModel class.
/// </summary>
/// <param name="source">The object to create model from.</param>
/// <param name="allTypes">The list of all model types; Used to implement polymorphism.</param>
public ModelTemplateModel(CompositeType source, ISet<CompositeType> allTypes)
{
this.LoadFrom(source);
PropertyTemplateModels = new List<PropertyTemplateModel>();
source.Properties.ForEach(p => PropertyTemplateModels.Add(new PropertyTemplateModel(p)));
if (!string.IsNullOrEmpty(source.PolymorphicDiscriminator))
{
if (!source.Properties.Any(p => p.Name == source.PolymorphicDiscriminator))
{
var polymorphicProperty = new Property
{
IsRequired = true,
Name = source.PolymorphicDiscriminator,
SerializedName = source.PolymorphicDiscriminator,
Documentation = "Polymorhpic Discriminator",
Type = new PrimaryType(KnownPrimaryType.String)
};
source.Properties.Add(polymorphicProperty);
}
}
if (source.BaseModelType != null)
{
this.parent = new ModelTemplateModel(source.BaseModelType, allTypes);
}
this.allTypes = allTypes;
}
开发者ID:jhancock93,项目名称:autorest,代码行数:34,代码来源:ModelTemplateModel.cs
示例16: IsGlobalMemberDeclarationContext
public static bool IsGlobalMemberDeclarationContext(
this SyntaxTree syntaxTree,
int position,
ISet<SyntaxKind> validModifiers,
CancellationToken cancellationToken)
{
if (!syntaxTree.IsInteractiveOrScript())
{
return false;
}
var tokenOnLeftOfPosition = syntaxTree.FindTokenOnLeftOfPosition(position, cancellationToken);
var token = tokenOnLeftOfPosition.GetPreviousTokenIfTouchingWord(position);
var modifierTokens = syntaxTree.GetPrecedingModifiers(position, tokenOnLeftOfPosition, cancellationToken);
if (modifierTokens.IsEmpty())
{
return false;
}
if (modifierTokens.IsSubsetOf(validModifiers))
{
// the parent is the member
// the grandparent is the container of the member
// in interactive, it's possible that there might be an intervening "incomplete" member for partially
// typed declarations that parse ambiguously. For example, "internal e".
if (token.Parent.IsKind(SyntaxKind.CompilationUnit) ||
(token.Parent.IsKind(SyntaxKind.IncompleteMember) && token.Parent.IsParentKind(SyntaxKind.CompilationUnit)))
{
return true;
}
}
return false;
}
开发者ID:GeertVL,项目名称:roslyn,代码行数:35,代码来源:SyntaxTreeExtensions.cs
示例17: StepTerm
/// <summary>
/// Eliminate rules with nonsolitary terminals
/// </summary>
/// <param name="productions"></param>
private void StepTerm(ISet<Production> productions) {
var newProductions = new List<Production>();
var lookup = new Dictionary<Terminal, Nonterminal>();
foreach (var production in productions) {
if (production.Rhs.Count < 2) {
continue;
}
for (int i = 0; i < production.Rhs.Count; i++) {
var word = production.Rhs[i];
if (word.IsNonterminal) {
continue;
}
Terminal terminal = (Terminal)word;
Nonterminal fresh;
if (!lookup.TryGetValue(terminal, out fresh)) {
fresh = GetFresh();
lookup[terminal] = fresh;
newProductions.Add(
new Production(fresh, new Sentence { terminal })
);
}
production.Rhs[i] = fresh;
}
}
productions.UnionWith(newProductions);
}
开发者ID:ellisonch,项目名称:CFGLib,代码行数:30,代码来源:CFGtoCNF.cs
示例18: FindIndirectCircularReferences
private static void FindIndirectCircularReferences(ISet<Node> childList)
{
var toIgnore = new HashSet<Node>();
foreach (var node in childList.ToHashSet())
{
if(toIgnore.Contains(node))
continue;
var path = new HashSet<Node>();
if (IndirectlyDependsOnItself(node, node, ref path))
{
path.Add(node);
toIgnore.UnionWith(path);
childList.ExceptWith(path);
var dependantOnCircularDependencies = childList.Where(x => path.Any(x.DependsOn));
var cirularHolder = new CircularDependencyHolderNode(path);
foreach (var dependantOnCircularDependency in dependantOnCircularDependencies)
{
//Remove all dependencies on nodes in the path
dependantOnCircularDependency.SiblingDependencies.RemoveWhere(x => path.Contains(x));
//Add dependency on circular holder
dependantOnCircularDependency.SiblingDependencies.Add(cirularHolder);
}
//Add all dependencies in the path to the new node
cirularHolder.SiblingDependencies.UnionWith(path.SiblingDependencies().Except(path)); //Should not be dependant on themselves
childList.Add(cirularHolder);
}
}
}
开发者ID:davidkron,项目名称:DevArch,代码行数:29,代码来源:CircularReferenceFinder.cs
示例19: IMRUJobDefinition
/// <summary>
/// Constructor
/// </summary>
/// <param name="mapFunctionConfiguration">Map function configuration</param>
/// <param name="mapInputCodecConfiguration">Map input codec configuration</param>
/// <param name="updateFunctionCodecsConfiguration">codec configuration for update
/// function. It is union of TMapInput, TMapOutput and TResult configuration</param>
/// <param name="reduceFunctionConfiguration">Reduce function configuration</param>
/// <param name="updateFunctionConfiguration">Update function configuration</param>
/// <param name="mapOutputPipelineDataConverterConfiguration">Configuration of
/// PipelineDataConverter for TMapOutput</param>
/// <param name="mapInputPipelineDataConverterConfiguration">Configuration of
/// PipelineDataConverter for TMapInput</param>
/// <param name="partitionedDatasetConfiguration">Configuration of partitioned
/// dataset</param>
/// <param name="perMapConfigGeneratorConfig">Per mapper configuration</param>
/// <param name="numberOfMappers">Number of mappers</param>
/// <param name="memoryPerMapper">Per Mapper memory.</param>
/// <param name="jobName">Job name</param>
internal IMRUJobDefinition(
IConfiguration mapFunctionConfiguration,
IConfiguration mapInputCodecConfiguration,
IConfiguration updateFunctionCodecsConfiguration,
IConfiguration reduceFunctionConfiguration,
IConfiguration updateFunctionConfiguration,
IConfiguration mapOutputPipelineDataConverterConfiguration,
IConfiguration mapInputPipelineDataConverterConfiguration,
IConfiguration partitionedDatasetConfiguration,
ISet<IConfiguration> perMapConfigGeneratorConfig,
int numberOfMappers,
int memoryPerMapper,
int updateTaskMemory,
string jobName)
{
_mapFunctionConfiguration = mapFunctionConfiguration;
_mapInputCodecConfiguration = mapInputCodecConfiguration;
_updateFunctionCodecsConfiguration = updateFunctionCodecsConfiguration;
_reduceFunctionConfiguration = reduceFunctionConfiguration;
_updateFunctionConfiguration = updateFunctionConfiguration;
_mapOutputPipelineDataConverterConfiguration = mapOutputPipelineDataConverterConfiguration;
_mapInputPipelineDataConverterConfiguration = mapInputPipelineDataConverterConfiguration;
_partitionedDatasetConfiguration = partitionedDatasetConfiguration;
_numberOfMappers = numberOfMappers;
_jobName = jobName;
_memoryPerMapper = memoryPerMapper;
_updateTaskMemory = updateTaskMemory;
_perMapConfigGeneratorConfig = perMapConfigGeneratorConfig;
}
开发者ID:swlsw,项目名称:incubator-reef,代码行数:48,代码来源:IMRUJobDefinition.cs
示例20: DerivesFromController
private bool DerivesFromController(TypeInfo typeInfo, ISet<Assembly> candidateAssemblies)
{
while (typeInfo != ObjectTypeInfo)
{
var baseTypeInfo = typeInfo.BaseType.GetTypeInfo();
// A base type will be treated as a controller if
// a) it ends in the term "Controller" and
// b) it's assembly is one of the candidate assemblies we're considering. This ensures that the assembly
// the base type is declared in references Mvc.
if (baseTypeInfo.Name.EndsWith(ControllerTypeName, StringComparison.Ordinal) &&
candidateAssemblies.Contains(baseTypeInfo.Assembly))
{
return true;
}
// c). The base type is called 'Controller.
if (string.Equals(baseTypeInfo.Name, ControllerTypeName, StringComparison.Ordinal))
{
return true;
}
typeInfo = baseTypeInfo;
}
return false;
}
开发者ID:notami18,项目名称:Mvc,代码行数:27,代码来源:DefaultControllerTypeProvider.cs
注:本文中的ISet类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论