public void write_single_section_of_text_with_numbers()
        {
            var writer = new TreeWriter(new Numbered());
            "ABCDEFGHIJK".ToCharArray().Each(c => writer.Line("".PadRight(10, c)));

            writer.WriteAll(Console.Out);
        }
Exemple #2
0
        public BuildPlanVisualizer(IPipelineGraph pipeline, bool deep = false, int levels = 0)
        {
            _pipeline = pipeline;
            _writer   = new TreeWriter();

            _maxLevels = deep ? int.MaxValue : levels;
        }
        public BuildPlanVisualizer(IPipelineGraph pipeline, bool deep = false, int levels = 0)
        {
            _pipeline = pipeline;
            _writer = new TreeWriter();

            _maxLevels = deep ? int.MaxValue : levels;
        }
        public void write_single_section_of_text()
        {
            var writer = new TreeWriter();

            "ABCDEFGHIJK".ToCharArray().Each(c => writer.Line("".PadRight(10, c)));

            writer.WriteAll(Console.Out);
        }
Exemple #5
0
        /// <summary>
        /// Responsible for rendering the DNNTree and in an uplevel rendering of the tree, sending down the xml for the child nodes in a ClientAPI variable.
        /// </summary>
        /// <param name="writer"></param>
        /// <remarks>
        /// </remarks>
        /// <history>
        ///     [jbrinkman]	5/6/2004	Created
        ///		[Jon Henning 4/6/2005	Commented
        /// </history>
        protected override void Render(HtmlTextWriter writer)
        {
            //If Me.IsDownLevel = False Then DotNetNuke.UI.Utilities.ClientAPI.RegisterClientVariable(Me.Page, Me.ClientID & "_xml", Me.TreeNodes.ToXml, True)
            TreeWriter.RenderTree(writer, this);
            Control oCtl;

            foreach (Control tempLoopVar_oCtl in this.Controls)
            {
                oCtl = tempLoopVar_oCtl;
                oCtl.RenderControl(writer);
            }
        }
Exemple #6
0
 public static TreeWriter <T> Serialize <T>(this Tree <T> tree, TreeWriter <T> serializer)
 {
     serializer.WritePrefix(tree);
     if (!tree.IsLeaf)
     {
         for (int i = 0; i < tree.Branches.Count; i++)
         {
             serializer.WriteBranch(tree.Branches[i], i);
         }
     }
     serializer.WriteSuffix(tree);
     return(serializer);
 }
Exemple #7
0
 public TreeWriter <T> Serialize(TreeWriter <T> serializer)
 {
     serializer.WritePrefix(this);
     if (!IsLeaf)
     {
         for (int i = 0; i < Branches.Count; i++)
         {
             serializer.WriteBranch(Branches[i], i);
         }
     }
     serializer.WriteSuffix(this);
     return(serializer);
 }
Exemple #8
0
 /// -----------------------------------------------------------------------------
 /// <summary>
 /// Responsible for rendering the DNNTree and in an uplevel rendering of the tree, sending down the xml for the child nodes in a ClientAPI variable.
 /// </summary>
 /// <param name="writer"></param>
 /// <remarks>
 /// </remarks>
 /// <history>
 ///     [jbrinkman]	5/6/2004	Created
 ///		[Jon Henning 4/6/2005	Commented
 /// </history>
 /// -----------------------------------------------------------------------------
 protected override void Render(HtmlTextWriter writer)
 {
     //If Me.IsDownLevel = False Then DotNetNuke.UI.Utilities.ClientAPI.RegisterClientVariable(Me.Page, Me.ClientID & "_xml", Me.TreeNodes.ToXml, True)
     TreeWriter.RenderTree(writer, this);
     foreach (Control oCtl in this.Controls)
     {
         oCtl.RenderControl(writer);
     }
     if (this.IsDownLevel == false)
     {
         ClientAPI.RegisterStartUpScript(Page, this.ClientID + "_startup", "<script>dnn.controls.initTree($('" + this.ClientID + "'));</script>");
     }
 }
        public void write_single_section_of_text_with_outline_with_bars()
        {
            var writer = new TreeWriter(new Outline());
            "abcdefghijk".ToCharArray().Each(c => writer.Line("".PadRight(10, c)));


            writer.StartSection(5);
            "LMNOPQRS".ToCharArray().Each(c => writer.Line("".PadRight(20, c)));
            writer.EndSection();

            "ABCDEFGHIJK".ToCharArray().Each(c => writer.Line("".PadRight(10, c)));

            writer.WriteAll(Console.Out);
        }
