Example #1
0
  public void unregisterAndRecycleAtomicPart(AtomicPart part) {
    int partId = part.getId();

    BaseOperation.removeAtomicPartFromBuildDateIndex(partBuildDateIndex, part);
    partIdIndex.remove(partId);
    part.clearPointers();

    idPool.putUnusedId(partId);
  }
Example #2
0
  public AtomicPart createAndRegisterAtomicPart() throws OperationFailedException {
    int id = idPool.getId();
    String type = createType();
    int buildDate = createBuildDate(Parameters.MinAtomicDate, Parameters.MaxAtomicDate);
    int x = ThreadRandom.nextInt(Parameters.XYRange), y = x + 1; // convenient for invariant tests

    AtomicPart part = designObjFactory.createAtomicPart(id, type, buildDate, x, y);

    partIdIndex.put(id, part);
    BaseOperation.addAtomicPartToBuildDateIndex(partBuildDateIndex, part);

    return part;
  }