Main Page | Packages | Class Hierarchy | Alphabetical List | Class List | File List | Class Members

com/ohrasys/cad/bnf/validator/ValidatorUtils.java

Go to the documentation of this file.
00001 package com.ohrasys.cad.bnf.validator;
00002 import java.util.*;
00003 public class ValidatorUtils {
00004   public static List flattenList(List tokens){
00005     if((tokens == null)||(tokens.size() == 0)) return new ArrayList<Object>();
00006     return recursiveFlatten(new ArrayList<Object>(), tokens);
00007   }
00008   
00009   private static List<Object> recursiveFlatten(List<Object> result, Object token){
00010     if(token instanceof List) {
00011       for(int i = 0; i < ((List)token).size(); i++){
00012         recursiveFlatten(result, ((List)token).get(i));
00013       }
00014     } else {
00015       result.add(token);
00016     }
00017     return result;
00018   }
00019   
00020 }

Generated on Sun Nov 13 10:13:03 2005 for JavaBackus-NaurTestAPI(JBNT) by  doxygen 1.4.2