Exemple #10
0
        public void write_single_section_of_text_with_outline_with_bars()
        {
            var writer = new TreeWriter(new Outline());

            "abcdefghijk".ToCharArray().Each(c => writer.Line("".PadRight(10, c)));

            writer.StartSection(5);
            "LMNOPQRS".ToCharArray().Each(c => writer.Line("".PadRight(20, c)));
            writer.EndSection();

            "ABCDEFGHIJK".ToCharArray().Each(c => writer.Line("".PadRight(10, c)));

            writer.WriteAll(Console.Out);
        }
        public string GenerateHtml()
        {
            SaveDatas();
            switch (DisplayMode)
            {
            case DisplayMode.Relations:
                var relWritter = new TreeWriter();
                return(relWritter.GenerateHtml(PersonnageInfo.Personnage.Relations, OptionsViewModel.Options));

            case DisplayMode.Rps:
                var htmlWriter = new HtmlWriterService();
                return(htmlWriter.GenerateHtml(PersonnageInfo.Personnage.Periodes, OptionsViewModel.Options));

            default:
                return(string.Empty);
            }
        }
Exemple #12
0
        public void nested_bullets()
        {
            var writer = new TreeWriter();

            writer.Line("First List");
            writer.StartSection <Astericks>();

            "ABCDEFGHIJK".ToCharArray().Each(c => writer.Line("".PadRight(10, c)));

            writer.EndSection();

            writer.Line("More text");

            writer.StartSection <Numbered>();
            "ABCDEFGHIJK".ToCharArray().Each(c => writer.Line("".PadRight(10, c)));

            writer.EndSection();

            writer.WriteAll(Console.Out);
        }
Exemple #13
0
        public void deep_nested_sections_with_left_border()
        {
            var writer = new TreeWriter();

            "ABCDEFGHIJK".ToCharArray().Each(c => writer.Line("".PadRight(20, c)));

            writer.StartSection <Astericks>();
            "LMNOPQRS".ToCharArray().Each(c => writer.Line("".PadRight(20, c)));

            writer.StartSection <Numbered>();
            "TUVWXYZ".ToCharArray().Each(c => writer.Line("".PadRight(20, c)));
            writer.EndSection();

            "1234567".ToCharArray().Each(c => writer.Line("".PadRight(20, c)));
            writer.EndSection();

            "GHIJKLMNO".ToCharArray().Each(c => writer.Line("".PadRight(20, c)));

            writer.WriteAll(Console.Out);
        }
