TS 68 JavaFX Hints

(Difference between revisions)
({{testcase|Generate class}})
({{testcase|Generate variable }})
Line 41: Line 41:
*  Copy the code to the editor:  
*  Copy the code to the editor:  
<code> <pre>   
<code> <pre>   
-
class A{
+
public class A {
-
  value;
+
    function f() {
 +
          value;
 +
    }
}
}
 +
</pre> </code>   
</pre> </code>   
* Click on the hint
* Click on the hint
-
* Select Create Local Variable
+
* Select Create variable value in the javafxapplication.Main.A
-
* {{result|EXPECTED RESULT:  The 'var value' code is generated  }}
+
* {{result|EXPECTED RESULT:  The 'var value;' attribute is generated  }}
<code> <pre>   
<code> <pre>   
-
class A{
+
public class A {
-
   var value;
+
    var value;
 +
 
 +
    function f() {
 +
          value;
 +
    }
 +
}
 +
</pre> </code>
 +
 
 +
=== {{testcase|Generate local variable }} ===
 +
*  Copy the code to the editor:
 +
<code> <pre> 
 +
public class A {
 +
    function f() {
 +
          value;
 +
    }
 +
}
 +
 
 +
</pre> </code>    
 +
* Click on the hint
 +
* Select Create local variable value in the javafxapplication.Main.A
 +
* {{result|EXPECTED RESULT:  The 'var value;' local variable is generated  }}
 +
<code> <pre> 
 +
public class A {
 +
    function f() {
 +
 
 +
          var value;
 +
          value;
 +
    }
}
}
</pre> </code>
</pre> </code>

Revision as of 13:20, 26 February 2010

Author: Alexandr Scherbatiy
Version: 1.2
Last update: 26 February 2010
Introduction:
Comments:


Contents


Semantic

Unused variables

  • Copy the code to the editor:
         
var a = 10;
var b = 20;
var c = a + 30;
  • EXPECTED RESULT: The 'b' variable is indicated as unused

Unused attributes

  • Copy the code to the editor:
         
class A{
    public var a;
}
  • EXPECTED RESULT: The 'a' attribute is indicated as unused

Unused functions

  • Copy the code to the editor:
  
class A{
    public function f(){}
}
  • EXPECTED RESULT: The 'f' function is indicated as unused

Dynamic Hints

Generate variable

  • Copy the code to the editor:
  
public class A {
    function f() {
          value;
    }
}

  • Click on the hint
  • Select Create variable value in the javafxapplication.Main.A
  • EXPECTED RESULT: The 'var value;' attribute is generated
  
public class A {
    var value;

    function f() {
          value;
    }
}

Generate local variable

  • Copy the code to the editor:
  
public class A {
    function f() {
          value;
    }
}

  • Click on the hint
  • Select Create local variable value in the javafxapplication.Main.A
  • EXPECTED RESULT: The 'var value;' local variable is generated
  
public class A {
    function f() {

          var value;
          value;
    }
}

Generate class

  • Copy the code to the editor:
  
var a = A{};
  • Click on the hint
  • Select Create A Class in the javafxapplication
  • EXPECTED RESULT: The 'A' class is generated under the javafxapplication package


Generate class in a file

  • Copy the code to the editor:
  
var a = A{};
  • Click on the hint
  • Select Create A Class in the javafxapplication.Main
  • EXPECTED RESULT: The 'A' class is generated in the Main file
  
var a = A{};

class A {
    //TODO Not implemented yet.
}

Implement all abstract methods

Argument with Sequence type

  • Copy the code to the editor:
         
abstract class A{
    abstract function f (seq:Boolean[]);
}

class B extends A{

}
  • Implement all abstract methods .
    • EXPECTED RESULT: Implementation of the abstract methods should be added
  
import java.lang.UnsupportedOperationException;

abstract class A{
    abstract function f (seq:Boolean[]);
}

class B extends A{
    override function f (seq : Boolean[]) : Object { 
        throw new UnsupportedOperationException('Not implemented yet');
    }
}


Generic interface

  • Copy the code to the editor:
         
import java.lang.Comparable;

class Vector extends Comparable {
}
  • Implement all abstract methods .
    • EXPECTED RESULT: Implementation of the abstract methods should be added
import java.lang.Comparable;
import java.lang.UnsupportedOperationException;

class Vector extends Comparable {
    override public function compareTo (arg) : Integer {
        throw new UnsupportedOperationException('Not implemented yet');
    }
}
Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo