If the current line is not empty or null, it is added to the arraylist
of lines and a new empty line is added.
422052
protected void carriageReturn() {
        // the arraylist with lines may not be null
        if (lines == null) {
            lines = new ArrayList();
        }
        // If the current line is not null
        if (line != null) {
            // we check if the end of the page is reached (bugfix by Francois Gravel)
            if (currentHeight + line.height() + leading < indentTop() - indentBottom()) {
                // if so nonempty lines are added and the height is augmented
                if (line.size() > 0) {
                    currentHeight += line.height();
                    lines.add(line);
                    pageEmpty = false;
                }
            }
            // if the end of the line is reached, we start a new page
            else {
                newPage();
            }
        }
        if (imageEnd > -1 && currentHeight > imageEnd) {
            imageEnd = -1;
            indentation.imageIndentRight = 0;
            indentation.imageIndentLeft = 0;
        }
        // a new current line is constructed
        line = new PdfLine(indentLeft(), indentRight(), alignment, leading);
    }
1302715
private function appendLine(?string $line, bool $trim): void
  {
    if ($line===null) return;

    if ($trim) $line = trim($line);

    $this->lines[] = $line;
  }
315560
private void nullPrintln(PrintStream out, String line)
    {
        if (out != null)
        {
            out.println(line);
        }
    }
598984
public void appendLine(Object... parts) {
    if (parts.length > 0) {
      sb.append(indent);
    }
    appendParts(parts);
    sb.append('\n');
  }
680713
private void fillIn() throws IOException {

		BufferedReader br = null;
		InputStream in = null;
		try {
			in = new FileInputStream( this.definitionFile.getEditedFile());
			br = new BufferedReader( new InputStreamReader( in, StandardCharsets.UTF_8 ));

			String line;
			while(( line = nextLine( br )) != null ) {

				int code = recognizeBlankLine( line, this.definitionFile.getBlocks());
				if( code == P_CODE_YES )
					continue;

				code = recognizeComment( line, this.definitionFile.getBlocks());
				if( code == P_CODE_YES )
					continue;

				code = recognizeImport( line );
				if( code == P_CODE_CANCEL )
					break;
				else if( code == P_CODE_YES )
					continue;

				code = recognizeFacet( line, br );
				if( code == P_CODE_CANCEL )
					break;
				else if( code == P_CODE_YES )
					continue;

				code = recognizeInstanceOf( line, br, null );
				if( code == P_CODE_CANCEL )
					break;
				else if( code == P_CODE_YES )
					continue;

				// "recognizeComponent" is the last attempt to identify the line.
				code = recognizeComponent( line, br );

				// So, eventually, we add the line as an unknown block.
				if( code != P_CODE_YES )
					this.definitionFile.getBlocks().add( new BlockUnknown( this.definitionFile, line ));

				// Deal with the error codes.
				// Cancel: break the loop.
				// No: try to process the next line.
				if( code == P_CODE_CANCEL )
					break;

				if( code == P_CODE_NO )
					addModelError( ErrorCode.P_UNRECOGNIZED_BLOCK );
			}

			if( line == null
					&& this.lastLineEndedWithLineBreak )
				this.definitionFile.getBlocks().add( new BlockBlank( this.definitionFile, "" ));

		} finally {
			Utils.closeQuietly( br );
			Utils.closeQuietly( in );
		}
	}
387241
public boolean addBusLine(BusLine busLine) {
		if (busLine == null) {
			return false;
		}
		if (this.busLines.indexOf(busLine) != -1) {
			return false;
		}
		if (!this.busLines.add(busLine)) {
			return false;
		}
		final boolean isValidLine = busLine.isValidPrimitive();
		busLine.setEventFirable(isEventFirable());
		busLine.setContainer(this);
		if (isEventFirable()) {
			fireShapeChanged(new BusChangeEvent(this,
					BusChangeEventType.LINE_ADDED,
					busLine,
					this.busLines.size() - 1,
					"shape", //$NON-NLS-1$
					null,
					null));
			if (!isValidLine) {
				revalidate();
			} else {
				checkPrimitiveValidity();
			}
		}
		return true;
	}
1335707
public void addSelectionChangedListener(ISelectionChangedListener listener)
	{
		if (fOutlineViewer != null)
		{
			fOutlineViewer.addSelectionChangedListener(listener);
		} else
		{
			fSelectionChangedListeners.add(listener);
		}
	}
