Пример #1
0
 /**
  * Checks if the Loop contains the specified child Loop. It will check the complete child
  * hierarchy.
  *
  * @param name name of a child loop
  * @return boolean
  */
 public boolean hasLoop(String name) {
   for (Loop l : this.childList()) {
     if (name.equals(l.getName())) {
       return true;
     }
     if (l.hasLoop(name)) {
       return true;
     }
   }
   return false;
 }
Пример #2
0
 /**
  * Get the loop in the X12 transaction It will check the complete child hierarchy.
  *
  * @param name name of a loop
  * @return {@link java.util.List}<{@link Loop}>
  */
 public List<Loop> findLoop(String name) {
   List<Loop> foundLoops = new ArrayList<Loop>();
   for (Loop l : this.childList()) {
     if (name.equals(l.getName())) {
       foundLoops.add(l);
     }
     List<Loop> moreLoops = l.findLoop(name);
     if (moreLoops.size() > 0) {
       foundLoops.addAll(moreLoops);
     }
   }
   return foundLoops;
 }