Skip to content
Snippets Groups Projects
AbstractWallet.java 1.64 KiB
Newer Older
import fucoin.AbstractNode;

public abstract class AbstractWallet extends AbstractNode {
    /**
     * Currently amount of this wallet
     */
    protected int amount;

    /**
     * The name of this wallet (does never change, no duplicates in network assumed)
     */
    protected final String name;

    /**
     * Init. a wallet with a name.
     *
     * @param name Name of the Wallet
     */
    public AbstractWallet(String name) {
        this.name = name;
    }

    /**
     * Returns the name of the wallet
     *
     * @return Name of the wallet.
     */
    public String getName() {
        return this.name;
    }

    /**
     * Performs housekeeping operations, e.g. pushes
     * backedUpNeighbor-entries to other neighbors
     */
    public abstract void leave();

    /**
     * Returns the current amount of the wallet
     *
     * @return amount of the wallet
     */
    public int getAmount() {
        return amount;
    }

    /**
     * Set new Amount of the wallet.
     * @param amount New amount of the wallet
     */
    public abstract void setAmount(int amount);

    /**
     * Add amount to current amount.
     * @param amount value to add to current account.
     */
    public abstract void addAmount(int amount);

    public abstract void setActive(boolean isActive);

    public abstract ActorRef getPreKnownNeighbour();
    public abstract void setRemoteSuperVisorActor(ActorRef remoteSuperVisorActor);

    public abstract void logTransaction(String msg);

    public abstract void send(String address, int amount);