예제 #1
0
 public virtual int[] ToOrderedKeys()
 {
     int[] res = GetKeys();
     JavaUtil.Sort(res);
     return(res);
 }
예제 #2
0
        /// <summary>Combines hashCode of previous elements sequence and value's hashCode.</summary>
        /// <param name="hashCode">previous hashCode value</param>
        /// <param name="value">new element</param>
        /// <returns>combined hashCode</returns>
        public static int Combine(int hashCode, float value)
        {
            int v = JavaUtil.FloatToIntBits(value);

            return(Combine(hashCode, v));
        }
예제 #3
0
        /// <summary>Combines hashCode of previous elements sequence and value's hashCode.</summary>
        /// <param name="hashCode">previous hashCode value</param>
        /// <param name="value">new element</param>
        /// <returns>combined hashCode</returns>
        public static int Combine(int hashCode, double value)
        {
            long v = JavaUtil.DoubleToLongBits(value);

            return(Combine(hashCode, v));
        }
예제 #4
0
        public static ByteBuffer CreateBufferedEscapedString(byte[] bytes)
        {
            ByteBuffer buf = new ByteBuffer(bytes.Length * 2 + 2);

            buf.Append('(');
            foreach (byte b in bytes)
            {
                switch (b)
                {
                case (byte)'\r': {
                    buf.Append(escR);
                    break;
                }

                case (byte)'\n': {
                    buf.Append(escN);
                    break;
                }

                case (byte)'\t': {
                    buf.Append(escT);
                    break;
                }

                case (byte)'\b': {
                    buf.Append(escB);
                    break;
                }

                case (byte)'\f': {
                    buf.Append(escF);
                    break;
                }

                case (byte)'(':
                case (byte)')':
                case (byte)'\\': {
                    buf.Append('\\').Append(b);
                    break;
                }

                default: {
                    if (b < 8 && b >= 0)
                    {
                        buf.Append("\\00").Append(JavaUtil.IntegerToOctalString(b));
                    }
                    else
                    {
                        if (b >= 8 && b < 32)
                        {
                            buf.Append("\\0").Append(JavaUtil.IntegerToOctalString(b));
                        }
                        else
                        {
                            buf.Append(b);
                        }
                    }
                    break;
                }
                }
            }
            buf.Append(')');
            return(buf);
        }