examples
Folders and files
Name | Name | Last commit date | ||
---|---|---|---|---|
parent directory.. | ||||
<body> <h2>Examples Directory</h2> As you might expect, the sub-directories in this directory all hold various examples of Converting <b>Cobol Copybooks</b> to Xml and processing <i>Cobol Copybooks</i> / <i>cb2xml-Xml</i> in various languages. In particular: <ul> <li><a href="RunningCb2xml">RunningCb2xml</a> holds bat/shell script examples of converting Cobol-Copybooks to Xml + converting Cobol-Data files To / from Xml. If you want to convert Cobol data files to/from Xml you are better of using <a href="https://sourceforge.net/p/jrecord/wiki/Data2Xml%20and%20Xml2Data/">JRecord</a>.</li> <li>The <a href="GroovyExample">GroovyExample</a>, <a href="JRubyExample">JRubyExample</a> and <a href="JythonExample">JythonExample</a> hold programs that process <i>Cobol-Copybooks</i> / <i>cb2xml-Xml</i> using jaxb.</li> <li>The <a href="JRubyExample">RubyExample</a> and <a href="JythonExample">PythonExample</a> directories hold example programs that read cb2xml generated Xml.</li> <li>Finally <a href="JavaExamples">JavaExamples</a> holds <i>bat/shell script</i> files to run the java example programs.</li> </ul> <h3>Python Example</h3> <p>The following code prints details from a cb2xml-Xml file.</p> <pre><font color="#000000"><span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#990066">10 </font></span><font color="#006699"><strong>import</strong></font> xml.etree.ElementTree <font color="#006699"><strong>as</strong></font> ET <span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">11 </font></span> <span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">12 </font></span><font color="#cc0000">#</font><font color="#cc0000">#</font><font color="#cc0000"> </font><font color="#cc0000">Get</font><font color="#cc0000"> </font><font color="#cc0000">an</font><font color="#cc0000"> </font><font color="#cc0000">attribute</font><font color="#cc0000"> </font><font color="#cc0000">if</font><font color="#cc0000"> </font><font color="#cc0000">it</font><font color="#cc0000"> </font><font color="#cc0000">exist</font><font color="#cc0000"> </font><font color="#cc0000">otherwise</font><font color="#cc0000"> </font><font color="#cc0000">return</font><font color="#cc0000"> </font><font color="#cc0000">''</font> <span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">13 </font></span><font color="#006699"><strong>def</strong></font> <font color="#9966ff">getAttr</font><font color="#000000"><strong>(</strong></font>d, key<font color="#000000"><strong>)</strong></font><font color="#006699"><strong>:</strong></font> <span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">14 </font></span> r<font color="#000000"><strong>=</strong></font><font color="#ff00cc">'</font><font color="#ff00cc">'</font> <span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#990066">15 </font></span> <font color="#006699"><strong>if</strong></font> key <font color="#006699"><strong>in</strong></font> d.attrib<font color="#006699"><strong>:</strong></font> <span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">16 </font></span> r <font color="#000000"><strong>=</strong></font> d.attrib[key] <span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">17 </font></span> <font color="#006699"><strong>return</strong></font> r <span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">18 </font></span> <span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">19 </font></span><font color="#cc0000">#</font><font color="#cc0000"> </font><font color="#cc0000">Get</font><font color="#cc0000"> </font><font color="#cc0000">attribute</font><font color="#cc0000"> </font><font color="#cc0000">if</font><font color="#cc0000"> </font><font color="#cc0000">it</font><font color="#cc0000"> </font><font color="#cc0000">exists</font> <span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#990066">20 </font></span><font color="#006699"><strong>def</strong></font> <font color="#9966ff">getAttrId</font><font color="#000000"><strong>(</strong></font>d, key<font color="#000000"><strong>)</strong></font><font color="#006699"><strong>:</strong></font> <span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">21 </font></span> r<font color="#000000"><strong>=</strong></font><font color="#ff00cc">'</font><font color="#ff00cc">'</font> <span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">22 </font></span> <font color="#006699"><strong>if</strong></font> key <font color="#006699"><strong>in</strong></font> d.attrib<font color="#006699"><strong>:</strong></font> <span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">23 </font></span> r <font color="#000000"><strong>=</strong></font> key <font color="#000000"><strong>+</strong></font> <font color="#ff00cc">'</font><font color="#ff00cc">=</font><font color="#ff00cc">'</font> <font color="#000000"><strong>+</strong></font> d.attrib[key] <span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">24 </font></span> <font color="#006699"><strong>return</strong></font> r <span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#990066">25 </font></span> <span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">26 </font></span><font color="#cc0000">#</font><font color="#cc0000">#########################################################################</font> <span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">27 </font></span><font color="#cc0000">#</font><font color="#cc0000"> </font><font color="#cc0000">Purpose:</font><font color="#cc0000"> </font><font color="#cc0000">Print</font><font color="#cc0000"> </font><font color="#cc0000">one</font><font color="#cc0000"> </font><font color="#cc0000">item</font> <span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">28 </font></span><font color="#cc0000">#</font><font color="#cc0000">#########################################################################</font> <span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">29 </font></span><font color="#006699"><strong>def</strong></font> <font color="#9966ff">printItem</font><font color="#000000"><strong>(</strong></font>indent, item<font color="#000000"><strong>)</strong></font><font color="#006699"><strong>:</strong></font> <span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#990066">30 </font></span> n <font color="#000000"><strong>=</strong></font> indent <font color="#000000"><strong>+</strong></font> item.attrib[<font color="#ff00cc">'</font><font color="#ff00cc">level</font><font color="#ff00cc">'</font>] <font color="#000000"><strong>+</strong></font> <font color="#ff00cc">"</font><font color="#ff00cc"> </font><font color="#ff00cc">"</font> <font color="#000000"><strong>+</strong></font> item.attrib[<font color="#ff00cc">'</font><font color="#ff00cc">name</font><font color="#ff00cc">'</font>] <font color="#000000"><strong>+</strong></font> <font color="#ff00cc">"</font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc">"</font> <span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">31 </font></span> n <font color="#000000"><strong>=</strong></font> n[<font color="#006699"><strong>:</strong></font><font color="#ff0000">50</font>] <span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">32 </font></span> <span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">33 </font></span> <font color="#006699"><strong>print</strong></font> n, <font color="#ff00cc">'</font><font color="#ff00cc">\t</font><font color="#ff00cc">'</font>, item.attrib[<font color="#ff00cc">'</font><font color="#ff00cc">position</font><font color="#ff00cc">'</font>], <font color="#ff00cc">'</font><font color="#ff00cc">\t</font><font color="#ff00cc">'</font>, item.attrib[<font color="#ff00cc">'</font><font color="#ff00cc">storage</font><font color="#ff00cc">-</font><font color="#ff00cc">length</font><font color="#ff00cc">'</font>], <font color="#ff00cc">'</font><font color="#ff00cc">\t</font><font color="#ff00cc">'</font>, <font color="#9966ff">getAttr</font><font color="#000000"><strong>(</strong></font>item, <font color="#ff00cc">'</font><font color="#ff00cc">display</font><font color="#ff00cc">-</font><font color="#ff00cc">length</font><font color="#ff00cc">'</font><font color="#000000"><strong>)</strong></font>, <font color="#9966ff">getAttr</font><font color="#000000"><strong>(</strong></font>item, <font color="#ff00cc">'</font><font color="#ff00cc">picture</font><font color="#ff00cc">'</font><font color="#000000"><strong>)</strong></font>, <font color="#9966ff">getAttrId</font><font color="#000000"><strong>(</strong></font>item, <font color="#ff00cc">'</font><font color="#ff00cc">usage</font><font color="#ff00cc">'</font><font color="#000000"><strong>)</strong></font>, <font color="#9966ff">getAttrId</font><font color="#000000"><strong>(</strong></font>item, <font color="#ff00cc">'</font><font color="#ff00cc">numeric</font><font color="#ff00cc">'</font><font color="#000000"><strong>)</strong></font>, <font color="#9966ff">getAttrId</font><font color="#000000"><strong>(</strong></font>item, <font color="#ff00cc">'</font><font color="#ff00cc">signed</font><font color="#ff00cc">'</font><font color="#000000"><strong>)</strong></font> <span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">34 </font></span> <font color="#006699"><strong>for</strong></font> child <font color="#006699"><strong>in</strong></font> item.<font color="#9966ff">findall</font><font color="#000000"><strong>(</strong></font><font color="#ff00cc">'</font><font color="#ff00cc">item</font><font color="#ff00cc">'</font><font color="#000000"><strong>)</strong></font><font color="#006699"><strong>:</strong></font> <span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#990066">35 </font></span> <font color="#9966ff">printItem</font><font color="#000000"><strong>(</strong></font>indent <font color="#000000"><strong>+</strong></font> <font color="#ff00cc">"</font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc">"</font>, child<font color="#000000"><strong>)</strong></font> <span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">36 </font></span> <span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">37 </font></span><font color="#cc0000">#</font><font color="#cc0000">########################################################################</font> <span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">38 </font></span> <span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">39 </font></span>tree <font color="#000000"><strong>=</strong></font> ET.<font color="#9966ff">parse</font><font color="#000000"><strong>(</strong></font><font color="#ff00cc">'</font><font color="#ff00cc">cbl2xml_Test110</font><font color="#ff00cc">.</font><font color="#ff00cc">cbl</font><font color="#ff00cc">.</font><font color="#ff00cc">xml</font><font color="#ff00cc">'</font><font color="#000000"><strong>)</strong></font> <span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#990066">40 </font></span>root <font color="#000000"><strong>=</strong></font> tree.<font color="#9966ff">getroot</font><font color="#000000"><strong>(</strong></font><font color="#000000"><strong>)</strong></font> <span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">41 </font></span> <span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">42 </font></span><font color="#006699"><strong>print</strong></font> <font color="#ff00cc">"</font><font color="#ff00cc">></font><font color="#ff00cc">></font><font color="#ff00cc"> </font><font color="#ff00cc">"</font>, root.tag, root.attrib[<font color="#ff00cc">'</font><font color="#ff00cc">filename</font><font color="#ff00cc">'</font>] <span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">43 </font></span> <span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">44 </font></span><font color="#006699"><strong>for</strong></font> child <font color="#006699"><strong>in</strong></font> root.<font color="#9966ff">findall</font><font color="#000000"><strong>(</strong></font><font color="#ff00cc">'</font><font color="#ff00cc">item</font><font color="#ff00cc">'</font><font color="#000000"><strong>)</strong></font><font color="#006699"><strong>:</strong></font> <span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#990066">45 </font></span> <font color="#9966ff">printItem</font><font color="#000000"><strong>(</strong></font><font color="#ff00cc">"</font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc">"</font>, child<font color="#000000"><strong>)</strong></font> </font></pre> <h3>Groovy Example</h3> <p>The following code loads a Cobol-Copybook into Java classes and prints the data. It uses both the cb2xml.jar and cb2xml_Jaxb.jar.</p> <pre><font color="#000000"><span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 1 </font></span><font color="#6600cc">/**</font> <span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 2 </font></span><font color="#6600cc"> </font><font color="#6600cc">*</font><font color="#6600cc"> </font><font color="#6600cc">Need</font><font color="#6600cc"> </font><font color="#6600cc">to</font><font color="#6600cc"> </font><font color="#6600cc">add</font><font color="#6600cc"> </font><font color="#6600cc">.</font><font color="#6600cc">.</font><font color="#6600cc">/</font><font color="#6600cc">.</font><font color="#6600cc">.</font><font color="#6600cc">/</font><font color="#6600cc">lib</font><font color="#6600cc">/</font><font color="#6600cc">cb2xml</font><font color="#6600cc">.</font><font color="#6600cc">jar</font><font color="#6600cc"> </font><font color="#6600cc">&</font><font color="#6600cc"> </font><font color="#6600cc">.</font><font color="#6600cc">.</font><font color="#6600cc">/</font><font color="#6600cc">.</font><font color="#6600cc">.</font><font color="#6600cc">/</font><font color="#6600cc">lib</font><font color="#6600cc">/</font><font color="#6600cc">cb2xml_Jaxb</font><font color="#6600cc">.</font><font color="#6600cc">jar</font><font color="#6600cc"> </font><font color="#6600cc">to</font><font color="#6600cc"> </font><font color="#6600cc">the</font><font color="#6600cc"> </font><font color="#6600cc">classpath</font> <span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 3 </font></span><font color="#6600cc"> </font><font color="#6600cc">*</font><font color="#6600cc"> </font><font color="#6600cc">The</font><font color="#6600cc"> </font><font color="#6600cc">run</font><font color="#6600cc">.</font><font color="#6600cc">bat</font><font color="#6600cc">/</font><font color="#6600cc">sh</font><font color="#6600cc"> </font><font color="#6600cc">will</font><font color="#6600cc"> </font><font color="#6600cc">do</font><font color="#6600cc"> </font><font color="#6600cc">this</font> <span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 4 </font></span><font color="#6600cc"> </font><font color="#6600cc">*/</font> <span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#990066"> 5 </font></span><font color="#006699"><strong>import</strong></font> net.sf.cb2xml.jaxb.Copybook <span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 6 </font></span><font color="#006699"><strong>import</strong></font> net.sf.cb2xml.jaxb.Item <span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 7 </font></span><font color="#006699"><strong>import</strong></font> net.sf.cb2xml.parse.CobolParser <span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 8 </font></span> <span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 9 </font></span> <font color="#cc0000">//</font><font color="#cc0000"> </font><font color="#cc0000">Parsing</font><font color="#cc0000"> </font><font color="#cc0000">a</font><font color="#cc0000"> </font><font color="#cc0000">Cobol</font><font color="#cc0000"> </font><font color="#cc0000">copybook</font> <span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#990066"> 10 </font></span> <font color="#009966"><strong>def</strong></font> cpy <font color="#000000"><strong>=</strong></font> CobolParser.<font color="#9966ff">newParser</font><font color="#000000"><strong>(</strong></font><font color="#000000"><strong>)</strong></font>.<font color="#9966ff">parseCobol</font><font color="#000000"><strong>(</strong></font><font color="#ff00cc">"</font><font color="#ff00cc">cbl2xml_Test110</font><font color="#ff00cc">.</font><font color="#ff00cc">cbl</font><font color="#ff00cc">"</font><font color="#000000"><strong>)</strong></font> <span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 11 </font></span> <span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 12 </font></span> <font color="#cc0000">//</font><font color="#cc0000"> </font><font color="#cc0000">Now</font><font color="#cc0000"> </font><font color="#cc0000">lets</font><font color="#cc0000"> </font><font color="#cc0000">print</font><font color="#cc0000"> </font><font color="#cc0000">it</font> <span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 13 </font></span> <font color="#66ccff"><strong>print</strong></font><font color="#000000"><strong>(</strong></font><font color="#ff00cc">"</font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc">"</font>, cpy.<font color="#9966ff">getItem</font><font color="#000000"><strong>(</strong></font><font color="#000000"><strong>)</strong></font><font color="#000000"><strong>)</strong></font> <span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 14 </font></span> <span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#990066"> 15 </font></span><font color="#cc0000">//</font><font color="#cc0000"> </font><font color="#cc0000">Print</font><font color="#cc0000"> </font><font color="#cc0000">Cobol</font><font color="#cc0000"> </font><font color="#cc0000">item</font><font color="#cc0000"> </font><font color="#cc0000">(and</font><font color="#cc0000"> </font><font color="#cc0000">its</font><font color="#cc0000"> </font><font color="#cc0000">child</font><font color="#cc0000"> </font><font color="#cc0000">items</font> <span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 16 </font></span><font color="#009966"><strong>def</strong></font> <font color="#66ccff"><strong>print</strong></font><font color="#000000"><strong>(</strong></font>String indent, List<Item> items<font color="#000000"><strong>)</strong></font> { <span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 17 </font></span> <span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 18 </font></span> <font color="#006699"><strong>for</strong></font> <font color="#000000"><strong>(</strong></font>Item item : items<font color="#000000"><strong>)</strong></font> { <span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 19 </font></span> String s <font color="#000000"><strong>=</strong></font> indent <font color="#000000"><strong>+</strong></font> item.<font color="#9966ff">getName</font><font color="#000000"><strong>(</strong></font><font color="#000000"><strong>)</strong></font> <font color="#000000"><strong>+</strong></font> <font color="#ff00cc">"</font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc">"</font> <span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#990066"> 20 </font></span> s <font color="#000000"><strong>=</strong></font> s.<font color="#9966ff">substring</font><font color="#000000"><strong>(</strong></font><font color="#ff0000">0</font>, <font color="#ff0000">50</font><font color="#000000"><strong>)</strong></font> <span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 21 </font></span> <font color="#66ccff"><strong>println</strong></font> s <font color="#000000"><strong>+</strong></font> item.<font color="#9966ff">getPosition</font><font color="#000000"><strong>(</strong></font><font color="#000000"><strong>)</strong></font> <font color="#000000"><strong>+</strong></font> <font color="#ff00cc">"</font><font color="#ff00cc">\t</font><font color="#ff00cc">"</font> <font color="#000000"><strong>+</strong></font> item.<font color="#9966ff">getStorageLength</font><font color="#000000"><strong>(</strong></font><font color="#000000"><strong>)</strong></font> <font color="#000000"><strong>+</strong></font> <font color="#ff00cc">"</font><font color="#ff00cc">\t</font><font color="#ff00cc">"</font> <font color="#000000"><strong>+</strong></font> item.<font color="#9966ff">getDisplayLength</font><font color="#000000"><strong>(</strong></font><font color="#000000"><strong>)</strong></font> <font color="#000000"><strong>+</strong></font> <font color="#9966ff">cn</font><font color="#000000"><strong>(</strong></font>item.<font color="#9966ff">getPicture</font><font color="#000000"><strong>(</strong></font><font color="#000000"><strong>)</strong></font><font color="#000000"><strong>)</strong></font> <font color="#000000"><strong>+</strong></font> <font color="#9966ff">cn</font><font color="#000000"><strong>(</strong></font>item.<font color="#9966ff">getUsage</font><font color="#000000"><strong>(</strong></font><font color="#000000"><strong>)</strong></font><font color="#000000"><strong>)</strong></font> <font color="#000000"><strong>+</strong></font> <font color="#9966ff">cn</font><font color="#000000"><strong>(</strong></font>item.<font color="#9966ff">isNumeric</font><font color="#000000"><strong>(</strong></font><font color="#000000"><strong>)</strong></font><font color="#000000"><strong>)</strong></font> <font color="#000000"><strong>+</strong></font> <font color="#9966ff">cn</font><font color="#000000"><strong>(</strong></font>item.<font color="#9966ff">isSigned</font><font color="#000000"><strong>(</strong></font><font color="#000000"><strong>)</strong></font><font color="#000000"><strong>)</strong></font> <span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 22 </font></span> <span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 23 </font></span> <font color="#66ccff"><strong>print</strong></font><font color="#000000"><strong>(</strong></font>indent <font color="#000000"><strong>+</strong></font> <font color="#ff00cc">"</font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc">"</font>, item.<font color="#9966ff">getItem</font><font color="#000000"><strong>(</strong></font><font color="#000000"><strong>)</strong></font><font color="#000000"><strong>)</strong></font> <span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 24 </font></span> } <span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#990066"> 25 </font></span>} <span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 26 </font></span> <span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 27 </font></span><font color="#cc0000">//</font><font color="#cc0000"> </font><font color="#cc0000">add</font><font color="#cc0000"> </font><font color="#cc0000">tab</font><font color="#cc0000"> </font><font color="#cc0000">to</font><font color="#cc0000"> </font><font color="#cc0000">object</font><font color="#cc0000"> </font><font color="#cc0000">and</font><font color="#cc0000"> </font><font color="#cc0000">convert</font><font color="#cc0000"> </font><font color="#cc0000">to</font><font color="#cc0000"> </font><font color="#cc0000">""</font><font color="#cc0000"> </font><font color="#cc0000">if</font><font color="#cc0000"> </font><font color="#cc0000">null</font> <span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 28 </font></span><font color="#009966"><strong>def</strong></font> <font color="#9966ff">cn</font><font color="#000000"><strong>(</strong></font>obj<font color="#000000"><strong>)</strong></font> { <span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 29 </font></span> <font color="#006699"><strong>if</strong></font> <font color="#000000"><strong>(</strong></font>obj <font color="#000000"><strong>=</strong></font><font color="#000000"><strong>=</strong></font> <font color="#cc00cc">null</font><font color="#000000"><strong>)</strong></font> { <span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#990066"> 30 </font></span> <font color="#006699"><strong>return</strong></font> <font color="#ff00cc">"</font><font color="#ff00cc">\t</font><font color="#ff00cc">"</font> <span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 31 </font></span> } <span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 32 </font></span> <font color="#006699"><strong>return</strong></font> <font color="#ff00cc">"</font><font color="#ff00cc">\t</font><font color="#ff00cc">"</font> <font color="#000000"><strong>+</strong></font>obj <span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 33 </font></span>} </font></pre> </body>