本文整理汇总了C#中Match类的典型用法代码示例。如果您正苦于以下问题:C# Match类的具体用法?C# Match怎么用?C# Match使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Match类属于命名空间,在下文中一共展示了Match类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: ICanCreateAMatch
public void ICanCreateAMatch()
{
var match = new Match(7, 501);
Assert.AreEqual(7, match.BestOfLegs);
Assert.AreEqual(501, match.LegStartScore);
}
开发者ID:andycornforth,项目名称:Darts_Scorer,代码行数:7,代码来源:MatchTests.cs
示例2: IsValid
public override bool IsValid(Match match)
{
var nextDecision = match.PendingDecisions.First();
return nextDecision.PlayerIndex == this._playerIndex
&& nextDecision.Type == DecisionType.ChooseMergeOrder;
}
开发者ID:Tallness,项目名称:Amass,代码行数:7,代码来源:SetMergeOrderAction.cs
示例3: Apply
public override void Apply(Match match)
{
if (!this.IsValid(match))
{
return;
}
match.PendingDecisions.Dequeue();
if (this._stocks.Count>0)
{
Console.WriteLine(" [{0}] Purchasing stock in: ",match.Players[this._playerIndex].Member.Name);
foreach (var stock in _stocks)
{
match.Players[_playerIndex].AddStock(stock.Key, stock.Value);
var price = Engine.GetStockPrice(stock.Key, match);
Console.WriteLine(" - {1}x {0} - spending {2:C}", stock.Key, stock.Value, stock.Value * price);
match.Players[_playerIndex].Money -= stock.Value * price;
match.AvailableStock[stock.Key] -= stock.Value;
}
}
else
{
Console.WriteLine(" No active chains to purchase stock in");
}
if (match.PendingDecisions.Count == 0)
match.CurrentPhase = MatchPhase.DrawingTile;
}
开发者ID:Tallness,项目名称:Amass,代码行数:30,代码来源:PurchaseStockAction.cs
示例4: Extract
/// <summary>
/// Extracts the matches of this pattern from <paramref name="source" />.
/// </summary>
/// <param name="fileName">The name of the file associated with <paramref name="source" />.</param>
/// <param name="source">The source string</param>
/// <returns>
/// A collection of found matches.
/// </returns>
public MatchCollection Extract(string fileName, string source)
{
MatchCollection resultMatches = new MatchCollection();
LineCounter lineCounter = new LineCounter(source);
RegexMatch regexMatch = scanner.Match(source);
while (regexMatch.Success)
{
Match match = new Match();
match["Path"] = Path.GetDirectoryName(fileName);
match["File"] = Path.GetFileName(fileName);
match["LineNumber"] = lineCounter.CountTo(regexMatch.Index).InvariantToString();
foreach (string groupName in scanner.GetGroupNames())
{
// ignore default-names like '0', '1' ... as produced
// by the Regex class
if (Char.IsLetter(groupName[0]) || (groupName[0] == '_'))
{
match[groupName] = ConcatenateCaptures(regexMatch.Groups[groupName]);
}
}
resultMatches.Add(match);
regexMatch = regexMatch.NextMatch();
}
return resultMatches;
}
开发者ID:scottdorman,项目名称:MSBuildContrib,代码行数:34,代码来源:Pattern.cs
示例5: Apply
public override IEnumerable<Tuple<ShapeNode, ShapeNode>> Apply(Match<Word, ShapeNode> match, Word output)
{
FeatureStruct fs = _simpleCtxt.FeatureStruct.DeepClone();
fs.ReplaceVariables(match.VariableBindings);
ShapeNode newNode = output.Shape.Add(fs);
return Tuple.Create((ShapeNode) null, newNode).ToEnumerable();
}
开发者ID:sillsdev,项目名称:hermitcrab,代码行数:7,代码来源:InsertSimpleContext.cs
示例6: TranslationCandidatesDefaultValue_Match
public void TranslationCandidatesDefaultValue_Match()
{
Match match;
match = new Match();
Assert.IsFalse(match.HasReferenceTranslation, "HasReferenceTranslation is incorrect.");
Assert.IsNull(match.Id, "Id is incorrect.");
Assert.IsNull(match.MatchQuality, "MatchQuality is incorrect.");
Assert.IsNull(match.MatchSuitability, "MatchSuitability is incorrect.");
Assert.IsNull(match.Metadata, "Metadata is incorrect.");
Assert.IsNull(match.Origin, "Origin is incorrect.");
Assert.IsNull(match.OriginalData, "OriginalData is incorrect.");
Assert.IsNull(match.Similarity, "Similarity is incorrect.");
Assert.IsNull(match.Source, "Source is incorrect.");
Assert.IsNull(match.SourceReference, "SourceReference is incorrect.");
Assert.IsNull(match.SubType, "SubType is incorrect.");
Assert.IsNull(match.Target, "Target is incorrect.");
Assert.AreEqual(MatchType.TranslationMemory, match.Type, "Type is incorrect.");
match = new Match("sourcereference");
Assert.IsFalse(match.HasReferenceTranslation, "HasReferenceTranslation is incorrect.");
Assert.IsNull(match.Id, "Id is incorrect.");
Assert.IsNull(match.MatchQuality, "MatchQuality is incorrect.");
Assert.IsNull(match.MatchSuitability, "MatchSuitability is incorrect.");
Assert.IsNull(match.Metadata, "Metadata is incorrect.");
Assert.IsNull(match.Origin, "Origin is incorrect.");
Assert.IsNull(match.OriginalData, "OriginalData is incorrect.");
Assert.IsNull(match.Similarity, "Similarity is incorrect.");
Assert.IsNull(match.Source, "Source is incorrect.");
Assert.AreEqual("sourcereference", match.SourceReference, "SourceReference is incorrect.");
Assert.IsNull(match.SubType, "SubType is incorrect.");
Assert.IsNull(match.Target, "Target is incorrect.");
Assert.AreEqual(MatchType.TranslationMemory, match.Type, "Type is incorrect.");
}
开发者ID:jogleasonjr,项目名称:XLIFF2-Object-Model,代码行数:34,代码来源:TranslationCandidatesDefaultValueTests.cs
示例7: Goal
public Goal(int id, int minutes, Match match, int idPlayer)
{
Id = id;
Minutes = minutes;
Match = match;
Player = createPlayer(idPlayer);
}
开发者ID:BaziAplikacija,项目名称:TipsterCup,代码行数:7,代码来源:Goal.cs
示例8: PointsEarned
public override int PointsEarned(MatchResult outcome, Match MatchOfWeek)
{
int Multiple = outcome.Match == MatchOfWeek ? 2 : 1;
if (outcome.Winner != null && !outcome.Winner.Equals(Winner))
return 0;
//Is a stoppage!
if (outcome.ResultType.HasRounds)
{
if (outcome.Round == Round)
{
return ((3 + 5) * Multiple);
}
else if (outcome.Round <= Round + 1 && outcome.Round >= Round - 1)
{
return ((3 + 3) * Multiple);
}
else if (outcome.Round <= Round + 2 && outcome.Round >= Round - 2)
{
return ((3 + 1) * Multiple);
}
else
{
return (3 * Multiple);
}
}
return 0;
}
开发者ID:elmo61,项目名称:BritBoxing,代码行数:30,代码来源:RoundKnockOutPrediction.cs
示例9: ConvertJsonDateToDateString
/// <summary>
/// 将Json序列化的时间由/Date(....)转为字符串
/// </summary>
private string ConvertJsonDateToDateString(Match m)
{
string result = string.Empty;
DateTime dt = new DateTime(1970, 1, 1);
dt = dt.AddMilliseconds(long.Parse(m.Groups[1].Value)).ToLocalTime();
return dt.ToString(FormateStr);
}
开发者ID:RockyMyx,项目名称:ASP.NetMvc-Bootstrap,代码行数:10,代码来源:CustomJsonResult.cs
示例10: ReplaceMatch
private static void ReplaceMatch(Match scMatch, int monitorHeight, string scConfigContent, string scFolderPath, string fileName)
{
if (scMatch.Success)
{
string fullString = scMatch.Captures[0].Value;
string variablesName = scMatch.Groups[1].Captures[0].Value;
string delimiter = scMatch.Groups[2].Captures[0].Value;
string valueEnclosingCharacter = scMatch.Groups[3].Captures[0].Value;
int configHeight = int.Parse(scMatch.Groups[4].Captures[0].Value);
if (configHeight != monitorHeight)
{
Console.WriteLine("Current Height: {0}", configHeight);
Console.ForegroundColor = ConsoleColor.Yellow;
Console.WriteLine("Changing to {0}", monitorHeight);
scConfigContent = scConfigContent.Replace(fullString, string.Format(CultureInfo.InvariantCulture, "{0}{1}{2}{3}{2}", variablesName, delimiter, valueEnclosingCharacter, monitorHeight));
Console.ForegroundColor = ConsoleColor.Green;
WriteAllText(scFolderPath, fileName, scConfigContent);
}
else
{
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine("Everthing is already goooood to gooo!!!");
}
}
else
{
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("Something bad happened to the config file... go check it!");
Console.ReadLine();
}
}
开发者ID:quickstar,项目名称:scres,代码行数:33,代码来源:Program.cs
示例11: Cluster
/// <summary>
/// Clusters Two INodes together, sets new root/parent/left and right edges
/// </summary>
/// <param name="left"> Node on the left </param>
/// <param name="right"> Node on the Right </param>
/// <param name="match"> Inverted or Not Inverted </param>
/// <param name="matchData"> Optional MatchData variable, store clustering information </param>
public Cluster(INode left, INode right, Match match = Match.NonInverted, MatchData matchData = null)
{
if (match == Match.Impossible)
{
throw new ArgumentException("Match is apparently impossible why are you trying?");
}
// Now Build the new nodes
_left = left;
_right = right;
_matchData = matchData;
_size = left.Size() + right.Size();
_leftedge = left.LeftEdge();
_rightedge = right.RightEdge();
// Set the parents accordingly
left.Parent(this);
right.Parent(this);
_parent = null;
// change the roots
_left.Root(this);
_right.Root(this);
// Update Count
Id = _count++;
}
开发者ID:Algorithmix,项目名称:Papyrus,代码行数:34,代码来源:Cluster.cs
示例12: CreateMatch
public Match CreateMatch(DateTime matchDate, TimeSpan time, Venue venue, CompetitionMatchType matchType,
Competition competition, Team homeTeam, Team awayTeam)
{
if (homeTeam.GetType() == awayTeam.GetType())
{
Match match = new Match();
match.MatchDate = matchDate;
match.MatchTime = time;
match.Venue = venue;
match.CompetitionMatchType = matchType;
match.Competition = competition;
match.HomeTeam = homeTeam;
match.AwayTeam = awayTeam;
context.Matches.Add(match);
context.SaveChanges();
return match;
}
else
{
return null;
}
}
开发者ID:BarryOCathain,项目名称:GAA_Paper_Templates,代码行数:25,代码来源:MatchView.cs
示例13: MatchCollectionTest
public MatchCollectionTest()
{
Match<char> match;
try
{
match = new Match<char> ("0123456789".ToListCursor (), 0, 10, true);
}
catch (Exception e)
{
Assert.Inconclusive (e.ToString ());
throw;
}
m_allDigitsMatch = match;
try
{
match = new Match<char> ("0123456789".ToListCursor (), 0, 0, false);
}
catch (Exception e)
{
Assert.Inconclusive (e.ToString ());
throw;
}
m_noDigitsMatch = match;
}
开发者ID:jeremyrsellars,项目名称:HighRegex,代码行数:26,代码来源:MatchCollectionTest.cs
示例14: ICannotAdd2PlayersToAMatchWithTheSameName
public void ICannotAdd2PlayersToAMatchWithTheSameName()
{
var match = new Match(7, 501);
var player = new Player("Andy");
match.AddPlayer(player);
match.AddPlayer(player);
}
开发者ID:andycornforth,项目名称:Darts_Scorer,代码行数:7,代码来源:MatchTests.cs
示例15: ProcessRequest
public override void ProcessRequest(HttpContext context, Match match)
{
context.Response.Cache.SetCacheability(HttpCacheability.NoCache);
try
{
PccConfig.LoadConfig("pcc.config");
string searchTermsId = GetStringFromUrl(context, match, "SearchTermsId");
// make sure target directory exists
String targetDir = System.IO.Path.GetDirectoryName(PccConfig.SearchTermsPath);
if (!System.IO.Directory.Exists(targetDir))
{
context.Response.StatusCode = (int)HttpStatusCode.InternalServerError;
context.Response.Write("SearchTermsPath does not exist or is not configured correctly in pcc.config");
context.Response.ContentType = "text/plain";
return;
}
string searchTermsFileName = Path.Combine(targetDir, searchTermsId);
using (FileStream searchStream = new FileStream(searchTermsFileName, FileMode.Open, FileAccess.Read, FileShare.Read))
{
searchStream.CopyTo(context.Response.OutputStream);
}
context.Response.ContentType = "application/json;charset=utf-8";
context.Response.StatusCode = (int)HttpStatusCode.OK;
}
catch(Exception e)
{
context.Response.StatusCode = (int)HttpStatusCode.InternalServerError;
context.Response.Write(e.Message);
context.Response.ContentType = "text/plain";
return;
}
}
开发者ID:Mahendravv,项目名称:ACS-C-Sharp-Viewing-Sample,代码行数:34,代码来源:HttpSearchTerm.cs
示例16: IsUnapplicationNonvacuous
private bool IsUnapplicationNonvacuous(Match<Word, ShapeNode> match, IEnumerable<FeatureStruct> rhsAntiFSs)
{
int i = 0;
foreach (FeatureStruct fs in rhsAntiFSs)
{
ShapeNode node = match.GroupCaptures["target" + i].Span.GetStart(match.Matcher.Direction);
foreach (SymbolicFeature sf in fs.Features.OfType<SymbolicFeature>())
{
SymbolicFeatureValue sfv = fs.GetValue(sf);
SymbolicFeatureValue nodeSfv;
if (node.Annotation.FeatureStruct.TryGetValue(sf, out nodeSfv))
{
if (sfv.IsVariable)
{
SymbolicFeatureValue varSfv;
if (!match.VariableBindings.TryGetValue(sfv.VariableName, out varSfv) || !nodeSfv.IsSupersetOf(varSfv, !sfv.Agree))
return true;
}
else if (!nodeSfv.IsSupersetOf(sfv))
{
return true;
}
}
}
i++;
}
return false;
}
开发者ID:sillsdev,项目名称:hermitcrab,代码行数:29,代码来源:FeatureAnalysisRewriteRuleSpec.cs
示例17: selectChoice
public void selectChoice(Match.RPS choice)
{
if(currentMatch != null)
{
currentMatch.setPlayerChoice(this, choice);
}
}
开发者ID:Aggrathon,项目名称:rps_tournament,代码行数:7,代码来源:HumanPlayer.cs
示例18: DoMatch
public override bool DoMatch(INode other, Match match)
{
if (other == null || other.IsNull)
return true;
else
return childNode.DoMatch(other, match);
}
开发者ID:sphynx79,项目名称:dotfiles,代码行数:7,代码来源:OptionalNode.cs
示例19: FindContainingAllTokensInOrder
static Match FindContainingAllTokensInOrder(string s, int startIndex, int endIndex, string[] tokens)
{
int firstTokenStart;
int lastTokenEnd;
if (tokens.Length == 0)
{
return null;
}
firstTokenStart = s.IndexOf(tokens[0], startIndex, endIndex - startIndex);
if (firstTokenStart == -1)
{
return null;
}
lastTokenEnd = firstTokenStart + tokens[0].Length;
for (int i = 1; i < tokens.Length; i++)
{
lastTokenEnd = s.IndexOf(tokens[i], lastTokenEnd, endIndex - lastTokenEnd);
if (lastTokenEnd == -1)
{
return null;
}
lastTokenEnd += tokens[i].Length;
}
Match ret = new Match();
ret.Index = firstTokenStart;
ret.EndIndex = lastTokenEnd;
return ret;
}
开发者ID:nguerrera,项目名称:corefxlab,代码行数:31,代码来源:Program.cs
示例20: MatchEditor
public MatchEditor(Match m, Player[] playerList)
{
this.oldMatch = m;
this.thisMatch = m.Clone();
this.players = playerList;
InitializeComponent();
}
开发者ID:pcluddite,项目名称:scholarbowl,代码行数:7,代码来源:MatchEditor.cs
注:本文中的Match类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论