bgabriel998/SoftwareDevProject

View on GitHub
doc/JavaDoc/ch/epfl/sdp/peakar/points/UserPoint.html

Summary

Maintainability
Test Coverage
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_242-release) on Fri Jun 04 18:15:40 CEST 2021 -->
<title>UserPoint</title>
<meta name="date" content="2021-06-04">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
    try {
        if (location.href.indexOf('is-external=true') == -1) {
            parent.document.title="UserPoint";
        }
    }
    catch(err) {
    }
//-->
var methods = {"i0":10,"i1":10,"i2":10,"i3":9,"i4":10,"i5":10,"i6":10,"i7":10,"i8":10};
var tabs = {65535:["t0","All Methods"],1:["t1","Static Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!--   -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!--   -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-files/index-1.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../ch/epfl/sdp/peakar/points/POIPoint.html" title="class in ch.epfl.sdp.peakar.points"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li>Next&nbsp;Class</li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?ch/epfl/sdp/peakar/points/UserPoint.html" target="_top">Frames</a></li>
<li><a href="UserPoint.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
  allClassesLink = document.getElementById("allclasses_navbar_top");
  if(window==top) {
    allClassesLink.style.display = "block";
  }
  else {
    allClassesLink.style.display = "none";
  }
  //-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li><a href="#field.summary">Field</a>&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li><a href="#field.detail">Field</a>&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.top">
<!--   -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">ch.epfl.sdp.peakar.points</div>
<h2 title="Class UserPoint" class="title">Class UserPoint</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>java.lang.Object</li>
<li>
<ul class="inheritance">
<li><a href="../../../../../ch/epfl/sdp/peakar/points/Point.html" title="class in ch.epfl.sdp.peakar.points">ch.epfl.sdp.peakar.points.Point</a></li>
<li>
<ul class="inheritance">
<li>ch.epfl.sdp.peakar.points.UserPoint</li>
</ul>
</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<br>
<pre>public final class <span class="typeNameLabel">UserPoint</span>
extends <a href="../../../../../ch/epfl/sdp/peakar/points/Point.html" title="class in ch.epfl.sdp.peakar.points">Point</a></pre>
<div class="block">UserPoint is a class that represents a general point on earth.

 This class is a singleton: only one instance of this class is available on the
 entire program.

 It adds a component to represent the accuracy of the user's location and customLocation:
 <ul>
 <li>accuracy accuracy in meters of the user location
 <li>customLocation if true, the userPoint location is not updated by the GPS tracker
 </ul>
 <p>
 It provides a constructor that takes a GPSTracker as an input.
 It provides a method to get updates on the user location.

 This class should be used as a observer that observes a GPSTracker.

 This class can be observed; The updates will be called only if the location changes
 more than MIN_DISTANCE_FOR_UPDATES meters.</div>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- =========== FIELD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="field.summary">
<!--   -->
</a>
<h3>Field Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Field Summary table, listing fields, and an explanation">
<caption><span>Fields</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Field and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../ch/epfl/sdp/peakar/points/UserPoint.html#MIN_DISTANCE_FOR_UPDATES">MIN_DISTANCE_FOR_UPDATES</a></span></code>&nbsp;</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="fields.inherited.from.class.ch.epfl.sdp.peakar.points.Point">
<!--   -->
</a>
<h3>Fields inherited from class&nbsp;ch.epfl.sdp.peakar.points.<a href="../../../../../ch/epfl/sdp/peakar/points/Point.html" title="class in ch.epfl.sdp.peakar.points">Point</a></h3>
<code><a href="../../../../../ch/epfl/sdp/peakar/points/Point.html#altitude">altitude</a>, <a href="../../../../../ch/epfl/sdp/peakar/points/Point.html#latitude">latitude</a>, <a href="../../../../../ch/epfl/sdp/peakar/points/Point.html#longitude">longitude</a></code></li>
</ul>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method.summary">
<!--   -->
</a>
<h3>Method Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd">&nbsp;</span></span><span id="t1" class="tableTab"><span><a href="javascript:show(1);">Static Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd">&nbsp;</span></span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../ch/epfl/sdp/peakar/points/UserPoint.html#addObserver-java.util.Observer-">addObserver</a></span>(java.util.Observer&nbsp;o)</code>
<div class="block">Allows to add observers to the UserPoint.</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../ch/epfl/sdp/peakar/points/UserPoint.html#canGetLocation--">canGetLocation</a></span>()</code>&nbsp;</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code>double</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../ch/epfl/sdp/peakar/points/UserPoint.html#getAccuracy--">getAccuracy</a></span>()</code>
<div class="block">Getter for the accuracy.</div>
</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code>static <a href="../../../../../ch/epfl/sdp/peakar/points/UserPoint.html" title="class in ch.epfl.sdp.peakar.points">UserPoint</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../ch/epfl/sdp/peakar/points/UserPoint.html#getInstance-android.content.Context-">getInstance</a></span>(android.content.Context&nbsp;mContext)</code>
<div class="block">Method to get the singleton instance of this class.</div>
</td>
</tr>
<tr id="i4" class="altColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../ch/epfl/sdp/peakar/points/UserPoint.html#isCustomLocation--">isCustomLocation</a></span>()</code>
<div class="block">To check if the custom location is on</div>
</td>
</tr>
<tr id="i5" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../ch/epfl/sdp/peakar/points/UserPoint.html#setLocation-double-double-double-double-">setLocation</a></span>(double&nbsp;lat,
           double&nbsp;lon,
           double&nbsp;alt,
           double&nbsp;acc)</code>
<div class="block">Method used to set custom user location</div>
</td>
</tr>
<tr id="i6" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../ch/epfl/sdp/peakar/points/UserPoint.html#switchToRealLocation--">switchToRealLocation</a></span>()</code>
<div class="block">Sets customLocation to false</div>
</td>
</tr>
<tr id="i7" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../ch/epfl/sdp/peakar/points/UserPoint.html#update--">update</a></span>()</code>
<div class="block">Method that is used to update the current user location.</div>
</td>
</tr>
<tr id="i8" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../ch/epfl/sdp/peakar/points/UserPoint.html#updateGPSTracker-android.content.Context-">updateGPSTracker</a></span>(android.content.Context&nbsp;mContext)</code>&nbsp;</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.ch.epfl.sdp.peakar.points.Point">
<!--   -->
</a>
<h3>Methods inherited from class&nbsp;ch.epfl.sdp.peakar.points.<a href="../../../../../ch/epfl/sdp/peakar/points/Point.html" title="class in ch.epfl.sdp.peakar.points">Point</a></h3>
<code><a href="../../../../../ch/epfl/sdp/peakar/points/Point.html#computeBoundingBox-double-">computeBoundingBox</a>, <a href="../../../../../ch/epfl/sdp/peakar/points/Point.html#computeDistance-ch.epfl.sdp.peakar.points.Point-">computeDistance</a>, <a href="../../../../../ch/epfl/sdp/peakar/points/Point.html#computeFlatDistance-ch.epfl.sdp.peakar.points.Point-">computeFlatDistance</a>, <a href="../../../../../ch/epfl/sdp/peakar/points/Point.html#getAltitude--">getAltitude</a>, <a href="../../../../../ch/epfl/sdp/peakar/points/Point.html#getDistanceToUser--">getDistanceToUser</a>, <a href="../../../../../ch/epfl/sdp/peakar/points/Point.html#getHorizontalBearing--">getHorizontalBearing</a>, <a href="../../../../../ch/epfl/sdp/peakar/points/Point.html#getLatitude--">getLatitude</a>, <a href="../../../../../ch/epfl/sdp/peakar/points/Point.html#getLongitude--">getLongitude</a>, <a href="../../../../../ch/epfl/sdp/peakar/points/Point.html#getVerticalBearing--">getVerticalBearing</a>, <a href="../../../../../ch/epfl/sdp/peakar/points/Point.html#setAltitude-double-">setAltitude</a>, <a href="../../../../../ch/epfl/sdp/peakar/points/Point.html#setDistanceToUser-ch.epfl.sdp.peakar.points.UserPoint-">setDistanceToUser</a>, <a href="../../../../../ch/epfl/sdp/peakar/points/Point.html#setHorizontalBearing-ch.epfl.sdp.peakar.points.Point-">setHorizontalBearing</a>, <a href="../../../../../ch/epfl/sdp/peakar/points/Point.html#setLatitude-double-">setLatitude</a>, <a href="../../../../../ch/epfl/sdp/peakar/points/Point.html#setLongitude-double-">setLongitude</a>, <a href="../../../../../ch/epfl/sdp/peakar/points/Point.html#setVerticalBearing-ch.epfl.sdp.peakar.points.Point-">setVerticalBearing</a></code></li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.java.lang.Object">
<!--   -->
</a>
<h3>Methods inherited from class&nbsp;java.lang.Object</h3>
<code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ FIELD DETAIL =========== -->
<ul class="blockList">
<li class="blockList"><a name="field.detail">
<!--   -->
</a>
<h3>Field Detail</h3>
<a name="MIN_DISTANCE_FOR_UPDATES">
<!--   -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>MIN_DISTANCE_FOR_UPDATES</h4>
<pre>public static final&nbsp;int MIN_DISTANCE_FOR_UPDATES</pre>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../constant-values.html#ch.epfl.sdp.peakar.points.UserPoint.MIN_DISTANCE_FOR_UPDATES">Constant Field Values</a></dd>
</dl>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method.detail">
<!--   -->
</a>
<h3>Method Detail</h3>
<a name="addObserver-java.util.Observer-">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>addObserver</h4>
<pre>public&nbsp;void&nbsp;addObserver(java.util.Observer&nbsp;o)</pre>
<div class="block">Allows to add observers to the UserPoint.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>o</code> - observer to add</dd>
</dl>
</li>
</ul>
<a name="getInstance-android.content.Context-">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getInstance</h4>
<pre>public static&nbsp;<a href="../../../../../ch/epfl/sdp/peakar/points/UserPoint.html" title="class in ch.epfl.sdp.peakar.points">UserPoint</a>&nbsp;getInstance(android.content.Context&nbsp;mContext)</pre>
<div class="block">Method to get the singleton instance of this class. If the class was already
 initialized the parameter will be ignored.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>mContext</code> - context of the application.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>single instance of the user point.</dd>
</dl>
</li>
</ul>
<a name="updateGPSTracker-android.content.Context-">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>updateGPSTracker</h4>
<pre>public&nbsp;void&nbsp;updateGPSTracker(android.content.Context&nbsp;mContext)</pre>
</li>
</ul>
<a name="update--">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>update</h4>
<pre>public&nbsp;void&nbsp;update()</pre>
<div class="block">Method that is used to update the current user location.

 It updates the observers if the point has moved more than MIN_DISTANCE_FOR_UPDATES
 from the last saved location.</div>
</li>
</ul>
<a name="getAccuracy--">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getAccuracy</h4>
<pre>public&nbsp;double&nbsp;getAccuracy()</pre>
<div class="block">Getter for the accuracy.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>accuracy of the current location (in meters)</dd>
</dl>
</li>
</ul>
<a name="canGetLocation--">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>canGetLocation</h4>
<pre>public&nbsp;boolean&nbsp;canGetLocation()</pre>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd><code>true</code> if GPSTracker is able to get the current location;
          <code>false</code> otherwise.</dd>
</dl>
</li>
</ul>
<a name="setLocation-double-double-double-double-">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setLocation</h4>
<pre>public&nbsp;void&nbsp;setLocation(double&nbsp;lat,
                        double&nbsp;lon,
                        double&nbsp;alt,
                        double&nbsp;acc)</pre>
<div class="block">Method used to set custom user location</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>lat</code> - user latitude (in degrees)</dd>
<dd><code>lon</code> - user longitude (in degrees)</dd>
<dd><code>alt</code> - user altitude (in meters)</dd>
<dd><code>acc</code> - user accuracy (in meters)</dd>
</dl>
</li>
</ul>
<a name="switchToRealLocation--">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>switchToRealLocation</h4>
<pre>public&nbsp;void&nbsp;switchToRealLocation()</pre>
<div class="block">Sets customLocation to false</div>
</li>
</ul>
<a name="isCustomLocation--">
<!--   -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>isCustomLocation</h4>
<pre>public&nbsp;boolean&nbsp;isCustomLocation()</pre>
<div class="block">To check if the custom location is on</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd><code>true</code> if customLocation is enabled;
          <code>false</code> otherwise.</dd>
</dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!--   -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!--   -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-files/index-1.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../ch/epfl/sdp/peakar/points/POIPoint.html" title="class in ch.epfl.sdp.peakar.points"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li>Next&nbsp;Class</li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?ch/epfl/sdp/peakar/points/UserPoint.html" target="_top">Frames</a></li>
<li><a href="UserPoint.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
  allClassesLink = document.getElementById("allclasses_navbar_bottom");
  if(window==top) {
    allClassesLink.style.display = "block";
  }
  else {
    allClassesLink.style.display = "none";
  }
  //-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li><a href="#field.summary">Field</a>&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li><a href="#field.detail">Field</a>&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.bottom">
<!--   -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>