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"

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.
+
<!-- table start -->
 +
{| border=1  width="100%" cellspacing="0" cellpadding="4" style="border-color:#eee" class="wikitable sortable"
 +
<!-- header row start -->
 +
! '''Semantic''' !! '''Java''' !! '''VJET VJO'''
 +
<!-- header row end -->
 +
|-
 +
|  Declare a Namespace
 +
|  package vjo.x.y
 +
|  <br/> 
 +
|}<!-- table end -->
  
 +
<br/>
 +
<!-- code start-->
 +
<pre style="margin-left:20px; font-size:1.4em; background-color:#fdfdfd">
 +
vjo.ctype("vjo.x.y.Z") // where Z is the name of a class.
 +
</pre><!-- code end-->
 +
 +
|-
 +
|  Import a Class
 +
|  import vjo.utils.X
 +
|  <br/> 
 +
<!-- code start-->
 +
<pre style="margin-left:20px; font-size:1.4em; background-color:#fdfdfd">
 +
.needs("vjo.utils.X")
 +
</pre><!-- code end-->
 +
  
 +
=== Type Definitions and Manipulation ===
  
 +
<!-- table start -->
 +
{| border=1  width="100%" cellspacing="0" cellpadding="4" style="border-color:#eee" class="wikitable sortable"
 +
<!-- header row start -->
 +
! '''Semantic''' !! '''Java''' !! '''VJET VJO'''
 +
<!-- header row end -->
 +
|-
 +
|  Define a Class 
 +
|}<!-- table end -->
  
== Wiki Documents ==
+
<br/>
 +
<!-- code start-->
 +
<pre style="margin-left:20px; font-size:1.4em; background-color:#fdfdfd">class X{}</pre><!-- code end-->
 +
 +
 +
<!-- code start-->
 +
<pre style="margin-left:20px; font-size:1.4em; background-color:#fdfdfd">vjo.ctype("<namespace>.X")</pre><!-- code end-->
 +
 +
|-
 +
|  Define an Interface 
 +
<!-- code start-->
 +
<pre style="margin-left:20px; font-size:1.4em; background-color:#fdfdfd">interface Y{}</pre><!-- code end-->
 +
 +
 +
<!-- code start-->
 +
<pre style="margin-left:20px; font-size:1.4em; background-color:#fdfdfd">vjo.itype("<namespace>.Y")</pre><!-- code end-->
 +
 +
|-
 +
|  Define an Enum 
 +
<!-- code start-->
 +
<pre style="margin-left:20px; font-size:1.4em; background-color:#fdfdfd">enum E{}</pre><!-- code end-->
 +
 +
 +
<!-- code start-->
 +
<pre style="margin-left:20px; font-size:1.4em; background-color:#fdfdfd">vjo.etype("<namespace>.E")</pre><!-- code end-->
 +
 +
|-
 +
|  Define an Abstract Class 
 +
<!-- code start-->
 +
<pre style="margin-left:20px; font-size:1.4em; background-color:#fdfdfd">abstract class Z{}</pre><!-- code end-->
 +
 +
 +
<!-- code start-->
 +
<pre style="margin-left:20px; font-size:1.4em; background-color:#fdfdfd">//> abstract
 +
vjo.ctype("<namespace>.Z")</pre><!-- code end-->
 +
 +
|-
 +
|  Define an Inner Class 
 +
<!-- code start-->
 +
<pre style="margin-left:20px; font-size:1.4em; background-color:#fdfdfd">class X{}</pre><!-- code end-->
 +
 +
 +
<!-- code start-->
 +
<pre style="margin-left:20px; font-size:1.4em; background-color:#fdfdfd">X : vjo.ctype()</pre><!-- code end-->
 +
 +
|-
 +
|  Modify a Type 
 +
<!-- code start-->
 +
<pre style="margin-left:20px; font-size:1.4em; background-color:#fdfdfd">final class R{};</pre><!-- code end-->
 +
 +
 +
<!-- code start-->
 +
<pre style="margin-left:20px; font-size:1.4em; background-color:#fdfdfd">//> final
 +
vjo.ctype("vjo.R")</pre><!-- code end-->
 +
 +
|-
 +
|  Define a Constructor 
 +
<!-- code start-->
 +
<pre style="margin-left:20px; font-size:1.4em; background-color:#fdfdfd">D(){}</pre><!-- code end-->
 +
 +
 +
<!-- code start-->
 +
<pre style="margin-left:20px; font-size:1.4em; background-color:#fdfdfd">constructs: function(){}</pre><!-- code end-->
 +
 +
|-
 +
|  Overload a Constructor 
 +
<!-- code start-->
 +
<pre style="margin-left:20px; font-size:1.4em; background-color:#fdfdfd">D(int arg){}
 +
D(String arg){}</pre><!-- code end-->
 +
 +
 +
