Advertisement
kernel_memory_dump

Untitled

Mar 13th, 2014
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.68 KB | None | 0 0
  1. package aplikacija;
  2.  
  3. public class Semafor {
  4.    
  5.     private int svetlo;
  6.     private final int CRVENO  = 1;
  7.     private final int ZUTO1 = 2;
  8.     private final int ZELENO = 3;
  9.     private final int ZUTO2 = 4;
  10.    
  11.    
  12.     public void promeniSvetlo(){
  13.         if (svetlo == CRVENO){
  14.             svetlo = ZUTO1;
  15.         } else if (svetlo == ZUTO1){
  16.             svetlo = ZELENO;
  17.         } else if(svetlo == ZELENO){
  18.             svetlo = ZUTO2;
  19.         } else if ( svetlo == ZUTO2){
  20.             svetlo = CRVENO;
  21.         }
  22.    
  23.        
  24.         switch(svetlo){
  25.             case CRVENO:
  26.                 svetlo = ZUTO1;
  27.                 break;
  28.             case ZUTO1:
  29.                 svetlo = ZELENO;
  30.                 break;
  31.             case ZELENO:
  32.                 svetlo = ZUTO2;
  33.                 break;
  34.             case ZUTO2:
  35.                 svetlo = CRVENO;
  36.                 break;
  37.         }
  38.        
  39.     }
  40.    
  41.    
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement