Permalink
Browse files

Manual improvements constraints mixsets

  • Loading branch information...
TimLethbridge committed Jul 9, 2018
1 parent 5ba774c commit faaffe3b430b5754c22332d7da57b724195ab0b0
View
@@ -1,7 +1,7 @@
The MIT License for Umple
=========================
Copyright 2008-2018 Timothy C. Lethbridge, Andrew Forward, Omar Badreddin, Dusan Brestovansky, Julie Filion, Miguel Garzon, Hamoud Aljamaan, Ali Fatolahi, Julian Solano, Joshua Horacsek, Joel Hobson, Alvina Lee, Sultan Eid, Jordan Johns, Sonya Adams, James Zhao, Adam Dzialoszynski, Luna Lu, Song Bae Choi, Thomas Morrison, Sacha Bagasan, Andrew Paugh, Stuart Erskine, Russell Staughton, Christopher Hogan, Geoffrey Guest, Gabriel Blais Bourget, Robin Jastrzebski, Quinlan Jung, Blakeley Quebec Desloges, Jesus Zambrano, Ahmed Orabi, Mahmoud Orabi, Tonio Resende, Vahdat Abdelzad, Opeyemi Adesina, Aliaa Alghamdi, Tiago Nascimento, Tianyuan Chu, Fiodar Kazhamiaka, Greg Hysen, Jean-Christophe Charbonneau, Kenan Kigunda, Adriaan Cody Schuffelen, Marc Antoine Gosselin-Lavigne, Pedro Augusto Vincente, Jason Canto, Ellen Arteca, Alexi Turcotte, Karin Ng, Mark Galloway, Alexander Ringeri, Antonio Maria Pereria de Resende, Craig Bryan, Eric Telmer, Charles Wang, Chan Chun Kit, Nabil Maadarani, John Zweip, Kevin Brightwell, Warren Marivel, Ashley Merman, Xinxin Kou, Aymen Ben Rkhis, Curtis Meerkerk, Adam Kereliuk, Matthew Fritze, Michael Mkicik, Victoria Lacroix, Morgan Redshaw, Matthew Rodusek, Shikib Mehri, Amid Zakariapour, Marc de Niverville, Alex Hochheiden, Noah Murad, Katharine Cavers, Jackie Lang, Adam Bolding Jones, Chang Ding, Joshua McManus, Balaji Venkatesh, Runqing Zhang, Finn Hackett, Daniel Mitchell, Richard Hugessen, Bowei (Bernard) Yuan, Abdulaziz Algablan
Copyright 2008-2018 Timothy C. Lethbridge, Andrew Forward, Omar Badreddin, Dusan Brestovansky, Julie Filion, Miguel Garzon, Hamoud Aljamaan, Ali Fatolahi, Julian Solano, Joshua Horacsek, Joel Hobson, Alvina Lee, Sultan Eid, Jordan Johns, Sonya Adams, James Zhao, Adam Dzialoszynski, Luna Lu, Song Bae Choi, Thomas Morrison, Sacha Bagasan, Andrew Paugh, Stuart Erskine, Russell Staughton, Christopher Hogan, Geoffrey Guest, Gabriel Blais Bourget, Robin Jastrzebski, Quinlan Jung, Blakeley Quebec Desloges, Jesus Zambrano, Ahmed Orabi, Mahmoud Orabi, Tonio Resende, Vahdat Abdelzad, Opeyemi Adesina, Aliaa Alghamdi, Tiago Nascimento, Tianyuan Chu, Fiodar Kazhamiaka, Greg Hysen, Jean-Christophe Charbonneau, Kenan Kigunda, Adriaan Cody Schuffelen, Marc Antoine Gosselin-Lavigne, Pedro Augusto Vincente, Jason Canto, Ellen Arteca, Alexi Turcotte, Karin Ng, Mark Galloway, Alexander Ringeri, Antonio Maria Pereria de Resende, Craig Bryan, Eric Telmer, Charles Wang, Chan Chun Kit, Nabil Maadarani, John Zweip, Kevin Brightwell, Warren Marivel, Ashley Merman, Xinxin Kou, Aymen Ben Rkhis, Curtis Meerkerk, Adam Kereliuk, Matthew Fritze, Michael Mkicik, Victoria Lacroix, Morgan Redshaw, Matthew Rodusek, Shikib Mehri, Amid Zakariapour, Marc de Niverville, Alex Hochheiden, Noah Murad, Katharine Cavers, Jackie Lang, Adam Bolding Jones, Chang Ding, Joshua McManus, Balaji Venkatesh, Runqing Zhang, Finn Hackett, Daniel Mitchell, Richard Hugessen, Bowei (Bernard) Yuan, Abdulaziz Algablan, Zainab Al Showely
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
View
@@ -214,9 +214,9 @@
<echo>Fetching org.eclipse.cdt.core_5.5.0.jar</echo>
<echo level="warning">WARNING: This is merely wget-itng http://www.mirrorservice.org/sites/download.eclipse.org/eclipseMirror/tools/cdt/releases/kepler/sr1/plugins/org.eclipse.cdt.core_5.5.0.201309180223.jar</echo>
<echo level="warning">WARNING: This is merely wget-itng http://ftp.acc.umu.se/mirror/eclipse.org/tools/cdt/releases/kepler/sr1/plugins/org.eclipse.cdt.core_5.5.0.201309180223.jar</echo>
<mkdir dir="${umple.deps.manual.dir}" />
<get src="http://www.mirrorservice.org/sites/download.eclipse.org/eclipseMirror/tools/cdt/releases/kepler/sr1/plugins/org.eclipse.cdt.core_5.5.0.201309180223.jar"
<get src="http://ftp.acc.umu.se/mirror/eclipse.org/tools/cdt/releases/kepler/sr1/plugins/org.eclipse.cdt.core_5.5.0.201309180223.jar"
dest="${umple.deps.manual.dir}/"
usetimestamp="true" />
</else>
@@ -5,7 +5,7 @@ noreferences
@@description
<p><b>Transition actions:</b>
When n transition is taken, an action can occur. This is indicated
using a slash "/" followed by arbitrary code in braces. The arbitrary code
using a slash &quot;/&quot; followed by arbitrary code in braces. The arbitrary code
may be placed after the event name or before the destination state name. In other words the arrow -&gt; can be placed either directly after the event (before the action), or directly before the destination state (after the action)
<p><b>Entry and exit actions:</b>
@@ -14,14 +14,14 @@ when entering or exiting a state, an action can occur. This is indicated
using the keywords entry or exit, followed by a slash, followed by code.
</p>
<p>The actions described above should be programmed such that they take negligible time to execute; in other words they shouldn't contain significant loops..</p>
<p>The actions described above should be programmed such that they take negligible time to execute; in other words they shouldn&apos;t contain significant loops..</p>
<p><b>Do activities:</b>
If a longer-running computation (activity) needs to be while in a state,
encode this using the keyword do, followed by a block of code
in curly brackets. In languages such as Java
that support it, a thread will be started
to invoke the code. This allows the state machine to 'stay live'
to invoke the code. This allows the state machine to &apos;stay live&apos;
and be able to respond to other events, even while the do activity is
running. A do activity thread can be
interrupted and cancelled when a transition is taken out of the state. To enable this
@@ -4,9 +4,11 @@ noreferences
@@description
<p>Umple supports basoc OCL-type constraints that limit what umple-generated mutator methods (set, add, etc.) and constructors can do.</p>
<p>Umple supports basic OCL-type Boolean constraints that limit what umple-generated mutator methods (set, add, etc.) and constructors can do. If a constraint is violated set methods will return false, and constructors will throw an exception.</p>
<p>Constraints are specified within square brackets, in the same manner as guards on state machines.</p>
<p>Constraints are specified within square brackets. Simple constraints can refer to attributes and literals (numbers, strings). These can be compared using standard comparison operators such as &lt; and &gt;. Expressions can be conjoined by the and operator &amp;&amp; or the or operator ||. An exclamation mark is the not operator. Parentheses can be used to adjust the standard order of operations.</p>
<p><a href="">Guards on state machines are also Boolean expressions and, like simple constraints, are also enclosed within square brackets.</a></p>
<p>Additional capabilities are being developed in Umple to allow other types of constraints.</p>
@@ -4,7 +4,7 @@ noreferences
@@description
<p>You can specify basic preconditions in methods as shown below. This is still under development.</p>
<p>You can specify basic preconditions in methods as shown below. Like other constraints, they are specified in square brackets. Precondition appears as the first lines of a method and must start with &apos;pre:&apos;. A precondition can refer to one or more attributes or method arguments. If a precondition is not satisfied when the method is run an exception will be thrown; in Java a RuntimeException is used.</p>
@@syntax
[[methodBody]] [[precondition]]
@@ -0,0 +1,17 @@
Model Constraints
Constraints
noreferences
@@description
<p>Constraints be used to assert that certain properties of the model are as expected,
as shown in the examples below. Associations, attributes and generalizations can be checked.</p>
<p>Why would model constraints be useful, given that a programmer can just inspect the code to see if there are statements declaring the facts in question? The answer is that Umple has sophisticated separation of concerns mechanisms including <a href="Traits.html">traits</a>, mixins and <a href="BasicMixsets.html">mixsets</a>, and the developer may not be completely sure that a given model constraint will always be true. An attribute, for example, might be only introduced into the class in a completely different file or mixset, and the developer may not be certain that the file or mixset is being included. Using a model constraint allows a developer who wants to use that attribute in a method to cause an Umple compilation error if it does not in fact exist, rather than waiting to see if Java code fails to compile.
@@syntax
[[modelConstraint]] [[modelConstraintBody]] [[modelLinkingOp]] [[modelExpr]] [[modelRelationOp]] [[modelRelationOpAssociation]] [[modelRelationOpAttribute]] [[modelRelationOpInheritance]] [[modelRelationAssociationEnd]]
@@example
@@source manualexamples/ModelConstraints1.ump
@@endexample
@@ -3,8 +3,6 @@ Mixsets and Filters
noreferences
@@description
<p>This mixsets feature will be fully released soon.</p>
<p>Mixsets can be used to create different members of the same <em>product line</em> from a given Umple model, or to help divide the system into features for <em>feature-oriented development</em>. They can also be seen as providing conditional compilation capabilities such as those commonly found in C++ or C.</p>
<p>Mixsets are one of several separation-of-concerns capabilities available in Umple. The others being <a href="StructureofUmpleCode.html">mixins</a>, <a href="Traits.html">traits</a>, <a href="BeforeandAfterStatements.html">aspect orientation</a> and <a href="Filters.html">filters</a>.</p>
@@ -21,6 +19,12 @@ included in the system. A mixset is included using a <i>use</i> statement or a c
<li>Within a class, trait or other top-level entity. In this case the contents of the block are included in that entity (if a matching use statement is encountered).
</ul>
@@syntax
[[mixsetDefinition]] [[mixsetInnerContent]] [[mixsetInlineDefinition]] [[extraCode]]
@@example
@@source manualexamples/SimpleMixsets1.ump
@@endexample
@@ -6,7 +6,7 @@
// [*http://umple.org/license*]
//mixsets allow creation of mixins composed from multiple locations plus some constraints regarding usage of these mixins.
// See user manual page [*MixsetDefinition*]
// See user manual page [*BasicMixsets*]
mixsetDefinition : mixset [mixsetName] ( [[mixsetInnerContent]] | [[mixsetInlineDefinition]] )
mixsetInnerContent- : { [[extraCode]] }
@@ -31,7 +31,7 @@ public static void AssertCompileError(String umpleFile, String expectedOutputFil
expectedReader.close();
}
catch(Exception e) {
Assert.fail(e.getMessage()+
Assert.fail(""+e.getMessage()+
" Current Dir . =" +Paths.get(".").toAbsolutePath().normalize().toString()+
" Parent Dir .. =" + Paths.get("..").toAbsolutePath().normalize().toString());
}
@@ -33,7 +33,7 @@ public static void AssertRuntimeError(String javaClass, String expectedOutputFil
expectedReader.close();
}
catch(Exception e) {
Assert.fail(e.getMessage()+
Assert.fail(""+e.getMessage()+
" Current Dir . =" +Paths.get(".").toAbsolutePath().normalize().toString()+
" Parent Dir .. =" + Paths.get("..").toAbsolutePath().normalize().toString());
}
@@ -0,0 +1,34 @@
class X {
// Checks that this class has an assciation
// with class Z.
[model: -- Z]
}
class Y {
isA X;
// Verifies that this is a subclass of X
[model: isA X]
}
class Z {
a;
1 -- * X;
// Verifies that there is an association a
[model: has a]
}//$?[End_of_model]$?
class X
{
position 50 30 109 45;
}
class Y
{
position 50 130 109 45;
}
class Z
{
position 259 30 109 56;
position.association X__Z 0,6 110,24;
}
@@ -0,0 +1,18 @@
// Example constraints with a few more operations
// parentheses and negations
class X {
Boolean aBool;
Integer aa;
Integer bb;
Integer cc;
Integer dd;
Integer ee;
Integer ff;
Integer s1;
[aa < bb] // Simple attribute comparison
[cc > bb && aa < cc] // Conjunction
[(dd > ee) || (ee < ff)] // Disjunction and parens
[s1 != 0 || aa == 3] // Constant comparisons
[!(cc == 4 && dd == 5)] // negated parenthetic
[aBool || !(aa == 3)] // direct Boolean reference
}
@@ -0,0 +1,74 @@
// Initially there are two classes with no attributes
class X {}
class Z {}
// In another place, potentially a separate file.
// class X is given attribute a
// This is a simple mixin
class X {
a;
}
// In a third place we conditionally want to
// include attribute b, perhaps only in certain
// versions of the software.
mixset specialVersion {
class X {
b;
}
}
// To activate the specialVersion mixset we need
// to encounter the following
use specialVersion;
// We can also have another 'fragment' of
// the specialVersion mixset elsewhere
mixset specialVersion {
class X {
c;
}
}
// The following notations can also be used
class X {
mixset specialVersion {d;}
}
// Any features of a class can be incorporated
// using a mixset including the following
// Here we introduce a second mixset
mixset specialVersion2 {
class Z {p;}
}
class X {
mixset specialVersion2 {
isA Z;
0..1 -- * Z;
}
}
use specialVersion2;
// The following mixset will be ignored since
// there is no use statement for it
mixset specialVersion3 {
class W {}
}
//$?[End_of_model]$?
class Z
{
position 30 21 109 56;
}
class X
{
position 30 120 109 107;
}
class X
{
position.association X__Z 16,0 18,56;
}

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

0 comments on commit faaffe3

Please sign in to comment.