<!-- code start-->
 +
<pre style="margin-left:20px; font-size:1.4em; background-color:#fdfdfd">//>public void constructs(int arg)
 +
//>public void constructs(String arg)
 +
constructs:function(arg){}</pre><!-- code end-->
 +
 +
|-
 +
|  Call a Super Constructor
 +
 +
<!-- code start-->
 +
<pre style="margin-left:20px; font-size:1.4em; background-color:#fdfdfd">super()</pre><!-- code end-->
 +
 +
 +
<!-- code start-->
 +
<pre style="margin-left:20px; font-size:1.4em; background-color:#fdfdfd">this.base()</pre><!-- code end-->
 +
 +
|-
 +
|  Call a Super Constructor with Arguments
 +
 +
<!-- code start-->
 +
<pre style="margin-left:20px; font-size:1.4em; background-color:#fdfdfd">super(arg)</pre><!-- code end-->
 +
 +
 +
<!-- code start-->
 +
<pre style="margin-left:20px; font-size:1.4em; background-color:#fdfdfd">this.base(arg)</pre><!-- code end-->
 +
 +
|-
 +
|  Call a Super Method
 +
 +
<!-- code start-->
 +
<pre style="margin-left:20px; font-size:1.4em; background-color:#fdfdfd">super.doIt()</pre><!-- code end-->
 +
 +
 +
<!-- code start-->
 +
<pre style="margin-left:20px; font-size:1.4em; background-color:#fdfdfd">this.base.doIt()</pre><!-- code end-->
 +
 +
|-
 +
|  Extend a Class
 +
 +
<!-- code start-->
 +
<pre style="margin-left:20px; font-size:1.4em; background-color:#fdfdfd">class X extends Y</pre><!-- code end-->
 +
 +
 +
<!-- code start-->
 +
<pre style="margin-left:20px; font-size:1.4em; background-color:#fdfdfd">vjo.ctype("<namespace>.X")
 +
.inherits("<namespace>.Y")</pre><!-- code end-->
 +
 +
|-
 +
|  Implement an Interface
 +
 +
<!-- code start-->
 +
<pre style="margin-left:20px; font-size:1.4em; background-color:#fdfdfd">class X implements Y</pre><!-- code end-->
 +
 +
 +
<!-- code start-->
 +
<pre style="margin-left:20px; font-size:1.4em; background-color:#fdfdfd">vjo.ctype("<namespace>.X")
 +
.satisfies("<namespace>.Y")</pre><!-- code end-->
 +
 +
|-
 +
|  Implement an Instance Method
 +
|  
 +
<!-- code start-->
 +
<pre style="margin-left:20px; font-size:1.4em; background-color:#fdfdfd">void setName(String name)</pre><!-- code end-->
 +
 
 +
<!-- code start-->
 +
<pre style="margin-left:20px; font-size:1.4em; background-color:#fdfdfd">.protos({
 +
setName: function(String name)</pre><!-- code end-->
  
 +
})
 +
|-
 +
|  Implement a Static Method
 +
|  <br/> 
 +
<!-- code start-->
 +
<pre style="margin-left:20px; font-size:1.4em; background-color:#fdfdfd">
 +
static void setName(String name)
 +
</pre><!-- code end-->
 +
 
 +
<!-- code start-->
 +
<pre style="margin-left:20px; font-size:1.4em; background-color:#fdfdfd">.props({
 +
setName: function(String name)
 +
})</pre><!-- code end-->
 +
 +
|-
 +
|  Implement a Static Initializer 
 +
<!-- code start-->
 +
