Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Added notEquals in Interface & NormalInterval.class

Added other==null Abfrage in Vergleichsmethoden
Ersetzt value!=value abfrage durch isNaN(value)

Signed-off-by: Jan Menzel <menzel.jm@googlemail.com>
  • Loading branch information...
commit 0b246e073cbf28e710569fee787501b5c6f30a20 1 parent b858ce6
Jan Menzel jmenzel authored
2  Aufgabe 1/build/built-jar.properties
... ... @@ -1,4 +1,4 @@
1   -#Wed, 11 Apr 2012 00:31:54 +0200
  1 +#Wed, 11 Apr 2012 11:17:57 +0200
2 2
3 3
4 4 C\:\\Users\\jmenzel\\Desktop\\AD\\AD-2012-SS\\Aufgabe\ 1=
BIN  Aufgabe 1/build/classes/adintervall/Interval.class
Binary file not shown
BIN  Aufgabe 1/build/classes/adintervall/NormalInterval.class
Binary file not shown
48 Aufgabe 1/build/test/results/TEST-adintervall.IntervalTest.xml
... ... @@ -1,5 +1,5 @@
1 1 <?xml version="1.0" encoding="UTF-8" ?>
2   -<testsuite errors="0" failures="0" hostname="JMRotable" name="adintervall.IntervalTest" tests="32" time="1.126" timestamp="2012-04-10T22:31:55">
  2 +<testsuite errors="0" failures="0" hostname="JMRotable" name="adintervall.IntervalTest" tests="32" time="1.045" timestamp="2012-04-11T09:17:58">
3 3 <properties>
4 4 <property name="default.javac.source" value="1.7" />
5 5 <property name="file.encoding.pkg" value="sun.io" />
@@ -87,7 +87,7 @@
87 87 <property name="libs.JAXB-ENDORSED.src" value="" />
88 88 <property name="libs.hibernate-persistence.javadoc" value="" />
89 89 <property name="libs.ejb3-persistence.classpath" value="C:\Program Files\NetBeans 7.1.1\java\modules\ext\hibernate\ejb3-persistence.jar" />
90   - <property name="sun.java.command" value="org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner adintervall.IntervalTest filtertrace=true haltOnError=false haltOnFailure=false showoutput=true outputtoformatters=true logfailedtests=true logtestlistenerevents=true formatter=org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,C:\Users\jmenzel\Desktop\AD\AD-2012-SS\Aufgabe 1\build\test\results\TEST-adintervall.IntervalTest.xml crashfile=C:\Users\jmenzel\Desktop\AD\AD-2012-SS\Aufgabe 1\build\junitvmwatcher4042027188331098864.properties propsfile=C:\Users\jmenzel\Desktop\AD\AD-2012-SS\Aufgabe 1\build\junit3257400384706943449.properties" />
  90 + <property name="sun.java.command" value="org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner adintervall.IntervalTest filtertrace=true haltOnError=false haltOnFailure=false showoutput=true outputtoformatters=true logfailedtests=true logtestlistenerevents=true formatter=org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,C:\Users\jmenzel\Desktop\AD\AD-2012-SS\Aufgabe 1\build\test\results\TEST-adintervall.IntervalTest.xml crashfile=C:\Users\jmenzel\Desktop\AD\AD-2012-SS\Aufgabe 1\build\junitvmwatcher7600552025313819518.properties propsfile=C:\Users\jmenzel\Desktop\AD\AD-2012-SS\Aufgabe 1\build\junit1783206424951819278.properties" />
