Biblioteca Java - Rev 32

Subversion Repositories:
Rev:
<?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>Elevator.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 &quot;ElevatorCurs&quot; (powered by JaCoCo from EclEmma)</a> &gt; <a href="index.source.html" class="el_package">elevatorcurs.model</a> &gt; <span class="el_source">Elevator.java</span></div><h1>Elevator.java</h1><pre class="source lang-java linenums">
package elevatorcurs.model;

import java.util.Observable;

/**
 *
 * @author Mihai Hulea mihai.hulea@aut.utcluj.ro
 */
public class Elevator extends Observable{
    private int position;
    private Direction currentDir;

<span class="fc" id="L14">    public Elevator() {</span>
<span class="fc" id="L15">        currentDir = Direction.HOLD;</span>
<span class="fc" id="L16">    }</span>
   
    public void move(){
<span class="pc bpc" id="L19" title="2 of 3 branches missed.">        switch(currentDir){</span>
            case UP:{
<span class="nc" id="L21">                position = position + 1;                 </span>
<span class="nc" id="L22">                setChanged();</span>
<span class="nc" id="L23">                notifyObservers(this);</span>
<span class="nc" id="L24">                break;</span>
            }
            case DOWN:{
<span class="nc" id="L27">                position = position - 1; </span>
<span class="nc" id="L28">                setChanged();</span>
<span class="nc" id="L29">                notifyObservers(this);</span>
<span class="nc" id="L30">                break;</span>
            }
            case HOLD: {}
        }
<span class="fc" id="L34">    }</span>
   
    public void setCurrentDir(Direction dir){
<span class="fc" id="L37">        this.currentDir = dir;</span>
<span class="fc" id="L38">    }</span>
   
    public Direction getCurrentDir(){
<span class="fc" id="L41">        return currentDir;</span>
    }
   
    public int getPosition(){
<span class="fc" id="L45">        return position;</span>
    }
   
    public String toString(){
<span class="fc" id="L49">        return &quot;Elevator: pos=&quot;+position+&quot;: dir=&quot;+currentDir;</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>