1301690
private void addMissingBlanks(final int index) {
		final int count = index - this.list.size();
		for (int i = 0; i < count; i++)
			this.list.add(this.blankElement);
	}

	/** Postcondition: this.list.get(this.list.size()-1) != blankElement */
	private void removeTrail() {
		int last = this.list.size() - 1;
		while (last >= 0 && this.list.get(last) == this.blankElement) {
			this.list.remove(last);
			last = this.list.size() - 1;
		}
	}

    /**
     * @return the capacity of the full list
     */
    public int capacity() {
		if (this.capacity < this.list.size())
			this.capacity = this.list.size();

		return this.capacity;
    }
}
228297
public static List<String> linesFrom(InputStream is) {
        ArrayList<String> lines = new ArrayList<String>();
        for (String line : new LineReader(is)) {
            if (line.length() > 0 && !line.startsWith("#"))
                lines.add(line);
        }
        return lines;
    }
149858
public void update(int offset, List<String> lines) {
        if (lines.isEmpty()) {
            throw new IllegalArgumentException("Empty line set");
        }
        if (offset >= count() || offset < 0) {
            throw new IndexOutOfBoundsException("Index: " + offset + ", Size: " + count());
        }

        int up = count() - offset - 1;
        for (int i = 0; i < lines.size(); ++i) {
            String line = lines.get(i);
            if (i == 0) {
                terminal.print("\r");
                if (up > 0) {
                    terminal.print(cursorUp(up));
                }
            } else {
                terminal.println();
                --up;
            }

            String old = offset + i < buffer.size()
                         ? buffer.get(offset + i)
                         : null;
            buffer.set(offset + i, line);
            if (line.equals(old) && !line.isEmpty()) {
                // No change.
                continue;
            }
            terminal.print(CURSOR_ERASE);
            terminal.print(line);
        }

        // Move the cursor back to the end of the last line.
        if (up > 0) {
            terminal.format("\r%s%s",
                            cursorDown(up),
                            cursorRight(printableWidth(lastLine())));
        }

    }
573939
public boolean recordNoInline() {
    if (!currentInfo.isNoInline()) {
      currentInfo.setNoInline(true);
      populated = true;
      return true;
    } else {
      return false;
    }
  }
226063
def add(self, indent, line):
        
        if isinstance(line, str):
            list.append(self, indent*4*' ' + line)
        else:
            for subline in line:
                list.append(self, indent*4*' ' + subline)
1322463
def add_line_if_absent(filename: str, line: str) -> None:
    
    assert "\n" not in line
    if not is_line_in_file(filename, line):
        log.info("Appending line {!r} to file {!r}", line, filename)
        with open(filename, "a") as file:
            file.writelines([line])
716881
public void addition(E entry) {
        if (additions==null) additions = new ArrayList<E>();
        additions.add(entry);
    }
33800
public void append(StringBuilder buffer, Object value) {
        if (buffer == null) {
            throw new NullPointerException("buffer");
        }

        buffer.append(value);
    }
109725
private void emitCodeLines(final StringBuilder out, final Line lines, final String meta, final boolean removeIndent)
    {
        Line line = lines;
        if (this.config.codeBlockEmitter != null)
        {
            final ArrayList<String> list = new ArrayList<String>();
            while (line != null)
            {
                if (line.isEmpty)
                {
                    list.add("");
                }
                else
                {
                    list.add(removeIndent ? line.value.substring(4) : line.value);
                }
                line = line.next;
            }
            this.config.codeBlockEmitter.emitBlock(out, list, meta);
        }
        else
        {
            while (line != null)
            {
                if (!line.isEmpty)
                {
                    for (int i = removeIndent ? 4 : 0; i < line.value.length(); i++)
                    {
                        final char c;
                        switch (c = line.value.charAt(i))
                        {
                        case '&':
                            out.append("&amp;");
                            break;
                        case '<':
                            out.append("&lt;");
                            break;
                        case '>':
                            out.append("&gt;");
                            break;
                        default:
                            out.append(c);
                            break;
                        }
                    }
                }
                out.append('\n');
                line = line.next;
            }
        }
    }
144847
private void doAppendLine(final String... fields) throws IOException {
		if (null != fields) {
			for (int i = 0; i < fields.length; i++) {
				appendField(fields[i]);
			}
			writer.write(config.lineDelimiter);
			newline = true;
		}
	}