91 91 <property name="built-jar.properties" value="C:\Users\jmenzel\Desktop\AD\AD-2012-SS\Aufgabe 1\build\built-jar.properties" />
92 92 <property name="ant.file.type.ADIntervall-impl" value="file" />
93 93 <property name="libs.junit.src" value="" />
@@ -284,37 +284,37 @@
284 284 <property name="mkdist.disabled" value="false" />
285 285 <property name="sun.arch.data.model" value="64" />
286 286 </properties>
287   - <testcase classname="adintervall.IntervalTest" name="testFactory" time="0.008" />
288   - <testcase classname="adintervall.IntervalTest" name="testContains" time="0.001" />
289   - <testcase classname="adintervall.IntervalTest" name="testEquals" time="0.002" />
290   - <testcase classname="adintervall.IntervalTest" name="testLength" time="0.075" />
291   - <testcase classname="adintervall.IntervalTest" name="testPlus" time="0.372" />
292   - <testcase classname="adintervall.IntervalTest" name="testMinus" time="0.148" />
293   - <testcase classname="adintervall.IntervalTest" name="testMul" time="0.166" />
294   - <testcase classname="adintervall.IntervalTest" name="testDiv" time="0.029" />
295   - <testcase classname="adintervall.IntervalTest" name="testnewNai" time="0.001" />
  287 + <testcase classname="adintervall.IntervalTest" name="testFactory" time="0.015" />
  288 + <testcase classname="adintervall.IntervalTest" name="testContains" time="0.0" />
  289 + <testcase classname="adintervall.IntervalTest" name="testEquals" time="0.016" />
  290 + <testcase classname="adintervall.IntervalTest" name="testLength" time="0.062" />
  291 + <testcase classname="adintervall.IntervalTest" name="testPlus" time="0.359" />
  292 + <testcase classname="adintervall.IntervalTest" name="testMinus" time="0.141" />
  293 + <testcase classname="adintervall.IntervalTest" name="testMul" time="0.202" />
  294 + <testcase classname="adintervall.IntervalTest" name="testDiv" time="0.032" />
  295 + <testcase classname="adintervall.IntervalTest" name="testnewNai" time="0.0" />
296 296 <testcase classname="adintervall.IntervalTest" name="testKomm" time="0.0" />
297   - <testcase classname="adintervall.IntervalTest" name="testUnion" time="0.001" />
  297 + <testcase classname="adintervall.IntervalTest" name="testUnion" time="0.0" />
298 298 <testcase classname="adintervall.IntervalTest" name="test_less" time="0.0" />
299   - <testcase classname="adintervall.IntervalTest" name="test_greater" time="0.001" />
300   - <testcase classname="adintervall.IntervalTest" name="test_pLess" time="0.001" />
  299 + <testcase classname="adintervall.IntervalTest" name="test_greater" time="0.0" />
  300 + <testcase classname="adintervall.IntervalTest" name="test_pLess" time="0.0" />
301 301 <testcase classname="adintervall.IntervalTest" name="test_less_d" time="0.0" />
302   - <testcase classname="adintervall.IntervalTest" name="test_pLess_d" time="0.001" />
303   - <testcase classname="adintervall.IntervalTest" name="test_square" time="0.001" />
304   - <testcase classname="adintervall.IntervalTest" name="testequalsnew" time="0.001" />
305   - <testcase classname="adintervall.IntervalTest" name="get_bounds_test" time="0.001" />
306   - <testcase classname="adintervall.IntervalTest" name="testIntersection" time="0.002" />
307   - <testcase classname="adintervall.IntervalTest" name="testDifference" time="0.002" />
308   - <testcase classname="adintervall.IntervalTest" name="test_lessEqual" time="0.001" />
  302 + <testcase classname="adintervall.IntervalTest" name="test_pLess_d" time="0.0" />
  303 + <testcase classname="adintervall.IntervalTest" name="test_square" time="0.0" />
  304 + <testcase classname="adintervall.IntervalTest" name="testequalsnew" time="0.0" />
  305 + <testcase classname="adintervall.IntervalTest" name="get_bounds_test" time="0.0" />
  306 + <testcase classname="adintervall.IntervalTest" name="testIntersection" time="0.0" />
  307 + <testcase classname="adintervall.IntervalTest" name="testDifference" time="0.0" />
  308 + <testcase classname="adintervall.IntervalTest" name="test_lessEqual" time="0.0" />
309 309 <testcase classname="adintervall.IntervalTest" name="test_greaterEqual" time="0.0" />
310   - <testcase classname="adintervall.IntervalTest" name="test_pLessEqual" time="0.001" />
  310 + <testcase classname="adintervall.IntervalTest" name="test_pLessEqual" time="0.0" />
311 311 <testcase classname="adintervall.IntervalTest" name="test_pGreater" time="0.0" />
312 312 <testcase classname="adintervall.IntervalTest" name="test_pGreaterEqual" time="0.0" />
313 313 <testcase classname="adintervall.IntervalTest" name="test_lessEqual_d" time="0.0" />
314 314 <testcase classname="adintervall.IntervalTest" name="test_greater_d" time="0.0" />
315   - <testcase classname="adintervall.IntervalTest" name="test_greaterEqual_d" time="0.001" />
  315 + <testcase classname="adintervall.IntervalTest" name="test_greaterEqual_d" time="0.0" />
316 316 <testcase classname="adintervall.IntervalTest" name="test_pLessEqual_d" time="0.0" />
317   - <testcase classname="adintervall.IntervalTest" name="test_pGreater_d" time="0.002" />
  317 + <testcase classname="adintervall.IntervalTest" name="test_pGreater_d" time="0.0" />
