chore(assets): Upload report assets
Some checks failed
Polyglot CI / tests (push) Has been cancelled
Some checks failed
Polyglot CI / tests (push) Has been cancelled
This commit is contained in:
parent
f013955bc2
commit
32cd6bcb21
119 changed files with 4531 additions and 1 deletions
|
|
@ -0,0 +1 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en"><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/><link rel="stylesheet" href="../jacoco-resources/report.css" type="text/css"/><link rel="shortcut icon" href="../jacoco-resources/report.gif" type="image/gif"/><title>AltitudeRange</title><script type="text/javascript" src="../jacoco-resources/sort.js"></script></head><body onload="initialSort(['breadcrumb'])"><div class="breadcrumb" id="breadcrumb"><span class="info"><a href="../jacoco-sessions.html" class="el_session">Sessions</a></span><a href="../index.html" class="el_report">ilp-coursework</a> > <a href="index.html" class="el_package">io.github.js0ny.ilp_coursework.data.common</a> > <span class="el_class">AltitudeRange</span></div><h1>AltitudeRange</h1><table class="coverage" cellspacing="0" id="coveragetable"><thead><tr><td class="sortable" id="a" onclick="toggleSort(this)">Element</td><td class="down sortable bar" id="b" onclick="toggleSort(this)">Missed Instructions</td><td class="sortable ctr2" id="c" onclick="toggleSort(this)">Cov.</td><td class="sortable bar" id="d" onclick="toggleSort(this)">Missed Branches</td><td class="sortable ctr2" id="e" onclick="toggleSort(this)">Cov.</td><td class="sortable ctr1" id="f" onclick="toggleSort(this)">Missed</td><td class="sortable ctr2" id="g" onclick="toggleSort(this)">Cxty</td><td class="sortable ctr1" id="h" onclick="toggleSort(this)">Missed</td><td class="sortable ctr2" id="i" onclick="toggleSort(this)">Lines</td><td class="sortable ctr1" id="j" onclick="toggleSort(this)">Missed</td><td class="sortable ctr2" id="k" onclick="toggleSort(this)">Methods</td></tr></thead><tfoot><tr><td>Total</td><td class="bar">0 of 9</td><td class="ctr2">100%</td><td class="bar">0 of 0</td><td class="ctr2">n/a</td><td class="ctr1">0</td><td class="ctr2">1</td><td class="ctr1">0</td><td class="ctr2">1</td><td class="ctr1">0</td><td class="ctr2">1</td></tr></tfoot><tbody><tr><td id="a0"><a href="AltitudeRange.java.html#L12" class="el_method">AltitudeRange(double, double)</a></td><td class="bar" id="b0"><img src="../jacoco-resources/greenbar.gif" width="120" height="10" title="9" alt="9"/></td><td class="ctr2" id="c0">100%</td><td class="bar" id="d0"/><td class="ctr2" id="e0">n/a</td><td class="ctr1" id="f0">0</td><td class="ctr2" id="g0">1</td><td class="ctr1" id="h0">0</td><td class="ctr2" id="i0">1</td><td class="ctr1" id="j0">0</td><td class="ctr2" id="k0">1</td></tr></tbody></table><div class="footer"><span class="right">Created with <a href="http://www.jacoco.org/jacoco">JaCoCo</a> 0.8.12.202403310830</span></div></body></html>
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en"><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/><link rel="stylesheet" href="../jacoco-resources/report.css" type="text/css"/><link rel="shortcut icon" href="../jacoco-resources/report.gif" type="image/gif"/><title>AltitudeRange.java</title><link rel="stylesheet" href="../jacoco-resources/prettify.css" type="text/css"/><script type="text/javascript" src="../jacoco-resources/prettify.js"></script></head><body onload="window['PR_TAB_WIDTH']=4;prettyPrint()"><div class="breadcrumb" id="breadcrumb"><span class="info"><a href="../jacoco-sessions.html" class="el_session">Sessions</a></span><a href="../index.html" class="el_report">ilp-coursework</a> > <a href="index.source.html" class="el_package">io.github.js0ny.ilp_coursework.data.common</a> > <span class="el_source">AltitudeRange.java</span></div><h1>AltitudeRange.java</h1><pre class="source lang-java linenums">package io.github.js0ny.ilp_coursework.data.common;
|
||||
|
||||
import io.github.js0ny.ilp_coursework.data.external.RestrictedArea;
|
||||
|
||||
/**
|
||||
* Represents a range of altitude values (that is a fly-zone in {@link RestrictedArea}).
|
||||
*
|
||||
* @param lower The lower bound of the altitude range.
|
||||
* @param upper The upper bound of the altitude range. If {@code upper = -1}, then the region is not
|
||||
* a fly zone.
|
||||
*/
|
||||
<span class="fc" id="L12">public record AltitudeRange(double lower, double upper) {}</span>
|
||||
</pre><div class="footer"><span class="right">Created with <a href="http://www.jacoco.org/jacoco">JaCoCo</a> 0.8.12.202403310830</span></div></body></html>
|
||||
File diff suppressed because one or more lines are too long
|
|
@ -0,0 +1,65 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en"><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/><link rel="stylesheet" href="../jacoco-resources/report.css" type="text/css"/><link rel="shortcut icon" href="../jacoco-resources/report.gif" type="image/gif"/><title>Angle.java</title><link rel="stylesheet" href="../jacoco-resources/prettify.css" type="text/css"/><script type="text/javascript" src="../jacoco-resources/prettify.js"></script></head><body onload="window['PR_TAB_WIDTH']=4;prettyPrint()"><div class="breadcrumb" id="breadcrumb"><span class="info"><a href="../jacoco-sessions.html" class="el_session">Sessions</a></span><a href="../index.html" class="el_report">ilp-coursework</a> > <a href="index.source.html" class="el_package">io.github.js0ny.ilp_coursework.data.common</a> > <span class="el_source">Angle.java</span></div><h1>Angle.java</h1><pre class="source lang-java linenums">package io.github.js0ny.ilp_coursework.data.common;
|
||||
|
||||
/**
|
||||
* Represents the data transfer object for angle
|
||||
*
|
||||
* @param val value of the angle in degrees
|
||||
*/
|
||||
public record Angle(double degrees) {
|
||||
private static final double STEP = 22.5;
|
||||
private static final double EPSILON = 1e-10;
|
||||
|
||||
<span class="fc" id="L12"> public Angle {</span>
|
||||
<span class="pc bpc" id="L13" title="1 of 4 branches missed."> if (degrees < 0 || degrees >= 360) {</span>
|
||||
<span class="fc" id="L14"> throw new IllegalArgumentException("Angle must be in range [0, 360). Got: " + degrees);</span>
|
||||
}
|
||||
|
||||
// Should be a multiple of 22.5 (one of the 16 major directions)
|
||||
<span class="fc" id="L18"> double remainder = degrees % STEP;</span>
|
||||
|
||||
// Floating point modulo may have tiny errors, e.g. 45.0 % 22.5 could be 0.0 or
|
||||
// 1.0e-15
|
||||
// So we need to check if the remainder is small enough, or close enough to STEP
|
||||
// (handling negative errors)
|
||||
<span class="pc bpc" id="L24" title="3 of 4 branches missed."> if (Math.abs(remainder) > EPSILON && Math.abs(remainder - STEP) > EPSILON) {</span>
|
||||
<span class="nc" id="L25"> throw new IllegalArgumentException(</span>
|
||||
"Angle must be a multiple of 22.5 (one of the 16 major directions). Got: "
|
||||
+ degrees);
|
||||
}
|
||||
<span class="fc" id="L29"> }</span>
|
||||
|
||||
public static Angle fromIndex(int index) {
|
||||
<span class="nc bnc" id="L32" title="All 4 branches missed."> if (index < 0 || index > 15) {</span>
|
||||
<span class="nc" id="L33"> throw new IllegalArgumentException("Direction index must be between 0 and 15");</span>
|
||||
}
|
||||
<span class="nc" id="L35"> return new Angle(index * STEP);</span>
|
||||
}
|
||||
|
||||
public static Angle snap(double rawAngle) {
|
||||
<span class="fc" id="L39"> double normalized = normalize(rawAngle);</span>
|
||||
<span class="fc" id="L40"> double snapped = Math.round(normalized / STEP) * STEP;</span>
|
||||
<span class="fc" id="L41"> return new Angle(normalize(snapped));</span>
|
||||
}
|
||||
|
||||
public Angle offset(int increments) {
|
||||
<span class="fc" id="L45"> double rotated = degrees + increments * STEP;</span>
|
||||
<span class="fc" id="L46"> return new Angle(normalize(rotated));</span>
|
||||
}
|
||||
|
||||
private static double normalize(double angle) {
|
||||
<span class="fc" id="L50"> double normalized = angle % 360;</span>
|
||||
<span class="fc bfc" id="L51" title="All 2 branches covered."> if (normalized < 0) {</span>
|
||||
<span class="fc" id="L52"> normalized += 360;</span>
|
||||
}
|
||||
<span class="fc" id="L54"> return normalized;</span>
|
||||
}
|
||||
|
||||
public static double toRadians(double degrees) {
|
||||
<span class="nc" id="L58"> return Math.toRadians(degrees);</span>
|
||||
}
|
||||
|
||||
public double toRadians() {
|
||||
<span class="fc" id="L62"> return Math.toRadians(degrees);</span>
|
||||
}
|
||||
}
|
||||
</pre><div class="footer"><span class="right">Created with <a href="http://www.jacoco.org/jacoco">JaCoCo</a> 0.8.12.202403310830</span></div></body></html>
|
||||
|
|
@ -0,0 +1 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en"><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/><link rel="stylesheet" href="../jacoco-resources/report.css" type="text/css"/><link rel="shortcut icon" href="../jacoco-resources/report.gif" type="image/gif"/><title>DroneAvailability</title><script type="text/javascript" src="../jacoco-resources/sort.js"></script></head><body onload="initialSort(['breadcrumb'])"><div class="breadcrumb" id="breadcrumb"><span class="info"><a href="../jacoco-sessions.html" class="el_session">Sessions</a></span><a href="../index.html" class="el_report">ilp-coursework</a> > <a href="index.html" class="el_package">io.github.js0ny.ilp_coursework.data.common</a> > <span class="el_class">DroneAvailability</span></div><h1>DroneAvailability</h1><table class="coverage" cellspacing="0" id="coveragetable"><thead><tr><td class="sortable" id="a" onclick="toggleSort(this)">Element</td><td class="down sortable bar" id="b" onclick="toggleSort(this)">Missed Instructions</td><td class="sortable ctr2" id="c" onclick="toggleSort(this)">Cov.</td><td class="sortable bar" id="d" onclick="toggleSort(this)">Missed Branches</td><td class="sortable ctr2" id="e" onclick="toggleSort(this)">Cov.</td><td class="sortable ctr1" id="f" onclick="toggleSort(this)">Missed</td><td class="sortable ctr2" id="g" onclick="toggleSort(this)">Cxty</td><td class="sortable ctr1" id="h" onclick="toggleSort(this)">Missed</td><td class="sortable ctr2" id="i" onclick="toggleSort(this)">Lines</td><td class="sortable ctr1" id="j" onclick="toggleSort(this)">Missed</td><td class="sortable ctr2" id="k" onclick="toggleSort(this)">Methods</td></tr></thead><tfoot><tr><td>Total</td><td class="bar">4 of 45</td><td class="ctr2">91%</td><td class="bar">4 of 8</td><td class="ctr2">50%</td><td class="ctr1">4</td><td class="ctr2">6</td><td class="ctr1">1</td><td class="ctr2">6</td><td class="ctr1">0</td><td class="ctr2">2</td></tr></tfoot><tbody><tr><td id="a0"><a href="DroneAvailability.java.html#L10" class="el_method">checkAvailability(DayOfWeek, LocalTime)</a></td><td class="bar" id="b0"><img src="../jacoco-resources/redbar.gif" width="13" height="10" title="4" alt="4"/><img src="../jacoco-resources/greenbar.gif" width="106" height="10" title="32" alt="32"/></td><td class="ctr2" id="c1">88%</td><td class="bar" id="d0"><img src="../jacoco-resources/redbar.gif" width="60" height="10" title="4" alt="4"/><img src="../jacoco-resources/greenbar.gif" width="60" height="10" title="4" alt="4"/></td><td class="ctr2" id="e0">50%</td><td class="ctr1" id="f0">4</td><td class="ctr2" id="g0">5</td><td class="ctr1" id="h0">1</td><td class="ctr2" id="i0">5</td><td class="ctr1" id="j0">0</td><td class="ctr2" id="k0">1</td></tr><tr><td id="a1"><a href="DroneAvailability.java.html#L6" class="el_method">DroneAvailability(String, TimeWindow[])</a></td><td class="bar" id="b1"><img src="../jacoco-resources/greenbar.gif" width="30" height="10" title="9" alt="9"/></td><td class="ctr2" id="c0">100%</td><td class="bar" id="d1"/><td class="ctr2" id="e1">n/a</td><td class="ctr1" id="f1">0</td><td class="ctr2" id="g1">1</td><td class="ctr1" id="h1">0</td><td class="ctr2" id="i1">1</td><td class="ctr1" id="j1">0</td><td class="ctr2" id="k1">1</td></tr></tbody></table><div class="footer"><span class="right">Created with <a href="http://www.jacoco.org/jacoco">JaCoCo</a> 0.8.12.202403310830</span></div></body></html>
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en"><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/><link rel="stylesheet" href="../jacoco-resources/report.css" type="text/css"/><link rel="shortcut icon" href="../jacoco-resources/report.gif" type="image/gif"/><title>DroneAvailability.java</title><link rel="stylesheet" href="../jacoco-resources/prettify.css" type="text/css"/><script type="text/javascript" src="../jacoco-resources/prettify.js"></script></head><body onload="window['PR_TAB_WIDTH']=4;prettyPrint()"><div class="breadcrumb" id="breadcrumb"><span class="info"><a href="../jacoco-sessions.html" class="el_session">Sessions</a></span><a href="../index.html" class="el_report">ilp-coursework</a> > <a href="index.source.html" class="el_package">io.github.js0ny.ilp_coursework.data.common</a> > <span class="el_source">DroneAvailability.java</span></div><h1>DroneAvailability.java</h1><pre class="source lang-java linenums">package io.github.js0ny.ilp_coursework.data.common;
|
||||
|
||||
import java.time.DayOfWeek;
|
||||
import java.time.LocalTime;
|
||||
|
||||
<span class="fc" id="L6">public record DroneAvailability(String id, TimeWindow[] availability) {</span>
|
||||
|
||||
public boolean checkAvailability(DayOfWeek day, LocalTime time) {
|
||||
|
||||
<span class="pc bpc" id="L10" title="1 of 2 branches missed."> for (var a : availability) {</span>
|
||||
<span class="pc bpc" id="L11" title="1 of 2 branches missed."> if (a.dayOfWeek().equals(day)) {</span>
|
||||
<span class="pc bpc" id="L12" title="2 of 4 branches missed."> if (!time.isBefore(a.from()) && !time.isAfter(a.until())) {</span>
|
||||
<span class="fc" id="L13"> return true;</span>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
<span class="nc" id="L18"> return false;</span>
|
||||
}
|
||||
}
|
||||
</pre><div class="footer"><span class="right">Created with <a href="http://www.jacoco.org/jacoco">JaCoCo</a> 0.8.12.202403310830</span></div></body></html>
|
||||
|
|
@ -0,0 +1 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en"><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/><link rel="stylesheet" href="../jacoco-resources/report.css" type="text/css"/><link rel="shortcut icon" href="../jacoco-resources/report.gif" type="image/gif"/><title>DroneCapability</title><script type="text/javascript" src="../jacoco-resources/sort.js"></script></head><body onload="initialSort(['breadcrumb'])"><div class="breadcrumb" id="breadcrumb"><span class="info"><a href="../jacoco-sessions.html" class="el_session">Sessions</a></span><a href="../index.html" class="el_report">ilp-coursework</a> > <a href="index.html" class="el_package">io.github.js0ny.ilp_coursework.data.common</a> > <span class="el_class">DroneCapability</span></div><h1>DroneCapability</h1><table class="coverage" cellspacing="0" id="coveragetable"><thead><tr><td class="sortable" id="a" onclick="toggleSort(this)">Element</td><td class="down sortable bar" id="b" onclick="toggleSort(this)">Missed Instructions</td><td class="sortable ctr2" id="c" onclick="toggleSort(this)">Cov.</td><td class="sortable bar" id="d" onclick="toggleSort(this)">Missed Branches</td><td class="sortable ctr2" id="e" onclick="toggleSort(this)">Cov.</td><td class="sortable ctr1" id="f" onclick="toggleSort(this)">Missed</td><td class="sortable ctr2" id="g" onclick="toggleSort(this)">Cxty</td><td class="sortable ctr1" id="h" onclick="toggleSort(this)">Missed</td><td class="sortable ctr2" id="i" onclick="toggleSort(this)">Lines</td><td class="sortable ctr1" id="j" onclick="toggleSort(this)">Missed</td><td class="sortable ctr2" id="k" onclick="toggleSort(this)">Methods</td></tr></thead><tfoot><tr><td>Total</td><td class="bar">0 of 24</td><td class="ctr2">100%</td><td class="bar">0 of 0</td><td class="ctr2">n/a</td><td class="ctr1">0</td><td class="ctr2">1</td><td class="ctr1">0</td><td class="ctr2">1</td><td class="ctr1">0</td><td class="ctr2">1</td></tr></tfoot><tbody><tr><td id="a0"><a href="DroneCapability.java.html#L3" class="el_method">DroneCapability(boolean, boolean, float, int, float, float, float)</a></td><td class="bar" id="b0"><img src="../jacoco-resources/greenbar.gif" width="120" height="10" title="24" alt="24"/></td><td class="ctr2" id="c0">100%</td><td class="bar" id="d0"/><td class="ctr2" id="e0">n/a</td><td class="ctr1" id="f0">0</td><td class="ctr2" id="g0">1</td><td class="ctr1" id="h0">0</td><td class="ctr2" id="i0">1</td><td class="ctr1" id="j0">0</td><td class="ctr2" id="k0">1</td></tr></tbody></table><div class="footer"><span class="right">Created with <a href="http://www.jacoco.org/jacoco">JaCoCo</a> 0.8.12.202403310830</span></div></body></html>
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en"><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/><link rel="stylesheet" href="../jacoco-resources/report.css" type="text/css"/><link rel="shortcut icon" href="../jacoco-resources/report.gif" type="image/gif"/><title>DroneCapability.java</title><link rel="stylesheet" href="../jacoco-resources/prettify.css" type="text/css"/><script type="text/javascript" src="../jacoco-resources/prettify.js"></script></head><body onload="window['PR_TAB_WIDTH']=4;prettyPrint()"><div class="breadcrumb" id="breadcrumb"><span class="info"><a href="../jacoco-sessions.html" class="el_session">Sessions</a></span><a href="../index.html" class="el_report">ilp-coursework</a> > <a href="index.source.html" class="el_package">io.github.js0ny.ilp_coursework.data.common</a> > <span class="el_source">DroneCapability.java</span></div><h1>DroneCapability.java</h1><pre class="source lang-java linenums">package io.github.js0ny.ilp_coursework.data.common;
|
||||
|
||||
<span class="fc" id="L3">public record DroneCapability(</span>
|
||||
boolean cooling,
|
||||
boolean heating,
|
||||
float capacity,
|
||||
int maxMoves,
|
||||
float costPerMove,
|
||||
float costInitial,
|
||||
float costFinal) {}
|
||||
</pre><div class="footer"><span class="right">Created with <a href="http://www.jacoco.org/jacoco">JaCoCo</a> 0.8.12.202403310830</span></div></body></html>
|
||||
|
|
@ -0,0 +1 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en"><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/><link rel="stylesheet" href="../jacoco-resources/report.css" type="text/css"/><link rel="shortcut icon" href="../jacoco-resources/report.gif" type="image/gif"/><title>DroneEvent</title><script type="text/javascript" src="../jacoco-resources/sort.js"></script></head><body onload="initialSort(['breadcrumb'])"><div class="breadcrumb" id="breadcrumb"><span class="info"><a href="../jacoco-sessions.html" class="el_session">Sessions</a></span><a href="../index.html" class="el_report">ilp-coursework</a> > <a href="index.html" class="el_package">io.github.js0ny.ilp_coursework.data.common</a> > <span class="el_class">DroneEvent</span></div><h1>DroneEvent</h1><table class="coverage" cellspacing="0" id="coveragetable"><thead><tr><td class="sortable" id="a" onclick="toggleSort(this)">Element</td><td class="down sortable bar" id="b" onclick="toggleSort(this)">Missed Instructions</td><td class="sortable ctr2" id="c" onclick="toggleSort(this)">Cov.</td><td class="sortable bar" id="d" onclick="toggleSort(this)">Missed Branches</td><td class="sortable ctr2" id="e" onclick="toggleSort(this)">Cov.</td><td class="sortable ctr1" id="f" onclick="toggleSort(this)">Missed</td><td class="sortable ctr2" id="g" onclick="toggleSort(this)">Cxty</td><td class="sortable ctr1" id="h" onclick="toggleSort(this)">Missed</td><td class="sortable ctr2" id="i" onclick="toggleSort(this)">Lines</td><td class="sortable ctr1" id="j" onclick="toggleSort(this)">Missed</td><td class="sortable ctr2" id="k" onclick="toggleSort(this)">Methods</td></tr></thead><tfoot><tr><td>Total</td><td class="bar">238 of 238</td><td class="ctr2">0%</td><td class="bar">20 of 20</td><td class="ctr2">0%</td><td class="ctr1">14</td><td class="ctr2">14</td><td class="ctr1">43</td><td class="ctr2">43</td><td class="ctr1">4</td><td class="ctr2">4</td></tr></tfoot><tbody><tr><td id="a3"><a href="DroneEvent.java.html#L72" class="el_method">fromPathResponseWithTimestamps(DeliveryPathResponse, Map)</a></td><td class="bar" id="b0"><img src="../jacoco-resources/redbar.gif" width="120" height="10" title="87" alt="87"/></td><td class="ctr2" id="c0">0%</td><td class="bar" id="d0"><img src="../jacoco-resources/redbar.gif" width="120" height="10" title="8" alt="8"/></td><td class="ctr2" id="e0">0%</td><td class="ctr1" id="f0">5</td><td class="ctr2" id="g0">5</td><td class="ctr1" id="h0">16</td><td class="ctr2" id="i0">16</td><td class="ctr1" id="j0">1</td><td class="ctr2" id="k0">1</td></tr><tr><td id="a2"><a href="DroneEvent.java.html#L52" class="el_method">fromPathResponseWithTimestamp(DeliveryPathResponse, LocalDateTime)</a></td><td class="bar" id="b1"><img src="../jacoco-resources/redbar.gif" width="96" height="10" title="70" alt="70"/></td><td class="ctr2" id="c1">0%</td><td class="bar" id="d1"><img src="../jacoco-resources/redbar.gif" width="90" height="10" title="6" alt="6"/></td><td class="ctr2" id="e1">0%</td><td class="ctr1" id="f1">4</td><td class="ctr2" id="g1">4</td><td class="ctr1" id="h1">14</td><td class="ctr2" id="i1">14</td><td class="ctr1" id="j1">1</td><td class="ctr2" id="k1">1</td></tr><tr><td id="a1"><a href="DroneEvent.java.html#L31" class="el_method">fromPathResponse(DeliveryPathResponse)</a></td><td class="bar" id="b2"><img src="../jacoco-resources/redbar.gif" width="91" height="10" title="66" alt="66"/></td><td class="ctr2" id="c2">0%</td><td class="bar" id="d2"><img src="../jacoco-resources/redbar.gif" width="90" height="10" title="6" alt="6"/></td><td class="ctr2" id="e2">0%</td><td class="ctr1" id="f2">4</td><td class="ctr2" id="g2">4</td><td class="ctr1" id="h2">12</td><td class="ctr2" id="i2">12</td><td class="ctr1" id="j2">1</td><td class="ctr2" id="k2">1</td></tr><tr><td id="a0"><a href="DroneEvent.java.html#L21" class="el_method">DroneEvent(String, double, double, String)</a></td><td class="bar" id="b3"><img src="../jacoco-resources/redbar.gif" width="20" height="10" title="15" alt="15"/></td><td class="ctr2" id="c3">0%</td><td class="bar" id="d3"/><td class="ctr2" id="e3">n/a</td><td class="ctr1" id="f3">1</td><td class="ctr2" id="g3">1</td><td class="ctr1" id="h3">1</td><td class="ctr2" id="i3">1</td><td class="ctr1" id="j3">1</td><td class="ctr2" id="k3">1</td></tr></tbody></table><div class="footer"><span class="right">Created with <a href="http://www.jacoco.org/jacoco">JaCoCo</a> 0.8.12.202403310830</span></div></body></html>
|
||||
|
|
@ -0,0 +1,93 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en"><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/><link rel="stylesheet" href="../jacoco-resources/report.css" type="text/css"/><link rel="shortcut icon" href="../jacoco-resources/report.gif" type="image/gif"/><title>DroneEvent.java</title><link rel="stylesheet" href="../jacoco-resources/prettify.css" type="text/css"/><script type="text/javascript" src="../jacoco-resources/prettify.js"></script></head><body onload="window['PR_TAB_WIDTH']=4;prettyPrint()"><div class="breadcrumb" id="breadcrumb"><span class="info"><a href="../jacoco-sessions.html" class="el_session">Sessions</a></span><a href="../index.html" class="el_report">ilp-coursework</a> > <a href="index.source.html" class="el_package">io.github.js0ny.ilp_coursework.data.common</a> > <span class="el_source">DroneEvent.java</span></div><h1>DroneEvent.java</h1><pre class="source lang-java linenums">package io.github.js0ny.ilp_coursework.data.common;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import io.github.js0ny.ilp_coursework.data.response.DeliveryPathResponse;
|
||||
|
||||
// Corresponding in Go
|
||||
//
|
||||
|
||||
/*
|
||||
* type DroneEvent struct {
|
||||
* DroneID string `json:"drone_id"`
|
||||
* Latitude float64 `json:"latitude"`
|
||||
* Longitude float64 `json:"longitude"`
|
||||
* Timestamp string `json:"timestamp"`
|
||||
* }
|
||||
*/
|
||||
|
||||
<span class="nc" id="L21">public record DroneEvent(</span>
|
||||
String droneId,
|
||||
double latitude,
|
||||
double longitude,
|
||||
String timestamp) {
|
||||
|
||||
final static int STEP = 1; // seconds between events
|
||||
// Helper method that converts from DeliveryPathResponse to List<DroneEvent>
|
||||
|
||||
public static List<DroneEvent> fromPathResponse(DeliveryPathResponse resp) {
|
||||
<span class="nc" id="L31"> List<DroneEvent> events = new java.util.ArrayList<>();</span>
|
||||
<span class="nc bnc" id="L32" title="All 2 branches missed."> for (var p : resp.dronePaths()) {</span>
|
||||
<span class="nc" id="L33"> String id = p.droneId() + "";</span>
|
||||
<span class="nc bnc" id="L34" title="All 2 branches missed."> for (var d : p.deliveries()) {</span>
|
||||
<span class="nc bnc" id="L35" title="All 2 branches missed."> for (var coord : d.flightPath()) {</span>
|
||||
<span class="nc" id="L36"> String timestamp = java.time.Instant.now().toString();</span>
|
||||
<span class="nc" id="L37"> events.add(new DroneEvent(</span>
|
||||
id,
|
||||
<span class="nc" id="L39"> coord.lat(),</span>
|
||||
<span class="nc" id="L40"> coord.lng(),</span>
|
||||
timestamp));
|
||||
<span class="nc" id="L42"> }</span>
|
||||
<span class="nc" id="L43"> }</span>
|
||||
}
|
||||
<span class="nc" id="L45"> return events;</span>
|
||||
}
|
||||
|
||||
// Helper method that converts from DeliveryPathResponse to List<DroneEvent>
|
||||
// with base timestamp
|
||||
public static List<DroneEvent> fromPathResponseWithTimestamp(DeliveryPathResponse resp,
|
||||
LocalDateTime baseTimestamp) {
|
||||
<span class="nc" id="L52"> List<DroneEvent> events = new java.util.ArrayList<>();</span>
|
||||
<span class="nc" id="L53"> java.time.LocalDateTime timestamp = baseTimestamp;</span>
|
||||
<span class="nc bnc" id="L54" title="All 2 branches missed."> for (var p : resp.dronePaths()) {</span>
|
||||
<span class="nc" id="L55"> String id = String.valueOf(p.droneId());</span>
|
||||
<span class="nc bnc" id="L56" title="All 2 branches missed."> for (var d : p.deliveries()) {</span>
|
||||
<span class="nc bnc" id="L57" title="All 2 branches missed."> for (var coord : d.flightPath()) {</span>
|
||||
<span class="nc" id="L58"> events.add(new DroneEvent(</span>
|
||||
id,
|
||||
<span class="nc" id="L60"> coord.lat(),</span>
|
||||
<span class="nc" id="L61"> coord.lng(),</span>
|
||||
<span class="nc" id="L62"> timestamp.toString()));</span>
|
||||
<span class="nc" id="L63"> timestamp = timestamp.plusSeconds(STEP); // Increment timestamp for each event</span>
|
||||
<span class="nc" id="L64"> }</span>
|
||||
<span class="nc" id="L65"> }</span>
|
||||
}
|
||||
<span class="nc" id="L67"> return events;</span>
|
||||
}
|
||||
|
||||
public static List<DroneEvent> fromPathResponseWithTimestamps(
|
||||
DeliveryPathResponse resp, Map<Integer, LocalDateTime> deliveryTimestamps) {
|
||||
<span class="nc" id="L72"> List<DroneEvent> events = new java.util.ArrayList<>();</span>
|
||||
<span class="nc bnc" id="L73" title="All 2 branches missed."> for (var p : resp.dronePaths()) {</span>
|
||||
<span class="nc" id="L74"> String id = String.valueOf(p.droneId());</span>
|
||||
<span class="nc bnc" id="L75" title="All 2 branches missed."> for (var d : p.deliveries()) {</span>
|
||||
<span class="nc" id="L76"> LocalDateTime timestamp = deliveryTimestamps.get(d.deliveryId());</span>
|
||||
// Fallback to current time if the delivery does not carry a timestamp.
|
||||
<span class="nc" id="L78"> System.out.println("Generated event for drone " + id + " at " + timestamp.toString());</span>
|
||||
<span class="nc bnc" id="L79" title="All 2 branches missed."> LocalDateTime current = timestamp != null ? timestamp : LocalDateTime.now();</span>
|
||||
<span class="nc bnc" id="L80" title="All 2 branches missed."> for (var coord : d.flightPath()) {</span>
|
||||
<span class="nc" id="L81"> events.add(new DroneEvent(</span>
|
||||
id,
|
||||
<span class="nc" id="L83"> coord.lat(),</span>
|
||||
<span class="nc" id="L84"> coord.lng(),</span>
|
||||
<span class="nc" id="L85"> current.toString()));</span>
|
||||
<span class="nc" id="L86"> current = current.plusSeconds(STEP);</span>
|
||||
<span class="nc" id="L87"> }</span>
|
||||
<span class="nc" id="L88"> }</span>
|
||||
}
|
||||
<span class="nc" id="L90"> return events;</span>
|
||||
}
|
||||
}
|
||||
</pre><div class="footer"><span class="right">Created with <a href="http://www.jacoco.org/jacoco">JaCoCo</a> 0.8.12.202403310830</span></div></body></html>
|
||||
|
|
@ -0,0 +1 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en"><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/><link rel="stylesheet" href="../jacoco-resources/report.css" type="text/css"/><link rel="shortcut icon" href="../jacoco-resources/report.gif" type="image/gif"/><title>LngLat</title><script type="text/javascript" src="../jacoco-resources/sort.js"></script></head><body onload="initialSort(['breadcrumb'])"><div class="breadcrumb" id="breadcrumb"><span class="info"><a href="../jacoco-sessions.html" class="el_session">Sessions</a></span><a href="../index.html" class="el_report">ilp-coursework</a> > <a href="index.html" class="el_package">io.github.js0ny.ilp_coursework.data.common</a> > <span class="el_class">LngLat</span></div><h1>LngLat</h1><table class="coverage" cellspacing="0" id="coveragetable"><thead><tr><td class="sortable" id="a" onclick="toggleSort(this)">Element</td><td class="down sortable bar" id="b" onclick="toggleSort(this)">Missed Instructions</td><td class="sortable ctr2" id="c" onclick="toggleSort(this)">Cov.</td><td class="sortable bar" id="d" onclick="toggleSort(this)">Missed Branches</td><td class="sortable ctr2" id="e" onclick="toggleSort(this)">Cov.</td><td class="sortable ctr1" id="f" onclick="toggleSort(this)">Missed</td><td class="sortable ctr2" id="g" onclick="toggleSort(this)">Cxty</td><td class="sortable ctr1" id="h" onclick="toggleSort(this)">Missed</td><td class="sortable ctr2" id="i" onclick="toggleSort(this)">Lines</td><td class="sortable ctr1" id="j" onclick="toggleSort(this)">Missed</td><td class="sortable ctr2" id="k" onclick="toggleSort(this)">Methods</td></tr></thead><tfoot><tr><td>Total</td><td class="bar">8 of 70</td><td class="ctr2">88%</td><td class="bar">5 of 14</td><td class="ctr2">64%</td><td class="ctr1">5</td><td class="ctr2">10</td><td class="ctr1">2</td><td class="ctr2">11</td><td class="ctr1">0</td><td class="ctr2">3</td></tr></tfoot><tbody><tr><td id="a1"><a href="LngLat.java.html#L13" class="el_method">LngLat(double, double)</a></td><td class="bar" id="b0"><img src="../jacoco-resources/redbar.gif" width="19" height="10" title="6" alt="6"/><img src="../jacoco-resources/greenbar.gif" width="100" height="10" title="31" alt="31"/></td><td class="ctr2" id="c2">83%</td><td class="bar" id="d0"><img src="../jacoco-resources/redbar.gif" width="45" height="10" title="3" alt="3"/><img src="../jacoco-resources/greenbar.gif" width="75" height="10" title="5" alt="5"/></td><td class="ctr2" id="e1">62%</td><td class="ctr1" id="f0">3</td><td class="ctr2" id="g0">5</td><td class="ctr1" id="h0">1</td><td class="ctr2" id="i0">6</td><td class="ctr1" id="j0">0</td><td class="ctr2" id="k0">1</td></tr><tr><td id="a0"><a href="LngLat.java.html#L30" class="el_method">isSamePoint(LngLat)</a></td><td class="bar" id="b1"><img src="../jacoco-resources/redbar.gif" width="6" height="10" title="2" alt="2"/><img src="../jacoco-resources/greenbar.gif" width="77" height="10" title="24" alt="24"/></td><td class="ctr2" id="c1">92%</td><td class="bar" id="d1"><img src="../jacoco-resources/redbar.gif" width="30" height="10" title="2" alt="2"/><img src="../jacoco-resources/greenbar.gif" width="60" height="10" title="4" alt="4"/></td><td class="ctr2" id="e0">66%</td><td class="ctr1" id="f1">2</td><td class="ctr2" id="g1">4</td><td class="ctr1" id="h1">1</td><td class="ctr2" id="i1">3</td><td class="ctr1" id="j1">0</td><td class="ctr2" id="k1">1</td></tr><tr><td id="a2"><a href="LngLat.java.html#L26" class="el_method">LngLat(LngLatAlt)</a></td><td class="bar" id="b2"><img src="../jacoco-resources/greenbar.gif" width="22" height="10" title="7" alt="7"/></td><td class="ctr2" id="c0">100%</td><td class="bar" id="d2"/><td class="ctr2" id="e2">n/a</td><td class="ctr1" id="f2">0</td><td class="ctr2" id="g2">1</td><td class="ctr1" id="h2">0</td><td class="ctr2" id="i2">2</td><td class="ctr1" id="j2">0</td><td class="ctr2" id="k2">1</td></tr></tbody></table><div class="footer"><span class="right">Created with <a href="http://www.jacoco.org/jacoco">JaCoCo</a> 0.8.12.202403310830</span></div></body></html>
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en"><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/><link rel="stylesheet" href="../jacoco-resources/report.css" type="text/css"/><link rel="shortcut icon" href="../jacoco-resources/report.gif" type="image/gif"/><title>LngLat.java</title><link rel="stylesheet" href="../jacoco-resources/prettify.css" type="text/css"/><script type="text/javascript" src="../jacoco-resources/prettify.js"></script></head><body onload="window['PR_TAB_WIDTH']=4;prettyPrint()"><div class="breadcrumb" id="breadcrumb"><span class="info"><a href="../jacoco-sessions.html" class="el_session">Sessions</a></span><a href="../index.html" class="el_report">ilp-coursework</a> > <a href="index.source.html" class="el_package">io.github.js0ny.ilp_coursework.data.common</a> > <span class="el_source">LngLat.java</span></div><h1>LngLat.java</h1><pre class="source lang-java linenums">package io.github.js0ny.ilp_coursework.data.common;
|
||||
|
||||
/**
|
||||
* Represents the data transfer object for a point or coordinate that defines by a longitude and
|
||||
* latitude
|
||||
*
|
||||
* @param lng longitude of the coordinate/point
|
||||
* @param lat latitude of the coordinate/point
|
||||
*/
|
||||
public record LngLat(double lng, double lat) {
|
||||
private static final double EPSILON = 1e-9;
|
||||
|
||||
<span class="fc" id="L13"> public LngLat {</span>
|
||||
<span class="pc bpc" id="L14" title="1 of 4 branches missed."> if (lat < -90 || lat > 90) {</span>
|
||||
<span class="fc" id="L15"> throw new IllegalArgumentException(</span>
|
||||
"Latitude must be between -90 and +90 degrees. Got: " + lat);
|
||||
}
|
||||
|
||||
<span class="pc bpc" id="L19" title="2 of 4 branches missed."> if (lng < -180 || lng > 180) {</span>
|
||||
<span class="nc" id="L20"> throw new IllegalArgumentException(</span>
|
||||
"Longitude must be between -180 and +180 degrees. Got: " + lng);
|
||||
}
|
||||
<span class="fc" id="L23"> }</span>
|
||||
|
||||
public LngLat(LngLatAlt coord) {
|
||||
<span class="fc" id="L26"> this(coord.lng(), coord.lat());</span>
|
||||
<span class="fc" id="L27"> }</span>
|
||||
|
||||
public boolean isSamePoint(LngLat other) {
|
||||
<span class="pc bpc" id="L30" title="1 of 2 branches missed."> if (other == null) {</span>
|
||||
<span class="nc" id="L31"> return false;</span>
|
||||
}
|
||||
<span class="pc bpc" id="L33" title="1 of 4 branches missed."> return (Math.abs(lng - other.lng()) < EPSILON && Math.abs(lat - other.lat()) < EPSILON);</span>
|
||||
}
|
||||
}
|
||||
</pre><div class="footer"><span class="right">Created with <a href="http://www.jacoco.org/jacoco">JaCoCo</a> 0.8.12.202403310830</span></div></body></html>
|
||||
|
|
@ -0,0 +1 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en"><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/><link rel="stylesheet" href="../jacoco-resources/report.css" type="text/css"/><link rel="shortcut icon" href="../jacoco-resources/report.gif" type="image/gif"/><title>LngLatAlt</title><script type="text/javascript" src="../jacoco-resources/sort.js"></script></head><body onload="initialSort(['breadcrumb'])"><div class="breadcrumb" id="breadcrumb"><span class="info"><a href="../jacoco-sessions.html" class="el_session">Sessions</a></span><a href="../index.html" class="el_report">ilp-coursework</a> > <a href="index.html" class="el_package">io.github.js0ny.ilp_coursework.data.common</a> > <span class="el_class">LngLatAlt</span></div><h1>LngLatAlt</h1><table class="coverage" cellspacing="0" id="coveragetable"><thead><tr><td class="sortable" id="a" onclick="toggleSort(this)">Element</td><td class="down sortable bar" id="b" onclick="toggleSort(this)">Missed Instructions</td><td class="sortable ctr2" id="c" onclick="toggleSort(this)">Cov.</td><td class="sortable bar" id="d" onclick="toggleSort(this)">Missed Branches</td><td class="sortable ctr2" id="e" onclick="toggleSort(this)">Cov.</td><td class="sortable ctr1" id="f" onclick="toggleSort(this)">Missed</td><td class="sortable ctr2" id="g" onclick="toggleSort(this)">Cxty</td><td class="sortable ctr1" id="h" onclick="toggleSort(this)">Missed</td><td class="sortable ctr2" id="i" onclick="toggleSort(this)">Lines</td><td class="sortable ctr1" id="j" onclick="toggleSort(this)">Missed</td><td class="sortable ctr2" id="k" onclick="toggleSort(this)">Methods</td></tr></thead><tfoot><tr><td>Total</td><td class="bar">0 of 12</td><td class="ctr2">100%</td><td class="bar">0 of 0</td><td class="ctr2">n/a</td><td class="ctr1">0</td><td class="ctr2">1</td><td class="ctr1">0</td><td class="ctr2">1</td><td class="ctr1">0</td><td class="ctr2">1</td></tr></tfoot><tbody><tr><td id="a0"><a href="LngLatAlt.java.html#L11" class="el_method">LngLatAlt(double, double, double)</a></td><td class="bar" id="b0"><img src="../jacoco-resources/greenbar.gif" width="120" height="10" title="12" alt="12"/></td><td class="ctr2" id="c0">100%</td><td class="bar" id="d0"/><td class="ctr2" id="e0">n/a</td><td class="ctr1" id="f0">0</td><td class="ctr2" id="g0">1</td><td class="ctr1" id="h0">0</td><td class="ctr2" id="i0">1</td><td class="ctr1" id="j0">0</td><td class="ctr2" id="k0">1</td></tr></tbody></table><div class="footer"><span class="right">Created with <a href="http://www.jacoco.org/jacoco">JaCoCo</a> 0.8.12.202403310830</span></div></body></html>
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en"><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/><link rel="stylesheet" href="../jacoco-resources/report.css" type="text/css"/><link rel="shortcut icon" href="../jacoco-resources/report.gif" type="image/gif"/><title>LngLatAlt.java</title><link rel="stylesheet" href="../jacoco-resources/prettify.css" type="text/css"/><script type="text/javascript" src="../jacoco-resources/prettify.js"></script></head><body onload="window['PR_TAB_WIDTH']=4;prettyPrint()"><div class="breadcrumb" id="breadcrumb"><span class="info"><a href="../jacoco-sessions.html" class="el_session">Sessions</a></span><a href="../index.html" class="el_report">ilp-coursework</a> > <a href="index.source.html" class="el_package">io.github.js0ny.ilp_coursework.data.common</a> > <span class="el_source">LngLatAlt.java</span></div><h1>LngLatAlt.java</h1><pre class="source lang-java linenums">package io.github.js0ny.ilp_coursework.data.common;
|
||||
|
||||
/**
|
||||
* Represents the data transfer object for a point or coordinate that defines by a longitude and
|
||||
* latitude
|
||||
*
|
||||
* @param lng longitude of the coordinate/point
|
||||
* @param lat latitude of the coordinate/point
|
||||
* @param alt altitude of the coordinate/point
|
||||
*/
|
||||
<span class="fc" id="L11">public record LngLatAlt(double lng, double lat, double alt) {}</span>
|
||||
</pre><div class="footer"><span class="right">Created with <a href="http://www.jacoco.org/jacoco">JaCoCo</a> 0.8.12.202403310830</span></div></body></html>
|
||||
|
|
@ -0,0 +1 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en"><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/><link rel="stylesheet" href="../jacoco-resources/report.css" type="text/css"/><link rel="shortcut icon" href="../jacoco-resources/report.gif" type="image/gif"/><title>Region</title><script type="text/javascript" src="../jacoco-resources/sort.js"></script></head><body onload="initialSort(['breadcrumb'])"><div class="breadcrumb" id="breadcrumb"><span class="info"><a href="../jacoco-sessions.html" class="el_session">Sessions</a></span><a href="../index.html" class="el_report">ilp-coursework</a> > <a href="index.html" class="el_package">io.github.js0ny.ilp_coursework.data.common</a> > <span class="el_class">Region</span></div><h1>Region</h1><table class="coverage" cellspacing="0" id="coveragetable"><thead><tr><td class="sortable" id="a" onclick="toggleSort(this)">Element</td><td class="down sortable bar" id="b" onclick="toggleSort(this)">Missed Instructions</td><td class="sortable ctr2" id="c" onclick="toggleSort(this)">Cov.</td><td class="sortable bar" id="d" onclick="toggleSort(this)">Missed Branches</td><td class="sortable ctr2" id="e" onclick="toggleSort(this)">Cov.</td><td class="sortable ctr1" id="f" onclick="toggleSort(this)">Missed</td><td class="sortable ctr2" id="g" onclick="toggleSort(this)">Cxty</td><td class="sortable ctr1" id="h" onclick="toggleSort(this)">Missed</td><td class="sortable ctr2" id="i" onclick="toggleSort(this)">Lines</td><td class="sortable ctr1" id="j" onclick="toggleSort(this)">Missed</td><td class="sortable ctr2" id="k" onclick="toggleSort(this)">Methods</td></tr></thead><tfoot><tr><td>Total</td><td class="bar">51 of 84</td><td class="ctr2">39%</td><td class="bar">1 of 4</td><td class="ctr2">75%</td><td class="ctr1">4</td><td class="ctr2">7</td><td class="ctr1">11</td><td class="ctr2">17</td><td class="ctr1">3</td><td class="ctr2">5</td></tr></tfoot><tbody><tr><td id="a3"><a href="Region.java.html#L52" class="el_method">toGeoJson()</a></td><td class="bar" id="b0"><img src="../jacoco-resources/redbar.gif" width="120" height="10" title="25" alt="25"/></td><td class="ctr2" id="c2">0%</td><td class="bar" id="d1"/><td class="ctr2" id="e1">n/a</td><td class="ctr1" id="f0">1</td><td class="ctr2" id="g1">1</td><td class="ctr1" id="h0">6</td><td class="ctr2" id="i0">6</td><td class="ctr1" id="j0">1</td><td class="ctr2" id="k0">1</td></tr><tr><td id="a4"><a href="Region.java.html#L66" class="el_method">toGeoJsonString()</a></td><td class="bar" id="b1"><img src="../jacoco-resources/redbar.gif" width="86" height="10" title="18" alt="18"/></td><td class="ctr2" id="c3">0%</td><td class="bar" id="d2"/><td class="ctr2" id="e2">n/a</td><td class="ctr1" id="f1">1</td><td class="ctr2" id="g2">1</td><td class="ctr1" id="h1">5</td><td class="ctr2" id="i1">5</td><td class="ctr1" id="j1">1</td><td class="ctr2" id="k1">1</td></tr><tr><td id="a1"><a href="Region.java.html#L55" class="el_method">lambda$toGeoJson$0(LngLat)</a></td><td class="bar" id="b2"><img src="../jacoco-resources/redbar.gif" width="38" height="10" title="8" alt="8"/></td><td class="ctr2" id="c4">0%</td><td class="bar" id="d3"/><td class="ctr2" id="e3">n/a</td><td class="ctr1" id="f2">1</td><td class="ctr2" id="g3">1</td><td class="ctr1" id="h2">1</td><td class="ctr2" id="i3">1</td><td class="ctr1" id="j2">1</td><td class="ctr2" id="k2">1</td></tr><tr><td id="a0"><a href="Region.java.html#L42" class="el_method">isClosed()</a></td><td class="bar" id="b3"><img src="../jacoco-resources/greenbar.gif" width="115" height="10" title="24" alt="24"/></td><td class="ctr2" id="c0">100%</td><td class="bar" id="d0"><img src="../jacoco-resources/redbar.gif" width="30" height="10" title="1" alt="1"/><img src="../jacoco-resources/greenbar.gif" width="90" height="10" title="3" alt="3"/></td><td class="ctr2" id="e0">75%</td><td class="ctr1" id="f3">1</td><td class="ctr2" id="g0">3</td><td class="ctr1" id="h3">0</td><td class="ctr2" id="i2">5</td><td class="ctr1" id="j3">0</td><td class="ctr2" id="k3">1</td></tr><tr><td id="a2"><a href="Region.java.html#L26" class="el_method">Region(String, List)</a></td><td class="bar" id="b4"><img src="../jacoco-resources/greenbar.gif" width="43" height="10" title="9" alt="9"/></td><td class="ctr2" id="c1">100%</td><td class="bar" id="d4"/><td class="ctr2" id="e4">n/a</td><td class="ctr1" id="f4">0</td><td class="ctr2" id="g4">1</td><td class="ctr1" id="h4">0</td><td class="ctr2" id="i4">1</td><td class="ctr1" id="j4">0</td><td class="ctr2" id="k4">1</td></tr></tbody></table><div class="footer"><span class="right">Created with <a href="http://www.jacoco.org/jacoco">JaCoCo</a> 0.8.12.202403310830</span></div></body></html>
|
||||
|
|
@ -0,0 +1,76 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en"><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/><link rel="stylesheet" href="../jacoco-resources/report.css" type="text/css"/><link rel="shortcut icon" href="../jacoco-resources/report.gif" type="image/gif"/><title>Region.java</title><link rel="stylesheet" href="../jacoco-resources/prettify.css" type="text/css"/><script type="text/javascript" src="../jacoco-resources/prettify.js"></script></head><body onload="window['PR_TAB_WIDTH']=4;prettyPrint()"><div class="breadcrumb" id="breadcrumb"><span class="info"><a href="../jacoco-sessions.html" class="el_session">Sessions</a></span><a href="../index.html" class="el_report">ilp-coursework</a> > <a href="index.source.html" class="el_package">io.github.js0ny.ilp_coursework.data.common</a> > <span class="el_source">Region.java</span></div><h1>Region.java</h1><pre class="source lang-java linenums">package io.github.js0ny.ilp_coursework.data.common;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import io.github.js0ny.ilp_coursework.data.request.RegionCheckRequest;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Represents the data transfer object for a region definition
|
||||
*
|
||||
* <p>This record encapsulates the data for calculating if a coordinate is inside the region
|
||||
*
|
||||
* <p>A built-in method {@code isClosedTo} is defined to check this DTO is valid or not in the mean
|
||||
* of closing polygon
|
||||
*
|
||||
* @param name The human-readable name for the region
|
||||
* @param vertices list of coordinates that forms a polygon as a region.
|
||||
* <p>In order to define a valid region, the last element of the list should be the same as the
|
||||
* first, or known as closed
|
||||
* @see RegionCheckRequest
|
||||
* @see io.github.js0ny.ilp_coursework.service.GpsCalculationService#checkIsInRegion(LngLat, Region)
|
||||
*/
|
||||
<span class="fc" id="L26">public record Region(String name, List<LngLat> vertices) {</span>
|
||||
/**
|
||||
* Magic number 4: For a polygon, 3 edges is required.
|
||||
*
|
||||
* <p>In this dto, edges + 1 vertices is required.
|
||||
*/
|
||||
private static final int MINIMUM_VERTICES = 4;
|
||||
|
||||
/**
|
||||
* Method to check if the region has a valid polygon by checking if the {@code vertices} forms a
|
||||
* closed polygon
|
||||
*
|
||||
* @return {@code true} if the {@code vertices} are able to form a polygon and form a closed
|
||||
* polygon
|
||||
*/
|
||||
public boolean isClosed() {
|
||||
<span class="pc bpc" id="L42" title="1 of 4 branches missed."> if (vertices == null || vertices.size() < MINIMUM_VERTICES) {</span>
|
||||
<span class="fc" id="L43"> return false;</span>
|
||||
}
|
||||
<span class="fc" id="L45"> LngLat first = vertices.getFirst();</span>
|
||||
<span class="fc" id="L46"> LngLat last = vertices.getLast();</span>
|
||||
<span class="fc" id="L47"> return Objects.equals(last, first);</span>
|
||||
}
|
||||
|
||||
public Map<String, Object> toGeoJson() {
|
||||
try {
|
||||
<span class="nc" id="L52"> ObjectMapper mapper = new ObjectMapper();</span>
|
||||
|
||||
<span class="nc" id="L54"> List<List<Double>> ring =</span>
|
||||
<span class="nc" id="L55"> vertices.stream().map(v -> List.of(v.lng(), v.lat())).toList();</span>
|
||||
|
||||
<span class="nc" id="L57"> return Map.of("type", "Polygon", "coordinates", List.of(ring));</span>
|
||||
|
||||
<span class="nc" id="L59"> } catch (Exception e) {</span>
|
||||
<span class="nc" id="L60"> throw new RuntimeException("Failed to generate GeoJSON", e);</span>
|
||||
}
|
||||
}
|
||||
|
||||
public String toGeoJsonString() {
|
||||
try {
|
||||
<span class="nc" id="L66"> ObjectMapper mapper = new ObjectMapper();</span>
|
||||
|
||||
<span class="nc" id="L68"> var geoJson = toGeoJson();</span>
|
||||
|
||||
<span class="nc" id="L70"> return mapper.writeValueAsString(geoJson);</span>
|
||||
<span class="nc" id="L71"> } catch (Exception e) {</span>
|
||||
<span class="nc" id="L72"> throw new RuntimeException("Failed to generate GeoJSON", e);</span>
|
||||
}
|
||||
}
|
||||
}
|
||||
</pre><div class="footer"><span class="right">Created with <a href="http://www.jacoco.org/jacoco">JaCoCo</a> 0.8.12.202403310830</span></div></body></html>
|
||||
|
|
@ -0,0 +1 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en"><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/><link rel="stylesheet" href="../jacoco-resources/report.css" type="text/css"/><link rel="shortcut icon" href="../jacoco-resources/report.gif" type="image/gif"/><title>TimeWindow</title><script type="text/javascript" src="../jacoco-resources/sort.js"></script></head><body onload="initialSort(['breadcrumb'])"><div class="breadcrumb" id="breadcrumb"><span class="info"><a href="../jacoco-sessions.html" class="el_session">Sessions</a></span><a href="../index.html" class="el_report">ilp-coursework</a> > <a href="index.html" class="el_package">io.github.js0ny.ilp_coursework.data.common</a> > <span class="el_class">TimeWindow</span></div><h1>TimeWindow</h1><table class="coverage" cellspacing="0" id="coveragetable"><thead><tr><td class="sortable" id="a" onclick="toggleSort(this)">Element</td><td class="down sortable bar" id="b" onclick="toggleSort(this)">Missed Instructions</td><td class="sortable ctr2" id="c" onclick="toggleSort(this)">Cov.</td><td class="sortable bar" id="d" onclick="toggleSort(this)">Missed Branches</td><td class="sortable ctr2" id="e" onclick="toggleSort(this)">Cov.</td><td class="sortable ctr1" id="f" onclick="toggleSort(this)">Missed</td><td class="sortable ctr2" id="g" onclick="toggleSort(this)">Cxty</td><td class="sortable ctr1" id="h" onclick="toggleSort(this)">Missed</td><td class="sortable ctr2" id="i" onclick="toggleSort(this)">Lines</td><td class="sortable ctr1" id="j" onclick="toggleSort(this)">Missed</td><td class="sortable ctr2" id="k" onclick="toggleSort(this)">Methods</td></tr></thead><tfoot><tr><td>Total</td><td class="bar">0 of 12</td><td class="ctr2">100%</td><td class="bar">0 of 0</td><td class="ctr2">n/a</td><td class="ctr1">0</td><td class="ctr2">1</td><td class="ctr1">0</td><td class="ctr2">1</td><td class="ctr1">0</td><td class="ctr2">1</td></tr></tfoot><tbody><tr><td id="a0"><a href="TimeWindow.java.html#L6" class="el_method">TimeWindow(DayOfWeek, LocalTime, LocalTime)</a></td><td class="bar" id="b0"><img src="../jacoco-resources/greenbar.gif" width="120" height="10" title="12" alt="12"/></td><td class="ctr2" id="c0">100%</td><td class="bar" id="d0"/><td class="ctr2" id="e0">n/a</td><td class="ctr1" id="f0">0</td><td class="ctr2" id="g0">1</td><td class="ctr1" id="h0">0</td><td class="ctr2" id="i0">1</td><td class="ctr1" id="j0">0</td><td class="ctr2" id="k0">1</td></tr></tbody></table><div class="footer"><span class="right">Created with <a href="http://www.jacoco.org/jacoco">JaCoCo</a> 0.8.12.202403310830</span></div></body></html>
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en"><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/><link rel="stylesheet" href="../jacoco-resources/report.css" type="text/css"/><link rel="shortcut icon" href="../jacoco-resources/report.gif" type="image/gif"/><title>TimeWindow.java</title><link rel="stylesheet" href="../jacoco-resources/prettify.css" type="text/css"/><script type="text/javascript" src="../jacoco-resources/prettify.js"></script></head><body onload="window['PR_TAB_WIDTH']=4;prettyPrint()"><div class="breadcrumb" id="breadcrumb"><span class="info"><a href="../jacoco-sessions.html" class="el_session">Sessions</a></span><a href="../index.html" class="el_report">ilp-coursework</a> > <a href="index.source.html" class="el_package">io.github.js0ny.ilp_coursework.data.common</a> > <span class="el_source">TimeWindow.java</span></div><h1>TimeWindow.java</h1><pre class="source lang-java linenums">package io.github.js0ny.ilp_coursework.data.common;
|
||||
|
||||
import java.time.DayOfWeek;
|
||||
import java.time.LocalTime;
|
||||
|
||||
<span class="fc" id="L6">public record TimeWindow(DayOfWeek dayOfWeek, LocalTime from, LocalTime until) {}</span>
|
||||
</pre><div class="footer"><span class="right">Created with <a href="http://www.jacoco.org/jacoco">JaCoCo</a> 0.8.12.202403310830</span></div></body></html>
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue