Hi, if you&#39;re only interested in converting the Java code to Smalltalk, I would simple take one class at a time. &nbsp;For example, using the Glass class:<div><br class="webkit-block-placeholder"></div><div>Object subclass: #Glass
</div><div>&nbsp;&nbsp; &nbsp; instanceVariableNames: &#39;&#39;</div><div>&nbsp;&nbsp; &nbsp; classVariableNames: &#39;&#39;</div><div>&nbsp;&nbsp; &nbsp; poolDictionaries: &#39;&#39;</div><div>&nbsp;&nbsp; &nbsp; category: &nbsp;&#39;Adapter-Example&#39;</div><div><br>&nbsp;</div><div>instance methods &#39;
<i>initialize-release&#39;</i></div><div><br class="webkit-block-placeholder"></div><div>initialize</div><div>&nbsp;&nbsp; content := 0.0</div><div><br class="webkit-block-placeholder"></div><div>instance methods &#39;<i>accessing</i>
<i>&#39; protocol</i></div><div><br class="webkit-block-placeholder"></div><div>content: &nbsp;anObject</div><div>&nbsp;&nbsp; content := anObject</div><div><br class="webkit-block-placeholder"></div><div>class methods &#39;<i>class initialization&#39; protocol
</i></div><div><i><br class="webkit-block-placeholder"></i></div><div><i>new</i></div><div><i>&nbsp;&nbsp;^super new initialize</i></div><div><i><br class="webkit-block-placeholder"></i></div><div>Good luck,</div><div><br class="webkit-block-placeholder">
</div><div>-Conrad</div><div><br>&nbsp;</div><div><div><span class="gmail_quote">On 8/29/07, <b class="gmail_sendername">KingNothing</b> &lt;<a href="mailto:petpa0l0@hotmail.com">petpa0l0@hotmail.com</a>&gt; wrote:</span><blockquote class="gmail_quote" style="margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>Hi, i&#39;m new to this forum and to smalltalk.<br>I&#39;ve got to implement now the Adapeter Pattern in SmallTalk.<br>I&#39;ve got an example in Java that i must translate in SmallTalk.<br>Here there are the Java Classes :
<br><br>------------------------------------------<br>public class Glass<br>{<br>&nbsp;&nbsp; /**<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;in 12th of pint<br>&nbsp;&nbsp; */<br>&nbsp;&nbsp; float content;<br><br>&nbsp;&nbsp; public Glass()<br>&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;content=0;<br>&nbsp;&nbsp; }<br><br>&nbsp;&nbsp; /**<br>
&nbsp;&nbsp; */<br>&nbsp;&nbsp; public void fill(float filling)<br>&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;content=filling;<br>&nbsp;&nbsp; }<br><br>&nbsp;&nbsp; public String toString()<br>&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; super.toString()+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;, level (12th of pint)=&quot;+content;
<br>&nbsp;&nbsp; }<br>}<br>-------------------------------<br><br>public class Keg<br>{<br>&nbsp;&nbsp; /**<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;content, in 12th of pint units<br>&nbsp;&nbsp; */<br>&nbsp;&nbsp; float filled;<br><br>&nbsp;&nbsp; /**<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;absolute level, in pints<br>&nbsp;&nbsp; */<br>&nbsp;&nbsp; public float getLevel()
<br>&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return filled/12;<br>&nbsp;&nbsp; }<br><br>&nbsp;&nbsp; float original;<br>&nbsp;&nbsp; /**<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;in pints<br>&nbsp;&nbsp; */<br>&nbsp;&nbsp; public float getCapacity()<br>&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return original/12;<br>&nbsp;&nbsp; }<br><br><br>&nbsp;&nbsp; /**<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Keg filled with total gallons of beer
<br>&nbsp;&nbsp; */<br>&nbsp;&nbsp; public Keg(float total)<br>&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;filled=total*8*12;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;original=filled;<br>&nbsp;&nbsp; }<br><br>&nbsp;&nbsp; /**<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;creates a Glass filled with<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;quantity/12 pints of beer<br>&nbsp;&nbsp; */<br>&nbsp;&nbsp; public Glass draw(float quantity)
<br>&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Glass g=new Glass();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;g.fill(quantity);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;filled-=quantity;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return g;<br>&nbsp;&nbsp; }<br><br>&nbsp;&nbsp; /**<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;% level<br>&nbsp;&nbsp; */<br>&nbsp;&nbsp; public float getPLevel()<br>&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return (100*filled)/original;
<br>&nbsp;&nbsp; }<br><br>&nbsp;&nbsp; public String toString()<br>&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; super.toString()+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;, level (%)=&quot;+getPLevel()+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;, level (pints)=&quot;+getLevel();<br>&nbsp;&nbsp; }<br>}<br>------------------------------
---<br><br>public class Fusto<br>{<br>&nbsp;&nbsp; /**<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;rapporto LITRO/PINTA<br>&nbsp;&nbsp; */<br>&nbsp;&nbsp; public final static float LITRO_PINTA=2.1133f;<br><br>&nbsp;&nbsp; Keg keg;<br>&nbsp;&nbsp; public Fusto(Keg k)<br>&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;keg=k;<br>&nbsp;&nbsp; }<br><br>
&nbsp;&nbsp; /**<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;crea un Glass riempito con<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;quant/10 litri di birra<br>&nbsp;&nbsp; */<br>&nbsp;&nbsp; public Glass spilla(float quant)<br>&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return keg.draw(quant*LITRO_PINTA*12/10);<br>&nbsp;&nbsp; }<br><br>&nbsp;&nbsp; /**<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;in litri, NON in percentuale!!!
<br>&nbsp;&nbsp; */<br>&nbsp;&nbsp; public float fornisciLivello()<br>&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return keg.getLevel()/LITRO_PINTA;<br>&nbsp;&nbsp; }<br><br>&nbsp;&nbsp; /**<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;in percentuale<br>&nbsp;&nbsp; */<br>&nbsp;&nbsp; public float fornisciPLivello()<br>&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return keg.getPLevel
();<br>&nbsp;&nbsp; }<br><br>&nbsp;&nbsp; public String toString()<br>&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; super.toString()+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;, livello (%)=&quot;+fornisciPLivello()+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;, livello (litri)=&quot;+fornisciLivello();
<br>&nbsp;&nbsp; }<br>}<br>-------------------------------------<br><br>Can someone give me some hints to translate java code into SmallTalk ?<br>Thanks in advance.<br><br>--<br>View this message in context: <a href="http://www.nabble.com/Adapter">
http://www.nabble.com/Adapter</a>-Pattern-in-SmallTalk-tf4347089.html#a12384904<br>Sent from the Squeak - Beginners mailing list archive at <a href="http://Nabble.com">Nabble.com</a>.<br><br>______________________________
_________________<br>Beginners mailing list<br><a href="mailto:Beginners@lists.squeakfoundati">Beginners@lists.squeakfoundati</a><a href="http://on.org">on.org</a><br><a href="http://lists.squeakfoundation">http://lists.squeakfoundation
</a>.org/mailman/listinfo/beginners<br></blockquote></div><br></div>