Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • meissnerfl73755/softa
1 result
Show changes
Commits on Source (22)
Showing
with 8270 additions and 0 deletions
# Default ignored files
/shelf/
/workspace.xml
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<bytecodeTargetLevel target="1.6" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
</set>
</option>
</GradleProjectSettings>
</option>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_6" project-jdk-name="IDE SDK" project-jdk-type="JavaSDK" />
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>
\ No newline at end of file
.DS_Store
.gradle
/build/
/out/
gradle-app.setting
!gradle-wrapper.jar
.gradletasknamecache
.idea/
*.iml
language: java
dist: trusty
\ No newline at end of file
MIT License
Copyright (c) 2017 HS Rosenheim :: Informatik :: Programmieren 3
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
\ No newline at end of file
_This is an assignment to the [Software Architecture](https://ohm-softa.github.io) class at the [Technische Hochschule Nürnberg](http://www.th-nuernberg.de)._
# Assignment 5: Generics and Bounds
This assignment covers an advanced topic of generics: bounds on type parameters and wildcards.
Bounds describe type constraints of generic classes or methods that allow to balance type safety with flexibility of use.
## Setup
1. Create a fork of this repository (button in the right upper corner)
2. Clone the project (get the link by clicking the green _Clone or download button_)
3. Import the project to your IDE (remember the guide in assignment 1)
4. Validate your environment by running the tests from your IntelliJ and by running `gradle test` on the command line.
## Groundwork
First, create the model for this assigment:
![Model spec](./assets/class-spec-1.svg)
1. Create the `enum` _PlantColor_
2. Implement the `abstract` class _Plant_
3. Implement the child classes _Flower_ and _Shrub_<br>
_Remarks:_
- A shrub is always green; a flower may be any color but green (handle a wrong value in the constructor)
- Flowers compare to each other by height
- All good data classes should always implement `equals` and `hashCode`, ideally also `toString`.
4. Create tests to ensure that your model classes are correct (e.g. green flowers won't work)
## Basic Bounds
Implement a `PlantBed` which manages a list of plants (use `SimpleList<T>`).
![PlantBed spec](./assets/class-spec-2.svg)
A `PlantBed` may contain any subclass of `Plant` but nothing else!
Use appropriate bounds when declaring the generic class.
_Remarks:_ The method `getPlantsByColor` is very easy to implement if you think of the `filter` method of the `SimpleList`!
Remember to create tests for nearly every line you code!
## Bounds on Wildcards
Last but not least we'll look at the PECS (**P**roducer **E**xtends **C**onsumer **S**uper) principle.
![Utils spec](./assets/class-spec-3.svg)
Implement a method `repot` that removes plants from one bed and inserts it in another.
Make sure that you can repot from a flower bed to a plant bed, but not vice versa.
1. Add a `remove` function to `PlantBed`
2. Implement the utility method `repot` in a utility class `PlantBedUtility`, use the appropriate bounds.
Why should this class be declared `abstract` and have a `private` constructor?
_Remark:_ the above UML diagram for the utility method does not include any bounds but you **need** some (PECS!) -- the compiler is unable to capture the types if you implement the method strictly as described in the UML!
This diff is collapsed.
@startuml
package java.lang {
interface Comparable<T> {
+compareTo(other: T): int
}
}
package ohm.softa.a05.model {
+enum PlantColor {
GREEN,
YELLOW,
RED,
BLUE,
ORANGE
}
+abstract class Plant implements Comparable {
-height: double
-family: String
-name: String
+getHeight(): double
+getFamily(): String
+getName(): String
+{abstract} getColor(): PlantColor
}
+class Flower extends Plant {
}
+class Shrub extends Plant{
}
}
@enduml
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" standalone="no"?><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" contentScriptType="application/ecmascript" contentStyleType="text/css" height="431px" preserveAspectRatio="none" style="width:339px;height:431px;" version="1.1" viewBox="0 0 339 431" width="339px" zoomAndPan="magnify"><defs><filter height="300%" id="fo6x3wtnyfwlg" width="300%" x="-1" y="-1"><feGaussianBlur result="blurOut" stdDeviation="2.0"/><feColorMatrix in="blurOut" result="blurOut2" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .4 0"/><feOffset dx="4.0" dy="4.0" in="blurOut2" result="blurOut3"/><feBlend in="SourceGraphic" in2="blurOut3" mode="normal"/></filter></defs><g><!--cluster java.lang--><polygon fill="#FFFFFF" filter="url(#fo6x3wtnyfwlg)" points="14,16,83,16,90,38.4883,188,38.4883,188,112,14,112,14,16" style="stroke: #000000; stroke-width: 1.5;"/><line style="stroke: #000000; stroke-width: 1.5;" x1="14" x2="90" y1="38.4883" y2="38.4883"/><text fill="#000000" font-family="sans-serif" font-size="14" font-weight="bold" lengthAdjust="spacingAndGlyphs" textLength="63" x="18" y="31.5352">java.lang</text><!--cluster ohm.softa.a05.model--><polygon fill="#FFFFFF" filter="url(#fo6x3wtnyfwlg)" points="21,137,176,137,183,159.4883,317,159.4883,317,419,21,419,21,137" style="stroke: #000000; stroke-width: 1.5;"/><line style="stroke: #000000; stroke-width: 1.5;" x1="21" x2="183" y1="159.4883" y2="159.4883"/><text fill="#000000" font-family="sans-serif" font-size="14" font-weight="bold" lengthAdjust="spacingAndGlyphs" textLength="149" x="25" y="152.5352">ohm.softa.a05.model</text><!--class Comparable--><rect fill="#FEFECE" filter="url(#fo6x3wtnyfwlg)" height="60.9551" id="Comparable" style="stroke: #A80036; stroke-width: 1.5;" width="157" x="22.5" y="43"/><ellipse cx="56.4" cy="59" fill="#B4A7E5" rx="11" ry="11" style="stroke: #A80036; stroke-width: 1.0;"/><path d="M52.8277,55.2651 L52.8277,53.1069 L60.2071,53.1069 L60.2071,55.2651 L57.7418,55.2651 L57.7418,63.3418 L60.2071,63.3418 L60.2071,65.5 L52.8277,65.5 L52.8277,63.3418 L55.2931,63.3418 L55.2931,55.2651 Z "/><text fill="#000000" font-family="sans-serif" font-size="12" font-style="italic" lengthAdjust="spacingAndGlyphs" textLength="71" x="74.6" y="63.5352">Comparable</text><rect fill="#FFFFFF" height="16.1328" style="stroke: #000000; stroke-width: 1.0; stroke-dasharray: 2.0,2.0;" width="10" x="172.5" y="40"/><text fill="#000000" font-family="sans-serif" font-size="12" font-style="italic" lengthAdjust="spacingAndGlyphs" textLength="8" x="173.5" y="52.6016">T</text><line style="stroke: #A80036; stroke-width: 1.5;" x1="23.5" x2="178.5" y1="75" y2="75"/><line style="stroke: #A80036; stroke-width: 1.5;" x1="23.5" x2="178.5" y1="83" y2="83"/><ellipse cx="33.5" cy="94.9775" fill="#84BE84" rx="3" ry="3" style="stroke: #038048; stroke-width: 1.0;"/><text fill="#000000" font-family="sans-serif" font-size="11" lengthAdjust="spacingAndGlyphs" textLength="131" x="42.5" y="97.6348">compareTo(other: T): int</text><!--class PlantColor--><rect fill="#FEFECE" filter="url(#fo6x3wtnyfwlg)" height="112.7754" id="PlantColor" style="stroke: #A80036; stroke-width: 1.5;" width="101" x="207.5" y="177"/><ellipse cx="222.5" cy="193" fill="#EB937F" rx="11" ry="11" style="stroke: #A80036; stroke-width: 1.0;"/><path d="M226.1143,199.5 L218.3945,199.5 L218.3945,187.1069 L226.1143,187.1069 L226.1143,189.2651 L220.8433,189.2651 L220.8433,191.938 L225.6162,191.938 L225.6162,194.0962 L220.8433,194.0962 L220.8433,197.3418 L226.1143,197.3418 Z "/><ellipse cx="241.5" cy="192.5" fill="#84BE84" rx="3" ry="3" style="stroke: #038048; stroke-width: 1.0;"/><text fill="#000000" font-family="sans-serif" font-size="12" lengthAdjust="spacingAndGlyphs" textLength="58" x="247.5" y="197.5352">PlantColor</text><line style="stroke: #A80036; stroke-width: 1.5;" x1="208.5" x2="307.5" y1="209" y2="209"/><text fill="#000000" font-family="sans-serif" font-size="11" lengthAdjust="spacingAndGlyphs" textLength="38" x="213.5" y="223.6348">GREEN,</text><text fill="#000000" font-family="sans-serif" font-size="11" lengthAdjust="spacingAndGlyphs" textLength="46" x="213.5" y="236.5898">YELLOW,</text><text fill="#000000" font-family="sans-serif" font-size="11" lengthAdjust="spacingAndGlyphs" textLength="24" x="213.5" y="249.5449">RED,</text><text fill="#000000" font-family="sans-serif" font-size="11" lengthAdjust="spacingAndGlyphs" textLength="29" x="213.5" y="262.5">BLUE,</text><text fill="#000000" font-family="sans-serif" font-size="11" lengthAdjust="spacingAndGlyphs" textLength="46" x="213.5" y="275.4551">ORANGE</text><line style="stroke: #A80036; stroke-width: 1.5;" x1="208.5" x2="307.5" y1="281.7754" y2="281.7754"/><!--class Plant--><rect fill="#FEFECE" filter="url(#fo6x3wtnyfwlg)" height="138.6855" id="Plant" style="stroke: #A80036; stroke-width: 1.5;" width="143" x="29.5" y="164"/><ellipse cx="77.25" cy="180" fill="#A9DCDF" rx="11" ry="11" style="stroke: #A80036; stroke-width: 1.0;"/><path d="M77.3633,175.5981 L76.2095,180.6699 L78.5254,180.6699 Z M75.8691,173.3569 L78.8657,173.3569 L82.2109,185.75 L79.7622,185.75 L78.9985,182.687 L75.7197,182.687 L74.9727,185.75 L72.5239,185.75 Z "/><ellipse cx="102.75" cy="179.5" fill="#84BE84" rx="3" ry="3" style="stroke: #038048; stroke-width: 1.0;"/><text fill="#000000" font-family="sans-serif" font-size="12" font-style="italic" lengthAdjust="spacingAndGlyphs" textLength="28" x="108.75" y="184.5352">Plant</text><line style="stroke: #A80036; stroke-width: 1.5;" x1="30.5" x2="171.5" y1="196" y2="196"/><rect fill="none" height="6" style="stroke: #C82930; stroke-width: 1.0;" width="6" x="37.5" y="204.9775"/><text fill="#000000" font-family="sans-serif" font-size="11" lengthAdjust="spacingAndGlyphs" textLength="77" x="49.5" y="210.6348">height: double</text><rect fill="none" height="6" style="stroke: #C82930; stroke-width: 1.0;" width="6" x="37.5" y="217.9326"/><text fill="#000000" font-family="sans-serif" font-size="11" lengthAdjust="spacingAndGlyphs" textLength="70" x="49.5" y="223.5898">family: String</text><rect fill="none" height="6" style="stroke: #C82930; stroke-width: 1.0;" width="6" x="37.5" y="230.8877"/><text fill="#000000" font-family="sans-serif" font-size="11" lengthAdjust="spacingAndGlyphs" textLength="67" x="49.5" y="236.5449">name: String</text><line style="stroke: #A80036; stroke-width: 1.5;" x1="30.5" x2="171.5" y1="242.8652" y2="242.8652"/><ellipse cx="40.5" cy="254.8428" fill="#84BE84" rx="3" ry="3" style="stroke: #038048; stroke-width: 1.0;"/><text fill="#000000" font-family="sans-serif" font-size="11" lengthAdjust="spacingAndGlyphs" textLength="103" x="49.5" y="257.5">getHeight(): double</text><ellipse cx="40.5" cy="267.7979" fill="#84BE84" rx="3" ry="3" style="stroke: #038048; stroke-width: 1.0;"/><text fill="#000000" font-family="sans-serif" font-size="11" lengthAdjust="spacingAndGlyphs" textLength="97" x="49.5" y="270.4551">getFamily(): String</text><ellipse cx="40.5" cy="280.7529" fill="#84BE84" rx="3" ry="3" style="stroke: #038048; stroke-width: 1.0;"/><text fill="#000000" font-family="sans-serif" font-size="11" lengthAdjust="spacingAndGlyphs" textLength="93" x="49.5" y="283.4102">getName(): String</text><ellipse cx="40.5" cy="293.708" fill="#84BE84" rx="3" ry="3" style="stroke: #038048; stroke-width: 1.0;"/><text fill="#000000" font-family="sans-serif" font-size="11" font-style="italic" lengthAdjust="spacingAndGlyphs" textLength="117" x="49.5" y="296.3652">getColor(): PlantColor</text><!--class Flower--><rect fill="#FEFECE" filter="url(#fo6x3wtnyfwlg)" height="48" id="Flower" style="stroke: #A80036; stroke-width: 1.5;" width="80" x="45" y="363"/><ellipse cx="60" cy="379" fill="#ADD1B2" rx="11" ry="11" style="stroke: #A80036; stroke-width: 1.0;"/><path d="M62.4731,385.1431 Q61.8921,385.4419 61.2529,385.5913 Q60.6138,385.7407 59.9082,385.7407 Q57.4014,385.7407 56.0815,384.0889 Q54.7617,382.437 54.7617,379.3159 Q54.7617,376.1865 56.0815,374.5347 Q57.4014,372.8828 59.9082,372.8828 Q60.6138,372.8828 61.2612,373.0322 Q61.9087,373.1816 62.4731,373.4805 L62.4731,376.2031 Q61.8423,375.6221 61.2488,375.3523 Q60.6553,375.0825 60.0244,375.0825 Q58.6797,375.0825 57.9949,376.1492 Q57.3101,377.2158 57.3101,379.3159 Q57.3101,381.4077 57.9949,382.4744 Q58.6797,383.541 60.0244,383.541 Q60.6553,383.541 61.2488,383.2712 Q61.8423,383.0015 62.4731,382.4204 Z "/><ellipse cx="79" cy="378.5" fill="#84BE84" rx="3" ry="3" style="stroke: #038048; stroke-width: 1.0;"/><text fill="#000000" font-family="sans-serif" font-size="12" lengthAdjust="spacingAndGlyphs" textLength="37" x="85" y="383.5352">Flower</text><line style="stroke: #A80036; stroke-width: 1.5;" x1="46" x2="124" y1="395" y2="395"/><line style="stroke: #A80036; stroke-width: 1.5;" x1="46" x2="124" y1="403" y2="403"/><!--class Shrub--><rect fill="#FEFECE" filter="url(#fo6x3wtnyfwlg)" height="48" id="Shrub" style="stroke: #A80036; stroke-width: 1.5;" width="76" x="160" y="363"/><ellipse cx="175" cy="379" fill="#ADD1B2" rx="11" ry="11" style="stroke: #A80036; stroke-width: 1.0;"/><path d="M177.4731,385.1431 Q176.8921,385.4419 176.2529,385.5913 Q175.6138,385.7407 174.9082,385.7407 Q172.4014,385.7407 171.0815,384.0889 Q169.7617,382.437 169.7617,379.3159 Q169.7617,376.1865 171.0815,374.5347 Q172.4014,372.8828 174.9082,372.8828 Q175.6138,372.8828 176.2612,373.0322 Q176.9087,373.1816 177.4731,373.4805 L177.4731,376.2031 Q176.8423,375.6221 176.2488,375.3523 Q175.6553,375.0825 175.0244,375.0825 Q173.6797,375.0825 172.9949,376.1492 Q172.3101,377.2158 172.3101,379.3159 Q172.3101,381.4077 172.9949,382.4744 Q173.6797,383.541 175.0244,383.541 Q175.6553,383.541 176.2488,383.2712 Q176.8423,383.0015 177.4731,382.4204 Z "/><ellipse cx="194" cy="378.5" fill="#84BE84" rx="3" ry="3" style="stroke: #038048; stroke-width: 1.0;"/><text fill="#000000" font-family="sans-serif" font-size="12" lengthAdjust="spacingAndGlyphs" textLength="33" x="200" y="383.5352">Shrub</text><line style="stroke: #A80036; stroke-width: 1.5;" x1="161" x2="235" y1="395" y2="395"/><line style="stroke: #A80036; stroke-width: 1.5;" x1="161" x2="235" y1="403" y2="403"/><!--link Comparable to Plant--><path d="M101,124.7201 C101,137.2139 101,150.7882 101,163.9761 " fill="none" id="Comparable-Plant" style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 7.0,7.0;"/><polygon fill="none" points="94.0001,124.3496,101,104.3496,108.0001,124.3496,94.0001,124.3496" style="stroke: #A80036; stroke-width: 1.0;"/><!--link Plant to Flower--><path d="M91.6546,323.1577 C90.1333,337.7526 88.6788,351.7064 87.5198,362.8256 " fill="none" id="Plant-Flower" style="stroke: #A80036; stroke-width: 1.0;"/><polygon fill="none" points="84.7132,322.2305,93.749,303.0641,98.6378,323.682,84.7132,322.2305" style="stroke: #A80036; stroke-width: 1.0;"/><!--link Plant to Shrub--><path d="M155.7649,320.1641 C165.6688,335.8367 175.2182,350.9483 182.7237,362.8256 " fill="none" id="Plant-Shrub" style="stroke: #A80036; stroke-width: 1.0;"/><polygon fill="none" points="149.7256,323.7106,144.959,303.0641,161.5606,316.2318,149.7256,323.7106" style="stroke: #A80036; stroke-width: 1.0;"/><!--
@startuml
package java.lang {
interface Comparable<T> {
+compareTo(other: T): int
}
}
package ohm.softa.a05.model {
+enum PlantColor {
GREEN,
YELLOW,
RED,
BLUE,
ORANGE
}
+abstract class Plant implements Comparable {
-height: double
-family: String
-name: String
+getHeight(): double
+getFamily(): String
+getName(): String
+{abstract} getColor(): PlantColor
}
+class Flower extends Plant {
}
+class Shrub extends Plant{
}
}
@enduml
PlantUML version 1.2019.03(Sun Mar 10 12:04:44 CET 2019)
(GPL source distribution)
Java Runtime: OpenJDK Runtime Environment
JVM: OpenJDK 64-Bit Server VM
Java Version: 11.0.2+9
Operating System: Mac OS X
OS Version: 10.14.4
Default Encoding: UTF-8
Language: en
Country: GB
--></g></svg>
\ No newline at end of file
This diff is collapsed.
@startuml
package ohm.softa.a05 {
+class PlantBed<T> {
-plants: SimpleList<T>
+add(plant: T)
+size(): int
+getPlantsByColor(color: PlantColor): SimpleList<T>
}
}
@enduml
<?xml version="1.0" encoding="UTF-8" standalone="no"?><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" contentScriptType="application/ecmascript" contentStyleType="text/css" height="163px" preserveAspectRatio="none" style="width:352px;height:163px;" version="1.1" viewBox="0 0 352 163" width="352px" zoomAndPan="magnify"><defs><filter height="300%" id="f1uwdgfzocpil6" width="300%" x="-1" y="-1"><feGaussianBlur result="blurOut" stdDeviation="2.0"/><feColorMatrix in="blurOut" result="blurOut2" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .4 0"/><feOffset dx="4.0" dy="4.0" in="blurOut2" result="blurOut3"/><feBlend in="SourceGraphic" in2="blurOut3" mode="normal"/></filter></defs><g><!--cluster ohm.softa.a05--><polygon fill="#FFFFFF" filter="url(#f1uwdgfzocpil6)" points="14,16,121,16,128,38.4883,330,38.4883,330,151,14,151,14,16" style="stroke: #000000; stroke-width: 1.5;"/><line style="stroke: #000000; stroke-width: 1.5;" x1="14" x2="128" y1="38.4883" y2="38.4883"/><text fill="#000000" font-family="sans-serif" font-size="14" font-weight="bold" lengthAdjust="spacingAndGlyphs" textLength="101" x="18" y="31.5352">ohm.softa.a05</text><!--class PlantBed--><rect fill="#FEFECE" filter="url(#f1uwdgfzocpil6)" height="99.8203" id="PlantBed" style="stroke: #A80036; stroke-width: 1.5;" width="300" x="22" y="43"/><ellipse cx="131.25" cy="59" fill="#ADD1B2" rx="11" ry="11" style="stroke: #A80036; stroke-width: 1.0;"/><path d="M133.7231,65.1431 Q133.1421,65.4419 132.5029,65.5913 Q131.8638,65.7407 131.1582,65.7407 Q128.6514,65.7407 127.3315,64.0889 Q126.0117,62.437 126.0117,59.3159 Q126.0117,56.1865 127.3315,54.5347 Q128.6514,52.8828 131.1582,52.8828 Q131.8638,52.8828 132.5112,53.0322 Q133.1587,53.1816 133.7231,53.4805 L133.7231,56.2031 Q133.0923,55.6221 132.4988,55.3523 Q131.9053,55.0825 131.2744,55.0825 Q129.9297,55.0825 129.2449,56.1492 Q128.5601,57.2158 128.5601,59.3159 Q128.5601,61.4077 129.2449,62.4744 Q129.9297,63.541 131.2744,63.541 Q131.9053,63.541 132.4988,63.2712 Q133.0923,63.0015 133.7231,62.4204 Z "/><ellipse cx="156.75" cy="58.5" fill="#84BE84" rx="3" ry="3" style="stroke: #038048; stroke-width: 1.0;"/><text fill="#000000" font-family="sans-serif" font-size="12" lengthAdjust="spacingAndGlyphs" textLength="50" x="162.75" y="63.5352">PlantBed</text><rect fill="#FFFFFF" height="16.1328" style="stroke: #000000; stroke-width: 1.0; stroke-dasharray: 2.0,2.0;" width="10" x="315" y="40"/><text fill="#000000" font-family="sans-serif" font-size="12" font-style="italic" lengthAdjust="spacingAndGlyphs" textLength="8" x="316" y="52.6016">T</text><line style="stroke: #A80036; stroke-width: 1.5;" x1="23" x2="321" y1="75" y2="75"/><rect fill="none" height="6" style="stroke: #C82930; stroke-width: 1.0;" width="6" x="30" y="83.9775"/><text fill="#000000" font-family="sans-serif" font-size="11" lengthAdjust="spacingAndGlyphs" textLength="118" x="42" y="89.6348">plants: SimpleList&lt;T&gt;</text><line style="stroke: #A80036; stroke-width: 1.5;" x1="23" x2="321" y1="95.9551" y2="95.9551"/><ellipse cx="33" cy="107.9326" fill="#84BE84" rx="3" ry="3" style="stroke: #038048; stroke-width: 1.0;"/><text fill="#000000" font-family="sans-serif" font-size="11" lengthAdjust="spacingAndGlyphs" textLength="68" x="42" y="110.5898">add(plant: T)</text><ellipse cx="33" cy="120.8877" fill="#84BE84" rx="3" ry="3" style="stroke: #038048; stroke-width: 1.0;"/><text fill="#000000" font-family="sans-serif" font-size="11" lengthAdjust="spacingAndGlyphs" textLength="49" x="42" y="123.5449">size(): int</text><ellipse cx="33" cy="133.8428" fill="#84BE84" rx="3" ry="3" style="stroke: #038048; stroke-width: 1.0;"/><text fill="#000000" font-family="sans-serif" font-size="11" lengthAdjust="spacingAndGlyphs" textLength="274" x="42" y="136.5">getPlantsByColor(color: PlantColor): SimpleList&lt;T&gt;</text><!--
@startuml
package ohm.softa.a05 {
+class PlantBed<T> {
-plants: SimpleList<T>
+add(plant: T)
+size(): int
+getPlantsByColor(color: PlantColor): SimpleList<T>
}
}
@enduml
PlantUML version 1.2019.03(Sun Mar 10 12:04:44 CET 2019)
(GPL source distribution)
Java Runtime: OpenJDK Runtime Environment
JVM: OpenJDK 64-Bit Server VM
Java Version: 11.0.2+9
Operating System: Mac OS X
OS Version: 10.14.4
Default Encoding: UTF-8
Language: en
Country: GB
--></g></svg>
\ No newline at end of file
This diff is collapsed.
@startuml
package ohm.softa.a05.utils {
+abstract class PlantBedUtility{
+{static} <???> repot(from: PlantBed<???>, PlantColor c, to: PlantBed<???>)
}
}
@enduml
\ No newline at end of file
<?xml version="1.0" encoding="us-ascii" standalone="no"?><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" contentStyleType="text/css" height="329px" preserveAspectRatio="none" style="width:667px;height:329px;background:#FFFFFF;" version="1.1" viewBox="0 0 667 329" width="667px" zoomAndPan="magnify"><defs/><g><!--cluster ohm--><g id="cluster_ohm"><path d="M8.5,6 L41.5,6 A3.75,3.75 0 0 1 44,8.5 L51,28.4883 L657.5,28.4883 A2.5,2.5 0 0 1 660,30.9883 L660,319.5 A2.5,2.5 0 0 1 657.5,322 L8.5,322 A2.5,2.5 0 0 1 6,319.5 L6,8.5 A2.5,2.5 0 0 1 8.5,6 " fill="none" style="stroke:#000000;stroke-width:1.5;"/><line style="stroke:#000000;stroke-width:1.5;" x1="6" x2="51" y1="28.4883" y2="28.4883"/><text fill="#000000" font-family="sans-serif" font-size="14" font-weight="bold" lengthAdjust="spacing" textLength="32" x="10" y="21.5352">ohm</text></g><!--cluster softa--><g id="cluster_softa"><path d="M32.5,49 L70.5,49 A3.75,3.75 0 0 1 73,51.5 L80,71.4883 L633.5,71.4883 A2.5,2.5 0 0 1 636,73.9883 L636,295.5 A2.5,2.5 0 0 1 633.5,298 L32.5,298 A2.5,2.5 0 0 1 30,295.5 L30,51.5 A2.5,2.5 0 0 1 32.5,49 " fill="none" style="stroke:#000000;stroke-width:1.5;"/><line style="stroke:#000000;stroke-width:1.5;" x1="30" x2="80" y1="71.4883" y2="71.4883"/><text fill="#000000" font-family="sans-serif" font-size="14" font-weight="bold" lengthAdjust="spacing" textLength="37" x="34" y="64.5352">softa</text></g><!--cluster a05--><g id="cluster_a05"><path d="M56.5,92 L83.5,92 A3.75,3.75 0 0 1 86,94.5 L93,114.4883 L609.5,114.4883 A2.5,2.5 0 0 1 612,116.9883 L612,271.5 A2.5,2.5 0 0 1 609.5,274 L56.5,274 A2.5,2.5 0 0 1 54,271.5 L54,94.5 A2.5,2.5 0 0 1 56.5,92 " fill="none" style="stroke:#000000;stroke-width:1.5;"/><line style="stroke:#000000;stroke-width:1.5;" x1="54" x2="93" y1="114.4883" y2="114.4883"/><text fill="#000000" font-family="sans-serif" font-size="14" font-weight="bold" lengthAdjust="spacing" textLength="26" x="58" y="107.5352">a05</text></g><!--cluster utils--><g id="cluster_utils"><path d="M80.5,135 L114.5,135 A3.75,3.75 0 0 1 117,137.5 L124,157.4883 L585.5,157.4883 A2.5,2.5 0 0 1 588,159.9883 L588,247.5 A2.5,2.5 0 0 1 585.5,250 L80.5,250 A2.5,2.5 0 0 1 78,247.5 L78,137.5 A2.5,2.5 0 0 1 80.5,135 " fill="none" style="stroke:#000000;stroke-width:1.5;"/><line style="stroke:#000000;stroke-width:1.5;" x1="78" x2="124" y1="157.4883" y2="157.4883"/><text fill="#000000" font-family="sans-serif" font-size="14" font-weight="bold" lengthAdjust="spacing" textLength="33" x="82" y="150.5352">utils</text></g><!--class PlantBedUtility--><g id="elem_PlantBedUtility"><rect codeLine="2" fill="#F1F1F1" height="64.4883" id="PlantBedUtility" rx="2.5" ry="2.5" style="stroke:#181818;stroke-width:0.5;" width="477" x="94.5" y="170"/><ellipse cx="274.25" cy="186" fill="#A9DCDF" rx="11" ry="11" style="stroke:#181818;stroke-width:1.0;"/><path d="M274.1133,181.3481 L272.9595,186.4199 L275.2754,186.4199 Z M272.6191,179.1069 L275.6157,179.1069 L278.9609,191.5 L276.5122,191.5 L275.7485,188.437 L272.4697,188.437 L271.7227,191.5 L269.2739,191.5 Z " fill="#000000"/><ellipse cx="299.75" cy="185.5" fill="#84BE84" rx="3" ry="3" style="stroke:#038048;stroke-width:1.0;"/><text fill="#000000" font-family="sans-serif" font-size="14" font-style="italic" lengthAdjust="spacing" textLength="98" x="305.75" y="191.291">PlantBedUtility</text><line style="stroke:#181818;stroke-width:0.5;" x1="95.5" x2="570.5" y1="202" y2="202"/><line style="stroke:#181818;stroke-width:0.5;" x1="95.5" x2="570.5" y1="210" y2="210"/><ellipse cx="105.5" cy="223.7441" fill="#84BE84" rx="3" ry="3" style="stroke:#038048;stroke-width:1.0;"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" text-decoration="underline" textLength="451" x="114.5" y="227.5352">&lt;???&gt; repot(from: PlantBed&lt;???&gt;, PlantColor c, to: PlantBed&lt;???&gt;)</text></g><!--SRC=[AqXCpavCJrN8pyZLAyvFAqdKIpGmrIijoSmfLgZcKW02xSIaufAYnEGIXUISnE9YXO2SnBmIfzIKKA2Qp99AY2AmmkhYaiIIpEHQ1HjxUtixXQBKWlmIZRIY_5mhk2QmZ0w4wvoVar-aaAoZK9AFfa0JR6OjLoq0]--></g></svg>
\ No newline at end of file
plugins {
id 'java'
id 'idea'
}
group 'ohm.softa'
version '1.0-SNAPSHOT'
sourceCompatibility = 11
repositories {
mavenCentral()
}
dependencies {
implementation("org.apache.commons:commons-lang3:$commons_lang3_version")
implementation("org.apache.logging.log4j:log4j-api:${log4j2Version}")
implementation("org.apache.logging.log4j:log4j-core:${log4j2Version}")
testImplementation("org.junit.jupiter:junit-jupiter-api:${junitVersion}")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:${junitVersion}")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-params:${junitVersion}")
}
test {
useJUnitPlatform()
testLogging {
events "passed", "skipped", "failed"
}
}
javadoc {
source = sourceSets.main.allJava
classpath = configurations.implementation
}
junitVersion=5.7.1
log4j2Version=2.14.1
commons_lang3_version=3.12.0
org.gradle.java.home=/usr/lib/jvm/java-11-openjdk
\ No newline at end of file