示例#1
0
  public NSArray topMostTaserParents() {
    Enumeration enumer = anItem.topMostParents().objectEnumerator();
    NSMutableArray temp = new NSMutableArray();
    // System.out.println("Item - " + anItem.valueForKey("bugId")  + " - " + anItem.shortDesc());

    while (enumer.hasMoreElements()) {
      Item tempEo = (Item) enumer.nextElement();
      // System.out.println("\t\tparentA - " + tempEo.bugId() + " - " + tempEo.shortDesc());

      if ((tempEo.type().equals("Prospect")) || (tempEo.type().equals("Customer"))) {
        temp.addObject(tempEo);

        // System.out.println("\t\tparentB - " + tempEo.bugId() + " - " + tempEo.shortDesc());
      }
    }
    return temp;
  }
示例#2
0
 /**
  * Adds the given "uninitialized" type to {@link #typeTable} and returns its index. This method is
  * used for UNINITIALIZED types, made of an internal name and a bytecode offset.
  *
  * @param type the internal name to be added to the type table.
  * @param offset the bytecode offset of the NEW instruction that created this UNINITIALIZED type
  *     value.
  * @return the index of this internal name in the type table.
  */
 int addUninitializedType(final String type, final int offset) {
   key.type = TYPE_UNINIT;
   key.intVal = offset;
   key.strVal1 = type;
   key.hashCode = 0x7FFFFFFF & (TYPE_UNINIT + type.hashCode() + offset);
   Item result = get(key);
   if (result == null) {
     result = addType(key);
   }
   return result.index;
 }
示例#3
0
 /**
  * Returns the index of the common super type of the two given types. This method calls {@link
  * #getCommonSuperClass} and caches the result in the {@link #items} hash table to speedup future
  * calls with the same parameters.
  *
  * @param type1 index of an internal name in {@link #typeTable}.
  * @param type2 index of an internal name in {@link #typeTable}.
  * @return the index of the common super type of the two given types.
  */
 int getMergedType(final int type1, final int type2) {
   key2.type = TYPE_MERGED;
   key2.longVal = type1 | (((long) type2) << 32);
   key2.hashCode = 0x7FFFFFFF & (TYPE_MERGED + type1 + type2);
   Item result = get(key2);
   if (result == null) {
     String t = typeTable[type1].strVal1;
     String u = typeTable[type2].strVal1;
     key2.intVal = addType(getCommonSuperClass(t, u));
     result = new Item((short) 0, key2);
     put(result);
   }
   return result.intVal;
 }
示例#4
0
文件: A2.java 项目: pkvac/My-Projects
    public void commandLETTER(
        String srcPostOffice,
        String pickUpPerson,
        String dstPostOffice,
        String returnPerson,
        int systemTime) {
      int srcOfficeIndex = getOfficeIndex(srcPostOffice);
      if (srcOfficeIndex != -1) {
        newLetterEntry("log_" + srcPostOffice + ".txt", srcPostOffice, dstPostOffice);
        int dstOfficeIndex = getOfficeIndex(dstPostOffice);
        if (dstOfficeIndex != -1) {
          if (isNewCriminal(newCriminals, pickUpPerson) == false
              && isOldCriminal("wanted.txt", pickUpPerson) == false) {
            if (((Office) offices.get(srcOfficeIndex)).currentItems.size()
                < ((Office) offices.get(srcOfficeIndex)).maxCap) {
              Item newItem = new Item();
              newItem.fromOffice = new String(srcPostOffice);
              newItem.recipent = new String(pickUpPerson);
              newItem.toOffice = new String(dstPostOffice);
              if (returnPerson.equals("NONE")) {
                newItem.returnRecipent = "";
              } else {
                newItem.returnRecipent = new String(returnPerson);
              }
              newItem.dayGotInSystem = systemTime;
              newItem.type = new String("letter");
              newItem.delivaryTime = ((Office) offices.get(srcOfficeIndex)).transitTime;
              ((Office) offices.get(srcOfficeIndex)).waitingForSending.add(newItem);
              acceptedLetterEntry("log_" + srcPostOffice + ".txt", dstPostOffice);
            } else {
              rejectedLetterEntry("log_" + srcPostOffice + ".txt", srcPostOffice);
              rejectedLetterEntry("log_master.txt", srcPostOffice);
            }
          } else {
            rejectedLetterEntry("log_" + srcPostOffice + ".txt", srcPostOffice);
            rejectedLetterEntry("log_master.txt", srcPostOffice);
          }

        } else {
          rejectedLetterEntry("log_" + srcPostOffice + ".txt", srcPostOffice);
          rejectedLetterEntry("log_master.txt", srcPostOffice);
        }
      }
    }
