Example #1
0
 //  Set Object Reference for Personnel and PersonnelList
 public static void Ref_Personnel_PersonnelList(
     IDMap map, ArrayList<PersonnelList> PeLlist, ArrayList<Personnel> Pelist) {
   while (map.hasNext()) {
     Pair mapping = map.NextPair();
     if (mapping.notNull()) {
       Pelist.get(mapping.Second()).setPersonnelList(PeLlist.get(mapping.First()));
     }
   }
   map.Reset();
 }
Example #2
0
 @Override
 public boolean solve(final Object solver, long res) {
   if ((res < (1L << 52)) && (solver != null)) {
     {
       final IDMap<Object> solvers = MappedDatabase.this.solvers;
       final int sid;
       synchronized (solvers) {
         if (solvers.containsKey(solver)) sid = solvers.get(solver);
         else {
           sid = solvers.map(solver);
           final LocalDateTime now = LocalDateTime.now();
           solverLog.printf(
               "%04d-%02d-%02d %02d:%02d SOLVER #%4d: %s\n",
               now.getYear(),
               now.getMonthValue(),
               now.getDayOfMonth(),
               now.getHour(),
               now.getMinute(),
               sid,
               solver);
         }
       }
       res |= (long) sid << 52;
     }
     final long spec = (getSpec() << 20) | timestamp(LocalDateTime.now());
     final LongBuffer db = MappedDatabase.this.db;
     final int idx = this.idx;
     synchronized (db) {
       if (((db.get(idx) ^ spec) >> 20) == 0L) {
         if (db.get(idx + 1) == 0L) {
           db.put(idx, spec);
           db.put(idx + 1, res);
         } else {
           final DataOutput dupStream = MappedDatabase.this.dupStream;
           if (dupStream != null) {
             try {
               dupStream.writeLong(spec);
               dupStream.writeLong(res);
             } catch (final Exception e) {
               System.err.printf(
                   "Duplicate result: %010X: %013X by %s\n", spec >>> 25, res, solver);
             }
           }
         }
         return true;
       }
     }
   }
   System.err.printf("Result report error: %010X: %013X by %s\n", getSpec() >>> 5, res, solver);
   return false;
 } // solve()