Ejemplo n.º 1
0
        public ConsoleString(ConsolePoint position, IEnumerable <ConsoleSegment> segments)
        {
            Position = position;
            Segments = segments.ToImmutableList();

            _outputString = new CommandLineParsing.Output.ConsoleString(Segments.Select(Map));
        }
Ejemplo n.º 2
0
 public virtual int GetEstimatedSize()
 {
     return(Segments.Select(segment =>
                            segment.Starts.DataLength +
                            segment.Lengths.DataLength +
                            segment.SharedIndices.DataLength).Sum());
 }
Ejemplo 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));
            }
        }
    }
Ejemplo 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)));
        }
Ejemplo 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())));
        }
Ejemplo 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();
        }
Ejemplo 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);
     }
 }
Ejemplo 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();
 }
Ejemplo 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 + "?");
        }
Ejemplo 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));
        }
Ejemplo n.º 12
0
Archivo: Cipher.cs Proyecto: 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);
        }
Ejemplo 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));
 }
Ejemplo n.º 14
0
 public string ToUrlFromParameters(IDictionary <string, object> parameters)
 {
     return("/" + Segments.Select(x => x.SegmentFromParameters(parameters)).Join("/"));
 }
Ejemplo n.º 15
0
 public string RoutePatternString()
 {
     return("/" + Segments.Select(x => x.RoutePatternPath()).Join("/"));
 }
Ejemplo n.º 16
0
 public IGS1Item GetSegment(string applicationIdentifier)
 {
     return(Segments.Select(item => item).SingleOrDefault(x => x.Id == applicationIdentifier));
 }
Ejemplo n.º 17
0
        public string ReadRouteDataFromMethodArguments(Expression expression)
        {
            var arguments = MethodCallParser.ToArguments(expression);

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

            return(string.Join("/", parts));
        }
Ejemplo n.º 20
0
 public Element SegmentsAsWorkshopData() => Element.CreateArray(
     Segments.Select(segment => segment.AsWorkshopData()).ToArray()
     );
Ejemplo 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();
 }
Ejemplo n.º 22
0
 public override string ToString()
 {
     return(string.Join(";", Segments.Select(s => s.ToString(_a))));
 }
Ejemplo n.º 23
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()));

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

            return("../" + string.Join("/", parts));
        }
Ejemplo 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)));
 }
Ejemplo n.º 26
0
 public void GetDistinctTransportationCompany()
 {
     TransportationCompanies = Segments.Select(x => x.TransportationCompany).Distinct().ToList();
 }