lpr-b:ccremoto
no way to compare when less than two revisions
Differenze
Queste sono le differenze tra la revisione selezionata e la versione attuale della pagina.
— | lpr-b:ccremoto [07/12/2007 alle 10:01 (17 anni fa)] (versione attuale) – creata Marco Danelutto | ||
---|---|---|---|
Linea 1: | Linea 1: | ||
+ | <code java> | ||
+ | package ccRMI; | ||
+ | import java.rmi.RemoteException; | ||
+ | import java.rmi.server.UnicastRemoteObject; | ||
+ | |||
+ | public class CC extends UnicastRemoteObject implements InterfacciaCC { | ||
+ | |||
+ | |||
+ | private static final long serialVersionUID = 1L; | ||
+ | |||
+ | private long cc = 0L; | ||
+ | |||
+ | protected CC() throws RemoteException { | ||
+ | super(); | ||
+ | } | ||
+ | |||
+ | public synchronized long prelievo(long quanto) throws RemoteException { | ||
+ | if(quanto <= cc) { | ||
+ | cc -= quanto; | ||
+ | return (cc); | ||
+ | } else | ||
+ | return -cc; | ||
+ | } | ||
+ | |||
+ | public synchronized long saldo() throws RemoteException { | ||
+ | return cc; | ||
+ | } | ||
+ | |||
+ | public synchronized long versa(long quanto) throws RemoteException { | ||
+ | cc += quanto; | ||
+ | return cc; | ||
+ | } | ||
+ | |||
+ | } | ||
+ | </ |
lpr-b/ccremoto.txt · Ultima modifica: 07/12/2007 alle 10:01 (17 anni fa) da Marco Danelutto