コード例 #1
0
ファイル: DurationType.cs プロジェクト: Neo4Net/Neo4Net
 protected internal override void AddTypeSpecificDetails(StringJoiner joiner, GenericKey state)
 {
     joiner.add("long0=" + state.Long0);
     joiner.add("long1=" + state.Long1);
     joiner.add("long2=" + state.Long2);
     joiner.add("long3=" + state.Long3);
 }
コード例 #2
0
        public void ShouldConcateString()
        {
            StringJoiner sut      = new StringJoiner();
            string       expected = "Usama Khan";

            Assert.That(sut.Join("Usama", "Khan"), Is.EqualTo(expected));
        }
コード例 #3
0
        public void ShouldConcateStringCasSenstive()
        {
            StringJoiner sut      = new StringJoiner();
            string       expected = "USAMA KHAN";

            Assert.That(sut.Join("Usama", "Khan"), Is.EqualTo(expected).IgnoreCase);
        }
コード例 #4
0
        public void ShouldJoinAndTestNotEqualString()
        {
            string       expected = "Usama Khan";
            StringJoiner sut      = new StringJoiner();

            Assert.That(sut.Join("MUhammad", "Usama"), Is.Not.EqualTo(expected));
        }
コード例 #5
0
 private void ReportToJoiner(StringJoiner joiner, Counter counter)
 {
     if (counter.NbrOfReports > 0)
     {
         joiner.add(counter.ToString());
     }
 }
コード例 #6
0
ファイル: StringJoinerTests.cs プロジェクト: k-boyle/Espeon
        public void TestJoinerClearClearsString()
        {
            var joiner = new StringJoiner("");

            joiner.Append("a");
            joiner.Clear();
            Assert.AreEqual(string.Empty, joiner.ToString());
        }
コード例 #7
0
ファイル: LoggingMonitor.cs プロジェクト: Neo4Net/Neo4Net
        public override void RecoveryCleanupFinished(File indexFile, IndexDescriptor indexDescriptor, long numberOfPagesVisited, long numberOfCleanedCrashPointers, long durationMillis)
        {
            StringJoiner joiner = new StringJoiner(", ", "Schema index cleanup job finished: " + IndexDescription(indexFile, indexDescriptor) + " ", "");

            joiner.add("Number of pages visited: " + numberOfPagesVisited);
            joiner.add("Number of cleaned crashed pointers: " + numberOfCleanedCrashPointers);
            joiner.add("Time spent: " + duration(durationMillis));
            _log.info(joiner.ToString());
        }
コード例 #8
0
        public void shouldJoinNotEqualString()
        {
            var    sutStringJoiner = new StringJoiner();
            string expectedResult  = "USAMA KHAN";

            var fullName = sutStringJoiner.Join("Muhammad", "Usama");

            Assert.That(fullName, Is.Not.EqualTo(expectedResult).IgnoreCase);
        }
コード例 #9
0
        public void shouldJoinStringCaseInsentive()
        {
            var    sutStringJoiner = new StringJoiner();
            string expectedResult  = "USAMA KHAN";

            var fullName = sutStringJoiner.Join("Usama", "Khan");

            Assert.That(fullName, Is.EqualTo(expectedResult).IgnoreCase);
        }
コード例 #10
0
        public void shouldJoinString()
        {
            var    sutStringJoiner = new StringJoiner();
            string expectedResult  = "Usama Khan";

            var fullName = sutStringJoiner.Join("Usama", "Khan");

            Assert.That(fullName, Is.EqualTo(expectedResult));
        }
コード例 #11
0
ファイル: GeometryArrayType.cs プロジェクト: Neo4Net/Neo4Net
 protected internal override void AddTypeSpecificDetails(StringJoiner joiner, GenericKey state)
 {
     joiner.add("long1=" + state.Long1);
     joiner.add("long2=" + state.Long2);
     joiner.add("long3=" + state.Long3);
     joiner.add("long0Array=" + Arrays.ToString(state.Long0Array));
     joiner.add("long1Array=" + Arrays.ToString(state.Long1Array));
     base.AddTypeSpecificDetails(joiner, state);
 }
コード例 #12
0
ファイル: StringJoinerTests.cs プロジェクト: k-boyle/Espeon
        public void TestJoinerToStringGivesExpectedString(string seperator, string expected)
        {
            var joiner = new StringJoiner(seperator);

            joiner.Append("a");
            joiner.Append("b");
            joiner.Append("c");
            Assert.AreEqual(expected, joiner.ToString());
        }
