Пример #1
0
        public virtual void dumpDot(PrintWriter @out)
        {
            @out.write("digraph \"CART Tree\" {\n");
            @out.write("rankdir = LR\n");
            DecisionTree.Node[] array = this.cart;
            int num = array.Length;

            for (int i = 0; i < num; i++)
            {
                DecisionTree.Node node = array[i];
                @out.println(new StringBuilder().append("\t\"node").append(Object.instancehelper_hashCode(node)).append("\" [ label=\"").append(Object.instancehelper_toString(node)).append("\", color=").append(this.dumpDotNodeColor(node)).append(", shape=").append(this.dumpDotNodeShape(node)).append(" ]\n").toString());
                if (node is DecisionTree.DecisionNode)
                {
                    DecisionTree.DecisionNode decisionNode = (DecisionTree.DecisionNode)node;
                    if (decisionNode.qtrue < this.cart.Length && this.cart[decisionNode.qtrue] != null)
                    {
                        @out.write(new StringBuilder().append("\t\"node").append(Object.instancehelper_hashCode(node)).append("\" -> \"node").append(Object.instancehelper_hashCode(this.cart[decisionNode.qtrue])).append("\" [ label=TRUE ]\n").toString());
                    }
                    if (decisionNode.qfalse < this.cart.Length && this.cart[decisionNode.qfalse] != null)
                    {
                        @out.write(new StringBuilder().append("\t\"node").append(Object.instancehelper_hashCode(node)).append("\" -> \"node").append(Object.instancehelper_hashCode(this.cart[decisionNode.qfalse])).append("\" [ label=FALSE ]\n").toString());
                    }
                }
            }
            @out.write("}\n");
            @out.close();
        }
Пример #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Override protected void writeLog(@Nonnull PrintWriter out, @Nonnull String message)
        protected internal override void WriteLog(PrintWriter @out, string message)
        {
            @out.write(_prefix);
            @out.write(": ");
            @out.write(message);
            @out.println();
        }
Пример #3
0
 private void LineStart(PrintWriter @out)
 {
     @out.write(Time());
     @out.write(' ');
     @out.write(_prefix);
     @out.write(' ');
 }
Пример #4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Override protected void writeLog(@Nonnull PrintWriter out, @Nonnull String message, @Nonnull Throwable throwable)
        protected internal override void WriteLog(PrintWriter @out, string message, Exception throwable)
        {
            @out.write(_prefix);
            @out.write(": ");
            @out.write(message);
            @out.write(' ');
            @out.write(throwable.Message);
            @out.println();
            throwable.printStackTrace(@out);
        }
Пример #5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Override protected void writeLog(@Nonnull PrintWriter out, @Nonnull String message, @Nonnull Throwable throwable)
        protected internal override void WriteLog(PrintWriter @out, string message, Exception throwable)
        {
            LineStart(@out);
            @out.write(message);
            if (throwable.Message != null)
            {
                @out.write(' ');
                @out.write(throwable.Message);
            }
            @out.println();
            throwable.printStackTrace(@out);
        }
Пример #6
0
        /// <summary>
        /// Writes char array
        /// </summary>
        /// <param name="chars"></param>
        /// <param name="index"></param>
        /// <param name="count"></param>
        public override void write(char [] chars, int index, int count)
        {
            if (_outputMode == OutputMode.CharWriter)
            {
                _printWriter.write(chars, index, count);
            }
            else
            {
                int     length     = Encoding.GetMaxByteCount(count);
                byte [] bytebuffer = GetByteBuffer(length);
                int     realLength = Encoding.GetBytes(chars, index, count, bytebuffer, 0);

                _outputStream.write(TypeUtils.ToSByteArray(bytebuffer), 0, realLength);
            }
        }
Пример #7
0
 private void writeBatch(PrintWriter @out, int batchSize)
 {
     for (int i = 0; i < batchSize; i++)
     {
         @out.write(format("%d %d\n", i, i * i));
         i++;
     }
 }
Пример #8
0
 private void traverseDot(PrintWriter printWriter, Set set)
 {
     if (!set.contains(this))
     {
         set.add(this);
         printWriter.println(new StringBuilder().append("\tnode").append(this.getID()).append(" [ label=").append(this.getGDLLabel(this)).append(", color=").append(this.getGDLColor(this)).append(", shape=").append(this.getGDLShape(this)).append(" ]\n").toString());
         GrammarArc[] successors = this.getSuccessors();
         GrammarArc[] array      = successors;
         int          num        = array.Length;
         for (int i = 0; i < num; i++)
         {
             GrammarArc  grammarArc  = array[i];
             GrammarNode grammarNode = grammarArc.getGrammarNode();
             float       probability = grammarArc.getProbability();
             printWriter.write(new StringBuilder().append("\tnode").append(this.getID()).append(" -> node").append(grammarNode.getID()).append(" [ label=").append(probability).append(" ]\n").toString());
             grammarNode.traverseDot(printWriter, set);
         }
     }
 }
Пример #9
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Override protected void writeLog(@Nonnull PrintWriter out, @Nonnull String message)
        protected internal override void WriteLog(PrintWriter @out, string message)
        {
            LineStart(@out);
            @out.write(message);
            @out.println();
        }