Clear a number of lines

 @param [Integer] n
   the number of lines to clear
 @param [Symbol] :direction
   the direction to clear, default :up

 @api public
428270
def clear_lines(n, direction = :up)
      n.times.reduce([]) do |acc, i|
        dir = direction == :up ? up : down
        acc << clear_line + ((i == n - 1) ? '' : dir)
      end.join
    end
1338947
public void clear() {
        int h = head;
        int t = tail;
        if (h != t) { // clear all cells
            head = tail = 0;
            int i = h;
            int mask = elements.length - 1;
            do {
                elements[i] = null;
                i = (i + 1) & mask;
            } while (i != t);
        }
    }
681007
public void clear () {
		final T[] items = this.items;
		if (tail > head) {
			int i = head, n = tail;
			do {
				items[i++] = null;
			} while (i < n);
		} else if (size > 0) { // NOTE: when head == tail the buffer can be empty or full
			for (int i = head, n = items.length; i < n; i++)
				items[i] = null;
			for (int i = 0, n = tail; i < n; i++)
				items[i] = null;
		}
		this.head = 0;
		this.tail = 0;
		this.size = 0;
	}
124095
public void clear(int i) {
        char ch = (char) -1;
        int apos = i - 1;
        int rpos = pos - 1;
        for (; rpos > -1 && apos > -1; rpos--, apos--) {
            buffer[rpos] = ch;
            buffer2[rpos] = -1;
        }
        for (rpos = buffer.length - 1; apos > -1; rpos--, apos--) {
            buffer[rpos] = ch;
            buffer2[rpos] = -1;
        }
    }
2294
def clear(self, match="*", count=1000):
        
        cursor = '0'
        while cursor != 0:
            cursor, keys = self.scan(cursor=cursor, match=match, count=count)
            if keys:
                self._client.delete(*keys)
728955
private function clearStandaloneLines(array &$nodes, array &$tokens)
    {
        if ($this->lineTokens > 1) {
            // this is the third or later node on this line, so it can't be standalone
            return;
        }

        $prev = null;
        if ($this->lineTokens === 1) {
            // this is the second node on this line, so it can't be standalone
            // unless the previous node is whitespace.
            if ($prev = end($nodes)) {
                if (!$this->tokenIsWhitespace($prev)) {
                    return;
                }
            }
        }

        if ($next = reset($tokens)) {
            // If we're on a new line, bail.
            if ($next[Mustache_Tokenizer::LINE] !== $this->lineNum) {
                return;
            }

            // If the next token isn't whitespace, bail.
            if (!$this->tokenIsWhitespace($next)) {
                return;
            }

            if (count($tokens) !== 1) {
                // Unless it's the last token in the template, the next token
                // must end in newline for this to be standalone.
                if (substr($next[Mustache_Tokenizer::VALUE], -1) !== "\n") {
                    return;
                }
            }

            // Discard the whitespace suffix
            array_shift($tokens);
        }

        if ($prev) {
            // Return the whitespace prefix, if any
            return array_pop($nodes);
        }
    }
584337
def clear!(*args)
      internal_lock do
        args = registry.keys if args.empty?
        args.each do |key|
          value = self[key]
          if value.respond_to?(:clear)
            value.clear
          elsif value.respond_to?(:value)
            value.value = nil
          end
          registry.delete(key)
        end
        yield if block_given?
      end
      true
    end
51586
public void clear() {
        if (arrMask != null) {
            for (int y = 0; y < height; y++) {
                for (int x = 0; x < width; x++) {
                    arrMask[x][y] = false;
                }
            }
        }
    }
671659
def remove(self, line):
        """"""
        nb = 0
        for block in self.blocks:
            nb += block.remove(line)

        return nb
1268917
def _skip_lines(self, n):
        ''''''
        for i in range(n):
            self.line = next(self.output)
        return self.line
879102
def tidy_blank_lines
      (@fragments.size - 1).times do |i|
        if @fragments[i].kind_of?(BlankLine) and 
            @fragments[i+1].kind_of?(ListEnd)
          @fragments[i], @fragments[i+1] = @fragments[i+1], @fragments[i] 
        end
      end

      # remove leading blanks
      @fragments.each_with_index do |f, i|
        break unless f.kind_of? BlankLine
        @fragments[i] = nil
      end

      @fragments.compact!
    end
966768
public void reset( int N ) {
        this.N = N;

        this.diag = null;
        this.off = null;

        if( splits.length < N ) {
            splits = new int[N];
        }

        numSplits = 0;

        x1 = 0;
        x2 = N-1;

        steps = numExceptional = lastExceptional = 0;

        this.Q = null;
    }
564268
def del_node(self, n):
        '''
        
        '''
        parent = self.get_node_attr(n, 'parent')
        if self.get_node_attr(n, 'direction') == 'R':
            self.set_node_attr(parent, 'Rchild', None)
        else:
            self.set_node_attr(parent, 'Lchild', None)
        Graph.del_node(self, n)
813267
void clear() {
        offset = intLen = 0;
        for (int index=0, n=value.length; index < n; index++)
            value[index] = 0;
    }
18657
public synchronized void remove(int n) throws IOException {
    if (isEmpty()) {
      throw new NoSuchElementException();
    }
    if (n < 0) {
      throw new IllegalArgumentException("Cannot remove negative (" + n + ") number of elements.");
    }
    if (n == 0) {
      return;
    }
    if (n == elementCount) {
      clear();
      return;
    }
    if (n > elementCount) {
      throw new IllegalArgumentException(
          "Cannot remove more elements (" + n + ") than present in queue (" + elementCount + ").");
    }

    final int eraseStartPosition = first.position;
    int eraseTotalLength = 0;

    // Read the position and length of the new first element.
    int newFirstPosition = first.position;
    int newFirstLength = first.length;
    for (int i = 0; i < n; i++) {
      eraseTotalLength += Element.HEADER_LENGTH + newFirstLength;
      newFirstPosition = wrapPosition(newFirstPosition + Element.HEADER_LENGTH + newFirstLength);
      ringRead(newFirstPosition, buffer, 0, Element.HEADER_LENGTH);
      newFirstLength = readInt(buffer, 0);
    }

    // Commit the header.
    writeHeader(fileLength, elementCount - n, newFirstPosition, last.position);
    elementCount -= n;
    first = new Element(newFirstPosition, newFirstLength);

    // Commit the erase.
    ringErase(eraseStartPosition, eraseTotalLength);
  }
6953
function ( n ) { 

        var i = this.uis.indexOf( n ); 
        if ( i !== -1 ) {
            this.inner.removeChild( this.uis[i].c[0] );
            this.uis.splice( i, 1 ); 
        }

    }
1012743
function(lines) {
		let output = [];
		let newlineCount = 0;
		for (let i = 0; i < lines.length; i++) {
			const line = lines[i];
			if (!line.trim()) {
				newlineCount++;
			} else {
				newlineCount = 0;
			}

			if (newlineCount >= 2) continue;

			output.push(line);
		}
		return output;
	}