Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
naming-backend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
ics-software
naming-backend
Commits
c522e1e3
Commit
c522e1e3
authored
2 years ago
by
Lars Johansson
Browse files
Options
Downloads
Patches
Plain Diff
Refactor to use String.split instead of StringTokenizer
parent
12bd26ef
No related branches found
No related tags found
No related merge requests found
Pipeline
#124636
passed
2 years ago
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/org/openepics/names/util/NamingConventionUtil.java
+34
-45
34 additions, 45 deletions
...n/java/org/openepics/names/util/NamingConventionUtil.java
with
34 additions
and
45 deletions
src/main/java/org/openepics/names/util/NamingConventionUtil.java
+
34
−
45
View file @
c522e1e3
...
@@ -19,7 +19,6 @@
...
@@ -19,7 +19,6 @@
package
org.openepics.names.util
;
package
org.openepics.names.util
;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
java.util.StringTokenizer
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.openepics.names.repository.model.Discipline
;
import
org.openepics.names.repository.model.Discipline
;
...
@@ -138,11 +137,11 @@ public class NamingConventionUtil {
...
@@ -138,11 +137,11 @@ public class NamingConventionUtil {
// system structure
// system structure
// before first occurrence of DELIMITER_EXTRA
// before first occurrence of DELIMITER_EXTRA
String
Tokenizer
s
t
1
=
new
StringTokenizer
(
conventionName
,
DELIMITER_EXTRA
,
false
);
String
[]
s1
=
conventionName
.
split
(
DELIMITER_EXTRA
);
if
(
s
t
1
.
countTokens
()
==
1
||
s
t
1
.
countTokens
()
==
2
||
s
t
1
.
countTokens
()
==
3
)
{
if
(
s1
.
length
==
1
||
s1
.
length
==
2
||
s1
.
length
==
3
)
{
String
Tokenizer
s
t
2
=
new
StringTokenizer
(
st1
.
nextToken
(),
DELIMITER_INTRA
,
false
);
String
[]
s2
=
s1
[
0
].
split
(
DELIMITER_INTRA
);
if
(
s
t
2
.
countTokens
()
==
3
)
{
if
(
s2
.
length
==
3
)
{
return
s
t2
.
nextToken
()
;
return
s
2
[
0
]
;
}
}
}
}
}
}
...
@@ -161,14 +160,13 @@ public class NamingConventionUtil {
...
@@ -161,14 +160,13 @@ public class NamingConventionUtil {
// system structure
// system structure
// before first occurrence of DELIMITER_EXTRA
// before first occurrence of DELIMITER_EXTRA
StringTokenizer
st1
=
new
StringTokenizer
(
conventionName
,
DELIMITER_EXTRA
,
false
);
String
[]
s1
=
conventionName
.
split
(
DELIMITER_EXTRA
);
if
(
st1
.
countTokens
()
==
1
||
st1
.
countTokens
()
==
2
||
st1
.
countTokens
()
==
3
)
{
if
(
s1
.
length
==
1
||
s1
.
length
==
2
||
s1
.
length
==
3
)
{
StringTokenizer
st2
=
new
StringTokenizer
(
st1
.
nextToken
(),
DELIMITER_INTRA
,
false
);
String
[]
s2
=
s1
[
0
].
split
(
DELIMITER_INTRA
);
if
(
st2
.
countTokens
()
==
3
)
{
if
(
s2
.
length
==
3
)
{
st2
.
nextToken
();
return
s2
[
1
];
return
st2
.
nextToken
();
}
else
if
(
s2
.
length
==
2
||
s2
.
length
==
1
)
{
}
else
if
(
st2
.
countTokens
()
==
2
||
st2
.
countTokens
()
==
1
)
{
return
s2
[
0
];
return
st2
.
nextToken
();
}
}
}
}
}
}
...
@@ -187,16 +185,13 @@ public class NamingConventionUtil {
...
@@ -187,16 +185,13 @@ public class NamingConventionUtil {
// system structure
// system structure
// before first occurrence of DELIMITER_EXTRA
// before first occurrence of DELIMITER_EXTRA
StringTokenizer
st1
=
new
StringTokenizer
(
conventionName
,
DELIMITER_EXTRA
,
false
);
String
[]
s1
=
conventionName
.
split
(
DELIMITER_EXTRA
);
if
(
st1
.
countTokens
()
==
1
||
st1
.
countTokens
()
==
2
||
st1
.
countTokens
()
==
3
)
{
if
(
s1
.
length
==
1
||
s1
.
length
==
2
||
s1
.
length
==
3
)
{
StringTokenizer
st2
=
new
StringTokenizer
(
st1
.
nextToken
(),
DELIMITER_INTRA
,
false
);
String
[]
s2
=
s1
[
0
].
split
(
DELIMITER_INTRA
);
if
(
st2
.
countTokens
()
==
3
)
{
if
(
s2
.
length
==
3
)
{
st2
.
nextToken
();
return
s2
[
2
];
st2
.
nextToken
();
}
else
if
(
s2
.
length
==
2
)
{
return
st2
.
nextToken
();
return
s2
[
1
];
}
else
if
(
st2
.
countTokens
()
==
2
)
{
st2
.
nextToken
();
return
st2
.
nextToken
();
}
}
}
}
}
}
...
@@ -216,12 +211,11 @@ public class NamingConventionUtil {
...
@@ -216,12 +211,11 @@ public class NamingConventionUtil {
// after first occurrence of DELIMITER_EXTRA
// after first occurrence of DELIMITER_EXTRA
// before possible second occurrence of DELIMITER_EXTRA
// before possible second occurrence of DELIMITER_EXTRA
StringTokenizer
st1
=
new
StringTokenizer
(
conventionName
,
DELIMITER_EXTRA
,
false
);
String
[]
s1
=
conventionName
.
split
(
DELIMITER_EXTRA
);
if
(
st1
.
countTokens
()
==
2
||
st1
.
countTokens
()
==
3
)
{
if
(
s1
.
length
==
2
||
s1
.
length
==
3
)
{
st1
.
nextToken
();
String
[]
s2
=
s1
[
1
].
split
(
DELIMITER_INTRA
);
StringTokenizer
st2
=
new
StringTokenizer
(
st1
.
nextToken
(),
DELIMITER_INTRA
,
false
);
if
(
s2
.
length
==
3
||
s2
.
length
==
2
)
{
if
(
st2
.
countTokens
()
==
3
||
st2
.
countTokens
()
==
2
)
{
return
s2
[
0
];
return
st2
.
nextToken
();
}
}
}
}
}
}
...
@@ -241,13 +235,11 @@ public class NamingConventionUtil {
...
@@ -241,13 +235,11 @@ public class NamingConventionUtil {
// after first occurrence of DELIMITER_EXTRA
// after first occurrence of DELIMITER_EXTRA
// before possible second occurrence of DELIMITER_EXTRA
// before possible second occurrence of DELIMITER_EXTRA
StringTokenizer
st1
=
new
StringTokenizer
(
conventionName
,
DELIMITER_EXTRA
,
false
);
String
[]
s1
=
conventionName
.
split
(
DELIMITER_EXTRA
);
if
(
st1
.
countTokens
()
==
2
||
st1
.
countTokens
()
==
3
)
{
if
(
s1
.
length
==
2
||
s1
.
length
==
3
)
{
st1
.
nextToken
();
String
[]
s2
=
s1
[
1
].
split
(
DELIMITER_INTRA
);
StringTokenizer
st2
=
new
StringTokenizer
(
st1
.
nextToken
(),
DELIMITER_INTRA
,
false
);
if
(
s2
.
length
==
3
||
s2
.
length
==
2
)
{
if
(
st2
.
countTokens
()
==
3
||
st2
.
countTokens
()
==
2
)
{
return
s2
[
1
];
st2
.
nextToken
();
return
st2
.
nextToken
();
}
}
}
}
}
}
...
@@ -267,14 +259,11 @@ public class NamingConventionUtil {
...
@@ -267,14 +259,11 @@ public class NamingConventionUtil {
// after first occurrence of DELIMITER_EXTRA
// after first occurrence of DELIMITER_EXTRA
// before possible second occurrence of DELIMITER_EXTRA
// before possible second occurrence of DELIMITER_EXTRA
StringTokenizer
st1
=
new
StringTokenizer
(
conventionName
,
DELIMITER_EXTRA
,
false
);
String
[]
s1
=
conventionName
.
split
(
DELIMITER_EXTRA
);
if
(
st1
.
countTokens
()
==
2
||
st1
.
countTokens
()
==
3
)
{
if
(
s1
.
length
==
2
||
s1
.
length
==
3
)
{
st1
.
nextToken
();
String
[]
s2
=
s1
[
1
].
split
(
DELIMITER_INTRA
);
StringTokenizer
st2
=
new
StringTokenizer
(
st1
.
nextToken
(),
DELIMITER_INTRA
,
false
);
if
(
s2
.
length
==
3
)
{
if
(
st2
.
countTokens
()
==
3
)
{
return
s2
[
2
];
st2
.
nextToken
();
st2
.
nextToken
();
return
st2
.
nextToken
();
}
}
}
}
}
}
...
...
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