<pre style="margin-left:20px; font-size:1.4em; background-color:#fdfdfd">{// static initialization here
 +
static{...}</pre><!-- code end-->
 +
 +
 +
<!-- code start-->
 +
<pre style="margin-left:20px; font-size:1.4em; background-color:#fdfdfd">// static initialization here
 +
.inits(function(){...})
 +
</pre><!-- code end-->
 +
  
* Getting Started
 
** [[VJET:VJET JavaScript IDE Installation Guide]] <nowiki>-</nowiki> Installation instructions, brief VJET JavaScript overview, where to find VJET JavaScript documentation
 
** [[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
 
** [[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.
 
* Features:
 
** [[https://www.ebayopensource.org/wiki/display/VJET/Code+Assistance+Features Code Assistance Features]] <nowiki>-</nowiki> Overview of code assist features
 
** [[https://www.ebayopensource.org/wiki/display/VJET/Code+Search+Features Code Search Features]] <nowiki>-</nowiki> Overview of code search features
 
* 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; ==
+
test
  
In Eclipse, select menu item '''Help > Welcome'''
+
==== Declarations ====
  
* For an overview of VJET JavaScript select the '''Overview''' page, then '''Developing JavaScript'''
+
<!-- table start -->
* For the VJET JavaScript Hello World tutorial select the '''Tutorials''' page, then '''Hello VJET JavaScript World'''
+
{| border=1  width="100%" cellspacing="0" cellpadding="4" style="border-color:#eee" class="wikitable sortable"
 +
<!-- header row start -->
 +
! '''To Declare''' !! '''Java''' !! '''VJET VJO'''  
 +
<!-- header row end -->
 +
|-
 +
|  Enum Constants 
 +
|}<!-- table end -->
  
=== Eclipse Cheat Sheets ===
+
<br/>
 
+
<!-- code start-->
Eclipse cheat sheets will be added as an ongoing documentation effort and are delivered in 2 ways:
+
<pre style="margin-left:20px; font-size:1.4em; background-color:#fdfdfd">public enum Days {
* Bundled with the VJET JavaScript IDE plugin
+
MON,TUE,WED,THU,FRI,SAT,SUN
* Published outside the VJET JavaScript IDE plugin and can be installed.
+
}</pre><!-- code end-->
 
+
Published cheat sheets are available on the [[https://www.ebayopensource.org/index.php/VJET/Downloads VJET JavaScript Download site]].
+
 
+
<!-- code start-->
 
+
<pre style="margin-left:20px; font-size:1.4em; background-color:#fdfdfd">vjo.etype('<namespace>.Days')
==== Select a Cheat Sheet<br/> ====
+
.values('MON,TUE,WED,THU,FRI,SAT,SUN')</pre><!-- code end-->
 
+
 
+
|-
# Select menu item '''Help > Cheat Sheets'''
+
|  Argument Types 
# Select '''Select a cheat sheet from the list''', then open the '''JavaScript Development''' folder
+
<!-- code start-->
# Double click the cheat sheet you want to view
+
<pre style="margin-left:20px; font-size:1.4em; background-color:#fdfdfd">void setName(String name){}</pre><!-- code end-->
 
+
 
+
 
+
<!-- code start-->
==== Install a Cheat Sheet ====
+
<pre style="margin-left:20px; font-size:1.4em; background-color:#fdfdfd">//> void setName(String name)
 
+
setName : function(name){}</pre><!-- code end-->
# Select the menu item '''Help > Cheat Sheets'''
+
# 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.
+
|  Method Scope 
# The cheat sheet will open in Eclipse.
+
<!-- code start-->
[[Category:VJET]]
+
<pre style="margin-left:20px; font-size:1.4em; background-color:#fdfdfd">public void setName(String name){}</pre><!-- code end-->
 +
 +
 +
<!-- code start-->
 +
<pre style="margin-left:20px; font-size:1.4em; background-color:#fdfdfd">//>public void setName(String name)
 +
setName : function(name){}</pre><!-- code end-->
 +
 +
|-
 +
|  Return Type 
 +
<!-- code start-->
 +
<pre style="margin-left:20px; font-size:1.4em; background-color:#fdfdfd">public X getIt(){}</pre><!-- code end-->
 +
 +
 +
<!-- code start-->
 +
<pre style="margin-left:20px; font-size:1.4em; background-color:#fdfdfd">//> public X getIt()
 +
getIt : function(){}</pre><!-- code end-->
 +
 +
|-
 +
|  Overloaded Method
 +
 +
<!-- code start-->
 +
<pre style="margin-left:20px; font-size:1.4em; background-color:#fdfdfd">public X getIt(String x)
 +
public X getIt(int x)</pre><!-- code end-->
 +
 
 +
<!-- code start-->
 +
<pre style="margin-left:20px; font-size:1.4em; background-color:#fdfdfd">//>public X getIt(String x)
 +
//>public X getIt(int x)
 +
getIt:function(x) {}</pre><!-- code end-->
 +
 +
|-
 +
|  Method with Variable Arguments
 +
 +
<!-- code start-->
 +
<pre style="margin-left:20px; font-size:1.4em; background-color:#fdfdfd">public X getIt(String... x)</pre><!-- code end-->
 +
 
 +
<!-- code start-->
 +
<pre style="margin-left:20px; font-size:1.4em; background-color:#fdfdfd">//>public X getIt(String... x)
 +
getIt:function(x) {}</pre><!-- code end-->
 +
 +
|-
 +
|  Local Variable
 +
 +
<!-- code start-->
 +
<pre style="margin-left:20px; font-size:1.4em; background-color:#fdfdfd">int x = 10;
 +
String s = "hello";
 +
final boolean ok = false;</pre><!-- code end-->
 +
 +
 +
<!-- code start-->
 +
<pre style="margin-left:20px; font-size:1.4em; background-color:#fdfdfd">var x = 10; //< int
 +
var s = 'hello'; //< String
 +
var ok = false; //< final boolean</pre><!-- code end-->

Revision as of 21:38, 3 December 2012

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(){...})


test

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