Inserts a flat list as a tree in a TableCollectionManager. It does
insert data in the right order for the creation of the tree (parents
must be inserted first)

@param list
@param mng
@param parentIdGetter
545645
public static <T extends IHasIntegerId> void insertFlatList( List<T> list, TableCollectionManager<T> mng, Func1<T, Integer> parentIdGetter )
	{
		HashSet<Integer> inserted = new HashSet<>();
		
		List<T> toInsert = new ArrayList<>( list );
		List<T> postPoned = new ArrayList<>();
		List<T> inOrder = new ArrayList<>();
		
		int nbInserted;
		
		while( ! toInsert.isEmpty() )
		{
			nbInserted = 0;
			while( ! toInsert.isEmpty() )
			{
				T a = toInsert.remove( 0 );
				Integer parentId = parentIdGetter.exec( a );
				
				if( parentId==null || parentId<=0 || inserted.contains( parentId ) || mng.getRowForRecordId( parentId )!=null )
				{
					inOrder.add( a );
					inserted.add( a.getId() );
					
					nbInserted++;
				}
				else
				{
					postPoned.add( a );
				}
			}
			toInsert = postPoned;
			postPoned = new ArrayList<>();
			
			if( nbInserted == 0 && ! toInsert.isEmpty() )
			{
				GWT.log("Cannot construct full tree !");
				throw new RuntimeException( "Cannot construct full tree !" );
			}
		}
		
		for( T t : inOrder )
			mng.getDataPlug().updated( t );
	}
1059317
private void addChildrenForOUNode(CmsOrganizationalUnit item) {

        List<Object> itemsToRemove = new ArrayList<Object>();

        Collection<?> childCol = m_treeContainer.getChildren(item);
        if (childCol != null) {
            itemsToRemove.addAll(childCol);
        }

        try {
            if (m_app.isOUManagable(item.getName())) {

                List<I_CmsOuTreeType> types = m_app.getTreeTypeProvider().getTreeTypes();
                for (I_CmsOuTreeType type : types) {
                    if (!type.isValidForOu(m_cms, item.getName())) {
                        continue;
                    }
                    if (type.isOrgUnit()) {
                        continue;
                    }
                    String itemId = type.getId() + item.getName();
                    Item newItem = m_treeContainer.addItem(itemId);
                    itemsToRemove.remove(itemId);
                    if (newItem != null) {
                        newItem.getItemProperty(PROP_NAME).setValue(getIconCaptionHTML(itemId, type));
                        newItem.getItemProperty(PROP_TYPE).setValue(type);
                        m_treeContainer.setParent(itemId, item);
                        setChildrenAllowed(itemId, type.isExpandable());
                    }
                }
            }
            List<CmsOrganizationalUnit> ous = OpenCms.getOrgUnitManager().getOrganizationalUnits(
                m_cms,
                item.getName(),
                false);
            List<CmsOrganizationalUnit> webOus = new ArrayList<CmsOrganizationalUnit>();
            for (CmsOrganizationalUnit ou : ous) {
                if (m_app.isParentOfManagableOU(ou.getName())) {
                    itemsToRemove.remove(ou);
                    if (ou.hasFlagWebuser()) {
                        webOus.add(ou);
                    } else {
                        addOuToTree(ou, item);
                    }
                }
            }
            for (CmsOrganizationalUnit ou : webOus) {
                if (m_app.isParentOfManagableOU(ou.getName())) {
                    itemsToRemove.remove(ou);
                    addOuToTree(ou, item);
                }
            }
        } catch (CmsException e) {
            LOG.error("Can't read ou", e);
        }
        for (Object it : itemsToRemove) {
            m_treeContainer.removeItemRecursively(it);
        }
    }
102738
public CompositeGeneratorNode appendNewLine(final CompositeGeneratorNode parent) {
    List<IGeneratorNode> _children = parent.getChildren();
    String _lineDelimiter = this.wsConfig.getLineDelimiter();
    NewLineNode _newLineNode = new NewLineNode(_lineDelimiter, false);
    _children.add(_newLineNode);
    return parent;
  }