コード例 #13
0
        public override string ToString()
        {
            StringJoiner joiner = new StringJoiner(", ", "CleanupJob(", ")");

            joiner.add("file=" + _indexFile.AbsolutePath);
            joiner.add("needed=" + _needed);
            joiner.add("failure=" + (_failure == null ? null : _failure.ToString()));
            return(joiner.ToString());
        }
コード例 #14
0
        public void ShouldCompareTwoStrings()
        {
            String       expected = "USAMA KHAN";
            StringJoiner sut      = new StringJoiner();

            sut.Join("Muhammad", "Usama");

            Assert.That(sut.Result, Is.Not.EqualTo(expected));
        }
コード例 #15
0
ファイル: LoggingMonitor.cs プロジェクト: Neo4Net/Neo4Net
        public override void RecoveryCleanupFinished(long numberOfPagesVisited, long numberOfCleanedCrashPointers, long durationMillis)
        {
            StringJoiner joiner = new StringJoiner(", ", "Label index cleanup job finished: ", "");

            joiner.add("Number of pages visited: " + numberOfPagesVisited);
            joiner.add("Number of cleaned crashed pointers: " + numberOfCleanedCrashPointers);
            joiner.add("Time spent: " + duration(durationMillis));
            _log.info(joiner.ToString());
        }
コード例 #16
0
        private string MainReportString(string title)
        {
            StringJoiner joiner = new StringJoiner(", ", title + ": ", "");

            _times.Values.forEach(logger =>
            {
                ReportToJoiner(joiner, logger);
            });
            return(joiner.ToString());
        }
コード例 #17
0
        private string IndexPattern(string label, params string[] properties)
        {
            StringJoiner pattern = new StringJoiner(",", ":" + label + "(", ")");

            foreach (string property in properties)
            {
                pattern.add(property);
            }
            return(pattern.ToString());
        }
コード例 #18
0
        internal override string ToDetailedStringInternal()
        {
            StringJoiner joiner = new StringJoiner(",");

            foreach (GenericKey state in _states)
            {
                joiner.add(state.ToDetailedStringInternal());
            }
            return(joiner.ToString());
        }
コード例 #19
0
        private string Join(ICollection <object> collection)
        {
            var joiner = new StringJoiner(",");

            foreach (var value in collection)
            {
                joiner.Add(value.ToString());
            }

            return(joiner.ToString());
        }
コード例 #20
0
        public string PrintGenreNames()
        {
            StringJoiner names = new StringJoiner(", ");

            foreach (var genre in Title.TitleGenre)
            {
                names.Join(genre.Genre.Name);
            }

            return(names.JoinedString);
        }
コード例 #21
0
 public override void Init()
 {
     _started = false;
     if (!_jobs.Empty)
     {
         StringJoiner joiner = new StringJoiner(string.Format("%n  "), "Did not expect there to be any cleanup jobs still here. Jobs[", "]");
         ConsumeAndCloseJobs(cj => joiner.add(_jobs.ToString()));
         throw new System.InvalidOperationException(joiner.ToString());
     }
     ScheduleJobs();
 }
コード例 #22
0
        private string PeriodReportString(long millisSinceLastPeriodReport)
        {
            long         secondsSinceLastPeriodReport = TimeUnit.MILLISECONDS.toSeconds(millisSinceLastPeriodReport);
            StringJoiner joiner = new StringJoiner(", ", "Last " + secondsSinceLastPeriodReport + " sec: ", "");

//JAVA TO C# CONVERTER TODO TASK: Method reference arbitrary object instance method syntax is not converted by Java to C# Converter:
            _times.Values.Select(Logger::period).ForEach(period =>
            {
                ReportToJoiner(joiner, period);
                period.reset();
            });
            return(joiner.ToString());
        }
コード例 #23
0
ファイル: SupportSpatialUtil.cs プロジェクト: lanicon/nesper
        public static string SortGetExpectedPoints(
            BoundingBox bb,
            IList<SupportSpatialPoint> points)
        {
            var joiner = new StringJoiner(",");
            foreach (var point in points) {
                if (bb.ContainsPoint(point.Px.Value, point.Py.Value)) {
                    joiner.Add(point.Id);
                }
            }

            return joiner.ToString();
        }
コード例 #24
0
        private string Describe(ISet <KernelTransactionHandle> allBlockers)
        {
            if (allBlockers.Count == 0)
            {
                return(StringUtils.EMPTY);
            }
            StringJoiner stringJoiner = new StringJoiner(", ", "[", "]");

            foreach (KernelTransactionHandle blocker in allBlockers)
            {
                stringJoiner.add(blocker.UserTransactionName);
            }
            return(stringJoiner.ToString());
        }
