Splits this block's lines, creating a new child block having 'line' as it's
lineTail.

@param aLine
The line to split from.
@return The newly created Block.
760338
public Block split (final Line aLine)
  {
    final Block aBlock = new Block ();

    aBlock.m_aLines = m_aLines;
    aBlock.m_aLineTail = aLine;
    m_aLines = aLine.m_aNext;
    aLine.m_aNext = null;
    if (m_aLines == null)
      m_aLineTail = null;
    else
      m_aLines.m_aPrevious = null;

    if (m_aBlocks == null)
      m_aBlocks = m_aBlockTail = aBlock;
    else
    {
      m_aBlockTail.m_aNext = aBlock;
      m_aBlockTail = aBlock;
    }

    return aBlock;
  }
1014413
public Block createBlock() {
        Block b = new Block(-1, -1, numBlocks++, blocklistHead);
        blocklistHead = b;
        return b;
    }
902573
function() {
    // Assign 'this' to a variable for use in the closures below.
    var thisBlock = this;
    var dropdown = new Blockly.FieldDropdown(
        [[Blockly.Msg.LISTS_SPLIT_LIST_FROM_TEXT, 'SPLIT'],
         [Blockly.Msg.LISTS_SPLIT_TEXT_FROM_LIST, 'JOIN']],
        function(newMode) {
          thisBlock.updateType_(newMode);
        });
    this.setHelpUrl(Blockly.Msg.LISTS_SPLIT_HELPURL);
    this.setColour(Blockly.Blocks.lists.HUE);
    this.appendValueInput('INPUT')
        .setCheck('String')
        .appendField(dropdown, 'MODE');
    this.appendValueInput('DELIM')
        .setCheck('String')
        .appendField(Blockly.Msg.LISTS_SPLIT_WITH_DELIMITER);
    this.setInputsInline(true);
    this.setOutput(true, 'Array');
    this.setTooltip(function() {
      var mode = thisBlock.getFieldValue('MODE');
      if (mode == 'SPLIT') {
        return Blockly.Msg.LISTS_SPLIT_TOOLTIP_SPLIT;
      } else if (mode == 'JOIN') {
        return Blockly.Msg.LISTS_SPLIT_TOOLTIP_JOIN;
      }
      throw 'Unknown mode: ' + mode;
    });
  }
1062967
@Override
	public void addUniqueHeadLine(final String type, final String aLine) {
		ArrayList<String> lines = headers.get(type);

		if (lines == null) {
			lines = new ArrayList<>();
			lines.add(aLine);
			headers.put(type, lines);
		} else if (!lines.contains(aLine)) {
			lines.add(aLine);
		}
	}
1010028
def edges(&block)
      return to_enum(__callee__) unless block_given?

      children do |v|
        yield self, v
        v.edges(&block)
      end
    end
199831
function breakAfter(lineEndNode) {
    // If there's nothing to the right, then we can skip ending the line
    // here, and move root-wards since splitting just before an end-tag
    // would require us to create a bunch of empty copies.
    while (!lineEndNode.nextSibling) {
      lineEndNode = lineEndNode.parentNode;
      if (!lineEndNode) { return; }
    }

    function breakLeftOf(limit, copy) {
      // Clone shallowly if this node needs to be on both sides of the break.
      var rightSide = copy ? limit.cloneNode(false) : limit;
      var parent = limit.parentNode;
      if (parent) {
        // We clone the parent chain.
        // This helps us resurrect important styling elements that cross lines.
        // E.g. in <i>Foo<br>Bar</i>
        // should be rewritten to <li><i>Foo</i></li><li><i>Bar</i></li>.
        var parentClone = breakLeftOf(parent, 1);
        // Move the clone and everything to the right of the original
        // onto the cloned parent.
        var next = limit.nextSibling;
        parentClone.appendChild(rightSide);
        for (var sibling = next; sibling; sibling = next) {
          next = sibling.nextSibling;
          parentClone.appendChild(sibling);
        }
      }
      return rightSide;
    }

    var copiedListItem = breakLeftOf(lineEndNode.nextSibling, 0);

    // Walk the parent chain until we reach an unattached LI.
    for (var parent;
         // Check nodeType since IE invents document fragments.
         (parent = copiedListItem.parentNode) && parent.nodeType === 1;) {
      copiedListItem = parent;
    }
    // Put it on the list of lines for later processing.
    listItems.push(copiedListItem);
  }