示例#5
0
文件: A2.java 项目: pkvac/My-Projects
 public void commandPACKAGE(
     String srcPostOffice,
     String pickUpPerson,
     String dstPostOffice,
     int funds,
     int packageLen) {
   int srcOfficeIndex = getOfficeIndex(srcPostOffice);
   if (srcOfficeIndex != -1) {
     newPackageEntry("log_" + srcPostOffice + ".txt", srcPostOffice, dstPostOffice);
     int dstOfficeIndex = getOfficeIndex(dstPostOffice);
     if (dstOfficeIndex != -1) {
       if (isNewCriminal(newCriminals, pickUpPerson) == false
           && isOldCriminal("wanted.txt", pickUpPerson) == false) {
         if (((Office) offices.get(srcOfficeIndex)).currentItems.size()
             < ((Office) offices.get(srcOfficeIndex)).maxCap) {
           if (funds >= ((Office) offices.get(srcOfficeIndex)).postagePrice) {
             if (packageLen <= ((Office) offices.get(srcOfficeIndex)).maxPackageSize) {
               if (packageLen <= ((Office) offices.get(dstOfficeIndex)).maxPackageSize) {
                 // Clean insertion
                 Item newItem = new Item();
                 newItem.fromOffice = new String(srcPostOffice);
                 newItem.recipent = new String(pickUpPerson);
                 newItem.toOffice = new String(dstPostOffice);
                 newItem.funds = funds;
                 newItem.length = packageLen;
                 newItem.type = new String("package");
                 newItem.dayGotInSystem = currentDay;
                 newItem.delivaryTime = ((Office) offices.get(srcOfficeIndex)).transitTime;
                 ((Office) offices.get(srcOfficeIndex)).waitingForSending.add(newItem);
                 acceptedPackageEntry("log_" + srcPostOffice + ".txt", dstPostOffice);
               } else {
                 rejectedPackageEntry("log_" + srcPostOffice + ".txt", srcPostOffice);
                 rejectedPackageEntry("log_master.txt", srcPostOffice);
               }
             } else if (funds
                 >= (((Office) offices.get(srcOfficeIndex)).postagePrice
                     + ((Office) offices.get(srcOfficeIndex)).persuationPrice)) {
               // Illegal insertion
               Item newItem = new Item();
               newItem.fromOffice = new String(srcPostOffice);
               newItem.recipent = new String(pickUpPerson);
               newItem.toOffice = new String(dstPostOffice);
               newItem.funds = funds;
               newItem.length = packageLen;
               newItem.type = new String("package");
               newItem.dayGotInSystem = currentDay;
               newItem.delivaryTime = ((Office) offices.get(srcOfficeIndex)).transitTime;
               ((Office) offices.get(srcOfficeIndex)).waitingForSending.add(newItem);
               acceptedPackageEntry("log_" + srcPostOffice + ".txt", dstPostOffice);
               briberyDetectedEntry("log_master.txt", srcPostOffice);
             } else {
               rejectedPackageEntry("log_" + srcPostOffice + ".txt", srcPostOffice);
               rejectedPackageEntry("log_master.txt", srcPostOffice);
             }
           } else {
             rejectedPackageEntry("log_" + srcPostOffice + ".txt", srcPostOffice);
             rejectedPackageEntry("log_master.txt", srcPostOffice);
           }
         } else {
           rejectedPackageEntry("log_" + srcPostOffice + ".txt", srcPostOffice);
           rejectedPackageEntry("log_master.txt", srcPostOffice);
         }
       } else {
         rejectedPackageEntry("log_" + srcPostOffice + ".txt", srcPostOffice);
         rejectedPackageEntry("log_master.txt", srcPostOffice);
       }
     } else {
       rejectedPackageEntry("log_" + srcPostOffice + ".txt", srcPostOffice);
       rejectedPackageEntry("log_master.txt", srcPostOffice);
     }
   }
 }