Example #1
0
 @Override
 public void run() {
   while (scenario.day < 371) {
     // wait a day...
     try {
       Thread.sleep(scenario.sleepTime);
     } catch (InterruptedException e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
     }
     switch (state) {
       case SLEEPING: // if sleeping, continue to sleep
         break;
       case WOKEN_UP_BY_ELVES:
         // FIXME: help the elves who are at the door and go back to sleep
         for (Elf elf : scenario.elves) {
           if (elf.isAtDoor()) elf.backToWork();
         }
         state = SantaState.SLEEPING;
         break;
       case WOKEN_UP_BY_REINDEER:
         // FIXME: assemble the reindeer to the sleigh then change state to ready
         break;
       case READY_FOR_CHRISTMAS: // nothing more to be done
         break;
     }
   }
 }
Example #2
0
 public Symbol(Elf elf, String name, int value, Section section) {
   this.elf = elf;
   if (name != null) {
     this.st_name = elf.addString(name);
   } else {
     this.st_name = 0;
   }
   this.st_value = value;
   if (section != null) {
     this.st_shndx = elf.getSectionIndex(section);
   } else {
     this.st_shndx = SHN_UNDEF;
   }
   this.st_info = (STB_GLOBAL << 4) | (STT_FUNC & 0xF);
 }
Example #3
0
 public Symbol getSymbol() {
   if (symbol != null) {
     return symbol;
   } else {
     return elf.getSymbol(r_symndx);
   }
 }
Example #4
0
 public int getSymbolIndex() {
   if (symbol != null) {
     return elf.getIndexOfSymbol(symbol);
   } else {
     return r_symndx;
   }
 }
Example #5
0
  public int store(OutputStream out) throws IOException {

    if (symbol != null) {
      r_symndx = elf.getIndexOfSymbol(symbol);
    }

    final long info;
    if (elf.isClass32()) {
      info = (r_type & 0xFF) | (r_symndx << 8);
    } else {
      info = ((long) r_type) | (((long) r_symndx) << 32);
    }
    int cnt = 0;
    cnt += StoreUtil.storeAddr(out, elf.e_ident, r_address);
    cnt += StoreUtil.storeXword(out, elf.e_ident, info);
    return cnt;
  }
Example #6
0
 public Type getRelocType() {
   final Type[] types = (elf.isClass32() ? i386_RelocNumbers : x86_64_RelocNumbers);
   final int length = types.length;
   for (int i = 0; i < length; i++) {
     if (types[i].getNr() == r_type) {
       return types[i];
     }
   }
   return null;
 }
Example #7
0
 public Reloc(Elf elf, InputStream in) throws IOException {
   this.elf = elf;
   this.r_address = LoadUtil.loadAddr(in, elf.e_ident);
   final long info = LoadUtil.loadXword(in, elf.e_ident);
   this.r_info = info;
   if (elf.isClass32()) {
     this.r_symndx = (int) (info >> 8);
     this.r_type = (int) (info & 0xFF);
   } else {
     this.r_symndx = (int) (info >>> 32);
     this.r_type = (int) (info & 0xFFFFFFFF);
   }
 }
Example #8
0
  public PetBar(float width, float height) {
    super(0, 0, width, height);
    mShiftAnimation = new GLTranslate(100, 0, 0);
    updateParameters();

    mElf = new Elf();
    addPet(mElf);
    mElf.setPetBar(this);

    mPetMotion = new GLTranslate[mPetMax];
    for (int i = 0; i < mPetMax; i++) {
      mPetMotion[i] = new GLTranslate(mMotionTime, 0f, 0f);
    }

    mPressPoint = new PointF();
  }
Example #9
0
 public Symbol(Elf elf, InputStream in) throws IOException {
   this.elf = elf;
   if (elf.isClass32()) {
     st_name = LoadUtil.little32(in);
     st_value = LoadUtil.loadAddr(in, elf.e_ident);
     st_size = LoadUtil.loadXword(in, elf.e_ident);
     st_info = LoadUtil.little8(in);
     st_other = LoadUtil.little8(in);
     st_shndx = LoadUtil.little16(in);
   } else {
     st_name = LoadUtil.little32(in);
     st_info = LoadUtil.little8(in);
     st_other = LoadUtil.little8(in);
     st_shndx = LoadUtil.little16(in);
     st_value = LoadUtil.loadAddr(in, elf.e_ident);
     st_size = LoadUtil.loadXword(in, elf.e_ident);
   }
 }
Example #10
0
 public int store(OutputStream out) throws IOException {
   int cnt = 0;
   if (elf.isClass32()) {
     cnt += StoreUtil.little32(out, st_name);
     cnt += StoreUtil.storeAddr(out, elf.e_ident, st_value);
     cnt += StoreUtil.storeXword(out, elf.e_ident, st_size);
     cnt += StoreUtil.little8(out, st_info);
     cnt += StoreUtil.little8(out, st_other);
     cnt += StoreUtil.little16(out, st_shndx);
   } else {
     cnt += StoreUtil.little32(out, st_name);
     cnt += StoreUtil.little8(out, st_info);
     cnt += StoreUtil.little8(out, st_other);
     cnt += StoreUtil.little16(out, st_shndx);
     cnt += StoreUtil.storeAddr(out, elf.e_ident, st_value);
     cnt += StoreUtil.storeXword(out, elf.e_ident, st_size);
   }
   return cnt;
 }
Example #11
0
 /**
  * Operation
  *
  * @param e Elf (tünde) típusú ellenség
  */
 public void damage(Elf e) {
   Logging.log(">> Bullet.damage() hívás, paraméter: " + e.toString());
   e.sebez(elfDamage);
 }
Example #12
0
 public Section getSection() {
   return elf.getSection(st_shndx);
 }
Example #13
0
 public String getName() {
   return elf.getString(st_name);
 }