-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
1,305 additions
and
1,398 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
Building POOI | ||
============= | ||
|
||
**Pooi** was written using *IntelliJ IDEA*. The preferred method for building | ||
the system is therefore using the IDE. | ||
Building POOI | ||
============= | ||
|
||
**Pooi** was written using *IntelliJ IDEA*. The preferred method for building | ||
the system is therefore using the IDE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
> (anObject copy) rename "TraitsComplex" | ||
> (anObject copy) rename "Complex" | ||
> Complex.real = 0.0 | ||
> Complex.img = 0.0 | ||
> Complex.parent = TraitsComplex | ||
> TraitsComplex.str = {: (((self.real str) + " + ") + (self.img str)) + "i" } | ||
> TraitsComplex.isReal = {: self.img == 0.0 } | ||
> TraitsComplex.add = {c: self.real = (self.real + c.real); self.img = (self.img + c.img) } | ||
> TraitsComplex.sub = {c: self.real = (self.real - c.real); self.img = (self.img - c.img) } | ||
> TraitsComplex.mul = {c: self.real = ((self.real * c.real) - (self.img * c.img)); self.img = ((self.img * c.real) + (self.real * c.img)) } | ||
> (anObject copy) rename "TraitsComplex" | ||
> (anObject copy) rename "Complex" | ||
> Complex.real = 0.0 | ||
> Complex.img = 0.0 | ||
> Complex.parent = TraitsComplex | ||
> TraitsComplex.str = {: (((self.real str) + " + ") + (self.img str)) + "i" } | ||
> TraitsComplex.isReal = {: self.img == 0.0 } | ||
> TraitsComplex.add = {c: self.real = (self.real + c.real); self.img = (self.img + c.img) } | ||
> TraitsComplex.sub = {c: self.real = (self.real - c.real); self.img = (self.img - c.img) } | ||
> TraitsComplex.mul = {c: self.real = ((self.real * c.real) - (self.img * c.img)); self.img = ((self.img * c.real) + (self.real * c.img)) } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,65 +1,65 @@ | ||
Pooi [Prototype-based, object-oriented interpreter] | ||
|
||
type in your message | ||
try "Root list", "help" or "about" to start | ||
|
||
|
||
> (anObject copy) rename "Point" | ||
anObject was copied into Root as 'Root.anObject1' | ||
Root.anObject1 renamed to Root.Point | ||
|
||
|
||
> (anObject copy) rename "TraitsPoint" | ||
anObject was copied into Root as 'Root.anObject2' | ||
Root.anObject2 renamed to Root.TraitsPoint | ||
|
||
|
||
> Point.x = 0 | ||
'x' set in Root.Point | ||
|
||
|
||
> Point.y = 0 | ||
'y' set in Root.Point | ||
|
||
|
||
> (anObject copy) rename "Persona" | ||
anObject was copied into Root as 'Root.anObject3' | ||
Root.anObject3 renamed to Root.Persona | ||
|
||
|
||
> Point.parent = TraitsPoint | ||
'parent' set in Root.Point | ||
|
||
|
||
> Persona.edad = 42 | ||
'edad' set in Root.Persona | ||
|
||
|
||
> persona.nombre = "Baltasar Garc�a Perez-Schofield" | ||
Error: Attribute not found: 'persona' in 'Root' | ||
|
||
> Persona.nombre = "Baltasar Garc�a Perez-Schofield" | ||
'nombre' set in Root.Persona | ||
|
||
|
||
> (anObject copy) rename "TraitsPersona" | ||
anObject was copied into Root as 'Root.anObject4' | ||
Root.anObject4 renamed to Root.TraitsPersona | ||
|
||
|
||
> Persona.parent = TraitsPersona | ||
'parent' set in Root.Persona | ||
|
||
|
||
> TraitsPoint.shift = {d: self.x = (self.x + d); self.y = (self.y + d)} | ||
'shift' set in Root.TraitsPoint | ||
|
||
|
||
> Point shift 5 | ||
Root.Point.x and Root.bin.lit16 added, giving 5 | ||
'x' set in Root.Point | ||
Root.Point.y and Root.bin.lit19 added, giving 5 | ||
'y' set in Root.Point | ||
|
||
|
||
|
||
Pooi [Prototype-based, object-oriented interpreter] | ||
type in your message | ||
try "Root list", "help" or "about" to start | ||
> (anObject copy) rename "Point" | ||
anObject was copied into Root as 'Root.anObject1' | ||
Root.anObject1 renamed to Root.Point | ||
> (anObject copy) rename "TraitsPoint" | ||
anObject was copied into Root as 'Root.anObject2' | ||
Root.anObject2 renamed to Root.TraitsPoint | ||
> Point.x = 0 | ||
'x' set in Root.Point | ||
> Point.y = 0 | ||
'y' set in Root.Point | ||
> (anObject copy) rename "Persona" | ||
anObject was copied into Root as 'Root.anObject3' | ||
Root.anObject3 renamed to Root.Persona | ||
> Point.parent = TraitsPoint | ||
'parent' set in Root.Point | ||
> Persona.edad = 42 | ||
'edad' set in Root.Persona | ||
> persona.nombre = "Baltasar Garc�a Perez-Schofield" | ||
Error: Attribute not found: 'persona' in 'Root' | ||
> Persona.nombre = "Baltasar Garc�a Perez-Schofield" | ||
'nombre' set in Root.Persona | ||
> (anObject copy) rename "TraitsPersona" | ||
anObject was copied into Root as 'Root.anObject4' | ||
Root.anObject4 renamed to Root.TraitsPersona | ||
> Persona.parent = TraitsPersona | ||
'parent' set in Root.Persona | ||
> TraitsPoint.shift = {d: self.x = (self.x + d); self.y = (self.y + d)} | ||
'shift' set in Root.TraitsPoint | ||
> Point shift 5 | ||
Root.Point.x and Root.bin.lit16 added, giving 5 | ||
'x' set in Root.Point | ||
Root.Point.y and Root.bin.lit19 added, giving 5 | ||
'y' set in Root.Point | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
> (anObject copy) rename "Math" | ||
> Math.PI = 3.1416 | ||
> Math.sqr = {x: x * x } | ||
> Math.sqrt = {x: x * x } | ||
> | ||
> (anObject copy) rename "Math" | ||
> Math.PI = 3.1416 | ||
> Math.sqr = {x: x * x } | ||
> Math.sqrt = {x: x * x } | ||
> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
> (anObject copy) rename "Pair" | ||
> Pair.first = anObject | ||
> Pair.second = anObject | ||
> (anObject copy) rename "Pair" | ||
> Pair.first = anObject | ||
> Pair.second = anObject |
72 changes: 36 additions & 36 deletions
72
src/com/devbaltasarq/pooi/core/evaluables/methods/nativemethods/NativeMethodOsExit.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,36 @@ | ||
package com.devbaltasarq.pooi.core.evaluables.methods.nativemethods; | ||
|
||
import com.devbaltasarq.pooi.core.Evaluable; | ||
import com.devbaltasarq.pooi.core.ObjectBag; | ||
import com.devbaltasarq.pooi.core.Runtime; | ||
import com.devbaltasarq.pooi.core.evaluables.methods.NativeMethod; | ||
import com.devbaltasarq.pooi.core.Interpreter.InterpretError; | ||
|
||
/** | ||
* A method that extracts the time and stores it in a DateTime object. | ||
* Created by Baltasar on 30/01/2016. | ||
*/ | ||
public class NativeMethodOsExit extends NativeMethod { | ||
public static final String EtqMthOsExit = "exit"; | ||
|
||
public NativeMethodOsExit(Runtime rt) { | ||
super( rt, EtqMthOsExit ); | ||
} | ||
|
||
@Override | ||
public ObjectBag doIt(ObjectBag ref, Evaluable[] params, StringBuilder msg) | ||
throws InterpretError | ||
{ | ||
System.exit( 0 ); | ||
return null; | ||
} | ||
|
||
public int getNumParams() { | ||
return 0; | ||
} | ||
|
||
@Override | ||
public String[] getFormalParameters() { | ||
return new String[ 0 ]; | ||
} | ||
} | ||
package com.devbaltasarq.pooi.core.evaluables.methods.nativemethods; | ||
|
||
import com.devbaltasarq.pooi.core.Evaluable; | ||
import com.devbaltasarq.pooi.core.ObjectBag; | ||
import com.devbaltasarq.pooi.core.Runtime; | ||
import com.devbaltasarq.pooi.core.evaluables.methods.NativeMethod; | ||
import com.devbaltasarq.pooi.core.Interpreter.InterpretError; | ||
|
||
/** | ||
* A method that extracts the time and stores it in a DateTime object. | ||
* Created by Baltasar on 30/01/2016. | ||
*/ | ||
public class NativeMethodOsExit extends NativeMethod { | ||
public static final String EtqMthOsExit = "exit"; | ||
|
||
public NativeMethodOsExit(Runtime rt) { | ||
super( rt, EtqMthOsExit ); | ||
} | ||
|
||
@Override | ||
public ObjectBag doIt(ObjectBag ref, Evaluable[] params, StringBuilder msg) | ||
throws InterpretError | ||
{ | ||
System.exit( 0 ); | ||
return null; | ||
} | ||
|
||
public int getNumParams() { | ||
return 0; | ||
} | ||
|
||
@Override | ||
public String[] getFormalParameters() { | ||
return new String[ 0 ]; | ||
} | ||
} |
108 changes: 54 additions & 54 deletions
108
src/com/devbaltasarq/pooi/core/evaluables/methods/nativemethods/NativeMethodOsNow.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,54 @@ | ||
package com.devbaltasarq.pooi.core.evaluables.methods.nativemethods; | ||
|
||
import com.devbaltasarq.pooi.core.Evaluable; | ||
import com.devbaltasarq.pooi.core.ObjectBag; | ||
import com.devbaltasarq.pooi.core.Runtime; | ||
import com.devbaltasarq.pooi.core.evaluables.methods.NativeMethod; | ||
import com.devbaltasarq.pooi.core.Interpreter.InterpretError; | ||
import com.devbaltasarq.pooi.core.objs.ObjectDateTime; | ||
|
||
import java.util.Calendar; | ||
|
||
/** | ||
* A method that extracts the time and stores it in a DateTime object. | ||
* Created by Baltasar on 30/01/2016. | ||
*/ | ||
public class NativeMethodOsNow extends NativeMethod { | ||
public static final String EtqMthOsNow = "now"; | ||
|
||
public NativeMethodOsNow(Runtime rt) { | ||
super( rt, EtqMthOsNow ); | ||
} | ||
|
||
@Override | ||
public ObjectBag doIt(ObjectBag ref, Evaluable[] params, StringBuilder msg) | ||
throws InterpretError | ||
{ | ||
final Calendar now = Calendar.getInstance(); | ||
final Runtime rt = this.getRuntime(); | ||
|
||
chkParametersNumber( 0, params ); | ||
|
||
// Create date-time object | ||
final ObjectDateTime toret = rt.createDateTime( | ||
now.get( Calendar.DAY_OF_MONTH ), | ||
now.get( Calendar.MONTH ) + 1, | ||
now.get( Calendar.YEAR ), | ||
now.get( Calendar.HOUR ), | ||
now.get( Calendar.MINUTE ), | ||
now.get( Calendar.SECOND ) | ||
); | ||
|
||
msg.append( "Obtained current date and time" ); | ||
return toret; | ||
} | ||
|
||
public int getNumParams() { | ||
return 0; | ||
} | ||
|
||
@Override | ||
public String[] getFormalParameters() { | ||
return new String[ 0 ]; | ||
} | ||
} | ||
package com.devbaltasarq.pooi.core.evaluables.methods.nativemethods; | ||
|
||
import com.devbaltasarq.pooi.core.Evaluable; | ||
import com.devbaltasarq.pooi.core.ObjectBag; | ||
import com.devbaltasarq.pooi.core.Runtime; | ||
import com.devbaltasarq.pooi.core.evaluables.methods.NativeMethod; | ||
import com.devbaltasarq.pooi.core.Interpreter.InterpretError; | ||
import com.devbaltasarq.pooi.core.objs.ObjectDateTime; | ||
|
||
import java.util.Calendar; | ||
|
||
/** | ||
* A method that extracts the time and stores it in a DateTime object. | ||
* Created by Baltasar on 30/01/2016. | ||
*/ | ||
public class NativeMethodOsNow extends NativeMethod { | ||
public static final String EtqMthOsNow = "now"; | ||
|
||
public NativeMethodOsNow(Runtime rt) { | ||
super( rt, EtqMthOsNow ); | ||
} | ||
|
||
@Override | ||
public ObjectBag doIt(ObjectBag ref, Evaluable[] params, StringBuilder msg) | ||
throws InterpretError | ||
{ | ||
final Calendar now = Calendar.getInstance(); | ||
final Runtime rt = this.getRuntime(); | ||
|
||
chkParametersNumber( 0, params ); | ||
|
||
// Create date-time object | ||
final ObjectDateTime toret = rt.createDateTime( | ||
now.get( Calendar.DAY_OF_MONTH ), | ||
now.get( Calendar.MONTH ) + 1, | ||
now.get( Calendar.YEAR ), | ||
now.get( Calendar.HOUR ), | ||
now.get( Calendar.MINUTE ), | ||
now.get( Calendar.SECOND ) | ||
); | ||
|
||
msg.append( "Obtained current date and time" ); | ||
return toret; | ||
} | ||
|
||
public int getNumParams() { | ||
return 0; | ||
} | ||
|
||
@Override | ||
public String[] getFormalParameters() { | ||
return new String[ 0 ]; | ||
} | ||
} |
Oops, something went wrong.