本文整理汇总了C#中SetType类的典型用法代码示例。如果您正苦于以下问题:C# SetType类的具体用法?C# SetType怎么用?C# SetType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SetType类属于命名空间,在下文中一共展示了SetType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IsFlagsSet
public static bool IsFlagsSet(ObjectAccessId accessObject, RightsFlags[] flags,SetType setType=SetType.Any)
{
if (LoggedUser == null)
throw new Exception("Invalid user!");
if (LoggedUser.IsAdmin)
return true;
switch (setType)
{
case SetType.All:
if (flags.Select(flag => IsFlagSet(accessObject, flag)).All(result => result))
{
return true;
}
break;
case SetType.Any:
if (flags.Select(flag => IsFlagSet(accessObject, flag)).Any(result => result))
{
return true;
}
break;
default:
throw new ArgumentOutOfRangeException("setType");
}
return false;
}
示例2: CreateTrainingAndTestSets
/* LOGIC
* 1. Randomly select one node in the graph.
* 2. Randonly select the second node from the first node's connections.
* 3. Compute all the features for this pair of connected nodes.
* 4. Randomly select one node from the nodes that are not connected to
* the first node.
* 5. Compute all the features for the selected pair of disconnected nodes.
* 6. Repeat 5000 times.
* Note: when selecting a pair, make sure that it is not already in the training set.
*/
public static void CreateTrainingAndTestSets(string pathDataDir, SetType trainingSetType, SetType testingSetType,
int trainingSetSize, int testingSetSize, int testingDataAmount)
{
Console.WriteLine("Starting creation of training and testing subsets . . .");
FeaturesExtractor featuresExtractor = new FeaturesExtractor(pathDataDir);
featuresExtractor.LoadCharacterCharactersData();
featuresExtractor.LoadCharacterComicsData();
featuresExtractor.LoadCharacterSeriesData();
HashSet<string> usedExamples = new HashSet<string>();
HashSet<string> usedNodes = new HashSet<string>();
// Training data
Console.WriteLine("Creating training subset . . .");
Console.WriteLine(String.Format("Training set type: {0}", trainingSetType));
switch (trainingSetType)
{
case SetType.Balanced:
CreateAndSaveRandomBalancedSubset(FileManager.GetPathResultTrainingSet(pathDataDir, trainingSetType),
featuresExtractor, usedExamples, usedNodes, trainingSetSize);
break;
case SetType.Proportional:
CreateAndSaveRandomProportionalSubset(FileManager.GetPathResultTrainingSet(pathDataDir, trainingSetType),
featuresExtractor, usedExamples, usedNodes, trainingSetSize);
break;
}
// Testing data
Console.WriteLine("Creating testing subset . . .");
Console.WriteLine(String.Format("Testing set type: {0}", testingSetType));
switch (testingSetType)
{
case SetType.Balanced:
CreateAndSaveRandomBalancedSubset(FileManager.GetPathResultTestSet(pathDataDir, testingSetType),
featuresExtractor, usedExamples, usedNodes, testingSetSize);
break;
case SetType.Proportional:
CreateAndSaveRandomProportionalSubset(FileManager.GetPathResultTestSet(pathDataDir, testingSetType),
featuresExtractor, usedExamples, usedNodes, testingSetSize);
break;
case SetType.Nodes:
CreateAndSaveRandomNodesSubset(FileManager.GetPathResultTestSet(pathDataDir, testingSetType),
featuresExtractor, usedNodes, testingSetSize, testingDataAmount);
break;
}
Console.WriteLine("Finished creation of training and testing subsets.");
}
示例3: I
public void I(IEnumerable<int> series, SetType type)
{
StringBuilder sb = new StringBuilder();
foreach(int ion in series)
{
if(type == SetType.ArgLine)
{
UserAction = true;
UserAction = false;
}
sb.Append(ion);
sb.Append(',');
}
if(sb.Length > 1)
{
sb.Remove(sb.Length - 1, 1);
}
ArgumentLine.IonSeries = sb.ToString();
}
示例4: ConvertSetTypeToString
public virtual string ConvertSetTypeToString(SetType set_type)
{
if(set_type == SetType.UPDATE_ONLY)
return "updateonly";
else if(set_type == SetType.INSERT_ONLY)
return "insertonly";
else
return "full";
}
示例5: SetVideoByUrl
public virtual bool SetVideoByUrl(SetType set_type, Video obj)
{
return act.SetVideoByUrl(ConvertSetTypeToString(set_type), obj);
}
示例6: SetSiteByCode
public virtual bool SetSiteByCode(SetType set_type, Site obj)
{
return act.SetSiteByCode(ConvertSetTypeToString(set_type), obj);
}
示例7: SetQuestionByUuid
public virtual bool SetQuestionByUuid(SetType set_type, Question obj)
{
return act.SetQuestionByUuid(ConvertSetTypeToString(set_type), obj);
}
示例8: SetProfileQuestionByQuestionIdByProfileId
public virtual bool SetProfileQuestionByQuestionIdByProfileId(SetType set_type, ProfileQuestion obj)
{
return act.SetProfileQuestionByQuestionIdByProfileId(ConvertSetTypeToString(set_type), obj);
}
示例9: SetEventCategoryAssocByUuid
public virtual bool SetEventCategoryAssocByUuid(SetType set_type, EventCategoryAssoc obj)
{
return act.SetEventCategoryAssocByUuid(ConvertSetTypeToString(set_type), obj);
}
示例10: SetContentItemTypeByUuid
public virtual bool SetContentItemTypeByUuid(SetType set_type, ContentItemType obj)
{
return act.SetContentItemTypeByUuid(ConvertSetTypeToString(set_type), obj);
}
示例11: SetChannelByUuid
public virtual bool SetChannelByUuid(SetType set_type, Channel obj)
{
return act.SetChannelByUuid(ConvertSetTypeToString(set_type), obj);
}
示例12: SetAppByUuid
public virtual bool SetAppByUuid(SetType set_type, App obj)
{
return act.SetAppByUuid(ConvertSetTypeToString(set_type), obj);
}
示例13: AuthorizationSetDefinition
internal AuthorizationSetDefinition(SetType setType)
{
_setType = setType;
}
示例14: SetRewardConditionTypeByUuid
public virtual bool SetRewardConditionTypeByUuid(SetType set_type, RewardConditionType obj)
{
return act.SetRewardConditionTypeByUuid(ConvertSetTypeToString(set_type), obj);
}
示例15: SetProfileRewardPointsByUuid
public virtual bool SetProfileRewardPointsByUuid(SetType set_type, ProfileRewardPoints obj)
{
return act.SetProfileRewardPointsByUuid(ConvertSetTypeToString(set_type), obj);
}