318 318 <testcase classname="adintervall.IntervalTest" name="test_pGreaterEqual_d" time="0.0" />
319 319 <system-out><![CDATA[#-- Testing Factory --#
320 320 FactoryInterval.createInterval(NaN) => [ NaN , NaN ]
4 Aufgabe 1/src/adintervall/Interval.java
@@ -19,7 +19,9 @@
19 19
20 20 @Override
21 21 boolean equals(Object other);
22   -
  22 +
  23 + boolean notEquals(Object other);
  24 +
23 25 double length();
24 26
25 27
31 Aufgabe 1/src/adintervall/NormalInterval.java
@@ -33,9 +33,7 @@ public double length() {
33 33
34 34 @Override
35 35 public Boolean contains(double value) {
36   - if (value != value) {
37   - return false;
38   - }
  36 + if(isNaN(value)) return false;
39 37 return this.lowerbound <= value && value <= this.upperbound;
40 38 }
41 39
@@ -133,7 +131,14 @@ public String toString(){
133 131 }
134 132
135 133 @Override
136   - public boolean equals(Object o){
  134 + public boolean notEquals(Object o)
  135 + {
  136 + return !this.equals(o);
  137 + }
  138 +
  139 + @Override
  140 + public boolean equals(Object o)
  141 + {
137 142
138 143 if(this == Interval.NaI || ((Interval)o) == Interval.NaI)
139 144 {
@@ -147,8 +152,6 @@ public boolean equals(Object o){
147 152 return false;
148 153 }
149 154
150   -
151   -
152 155 if (o instanceof Double) {
153 156 return (this.lowerbound == (double) o && this.upperbound == (double) o);
154 157 } else if (o instanceof Interval) {
@@ -272,56 +275,56 @@ public Interval square() {
272 275
273 276 @Override
274 277 public Boolean less(Interval other) {
275   - if (this == Interval.NaI || other == Interval.NaI)
  278 + if (other == null || this == Interval.NaI || other == Interval.NaI)
276 279 return false;
277 280 return this.upperbound < other.getLowerBound();
278 281 }
279 282
280 283 @Override
281 284 public Boolean lessEqual(Interval other) {
282   - if (this == Interval.NaI || other == Interval.NaI)
  285 + if (other == null || this == Interval.NaI || other == Interval.NaI)
283 286 return false;
284 287 return this.upperbound <= other.getLowerBound();
285 288 }
286 289
287 290 @Override
288 291 public Boolean greater(Interval other) {
289   - if (this == Interval.NaI || other == Interval.NaI)
  292 + if (other == null || this == Interval.NaI || other == Interval.NaI)
290 293 return false;
291 294 return this.lowerbound > other.getUpperBound();
292 295 }
293 296
294 297 @Override
295 298 public Boolean greaterEqual(Interval other) {
296   - if (this == Interval.NaI || other == Interval.NaI)
  299 + if (other == null || this == Interval.NaI || other == Interval.NaI)
297 300 return false;
298 301 return this.lowerbound >= other.getUpperBound();
299 302 }
300 303
301 304 @Override
302 305 public Boolean pLess(Interval other) {
303   - if (this == Interval.NaI || other == Interval.NaI)
  306 + if (other == null || this == Interval.NaI || other == Interval.NaI)
304 307 return false;
305 308 return this.lowerbound < other.getUpperBound();
306 309 }
307 310
308 311 @Override
309 312 public Boolean pLessEqual(Interval other) {
310   - if (this == Interval.NaI || other == Interval.NaI)
  313 + if (other == null || this == Interval.NaI || other == Interval.NaI)
311 314 return false;
312 315 return this.lowerbound <= other.getUpperBound();
313 316 }
314 317
315 318 @Override
316 319 public Boolean pGreater(Interval other) {
317   - if (this == Interval.NaI || other == Interval.NaI)
  320 + if (other == null || this == Interval.NaI || other == Interval.NaI)
318 321 return false;
319 322 return this.upperbound > other.getLowerBound();
320 323 }
321 324
322 325 @Override
323 326 public Boolean pGreaterEqual(Interval other) {
324   - if (this == Interval.NaI || other == Interval.NaI)
  327 + if (other == null || this == Interval.NaI || other == Interval.NaI)
325 328 return false;
326 329 return this.upperbound >= other.getLowerBound();
327 330 }

0 comments on commit 0b246e0

Please sign in to comment.
Something went wrong with that request. Please try again.