コード例 #25
0
        internal virtual string ToDetailedString(GenericKey state)
        {
            StringJoiner joiner = new StringJoiner(", ");

            joiner.add(ToString(state));

            // Mutable, meta-state
            joiner.add("type=" + state.TypeConflict.GetType().Name);
            joiner.add("inclusion=" + state.Inclusion);
            joiner.add("isArray=" + state.IsArray);

            AddTypeSpecificDetails(joiner, state);
            return(joiner.ToString());
        }
コード例 #26
0
        private static void AssertCompare(
            MXCIFQuadTree tree,
            String expected,
            IDictionary <int, String> received)
        {
            StringJoiner joiner = new StringJoiner(",");

            foreach (string value in received.Values)
            {
                joiner.Add(value);
            }

            Assert.AreEqual(expected, joiner.ToString());
            Assert.IsTrue((expected.Length == 0 ? 0 : expected.SplitCsv().Length) <= MXCIFQuadTreeFilterIndexCount.Count(tree));
        }
コード例 #27
0
            internal virtual void AddToString(string name, long measurement, StringJoiner joiner, bool isTime)
            {
                string measurementString;

                if (isTime)
                {
                    long timeInNanos = TimeUnit.MILLISECONDS.toNanos(measurement);
                    measurementString = TimeUtil.nanosToString(timeInNanos);
                }
                else
                {
                    measurementString = Convert.ToString(measurement);
                }
                joiner.add(string.Format("{0}={1}", name, measurementString));
            }
コード例 #28
0
ファイル: StringJoiner.cs プロジェクト: ranganathsb/JavaSharp
        /// <summary>
        /// Adds the contents of the given {@code StringJoiner} without prefix and
        /// suffix as the next element if it is non-empty. If the given {@code
        /// StringJoiner} is empty, the call has no effect.
        ///
        /// <para>A {@code StringJoiner} is empty if <seealso cref="#add(CharSequence) add()"/>
        /// has never been called, and if {@code merge()} has never been called
        /// with a non-empty {@code StringJoiner} argument.
        ///
        /// </para>
        /// <para>If the other {@code StringJoiner} is using a different delimiter,
        /// then elements from the other {@code StringJoiner} are concatenated with
        /// that delimiter and the result is appended to this {@code StringJoiner}
        /// as a single element.
        ///
        /// </para>
        /// </summary>
        /// <param name="other"> The {@code StringJoiner} whose contents should be merged
        ///              into this one </param>
        /// <exception cref="NullPointerException"> if the other {@code StringJoiner} is null </exception>
        /// <returns> This {@code StringJoiner} </returns>
        public StringJoiner Merge(StringJoiner other)
        {
            Objects.RequireNonNull(other);
            if (other.Value != null)
            {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final int length = other.value.length();
                int length = other.Value.Length();
                // lock the length so that we can seize the data to be appended
                // before initiate copying to avoid interference, especially when
                // merge 'this'
                StringBuilder builder = PrepareBuilder();
                builder.Append(other.Value, other.Prefix.Length(), length);
            }
            return(this);
        }
コード例 #29
0
ファイル: ManifestPusher.cs プロジェクト: tiaotiao97/jib
        /**
         * Makes the warning for when the registry responds with an image digest that is not the expected
         * digest of the image.
         *
         * @param expectedDigest the expected image digest
         * @param receivedDigests the received image digests
         * @return the warning message
         */
        private static string MakeUnexpectedImageDigestWarning(
            DescriptorDigest expectedDigest, IList <string> receivedDigests)
        {
            if (receivedDigests.Count == 0)
            {
                return("Expected image digest " + expectedDigest + ", but received none");
            }

            StringJoiner message =
                new StringJoiner(", ", "Expected image digest " + expectedDigest + ", but received: ", "");

            foreach (string receivedDigest in receivedDigests)
            {
                message.Add(receivedDigest);
            }
            return(message.ToString());
        }
コード例 #30
0
            internal virtual string BuildProcedureQuery()
            {
                StringJoiner stringJoiner = new StringJoiner(",", "CALL " + Name + "(", ")");

                foreach (object parameter in Params)
                {
                    stringJoiner.add(parameter.ToString());
                }
                if (!string.ReferenceEquals(SetupQuery, null) && !string.ReferenceEquals(PostQuery, null))
                {
                    return(SetupQuery + " " + stringJoiner.ToString() + " " + PostQuery);
                }
                else
                {
                    return(stringJoiner.ToString());
                }
            }