437559
public static List<String> splitToCells(String line, int minCnt) {

        LOG.trace("split line : {}", line);

        List<String> newCells = new ArrayList<String>();

        for (Iterator<String> cellItr = Arrays.asList(line.split(",")).iterator(); cellItr
                .hasNext();) {

            String cell = cellItr.next();
            StringBuilder builder = new StringBuilder(cell);

            // セル内のダブルクオーテーションが奇数個の場合はセル内分割があるとみなし、
            // 次のダブルクオーテーションが奇数個のセルまで連結して1セルとする。
            if (StringUtils.countMatches(cell, '"') % 2 != 0) {

                do {
                    cell = cellItr.next();
                    // splitで除外された「,」をappend
                    builder.append(",");
                    builder.append(cell);

                } while (StringUtils.countMatches(cell, '"') % 2 == 0 && cellItr.hasNext());

            }

            newCells.add(modifyStr(builder.toString()));

        }

        while (newCells.size() < minCnt) {
            newCells.add("");
        }

        LOG.trace("new cells : {}", newCells);

        return newCells;
    }
1090705
protected function parseBlockLine($line, \SplFileObject $file, $lineBreaks)
    {
        $block = new Block();

        $args = $this->blockRegex($line);
        $name = array_shift($args);

        if ($name === null) {
            $lineNum = $file->key();
            throw new SyntaxException($lineNum, $line, "Could not parse the name of the block");
        }

        $block->setName($name)
              ->setArguments($args)
              ->setLineBreaks($lineBreaks);

        // Now we parse the children
        $newLine = $file->getCurrentLine();

        while (!$this->isBlockEnd($newLine, $name)) {
            $parsedLine = $this->parseLine($newLine, $file);
            if (!is_null($parsedLine)) {
                $block->addChild($parsedLine);
            }
            $newLine = $file->getCurrentLine();
        }

        return $block;
    }
9670
public static final <T> List<List<T>> split(List<T> list, Predicate<T> predicate)
    {
        if (list.isEmpty())
        {
            return Collections.EMPTY_LIST;
        }
        List<List<T>> lists = new ArrayList<>();
        boolean b = predicate.test(list.get(0));
        int len = list.size();
        int start = 0;
        for (int ii=1;ii<len;ii++)
        {
            boolean t = predicate.test(list.get(ii));
            if (b != t)
            {
                lists.add(list.subList(start, ii));
                start = ii;
                b = t;
            }
        }
        lists.add(list.subList(start, len));
        return lists;
    }
1297007
public void appendLine (@Nonnull final Line aLine)
  {
    if (m_aLineTail == null)
    {
      m_aLines = aLine;
      m_aLineTail = aLine;
    }
    else
    {
      aLine.m_bPrevEmpty = m_aLineTail.m_bIsEmpty;
      aLine.m_aPrevious = m_aLineTail;
      m_aLineTail.m_aNext = aLine;
      m_aLineTail = aLine;
    }
  }
938286
def block_yield(parent, indent)
      return unless accept :yield

      # Consume the newline from the end of the element
      error :yield unless accept(:line_feed).strip.empty?

      # Create a new node
      yield_node = [:yield, nil, {}, [], indent]

      parent[@children] << yield_node
    end
1105022
function(block) {
  switch(block.t) {
    case 'Paragraph':
    case 'SetextHeader':
    case 'ATXHeader':
      block.inline_content =
        this.inlineParser.parse(block.string_content.trim(), this.refmap);
      block.string_content = "";
      break;
    default:
      break;
  }

  if (block.children) {
    for (var i = 0; i < block.children.length; i++) {
      this.processInlines(block.children[i]);
    }
  }

}
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;
  }