Exemple #14
0
        public StorageEnvironment(IVirtualPager pager, bool ownsPager = true)
        {
            try
            {
                _pager               = pager;
                _ownsPager           = ownsPager;
                _freeSpaceRepository = new FreeSpaceRepository(this);
                _sliceComparer       = NativeMethods.memcmp;

                Setup(pager);

                FreeSpaceRoot.Name = "Free Space";
                Root.Name          = "Root";

                Writer = new TreeWriter(this);
            }
            catch (Exception)
            {
                Dispose();
            }
        }
        public void nested_bullets()
        {
            var writer = new TreeWriter();
            writer.Line("First List");
            writer.StartSection<Astericks>();

            "ABCDEFGHIJK".ToCharArray().Each(c => writer.Line("".PadRight(10, c)));

            writer.EndSection();

            writer.Line("More text");

            writer.StartSection<Numbered>();
            "ABCDEFGHIJK".ToCharArray().Each(c => writer.Line("".PadRight(10, c)));


            writer.EndSection();


            writer.WriteAll(Console.Out);
        }
        static public void BuildTree(HtmlTestFilesFixture fixture, string name)
        {
            string testFile     = fixture.GetDestinationPath(name);
            string baselineFile = testFile + ".tree";
            string text         = fixture.LoadDestinationFile(name);

            var tree = new HtmlTree(new TextStream(text), null, null, ParsingMode.Html);

            tree.Build();

            TreeWriter tw     = new TreeWriter();
            string     actual = tw.WriteTree(tree);

            if (_regenerateBaselineFiles)
            {
                // Update this to your actual enlistment if you need to update baseline
                baselineFile = Path.Combine(fixture.SourcePath, name) + ".tree";
                TestFiles.UpdateBaseline(baselineFile, actual);
            }
            else
            {
                TestFiles.CompareToBaseLine(baselineFile, actual);
            }
        }
 public DependencyVisualizer(string title, TreeWriter writer, BuildPlanVisualizer buildPlanVisitor)
 {
     _writer = new TitledWriter(title, writer);
     _buildPlanVisitor = buildPlanVisitor;
 }
        public WriterImpl(
            Stream stream,
            string path,
            OrcFile.WriterOptions options,
            ObjectInspector inspector,
            TypeDescription schema,
            long stripeSize,
            CompressionKind compress,
            int bufferSize,
            int rowIndexStride,
            MemoryManager memoryManager,
            bool addBlockPadding,
            OrcFile.Version version,
            OrcFile.WriterCallback callback,
            OrcFile.EncodingStrategy encodingStrategy,
            OrcFile.CompressionStrategy compressionStrategy,
            double paddingTolerance,
            long blockSizeValue,
            string bloomFilterColumnNames,
            double bloomFilterFpp)
        {
            this.baseStream = stream;
            this.streamFactory = new StreamFactory(this);
            this.path = path;
            this.options = options;
            this.callback = callback;
            this.schema = schema;
            this.adjustedStripeSize = stripeSize;
            this.defaultStripeSize = stripeSize;
            this.version = version;
            this.encodingStrategy = encodingStrategy;
            this.compressionStrategy = compressionStrategy;
            this.addBlockPadding = addBlockPadding;
            this.blockSize = blockSizeValue;
            this.paddingTolerance = paddingTolerance;
            this.compress = compress;
            this.rowIndexStride = rowIndexStride;
            this.memoryManager = memoryManager;
            buildIndex = rowIndexStride > 0;
            codec = createCodec(compress);
            int numColumns = schema.getMaximumId() + 1;
            this.bufferSize = getEstimatedBufferSize(defaultStripeSize, numColumns, bufferSize);
            if (version == OrcFile.Version.V_0_11)
            {
                /* do not write bloom filters for ORC v11 */
                this.bloomFilterColumns = new bool[schema.getMaximumId() + 1];
            }
            else
            {
                this.bloomFilterColumns =
                    OrcUtils.includeColumns(bloomFilterColumnNames, schema);
            }
            this.bloomFilterFpp = bloomFilterFpp;
            treeWriter = createTreeWriter(inspector, schema, streamFactory, false);
            if (buildIndex && rowIndexStride < MIN_ROW_INDEX_STRIDE)
            {
                throw new ArgumentException("Row stride must be at least " +
                    MIN_ROW_INDEX_STRIDE);
            }

            // ensure that we are able to handle callbacks before we register ourselves
            memoryManager.addWriter(path, stripeSize, this);
        }
 private static void writeFields(
     StructColumnVector vector,
     TreeWriter[] childrenWriters,
     int offset,
     int length)
 {
     for (int field = 0; field < childrenWriters.Length; ++field)
     {
         childrenWriters[field].writeBatch(vector.fields[field], offset, length);
     }
 }
 private void writeFileStatistics(OrcProto.Footer.Builder builder,
                                  TreeWriter writer)
 {
     builder.AddStatistics(writer.fileStatistics.serialize());
     foreach (TreeWriter child in writer.getChildrenWriters())
     {
         writeFileStatistics(builder, child);
     }
 }
 private long getRawDataSize(TreeWriter child, TypeDescription schema)
 {
     long total = 0;
     long numVals = child.fileStatistics.getNumberOfValues();
     switch (schema.getCategory())
     {
         case Category.BOOLEAN:
         case Category.BYTE:
         case Category.SHORT:
         case Category.INT:
         case Category.FLOAT:
             return numVals * JavaDataModel.Four;
         case Category.LONG:
         case Category.DOUBLE:
             return numVals * JavaDataModel.Eight;
         case Category.STRING:
         case Category.VARCHAR:
         case Category.CHAR:
             // ORC strings are converted to java Strings. so use JavaDataModel to
             // compute the overall size of strings
             StringColumnStatistics scs = (StringColumnStatistics)child.fileStatistics;
             numVals = numVals == 0 ? 1 : numVals;
             int avgStringLen = (int)(scs.getSum() / numVals);
             return numVals * JavaDataModel.lengthForStringOfLength(avgStringLen);
         case Category.DECIMAL:
             return numVals * JavaDataModel.lengthOfDecimal();
         case Category.DATE:
             return numVals * JavaDataModel.lengthOfDate();
         case Category.BINARY:
             // get total length of binary blob
             BinaryColumnStatistics bcs = (BinaryColumnStatistics)child.fileStatistics;
             return bcs.getSum();
         case Category.TIMESTAMP:
             return numVals * JavaDataModel.lengthOfTimestamp();
         case Category.LIST:
         case Category.MAP:
         case Category.UNION:
         case Category.STRUCT:
             {
                 TreeWriter[] childWriters = child.getChildrenWriters();
                 IList<TypeDescription> childTypes = schema.getChildren();
                 for (int i = 0; i < childWriters.Length; ++i)
                 {
                     total += getRawDataSize(childWriters[i], childTypes[i]);
                 }
                 break;
             }
         default:
             LOG.debug("Unknown object inspector category.");
             break;
     }
     return total;
 }
 public MapTreeWriter(int columnId,
               ObjectInspector inspector,
               TypeDescription schema,
               StreamFactory writer,
               bool nullable)
     : base(columnId, inspector, schema, writer, nullable)
 {
     this.isDirectV2 = isNewWriteFormat(writer);
     ObjectInspector keyInspector = null;
     ObjectInspector valueInspector = null;
     if (inspector != null)
     {
         MapObjectInspector insp = (MapObjectInspector)inspector;
         keyInspector = insp.getMapKeyObjectInspector();
         valueInspector = insp.getMapValueObjectInspector();
     }
     childrenWriters = new TreeWriter[2];
     IList<TypeDescription> children = schema.getChildren();
     childrenWriters[0] = createTreeWriter(keyInspector, children[0], writer, true);
     childrenWriters[1] = createTreeWriter(valueInspector, children[1], writer, true);
     lengths = createIntegerWriter(writer.createStream(columnId,
         OrcProto.Stream.Types.Kind.LENGTH), false, isDirectV2, writer);
     recordPosition(rowIndexPosition);
 }
 private List<TreeWriter> getAllColumnTreeWriters(TreeWriter rootTreeWriter)
 {
     List<TreeWriter> result = new List<TreeWriter>();
     getAllColumnTreeWritersImpl(rootTreeWriter, result);
     return result;
 }
 public UnionTreeWriter(int columnId,
               ObjectInspector inspector,
               TypeDescription schema,
               StreamFactory writer,
               bool nullable)
     : base(columnId, inspector, schema, writer, nullable)
 {
     IList<ObjectInspector> choices = null;
     if (inspector != null)
     {
         UnionObjectInspector insp = (UnionObjectInspector)inspector;
         choices = insp.getObjectInspectors();
     }
     IList<TypeDescription> children = schema.getChildren();
     childrenWriters = new TreeWriter[children.Count];
     for (int i = 0; i < childrenWriters.Length; ++i)
     {
         childrenWriters[i] = createTreeWriter(
             choices != null ? choices[i] : null, children[i], writer, true);
     }
     tags =
       new RunLengthByteWriter(writer.createStream(columnId,
           OrcProto.Stream.Types.Kind.DATA));
     recordPosition(rowIndexPosition);
 }
 private void writeStripeStatistics(OrcProto.StripeStatistics.Builder builder, TreeWriter treeWriter)
 {
     treeWriter.fileStatistics.merge(treeWriter.stripeColStatistics);
     builder.AddColStats(treeWriter.stripeColStatistics.serialize().Build());
     treeWriter.stripeColStatistics.reset();
     foreach (TreeWriter child in treeWriter.getChildrenWriters())
     {
         writeStripeStatistics(builder, child);
     }
 }
