public static SourceIndex Parse(string text) { SourceIndex sourceIndex = new SourceIndex(); string[] parts = text.Split('*'); string multiplier = (parts.Length > 1) ? parts[0].Trim() : "1"; string channelIndex = (parts.Length > 1) ? parts[1].Trim() : parts[0].Trim(); if (parts.Length > 2) throw new FormatException($"Too many asterisks found in source index {text}."); if (!double.TryParse(multiplier, out sourceIndex.Multiplier)) throw new FormatException($"Incorrect format for multiplier {multiplier} found in source index {text}."); if (channelIndex == "NONE") return null; if (!int.TryParse(channelIndex, out sourceIndex.ChannelIndex)) throw new FormatException($"Incorrect format for channel index {channelIndex} found in source index {text}."); if (channelIndex[0] == '-') { sourceIndex.Multiplier *= -1.0D; sourceIndex.ChannelIndex *= -1; } return sourceIndex; }
Graph(Vertex <V>[] vertices, Edge <V>[] edges) { this.vertices = vertices; this.edges = edges; for (var i = 0; i < edges.Length; i++) { var edge = edges[i]; if (SourceIndex.TryGetValue(edge.Source, out List <V> targets)) { targets.Add(edge.Target); } else { SourceIndex[edge.Source] = list(edge.Target); } if (TargetIndex.TryGetValue(edge.Target, out List <V> sources)) { sources.Add(edge.Source); } else { TargetIndex[edge.Target] = list(edge.Source); } } }
public override string ToString() { return(string.Format("{0} (Dest: {1},Source: {2}) {3}", Status.ToString(), DestIndex.ToString(), SourceIndex.ToString(), _length.ToString())); }
public override int GetHashCode() { int code = 23; code = code * 31 + SourceIndex.GetHashCode(); code = code * 31 + TargetIndex.GetHashCode(); return(code); }
public int CompareTo(AlignmentLink other) { int c1 = SourceIndex.CompareTo(other.SourceIndex); if (c1 != 0) { return(c1); } return(TargetIndex.CompareTo(other.TargetIndex)); }
public override int GetHashCode() { #if NETCOREAPP return(HashCode.Combine(SourceIndex, Type)); #else var hashCode = 17; hashCode = hashCode * 31 + SourceIndex.GetHashCode(); hashCode = hashCode * 31 + Type.GetHashCode(); return(hashCode); #endif }
public override string ToString() { if (IsNullMove) { return("NULL_MOVE"); } return(!string.IsNullOrEmpty(SAN) ? SAN : $"{SourceIndex.ToSquareString()}->{DestinationIndex.ToSquareString()}"); }
public IReadOnlyList <V> Sources(V target) { if (SourceIndex.TryGetValue(target, out List <V> sources)) { return(sources); } else { return(EmptyList); } }
/// <inheritdoc /> public override bool Equals(object obj) { if (base.Equals(obj)) { return(true); } MemoryIndexDataSource other = obj as MemoryIndexDataSource; if (other != null) { return(SourceIndex.Equals(other.SourceIndex) && SourceSnapshot.Equals(other.SourceSnapshot)); } else { return(false); } }
public GamaError(string msg, ParserRuleContext rule, params object[] format) { Message = string.Format(msg, format); At = new SourceIndex(rule.Start); }
public GamaError(string msg, SourceIndex at, params object[] format) { Message = string.Format(msg, format); At = at; }
/// <inheritdoc /> public override int GetHashCode() { return(SourceIndex.GetHashCode() ^ SourceSnapshot.GetHashCode()); }
private static void BuildPages(Arguments arguments, Site site, MarkdownPipeline pipeline) { var allResources = CollectPages(site); PageResourcesPostProcessors.Process(allResources, site); var allBuiltResources = new HashSet <string>(); arguments.VerboseLog($"{allResources.Count} total un-processed pages"); int builtPages = 0, skippedPages = 0, ignoredPages = 0; while (allBuiltResources.Count != allResources.Count) { int prevBuilt = allBuiltResources.Count; foreach ((string path, PageResource resource) in allResources) { // Do not re-build already built content if (allBuiltResources.Contains(path)) { continue; } // If this page has something un-built embedded in it then we cannot safely build it. if (!resource.Embedded?.IsSubsetOf(allBuiltResources) ?? false) { continue; } // If the resource isn't in the site, and isn't embedded into anything, we can skip building it entirely. if (resource.Location == ResourceLocation.Embed && (resource.EmbeddedInto?.Count ?? 0) == 0) { arguments.VerboseLog($"\"{resource.FullPath}\" is not used."); resource.SetHtmlTextAsEmpty(); allBuiltResources.Add(path); continue; } try { resource.BuildText(site, allResources, pipeline); } catch (Exception e) { throw new BuildException(e, $"{resource.FullPath} failed to build text."); } allBuiltResources.Add(path); switch (resource.WriteToDisk(arguments, site)) { case PageResource.WriteStatus.Ignored: ignoredPages++; break; case PageResource.WriteStatus.Skipped: skippedPages++; break; case PageResource.WriteStatus.Written: builtPages++; break; } } if (prevBuilt == allBuiltResources.Count) { throw new BuildException("Build has soft-locked - infinite loop due to recursive embedding?"); } } arguments.VerboseLog($"{builtPages} pages written to disk. {skippedPages} were skipped as identical, and {ignoredPages} were embeds."); SourceIndex.GeneratePageSourceLookup(arguments, allResources); }
public override string ToString() { return(SourceTable + "." + SourceColumn + "[" + SourceIndex.ToString() + "] => " + DestTable + "." + DestColumn + "[" + DestIndex.ToString() + "]"); }