Changeset 3416


Ignore:
Timestamp:
May 31, 2007, 10:48:52 AM (14 years ago)
Author:
Johan Enell
Message:

changed the regexp order in hasMoreData()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/core/net/sf/basedb/util/parser/FlatFileParser.java

    r3264 r3416  
    882882    lines from the stream. Each line is checked in the following order:
    883883    <ol>
     884    <li>Does it match the {@link #setIgnoreRegexp(Pattern) ignore} regular
     885      expression?</li>
     886    <li>Does it match the {@link #setDataFooterRegexp(Pattern) data footer}
     887      regular expression?</li>
     888    <li>Does it match the {@link #setSectionRegexp(Pattern) section}
     889      regular expression?</li>
    884890    <li>Can it be split by the {@link #setDataSplitterRegexp(Pattern) data}
    885       regular expression into the appropriate number of columns?
    886     <li>Does it match the {@link #setDataFooterRegexp(Pattern) data footer}
    887       regular expression?
    888     <li>Does it match the {@link #setSectionRegexp(Pattern) section}
    889       regular expression?
     891      regular expression into the appropriate number of columns?</li>
    890892    </ol>
    891893    If the first check is true, TRUE is returned and the data may be
     
    937939            }
    938940          }
     941
     942          // Check if it matches the data footer regexp
     943          if (!done && dataFooter != null)
     944          {
     945            Matcher m = dataFooter.matcher(line);
     946            done = m.matches();
     947          }
     948         
     949          // Check if it matches the section regexp
     950          if (!done && section != null)
     951          {
     952            Matcher m = section.matcher(line);
     953            if (m.matches() && (m.groupCount() == 1))
     954            {
     955              done = true;
     956              nextSection = new Line(parsedLines, line, m.group(1), LineType.SECTION);
     957              lines.add(nextSection);
     958            }
     959          }
    939960         
    940961          if (!done)
     
    947968              done = true;
    948969              nextData = new Data(parsedLines, line, columns, emptyIsNull, nullIsNull);
    949             }
    950           }
    951 
    952           // Check if it matches the data footer regexp
    953           if (!done && (dataFooter != null))
    954           {
    955             Matcher m = dataFooter.matcher(line);
    956             done = m.matches();
    957           }
    958          
    959           // Check if it matches the section regexp
    960           if (!done && (section != null))
    961           {
    962             Matcher m = section.matcher(line);
    963             if (m.matches() && (m.groupCount() == 1))
    964             {
    965               done = true;
    966               nextSection = new Line(parsedLines, line, m.group(1), LineType.SECTION);
    967               lines.add(nextSection);
    968970            }
    969971          }
Note: See TracChangeset for help on using the changeset viewer.