Exemple #26
0
 public TitledWriter(string title, TreeWriter writer)
 {
     _title = title;
     _writer = writer;
 }
Exemple #27
0
 public DependencyVisualizer(string title, TreeWriter writer, BuildPlanVisualizer buildPlanVisitor)
 {
     _writer           = new TitledWriter(title, writer);
     _buildPlanVisitor = buildPlanVisitor;
 }
Exemple #28
0
 public TreeWriterTests()
 {
     binaryWriter = BinaryWriterSubstitute.New();
     treeWriter   = new TreeWriter();
 }
        public void deep_nested_sections_with_left_border()
        {
            var writer = new TreeWriter();
            "ABCDEFGHIJK".ToCharArray().Each(c => writer.Line("".PadRight(20, c)));

            writer.StartSection<Astericks>();
            "LMNOPQRS".ToCharArray().Each(c => writer.Line("".PadRight(20, c)));

            writer.StartSection<Numbered>();
            "TUVWXYZ".ToCharArray().Each(c => writer.Line("".PadRight(20, c)));
            writer.EndSection();

            "1234567".ToCharArray().Each(c => writer.Line("".PadRight(20, c)));
            writer.EndSection();

            "GHIJKLMNO".ToCharArray().Each(c => writer.Line("".PadRight(20, c)));


            writer.WriteAll(Console.Out);
        }
 public ListTreeWriter(int columnId,
                ObjectInspector inspector,
                TypeDescription schema,
                StreamFactory writer,
                bool nullable)
     : base(columnId, inspector, schema, writer, nullable)
 {
     this.isDirectV2 = isNewWriteFormat(writer);
     ObjectInspector childOI = inspector == null ? null :
       ((ListObjectInspector)inspector).getListElementObjectInspector();
     childrenWriters = new TreeWriter[1];
     childrenWriters[0] =
       createTreeWriter(childOI, schema.getChildren()[0], writer, true);
     lengths = createIntegerWriter(writer.createStream(columnId,
         OrcProto.Stream.Types.Kind.LENGTH), false, isDirectV2, writer);
     recordPosition(rowIndexPosition);
 }
 private void getAllColumnTreeWritersImpl(TreeWriter tw, List<TreeWriter> result)
 {
     result.Add(tw);
     foreach (TreeWriter child in tw.childrenWriters)
     {
         getAllColumnTreeWritersImpl(child, result);
     }
 }
 public StructTreeWriter(int columnId,
                  ObjectInspector inspector,
                  TypeDescription schema,
                  StreamFactory writer,
                  bool nullable)
     : base(columnId, inspector, schema, writer, nullable)
 {
     IList<TypeDescription> children = schema.getChildren();
     if (inspector != null)
     {
         StructObjectInspector structObjectInspector =
           (StructObjectInspector)inspector;
         fields = structObjectInspector.getAllStructFieldRefs();
     }
     childrenWriters = new TreeWriter[children.Count];
     for (int i = 0; i < childrenWriters.Length; ++i)
     {
         ObjectInspector childOI;
         if (fields != null && i < fields.Count)
         {
             childOI = fields[i].getFieldObjectInspector();
         }
         else
         {
             childOI = null;
         }
         childrenWriters[i] = createTreeWriter(
           childOI, children[i], writer,
           true);
     }
     recordPosition(rowIndexPosition);
 }