test_class.file: unix4j-core/unix4j-base/src/test/java/org/unix4j/line/SimpleLineTest.java
test_class.identifier: SimpleLineTest
test_case.body: @Test
  	public void testSubLine() {
  		final String CRLF = "" + Line.CR + Line.LF;  
  		final Line line = new SimpleLine("0123456789", CRLF);
  		//identity cut
  		Assert.assertSame(line, SimpleLine.subLine(line, 0, line.length(), false));
  		Assert.assertSame(line, SimpleLine.subLine(line, 0, line.length(), true));
  		//0 to content length now
  		Assert.assertEquals(new SimpleLine("", ""), SimpleLine.subLine(line, 0, 0, false));
  		Assert.assertEquals(new SimpleLine("", CRLF), SimpleLine.subLine(line, 0, 0, true));
  		Assert.assertEquals(new SimpleLine("0", ""), SimpleLine.subLine(line, 0, 1, false));
  		Assert.assertEquals(new SimpleLine("0", CRLF), SimpleLine.subLine(line, 0, 1, true));
  		Assert.assertEquals(new SimpleLine("1", ""), SimpleLine.subLine(line, 1, 2, false));
  		Assert.assertEquals(new SimpleLine("1", CRLF), SimpleLine.subLine(line, 1, 2, true));
  		Assert.assertEquals(new SimpleLine("9", ""), SimpleLine.subLine(line, 9, 10, false));
  		Assert.assertEquals(new SimpleLine("9", CRLF), SimpleLine.subLine(line, 9, 10, true));
  		Assert.assertEquals(new SimpleLine("9", "" + Line.CR), SimpleLine.subLine(line, 9, 11, false));
  		Assert.assertEquals(new SimpleLine("9", CRLF), SimpleLine.subLine(line, 9, 12, false));
  		Assert.assertEquals(new SimpleLine("", "" + Line.CR), SimpleLine.subLine(line, 10, 11, false));
  		Assert.assertEquals(new SimpleLine("", CRLF), SimpleLine.subLine(line, 10, 12, false));
  		Assert.assertEquals(new SimpleLine("", "" + Line.LF), SimpleLine.subLine(line, 11, 12, false));
  
  		//expecte exceptions for
  		final int[] start= {-1,  0, 1, 0, 0};
  		final int[] end  = { 0, -1, 0, line.getContentLength()+1, line.length()+1};
  		final boolean[] preserveEnding= { true, true, true, true, false};
  		for (int i = 0; i < start.length; i++) {
  			try {
  				SimpleLine.subLine(line, start[i], end[i], preserveEnding[i]);
  				Assert.fail("expected exception for illegal subLine input arguments: line.subLine(" + start[i] + ", " + end[i] + ", " + preserveEnding[i] + ") for line " + line);
  			} catch (IllegalArgumentException e) {
  				//ok, that's what we would expect
  			}
  		}
  	}
