@Test public void testListVariables() { List<String> varCells = new ArrayList<String>(); varCells.add( "Var1 var1, Var2 var2,Var3 var3" ); final List<Global> varList = RuleSheetParserUtil.getVariableList( varCells ); assertNotNull( varList ); assertEquals( 3, varList.size() ); Global var = varList.get( 0 ); assertEquals( "Var1", var.getClassName() ); var = varList.get( 2 ); assertEquals( "Var3", var.getClassName() ); assertEquals( "var3", var.getIdentifier() ); }
public static List<Global> getVariableList( final List<String> variableCells ){ final List<Global> variableList = new ArrayList<Global>(); if ( variableCells == null ) return variableList; for( String variableCell: variableCells ){ final StringTokenizer tokens = new StringTokenizer( variableCell, "," ); while ( tokens.hasMoreTokens() ) { final String token = tokens.nextToken(); final Global vars = new Global(); final StringTokenizer paramTokens = new StringTokenizer( token, " " ); vars.setClassName( paramTokens.nextToken() ); if ( !paramTokens.hasMoreTokens() ) { throw new DecisionTableParseException( "The format for global variables is incorrect. " + "It should be: [Class name, Class otherName]. But it was: [" + variableCell + "]" ); } vars.setIdentifier( paramTokens.nextToken() ); variableList.add( vars ); } } return variableList; }
RuleSheetParserUtil { public static List<Global> getVariableList( final List<String> variableCells ){ final List<Global> variableList = new ArrayList<Global>(); if ( variableCells == null ) return variableList; for( String variableCell: variableCells ){ final StringTokenizer tokens = new StringTokenizer( variableCell, "," ); while ( tokens.hasMoreTokens() ) { final String token = tokens.nextToken(); final Global vars = new Global(); final StringTokenizer paramTokens = new StringTokenizer( token, " " ); vars.setClassName( paramTokens.nextToken() ); if ( !paramTokens.hasMoreTokens() ) { throw new DecisionTableParseException( "The format for global variables is incorrect. " + "It should be: [Class name, Class otherName]. But it was: [" + variableCell + "]" ); } vars.setIdentifier( paramTokens.nextToken() ); variableList.add( vars ); } } return variableList; } }
RuleSheetParserUtil { public static List<Global> getVariableList( final List<String> variableCells ){ final List<Global> variableList = new ArrayList<Global>(); if ( variableCells == null ) return variableList; for( String variableCell: variableCells ){ final StringTokenizer tokens = new StringTokenizer( variableCell, "," ); while ( tokens.hasMoreTokens() ) { final String token = tokens.nextToken(); final Global vars = new Global(); final StringTokenizer paramTokens = new StringTokenizer( token, " " ); vars.setClassName( paramTokens.nextToken() ); if ( !paramTokens.hasMoreTokens() ) { throw new DecisionTableParseException( "The format for global variables is incorrect. " + "It should be: [Class name, Class otherName]. But it was: [" + variableCell + "]" ); } vars.setIdentifier( paramTokens.nextToken() ); variableList.add( vars ); } } return variableList; } private  RuleSheetParserUtil(); }
RuleSheetParserUtil { public static List<Global> getVariableList( final List<String> variableCells ){ final List<Global> variableList = new ArrayList<Global>(); if ( variableCells == null ) return variableList; for( String variableCell: variableCells ){ final StringTokenizer tokens = new StringTokenizer( variableCell, "," ); while ( tokens.hasMoreTokens() ) { final String token = tokens.nextToken(); final Global vars = new Global(); final StringTokenizer paramTokens = new StringTokenizer( token, " " ); vars.setClassName( paramTokens.nextToken() ); if ( !paramTokens.hasMoreTokens() ) { throw new DecisionTableParseException( "The format for global variables is incorrect. " + "It should be: [Class name, Class otherName]. But it was: [" + variableCell + "]" ); } vars.setIdentifier( paramTokens.nextToken() ); variableList.add( vars ); } } return variableList; } private  RuleSheetParserUtil(); static String getRuleName(final String ruleRow); static List<Import> getImportList(final List<String> importCells); static List<Global> getVariableList( final List<String> variableCells ); static boolean isStringMeaningTrue(String property); static String rc2name( int row, int col ); }
RuleSheetParserUtil { public static List<Global> getVariableList( final List<String> variableCells ){ final List<Global> variableList = new ArrayList<Global>(); if ( variableCells == null ) return variableList; for( String variableCell: variableCells ){ final StringTokenizer tokens = new StringTokenizer( variableCell, "," ); while ( tokens.hasMoreTokens() ) { final String token = tokens.nextToken(); final Global vars = new Global(); final StringTokenizer paramTokens = new StringTokenizer( token, " " ); vars.setClassName( paramTokens.nextToken() ); if ( !paramTokens.hasMoreTokens() ) { throw new DecisionTableParseException( "The format for global variables is incorrect. " + "It should be: [Class name, Class otherName]. But it was: [" + variableCell + "]" ); } vars.setIdentifier( paramTokens.nextToken() ); variableList.add( vars ); } } return variableList; } private  RuleSheetParserUtil(); static String getRuleName(final String ruleRow); static List<Import> getImportList(final List<String> importCells); static List<Global> getVariableList( final List<String> variableCells ); static boolean isStringMeaningTrue(String property); static String rc2name( int row, int col );  }