1102053
@Override
  public List<DoubleSolution> execute(List<DoubleSolution> parentSolutions) {
    DoubleSolution child;

    int jrand;

    child = (DoubleSolution)currentSolution.copy() ;

    int numberOfVariables = parentSolutions.get(0).getNumberOfVariables();
    jrand = jRandomGenerator.getRandomValue(0, numberOfVariables - 1);

    // STEP 4. Checking the DE variant
    if ((DEFAULT_DE_VARIANT.equals(variant)) ||
            "best/1/bin".equals(variant)) {
      for (int j = 0; j < numberOfVariables; j++) {
        if (crRandomGenerator.getRandomValue(0.0, 1.0) < cr || j == jrand) {
          double value;
          value = parentSolutions.get(2).getVariableValue(j) + f * (parentSolutions.get(0).getVariableValue(
            j) -
            parentSolutions.get(1).getVariableValue(j));

          if (value < child.getLowerBound(j)) {
            value = child.getLowerBound(j);
          }
          if (value > child.getUpperBound(j)) {
            value = child.getUpperBound(j);
          }
          child.setVariableValue(j, value);
        } else {
          double value;
          value = currentSolution.getVariableValue(j);
          child.setVariableValue(j, value);
        }
      }
    } else if ("rand/1/exp".equals(variant) ||
            "best/1/exp".equals(variant)) {
      for (int j = 0; j < numberOfVariables; j++) {
        if (crRandomGenerator.getRandomValue(0.0, 1.0) < cr || j == jrand) {
          double value;
          value = parentSolutions.get(2).getVariableValue(j) + f * (parentSolutions.get(0).getVariableValue(j) -
                  parentSolutions.get(1).getVariableValue(j));

          if (value < child.getLowerBound(j)) {
            value = child.getLowerBound(j);
          }
          if (value > child.getUpperBound(j)) {
            value = child.getUpperBound(j);
          }

          child.setVariableValue(j, value);
        } else {
          cr = 0.0;
          double value;
          value = currentSolution.getVariableValue(j);
          child.setVariableValue(j, value);
        }
      }
    } else if ("current-to-rand/1".equals(variant) ||
            "current-to-best/1".equals(variant)) {
      for (int j = 0; j < numberOfVariables; j++) {
        double value;
        value = currentSolution.getVariableValue(j) + k * (parentSolutions.get(2).getVariableValue(j) -
                currentSolution.getVariableValue(j)) +
                f * (parentSolutions.get(0).getVariableValue(j) - parentSolutions.get(1).getVariableValue(j));

        if (value < child.getLowerBound(j)) {
          value = child.getLowerBound(j);
        }
        if (value > child.getUpperBound(j)) {
          value = child.getUpperBound(j);
        }

        child.setVariableValue(j, value);
      }
    } else if ("current-to-rand/1/bin".equals(variant) ||
            "current-to-best/1/bin".equals(variant)) {
      for (int j = 0; j < numberOfVariables; j++) {
        if (crRandomGenerator.getRandomValue(0.0, 1.0) < cr || j == jrand) {
          double value;
          value = currentSolution.getVariableValue(j) + k * (parentSolutions.get(2).getVariableValue(j) -
                  currentSolution.getVariableValue(j)) +
                  f * (parentSolutions.get(0).getVariableValue(j) - parentSolutions.get(1).getVariableValue(j));

          if (value < child.getLowerBound(j)) {
            value = child.getLowerBound(j);
          }
          if (value > child.getUpperBound(j)) {
            value = child.getUpperBound(j);
          }

          child.setVariableValue(j, value);
        } else {
          double value;
          value = currentSolution.getVariableValue(j);
          child.setVariableValue(j, value);
        }
      }
    } else if ("current-to-rand/1/exp".equals(variant) ||
            "current-to-best/1/exp".equals(variant)) {
      for (int j = 0; j < numberOfVariables; j++) {
        if (crRandomGenerator.getRandomValue(0.0, 1.0) < cr || j == jrand) {
          double value;
          value = currentSolution.getVariableValue(j) + k * (parentSolutions.get(2).getVariableValue(j) -
                  currentSolution.getVariableValue(j)) +
                  f * (parentSolutions.get(0).getVariableValue(j) - parentSolutions.get(1).getVariableValue(j));

          if (value < child.getLowerBound(j)) {
            value = child.getLowerBound(j);
          }
          if (value > child.getUpperBound(j)) {
            value = child.getUpperBound(j);
          }

          child.setVariableValue(j, value);
        } else {
          cr = 0.0;
          double value;
          value = currentSolution.getVariableValue(j);
          child.setVariableValue(j, value);
        }
      }
    } else {
      JMetalLogger.logger.severe("DifferentialEvolutionCrossover.execute: " +
              " unknown DE variant (" + variant + ")");
      Class<String> cls = String.class;
      String name = cls.getName();
      throw new JMetalException("Exception in " + name + ".execute()");
    }

    List<DoubleSolution> result = new ArrayList<>(1) ;
    result.add(child) ;
    return result;
  }
