本文整理汇总了C#中ISet类的典型用法代码示例。如果您正苦于以下问题:C# ISet类的具体用法?C# ISet怎么用?C# ISet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ISet类属于命名空间,在下文中一共展示了ISet类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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>();
}
示例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++;
}
}
}
示例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;
}
示例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.");
}
示例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);
}
示例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:" }
});
}
示例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);
}
}
}
示例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;
}
示例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;
}
示例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);
}
示例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");
}
示例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;
}
示例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>();
}
示例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;
}