class Splitting {

    protected List<TNodeTemplate> getNodeTemplatesWhichPredecessorsHasNoPredecessors(TTopologyTemplate topologyTemplate) {
        List<TNodeTemplate> nodeTemplates = ModelUtilities.getAllNodeTemplates(topologyTemplate);

        List<TNodeTemplate> predecessorsOfpredecessors = new ArrayList<>();
        predecessorsOfpredecessors.clear();
        List<TNodeTemplate> candidates = new ArrayList<>();
        for (TNodeTemplate nodeTemplate : nodeTemplates) {
            List<TNodeTemplate> allPredecessors = getHostedOnPredecessorsOfNodeTemplate(topologyTemplate, nodeTemplate);
            if (!allPredecessors.isEmpty()) {
                predecessorsOfpredecessors.clear();
                for (TNodeTemplate predecessor : allPredecessors) {
                    predecessorsOfpredecessors.addAll(getHostedOnPredecessorsOfNodeTemplate(topologyTemplate, predecessor));
                }
                if (predecessorsOfpredecessors.isEmpty()) {
                    candidates.add(nodeTemplate);
                }
            }
        }
        return candidates;
    }

}