Example #1
0
 /**
  * Get the number of duplicates of the parental crossing of this seed lot node. In case of an
  * initial seed lot node without parental crossing, 0 is returned.
  *
  * @return get number of duplicates of the parental crossing, if any
  */
 public int numDuplicatesOfParentCrossing() {
   if (parentCrossing == null) {
     return 0;
   } else {
     return parentCrossing.getNumDuplicates();
   }
 }
Example #2
0
 /**
  * Create a new seed lot node with given parental crossing, ID and sub ID. The seed lot node is
  * automatically registered with its parental crossing (if any).
  *
  * @param seedLot contained seed lot
  * @param generation generation in which seed lot is obtained
  * @param parentCrossing crossing performed to obtain the seeds in this seed lot
  * @param ID given ID
  * @param subID given sub ID
  */
 @SuppressWarnings("LeakingThisInConstructor")
 public SeedLotNode(
     SeedLot seedLot, int generation, CrossingNode parentCrossing, long ID, int subID) {
   this.seeds = null;
   this.seedLot = seedLot;
   this.generation = generation;
   this.ID = ID;
   this.subID = subID;
   // set parent
   this.parentCrossing = parentCrossing;
   // initialize children
   children = new HashMap<>();
   // register with parent crossing (if any)
   if (parentCrossing != null) {
     parentCrossing.setChild(this);
   }
 }
Example #3
0
 /**
  * Create a deep copy of this seed lot node node and its ancestor structure.
  *
  * @param shiftGen if <code>true</code> all generations are shifted (+1)
  * @param curCopiedSeedLots currently already copied seed lot nodes
  * @param curCopiedPlants currently already copied plant nodes
  * @return deep copy of this seed lot node and its ancestor structure, possibly with shifted
  *     generations (+1)
  * @throws CrossingSchemeException if anything goes wrong when copying this or related nodes
  */
 public SeedLotNode deepUpwardsCopy(
     boolean shiftGen,
     Map<String, SeedLotNode> curCopiedSeedLots,
     Map<String, PlantNode> curCopiedPlants)
     throws CrossingSchemeException {
   // copy parent crossing (if any)
   CrossingNode parentCopy = null;
   if (parentCrossing != null) {
     parentCopy = parentCrossing.deepUpwardsCopy(shiftGen, curCopiedSeedLots, curCopiedPlants);
   }
   // copy seedlot node
   int gen = generation;
   if (shiftGen) {
     gen++;
   }
   SeedLotNode copy = new SeedLotNode(seedLot, gen, parentCopy, ID, subID);
   return copy;
 }