forked from umple/umple
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Java test case for issue umple#923
- Loading branch information
Showing
3 changed files
with
140 additions
and
1 deletion.
There are no files selected for viewing
114 changes: 114 additions & 0 deletions
114
...uise/umple/implementation/java/ClassTemplateTest_StateMachineImplementsInterface.java.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
/*PLEASE DO NOT EDIT THIS CODE*/ | ||
/*This code was generated using the UMPLE 1.25.0-963d2bd modeling language!*/ | ||
|
||
|
||
|
||
public class FileLogger implements Logger | ||
{ | ||
|
||
//------------------------ | ||
// MEMBER VARIABLES | ||
//------------------------ | ||
|
||
//FileLogger Attributes | ||
private String fileName; | ||
|
||
//FileLogger State Machines | ||
public enum Status { disconnected, connected } | ||
private Status status; | ||
|
||
//------------------------ | ||
// CONSTRUCTOR | ||
//------------------------ | ||
|
||
public FileLogger(String aFileName) | ||
{ | ||
fileName = aFileName; | ||
setStatus(Status.disconnected); | ||
} | ||
|
||
//------------------------ | ||
// INTERFACE | ||
//------------------------ | ||
|
||
public String getStatusFullName() | ||
{ | ||
String answer = status.toString(); | ||
return answer; | ||
} | ||
|
||
public Status getStatus() | ||
{ | ||
return status; | ||
} | ||
|
||
public boolean connect() | ||
{ | ||
boolean wasEventProcessed = false; | ||
|
||
Status aStatus = status; | ||
switch (aStatus) | ||
{ | ||
case disconnected: | ||
setStatus(Status.connected); | ||
wasEventProcessed = true; | ||
break; | ||
default: | ||
// Other states do respond to this event | ||
} | ||
|
||
return wasEventProcessed; | ||
} | ||
|
||
public boolean disconnect() | ||
{ | ||
boolean wasEventProcessed = false; | ||
|
||
Status aStatus = status; | ||
switch (aStatus) | ||
{ | ||
case connected: | ||
setStatus(Status.disconnected); | ||
wasEventProcessed = true; | ||
break; | ||
default: | ||
// Other states do respond to this event | ||
} | ||
|
||
return wasEventProcessed; | ||
} | ||
|
||
public boolean write(String String) | ||
{ | ||
boolean wasEventProcessed = false; | ||
|
||
Status aStatus = status; | ||
switch (aStatus) | ||
{ | ||
case connected: | ||
setStatus(Status.connected); | ||
wasEventProcessed = true; | ||
break; | ||
default: | ||
// Other states do respond to this event | ||
} | ||
|
||
return wasEventProcessed; | ||
} | ||
|
||
private void setStatus(Status aStatus) | ||
{ | ||
status = aStatus; | ||
} | ||
|
||
public void delete() | ||
{} | ||
|
||
|
||
public String toString() | ||
{ | ||
String outputString = ""; | ||
return super.toString() + "["+ "]" | ||
+ outputString; | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
...st/cruise/umple/implementation/java/ClassTemplateTest_StateMachineImplementsInterface.ump
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
interface Logger { | ||
boolean connect(); | ||
boolean disconnect(); | ||
boolean write(String Data); | ||
} | ||
|
||
class FileLogger{ | ||
isA Logger; | ||
internal fileName; | ||
status{ | ||
disconnected{ | ||
connect -> connected; | ||
} | ||
connected{ | ||
disconnect -> disconnected; | ||
write(String) -> connected; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters