test_class.declarator: classUnderTest = null
test_class.modifier: private
test_class.original_string: private NetezzaProcedureFormator classUnderTest = null;
test_class.type: NetezzaProcedureFormator
test_class.var_name: classUnderTest
test_class.declarator: SQL = 
  		"CREATE OR REPLACE PROCEDURE num() RETURNS BOOL LANGUAGE NZPLSQL AS BEGIN_PROC/n DECLARE/n	" +
  		"n NUMERIC;BEGIN/n	n := 2147483647;RAISE NOTICE 'n is %', n;n := 2147483647 + 1;" +
  		"RAISE NOTICE 'n is %', n;n := 2147483647::numeric + 1;RAISE NOTICE 'n is %', n;" +
  		"n := 2147483647::bigint + 1;RAISE NOTICE 'n is %', n;n := 2147483647;n := n + 1;" +
  		"RAISE NOTICE 'n is %', n;END;END_PROC;"
test_class.modifier: private static final
test_class.original_string: private static final String SQL = 
  		"CREATE OR REPLACE PROCEDURE num() RETURNS BOOL LANGUAGE NZPLSQL AS BEGIN_PROC/n DECLARE/n	" +
  		"n NUMERIC;BEGIN/n	n := 2147483647;RAISE NOTICE 'n is %', n;n := 2147483647 + 1;" +
  		"RAISE NOTICE 'n is %', n;n := 2147483647::numeric + 1;RAISE NOTICE 'n is %', n;" +
  		"n := 2147483647::bigint + 1;RAISE NOTICE 'n is %', n;n := 2147483647;n := n + 1;" +
  		"RAISE NOTICE 'n is %', n;END;END_PROC;";
test_class.type: String
test_class.var_name: SQL
test_class.declarator: SQL2 = 
  		  "create or replace procedure EXEC_NZPLSQL_BLOCK(TEXT) returns BOOLEAN LANGUAGE NZPLSQL AS " +
  		  "BEGIN_PROC/nDECLARE lRet BOOLEAN;DECLARE sid INTEGER;DECLARE nm varchar;DECLARE cr varchar;BEGIN  " +
  		  "/nsid := current_sid;nm := 'any_block' || sid || '()';cr = 'CREATE OR REPLACE PROCEDURE ' || " +
  		  "nm ||  /n' RETURNS BOOL LANGUAGE NZPLSQL AS BEGIN_PROC '  /n|| $1 || ' END_PROC';EXECUTE IMMEDIATE " +
  		  "cr;EXECUTE IMMEDIATE 'SELECT ' || nm;EXECUTE IMMEDIATE 'DROP PROCEDURE ' || nm;RETURN TRUE;END;" +
  		  "END_PROC;"
test_class.modifier: private static final
test_class.original_string: private static final String SQL2 = 
  		  "create or replace procedure EXEC_NZPLSQL_BLOCK(TEXT) returns BOOLEAN LANGUAGE NZPLSQL AS " +
  		  "BEGIN_PROC/nDECLARE lRet BOOLEAN;DECLARE sid INTEGER;DECLARE nm varchar;DECLARE cr varchar;BEGIN  " +
  		  "/nsid := current_sid;nm := 'any_block' || sid || '()';cr = 'CREATE OR REPLACE PROCEDURE ' || " +
  		  "nm ||  /n' RETURNS BOOL LANGUAGE NZPLSQL AS BEGIN_PROC '  /n|| $1 || ' END_PROC';EXECUTE IMMEDIATE " +
  		  "cr;EXECUTE IMMEDIATE 'SELECT ' || nm;EXECUTE IMMEDIATE 'DROP PROCEDURE ' || nm;RETURN TRUE;END;" +
  		  "END_PROC;";
test_class.type: String
test_class.var_name: SQL2
test_class.file: sql12/plugins/netezza/src/test/java/net/sourceforge/squirrel_sql/plugins/netezza/tab/NetezzaProcedureFormatorTest.java
test_class.identifier: NetezzaProcedureFormatorTest
test_case.body: @Test
  	public void testformat() {
  		String newSql = classUnderTest.reformat(SQL);
  		//System.err.println("formatted query: \n"+newSql);
  		String[] parts = newSql.split("\n");
  		assertEquals(18, parts.length);
  	}
test_case.class_method_signature: NetezzaProcedureFormatorTest.testformat()
test_case.full_signature: @Test public void testformat()
test_case.identifier: testformat
test_case.invocations: reformat split assertEquals
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testformat()
focal_class.declarator: stmtSep
focal_class.modifier: private final
focal_class.original_string: private final String stmtSep;
focal_class.type: String
focal_class.var_name: stmtSep
focal_class.file: sql12/plugins/netezza/src/main/java/net/sourceforge/squirrel_sql/plugins/netezza/tab/NetezzaProcedureFormator.java
focal_class.identifier: NetezzaProcedureFormator
focal_class.interfaces: implements ICodeReformator
focal_class.class_method_signature: NetezzaProcedureFormator.NetezzaProcedureFormator(String stmtSep)
focal_class.full_signature: public  NetezzaProcedureFormator(String stmtSep)
focal_class.identifier: NetezzaProcedureFormator
focal_class.modifiers: public
focal_class.parameters: (String stmtSep)
focal_class.signature:  NetezzaProcedureFormator(String stmtSep)
focal_class.class_method_signature: NetezzaProcedureFormator.reformat(String in)
focal_class.full_signature: @Override public String reformat(String in)
focal_class.identifier: reformat
focal_class.modifiers: @Override public
focal_class.parameters: (String in)
focal_class.return: String
focal_class.signature: String reformat(String in)
focal_class.class_method_signature: NetezzaProcedureFormator.breakApartNewLines(String[] in, String stmtSep)
focal_class.full_signature: private List<String> breakApartNewLines(String[] in, String stmtSep)
focal_class.identifier: breakApartNewLines
focal_class.modifiers: private
focal_class.parameters: (String[] in, String stmtSep)
focal_class.return: List<String>
focal_class.signature: List<String> breakApartNewLines(String[] in, String stmtSep)
focal_method.body: @Override
  	public String reformat(String in)
  	{
  		StringBuilder result = new StringBuilder();
  		String newLinesStripped = in.replace("/n", " ");
  		List<String> parts = breakApartNewLines(newLinesStripped.split("\\s+"), stmtSep);
  		boolean foundAs = false;
  		boolean inDeclaration = false;
  		boolean inMainSection = false;
  		boolean inCreateSection = true;
  		for (String part : parts)
  		{
  			if (inCreateSection && !part.equalsIgnoreCase("AS"))
  			{
  				result.append(part);
  				result.append(" ");
  				continue;
  			}
  			if (part.equalsIgnoreCase("AS") && !foundAs)
  			{
  				foundAs = true;
  				inCreateSection = false;
  				result.append("AS\n");
  				continue;
  			}
  			if (part.equalsIgnoreCase("BEGIN_PROC") && !inMainSection)
  			{
  				result.append("BEGIN_PROC\n");
  				continue;
  			}
  			if (part.equalsIgnoreCase("DECLARE"))
  			{
  				result.append("DECLARE\n");
  				inDeclaration = true;
  				continue;
  			}
  			if (inDeclaration && !part.equalsIgnoreCase("BEGIN"))
  			{
  				if (!part.endsWith(stmtSep))
  				{
  					result.append("\t");
  				}
  				result.append(part);
  				if (part.endsWith(stmtSep))
  				{
  					result.append("\n");
  				}
  				else
  				{
  					result.append(" ");
  				}
  				continue;
  			}
  			if (inDeclaration && part.equalsIgnoreCase("BEGIN"))
  			{
  				result.append("BEGIN\n\t");
  				inDeclaration = false;
  				inMainSection = true;
  				continue;
  			}
  			if (inMainSection)
  			{
  				if (part.equalsIgnoreCase("END"+stmtSep) 
  					|| part.equalsIgnoreCase("END"))
  				{
  					inMainSection = false;
  					// remove the previously added tab character
  					result.setLength(result.length() - 1);
  					result.append(part);
  					if (!part.endsWith(stmtSep)) {
  						result.append(stmtSep);
  					}
  					result.append("\n");
  				}
  				else
  				{
  					result.append(part);
  					result.append(" ");
  					if (part.endsWith(stmtSep))
  					{
  						result.append("\n\t");
  					}
  				}
  				continue;
  			}
  			result.append(part);
  			result.append(stmtSep);
  			result.append("\n");
  		}
  		return result.toString();
  	}
focal_method.class_method_signature: NetezzaProcedureFormator.reformat(String in)
focal_method.full_signature: @Override public String reformat(String in)
focal_method.identifier: reformat
focal_method.invocations: replace breakApartNewLines split equalsIgnoreCase append append equalsIgnoreCase append equalsIgnoreCase append equalsIgnoreCase append equalsIgnoreCase endsWith append append endsWith append append equalsIgnoreCase append equalsIgnoreCase equalsIgnoreCase setLength length append endsWith append append append append endsWith append append append append toString
focal_method.modifiers: @Override public
focal_method.parameters: (String in)
focal_method.return: String
focal_method.signature: String reformat(String in)