public ConsoleString(ConsolePoint position, IEnumerable <ConsoleSegment> segments)
        {
            Position = position;
            Segments = segments.ToImmutableList();

            _outputString = new CommandLineParsing.Output.ConsoleString(Segments.Select(Map));
        }
Esempio n. 2
0
 public virtual int GetEstimatedSize()
 {
     return(Segments.Select(segment =>
                            segment.Starts.DataLength +
                            segment.Lengths.DataLength +
                            segment.SharedIndices.DataLength).Sum());
 }
Esempio n. 3
0
    protected override IEnumerable <Command> OnCreate(IMetadata sourceMetadata, IMetadata targetMetadata, IComparerContext context)
    {
        if (IsUserCreatedIndex)
        {
            var command = new Command();
            command
            .Append($"CREATE {(Unique ? "UNIQUE " : string.Empty)}{(Descending ? "DESCENDING" : "ASCENDING")} INDEX {IndexName.AsSqlIndentifier()}")
            .AppendLine()
            .Append($"    ON {RelationName.AsSqlIndentifier()}");
            if (ExpressionSource == null)
            {
                command.Append($"({string.Join(",", Segments.Select(s => s.FieldName.AsSqlIndentifier()))})");
            }
            else
            {
                command.Append($" COMPUTED BY {ExpressionSource}");
            }

            yield return(command);

            if (Inactive)
            {
                yield return(HandleIndexActiveInactive(context));
            }
        }
    }
Esempio n. 4
0
        /// <summary>
        /// Output the path string.
        /// </summary>
        /// <returns>The string.</returns>
        public override string ToString()
        {
            if (PathTemplate != null)
            {
                return(PathTemplate);
            }

            return("/" + String.Join("/", Segments.Select(e => e.Kind)));
        }
Esempio n. 5
0
 protected override void setJSON(JObject obj, BaseClassIfc host, SetJsonOptions options)
 {
     base.setJSON(obj, host, options);
     obj["BaseCurve"] = BaseCurve.getJson(this, options);
     obj["Segments"]  = new JArray(Segments.Select(x => x.getJson(this, options)));
     if (EndPoint != null)
     {
         obj["EndPoint"] = EndPoint.getJson(this, options);
     }
 }
        /// <summary>
        /// Gets the URL part for this segment. Used in URLs construction.
        /// If any of the child parts is <c>null</c>, the result is also <c>null</c>.
        /// </summary>
        /// <param name="valueGetter">The route value getter delegate.</param>
        /// <returns>
        /// Returns the corresponding part of the URL or <c>null</c> when the value is missing.
        /// </returns>
        public override SegmentValue GetUrlPart(Func <string, SegmentValue> valueGetter)
        {
            var parts = Segments.Select(s => s.GetUrlPart(valueGetter)).ToList();

            if (parts.Any(p => p == null))
            {
                return(null);
            }
            return((SegmentValue)string.Concat(parts.Select(s => s.ToString())));
        }
Esempio n. 7
0
        private void onPreferencesChanged(IDatabasePreferences preferences)
        {
            DurationFormat = preferences.DurationFormat;
            dateFormat     = preferences.DateFormat;

            var segments = Segments.Select(segment => segment.WithDurationFormat(DurationFormat));

            Segments.Clear();
            Segments.AddRange(segments);

            updateCurrentDateRangeString();
        }
Esempio n. 8
0
 public void VerifyIsStraight()
 {
     _IsStraight = true;
     if (Segments.Count > 2)
     {
         _IsStraight = CheckPointsAreStraight(Segments.Select(s => s.PointOnString));
     }
     else if (Points.Count > 2)
     {
         //unused at the moment, was coded in case I needed to create fret lines directly from points
         _IsStraight = CheckPointsAreStraight(Points);
     }
 }
Esempio n. 9
0
 public void PrepareSegments()
 {
     Segments.ForEach(s => s.IsClipped = s.GetIsClipped(TopLeft, BottomRight) && !s.IsOutline);
     if (_clipping)
     {
         Segments.RemoveAll(s => s.IsClipped);
     }
     DoMergeCollinearSegments();
     SplitSegmentsThatOverlap();
     EndPoints.AddRange(Segments.Select(vs => vs.Start));
     EndPoints.AddRange(Segments.Select(vs => vs.End));
     DebugDrawSegments();
 }
Esempio n. 10
0
        /// <summary>
        /// Gets the regex pattern for the current segment.
        /// </summary>
        /// <returns></returns>
        public override string GetRegexPattern()
        {
            var pattern = String.Concat(Segments.Select(s => s.GetRegexPattern()));

            if (String.IsNullOrEmpty(pattern))
            {
                return(pattern);
            }
            if (Segments.Count > 1)
            {
                pattern = '(' + pattern + ')';
            }
            return(pattern + "?");
        }
