Merge lp:~tapaal-contributor/tapaal/token-truncation-bug-1918913 into lp:tapaal

Proposed by Lena Ernstsen
Status: Merged
Approved by: Jiri Srba
Approved revision: 1124
Merged at revision: 1126
Proposed branch: lp:~tapaal-contributor/tapaal/token-truncation-bug-1918913
Merge into: lp:tapaal
Diff against target: 38 lines (+15/-4)
2 files modified
src/pipe/gui/Pipe.java (+1/-1)
src/pipe/gui/graphicElements/tapn/TimedPlaceComponent.java (+14/-3)
To merge this branch: bzr merge lp:~tapaal-contributor/tapaal/token-truncation-bug-1918913
Reviewer Review Type Date Requested Status
Jiri Srba Approve
Review via email: mp+400594@code.launchpad.net

This proposal supersedes a proposal from 2021-03-27.

Commit message

Every digit of the token count is now visible

Description of the change

Made it possible to see more than the 3 most significant digits for the token counts.
However, maximum number of digits is 8, as an "out of memory" error appears with 9 or more digits.

To post a comment you must log in.
Revision history for this message
Jiri Srba (srba) wrote : Posted in a previous version of this proposal

It looks as an okay solution. Can the limit of 999 tokens when drawing the net in GUI be increased to say 99999999 tokens? Should some net exceed it when loading, then print >9999 9999 instead of #9999 9999 (just to be sure).

review: Needs Fixing
Revision history for this message
Jiri Srba (srba) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/pipe/gui/Pipe.java'
--- src/pipe/gui/Pipe.java 2021-04-04 09:14:06 +0000
+++ src/pipe/gui/Pipe.java 2021-04-04 09:43:34 +0000
@@ -83,5 +83,5 @@
83 public static final int AGE_DECIMAL_PRECISION = 5;83 public static final int AGE_DECIMAL_PRECISION = 5;
84 public static final int AGE_PRECISION = AGE_DECIMAL_PRECISION + 4;84 public static final int AGE_PRECISION = AGE_DECIMAL_PRECISION + 4;
8585
86 public static final int MAX_NUMBER_OF_TOKENS_ALLOWED = 999;86 public static final int MAX_NUMBER_OF_TOKENS_ALLOWED = 9999999;
87}87}
8888
=== modified file 'src/pipe/gui/graphicElements/tapn/TimedPlaceComponent.java'
--- src/pipe/gui/graphicElements/tapn/TimedPlaceComponent.java 2020-08-19 11:34:44 +0000
+++ src/pipe/gui/graphicElements/tapn/TimedPlaceComponent.java 2021-04-04 09:43:34 +0000
@@ -254,9 +254,20 @@
254 case 0:254 case 0:
255 break;255 break;
256 default:256 default:
257 if (marking > 999) {257 if (marking > 99999999) {
258 // XXX could be better...258 String subMarking1 = String.valueOf(marking).substring(0, 4);
259 g.drawString("#" + marking, x, y + 20);259 String subMarking2 = String.valueOf(marking).substring(4);
260 g.drawString(">" + subMarking1, x - 5, y + 15);
261 g.drawString(subMarking2, x + 4, y + 25);
262 } else if (marking > 9999) {
263 // XXX could be better...
264 String subMarking1 = String.valueOf(marking).substring(0, 4);
265 String subMarking2 = String.valueOf(marking).substring(4);
266 g.drawString("#" + subMarking1, x - 5, y + 15);
267 g.drawString(subMarking2, x + 4, y + 25);
268 } else if (marking > 999) {
269 // XXX could be better...
270 g.drawString("#" + marking, x - 5, y + 20);
260 } else if (marking > 99) {271 } else if (marking > 99) {
261 g.drawString("#" + marking, x, y + 20);272 g.drawString("#" + marking, x, y + 20);
262 } else if (marking > 9) {273 } else if (marking > 9) {

Subscribers

People subscribed via source and target branches