Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
openbis
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sispub
openbis
Commits
08529a99
Commit
08529a99
authored
17 years ago
by
ribeaudc
Browse files
Options
Downloads
Patches
Plain Diff
Replace 'headerLine' with 'skippedLines' (more generic).
SVN: 405
parent
ba64c532
Loading
Loading
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
common/source/java/ch/systemsx/cisd/common/parser/DefaultLineFilter.java
+13
-11
13 additions, 11 deletions
...ava/ch/systemsx/cisd/common/parser/DefaultLineFilter.java
with
13 additions
and
11 deletions
common/source/java/ch/systemsx/cisd/common/parser/DefaultLineFilter.java
+
13
−
11
View file @
08529a99
package
ch.systemsx.cisd.common.parser
;
import
org.apache.commons.lang.ArrayUtils
;
/**
* A default <code>LineFilter</code> implementation that filters out comment and empty lines (lines starting with
* '#').
* <p>
* It is also possible here to define a set of lines that should be skipped.
* </p>
*
* @author Christian Ribeaud
*/
...
...
@@ -10,27 +15,24 @@ public final class DefaultLineFilter implements ILineFilter
{
/**
* The line where the header is.
* <p>
* If we set it bigger than <code>-1</code>, we assume that the header contains mapping information and should be
* skipped by the parser.
* </p>
* A set of lines that should be skipped.
*/
private
int
header
Line
=
-
1
;
private
int
[]
skipped
Line
s
=
ArrayUtils
.
EMPTY_INT_ARRAY
;
/**
Sets <code>headerLine</code>
. */
public
final
void
setHeader
Line
(
int
headerL
ine
)
/**
Add a line that should be skipped
. */
public
final
void
addSkipped
Line
(
int
l
ine
)
{
this
.
headerLine
=
headerL
ine
;
ArrayUtils
.
add
(
skippedLines
,
l
ine
)
;
}
//
// LineFilter
//
public
boolean
acceptLine
(
String
line
,
int
lineNumber
)
public
final
boolean
acceptLine
(
String
line
,
int
lineNumber
)
{
if
(
lineNumber
==
headerLine
)
// Not found
if
(
ArrayUtils
.
indexOf
(
skippedLines
,
lineNumber
)
>
ArrayUtils
.
INDEX_NOT_FOUND
)
{
return
false
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment