@Test public void is_containing_comments_test() { assertFalse(supportToTest.isHavingCommentsInside(null)); assertFalse(supportToTest.isHavingCommentsInside("")); assertTrue(supportToTest.isHavingCommentsInside("# i am a comment")); assertFalse(supportToTest.isHavingCommentsInside("abc: '#'")); assertFalse(supportToTest.isHavingCommentsInside("abc: 'xx#'")); assertFalse(supportToTest.isHavingCommentsInside("abc: \"#\"")); assertFalse(supportToTest.isHavingCommentsInside("abc: \"ab #\"")); assertTrue(supportToTest.isHavingCommentsInside("a: 'xx' # i am a comment")); assertTrue(supportToTest.isHavingCommentsInside("abc: \"ab\"\n # bla")); }
public boolean isHavingCommentsInside(String yamlContent) { if (yamlContent==null) { return false; } int begin = 0; int index = getIndex(yamlContent,begin); if (index==-1) { return false; } char[] chars = yamlContent.toCharArray(); while (index!=-1) { if (! isLineInsideString(index,chars)) { return true; } begin=index+1; index=getIndex(yamlContent,begin); } return false; }
YamlScriptSortMemberSupport { public boolean isHavingCommentsInside(String yamlContent) { if (yamlContent==null) { return false; } int begin = 0; int index = getIndex(yamlContent,begin); if (index==-1) { return false; } char[] chars = yamlContent.toCharArray(); while (index!=-1) { if (! isLineInsideString(index,chars)) { return true; } begin=index+1; index=getIndex(yamlContent,begin); } return false; } }
YamlScriptSortMemberSupport { public boolean isHavingCommentsInside(String yamlContent) { if (yamlContent==null) { return false; } int begin = 0; int index = getIndex(yamlContent,begin); if (index==-1) { return false; } char[] chars = yamlContent.toCharArray(); while (index!=-1) { if (! isLineInsideString(index,chars)) { return true; } begin=index+1; index=getIndex(yamlContent,begin); } return false; } YamlScriptSortMemberSupport(); }
YamlScriptSortMemberSupport { public boolean isHavingCommentsInside(String yamlContent) { if (yamlContent==null) { return false; } int begin = 0; int index = getIndex(yamlContent,begin); if (index==-1) { return false; } char[] chars = yamlContent.toCharArray(); while (index!=-1) { if (! isLineInsideString(index,chars)) { return true; } begin=index+1; index=getIndex(yamlContent,begin); } return false; } YamlScriptSortMemberSupport(); String sortAscending(String input); String sortAscendingSingleDocument(String input); boolean isHavingCommentsInside(String yamlContent); }
YamlScriptSortMemberSupport { public boolean isHavingCommentsInside(String yamlContent) { if (yamlContent==null) { return false; } int begin = 0; int index = getIndex(yamlContent,begin); if (index==-1) { return false; } char[] chars = yamlContent.toCharArray(); while (index!=-1) { if (! isLineInsideString(index,chars)) { return true; } begin=index+1; index=getIndex(yamlContent,begin); } return false; } YamlScriptSortMemberSupport(); String sortAscending(String input); String sortAscendingSingleDocument(String input); boolean isHavingCommentsInside(String yamlContent);  }