Exemple #1
0
  public static void initGame() {

    whitePlayer = new Player(Color.black, "Pesho");
    blackPlayer = new Player(Color.white, "Gosho");
    board = new Board();
    engine = Engine.getInstance(blackPlayer, whitePlayer, board);
  }
Exemple #2
0
 public void startTask() {
   if (processTaskInfo != null) {
     if (processTaskInfo.getFunction().equalsIgnoreCase(Config.EVOKE)) {
       try {
         Engine.getInstance()
             .evoke(
                 processTaskInfo.getProcessId(),
                 processTaskInfo.getNodeId(),
                 processTaskInfo.getForm());
       } catch (SQLException e) {
         // 数据库出现异常,再将该任务加入任务列表中
         Log.getLogger(Config.DATABASE).fatal("failed to get the process object", e);
         synchronized (Engine.taskList) {
           Engine.taskList.offer(
               new Command(
                   processTaskInfo.getProcessId(),
                   processTaskInfo.getNodeId(),
                   processTaskInfo.getForm(),
                   Config.EVOKE));
         }
       }
     } else {
       try {
         Engine.getInstance()
             .recieveResponse(
                 processTaskInfo.getProcessId(),
                 processTaskInfo.getNodeId(),
                 processTaskInfo.getForm());
       } catch (SQLException e) {
         // 数据库出现异常,再将该任务加入任务列表中
         Log.getLogger(Config.DATABASE).fatal("failed to get the process object", e);
         synchronized (Engine.taskList) {
           Engine.taskList.offer(
               new Command(
                   processTaskInfo.getProcessId(),
                   processTaskInfo.getNodeId(),
                   processTaskInfo.getForm(),
                   Config.RECIEVE));
         }
       }
     }
   }
 }
 public void changeMaping(Employee employee, Equipment equipment) {
   Mapping mapping =
       database
           .find(Mapping.class)
           .add(MobeelizerRestrictions.eq("equipment", equipment.getGuid()))
           .uniqueResult();
   mapping.setEmployee(employee.getGuid());
   mapping.setCreationDate(new Date());
   mapping.setCreatedBy(Engine.getInstance().getUserIdentyfication().getCurrentUser().getId());
   database.save(mapping);
 }
Exemple #4
0
 @Override
 public SessionInterface reconnect(boolean write) {
   readSessionState();
   close();
   Session newSession = Engine.getInstance().createSession(connectionInfo);
   newSession.sessionState = sessionState;
   newSession.recreateSessionState();
   if (write) {
     while (!newSession.database.beforeWriting()) {
       // wait until we are allowed to write
     }
   }
   return newSession;
 }
 public BPMView(Context context, AttributeSet attrs) {
   super(context, attrs);
   BPMBackground =
       Bitmap.createScaledBitmap(
           BitmapFactory.decodeResource(getResources(), R.drawable.lcdscreen3), /*(int)(240*0.5)*/
           (int) (Engine.getInstance().w * 0.1),
           (int) (120 * 1.5),
           true);
   lens =
       Bitmap.createScaledBitmap(
           BitmapFactory.decodeResource(getResources(), R.drawable.lens),
           (int) (Engine.getInstance().w * 0.1),
           (int) (120 * 1.5),
           true);
   paint = new Paint();
   paint.setAntiAlias(true);
   paint.setColor(Color.rgb(5, 117, 205));
   font = Typeface.createFromAsset(context.getAssets(), "rabbit.TTF");
   paint.setTypeface(font);
   paint.setTextSize((float) (0.05 * Engine.getInstance().h));
   this.setLayoutParams(
       new LayoutParams(
           (int) (0.0469 * Engine.getInstance().w), (int) (0.0469 * Engine.getInstance().w)));
 }
  public void map(Place place, Employee employee) {
    List<Mapping> mappings =
        database
            .find(Mapping.class)
            .add(MobeelizerRestrictions.eq("employee", employee.getGuid()))
            .list();
    for (int i = 0; i < mappings.size(); ++i) {
      if (mappings.get(i).getPlace() != null) {
        database.delete(Mapping.class, mappings.get(i).getGuid());
      }
    }

    Mapping mapping = new Mapping();
    mapping.setEmployee(employee.getGuid());
    mapping.setPlace(place.getGuid());
    mapping.setCreatedBy(Engine.getInstance().getUserIdentyfication().getCurrentUser().getId());
    mapping.setCreationDate(new Date());
    database.save(mapping);
  }
 static boolean sendFile(String remoteUri, String filePath) {
   final Engine engine = (Engine) Engine.getInstance();
   final INgnSipService sipService = engine.getSipService();
   final IScreenService screenService = engine.getScreenService();
   final String validUri = NgnUriUtils.makeValidSipUri(remoteUri);
   if (validUri == null) {
     Log.e(TAG, "failed to normalize sip uri '" + remoteUri + "'");
     return false;
   }
   final NgnMsrpSession msrpSession =
       NgnMsrpSession.createOutgoingSession(
           sipService.getSipStack(), NgnMediaType.FileTransfer, validUri);
   if (msrpSession == null) {
     Log.e(TAG, "Failed to create MSRP session");
     return false;
   }
   if (msrpSession.sendFile(filePath)) {
     screenService.show(ScreenFileTransferView.class, Long.toString(msrpSession.getId()));
     return true;
   } else {
     Log.e(TAG, "Failed to send file");
     return false;
   }
 }