Esempio n. 1
0
  @Override
  public void release() {
    cacheData.clear();

    // for memory mapped type we create temporary unpacked files which should be removed
    if (dir != null) dir.clear();
  }
Esempio n. 2
0
 /** Turnoff and cleanup the plugin. sets shutdown flag Signs all users out of IRC */
 @Override
 public void onDisable() {
   // disconnect all agents
   TIntObjectProcedure<IrcAgent> shutdown = new ShutdownProcedure();
   bots.forEachEntry(shutdown);
   bots.clear();
   LOG.log(Level.INFO, this.getDescription().getFullName() + " is disabled");
 }
Esempio n. 3
0
 /**
  * Records the current solution of the solver clears all previous recordings
  *
  * @param solver a solver
  */
 public void record(Solver solver) {
   if (empty) {
     Variable[] _dvars = solver.getStrategy().getVariables();
     for (int i = 0; i < _dvars.length; i++) {
       dvars.add(_dvars[i].getId());
     }
     empty = false;
   }
   boolean warn = false;
   intmap.clear();
   realmap.clear();
   setmap.clear();
   Variable[] vars = solver.getVars();
   for (int i = 0; i < vars.length; i++) {
     if ((vars[i].getTypeAndKind() & Variable.TYPE) != Variable.CSTE) {
       int kind = vars[i].getTypeAndKind() & Variable.KIND;
       if (!vars[i].isInstantiated()) {
         if (dvars.contains(vars[i].getId())) {
           throw new SolverException(vars[i] + " is not instantiated when recording a solution.");
         } else {
           warn = true;
         }
       } else {
         switch (kind) {
           case Variable.INT:
           case Variable.BOOL:
             IntVar v = (IntVar) vars[i];
             intmap.put(v.getId(), v.getValue());
             break;
           case Variable.REAL:
             RealVar r = (RealVar) vars[i];
             realmap.put(r.getId(), new double[] {r.getLB(), r.getUB()});
             break;
           case Variable.SET:
             SetVar s = (SetVar) vars[i];
             setmap.put(s.getId(), s.getValues());
             break;
         }
       }
     }
   }
   if (warn && solver.getSettings().warnUser()) {
     Chatterbox.err.printf(
         "Some non decision variables are not instantiated in the current solution.");
   }
 }