From 0d504952f4cab1b8ffd50a9330a1d55c52f4b038 Mon Sep 17 00:00:00 2001 From: "Dr. Martin Goik" <goik@hdm-stuttgart.de> Date: Thu, 9 May 2019 22:46:17 +0200 Subject: [PATCH] Supplementary slide explaining test principle --- .../Tests/unitTest.multi.svg | 1522 +++++++++++++++++ Doc/Sd1/objectsClasses.xml | 545 +++--- 2 files changed, 1802 insertions(+), 265 deletions(-) create mode 100644 Doc/Sd1/Ref/ObjectsAndClasses/Tests/unitTest.multi.svg diff --git a/Doc/Sd1/Ref/ObjectsAndClasses/Tests/unitTest.multi.svg b/Doc/Sd1/Ref/ObjectsAndClasses/Tests/unitTest.multi.svg new file mode 100644 index 000000000..021e001f3 --- /dev/null +++ b/Doc/Sd1/Ref/ObjectsAndClasses/Tests/unitTest.multi.svg @@ -0,0 +1,1522 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> + +<svg + xmlns:ns1="https://launchpad.net/jessyink" + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + width="170mm" + height="60mm" + viewBox="0 0 170.00002 60" + version="1.1" + id="svg8" + inkscape:version="0.92.3 (2405546, 2018-03-11)" + sodipodi:docname="unitTest.multi.svg"> + <sodipodi:namedview + id="base" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + inkscape:pageopacity="0.0" + inkscape:pageshadow="2" + inkscape:zoom="1.2869468" + inkscape:cx="322.80511" + inkscape:cy="64.998329" + inkscape:document-units="mm" + inkscape:current-layer="g5693" + showgrid="true" + inkscape:window-width="1600" + inkscape:window-height="1044" + inkscape:window-x="0" + inkscape:window-y="27" + inkscape:window-maximized="1" + fit-margin-top="0" + fit-margin-left="0" + fit-margin-right="0" + fit-margin-bottom="0" + showguides="false" + inkscape:snap-bbox="true" + inkscape:bbox-nodes="true" + inkscape:snap-global="true" + inkscape:snap-to-guides="false"> + <inkscape:grid + type="xygrid" + id="grid153" + originx="-1.4239177" + originy="-0.32290521" /> + </sodipodi:namedview> + <defs + id="defs2"> + <marker + inkscape:isstock="true" + style="overflow:visible" + id="marker5971" + refX="0" + refY="0" + orient="auto" + inkscape:stockid="Arrow2Mend"> + <path + inkscape:connector-curvature="0" + transform="scale(-0.6)" + d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1" + id="path5969" /> + </marker> + <marker + inkscape:isstock="true" + style="overflow:visible" + id="marker5697" + refX="0" + refY="0" + orient="auto" + inkscape:stockid="Arrow2Mend"> + <path + inkscape:connector-curvature="0" + transform="scale(-0.6)" + d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1" + id="path5695" /> + </marker> + <marker + inkscape:isstock="true" + style="overflow:visible" + id="marker5391" + refX="0" + refY="0" + orient="auto" + inkscape:stockid="Arrow2Mend"> + <path + inkscape:connector-curvature="0" + transform="scale(-0.6)" + d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1" + id="path5389" /> + </marker> + <marker + inkscape:isstock="true" + style="overflow:visible" + id="marker5123" + refX="0" + refY="0" + orient="auto" + inkscape:stockid="Arrow2Mend"> + <path + inkscape:connector-curvature="0" + transform="scale(-0.6)" + d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1" + id="path5121" /> + </marker> + <marker + inkscape:isstock="true" + style="overflow:visible" + id="marker4750" + refX="0" + refY="0" + orient="auto" + inkscape:stockid="Arrow2Mend"> + <path + inkscape:connector-curvature="0" + transform="scale(-0.6)" + d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1" + id="path4748" /> + </marker> + <marker + inkscape:isstock="true" + style="overflow:visible" + id="marker4472" + refX="0" + refY="0" + orient="auto" + inkscape:stockid="Arrow2Mend"> + <path + inkscape:connector-curvature="0" + transform="scale(-0.6)" + d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1" + id="path4470" /> + </marker> + <marker + inkscape:isstock="true" + style="overflow:visible" + id="marker4190" + refX="0" + refY="0" + orient="auto" + inkscape:stockid="Arrow2Mend"> + <path + inkscape:connector-curvature="0" + transform="scale(-0.6)" + d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1" + id="path4188" /> + </marker> + <marker + inkscape:isstock="true" + style="overflow:visible" + id="marker3946" + refX="0" + refY="0" + orient="auto" + inkscape:stockid="Arrow2Mend"> + <path + inkscape:connector-curvature="0" + transform="scale(-0.6)" + d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1" + id="path3944" /> + </marker> + <marker + inkscape:stockid="Arrow2Mend" + orient="auto" + refY="0" + refX="0" + id="marker1970" + style="overflow:visible" + inkscape:isstock="true"> + <path + id="path1968" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1" + d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + transform="scale(-0.6)" + inkscape:connector-curvature="0" /> + </marker> + <marker + inkscape:isstock="true" + style="overflow:visible" + id="marker1774" + refX="0" + refY="0" + orient="auto" + inkscape:stockid="DotM"> + <path + transform="matrix(0.4,0,0,0.4,2.96,0.4)" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;stroke-opacity:1" + d="m -2.5,-1 c 0,2.76 -2.24,5 -5,5 -2.76,0 -5,-2.24 -5,-5 0,-2.76 2.24,-5 5,-5 2.76,0 5,2.24 5,5 z" + id="path1772" + inkscape:connector-curvature="0" /> + </marker> + <marker + inkscape:isstock="true" + style="overflow:visible" + id="marker14694" + refX="0" + refY="0" + orient="auto" + inkscape:stockid="DotM"> + <path + transform="matrix(0.4,0,0,0.4,2.96,0.4)" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;stroke-opacity:1" + d="m -2.5,-1 c 0,2.76 -2.24,5 -5,5 -2.76,0 -5,-2.24 -5,-5 0,-2.76 2.24,-5 5,-5 2.76,0 5,2.24 5,5 z" + id="path14692" + inkscape:connector-curvature="0" /> + </marker> + <marker + inkscape:stockid="DotM" + orient="auto" + refY="0" + refX="0" + id="marker14195" + style="overflow:visible" + inkscape:isstock="true"> + <path + id="path14193" + d="m -2.5,-1 c 0,2.76 -2.24,5 -5,5 -2.76,0 -5,-2.24 -5,-5 0,-2.76 2.24,-5 5,-5 2.76,0 5,2.24 5,5 z" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;stroke-opacity:1" + transform="matrix(0.4,0,0,0.4,2.96,0.4)" + inkscape:connector-curvature="0" /> + </marker> + <marker + inkscape:stockid="DotM" + orient="auto" + refY="0" + refX="0" + id="marker11917" + style="overflow:visible" + inkscape:isstock="true"> + <path + id="path11915" + d="m -2.5,-1 c 0,2.76 -2.24,5 -5,5 -2.76,0 -5,-2.24 -5,-5 0,-2.76 2.24,-5 5,-5 2.76,0 5,2.24 5,5 z" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;stroke-opacity:1" + transform="matrix(0.4,0,0,0.4,2.96,0.4)" + inkscape:connector-curvature="0" /> + </marker> + <marker + inkscape:stockid="Arrow2Mend" + orient="auto" + refY="0" + refX="0" + id="marker6297" + style="overflow:visible" + inkscape:isstock="true"> + <path + id="path6295" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1" + d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + transform="scale(-0.6)" + inkscape:connector-curvature="0" /> + </marker> + <marker + inkscape:isstock="true" + style="overflow:visible" + id="marker12914" + refX="0" + refY="0" + orient="auto" + inkscape:stockid="Arrow2Mend"> + <path + inkscape:connector-curvature="0" + transform="scale(-0.6)" + d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1" + id="path12912" /> + </marker> + <marker + inkscape:stockid="Arrow2Mend" + orient="auto" + refY="0" + refX="0" + id="marker9325" + style="overflow:visible" + inkscape:isstock="true"> + <path + id="path9323" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1" + d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + transform="scale(-0.6)" + inkscape:connector-curvature="0" /> + </marker> + <marker + inkscape:stockid="Arrow2Mend" + orient="auto" + refY="0" + refX="0" + id="marker5341" + style="overflow:visible" + inkscape:isstock="true"> + <path + id="path5339" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1" + d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + transform="scale(-0.6)" + inkscape:connector-curvature="0" /> + </marker> + <marker + inkscape:isstock="true" + style="overflow:visible" + id="marker2807" + refX="0" + refY="0" + orient="auto" + inkscape:stockid="Arrow2Mend"> + <path + transform="scale(-0.6)" + d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1" + id="path2805" + inkscape:connector-curvature="0" /> + </marker> + <inkscape:perspective + sodipodi:type="inkscape:persp3d" + inkscape:vp_x="0 : 37.500001 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_z="170.00002 : 37.500001 : 1" + inkscape:persp3d-origin="85.00001 : 25 : 1" + id="perspective631" /> + <marker + inkscape:stockid="Arrow2Lend" + orient="auto" + refY="0" + refX="0" + id="Arrow2Lend" + style="overflow:visible" + inkscape:isstock="true"> + <path + id="path1067" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1" + d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + transform="matrix(-1.1,0,0,-1.1,-1.1,0)" + inkscape:connector-curvature="0" /> + </marker> + <marker + inkscape:stockid="Arrow2Mend" + orient="auto" + refY="0" + refX="0" + id="Arrow2Mend-6" + style="overflow:visible" + inkscape:isstock="true"> + <path + id="path1073-1" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1" + d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + transform="scale(-0.6)" + inkscape:connector-curvature="0" /> + </marker> + <marker + inkscape:stockid="Arrow2Mend" + orient="auto" + refY="0" + refX="0" + id="Arrow2Mend-5" + style="overflow:visible" + inkscape:isstock="true"> + <path + id="path1073-4" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1" + d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + transform="scale(-0.6)" + inkscape:connector-curvature="0" /> + </marker> + <marker + inkscape:stockid="Arrow2Mend" + orient="auto" + refY="0" + refX="0" + id="Arrow2Mend-65" + style="overflow:visible" + inkscape:isstock="true"> + <path + id="path1073-6" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1" + d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + transform="scale(-0.6)" + inkscape:connector-curvature="0" /> + </marker> + <marker + inkscape:stockid="Arrow2Mend" + orient="auto" + refY="0" + refX="0" + id="Arrow2Mend-65-5" + style="overflow:visible" + inkscape:isstock="true"> + <path + id="path1073-6-4" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1" + d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + transform="scale(-0.6)" + inkscape:connector-curvature="0" /> + </marker> + <marker + inkscape:stockid="Arrow2Mend" + orient="auto" + refY="0" + refX="0" + id="Arrow2Mend-6-8" + style="overflow:visible" + inkscape:isstock="true"> + <path + id="path1073-1-8" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1" + d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + transform="scale(-0.6)" + inkscape:connector-curvature="0" /> + </marker> + <marker + inkscape:stockid="Arrow2Mend" + orient="auto" + refY="0" + refX="0" + id="Arrow2Mend-65-5-4" + style="overflow:visible" + inkscape:isstock="true"> + <path + id="path1073-6-4-3" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1" + d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + transform="scale(-0.6)" + inkscape:connector-curvature="0" /> + </marker> + <marker + inkscape:isstock="true" + style="overflow:visible" + id="marker1003-2" + refX="0" + refY="0" + orient="auto" + inkscape:stockid="Arrow2Mend"> + <path + inkscape:connector-curvature="0" + transform="scale(-0.6)" + d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1" + id="path1001-3" /> + </marker> + <marker + inkscape:stockid="Arrow2Mend" + orient="auto" + refY="0" + refX="0" + id="Arrow2Mend-6-8-7" + style="overflow:visible" + inkscape:isstock="true"> + <path + id="path1073-1-8-5" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1" + d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + transform="scale(-0.6)" + inkscape:connector-curvature="0" /> + </marker> + <marker + inkscape:stockid="Arrow2Mend" + orient="auto" + refY="0" + refX="0" + id="Arrow2Mend-65-5-4-9" + style="overflow:visible" + inkscape:isstock="true"> + <path + id="path1073-6-4-3-2" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1" + d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + transform="scale(-0.6)" + inkscape:connector-curvature="0" /> + </marker> + <marker + inkscape:stockid="Arrow2Mend" + orient="auto" + refY="0" + refX="0" + id="Arrow2Mend-6-8-7-1" + style="overflow:visible" + inkscape:isstock="true"> + <path + id="path1073-1-8-5-0" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1" + d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + transform="scale(-0.6)" + inkscape:connector-curvature="0" /> + </marker> + <marker + inkscape:stockid="Arrow2Mend" + orient="auto" + refY="0" + refX="0" + id="Arrow2Mend-65-5-4-9-6" + style="overflow:visible" + inkscape:isstock="true"> + <path + id="path1073-6-4-3-2-3" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1" + d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + transform="scale(-0.6)" + inkscape:connector-curvature="0" /> + </marker> + <marker + inkscape:isstock="true" + style="overflow:visible" + id="marker1003-7" + refX="0" + refY="0" + orient="auto" + inkscape:stockid="Arrow2Mend"> + <path + inkscape:connector-curvature="0" + transform="scale(-0.6)" + d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1" + id="path1001-4" /> + </marker> + <marker + inkscape:isstock="true" + style="overflow:visible" + id="marker1003-7-6" + refX="0" + refY="0" + orient="auto" + inkscape:stockid="Arrow2Mend"> + <path + inkscape:connector-curvature="0" + transform="scale(-0.6)" + d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1" + id="path1001-4-8" /> + </marker> + <marker + inkscape:stockid="Arrow2Mend" + orient="auto" + refY="0" + refX="0" + id="Arrow2Mend-6-8-7-1-8" + style="overflow:visible" + inkscape:isstock="true"> + <path + id="path1073-1-8-5-0-4" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1" + d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + transform="scale(-0.6)" + inkscape:connector-curvature="0" /> + </marker> + <marker + inkscape:stockid="Arrow2Mend" + orient="auto" + refY="0" + refX="0" + id="Arrow2Mend-65-5-4-9-6-3" + style="overflow:visible" + inkscape:isstock="true"> + <path + id="path1073-6-4-3-2-3-1" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1" + d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + transform="scale(-0.6)" + inkscape:connector-curvature="0" /> + </marker> + <marker + inkscape:isstock="true" + style="overflow:visible" + id="marker1003-1" + refX="0" + refY="0" + orient="auto" + inkscape:stockid="Arrow2Mend"> + <path + inkscape:connector-curvature="0" + transform="scale(-0.6)" + d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1" + id="path1001-0" /> + </marker> + <marker + inkscape:stockid="Arrow2Mend" + orient="auto" + refY="0" + refX="0" + id="marker9325-1" + style="overflow:visible" + inkscape:isstock="true"> + <path + id="path9323-5" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1" + d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + transform="scale(-0.6)" + inkscape:connector-curvature="0" /> + </marker> + <marker + inkscape:stockid="Arrow2Mend" + orient="auto" + refY="0" + refX="0" + id="Arrow2Mend-6-8-7-1-8-9" + style="overflow:visible" + inkscape:isstock="true"> + <path + id="path1073-1-8-5-0-4-4" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1" + d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + transform="scale(-0.6)" + inkscape:connector-curvature="0" /> + </marker> + <marker + inkscape:stockid="Arrow2Mend" + orient="auto" + refY="0" + refX="0" + id="Arrow2Mend-5-9" + style="overflow:visible" + inkscape:isstock="true"> + <path + id="path1073-4-0" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1" + d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + transform="scale(-0.6)" + inkscape:connector-curvature="0" /> + </marker> + <marker + inkscape:stockid="Arrow2Mend" + orient="auto" + refY="0" + refX="0" + id="marker1970-6" + style="overflow:visible" + inkscape:isstock="true"> + <path + id="path1968-8" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1" + d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + transform="scale(-0.6)" + inkscape:connector-curvature="0" /> + </marker> + <marker + inkscape:stockid="Arrow2Mend" + orient="auto" + refY="0" + refX="0" + id="marker1970-6-6" + style="overflow:visible" + inkscape:isstock="true"> + <path + id="path1968-8-4" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1" + d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + transform="scale(-0.6)" + inkscape:connector-curvature="0" /> + </marker> + <marker + inkscape:stockid="Arrow2Mend" + orient="auto" + refY="0" + refX="0" + id="marker1970-6-0" + style="overflow:visible" + inkscape:isstock="true"> + <path + id="path1968-8-0" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1" + d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + transform="scale(-0.6)" + inkscape:connector-curvature="0" /> + </marker> + <marker + inkscape:stockid="Arrow2Mend" + orient="auto" + refY="0" + refX="0" + id="marker1970-6-0-5" + style="overflow:visible" + inkscape:isstock="true" + inkscape:collect="always"> + <path + id="path1968-8-0-3" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1" + d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + transform="scale(-0.6)" + inkscape:connector-curvature="0" /> + </marker> + <marker + inkscape:stockid="Arrow2Mend" + orient="auto" + refY="0" + refX="0" + id="marker1970-6-6-4" + style="overflow:visible" + inkscape:isstock="true" + inkscape:collect="always"> + <path + id="path1968-8-4-0" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1" + d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + transform="scale(-0.6)" + inkscape:connector-curvature="0" /> + </marker> + <marker + inkscape:stockid="Arrow2Mend" + orient="auto" + refY="0" + refX="0" + id="marker1970-6-1" + style="overflow:visible" + inkscape:isstock="true" + inkscape:collect="always"> + <path + id="path1968-8-7" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1" + d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + transform="scale(-0.6)" + inkscape:connector-curvature="0" /> + </marker> + <marker + inkscape:stockid="Arrow2Mend" + orient="auto" + refY="0" + refX="0" + id="marker1970-7" + style="overflow:visible" + inkscape:isstock="true" + inkscape:collect="always"> + <path + id="path1968-80" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1" + d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + transform="scale(-0.6)" + inkscape:connector-curvature="0" /> + </marker> + </defs> + <metadata + id="metadata5"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + <dc:title></dc:title> + </cc:Work> + </rdf:RDF> + </metadata> + <g + transform="translate(-1.4239073,-3.324251)" + style="display:inline" + inkscape:label="Layer 200" + id="g5062" + inkscape:groupmode="layer"> + <path + style="display:inline;fill:none;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="M 121.70833,27.297953 V 56.402122 L 146.84375,41.850039 Z" + id="path1974-8" + inkscape:connector-curvature="0" /> + <text + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.23333311px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:sans-serif;letter-spacing:0px;word-spacing:0px;display:inline;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332" + x="35.201977" + y="29.191378" + id="text4276-3"><tspan + sodipodi:role="line" + id="tspan4274-9" + x="35.201977" + y="29.191378" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';stroke-width:0.26458332">Method</tspan></text> + <text + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;line-height:1.25;font-family:'DejaVu Sans Mono';-inkscape-font-specification:'DejaVu Sans Mono Bold';letter-spacing:0px;word-spacing:0px;display:inline;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332" + x="35.294994" + y="36.000271" + id="text342-7"><tspan + sodipodi:role="line" + id="tspan340-2" + x="35.294994" + y="36.000271" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:'DejaVu Sans Mono';-inkscape-font-specification:'DejaVu Sans Mono Bold';stroke-width:0.26458332">isPrime(...)</tspan></text> + <rect + style="display:inline;opacity:0.68399999;fill:none;stroke:#000000;stroke-width:0.70555556;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + id="rect1329-5" + width="34.395836" + height="19.843748" + x="32.944744" + y="22.006289" + ry="1.3229153" /> + <text + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.23333311px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:sans-serif;letter-spacing:0px;word-spacing:0px;display:inline;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332" + x="69.775566" + y="26.471132" + id="text4276-2-9-0"><tspan + sodipodi:role="line" + id="tspan4274-1-7-2" + x="69.775566" + y="26.471132" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#ff6600;stroke-width:0.26458332">Computed output</tspan></text> + <path + style="display:inline;fill:none;stroke:#000000;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#marker1970-7)" + d="m 15.746826,31.266705 h 15.875" + id="path1379-4" + inkscape:connector-curvature="0" /> + <path + style="display:inline;fill:none;stroke:#000000;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#marker1970-6-1)" + d="M 67.340579,31.266703 H 83.215587" + id="path1379-2-8" + inkscape:connector-curvature="0" /> + <text + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;line-height:1.25;font-family:'DejaVu Sans';-inkscape-font-specification:'DejaVu Sans Bold';letter-spacing:0px;word-spacing:0px;display:inline;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332" + x="87.083046" + y="32.223751" + id="text1920-0"><tspan + sodipodi:role="line" + id="tspan1918-6" + x="87.083046" + y="32.223751" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:'DejaVu Sans Mono';-inkscape-font-specification:'DejaVu Sans Mono Bold';fill:#ff6600;stroke-width:0.26458332">true</tspan></text> + <path + style="display:inline;fill:none;stroke:#000000;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#marker1970-6-6-4)" + d="m 101.86457,31.266703 h 15.87501" + id="path1379-2-3-2" + inkscape:connector-curvature="0" /> + <path + style="display:inline;fill:none;stroke:#000000;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#marker1970-6-0-5)" + d="M 62.177074,50.417991 H 117.73958" + id="path1379-2-2-6" + inkscape:connector-curvature="0" + sodipodi:nodetypes="cc" /> + <text + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;line-height:1.25;font-family:'DejaVu Sans';-inkscape-font-specification:'DejaVu Sans Bold';letter-spacing:0px;word-spacing:0px;display:inline;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332" + x="124.35416" + y="41.85004" + id="text3013-5"><tspan + sodipodi:role="line" + id="tspan3011-6" + x="124.35416" + y="41.85004" + style="stroke-width:0.26458332">==</tspan></text> + <text + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;line-height:1.25;font-family:'DejaVu Sans';-inkscape-font-specification:'DejaVu Sans Bold';letter-spacing:0px;word-spacing:0px;display:inline;fill:#ff0000;fill-opacity:1;stroke:none;stroke-width:0.26458332" + x="149.18571" + y="43.11301" + id="text3017-6"><tspan + sodipodi:role="line" + id="tspan3015-3" + x="149.18571" + y="43.11301" + style="fill:#ff0000;stroke-width:0.26458332">Failure</tspan></text> + <text + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;line-height:1.25;font-family:'DejaVu Sans';-inkscape-font-specification:'DejaVu Sans Bold';letter-spacing:0px;word-spacing:0px;display:inline;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332" + x="6.2259684" + y="27.047838" + id="text1924-5-4"><tspan + sodipodi:role="line" + id="tspan1922-3-1" + x="6.2259684" + y="27.047838" + style="stroke-width:0.26458332"><tspan + style="fill:#800080;stroke-width:0.26458332" + id="tspan3019-8-7">Input: 10</tspan><tspan + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:'DejaVu Sans Mono';-inkscape-font-specification:'DejaVu Sans Mono Bold';fill:#800080;stroke-width:0.26458332" + id="tspan1962-5-1" /></tspan></text> + <text + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;line-height:1.25;font-family:'DejaVu Sans';-inkscape-font-specification:'DejaVu Sans Bold';letter-spacing:0px;word-spacing:0px;display:inline;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332" + x="6.2259684" + y="50.86034" + id="text1924-5-5-3"><tspan + sodipodi:role="line" + id="tspan1922-3-6-0" + x="6.2259684" + y="50.86034" + style="stroke-width:0.26458332"><tspan + style="fill:#0000ff;stroke-width:0.26458332" + id="tspan3281-8">Expected output:</tspan> <tspan + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:'DejaVu Sans Mono';-inkscape-font-specification:'DejaVu Sans Mono Bold';fill:#0000ff" + id="tspan5065">false</tspan></tspan></text> + </g> + <g + inkscape:groupmode="layer" + id="g5119" + inkscape:label="Layer 190" + style="display:none" + transform="translate(-1.4239073,-3.324251)"> + <text + id="text5071" + y="29.191378" + x="35.201977" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.23333311px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:sans-serif;letter-spacing:0px;word-spacing:0px;display:inline;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332" + xml:space="preserve"><tspan + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';stroke-width:0.26458332" + y="29.191378" + x="35.201977" + id="tspan5069" + sodipodi:role="line">Method</tspan></text> + <text + id="text5075" + y="36.000271" + x="35.294994" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;line-height:1.25;font-family:'DejaVu Sans Mono';-inkscape-font-specification:'DejaVu Sans Mono Bold';letter-spacing:0px;word-spacing:0px;display:inline;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332" + xml:space="preserve"><tspan + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:'DejaVu Sans Mono';-inkscape-font-specification:'DejaVu Sans Mono Bold';stroke-width:0.26458332" + y="36.000271" + x="35.294994" + id="tspan5073" + sodipodi:role="line">isPrime(...)</tspan></text> + <rect + ry="1.3229153" + y="22.006289" + x="32.944744" + height="19.843748" + width="34.395836" + id="rect5077" + style="display:inline;opacity:0.68399999;fill:none;stroke:#000000;stroke-width:0.70555556;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + <text + id="text5081" + y="26.471132" + x="69.775566" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.23333311px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:sans-serif;letter-spacing:0px;word-spacing:0px;display:inline;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332" + xml:space="preserve"><tspan + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#ff6600;stroke-width:0.26458332" + y="26.471132" + x="69.775566" + id="tspan5079" + sodipodi:role="line">Computed output</tspan></text> + <path + inkscape:connector-curvature="0" + id="path5083" + d="m 15.746826,31.266705 h 15.875" + style="display:inline;fill:none;stroke:#000000;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#marker1970-7)" /> + <path + inkscape:connector-curvature="0" + id="path5085" + d="M 67.340579,31.266703 H 83.215587" + style="display:inline;fill:none;stroke:#000000;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#marker1970-6-1)" /> + <text + id="text5089" + y="32.223751" + x="87.083046" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;line-height:1.25;font-family:'DejaVu Sans';-inkscape-font-specification:'DejaVu Sans Bold';letter-spacing:0px;word-spacing:0px;display:inline;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332" + xml:space="preserve"><tspan + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:'DejaVu Sans Mono';-inkscape-font-specification:'DejaVu Sans Mono Bold';fill:#ff6600;stroke-width:0.26458332" + y="32.223751" + x="87.083046" + id="tspan5087" + sodipodi:role="line">true</tspan></text> + <text + id="text5109" + y="27.047838" + x="6.2259684" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;line-height:1.25;font-family:'DejaVu Sans';-inkscape-font-specification:'DejaVu Sans Bold';letter-spacing:0px;word-spacing:0px;display:inline;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332" + xml:space="preserve"><tspan + style="stroke-width:0.26458332" + y="27.047838" + x="6.2259684" + id="tspan5107" + sodipodi:role="line"><tspan + id="tspan5103" + style="fill:#800080;stroke-width:0.26458332">Input: 10</tspan><tspan + id="tspan5105" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:'DejaVu Sans Mono';-inkscape-font-specification:'DejaVu Sans Mono Bold';fill:#800080;stroke-width:0.26458332" /></tspan></text> + </g> + <g + transform="translate(-1.4239073,-3.324251)" + style="display:none" + inkscape:label="Layer 180" + id="g5693" + inkscape:groupmode="layer"> + <text + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.23333311px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:sans-serif;letter-spacing:0px;word-spacing:0px;display:inline;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332" + x="35.201977" + y="29.191378" + id="text5665"><tspan + sodipodi:role="line" + id="tspan5663" + x="35.201977" + y="29.191378" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';stroke-width:0.26458332">Method</tspan></text> + <text + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;line-height:1.25;font-family:'DejaVu Sans Mono';-inkscape-font-specification:'DejaVu Sans Mono Bold';letter-spacing:0px;word-spacing:0px;display:inline;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332" + x="35.294994" + y="36.000271" + id="text5669"><tspan + sodipodi:role="line" + id="tspan5667" + x="35.294994" + y="36.000271" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:'DejaVu Sans Mono';-inkscape-font-specification:'DejaVu Sans Mono Bold';stroke-width:0.26458332">isPrime(...)</tspan></text> + <rect + style="display:inline;opacity:0.68399999;fill:none;stroke:#000000;stroke-width:0.70555556;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + id="rect5671" + width="34.395836" + height="19.843748" + x="32.944744" + y="22.006289" + ry="1.3229153" /> + <path + style="display:inline;fill:none;stroke:#000000;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#marker5971)" + d="m 15.746826,31.266705 h 15.875" + id="path5677" + inkscape:connector-curvature="0" /> + <text + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;line-height:1.25;font-family:'DejaVu Sans';-inkscape-font-specification:'DejaVu Sans Bold';letter-spacing:0px;word-spacing:0px;display:inline;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332" + x="6.2259684" + y="27.047838" + id="text5691"><tspan + sodipodi:role="line" + id="tspan5689" + x="6.2259684" + y="27.047838" + style="stroke-width:0.26458332"><tspan + style="fill:#800080;stroke-width:0.26458332" + id="tspan5685">Input: 10</tspan><tspan + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:'DejaVu Sans Mono';-inkscape-font-specification:'DejaVu Sans Mono Bold';fill:#800080;stroke-width:0.26458332" + id="tspan5687" /></tspan></text> + </g> + <g + inkscape:groupmode="layer" + id="g5063" + inkscape:label="Layer 100" + style="display:none" + transform="translate(-1.4239073,-3.324251)"> + <path + inkscape:connector-curvature="0" + id="path5010" + d="M 121.70833,27.297953 V 56.402122 L 146.84375,41.850039 Z" + style="display:inline;fill:none;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /> + <text + id="text5014" + y="29.191378" + x="35.201977" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.23333311px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:sans-serif;letter-spacing:0px;word-spacing:0px;display:inline;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332" + xml:space="preserve"><tspan + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';stroke-width:0.26458332" + y="29.191378" + x="35.201977" + id="tspan5012" + sodipodi:role="line">Method</tspan></text> + <text + id="text5018" + y="36.000271" + x="35.294994" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;line-height:1.25;font-family:'DejaVu Sans Mono';-inkscape-font-specification:'DejaVu Sans Mono Bold';letter-spacing:0px;word-spacing:0px;display:inline;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332" + xml:space="preserve"><tspan + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:'DejaVu Sans Mono';-inkscape-font-specification:'DejaVu Sans Mono Bold';stroke-width:0.26458332" + y="36.000271" + x="35.294994" + id="tspan5016" + sodipodi:role="line">isPrime(...)</tspan></text> + <rect + ry="1.3229153" + y="22.006289" + x="32.944744" + height="19.843748" + width="34.395836" + id="rect5020" + style="display:inline;opacity:0.68399999;fill:none;stroke:#000000;stroke-width:0.70555556;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + <text + id="text5024" + y="26.471132" + x="69.775566" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.23333311px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:sans-serif;letter-spacing:0px;word-spacing:0px;display:inline;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332" + xml:space="preserve"><tspan + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#ff6600;stroke-width:0.26458332" + y="26.471132" + x="69.775566" + id="tspan5022" + sodipodi:role="line">Computed output</tspan></text> + <path + inkscape:connector-curvature="0" + id="path5026" + d="m 15.746826,31.266705 h 15.875" + style="display:inline;fill:none;stroke:#000000;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#marker1970-7)" /> + <path + inkscape:connector-curvature="0" + id="path5028" + d="M 67.340579,31.266703 H 83.215587" + style="display:inline;fill:none;stroke:#000000;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#marker1970-6-1)" /> + <text + id="text5032" + y="32.223751" + x="87.083046" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;line-height:1.25;font-family:'DejaVu Sans';-inkscape-font-specification:'DejaVu Sans Bold';letter-spacing:0px;word-spacing:0px;display:inline;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332" + xml:space="preserve"><tspan + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:'DejaVu Sans Mono';-inkscape-font-specification:'DejaVu Sans Mono Bold';fill:#ff6600;stroke-width:0.26458332" + y="32.223751" + x="87.083046" + id="tspan5030" + sodipodi:role="line">true</tspan></text> + <path + inkscape:connector-curvature="0" + id="path5034" + d="m 101.86457,31.266703 h 15.87501" + style="display:inline;fill:none;stroke:#000000;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#marker1970-6-6-4)" /> + <path + sodipodi:nodetypes="cc" + inkscape:connector-curvature="0" + id="path5036" + d="M 62.177074,50.417991 H 117.73958" + style="display:inline;fill:none;stroke:#000000;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#marker1970-6-0-5)" /> + <text + id="text5040" + y="41.85004" + x="124.35416" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;line-height:1.25;font-family:'DejaVu Sans';-inkscape-font-specification:'DejaVu Sans Bold';letter-spacing:0px;word-spacing:0px;display:inline;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332" + xml:space="preserve"><tspan + style="stroke-width:0.26458332" + y="41.85004" + x="124.35416" + id="tspan5038" + sodipodi:role="line">==</tspan></text> + <text + id="text5044" + y="43.11301" + x="149.18571" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;line-height:1.25;font-family:'DejaVu Sans';-inkscape-font-specification:'DejaVu Sans Bold';letter-spacing:0px;word-spacing:0px;display:inline;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332" + xml:space="preserve"><tspan + style="fill:#008000;stroke-width:0.26458332" + y="43.11301" + x="149.18571" + id="tspan5042" + sodipodi:role="line">Success</tspan></text> + <text + id="text5052" + y="27.047838" + x="6.2259684" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;line-height:1.25;font-family:'DejaVu Sans';-inkscape-font-specification:'DejaVu Sans Bold';letter-spacing:0px;word-spacing:0px;display:inline;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332" + xml:space="preserve"><tspan + style="stroke-width:0.26458332" + y="27.047838" + x="6.2259684" + id="tspan5050" + sodipodi:role="line"><tspan + id="tspan5046" + style="fill:#800080;stroke-width:0.26458332">Input: </tspan><tspan + id="tspan5048" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:'DejaVu Sans Mono';-inkscape-font-specification:'DejaVu Sans Mono Bold';fill:#800080;stroke-width:0.26458332">7</tspan></tspan></text> + <text + id="text5060" + y="50.86034" + x="6.2259684" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;line-height:1.25;font-family:'DejaVu Sans';-inkscape-font-specification:'DejaVu Sans Bold';letter-spacing:0px;word-spacing:0px;display:inline;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332" + xml:space="preserve"><tspan + style="stroke-width:0.26458332" + y="50.86034" + x="6.2259684" + id="tspan5058" + sodipodi:role="line"><tspan + id="tspan5054" + style="fill:#0000ff;stroke-width:0.26458332">Expected output:</tspan> <tspan + id="tspan5056" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:'DejaVu Sans Mono';-inkscape-font-specification:'DejaVu Sans Mono Bold';fill:#0000ff;stroke-width:0.26458332">true</tspan></tspan></text> + </g> + <g + inkscape:groupmode="layer" + id="g3892" + inkscape:label="Layer 090" + style="display:none" + transform="translate(-1.4239073,-3.324251)"> + <path + inkscape:connector-curvature="0" + id="path3840" + d="M 121.70833,27.297953 V 56.402122 L 146.84375,41.850039 Z" + style="display:inline;fill:none;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /> + <text + id="text3844" + y="29.191378" + x="35.201977" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.23333311px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:sans-serif;letter-spacing:0px;word-spacing:0px;display:inline;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332" + xml:space="preserve"><tspan + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';stroke-width:0.26458332" + y="29.191378" + x="35.201977" + id="tspan3842" + sodipodi:role="line">Method</tspan></text> + <text + id="text3848" + y="36.000271" + x="35.294994" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;line-height:1.25;font-family:'DejaVu Sans Mono';-inkscape-font-specification:'DejaVu Sans Mono Bold';letter-spacing:0px;word-spacing:0px;display:inline;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332" + xml:space="preserve"><tspan + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:'DejaVu Sans Mono';-inkscape-font-specification:'DejaVu Sans Mono Bold';stroke-width:0.26458332" + y="36.000271" + x="35.294994" + id="tspan3846" + sodipodi:role="line">isPrime(...)</tspan></text> + <rect + ry="1.3229153" + y="22.006289" + x="32.944744" + height="19.843748" + width="34.395836" + id="rect3850" + style="display:inline;opacity:0.68399999;fill:none;stroke:#000000;stroke-width:0.70555556;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + <text + id="text3854" + y="26.471132" + x="69.775566" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.23333311px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:sans-serif;letter-spacing:0px;word-spacing:0px;display:inline;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332" + xml:space="preserve"><tspan + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#ff6600;stroke-width:0.26458332" + y="26.471132" + x="69.775566" + id="tspan3852" + sodipodi:role="line">Computed output</tspan></text> + <path + inkscape:connector-curvature="0" + id="path3856" + d="m 15.746826,31.266705 h 15.875" + style="display:inline;fill:none;stroke:#000000;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#marker1970-7)" /> + <path + inkscape:connector-curvature="0" + id="path3858" + d="M 67.340579,31.266703 H 83.215587" + style="display:inline;fill:none;stroke:#000000;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#marker1970-6-1)" /> + <text + id="text3862" + y="32.223751" + x="87.083046" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;line-height:1.25;font-family:'DejaVu Sans';-inkscape-font-specification:'DejaVu Sans Bold';letter-spacing:0px;word-spacing:0px;display:inline;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332" + xml:space="preserve"><tspan + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:'DejaVu Sans Mono';-inkscape-font-specification:'DejaVu Sans Mono Bold';fill:#ff6600;stroke-width:0.26458332" + y="32.223751" + x="87.083046" + id="tspan3860" + sodipodi:role="line">true</tspan></text> + <path + inkscape:connector-curvature="0" + id="path3864" + d="m 101.86457,31.266703 h 15.87501" + style="display:inline;fill:none;stroke:#000000;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#marker1970-6-6-4)" /> + <path + sodipodi:nodetypes="cc" + inkscape:connector-curvature="0" + id="path3866" + d="M 62.177074,50.417991 H 117.73958" + style="display:inline;fill:none;stroke:#000000;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#marker1970-6-0-5)" /> + <text + id="text3870" + y="41.85004" + x="124.35416" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;line-height:1.25;font-family:'DejaVu Sans';-inkscape-font-specification:'DejaVu Sans Bold';letter-spacing:0px;word-spacing:0px;display:inline;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332" + xml:space="preserve"><tspan + style="stroke-width:0.26458332" + y="41.85004" + x="124.35416" + id="tspan3868" + sodipodi:role="line">==</tspan></text> + <text + id="text3882" + y="27.047838" + x="6.2259684" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;line-height:1.25;font-family:'DejaVu Sans';-inkscape-font-specification:'DejaVu Sans Bold';letter-spacing:0px;word-spacing:0px;display:inline;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332" + xml:space="preserve"><tspan + style="stroke-width:0.26458332" + y="27.047838" + x="6.2259684" + id="tspan3880" + sodipodi:role="line"><tspan + id="tspan3876" + style="fill:#800080;stroke-width:0.26458332">Input: </tspan><tspan + id="tspan3878" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:'DejaVu Sans Mono';-inkscape-font-specification:'DejaVu Sans Mono Bold';fill:#800080;stroke-width:0.26458332">7</tspan></tspan></text> + <text + id="text3890" + y="50.86034" + x="6.2259684" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;line-height:1.25;font-family:'DejaVu Sans';-inkscape-font-specification:'DejaVu Sans Bold';letter-spacing:0px;word-spacing:0px;display:inline;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332" + xml:space="preserve"><tspan + style="stroke-width:0.26458332" + y="50.86034" + x="6.2259684" + id="tspan3888" + sodipodi:role="line"><tspan + id="tspan3884" + style="fill:#0000ff;stroke-width:0.26458332">Expected output:</tspan> <tspan + id="tspan3886" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:'DejaVu Sans Mono';-inkscape-font-specification:'DejaVu Sans Mono Bold';fill:#0000ff;stroke-width:0.26458332">true</tspan></tspan></text> + </g> + <g + transform="translate(-1.4239073,-3.324251)" + style="display:none" + inkscape:label="Layer 080" + id="g3942" + inkscape:groupmode="layer"> + <text + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.23333311px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:sans-serif;letter-spacing:0px;word-spacing:0px;display:inline;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332" + x="35.201977" + y="29.191378" + id="text3898"><tspan + sodipodi:role="line" + id="tspan3896" + x="35.201977" + y="29.191378" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';stroke-width:0.26458332">Method</tspan></text> + <text + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;line-height:1.25;font-family:'DejaVu Sans Mono';-inkscape-font-specification:'DejaVu Sans Mono Bold';letter-spacing:0px;word-spacing:0px;display:inline;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332" + x="35.294994" + y="36.000271" + id="text3902"><tspan + sodipodi:role="line" + id="tspan3900" + x="35.294994" + y="36.000271" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:'DejaVu Sans Mono';-inkscape-font-specification:'DejaVu Sans Mono Bold';stroke-width:0.26458332">isPrime(...)</tspan></text> + <rect + style="display:inline;opacity:0.68399999;fill:none;stroke:#000000;stroke-width:0.70555556;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + id="rect3904" + width="34.395836" + height="19.843748" + x="32.944744" + y="22.006289" + ry="1.3229153" /> + <text + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.23333311px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:sans-serif;letter-spacing:0px;word-spacing:0px;display:inline;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332" + x="69.775566" + y="26.471132" + id="text3908"><tspan + sodipodi:role="line" + id="tspan3906" + x="69.775566" + y="26.471132" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#ff6600;stroke-width:0.26458332">Computed output</tspan></text> + <path + style="display:inline;fill:none;stroke:#000000;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#marker1970-7)" + d="m 15.746826,31.266705 h 15.875" + id="path3910" + inkscape:connector-curvature="0" /> + <path + style="display:inline;fill:none;stroke:#000000;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#marker1970-6-1)" + d="M 67.340579,31.266703 H 83.215587" + id="path3912" + inkscape:connector-curvature="0" /> + <text + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;line-height:1.25;font-family:'DejaVu Sans';-inkscape-font-specification:'DejaVu Sans Bold';letter-spacing:0px;word-spacing:0px;display:inline;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332" + x="87.083046" + y="32.223751" + id="text3916"><tspan + sodipodi:role="line" + id="tspan3914" + x="87.083046" + y="32.223751" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:'DejaVu Sans Mono';-inkscape-font-specification:'DejaVu Sans Mono Bold';fill:#ff6600;stroke-width:0.26458332">true</tspan></text> + <text + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;line-height:1.25;font-family:'DejaVu Sans';-inkscape-font-specification:'DejaVu Sans Bold';letter-spacing:0px;word-spacing:0px;display:inline;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332" + x="6.2259684" + y="27.047838" + id="text3932"><tspan + sodipodi:role="line" + id="tspan3930" + x="6.2259684" + y="27.047838" + style="stroke-width:0.26458332"><tspan + style="fill:#800080;stroke-width:0.26458332" + id="tspan3926">Input: </tspan><tspan + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:'DejaVu Sans Mono';-inkscape-font-specification:'DejaVu Sans Mono Bold';fill:#800080;stroke-width:0.26458332" + id="tspan3928">7</tspan></tspan></text> + </g> + <g + inkscape:groupmode="layer" + id="g4468" + inkscape:label="Layer 070" + style="display:none" + transform="translate(-1.4239073,-3.324251)"> + <text + id="text4440" + y="29.191378" + x="35.201977" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.23333311px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:sans-serif;letter-spacing:0px;word-spacing:0px;display:inline;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332" + xml:space="preserve"><tspan + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';stroke-width:0.26458332" + y="29.191378" + x="35.201977" + id="tspan4438" + sodipodi:role="line">Method</tspan></text> + <text + id="text4444" + y="36.000271" + x="35.294994" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;line-height:1.25;font-family:'DejaVu Sans Mono';-inkscape-font-specification:'DejaVu Sans Mono Bold';letter-spacing:0px;word-spacing:0px;display:inline;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332" + xml:space="preserve"><tspan + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:'DejaVu Sans Mono';-inkscape-font-specification:'DejaVu Sans Mono Bold';stroke-width:0.26458332" + y="36.000271" + x="35.294994" + id="tspan4442" + sodipodi:role="line">isPrime(...)</tspan></text> + <rect + ry="1.3229153" + y="22.006289" + x="32.944744" + height="19.843748" + width="34.395836" + id="rect4446" + style="display:inline;opacity:0.68399999;fill:none;stroke:#000000;stroke-width:0.70555556;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + <path + inkscape:connector-curvature="0" + id="path4452" + d="m 15.746826,31.266705 h 15.875" + style="display:inline;fill:none;stroke:#000000;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#marker1970-7)" /> + <text + id="text4466" + y="27.047838" + x="6.2259684" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;line-height:1.25;font-family:'DejaVu Sans';-inkscape-font-specification:'DejaVu Sans Bold';letter-spacing:0px;word-spacing:0px;display:inline;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332" + xml:space="preserve"><tspan + style="stroke-width:0.26458332" + y="27.047838" + x="6.2259684" + id="tspan4464" + sodipodi:role="line"><tspan + id="tspan4460" + style="fill:#800080;stroke-width:0.26458332">Input: </tspan><tspan + id="tspan4462" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:'DejaVu Sans Mono';-inkscape-font-specification:'DejaVu Sans Mono Bold';fill:#800080;stroke-width:0.26458332">7</tspan></tspan></text> + </g> + <g + transform="translate(-1.4239073,-3.324251)" + style="display:none" + inkscape:label="Layer 060" + id="g4746" + inkscape:groupmode="layer"> + <text + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.23333311px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:sans-serif;letter-spacing:0px;word-spacing:0px;display:inline;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332" + x="35.201977" + y="29.191378" + id="text4728"><tspan + sodipodi:role="line" + id="tspan4726" + x="35.201977" + y="29.191378" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';stroke-width:0.26458332">Method</tspan></text> + <text + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;line-height:1.25;font-family:'DejaVu Sans Mono';-inkscape-font-specification:'DejaVu Sans Mono Bold';letter-spacing:0px;word-spacing:0px;display:inline;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332" + x="35.294994" + y="36.000271" + id="text4732"><tspan + sodipodi:role="line" + id="tspan4730" + x="35.294994" + y="36.000271" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:'DejaVu Sans Mono';-inkscape-font-specification:'DejaVu Sans Mono Bold';stroke-width:0.26458332">isPrime(...)</tspan></text> + <rect + style="display:inline;opacity:0.68399999;fill:none;stroke:#000000;stroke-width:0.70555556;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + id="rect4734" + width="34.395836" + height="19.843748" + x="32.944744" + y="22.006289" + ry="1.3229153" /> + </g> + <g + ns1:masterSlide="masterSlide" + transform="translate(-14.010514,-36.232287)" + inkscape:label="Master" + inkscape:groupmode="layer" + id="layer1" + style="display:inline" + sodipodi:insensitive="true"> + <text + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.23333311px;line-height:1.25;font-family:'DejaVu Sans Mono';-inkscape-font-specification:'DejaVu Sans Mono';letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332" + x="160.75327" + y="74.065605" + id="text2361"><tspan + sodipodi:role="line" + id="tspan2359" + x="160.75327" + y="77.811111" + style="stroke-width:0.26458332" /></text> + <text + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.23333311px;line-height:1.25;font-family:'DejaVu Sans Mono';-inkscape-font-specification:'DejaVu Sans Mono';letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332" + x="84.024094" + y="31.732275" + id="text4260"><tspan + sodipodi:role="line" + id="tspan4258" + x="84.024094" + y="35.477783" + style="stroke-width:0.26458332" /><tspan + sodipodi:role="line" + x="84.024094" + y="40.769447" + style="stroke-width:0.26458332" + id="tspan4262" /></text> + <text + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;line-height:1.25;font-family:'DejaVu Sans';-inkscape-font-specification:'DejaVu Sans Bold';letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332" + x="16.16674" + y="42.886116" + id="text1924"><tspan + sodipodi:role="line" + id="tspan1922" + x="16.16674" + y="42.886116" + style="stroke-width:0.26458332">Testing method <tspan + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:'DejaVu Sans Mono';-inkscape-font-specification:'DejaVu Sans Mono Bold'" + id="tspan3493">isPrime(int n)</tspan></tspan></text> + </g> +</svg> diff --git a/Doc/Sd1/objectsClasses.xml b/Doc/Sd1/objectsClasses.xml index 3d64a2620..064ea8e2b 100644 --- a/Doc/Sd1/objectsClasses.xml +++ b/Doc/Sd1/objectsClasses.xml @@ -4276,7 +4276,7 @@ System.out.println("Club's headcount:" + <emphasis role="red">john.</emphasis>ge <para>This is actually a regression with respect to the <code language="java">static</code> class method variant since the number of club members in fact does not depend on any - individual member instance. </para> + individual member instance.</para> <para>We may reveal this changes futility by:</para> @@ -10531,12 +10531,8 @@ public class Prime { </calloutlist> </figure> - <para>The <code language="java">static</code> method - <methodname>getFirstNegative(...)</methodname> may be executed from an - arbitrary context:</para> - <figure xml:id="sd1_fig_firstNegMethodExecFrmMain"> - <title>Obviously execution yet flawed</title> + <title>Execution yet being flawed</title> <programlisting language="java">for (int i = 1; i < 20;i++) { System.out.println(i + " is " + (Prime.isPrime(i) ? " a " : " not a ") @@ -10551,6 +10547,16 @@ public class Prime { ...</screen> </figure> + <figure xml:id="sd1_fig_unitTestPrinciple"> + <title>Unit test principle</title> + + <mediaobject> + <imageobject> + <imagedata fileref="Ref/ObjectsAndClasses/Tests/unitTest.multi.svg"/> + </imageobject> + </mediaobject> + </figure> + <figure xml:id="sd1_fig_SpecificationExamples"> <title>Sample test data</title> @@ -10668,7 +10674,7 @@ public class Prime { <para>Any methods not being annotated by <classname xlink:href="https://junit.org/junit4/javadoc/latest/org/junit/Test.html">@Test</classname> will not be called by the <xref linkend="glo_Junit"/> framework. - They may however be called by e.g. + They may however be called indirectly by test methods e.g. <methodname>test_1_isNotPrime()</methodname> thus acting as helper methods.</para> </callout> @@ -10677,7 +10683,7 @@ public class Prime { <figure xml:id="sd1_fig_testSkeletonImplementationIde"> <title><xref linkend="glo_Junit"/> skeleton test result (<xref - linkend="glo_Maven"/> CLI)</title> + linkend="glo_Maven"/> <abbrev>CLI</abbrev>)</title> <screen>goik@goiki Prime_v01> mvn test ... @@ -10803,10 +10809,13 @@ Results : <emphasis role="red">Tests run: 5, Failures: 0, Errors: 0</emphasis>, Skipped: 0</screen> </figure> - <figure xml:id="sd1_fig_primeV1Observe"> - <title>Implementation observation</title> + <section xml:id="sd1_sect_junitPrimBetterImpl"> + <title>Improving the algorithm</title> + + <figure xml:id="sd1_fig_primeV1Observe"> + <title>Implementation observation</title> - <screen><emphasis role="red">101 / 2 = 50.5 + <screen><emphasis role="red">101 / 2 = 50.5 101 / 3 = 33.6... 101 / 4 = 25.25 101 / 5 = 20.20 @@ -10819,12 +10828,12 @@ Results : 101 / 12 = 8.4... 101 / 13 = 7.7... ...</screen> - </figure> + </figure> - <figure xml:id="sd1_fig_primeV2Implemet"> - <title>Changing the implementation</title> + <figure xml:id="sd1_fig_primeV2Implemet"> + <title>Changing the implementation</title> - <programlisting language="none">public static boolean isPrime(int value) { + <programlisting language="none">public static boolean isPrime(int value) { for (int i = 2; <emphasis role="red">i * i < value</emphasis>; i++) { if (0 == value % i) { return false; @@ -10832,23 +10841,23 @@ Results : } return value != 1; }</programlisting> - </figure> + </figure> - <figure xml:id="sd1_fig_primeRegressionTest"> - <title>Regression test</title> + <figure xml:id="sd1_fig_primeRegressionTest"> + <title>Regression test</title> - <mediaobject> - <imageobject> - <imagedata fileref="Ref/ObjectsAndClasses/Tests/ideaTestV2Error.svg"/> - </imageobject> - </mediaobject> - </figure> + <mediaobject> + <imageobject> + <imagedata fileref="Ref/ObjectsAndClasses/Tests/ideaTestV2Error.svg"/> + </imageobject> + </mediaobject> + </figure> - <figure xml:id="sd1_fig_primeV2ImplementCorrect"> - <title>Correcting the implementation</title> + <figure xml:id="sd1_fig_primeV2ImplementCorrect"> + <title>Correcting the implementation</title> - <programlisting language="none">public static boolean <link - xlink:href="https://gitlab.mi.hdm-stuttgart.de/goik/GoikLectures/blob/master/Doc/Sd1/Ref/ObjectsAndClasses/Tests/Prime_v02/src/main/java/de/hdm_stuttgart/mi/sd1/Prime.java">isPrime</link>(int value) { + <programlisting language="none">public static boolean <link + xlink:href="https://gitlab.mi.hdm-stuttgart.de/goik/GoikLectures/blob/master/Doc/Sd1/Ref/ObjectsAndClasses/Tests/Prime_v02/src/main/java/de/hdm_stuttgart/mi/sd1/Prime.java">isPrime</link>(int value) { for (int i = 2; i * i <emphasis role="red"><=</emphasis> value; i++) { if (0 == value % i) { return false; @@ -10856,96 +10865,100 @@ Results : } return value != 1; }</programlisting> - </figure> + </figure> - <figure xml:id="sd1_fig_primeRegressionTestFinal"> - <title>Repeating regression test</title> + <figure xml:id="sd1_fig_primeRegressionTestFinal"> + <title>Repeating regression test</title> - <mediaobject> - <imageobject> - <imagedata fileref="Ref/ObjectsAndClasses/Tests/ideaTestV2Corrected.svg"/> - </imageobject> - </mediaobject> - </figure> + <mediaobject> + <imageobject> + <imagedata fileref="Ref/ObjectsAndClasses/Tests/ideaTestV2Corrected.svg"/> + </imageobject> + </mediaobject> + </figure> + </section> - <figure xml:id="sd1_fig_availableResultMethods"> - <title>Available comparison methods</title> + <section xml:id="sd1_sect_junitDetails"> + <title><xref linkend="glo_Junit"/>, important details</title> - <itemizedlist> - <listitem> - <para><methodname - xlink:href="http://junit.org/junit4/javadoc/latest/org/junit/Assert.html">assertEquals([String - message],...)</methodname></para> - </listitem> + <figure xml:id="sd1_fig_availableResultMethods"> + <title>Available comparison methods</title> - <listitem> - <para><methodname - xlink:href="http://junit.org/junit4/javadoc/latest/org/junit/Assert.html">assertArrayEquals([String - message],...)</methodname></para> - </listitem> + <itemizedlist> + <listitem> + <para><methodname + xlink:href="http://junit.org/junit4/javadoc/latest/org/junit/Assert.html">assertEquals([String + message],...)</methodname></para> + </listitem> - <listitem> - <para><methodname - xlink:href="http://junit.org/junit4/javadoc/latest/org/junit/Assert.html">assertFalse([String - message],...)</methodname></para> - </listitem> + <listitem> + <para><methodname + xlink:href="http://junit.org/junit4/javadoc/latest/org/junit/Assert.html">assertArrayEquals([String + message],...)</methodname></para> + </listitem> - <listitem> - <para><methodname - xlink:href="http://junit.org/junit4/javadoc/latest/org/junit/Assert.html">assertNotEquals([String - message],...)</methodname></para> - </listitem> + <listitem> + <para><methodname + xlink:href="http://junit.org/junit4/javadoc/latest/org/junit/Assert.html">assertFalse([String + message],...)</methodname></para> + </listitem> - <listitem> - <para><methodname - xlink:href="http://junit.org/junit4/javadoc/latest/org/junit/Assert.html">assertNull([String - message],...)</methodname></para> - </listitem> + <listitem> + <para><methodname + xlink:href="http://junit.org/junit4/javadoc/latest/org/junit/Assert.html">assertNotEquals([String + message],...)</methodname></para> + </listitem> - <listitem> - <para><methodname - xlink:href="http://junit.org/junit4/javadoc/latest/org/junit/Assert.html">fail([String - message],...)</methodname></para> - </listitem> - </itemizedlist> - </figure> + <listitem> + <para><methodname + xlink:href="http://junit.org/junit4/javadoc/latest/org/junit/Assert.html">assertNull([String + message],...)</methodname></para> + </listitem> + + <listitem> + <para><methodname + xlink:href="http://junit.org/junit4/javadoc/latest/org/junit/Assert.html">fail([String + message],...)</methodname></para> + </listitem> + </itemizedlist> + </figure> - <figure xml:id="sd1_fig_equalsDoubleCaveat"> - <title>Caution comparing <code language="java">float</code> / <code - language="java">double</code> !!</title> + <figure xml:id="sd1_fig_equalsDoubleCaveat"> + <title>Caution comparing <code language="java">float</code> / <code + language="java">double</code> !!</title> - <mediaobject> - <imageobject> - <imagedata fileref="Ref/ObjectsAndClasses/Tests/cautionEqualsDouble.png"/> - </imageobject> - </mediaobject> - </figure> + <mediaobject> + <imageobject> + <imagedata fileref="Ref/ObjectsAndClasses/Tests/cautionEqualsDouble.png"/> + </imageobject> + </mediaobject> + </figure> - <figure xml:id="sd1_fig_equalsDoubleCaveatResult"> - <title>Weird arithmetics?</title> + <figure xml:id="sd1_fig_equalsDoubleCaveatResult"> + <title>Weird arithmetics?</title> - <screen>java.lang.AssertionError: <emphasis role="red">Use assertEquals(expected, actual, delta)</emphasis> + <screen>java.lang.AssertionError: <emphasis role="red">Use assertEquals(expected, actual, delta)</emphasis> to compare floating-point numbers at org.junit.Assert.assertEquals(Assert.java:656) at qq.doubleCompareTest.test1_3(<emphasis role="red">doubleCompareTest.java:15</emphasis>) ...</screen> - </figure> + </figure> - <figure xml:id="sd1_fig_equalsDoubleCaveatUnderlyingProblem"> - <title>Limited representation precision</title> + <figure xml:id="sd1_fig_equalsDoubleCaveatUnderlyingProblem"> + <title>Limited representation precision</title> - <programlisting language="java">System.out.println("3.6 - 3 * 1.2 == " + (3.6 - 3 * 1.2));</programlisting> + <programlisting language="java">System.out.println("3.6 - 3 * 1.2 == " + (3.6 - 3 * 1.2));</programlisting> - <para>Result:</para> + <para>Result:</para> - <screen>3.6 - 3 * 1.2 == 4.440892098500626E-16</screen> - </figure> + <screen>3.6 - 3 * 1.2 == 4.440892098500626E-16</screen> + </figure> - <figure xml:id="sd1_fig_equalsDoubleSolve"> - <title>Solving the issue</title> + <figure xml:id="sd1_fig_equalsDoubleSolve"> + <title>Solving the issue</title> - <programlisting language="java">public class doubleCompareTest { + <programlisting language="java">public class doubleCompareTest { static final double delta = 1E-15; /** * Comparing 3.6 and 3 * 1.2 within delta's limit @@ -10955,22 +10968,22 @@ at qq.doubleCompareTest.test1_3(<emphasis role="red">doubleCompareTest.java:15</ Assert.assertEquals(3.6, 3 * 1.2 , delta); } }</programlisting> - </figure> + </figure> - <qandaset defaultlabel="qanda" xml:id="sd1QandaSumInteger"> - <title>Summing up integers to a given limit</title> + <qandaset defaultlabel="qanda" xml:id="sd1QandaSumInteger"> + <title>Summing up integers to a given limit</title> - <qandadiv> - <qandaentry> - <question> - <para>Suppose an arbitrary number n is given e.g n=5. We want to - compute the sum of all integers ranging from 1 to 5:</para> + <qandadiv> + <qandaentry> + <question> + <para>Suppose an arbitrary number n is given e.g n=5. We want to + compute the sum of all integers ranging from 1 to 5:</para> - <para>1 + 2 + 3 + 4 + 5 = 15</para> + <para>1 + 2 + 3 + 4 + 5 = 15</para> - <para>Implement the following method by using a loop:</para> + <para>Implement the following method by using a loop:</para> - <programlisting language="java">/** + <programlisting language="java">/** * Summing up all integers starting from 0 up to and including a given limit * Example: Let the limit be 5, then the result is 1 + 2 + 3 + 4 + 5 * @@ -10981,25 +10994,25 @@ public static long getSum (int limit) { ... }</programlisting> - <para>For the sake of getting used to it write some unit tests - beforehand.</para> + <para>For the sake of getting used to it write some unit tests + beforehand.</para> - <para>BTW: Is it possible to avoid the loop completely achieving - the same result?</para> - </question> + <para>BTW: Is it possible to avoid the loop completely achieving + the same result?</para> + </question> - <answer> - <para>The solution's class - <classname>de.hdm_stuttgart.de.sd1.sum.Summing</classname> is - being contained within:</para> + <answer> + <para>The solution's class + <classname>de.hdm_stuttgart.de.sd1.sum.Summing</classname> is + being contained within:</para> - <annotation role="make"> - <para role="eclipse">Sd1/summing/V1</para> - </annotation> + <annotation role="make"> + <para role="eclipse">Sd1/summing/V1</para> + </annotation> - <para>We start by defining unit tests beforehand:</para> + <para>We start by defining unit tests beforehand:</para> - <programlisting language="java">/** + <programlisting language="java">/** * Testing negative values and zero. */ @Test @@ -11019,92 +11032,93 @@ public static long getSum (int limit) { assertEquals(2147450880, Summing.getSum(65535));// Highest Integer.MAX_VALUE compatible value }</programlisting> - <para>The crucial part here is determining 1 + 2 + ... + 65535 - being equal to 2147450880. Legend has it the young <personname - xlink:href="https://en.wikipedia.org/wiki/Carl_Friedrich_Gauss">Carl - Friedrich Gauss</personname> at school was asked summing up 1 + 2 - + ... + 99 + 100. His teacher was keen for some peaceful time but - the young pupil decided otherwise:</para> + <para>The crucial part here is determining 1 + 2 + ... + 65535 + being equal to 2147450880. Legend has it the young <personname + xlink:href="https://en.wikipedia.org/wiki/Carl_Friedrich_Gauss">Carl + Friedrich Gauss</personname> at school was asked summing up 1 + + 2 + ... + 99 + 100. His teacher was keen for some peaceful time + but the young pupil decided otherwise:</para> - <informalequation> - <mathphrase>$\underbrace{1 + \underbrace{2 + \underbrace{3 + - \dots + 98}_{101} + 99}_{101} + 100}_{101}$</mathphrase> - </informalequation> + <informalequation> + <mathphrase>$\underbrace{1 + \underbrace{2 + \underbrace{3 + + \dots + 98}_{101} + 99}_{101} + 100}_{101}$</mathphrase> + </informalequation> - <para>Since there are 50 such terms the result is <inlineequation> - <m:math display="inline"> - <m:mrow> + <para>Since there are 50 such terms the result is + <inlineequation> + <m:math display="inline"> <m:mrow> - <m:mi>50</m:mi> + <m:mrow> + <m:mi>50</m:mi> - <m:mo>×</m:mo> + <m:mo>×</m:mo> - <m:mi>101</m:mi> - </m:mrow> + <m:mi>101</m:mi> + </m:mrow> - <m:mo>=</m:mo> + <m:mo>=</m:mo> - <m:mi>5050</m:mi> - </m:mrow> - </m:math> - </inlineequation>. Generalizing this example we have:</para> + <m:mi>5050</m:mi> + </m:mrow> + </m:math> + </inlineequation>. Generalizing this example we have:</para> - <informalequation> - <m:math display="block"> - <m:mrow> + <informalequation> + <m:math display="block"> <m:mrow> - <m:munderover> - <m:mo>∑</m:mo> - - <m:mrow> - <m:mi>i</m:mi> - - <m:mo>=</m:mo> + <m:mrow> + <m:munderover> + <m:mo>∑</m:mo> - <m:mi>1</m:mi> - </m:mrow> + <m:mrow> + <m:mi>i</m:mi> - <m:mi>n</m:mi> - </m:munderover> + <m:mo>=</m:mo> - <m:mi>i</m:mi> - </m:mrow> + <m:mi>1</m:mi> + </m:mrow> - <m:mo>=</m:mo> + <m:mi>n</m:mi> + </m:munderover> - <m:mfrac> - <m:mrow> - <m:mi>n</m:mi> + <m:mi>i</m:mi> + </m:mrow> - <m:mo>â¢</m:mo> + <m:mo>=</m:mo> + <m:mfrac> <m:mrow> - <m:mo>(</m:mo> + <m:mi>n</m:mi> + + <m:mo>â¢</m:mo> <m:mrow> - <m:mi>n</m:mi> + <m:mo>(</m:mo> - <m:mo>+</m:mo> + <m:mrow> + <m:mi>n</m:mi> - <m:mi>1</m:mi> - </m:mrow> + <m:mo>+</m:mo> - <m:mo>)</m:mo> + <m:mi>1</m:mi> + </m:mrow> + + <m:mo>)</m:mo> + </m:mrow> </m:mrow> - </m:mrow> - <m:mi>2</m:mi> - </m:mfrac> - </m:mrow> - </m:math> - </informalequation> + <m:mi>2</m:mi> + </m:mfrac> + </m:mrow> + </m:math> + </informalequation> - <para>For the current exercise we do not make use of this. Instead - we implement <link - xlink:href="P/Sd1/summing/target/site/apidocs/de/hdm_stuttgart/sd1/sum/Summing.html#getSum-int-">Summing.getSum(...)</link> - by coding a loop:</para> + <para>For the current exercise we do not make use of this. + Instead we implement <link + xlink:href="P/Sd1/summing/target/site/apidocs/de/hdm_stuttgart/sd1/sum/Summing.html#getSum-int-">Summing.getSum(...)</link> + by coding a loop:</para> - <programlisting language="java">/** + <programlisting language="java">/** * Summing up all integers starting from 0 up to and including a given limit * Example: Let the limit be 5, then the result is 1 + 2 + 3 + 4 + 5 * @@ -11120,82 +11134,82 @@ public static long getSum (int limit) { } }</programlisting> - <para>This passes all tests.</para> - </answer> - </qandaentry> - </qandadiv> - </qandaset> + <para>This passes all tests.</para> + </answer> + </qandaentry> + </qandadiv> + </qandaset> - <qandaset defaultlabel="qanda" xml:id="sd1QandaSumIntegerGauss"> - <title>Summing up, the better way</title> + <qandaset defaultlabel="qanda" xml:id="sd1QandaSumIntegerGauss"> + <title>Summing up, the better way</title> - <qandadiv> - <qandaentry> - <question> - <para>The previous solution of <xref - linkend="sd1QandaSumInteger"/> suffers from a performance issue. - When dealing with large values like 65535 looping will take some - time:</para> + <qandadiv> + <qandaentry> + <question> + <para>The previous solution of <xref + linkend="sd1QandaSumInteger"/> suffers from a performance issue. + When dealing with large values like 65535 looping will take some + time:</para> - <programlisting language="java">long start = System.nanoTime(); + <programlisting language="java">long start = System.nanoTime(); System.out.println("1 + 2 + ... + 65535" + "=" + getSum(65535)); long end = System.nanoTime(); System.out.println("Elapsed time: " + (end - start) + " nanoseconds");</programlisting> - <screen>1 + 2 + ... + 65535=2147450880 + <screen>1 + 2 + ... + 65535=2147450880 Elapsed time: 1169805 nanoseconds</screen> - <para>Barely more than one millisecond seems to be acceptable. But - using the method for calculations inside some tight loop this - might have a serious negative performance impact.</para> + <para>Barely more than one millisecond seems to be acceptable. + But using the method for calculations inside some tight loop + this might have a serious negative performance impact.</para> - <para>Thus implement a better (quicker) solution avoiding the loop - by using the explicit form. When you are finished re-estimate - execution time and compare the result to the previous - solution.</para> + <para>Thus implement a better (quicker) solution avoiding the + loop by using the explicit form. When you are finished + re-estimate execution time and compare the result to the + previous solution.</para> - <para>Provide unit tests and take care of larger values. What is - the largest possible value? Test it as well!</para> + <para>Provide unit tests and take care of larger values. What is + the largest possible value? Test it as well!</para> - <tip> - <para>Read <quote - xlink:href="https://betterexplained.com/articles/techniques-for-adding-the-numbers-1-to-100">Techniques - for Adding the Numbers 1 to 100</quote>.</para> - </tip> - </question> + <tip> + <para>Read <quote + xlink:href="https://betterexplained.com/articles/techniques-for-adding-the-numbers-1-to-100">Techniques + for Adding the Numbers 1 to 100</quote>.</para> + </tip> + </question> - <answer> - <para>The solution's class - <classname>de.hdm_stuttgart.de.sd1.sum.Summing</classname> is - being contained within:</para> + <answer> + <para>The solution's class + <classname>de.hdm_stuttgart.de.sd1.sum.Summing</classname> is + being contained within:</para> - <annotation role="make"> - <para role="eclipse">Sd1/summing/V2</para> - </annotation> + <annotation role="make"> + <para role="eclipse">Sd1/summing/V2</para> + </annotation> - <para>Since only our implementation changes we reuse our existing - unit tests. Our first straightforward implementation attempt - reads:</para> + <para>Since only our implementation changes we reuse our + existing unit tests. Our first straightforward implementation + attempt reads:</para> - <programlisting language="java" linenumbering="unnumbered">public static long getSum (int limit) { + <programlisting language="java" linenumbering="unnumbered">public static long getSum (int limit) { return limit * (limit + 1) / 2; }</programlisting> - <para>This fails both unit tests. The first error happens - at:</para> + <para>This fails both unit tests. The first error happens + at:</para> - <programlisting language="java" linenumbering="unnumbered">assertEquals(0, Summing.getSum(-5));</programlisting> + <programlisting language="java" linenumbering="unnumbered">assertEquals(0, Summing.getSum(-5));</programlisting> - <screen>java.lang.AssertionError: + <screen>java.lang.AssertionError: Expected :0 Actual :10</screen> - <para>We forgot to deal with negative <code - language="java">limit</code> values. Our sum is supposed to start - with 0 so negative <code language="java">limit</code> values - should yield 0 like in our loop based solution:</para> + <para>We forgot to deal with negative <code + language="java">limit</code> values. Our sum is supposed to + start with 0 so negative <code language="java">limit</code> + values should yield 0 like in our loop based solution:</para> - <programlisting language="java">public static long getSum(int limit) { + <programlisting language="java">public static long getSum(int limit) { if (limit < 0) { return 0; } else { @@ -11203,29 +11217,29 @@ Actual :10</screen> } }</programlisting> - <para>This helps but one test still fails:</para> + <para>This helps but one test still fails:</para> - <programlisting language="java">assertEquals(2147450880, Summing.getSumUsingGauss(65535));</programlisting> + <programlisting language="java">assertEquals(2147450880, Summing.getSumUsingGauss(65535));</programlisting> - <screen>java.lang.AssertionError: + <screen>java.lang.AssertionError: Expected :2147450880 Actual :-32768</screen> - <para>This actually is a showstopper for large <code - language="java">limit</code> values: The algebraic value of <code - language="java">limit * (limit + 1) / 2</code> might still fit - into an <code language="java">int</code>. But <code - language="java">limit * (limit + 1)</code> itself not yet divided - by 2 may exceed <code language="java" - xlink:href="https://docs.oracle.com/javase/10/docs/api/java/lang/Integer.html#MAX_VALUE">Integer.MAX_VALUE</code>. - Since the multiplication happens prior to dividing by 2 we see - this overflow error happen.</para> - - <para>Solving this issue requires changing the order of operations - avoiding arithmetic overflow. Unfortunately the following simple - solution does not work either:</para> - - <programlisting language="java">public static long getSum(int limit) { + <para>This actually is a showstopper for large <code + language="java">limit</code> values: The algebraic value of + <code language="java">limit * (limit + 1) / 2</code> might still + fit into an <code language="java">int</code>. But <code + language="java">limit * (limit + 1)</code> itself not yet + divided by 2 may exceed <code language="java" + xlink:href="https://docs.oracle.com/javase/10/docs/api/java/lang/Integer.html#MAX_VALUE">Integer.MAX_VALUE</code>. + Since the multiplication happens prior to dividing by 2 we see + this overflow error happen.</para> + + <para>Solving this issue requires changing the order of + operations avoiding arithmetic overflow. Unfortunately the + following simple solution does not work either:</para> + + <programlisting language="java">public static long getSum(int limit) { if (limit < 0) { return 0; } else { @@ -11233,15 +11247,15 @@ Actual :-32768</screen> } }</programlisting> - <para>This is only correct if <code language="java">limit</code> - is even. Otherwise division by 2 leaves us with a remainder of - 1.</para> + <para>This is only correct if <code language="java">limit</code> + is even. Otherwise division by 2 leaves us with a remainder of + 1.</para> - <para>However if <code language="java">limit</code> is uneven the - second factor <code language="java">limit + 1</code> will be even. - This observation leads us to the final solution:</para> + <para>However if <code language="java">limit</code> is uneven + the second factor <code language="java">limit + 1</code> will be + even. This observation leads us to the final solution:</para> - <programlisting language="java">public static long getSum(int limit) { + <programlisting language="java">public static long getSum(int limit) { if (limit < 0) { return 0; } else if (0 == limit % 2){ // even limit, divide by 2 @@ -11251,18 +11265,19 @@ Actual :-32768</screen> } }</programlisting> - <para>This passes all tests. We finally reconsider execution - time:</para> + <para>This passes all tests. We finally reconsider execution + time:</para> - <screen>1 + 2 + ... + 65535=2147450880 + <screen>1 + 2 + ... + 65535=2147450880 Elapsed time: 25422 nanoseconds</screen> - <para>Thus execution is roughly 46 times faster compared to the - loop based approach. This is not surprising since loop execution - is expensive in terms of performance.</para> - </answer> - </qandaentry> - </qandadiv> - </qandaset> + <para>Thus execution is roughly 46 times faster compared to the + loop based approach. This is not surprising since loop execution + is expensive in terms of performance.</para> + </answer> + </qandaentry> + </qandadiv> + </qandaset> + </section> </section> </chapter> -- GitLab