| ... |
... |
@@ -409,7 +409,7 @@ |
| 409 |
409 |
We will now add a class that will be in charge of loading all extensions registered at our new extension point. |
| 410 |
410 |
|
| 411 |
411 |
1. ((( |
| 412 |
|
-Add a class {{code language="none"}}HeadControllers{{/code}} to the package {{code language="none"}}de.cau.cs.rtprak.login.simple.controller{{/code}}. Add the following code, replacing {{code language="none"}}login{{/code}} with your login name in {{code language="none"}}EXTENSION_POINT_ID{{/code}} as usual: |
|
412 |
+Add a class {{code language="none"}}HeadControllers{{/code}} to the package {{code language="none"}}de.cau.cs.rtprak.login.simple.controller{{/code}}. Add the following code: |
| 413 |
413 |
|
| 414 |
414 |
{{code language="java"}} |
| 415 |
415 |
/** |
| ... |
... |
@@ -419,7 +419,7 @@ |
| 419 |
419 |
*/ |
| 420 |
420 |
public class HeadControllers { |
| 421 |
421 |
/** Identifier of the extension point */ |
| 422 |
|
- public final static String EXTENSION_POINT_ID = "de.cau.cs.rtprak.login.simple.headControllers"; |
|
422 |
+ public final static String EXTENSION_POINT_ID = "de.cau.cs.rtprak.groupx.simple.headControllers"; |
| 423 |
423 |
/** The singleton instance of the {@code HeadControllers} class */ |
| 424 |
424 |
public final static HeadControllers INSTANCE = new HeadControllers(); |
| 425 |
425 |
/** list of head controller ids with associated names. */ |
| ... |
... |
@@ -552,51 +552,32 @@ |
| 552 |
552 |
1*. Set the current head position to 1. |
| 553 |
553 |
1*. Refresh the table viewer with its {{code language="none"}}refresh(){{/code}} method. |
| 554 |
554 |
|
| 555 |
|
-== Adding a Test Head Controller == |
|
555 |
+ |
| 556 |
556 |
|
| 557 |
|
-Before creating a proper head controller in another plug-in, we will add a test controller to check whether all this stuff works. |
|
557 |
+ |
| 558 |
558 |
|
| 559 |
|
-1. ((( |
| 560 |
|
-Add a new class {{code language="none"}}NullController{{/code}} to the {{code language="none"}}de.cau.cs.rtprak.login.simple.controllers{{/code}} package: |
|
559 |
+ |
| 561 |
561 |
|
| 562 |
|
-{{code language="java"}} |
| 563 |
|
-/** |
| 564 |
|
- * Head controller that does nothing, for testing. |
| 565 |
|
- * @author msp |
| 566 |
|
- */ |
| 567 |
|
-public class NullController implements IHeadController { |
| 568 |
|
- /** |
| 569 |
|
- * {@inheritDoc} |
| 570 |
|
- */ |
| 571 |
|
- public HeadCommand nextCommand(final char character) { |
| 572 |
|
- return new HeadCommand(Action.NULL, Direction.NONE, '_'); |
| 573 |
|
- } |
| 574 |
|
- |
| 575 |
|
- /** |
| 576 |
|
- * {@inheritDoc} |
| 577 |
|
- */ |
| 578 |
|
- public void reset() { |
| 579 |
|
- } |
| 580 |
|
-} |
| 581 |
|
-{{/code}} |
| 582 |
|
-))) |
| 583 |
|
-1. Open the //Plugin Manifest Editor// and switch to the //Extensions// tab. Add your {{code language="none"}}de.cau.cs.rtprak.login.simple.headControllers{{/code}} extension point. Add a {{code language="none"}}controller{{/code}} element with ID {{code language="none"}}de.cau.cs.rtprak.login.simple.nullController{{/code}}, name {{code language="none"}}Null Controller{{/code}}, and class {{code language="none"}}de.cau.cs.rtprak.login.simple.controller.NullController{{/code}}. |
| 584 |
|
-1. Start the application and observe how your program behaves if you change the action and direction in the {{code language="none"}}NullController{{/code}} class. You can actually change both while the application is running, but only if you have started it in the Debug mode. In that case, Eclipse will actually hot-swap your changes into the running application. Sorcery! |
|
561 |
+ |
| 585 |
585 |
|
| 586 |
|
-== Implementing Your Own Head Controller == |
|
563 |
+ |
| 587 |
587 |
|
| 588 |
|
-We will now create a new plug-in with a new head controller: |
|
565 |
+ |
| 589 |
589 |
|
| 590 |
|
-1. Create a new plug-in {{code language="none"}}de.cau.cs.rtprak.login.simple.extension{{/code}}. In the //Plugin Manifest Editor//, add {{code language="none"}}de.cau.cs.rtprak.login.simple{{/code}} to the dependencies of the new plug-in. |
| 591 |
|
-1. Create a new class that implements {{code language="none"}}IHeadController{{/code}}:\\ |
| 592 |
|
-1*. Assuming that the initial head position is 1, the controller shall copy the input text infinitely often. So if the tape initially contains the word {{code language="none"}}hello{{/code}}, the controller shall generate {{code language="none"}}hellohellohellohe...{{/code}} . |
| 593 |
|
-1*. Your class needs some private fields to store the internal state of the controller, and you may need some special character as marker. Imagine how a Turing Machine would do this. |
| 594 |
|
-1*. It is not allowed to store data that can grow infinitely, since a Turing Machine may only have a finite number of states. This means that you may store single characters or numbers, but you must not store Strings, StringBuffers, arrays, lists, or sets. |
| 595 |
|
-1. Register the new controller class using an extension in the new plug-in. |
| 596 |
|
-1. Test your controller. |
|
567 |
+ |
| 597 |
597 |
|
| 598 |
|
-= Congratulations! = |
|
569 |
+ |
| 599 |
599 |
|
| 600 |
|
-Congratulations, you just made a big step towards understanding how Eclipse works. Plus, you've refreshed your knowledge on Turing Machines along the way. Eclipse is an industry standard technology, and having experience programming against it is a valuable skill for you. |
|
571 |
+ |
| 601 |
601 |
|
| 602 |
|
-If you have any comments and suggestions for improvement concerning this tutorial, please don't hesitate to tell us about them! |
|
573 |
+ |
|
574 |
+ |
|
575 |
+ |
|
576 |
+ |
|
577 |
+ |
|
578 |
+ |
|
579 |
+ |
|
580 |
+ |
|
581 |
+ |
|
582 |
+ |
|
583 |
+ |