Biblioteca Java - Rev 32
Subversion Repositories:
(root)/Courses and labs samples/ISP/Exemple_ISP_Cluj_2015/ElevatorCurs/.jacocoverage/report.html/elevatorcurs.model/Controller.java.html @ 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="../.resources/report.css" type="text/css"/><link rel="shortcut icon" href="../.resources/report.gif" type="image/gif"/><title>Controller.java</title><link rel="stylesheet" href="../.resources/prettify.css" type="text/css"/><script type="text/javascript" src="../.resources/prettify.js"></script></head><body onload="window['PR_TAB_WIDTH']=4;prettyPrint()"><div class="breadcrumb" id="breadcrumb"><span class="info"><a href="../.sessions.html" class="el_session">Sessions</a></span><a href="../index.html" class="el_report">JaCoCoverage analysis of project "ElevatorCurs" (powered by JaCoCo from EclEmma)</a> > <a href="index.source.html" class="el_package">elevatorcurs.model</a> > <span class="el_source">Controller.java</span></div><h1>Controller.java</h1><pre class="source lang-java linenums">
package elevatorcurs.model;
import java.util.LinkedList;
import java.util.NoSuchElementException;
/**
*
* @author Mihai Hulea mihai.hulea@aut.utcluj.ro
*/
public class Controller {
private Elevator e;
private Job currentJob;
private LinkedList<Job> jobs;
<span class="nc" id="L14"> public Controller(Elevator e) {</span>
<span class="nc" id="L15"> this.e = e;</span>
<span class="nc" id="L16"> jobs = new LinkedList<>();</span>
<span class="nc" id="L17"> }</span>
public void step(){
<span class="nc bnc" id="L20" title="All 2 branches missed."> if(currentJob!=null){</span>
//...
<span class="nc" id="L22"> int targetPosition = currentJob.getDestinationFloor() * 10;</span>
<span class="nc bnc" id="L23" title="All 2 branches missed."> if(targetPosition < e.getPosition()){</span>
<span class="nc" id="L24"> e.setCurrentDir(Direction.DOWN);</span>
<span class="nc bnc" id="L25" title="All 2 branches missed."> }else if(targetPosition > e.getPosition()){</span>
<span class="nc" id="L26"> e.setCurrentDir(Direction.UP);</span>
}else{
<span class="nc" id="L28"> e.setCurrentDir(Direction.HOLD);</span>
<span class="nc" id="L29"> System.out.println("ARRIVED!");</span>
<span class="nc" id="L30"> currentJob = null;</span>
}
<span class="nc" id="L32"> }else{</span>
//...
<span class="nc" id="L34"> currentJob = jobs.poll();</span>
/*try{
currentJob = jobs.removeFirst();
}catch(NoSuchElementException e){
}*/
}
<span class="nc" id="L41"> }</span>
public void addJob(Job j){
<span class="nc" id="L44"> jobs.addLast(j);</span>
<span class="nc" id="L45"> }</span>
}
</pre><div class="footer"><span class="right">Created with <a href="http://www.eclemma.org/jacoco">JaCoCo</a> 0.7.4.201502262128</span></div></body></html>
package elevatorcurs.model;
import java.util.LinkedList;
import java.util.NoSuchElementException;
/**
*
* @author Mihai Hulea mihai.hulea@aut.utcluj.ro
*/
public class Controller {
private Elevator e;
private Job currentJob;
private LinkedList<Job> jobs;
<span class="nc" id="L14"> public Controller(Elevator e) {</span>
<span class="nc" id="L15"> this.e = e;</span>
<span class="nc" id="L16"> jobs = new LinkedList<>();</span>
<span class="nc" id="L17"> }</span>
public void step(){
<span class="nc bnc" id="L20" title="All 2 branches missed."> if(currentJob!=null){</span>
//...
<span class="nc" id="L22"> int targetPosition = currentJob.getDestinationFloor() * 10;</span>
<span class="nc bnc" id="L23" title="All 2 branches missed."> if(targetPosition < e.getPosition()){</span>
<span class="nc" id="L24"> e.setCurrentDir(Direction.DOWN);</span>
<span class="nc bnc" id="L25" title="All 2 branches missed."> }else if(targetPosition > e.getPosition()){</span>
<span class="nc" id="L26"> e.setCurrentDir(Direction.UP);</span>
}else{
<span class="nc" id="L28"> e.setCurrentDir(Direction.HOLD);</span>
<span class="nc" id="L29"> System.out.println("ARRIVED!");</span>
<span class="nc" id="L30"> currentJob = null;</span>
}
<span class="nc" id="L32"> }else{</span>
//...
<span class="nc" id="L34"> currentJob = jobs.poll();</span>
/*try{
currentJob = jobs.removeFirst();
}catch(NoSuchElementException e){
}*/
}
<span class="nc" id="L41"> }</span>
public void addJob(Job j){
<span class="nc" id="L44"> jobs.addLast(j);</span>
<span class="nc" id="L45"> }</span>
}
</pre><div class="footer"><span class="right">Created with <a href="http://www.eclemma.org/jacoco">JaCoCo</a> 0.7.4.201502262128</span></div></body></html>