DataTypes and Methods – vpgl.net

Class Tree

void — T — NIL
— Array
— String
— Number
— Dictionary — App
— ThreeD
— Scene3D
— Geometry3D
— Grid
— Tile

The actual root class of the VPGL language is T. All other system defined classes are direct children (subclass) of T. It means:

  1. All methods defined in the class T is available on the other class instance.
  2. Some methods are overrides on sub-classes of T.
  3. Sub-classes of T have their own methods.

System Defined Classes

void class

void class has only one instance which literal representation is void. The basic meaning of void is “void” — useless, meaningless, uninitialized, error, etc.

void does not know anything for all methods except for IsVoid by default. This is the only reason that void is the top of the class tree of VPGL.
WARNING — Extending (adding methods on) void may cause unexpected result.

T class

T class has only one instance which literal representation is T. The basic meaning of T is the logical true. All “predicate” operator which emits only TRUE or FALSE, will emit T as logical TRUE.

T has many system defined methods as system root class. See methods section.

NIL class

NIL class has only one instance which literal representation is NIL.

NIL is one of special Symbol in VPGL language. NIL has several means as follows;

  • empty or filler entry,
  • logical FALSE,
  • “null”

All “predicate” operator which emits only TRUE or FALSE, will emit NIL as logical FALSE. SWITCH operator checks its input for switch condition whether it is NIL or not.

Array Class

Array is sequence of any data object in VPGL. Array literal representation is sequence of data literal separated by blank/space and bracketted by “[” and “]”. For example:

[1 23 456]
[ NIL NIL T]
[“String Literal – see below” 4.22 NIL]

Array can have Array as its element.
[ NIL [ 1 2 3 [ 4 5] 6]]

Empty Array is represented as:
[ ]

String class

VPGL can handle string object. String object is arbitrary sequence of characters expected for double quote, which is enclosed by ” (double quotation). For example;

“HELLO WORLD”, “May-10-2019”, “a”, “String”, “Three words string”, “Post-fix-notation”, “It includes \” character”.

If you wants to include double quote character in your string, Double quote ” must be escaped by \ (Back Slash) for each appearance shown as the last example above.

Number class

VPGL can flow numeric data token in diagrams. VPGL number object can represent integer and real number such as;

0, 1, -234, -56.789, 3.1415926535

Number object is NOT ACCEPTABLE in Floating point notation such as;

-1.602E-19

Minimum value and maximum value of number object depend on JavaScript specification.

Number object is a primitive object, not “composite” object. So their actual instances flow in diagrams, and FLOW operator duplicate their instance, not reference.

Dictionary class

Dictionary is a collection of key-value pair. Theses key must be unique – there is only one pair for each key. Key is a String or Number object. Values of dictionary are objects that VPGL is acceptable.

Dictiionary has literal form – string representation – as
{ key0 value0 key1 value1 key2 value2 … }.

Example:
{ }- empty dictionary
{ “Apple” “red” “Lemon” “yellow” }
{ “Apple” “red” “Lemon” “yellow” “Apple” “green” } is same as {“Apple” “green” “Lemon” “yellow”} which is set to the value as green associated by Apple, red is overridden by later appearance.

App class

App class is a sub-class of dictinary class, which is assumed to have a method Mainline.

VPGL executor starts execution with make a new instance of this class and invoke Mainline method against it. Users build thier own application by making thier own Mainline method and extending – adding other methods as they need.

TheeD class

ThreeD class represents the 3D Modeling world which VPGL executor has. This class has only one instance provided by 3D method.

Scene3D class

The VPGL 3D World is able to have arbitrary number of “Scene”. Instaces of this class represents each scenes of 3D World.

Geometry3D class

This class represents the object in scenes – cube, ball, ring, text… . Instances of this class represents each object in scenes. All objects belong to one scene.

3D—+–Scene–+–Geometry
| +–Geometry
| …
+–Scene–+–Geometry
| …

Grid class

Instances of Grid represet each method diagram. This class feature makes you to create methods/edit methods in your program dynamically. The usage of this class will be shown in future example.

Tile class

Tile is a content of each grid spots which has opname, option, information of input directions, and information of output directions. This class feature makes you to add new oprations/edit operations in exsiting grid dynamically. The usage of this class will be shown in future example.

User Defined class

VPGL can use user-defined classes. They have literal form as

< “ClassName” { key0 value0 key1 value 1 … } >

The first element of “<>”-bracketed sequence is a String object which represents this user defined class name. The second one is a dictionary object what this user defined object initially has.
This dictionary element can be omitted, if it starts with empty.

Example :
< “FooClass” >
< “FooClass” {“A” 1 “B” “XYZ”} >
< “Primes” { Lst [2] Rv NIL } >

Methods

Followning list has all predefinded methods in VPGL. Desctiptions of them are in linked page each. (If method name is link, you can see its description to linked page, otherwise, its description is under construction)

FLOW – Changing Direction, braching and merging of data-flows.

NOT – Logical complemet of input.

CONST – Make Constant Data and flow it into data-flow diagrams.

ALRT – Display input data on pop-up dialog.

OPTION – Get currnet value specified by option field.

== – Check both 2 inputs are same or not.

RANDOM – Get a random number.

ARRAY2 – Compose a array consists of 2 inputs.

ARRAY3 – Compose a array consists of 3 inputs.

LENGTH – Count the number of items in the target array.

INPUT – Taking an input from user.

END – Discarding input.

STOP – Terminate this program immediately.

SWITCH – Conditional branching. (if-then-else in VPGL)

JOIN – Waiting for another data-token arrival.

PAUSE – Waiting specified time.

3D – Get the handle of the 3D world of VPGL.

DUP – Copying this composite object.

PUSH – Append an element at the top.

HEAD – Get the first element.

GET – Get the specified element.

PUT – Put an element.

MEMBER – Check whether array has it or not.

EMPTY? – Check empty or not.

REST – Remove the first element.

N+1 – Increment.

N-1 – Decrement.

ABS – Get the absolute value.

ROUND – Get the nearest integer.

SIN – sin(x)

COS – cos(x)

A+B – Adding.

A-B – Subtracting.

A*B – Multiplying

A/B – Dividing

A%B – Modulo. Get Remainder.

GT – A>B

GE – A>=B

RESET – Reset the 3DWorld

SCENE – Get the specified SCENE object.

GEO – Get the specified Geometry object.

SETSCN – Set What scene to view.

SET – Set atributes for the target geometry.

UPDATE – Render the 3D view.

ATTACH – Register event handler.

CAM – Get Camera object of 3D World.

LOOK – Prove 3D object.