Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
Rugged
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Orekit
Rugged
Commits
7c643018
Commit
7c643018
authored
4 years ago
by
Guylaine Prat
Browse files
Options
Downloads
Patches
Plain Diff
Optimize use of regex pattern
parent
90c1d42a
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/org/orekit/rugged/errors/DumpReplayer.java
+10
-2
10 additions, 2 deletions
src/main/java/org/orekit/rugged/errors/DumpReplayer.java
with
10 additions
and
2 deletions
src/main/java/org/orekit/rugged/errors/DumpReplayer.java
+
10
−
2
View file @
7c643018
...
@@ -33,6 +33,7 @@ import java.util.List;
...
@@ -33,6 +33,7 @@ import java.util.List;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.NavigableMap
;
import
java.util.NavigableMap
;
import
java.util.TreeMap
;
import
java.util.TreeMap
;
import
java.util.regex.Pattern
;
import
java.util.stream.Stream
;
import
java.util.stream.Stream
;
import
org.hipparchus.analysis.differentiation.DerivativeStructure
;
import
org.hipparchus.analysis.differentiation.DerivativeStructure
;
...
@@ -272,6 +273,13 @@ public class DumpReplayer {
...
@@ -272,6 +273,13 @@ public class DumpReplayer {
/** Dumped calls. */
/** Dumped calls. */
private
final
List
<
DumpedCall
>
calls
;
private
final
List
<
DumpedCall
>
calls
;
/** Pattern for delimiting regular expressions. */
private
static
final
Pattern
SEPARATOR
=
Pattern
.
compile
(
"\\s+"
);
/** Empty pattern. */
private
static
final
Pattern
PATTERN
=
Pattern
.
compile
(
" "
);
/** Simple constructor.
/** Simple constructor.
*/
*/
public
DumpReplayer
()
{
public
DumpReplayer
()
{
...
@@ -976,14 +984,14 @@ public class DumpReplayer {
...
@@ -976,14 +984,14 @@ public class DumpReplayer {
final
int
colon
=
line
.
indexOf
(
':'
);
final
int
colon
=
line
.
indexOf
(
':'
);
if
(
colon
>
0
)
{
if
(
colon
>
0
)
{
final
String
parsedKey
=
line
.
substring
(
0
,
colon
).
trim
().
replaceAll
(
"
"
,
"
_"
).
toUpperCase
();
final
String
parsedKey
=
PATTERN
.
matcher
(
line
.
substring
(
0
,
colon
).
trim
()
)
.
replaceAll
(
"_"
).
toUpperCase
();
try
{
try
{
final
LineParser
parser
=
LineParser
.
valueOf
(
parsedKey
);
final
LineParser
parser
=
LineParser
.
valueOf
(
parsedKey
);
final
String
[]
fields
;
final
String
[]
fields
;
if
(
colon
+
1
>=
line
.
length
())
{
if
(
colon
+
1
>=
line
.
length
())
{
fields
=
new
String
[
0
];
fields
=
new
String
[
0
];
}
else
{
}
else
{
fields
=
line
.
substring
(
colon
+
1
).
trim
()
.
split
(
"\\s+"
);
fields
=
SEPARATOR
.
split
(
line
.
substring
(
colon
+
1
).
trim
());
}
}
parser
.
parse
(
l
,
file
,
line
,
fields
,
global
);
parser
.
parse
(
l
,
file
,
line
,
fields
,
global
);
}
catch
(
IllegalArgumentException
iae
)
{
}
catch
(
IllegalArgumentException
iae
)
{
...
...
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