Beispiel #1
0
//JAVA TO C# CONVERTER WARNING: 'final' parameters are ignored unless the option to convert to C# 7.2 'in' parameters is selected:
//ORIGINAL LINE: static String formatInterval(final long l)
        internal static string FormatInterval(long l)
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final long hr = MILLISECONDS.toHours(l);
            long hr = MILLISECONDS.toHours(l);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final long min = MILLISECONDS.toMinutes(l - HOURS.toMillis(hr));
            long min = MILLISECONDS.toMinutes(l - HOURS.toMillis(hr));
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final long sec = MILLISECONDS.toSeconds(l - HOURS.toMillis(hr) - MINUTES.toMillis(min));
            long sec = MILLISECONDS.toSeconds(l - HOURS.toMillis(hr) - MINUTES.toMillis(min));
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final long ms = l - HOURS.toMillis(hr) - MINUTES.toMillis(min) - SECONDS.toMillis(sec);
            long ms = l - HOURS.toMillis(hr) - MINUTES.toMillis(min) - SECONDS.toMillis(sec);

            return(string.Format("{0:D2}:{1:D2}:{2:D2}.{3:D3}", hr, min, sec, ms));
        }
Beispiel #2
0
        internal static object[] Build(Org.Neo4j.causalclustering.routing.load_balancing.LoadBalancingProcessor_Result result)
        {
//JAVA TO C# CONVERTER TODO TASK: Method reference arbitrary object instance method syntax is not converted by Java to C# Converter:
            object[] routers = result.RouteEndpoints().Select(Endpoint::address).Select(SocketAddress::toString).ToArray();
//JAVA TO C# CONVERTER TODO TASK: Method reference arbitrary object instance method syntax is not converted by Java to C# Converter:
            object[] readers = result.ReadEndpoints().Select(Endpoint::address).Select(SocketAddress::toString).ToArray();
//JAVA TO C# CONVERTER TODO TASK: Method reference arbitrary object instance method syntax is not converted by Java to C# Converter:
            object[] writers = result.WriteEndpoints().Select(Endpoint::address).Select(SocketAddress::toString).ToArray();

            IList <IDictionary <string, object> > servers = new List <IDictionary <string, object> >();

            if (writers.Length > 0)
            {
                IDictionary <string, object> map = new SortedDictionary <string, object>();

                map[ROLE_KEY]      = WRITE.name();
                map[ADDRESSES_KEY] = writers;

                servers.Add(map);
            }

            if (readers.Length > 0)
            {
                IDictionary <string, object> map = new SortedDictionary <string, object>();

                map[ROLE_KEY]      = READ.name();
                map[ADDRESSES_KEY] = readers;

                servers.Add(map);
            }

            if (routers.Length > 0)
            {
                IDictionary <string, object> map = new SortedDictionary <string, object>();

                map[ROLE_KEY]      = ROUTE.name();
                map[ADDRESSES_KEY] = routers;

                servers.Add(map);
            }

            long timeToLiveSeconds = MILLISECONDS.toSeconds(result.TtlMillis());

            return(new object[] { timeToLiveSeconds, servers });
        }
Beispiel #3
0
        internal static object[] Build(MultiClusterRoutingResult result)
        {
            System.Func <IList <Endpoint>, object[]> stringifyAddresses = es => es.Select(e => e.address().ToString()).ToArray();

            IList <IDictionary <string, object> > response = result.Routers().SetOfKeyValuePairs().Select(entry =>
            {
                string dbName      = entry.Key;
                object[] addresses = stringifyAddresses(entry.Value);

                IDictionary <string, object> responseRow = new SortedDictionary <string, object>();

                responseRow.put(DB_NAME_KEY, dbName);
                responseRow.put(ADDRESSES_KEY, addresses);

                return(responseRow);
            }).ToList();

            long ttlSeconds = MILLISECONDS.toSeconds(result.TtlMillis());

            return(new object[] { ttlSeconds, response });
        }