1267166
function splitOnLineBreak( range, blockLimit, nodeData ) {
			var firstBlockAscendant, pos;

			if ( nodeData.hasBlockSibling )
				return 1;

			firstBlockAscendant = range.startContainer.getAscendant( DTD.$block, 1 );
			if ( !firstBlockAscendant || !firstBlockAscendant.is( { div: 1, p: 1 } ) )
				return 0;

			pos = firstBlockAscendant.getPosition( blockLimit );

			if ( pos == CKEDITOR.POSITION_IDENTICAL || pos == CKEDITOR.POSITION_CONTAINS )
				return 0;

			var newContainer = range.splitElement( firstBlockAscendant );
			range.moveToPosition( newContainer, CKEDITOR.POSITION_AFTER_START );

			return 1;
		}
113397
public static <C extends Collection<String>> C splitString(String line, int begin, int end, char delim, C words) {
		int pos = begin;
		while (pos < end) {
			int start = pos;
			pos = line.indexOf(delim, pos);
			if(pos == -1 || pos > end) pos = end;
			words.add(line.substring(start, pos));
			pos++;
		}
		// If ending in a delimeter, add the empty string
		if(end>begin && line.charAt(end-1)==delim) words.add("");
		return words;
	}
1360271
private static MultiLineString splitMultiLineStringWithPoint(MultiLineString multiLineString, Point pointToSplit, double tolerance) {
        ArrayList<LineString> linestrings = new ArrayList<LineString>();
        boolean notChanged = true;
        int nb = multiLineString.getNumGeometries();
        for (int i = 0; i < nb; i++) {
            LineString subGeom = (LineString) multiLineString.getGeometryN(i);
            LineString[] result = splitLineStringWithPoint(subGeom, pointToSplit, tolerance);
            if (result != null) {
                Collections.addAll(linestrings, result);
                notChanged = false;
            } else {
                linestrings.add(subGeom);
            }
        }
        if (!notChanged) {
            return FACTORY.createMultiLineString(linestrings.toArray(new LineString[0]));
        }
        return null;
    }
120011
void splitBranches(final Element elem, final Branch filter) {
        final List<Element> ditavalRefs = getChildElements(elem, DITAVAREF_D_DITAVALREF);
        if (ditavalRefs.size() > 0) {
            // remove ditavalrefs
            for (final Element branch: ditavalRefs) {
                elem.removeChild(branch);
            }
            // create additional branches after current element
            final List<Element> branches = new ArrayList<>(ditavalRefs.size());
            branches.add(elem);
            final Node next = elem.getNextSibling();
            for (int i = 1; i < ditavalRefs.size(); i++) {
                final Element clone = (Element) elem.cloneNode(true);
                if (next != null) {
                    elem.getParentNode().insertBefore(clone, next);
                } else {
                    elem.getParentNode().appendChild(clone);
                }
                branches.add(clone);
            }
            // insert ditavalrefs
            for (int i = 0; i < branches.size(); i++) {
                final Element branch = branches.get(i);
                final Element ditavalref = ditavalRefs.get(i);
                branch.insertBefore(ditavalref, branch.getFirstChild());
                final Branch currentFilter = filter.merge(ditavalref);
                processAttributes(branch, currentFilter);
                final Branch childFilter = new Branch(currentFilter.resourcePrefix, currentFilter.resourceSuffix, Optional.empty(), Optional.empty());
                // process children of all branches
                for (final Element child: getChildElements(branch, MAP_TOPICREF)) {
                    if (DITAVAREF_D_DITAVALREF.matches(child)) {
                        continue;
                    }
                    splitBranches(child, childFilter);
                }
            }
        } else {
            processAttributes(elem, filter);
            for (final Element child: getChildElements(elem, MAP_TOPICREF)) {
                splitBranches(child, filter);
            }
        }
    }