Example #1
0
            public void NeTernRelObj(NeTernRelObj obj)
            {
                Obj[] col1 = obj.Col1();
                Obj[] col2 = obj.Col2();
                Obj[] col3 = obj.Col3();
                int   len  = col1.Length;
                int   size = 6 * len + (len == 1 ? 1 : 0);

                for (int i = 0; i < len; i++)
                {
                    size += ObjSize(col1[i]) + ObjSize(col2[i]) + ObjSize(col3[i]);
                }
                ConsumeSize(obj, size);
            }
Example #2
0
        public void NeTernRelObj(NeTernRelObj obj)
        {
            Obj[] col1 = obj.Col1();
            Obj[] col2 = obj.Col2();
            Obj[] col3 = obj.Col3();
            int   len  = col1.Length;

            writer.Write('[');

            if (IsMultiline(obj))
            {
                writer.Indent();
                if (writer.IsNewLine())
                {
                    writer.Write(' ');
                }
                else
                {
                    writer.NewLine();
                }

                for (int i = 0; i < len; i++)
                {
                    Obj arg1 = col1[i];
                    Obj arg2 = col2[i];
                    Obj arg3 = col3[i];

                    bool multiline = IsMultiline(arg1) || IsMultiline(arg2) || IsMultiline(arg3);

                    arg1.Visit(this);
                    writer.Write(",");
                    if (multiline)
                    {
                        writer.NewLine();
                    }
                    else
                    {
                        writer.Write(' ');
                    }

                    arg2.Visit(this);
                    writer.Write(",");
                    if (multiline)
                    {
                        writer.NewLine();
                    }
                    else
                    {
                        writer.Write(' ');
                    }

                    arg3.Visit(this);

                    if (i == 0 | i < len - 1)
                    {
                        writer.Write(";");
                    }
                    writer.NewLine();
                }

                writer.UnindentedNewLine();
            }
            else
            {
                for (int i = 0; i < len; i++)
                {
                    if (i > 0)
                    {
                        writer.Write("; ");
                    }
                    col1[i].Visit(this);
                    writer.Write(", ");
                    col2[i].Visit(this);
                    writer.Write(", ");
                    col3[i].Visit(this);
                }

                if (len == 1)
                {
                    writer.Write(';');
                }
            }

            writer.Write(']');
        }