示例#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();
        }