Example #1
0
 public void addClient(Client client) { // Add One Client
   String description = "Client Added";
   int index = 0;
   for (int i = 0; i < clients.length; i++) {
     if (clients[i] == null) {
       clients[i] = client;
       index = i;
       i = clients.length;
     }
   }
   out.print(" index = " + index + " *** ");
   out.println(
       Log.getData(
           clients[index].getId(),
           description,
           clients[index].getBalance(),
           client.getClass().getName()));
 } // For real Program
Example #2
0
  public void addClient(Client client, int i) { //  Create Random Array of  Client
    int index = 0;
    boolean isEmpty = true;

    while (isEmpty) {
      if (clients[i] == null) {
        clients[i] = client;
        index = i;
        isEmpty = false;
      } else if (i < clients.length - 1) i++;
      else i = 0;
    }
    String description = " Client Random ADDED ";
    out.print(" index = " + index + " *** ");
    out.println(
        Log.getData(
            clients[index].getId(),
            description,
            clients[index].getBalance(),
            client.getClass().getName()));
  } // For Random Program
Example #3
0
  public void removeClients(Client client) {
    String description = "CLIENT REMOVED";

    int i = 0;
    while (i < clients.length) {
      if (clients[i] != null) {
        System.out.println("!!!Remove!!!! Id = " + clients[i].getId());
        if (clients[i].equals(client)) {
          out.println(
              Log.getData(
                  clients[i].getId(),
                  description,
                  clients[i].getBalance(),
                  clients[i].getClass().getName()));
          clients[i] = null;
          i = clients.length;
        }
      }
      i++;
    }
  }