Esempio n. 11
0
        /// <summary>
        /// Gets the URL part for this segment. Used in URLs construction.
        /// If any of the child parts is <c>null</c>, returns an empty string.
        /// </summary>
        /// <param name="valueGetter">The route value getter delegate.</param>
        /// <returns>
        /// Returns the corresponding part of the URL or <c>null</c> when the value is missing.
        /// </returns>
        public override SegmentValue GetUrlPart(Func <string, SegmentValue> valueGetter)
        {
            var parts = Segments.Select(s => s.GetUrlPart(valueGetter)).ToList();

            if (parts.Any(p => p == null) || parts.Count == 0)
            {
                return(SegmentValue.Empty);
            }

            if (ShouldBeEmpty(parts))
            {
                return(SegmentValue.Empty);
            }
            var result = string.Concat(parts.Select(s => s.ToString()));

            return(SegmentValue.Create(result));
        }
Esempio n. 12
0
File: Cipher.cs Progetto: SinaC/RMUD
        public static string EncodeParagraph(params string[] Segments)
        {
            var encodedSegments = Segments.Select(s => EncodeString(s));
            var r    = "";
            var rows = encodedSegments.Max(s => s.Length);

            for (int i = 0; i < rows; i += 5)
            {
                foreach (var s in encodedSegments)
                {
                    if (s.Length <= i)
                    {
                        r += "      ";
                    }
                    else
                    {
                        r += s.Substring(i, 5) + " ";
                    }
                }
                r += "\n";
            }
            return(r);
        }
Esempio n. 13
0
 public override void GenerateHash( )
 {
     base.GenerateHash();
     this.GeometryHash += GetMd5FromObject(Segments.Select(obj => obj.Hash).ToArray());
     this.Hash          = GetMd5FromObject(this.GeometryHash + GetMd5FromObject(this.Properties));
 }
Esempio n. 14
0
 public string ToUrlFromParameters(IDictionary <string, object> parameters)
 {
     return("/" + Segments.Select(x => x.SegmentFromParameters(parameters)).Join("/"));
 }
Esempio n. 15
0
 public string RoutePatternString()
 {
     return("/" + Segments.Select(x => x.RoutePatternPath()).Join("/"));
 }
Esempio n. 16
0
 public IGS1Item GetSegment(string applicationIdentifier)
 {
     return(Segments.Select(item => item).SingleOrDefault(x => x.Id == applicationIdentifier));
 }
Esempio n. 17
0
        public string ReadRouteDataFromMethodArguments(Expression expression)
        {
            var arguments = MethodCallParser.ToArguments(expression);

            return("/" + Segments.Select(x => x.ReadRouteDataFromMethodArguments(arguments)).Join("/"));
        }
Esempio n. 18
0
 public override string ToString()
 {
     return("/" + string.Join("/", Segments.Select(s => s.Value)) + (QueryString.IsDefined ? ("?" + QueryString.ToString()) : ""));
 }
Esempio n. 19
0
        public string ToXPath()
        {
            var parts = Segments.Select(s => "f:" + s.Name);

            return(string.Join("/", parts));
        }
Esempio n. 20
0
 public Element SegmentsAsWorkshopData() => Element.CreateArray(
     Segments.Select(segment => segment.AsWorkshopData()).ToArray()
     );
Esempio n. 21
0
 protected override void setJSON(JObject obj, BaseClassIfc host, SetJsonOptions options)
 {
     base.setJSON(obj, host, options);
     obj["Segments"]         = new JArray(Segments.Select(x => x.getJson(this, options)));
     obj["RailHeadDistance"] = mRailHeadDistance.ToString();
 }
Esempio n. 22
0
 public override string ToString()
 {
     return(string.Join(";", Segments.Select(s => s.ToString(_a))));
 }
        /// <summary>
        /// Gets the regex pattern for the current segment.
        /// </summary>
        /// <returns></returns>
        public override string GetRegexPattern()
        {
            var pattern = String.Concat(Segments.Select(s => s.GetRegexPattern()));

            return('^' + pattern + '$');
        }
Esempio n. 24
0
        private string ToXPath()
        {
            var parts = Segments.Select(s => "f:" + s.Name);

            return("../" + string.Join("/", parts));
        }
Esempio n. 25
0
 /// <summary>
 /// Output the path string.
 /// </summary>
 /// <returns>The string.</returns>
 public override string ToString()
 {
     return("/" + String.Join("/", Segments.Select(e => e.Kind)));
 }
Esempio n. 26
0
 public void GetDistinctTransportationCompany()
 {
     TransportationCompanies = Segments.Select(x => x.TransportationCompany).Distinct().ToList();
 }