1175423
protected Element findAndReplaceSimpleLists(Counter counter, Element parent, java.util.Collection list,
            String parentName, String childName)
   {
      boolean shouldExist = (list != null) && (list.size() > 0);
      Element element = updateElement(counter, parent, parentName, shouldExist);
      if (shouldExist)
      {
         Iterator it = list.iterator();
         Iterator elIt = element.getChildren(childName, element.getNamespace()).iterator();
         if (!elIt.hasNext())
         {
            elIt = null;
         }

         Counter innerCount = new Counter(counter.getDepth() + 1);
         while (it.hasNext())
         {
            String value = (String) it.next();
            Element el;
            if ((elIt != null) && elIt.hasNext())
            {
               el = (Element) elIt.next();
               if (!elIt.hasNext())
               {
                  elIt = null;
               }
            }
            else
            {
               el = factory.element(childName, element.getNamespace());
               insertAtPreferredLocation(element, el, innerCount);
            }
            el.setText(value);
            innerCount.increaseCount();
         }
         if (elIt != null)
         {
            while (elIt.hasNext())
            {
               elIt.next();
               elIt.remove();
            }
         }
      }
      return element;
   }
1246523
public void updateIndex(Set<String> addedNodes, Set<String> removedNodes, Set<String> parentAddedNodes,
      Set<String> parentRemovedNodes)
   {
      // pass lists to search manager 
      if (searchManager != null && (addedNodes.size() > 0 || removedNodes.size() > 0))
      {
         try
         {
            searchManager.updateIndex(removedNodes, addedNodes);
         }
         catch (RepositoryException e)
         {
            log.error("Error indexing changes " + e, e);
         }
         catch (IOException e)
         {
            log.error("Error indexing changes " + e, e);
            try
            {
               handler.logErrorChanges(removedNodes, addedNodes);
            }
            catch (IOException ioe)
            {
               log.warn("Exception occure when errorLog writed. Error log is not complete. " + ioe, ioe);
            }
         }
      }
      // pass lists to parent search manager 
      if (parentSearchManager != null && (parentAddedNodes.size() > 0 || parentRemovedNodes.size() > 0))
      {
         try
         {
            parentSearchManager.updateIndex(parentRemovedNodes, parentAddedNodes);
         }
         catch (RepositoryException e)
         {
            log.error("Error indexing changes " + e, e);
         }
         catch (IOException e)
         {
            log.error("Error indexing changes " + e, e);
            try
            {
               parentHandler.logErrorChanges(parentRemovedNodes, parentAddedNodes);
            }
            catch (IOException ioe)
            {
               log.warn("Exception occure when errorLog writed. Error log is not complete. " + ioe, ioe);
            }
         }
      }
   }
271674
private function addDescendancy(&$list, $pid, $parents = false, $generations = -1): void
    {
        $person = Individual::getInstance($pid, $this->tree);
        if ($person === null) {
            return;
        }
        if (!isset($list[$pid])) {
            $list[$pid] = $person;
        }
        if (!isset($list[$pid]->generation)) {
            $list[$pid]->generation = 0;
        }
        foreach ($person->spouseFamilies() as $family) {
            if ($parents) {
                $husband = $family->husband();
                $wife    = $family->wife();
                if ($husband) {
                    $list[$husband->xref()] = $husband;
                    if (isset($list[$pid]->generation)) {
                        $list[$husband->xref()]->generation = $list[$pid]->generation - 1;
                    } else {
                        $list[$husband->xref()]->generation = 1;
                    }
                }
                if ($wife) {
                    $list[$wife->xref()] = $wife;
                    if (isset($list[$pid]->generation)) {
                        $list[$wife->xref()]->generation = $list[$pid]->generation - 1;
                    } else {
                        $list[$wife->xref()]->generation = 1;
                    }
                }
            }

            $children = $family->children();

            foreach ($children as $child) {
                if ($child) {
                    $list[$child->xref()] = $child;

                    if (isset($list[$pid]->generation)) {
                        $list[$child->xref()]->generation = $list[$pid]->generation + 1;
                    } else {
                        $list[$child->xref()]->generation = 2;
                    }
                }
            }
            if ($generations == -1 || $list[$pid]->generation + 1 < $generations) {
                foreach ($children as $child) {
                    $this->addDescendancy($list, $child->xref(), $parents, $generations); // recurse on the childs family
                }
            }
        }
    }
