Example #1
0
        public override string GetText()
        {
            if (!variables.Any())
            {
                return(string.Format("(λ. {0})", term));
            }

            return(string.Format("(λ {0}. {1})", variables.ToStrings().Separate(" ").AggregateString(), term));
        }
Example #2
0
        public static string SequenceToString <TSource>(this IEnumerable <TSource> source)
        {
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }

            return(source.ToStrings().Separate(", ").AggregateString());
        }
Example #3
0
        /// <summary>
        /// Will stream the given metrics in the specified format, breaking up the metrics into 10 packets at a time, where multiple metrics may
        /// comprise a single packet.  This call is appropriate for infinite IEnumerables.
        /// </summary>
        /// <exception cref="ArgumentNullException">	Thrown when the metrics are null. </exception>
        /// <param name="metrics">	The metrics. </param>
        public void Stream(IEnumerable <IMetric> metrics)
        {
            if (null == metrics)
            {
                throw new ArgumentNullException("metrics");
            }

            _messenger.StreamMetrics(metrics.ToStrings(_key, _format));
        }
Example #4
0
        /// <summary>
        /// Will stream the given metrics in the specified format, breaking up the metrics into 10 packets at a time, where multiple metrics may
        /// comprise a single packet.  This call is appropriate for infinite IEnumerables.
        /// </summary>
        /// <exception cref="ArgumentException">		Thrown when the hostNameOrAddress is null or empty OR the key contains invalid characters. </exception>
        /// <exception cref="ArgumentNullException">	Thrown when the metrics are null. </exception>
        /// <param name="hostNameOrAddress">	The DNS hostName or IPv4 or IPv6 address of the server. </param>
        /// <param name="port">	    The port. </param>
        /// <param name="format">   Describes the metric format to use. </param>
        /// <param name="key">	    The optional key to prefix metrics with. </param>
        /// <param name="metrics">  The metrics. </param>
        public static void Stream(string hostNameOrAddress, int port, MetricFormat format, string key, IEnumerable <IMetric> metrics)
        {
            if (string.IsNullOrEmpty(hostNameOrAddress))
            {
                throw new ArgumentException("cannot be null or empty", "hostNameOrAddress");
            }
            if (!key.IsValidKey())
            {
                throw new ArgumentException("contains invalid characters", "key");
            }
            if (null == metrics)
            {
                throw new ArgumentNullException("metrics");
            }

            SendToServer(hostNameOrAddress, port, metrics.ToStrings(key, format), true);
        }
Example #5
0
        public static string SequenceToMultilineString <TSource>(this IEnumerable <TSource> source)
        {
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }

            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.AppendLine("{");

            foreach (string @string in source.ToStrings())
            {
                stringBuilder.AppendFormat("\t{0}", @string.Replace("\n", "\n\t"));
            }

            stringBuilder.AppendLine("}");

            return(stringBuilder.ToString());
        }
Example #6
0
 public static string ToJoinedStrings <T>(this IEnumerable <T> stuff)
 {
     return(string.Join(", ", stuff.ToStrings()));
 }
Example #7
0
 public override string ToString()
 {
     return(string.Format("({0})", rules.ToStrings().Separate("|").AggregateString()));
 }
Example #8
0
 public override string GetText()
 {
     return(string.Format("[{0}]", terms.ToStrings().Separate(", ").AggregateString()));
 }
 public override string ToString()
 {
     return(string.Format("{0}: [{1}]", item, ranges.ToStrings().Separate(", ").AggregateString()));
 }
Example #10
0
        /// <summary>
        /// Will stream the given metrics in the specified format, breaking up the metrics into 10 packets at a time, where multiple metrics may
        /// comprise a single packet.  This call is appropriate for infinite IEnumerables.
        /// </summary>
        /// <exception cref="ArgumentNullException">	Thrown when the metrics are null. </exception>
        /// <param name="metrics">	The metrics. </param>
        public void Stream(IEnumerable<IMetric> metrics)
        {
            if (null == metrics) { throw new ArgumentNullException("metrics"); }

            _messenger.StreamMetrics(metrics.ToStrings(_key, _format));
        }
Example #11
0
        /// <summary>
        /// Will stream the given metrics in the specified format, breaking up the metrics into 10 packets at a time, where multiple metrics may
        /// comprise a single packet.  This call is appropriate for infinite IEnumerables.
        /// </summary>
        /// <exception cref="ArgumentException">		Thrown when the hostNameOrAddress is null or empty OR the key contains invalid characters. </exception>
        /// <exception cref="ArgumentNullException">	Thrown when the metrics are null. </exception>
        /// <param name="hostNameOrAddress">	The DNS hostName or IPv4 or IPv6 address of the server. </param>
        /// <param name="port">	   	The port. </param>
        /// <param name="format">  	Describes the metric format to use. </param>
        /// <param name="key">	   	The optional key to prefix metrics with. </param>
        /// <param name="metrics"> 	The metrics. </param>
        public static void Stream(string hostNameOrAddress, int port, MetricFormat format, string key, IEnumerable<IMetric> metrics)
        {
            if (string.IsNullOrEmpty(hostNameOrAddress)) { throw new ArgumentException("cannot be null or empty", "hostNameOrAddress"); }
            if (!key.IsValidKey()) { throw new ArgumentException("contains invalid characters", "key"); }
            if (null == metrics) { throw new ArgumentNullException("metrics"); }

            SendToServer(hostNameOrAddress, port, metrics.ToStrings(key, format), true);
        }