Giter Site home page Giter Site logo

Comments (3)

Tlapr231 avatar Tlapr231 commented on June 18, 2024

For the specific Java classes, a possible solution would be to create a new template file (copy the java ones) and manually translate these classes. This translation can either be a full translation or a half translation where the TXL will be able to properly interpret the rest.

Note that research may have to be made to find a proper Python replacements for the Java specific classes. Also, the after keyword is linked with this issue as the after keyword generates the specific TimerTask java class.

from umple.

SamuelLabonte avatar SamuelLabonte commented on June 18, 2024

Here is some context as to why the features ‘active’ and ‘after’ were left as out of scope for the initial beta. When these keywords are included in Umple code, they will generate Java files that contain nested classes (a class within a class). The nested classes (ex: TimerTask when you use ‘after’) are full of java specific code. These classes are also independent of the Umple code written by the user. Since these classes are always the same, it is simply not worthwhile to update the TXL to parse and translate the code in those classes. Since the focus of our approach was TXL, we decided to leave these classes (and the Umple keywords that generates them) as out of scope given the time constraints we had. We suggest that these classes be translated by hand and inserted in the java intermediate code before TXL translation. These can be wrapped around tags so the TXL can ignore them and not need to parse or translate them like regular code. We followed a similar approach for user functions (functions with user code which can be anything) and it worked quite well. The tags are then removed after the TXL translation, so they do not stay in the final output.

TXL has a feature that allows you to specify what you want it to consider comments. TXL then completely removes these and ignores what’s inside. Ideally, these comments would still be in the output as they help orient users in the generated class and specify from what relations certain methods originate. To translate these comments, the comments will have to parsed and translated along with the regular code. This will take new TXL rules to translate them and changes to the grammar to accept comments wherever they might appear (at a quick glance, making comments [class_body_element] and [statement] might be enough).

TXL is a funny language to work with and when you don’t know what you are doing it can be difficult to locate the source of errors and mistakes. Get familiar with the documentation https://www.txl.ca/txl-docs.html . Maybe write a few practice programs before trying to dive into the existing code.

from umple.

TimLethbridge avatar TimLethbridge commented on June 18, 2024

Umple example testing skipped for Python generation. This issue would hopefully allow these examples to be tested (note that as time goes by other examples may be added that are not listed here)

Class Diagrams :
Contains the key word "after()" which generates TimerTask Java specific code :
- Access Control 2 (AccessControl2.ump)

State Machines :
Contains the key word "after()" which generates TimerTask Java specific code :
- Canal Lock (CanalLockStateMachine.ump)
- Dishwasher (Dishwasher.ump)
- Elevator (Elevator_State_Machine.ump)
- Library Load (LibraryLoanStateMachine.ump)
- Telephone Set Modes (TelephoneSystem2.ump)
- Timed Commands (TimedCommands.ump)
- Traffic Lights B (TrafficLightsB.ump)

Contains the "Timer" object which generates a Thread java specific class :
- Microwave Oven (MicrowaveOven2.ump)
- Runway (Runway.ump)
- Security Light (SecurityLight.ump)

Depends on multiple Java specific classes :
- TCP/IP Simulation (TcpIpSimulation.ump)

Can't pinpoint the exact Umple code issue but it is either "Runtime.getRuntime()" or "Thread" which causes the "ConsoleTracer.java" Java specific class to be generated :
- Phones and Lines (Phone.ump)

Manual :
Contains the Java specific Thread class :
- Auto-Transitions1.ump
- Ball_Game.ump
- BcmsBaseConfiguration.ump
- BcmsMultipleCrisis-Multiple-Coordinator-Configuration.ump
- StateMachineActionsandDoActivities1.ump

Contains the Java specific Message class + Threading :
- CodeInjectioninCustomMethods1.ump
- CodeInjectioninEventMethods1.ump
- QueuedStateMachines1.ump
- UnspecifiedEvents2.ump

Contains Java specific classes used to generate HTML :
- BasicTemplates1.ump
- BasicTemplates2.ump
- BasicTemplates3.ump
- HtmlGeneration.ump

Others :
- AroundStatement1.ump (Code Injection)
- AroundStatement2.ump (Code Injection)
- PingPong.ump (Code Injection)
- PooledStateMachines1.ump (Contains Hashmaps)
- StateDependentMethods1.ump (Return nothing on a switch case)
- StateDependentMethods2.ump (Return nothing on a switch case)
- TcpIpSimulation.ump (uses synchronized keyword)
- W082ConflictingModifiers.ump (Code Injection)

from umple.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.