Design Patterns: Elements of Reusable Object-Oriented Software (ISBN 0-201-63361-2) โดย Erich Gamma, Richard Helm, Ralph Johnson และ John Vlissides (Gang of four: GoF)
แหล่งข้อมูลอื่น
Interpreter โดย Vince Huston (อังกฤษ)
สิงหาคม 08, 2021
นเทอร, พร, เตอร, แพตเท, interpreter, pattern, เป, นด, ไซน, แพตเท, ใช, ในกรณ, ขอบเขตของป, ญหาสามารถถ, กอธ, บายในล, กษณะท, เป, นภาษาและกฎท, แน, นอนตายต, เราสามารถสร, างคลาสท, เป, นต, วแทนขององค, ประกอบของภาษา, ดเร, ยงเข, าด, วยก, นเพ, ออธ, บายป, ญหาหน, งๆ, และแป. xinethxrphrietxraephtethirn Interpreter pattern epndiisnaephtethirn thiichinkrnithikhxbekhtkhxngpyhasamarththukxthibayinlksnathiepnphasaaelakdthiaennxntaytw erasamarthsrangkhlasthiepntwaethnkhxngxngkhprakxbkhxngphasa cderiyngekhadwyknephuxxthibaypyhahnung aelaaeplhruxpraeminphlodyichokhrngsrangthiidcderiyngiwnn twxyangechnsutrkhnitsastrtang hruxyktwxyangihechphaaecaacngechn sutrerkhakhnitsahrbhaphunthirupsamehliymphunthirupsamehliym 1 2 khwamyawthan khwamsung enuxha 1 karnaipichngan 2 twxyangopraekrm 2 1 phasacawa 3 xangxing 4 aehlngkhxmulxunkarnaipichngan aekikhcakkarthipyhaswnihyemuxthukxthibayinaebbthiepnniyamphasacamilksnathiepn recursive khuxpyhaihy cathukaekidodykaraebngaeykepnpyhayxy aelaaekpyhayxy lngiptamladb cninthisudthungpyhathiimcaepntxngaebngyxyxik thaihxngkhprakxbkhxngxinethxrphrietxraephtethirnmilksnaediywkbkhxmophsitaephtethirnxngkhprakxbkhxngxinethxrphrietxraephtethirnmidngni xinetxrefshruxkhlasaebbaexbsaetrkhepnaemaebbthiniyamphvtikrrmthiaetlaxxbecktkhxngxinethxrphrietxrtxngmi khlasthisamarthmixngkhprakxbxunkhxngxinethxrphrietxrid khlasthiepnswnplay imsamarthmixngkhprakxbxunid khlassahrbepnbribth context hruxxngkhprakxbthiichinkarpraeminphl UML khlasidxaaekrmkhxngxinethxrphrietxraephtethirntwxyangopraekrm aekikhphasacawa aekikh twxyangopraekrmephuxkhanwnhaphunthirupsamehliymodysutr phunthirupsamehliym 1 2 khwamyawthan khwamsungxinetxrefs Expression epnaemaebbkhxngswnprakxbtang khxngkhxmophsit niyamemthxd evaluate ephuxihaetlaxngkhprakxbpraeminphlinswnkhxngtwexngaelaxngkhprakxbyxythixyuphayit inthinieraich HashMap epn context ephuxsngphankhakhwaepripihkhlaschnid Variable ichinkarpraeminphl import java util HashMap public interface Expression public double evaluate HashMap lt String Double gt context throws Exception khlas Multiplication epriybesmuxnekhruxnghmaykhun samarthmixngkhprakxbyxyidsxngtwkhuxtwkhunkhangsayaelatwkhunkhangkhwa import java util HashMap public class Multiplication implements Expression private final Expression operand1 private final Expression operand2 public Multiplication Expression operand1 Expression operand2 this operand1 operand1 this operand2 operand2 public double evaluate HashMap lt String Double gt context throws Exception return operand1 evaluate context operand2 evaluate context khlas Division epriybesmuxnekhruxnghmayhar samarthmixngkhprakxbyxyidsxngtwkhuxtwthukharaelatwhar import java util HashMap public class Division implements Expression private final Expression operand1 private final Expression operand2 public Division Expression operand1 Expression operand2 this operand1 operand1 this operand2 operand2 public double evaluate HashMap lt String Double gt context throws Exception return operand1 evaluate context operand2 evaluate context khlas Constant epriybesmuxnkhakhngthiinsmkar immixngkhprakxbyxy import java util HashMap public class Constant implements Expression private final double value public Constant double value this value value public double evaluate HashMap lt String Double gt context return value khlas Variable epriybesmuxntwaeprinsmkar mihnathihakhakhxngtnexngcak context immixngkhprakxbyxy import java util HashMap public class Variable implements Expression private final String name public Variable String name this name name public double evaluate HashMap lt String Double gt context throws Exception Double value context get name if value null throw new Exception Unbound variable name return value kareriykichngan HashMap lt String Double gt context new HashMap lt String Double gt context put base 10 0 context put height 5 0 Expression two new Constant 2 Expression base new Variable base Expression height new Variable height Expression multi new Multiplication base height Expression triangleArea new Division multi two double result triangleArea evaluate context xangxing aekikhDesign Patterns Elements of Reusable Object Oriented Software ISBN 0 201 63361 2 ody Erich Gamma Richard Helm Ralph Johnson aela John Vlissides Gang of four GoF aehlngkhxmulxun aekikhInterpreter ody Vince Huston xngkvs ekhathungcak https th wikipedia org w index php title xinethxrphrietxraephtethirn amp oldid 9350085, wikipedia, วิกิ หนังสือ, หนังสือ, ห้องสมุด,