Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "VJET/Semantic Comparison - Java and vjojs"

 
(31 intermediate revisions by the same user not shown)
Line 1: Line 1:
Documentation for VJET JavaScript IDE is available in 2 forms:
+
The following tables summarize the semantic similarities between Java and VjO.
* [[#Wiki Documents]] <nowiki>-</nowiki> Informational and referential documentation; located on the VJET open source site.
+
* [[VJET:Overview#CheatSheets|Eclipse Cheat Sheets, Samples, and Help]] <nowiki>-</nowiki> Tutorial and task related topics available in Eclipse
+
  
Since VJET JavaScript IDE is an Eclipse plugin, most of the documentation will be in Eclipse.&nbsp; With Eclipse Cheat Sheets, you can view documentation, step through tutorials, and code at the same time.
+
{| style="background-color:#F9F9F9;border:1px solid #AAAAAA;border-collapse:collapse;color:black; margin:1em 0;"
 +
|-
 +
! style="background-color:#F2F2F2;text-align:center;border:1px solid #AAAAAA;padding:0.2em;" | Semantic
 +
! style="background-color:#F2F2F2;text-align:center;border:1px solid #AAAAAA;padding:0.2em;" | Java
 +
! style="background-color:#F2F2F2;text-align:center;border:1px solid #AAAAAA;padding:0.2em;" | VJET VJO
 +
|-
 +
| style="border:1px solid #AAAAAA;padding: 0.2em;" | Declare a Namespace
 +
| style="border:1px solid #AAAAAA;padding: 0.2em;" | package vjo.x.y
 +
| style="border:1px solid #AAAAAA;padding: 0.2em;" | <source lang="javascript">
 +
vjo.ctype("vjo.x.y.Z") // where Z is the name of a class.
 +
</source>
 +
 +
|-
 +
| style="border:1px solid #AAAAAA;padding: 0.2em;" | Import a Class
 +
| style="border:1px solid #AAAAAA;padding: 0.2em;" | import vjo.utils.X 
 +
| style="border:1px solid #AAAAAA;padding: 0.2em;" | <source lang="javascript">
 +
.needs("vjo.utils.X")
 +
</source>
 +
|}
  
 +
=== Type Definitions and Manipulation ===
  
 +
{| style="background-color:#F9F9F9;border:1px solid #AAAAAA;border-collapse:collapse;color:black; margin:1em 0;"
 +
|-
 +
! style="background-color:#F2F2F2;text-align:center;border:1px solid #AAAAAA;padding:0.2em;" | Semantic
 +
! style="background-color:#F2F2F2;text-align:center;border:1px solid #AAAAAA;padding:0.2em;" | Java
 +
! style="background-color:#F2F2F2;text-align:center;border:1px solid #AAAAAA;padding:0.2em;" | VJET VJO
 +
|-
 +
| style="border:1px solid #AAAAAA;padding: 0.2em;" | Define a Class
 +
| style="border:1px solid #AAAAAA;padding: 0.2em;" | <source lang="javascript">class X{}</source>
 +
| style="border:1px solid #AAAAAA;padding: 0.2em;" | <source lang="javascript">
 +
vjo.ctype("<namespace>.X")
 +
</source>
 +
 +
|-
 +
| style="border:1px solid #AAAAAA;padding: 0.2em;" | Define an Interface
 +
| style="border:1px solid #AAAAAA;padding: 0.2em;" | <source lang="javascript">interface Y{}</source> 
 +
| style="border:1px solid #AAAAAA;padding: 0.2em;" | <source lang="javascript">
 +
vjo.itype("<namespace>.Y")
 +
</source>
  
 +
|-
 +
| style="border:1px solid #AAAAAA;padding: 0.2em;" | Define an Enum
 +
| style="border:1px solid #AAAAAA;padding: 0.2em;" | <source lang="javascript">enum E{}</source> 
 +
| style="border:1px solid #AAAAAA;padding: 0.2em;" | <source lang="javascript">
 +
vjo.etype("<namespace>.E")
 +
</source>
  
== Wiki Documents ==
+
|-
 +
| style="border:1px solid #AAAAAA;padding: 0.2em;" | Define an Abstract Class
 +
| style="border:1px solid #AAAAAA;padding: 0.2em;" | <source lang="javascript">abstract class Z{}</source>  
 +
| style="border:1px solid #AAAAAA;padding: 0.2em;" | <source lang="javascript">
 +
//> abstract
 +
vjo.ctype("<namespace>.Z")
 +
</source>
  
 +
|-
 +
| style="border:1px solid #AAAAAA;padding: 0.2em;" | Define an Inner Class
 +
| style="border:1px solid #AAAAAA;padding: 0.2em;" | <source lang="javascript">class X{}</source> 
 +
| style="border:1px solid #AAAAAA;padding: 0.2em;" | <source lang="javascript">
 +
X : vjo.ctype()
 +
</source>
  
* Getting Started
+
|-
** [[VJET:VJET JavaScript IDE Installation Guide]] <nowiki>-</nowiki> Installation instructions, brief VJET JavaScript overview, where to find VJET JavaScript documentation
+
| style="border:1px solid #AAAAAA;padding: 0.2em;" | Modify a Type  
** [[https://www.ebayopensource.org/wiki/display/VJET/Importing+VJET+JavaScript+Type+Libraries Importing VJET JavaScript Type Libraries]] <nowiki>-</nowiki> Importing VJET JavaScript type libraries and configuring projects to use them
+
| style="border:1px solid #AAAAAA;padding: 0.2em;" | <source lang="javascript">final class R{};</source>
** [[VJET:JS code assist and validation for two or more js files|Code assist and validation for 2 or more js files]] <nowiki>-</nowiki> How to get assist for variables/ functions defined in other files.
+
| style="border:1px solid #AAAAAA;padding: 0.2em;" | <source lang="javascript">
* Features:
+
//> final
** [[https://www.ebayopensource.org/wiki/display/VJET/Code+Assistance+Features Code Assistance Features]] <nowiki>-</nowiki> Overview of code assist features
+
vjo.ctype("vjo.R")
** [[https://www.ebayopensource.org/wiki/display/VJET/Code+Search+Features Code Search Features]] <nowiki>-</nowiki> Overview of code search features
+
</source>  
* VJET Docs
+
** [[VJET:Type Declarations Using VJETDoc|VJETDoc&nbsp;]] <nowiki>-</nowiki> type declarations for JavaScript
+
** [[VJET:VJETDoc Quick Reference]]
+
** [[VJET:VJETDoc Reference Guide]]
+
  
== Eclipse Cheat Sheets, Samples, and Help&nbsp;&nbsp; ==
+
|-
 +
| style="border:1px solid #AAAAAA;padding: 0.2em;" | Define a Constructor   
 +
| style="border:1px solid #AAAAAA;padding: 0.2em;" | <source lang="javascript">D(){}</source> 
 +
| style="border:1px solid #AAAAAA;padding: 0.2em;" | <source lang="javascript">
 +
constructs: function(){}
 +
</source>
  
In Eclipse, select menu item '''Help > Welcome'''
+
|-
 +
| style="border:1px solid #AAAAAA;padding: 0.2em;" | Overload a Constructor   
 +
| style="border:1px solid #AAAAAA;padding: 0.2em;" | <source lang="javascript">D(int arg){}
 +
D(String arg){}</source> 
 +
| style="border:1px solid #AAAAAA;padding: 0.2em;" | <source lang="javascript">
 +
//>public void constructs(int arg)
 +
//>public void constructs(String arg)
 +
constructs:function(arg){}
 +
</source>  
  
* For an overview of VJET JavaScript select the '''Overview''' page, then '''Developing JavaScript'''
+
|-
* For the VJET JavaScript Hello World tutorial select the '''Tutorials''' page, then '''Hello VJET JavaScript World'''
+
| style="border:1px solid #AAAAAA;padding: 0.2em;" | Call a Super Constructor     
 +
| style="border:1px solid #AAAAAA;padding: 0.2em;" | <source lang="javascript">super()</source> 
 +
| style="border:1px solid #AAAAAA;padding: 0.2em;" | <source lang="javascript">
 +
this.base()
 +
</source>
  
=== Eclipse Cheat Sheets ===
+
|-
 +
| style="border:1px solid #AAAAAA;padding: 0.2em;" | Call a Super Constructor with Arguments     
 +
| style="border:1px solid #AAAAAA;padding: 0.2em;" | <source lang="javascript">super(arg)</source> 
 +
| style="border:1px solid #AAAAAA;padding: 0.2em;" | <source lang="javascript">
 +
this.base(arg)
 +
</source>
  
Eclipse cheat sheets will be added as an ongoing documentation effort and are delivered in 2 ways:
+
|-
* Bundled with the VJET JavaScript IDE plugin
+
| style="border:1px solid #AAAAAA;padding: 0.2em;" | Call a Super Method     
* Published outside the VJET JavaScript IDE plugin and can be installed.
+
| style="border:1px solid #AAAAAA;padding: 0.2em;" | <source lang="javascript">super.doIt()</source> 
 +
| style="border:1px solid #AAAAAA;padding: 0.2em;" | <source lang="javascript">
 +
this.base.doIt()
 +
</source>
  
Published cheat sheets are available on the [[https://www.ebayopensource.org/index.php/VJET/Downloads VJET JavaScript Download site]].
+
|-
 +
| style="border:1px solid #AAAAAA;padding: 0.2em;" | Extend a Class     
 +
| style="border:1px solid #AAAAAA;padding: 0.2em;" | <source lang="javascript">class X extends Y</source> 
 +
| style="border:1px solid #AAAAAA;padding: 0.2em;" | <source lang="javascript">
 +
vjo.ctype("<namespace>.X")
 +
.inherits("<namespace>.Y")
 +
</source>
  
 +
|-
 +
| style="border:1px solid #AAAAAA;padding: 0.2em;" | Implement an Interface       
 +
| style="border:1px solid #AAAAAA;padding: 0.2em;" | <source lang="javascript">class X implements Y</source> 
 +
| style="border:1px solid #AAAAAA;padding: 0.2em;" | <source lang="javascript">
 +
vjo.ctype("<namespace>.X")
 +
.satisfies("<namespace>.Y")
 +
</source>
  
==== Select a Cheat Sheet<br/> ====
+
|-
 +
| style="border:1px solid #AAAAAA;padding: 0.2em;" | Implement an Instance Method       
 +
| style="border:1px solid #AAAAAA;padding: 0.2em;" | <source lang="javascript">void setName(String name)</source>
 +
| style="border:1px solid #AAAAAA;padding: 0.2em;" | <source lang="javascript">
 +
.protos({
 +
setName: function(String name)
 +
</source>
  
 +
|-
 +
| style="border:1px solid #AAAAAA;padding: 0.2em;" | Implement a Static Method       
 +
| style="border:1px solid #AAAAAA;padding: 0.2em;" | <source lang="javascript">static void setName(String name)</source> 
 +
| style="border:1px solid #AAAAAA;padding: 0.2em;" | <source lang="javascript">
 +
.props({
 +
setName: function(String name)
 +
})
 +
</source>
  
# Select menu item '''Help > Cheat Sheets'''
+
|-
# Select '''Select a cheat sheet from the list''', then open the '''JavaScript Development''' folder
+
| style="border:1px solid #AAAAAA;padding: 0.2em;" | Implement a Static Initializer         
# Double click the cheat sheet you want to view
+
| style="border:1px solid #AAAAAA;padding: 0.2em;" | <source lang="javascript">{// static initialization here
 +
static{...}</source> 
 +
| style="border:1px solid #AAAAAA;padding: 0.2em;" | <source lang="javascript">
 +
// static initialization here
 +
.inits(function(){...})
 +
</source>
  
 +
|}
  
  
==== Install a Cheat Sheet ====
 
  
# Select the menu item '''Help > Cheat Sheets'''
+
==== Declarations ====
# Select '''Enter the URL of a cheat sheet''', and enter the URL of the cheat sheet. Click '''OK'''.
+
 
# If a dialog pops up that indicates that certain actions/commands may not work, dismiss the dialog.
+
{| style="background-color:#F9F9F9;border:1px solid #AAAAAA;border-collapse:collapse;color:black; margin:1em 0;"
# The cheat sheet will open in Eclipse.
+
|-
[[Category:VJET]]
+
! style="background-color:#F2F2F2;text-align:center;border:1px solid #AAAAAA;padding:0.2em;" | To Declare
 +
! style="background-color:#F2F2F2;text-align:center;border:1px solid #AAAAAA;padding:0.2em;" | Java
 +
! style="background-color:#F2F2F2;text-align:center;border:1px solid #AAAAAA;padding:0.2em;" | VJET VJO
 +
|-
 +
| style="border:1px solid #AAAAAA;padding: 0.2em;" | Enum Constants
 +
| style="border:1px solid #AAAAAA;padding: 0.2em;" | <source lang="javascript">
 +
public enum Days {
 +
MON,TUE,WED,THU,FRI,SAT,SUN
 +
}
 +
</source>
 +
| style="border:1px solid #AAAAAA;padding: 0.2em;" | <source lang="javascript">
 +
vjo.etype('<namespace>.Days')
 +
.values('MON,TUE,WED,THU,FRI,SAT,SUN')
 +
</source>
 +
 +
|-
 +
| style="border:1px solid #AAAAAA;padding: 0.2em;" |  Argument Types
 +
| style="border:1px solid #AAAAAA;padding: 0.2em;" | <source lang="javascript">
 +
void setName(String name){}
 +
</source>
 +
| style="border:1px solid #AAAAAA;padding: 0.2em;" | <source lang="javascript">
 +
//> void setName(String name)
 +
setName : function(name){}
 +
</source>
 +
 
 +
|-
 +
| style="border:1px solid #AAAAAA;padding: 0.2em;" |  Method Scope
 +
| style="border:1px solid #AAAAAA;padding: 0.2em;" | <source lang="javascript">
 +
public void setName(String name){}
 +
</source>
 +
| style="border:1px solid #AAAAAA;padding: 0.2em;" | <source lang="javascript">
 +
//>public void setName(String name)
 +
setName : function(name){}
 +
</source>
 +
 
 +
|-
 +
| style="border:1px solid #AAAAAA;padding: 0.2em;" |  Return Type
 +
| style="border:1px solid #AAAAAA;padding: 0.2em;" | <source lang="javascript">
 +
public X getIt(){}
 +
</source>
 +
| style="border:1px solid #AAAAAA;padding: 0.2em;" | <source lang="javascript">
 +
//> public X getIt()
 +
getIt : function(){}
 +
</source>
 +
 
 +
|-
 +
| style="border:1px solid #AAAAAA;padding: 0.2em;" |    Overloaded Method
 +
| style="border:1px solid #AAAAAA;padding: 0.2em;" | <source lang="javascript">
 +
public X getIt(String x)
 +
public X getIt(int x)
 +
</source>
 +
| style="border:1px solid #AAAAAA;padding: 0.2em;" | <source lang="javascript">
 +
//>public X getIt(String x)
 +
//>public X getIt(int x)
 +
getIt:function(x) {}
 +
</source>
 +
 
 +
|-
 +
| style="border:1px solid #AAAAAA;padding: 0.2em;" |  Method with Variable Arguments
 +
| style="border:1px solid #AAAAAA;padding: 0.2em;" | <source lang="javascript">
 +
public X getIt(String... x)
 +
</source>
 +
| style="border:1px solid #AAAAAA;padding: 0.2em;" | <source lang="javascript">
 +
//>public X getIt(String... x)
 +
getIt:function(x) {}
 +
</source>
 +
 
 +
|-
 +
| style="border:1px solid #AAAAAA;padding: 0.2em;" |  Local Variable
 +
| style="border:1px solid #AAAAAA;padding: 0.2em;" | <source lang="javascript">
 +
int x = 10;
 +
String s = "hello";
 +
final boolean ok = false;
 +
</source>
 +
| style="border:1px solid #AAAAAA;padding: 0.2em;" | <source lang="javascript">
 +
var x = 10; //< int
 +
var s = 'hello'; //< String
 +
var ok = false; //< final boolean
 +
</source>
 +
 
 +
|}
 +
 
 +
 
 +
[[Category:VJET|VJOJS]]
 +
[[Category:JavaScript]]

Latest revision as of 19:26, 2 May 2013

The following tables summarize the semantic similarities between Java and VjO.

Semantic Java VJET VJO
Declare a Namespace package vjo.x.y
vjo.ctype("vjo.x.y.Z") // where Z is the name of a class.
Import a Class import vjo.utils.X
.needs("vjo.utils.X")

Type Definitions and Manipulation

Semantic Java VJET VJO
Define a Class
class X{}
vjo.ctype("<namespace>.X")
Define an Interface
interface Y{}
vjo.itype("<namespace>.Y")
Define an Enum
enum E{}
vjo.etype("<namespace>.E")
Define an Abstract Class
abstract class Z{}
//> abstract
vjo.ctype("<namespace>.Z")
Define an Inner Class
class X{}
X : vjo.ctype()
Modify a Type
final class R{};
//> final
vjo.ctype("vjo.R")
Define a Constructor
D(){}
constructs: function(){}
Overload a Constructor
D(int arg){}
D(String arg){}
//>public void constructs(int arg)
//>public void constructs(String arg)
constructs:function(arg){}
Call a Super Constructor
super()
this.base()
Call a Super Constructor with Arguments
super(arg)
this.base(arg)
Call a Super Method
super.doIt()
this.base.doIt()
Extend a Class
class X extends Y
vjo.ctype("<namespace>.X")
.inherits("<namespace>.Y")
Implement an Interface
class X implements Y
vjo.ctype("<namespace>.X")
.satisfies("<namespace>.Y")
Implement an Instance Method
void setName(String name)
.protos({
setName: function(String name)
Implement a Static Method
static void setName(String name)
.props({
setName: function(String name)
})
Implement a Static Initializer
{// static initialization here
static{...}
// static initialization here
.inits(function(){...})


Declarations

To Declare Java VJET VJO
Enum Constants
public enum Days {
MON,TUE,WED,THU,FRI,SAT,SUN
}
vjo.etype('<namespace>.Days')
.values('MON,TUE,WED,THU,FRI,SAT,SUN')
Argument Types
void setName(String name){}
//> void setName(String name)
setName : function(name){}
Method Scope
public void setName(String name){}
//>public void setName(String name)
setName : function(name){}
Return Type
public X getIt(){}
//> public X getIt()
getIt : function(){}
Overloaded Method
public X getIt(String x)
public X getIt(int x)
//>public X getIt(String x)
//>public X getIt(int x)
getIt:function(x) {}
Method with Variable Arguments
public X getIt(String... x)
//>public X getIt(String... x)
getIt:function(x) {}
Local Variable
int x = 10;
String s = "hello";
final boolean ok = false;
var x = 10; //< int
var s = 'hello'; //< String
var ok = false; //< final boolean

Back to the top