test_case.class_method_signature: SimpleLineTest.testSubLine()
test_case.full_signature: @Test public void testSubLine()
test_case.identifier: testSubLine
test_case.invocations: assertSame subLine length assertSame subLine length assertEquals subLine assertEquals subLine assertEquals subLine assertEquals subLine assertEquals subLine assertEquals subLine assertEquals subLine assertEquals subLine assertEquals subLine assertEquals subLine assertEquals subLine assertEquals subLine assertEquals subLine getContentLength length subLine fail
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testSubLine()
focal_class.declarator: content
focal_class.modifier: private final
focal_class.original_string: private final CharSequence content;
focal_class.type: CharSequence
focal_class.var_name: content
focal_class.declarator: lineEnding
focal_class.modifier: private final
focal_class.original_string: private final CharSequence lineEnding;
focal_class.type: CharSequence
focal_class.var_name: lineEnding
focal_class.file: unix4j-core/unix4j-base/src/main/java/org/unix4j/line/SimpleLine.java
focal_class.identifier: SimpleLine
focal_class.interfaces: implements Line
focal_class.class_method_signature: SimpleLine.SimpleLine(CharSequence content)
focal_class.full_signature: public  SimpleLine(CharSequence content)
focal_class.identifier: SimpleLine
focal_class.modifiers: public
focal_class.parameters: (CharSequence content)
focal_class.signature:  SimpleLine(CharSequence content)
focal_class.class_method_signature: SimpleLine.SimpleLine(CharSequence content, char lineEnding)
focal_class.full_signature: public  SimpleLine(CharSequence content, char lineEnding)
focal_class.identifier: SimpleLine
focal_class.modifiers: public
focal_class.parameters: (CharSequence content, char lineEnding)
focal_class.signature:  SimpleLine(CharSequence content, char lineEnding)
focal_class.class_method_signature: SimpleLine.SimpleLine(CharSequence content, CharSequence lineEnding)
focal_class.full_signature: public  SimpleLine(CharSequence content, CharSequence lineEnding)
focal_class.identifier: SimpleLine
focal_class.modifiers: public
focal_class.parameters: (CharSequence content, CharSequence lineEnding)
focal_class.signature:  SimpleLine(CharSequence content, CharSequence lineEnding)
focal_class.class_method_signature: SimpleLine.length()
focal_class.full_signature: @Override public int length()
focal_class.identifier: length
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: int
focal_class.signature: int length()
focal_class.class_method_signature: SimpleLine.charAt(int index)
focal_class.full_signature: @Override public char charAt(int index)
focal_class.identifier: charAt
focal_class.modifiers: @Override public
focal_class.parameters: (int index)
focal_class.return: char
focal_class.signature: char charAt(int index)
focal_class.class_method_signature: SimpleLine.subSequence(int start, int end)
focal_class.full_signature: @Override public CharSequence subSequence(int start, int end)
focal_class.identifier: subSequence
focal_class.modifiers: @Override public
focal_class.parameters: (int start, int end)
focal_class.return: CharSequence
focal_class.signature: CharSequence subSequence(int start, int end)
focal_class.class_method_signature: SimpleLine.getContent()
focal_class.full_signature: @Override public String getContent()
focal_class.identifier: getContent
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String getContent()
focal_class.class_method_signature: SimpleLine.getContentLength()
focal_class.full_signature: @Override public int getContentLength()
focal_class.identifier: getContentLength
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: int
focal_class.signature: int getContentLength()
focal_class.class_method_signature: SimpleLine.getLineEnding()
focal_class.full_signature: @Override public String getLineEnding()
focal_class.identifier: getLineEnding
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String getLineEnding()
focal_class.class_method_signature: SimpleLine.getLineEndingLength()
focal_class.full_signature: @Override public int getLineEndingLength()
focal_class.identifier: getLineEndingLength
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: int
focal_class.signature: int getLineEndingLength()
focal_class.class_method_signature: SimpleLine.toString()
focal_class.full_signature: @Override public String toString()
focal_class.identifier: toString
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String toString()
focal_class.class_method_signature: SimpleLine.hashCode()
focal_class.full_signature: @Override public int hashCode()
focal_class.identifier: hashCode
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: int
focal_class.signature: int hashCode()
focal_class.class_method_signature: SimpleLine.equals(Object obj)
focal_class.full_signature: @Override public boolean equals(Object obj)
focal_class.identifier: equals
focal_class.modifiers: @Override public
focal_class.parameters: (Object obj)
focal_class.return: boolean
focal_class.signature: boolean equals(Object obj)
focal_class.class_method_signature: SimpleLine.subLine(Line line, int start, int end, boolean preserveLineEnding)
focal_class.full_signature: public static Line subLine(Line line, int start, int end, boolean preserveLineEnding)
focal_class.identifier: subLine
focal_class.modifiers: public static
focal_class.parameters: (Line line, int start, int end, boolean preserveLineEnding)
focal_class.return: Line
focal_class.signature: Line subLine(Line line, int start, int end, boolean preserveLineEnding)
focal_method.body: public static Line subLine(Line line, int start, int end, boolean preserveLineEnding) {
  		if (start == 0 && (end == line.length() || (preserveLineEnding && end == line.getContentLength()))) {
  			return line;
  		}
  		if (start < 0) {
  			throw new IllegalArgumentException("start cannot be negative: " + start);
  		}
  		if (end < 0) {
  			throw new IllegalArgumentException("end cannot be negative: " + end);
  		}
  		if (start > end) {
  			throw new IllegalArgumentException("start cannot be after end: " + start + " > " + end);
  		}
  		if (preserveLineEnding) {
  			if (end > line.getContentLength()) {
  				throw new IllegalArgumentException("start cannot be after line content end: " + end + " > " + line.getContentLength());
  			}
  			return new SimpleLine(line.subSequence(start, end), line.getLineEnding());
  		} else {
  			final int clen = line.getContentLength();
  			if (end > line.length()) {
  				throw new IllegalArgumentException("start cannot be after line end: " + end + " > " + line.length());
  			}
  			if (end <= clen) {
  				return new SimpleLine(line.subSequence(start, end), "");
  			} else {
  				if (start < clen) {
  					return new SimpleLine(line.subSequence(start, clen), line.subSequence(line.getContentLength(), end));
  				} else {
  					return new SimpleLine("", line.subSequence(start, end));
  				}
  			}
  		}
  	}
focal_method.class_method_signature: SimpleLine.subLine(Line line, int start, int end, boolean preserveLineEnding)
focal_method.full_signature: public static Line subLine(Line line, int start, int end, boolean preserveLineEnding)
focal_method.identifier: subLine
focal_method.invocations: length getContentLength getContentLength getContentLength subSequence getLineEnding getContentLength length length subSequence subSequence subSequence getContentLength subSequence
focal_method.modifiers: public static
focal_method.parameters: (Line line, int start, int end, boolean preserveLineEnding)
focal_method.return: Line
focal_method.signature: Line subLine(Line line, int start, int end, boolean preserveLineEnding)