810168
void setParent(JMFMessageData parent) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            JmfTr.entry(this, tc, "setParent", new Object[] { parent });

        synchronized (getMessageLockArtefact()) {

            // If the parent is a JSMessageData then this is straight forward
            if (parent instanceof JSMessageData) {
                parentMessage = (JSMessageData) parent;
                master = ((JSMessageData) parent).master;
                containingMessage = ((JSMessageData) parent).compatibilityWrapperOrSelf;
            }

            // ... if not, it must be a JSCompatibleMessageImpl, and its encoding must
            // be a JSMessageData, because if it was a JMFEncapsulation it couldn't be our parent
            else {
                JSMessageData msg = (JSMessageData) ((JSCompatibleMessageImpl) parent).getEncodingMessage();
                parentMessage = msg;
                master = msg.master;
                containingMessage = parent;
            }
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            JmfTr.exit(this, tc, "setParent");
    }
1139582
public void setParentGroupNames(java.util.Collection<String> parentGroupNames) {
        if (parentGroupNames == null) {
            this.parentGroupNames = null;
            return;
        }

        this.parentGroupNames = new java.util.ArrayList<String>(parentGroupNames);
    }
51340
public void setList(List<T> list) {
        if (list != mList) {
            mList = list;
            if (mList == null) {
                notifyInvalidated();
            } else {
                notifyChanged();
            }
        }
    }
607086
@Override public List<S> execute(List<S> source) {
    if (null == source) {
      throw new JMetalException("Null parameter") ;
    } else if (source.size() != 2) {
      throw new JMetalException("There must be two parents instead of " + source.size()) ;
    }

    List<S> list = new ArrayList<>() ;
    list.add((S) source.get(0).copy()) ;
    list.add((S) source.get(1).copy()) ;

    return list ;
  }
1133435
public void add(T parent, T child) {
        final Set<T> children = depTree.computeIfAbsent(parent, p -> new LinkedHashSet<>());
        if (!child.equals(parent)) {
            children.add(child);
        }
    }
1302485
public void addParentNode(final String childNodeName, final String parentNodeName) {
    checkIsBuilt();

    final Node child = this.nameToNodeMap.get(childNodeName);
    if (child == null) {
      throw new DagException(String.format("Unknown child node (%s). Did you create the node?",
          childNodeName));
    }

    final Node parent = this.nameToNodeMap.get(parentNodeName);
    if (parent == null) {
      throw new DagException(
          String.format("Unknown parent node (%s). Did you create the node?", parentNodeName));
    }

    child.addParent(parent);
  }
1003232
public void group(TreeTableColumn<S, ?>... treeTableColumns) {
        try {
            lock.lock();
            // init groups map
            if (groupOrder.size() == 0) {
                groups = new HashMap<>();
            }
            try {
                if (originalRoot == null) {
                    originalRoot = getRoot();
                }
                for (TreeTableColumn<S, ?> treeTableColumn : treeTableColumns) {
                    if (groupOrder.contains(treeTableColumn)) {
                        continue;
                    }
                    groups = group(treeTableColumn, groups, null, (RecursiveTreeItem<S>) originalRoot);
                }
                groupOrder.addAll(treeTableColumns);
                // update table ui
                buildGroupedRoot(groups, null, 0);
            } catch (Exception e) {
                e.printStackTrace();
            }
        } finally {
            lock.unlock();
        }
    }
361609
protected static void appendHandler(Class<? extends LogRecordHandler> parent, LogRecordHandler child){
    List<LogRecordHandler> toAdd = new LinkedList<LogRecordHandler>();
    //--Find Parents
    for(LogRecordHandler term : handlers){
      if(parent.isAssignableFrom(term.getClass())){
        toAdd.add(term);
      }
    }
    //--Add Handler
    for(LogRecordHandler p : toAdd){
      appendHandler(p, child);
    }
  }
696369
private void categoryTreeToList(List<CmsCategoryBean> categoryList, List<CmsCategoryTreeEntry> entries) {

        if (entries == null) {
            return;
        }
        // skipping the root tree entry where the path property is empty
        for (CmsCategoryTreeEntry entry : entries) {
            CmsCategoryBean bean = new CmsCategoryBean(entry);
            categoryList.add(bean);
            categoryTreeToList(categoryList, entry.getChildren());
        }
    }
1112062
public void setIsLastSubtaskOnLevel(
			boolean[] parentIsLastSubtaskList, boolean isLastSubtask)
	{
		this.isLastSubtaskOnLevel = 
				new boolean[parentIsLastSubtaskList.length + 1];
		
		for (int i = 0; i < parentIsLastSubtaskList.length; i++) {
			this.isLastSubtaskOnLevel[i] = parentIsLastSubtaskList[i];
		}
		this.isLastSubtaskOnLevel[parentIsLastSubtaskList.length] = 
				isLastSubtask;
	}