Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
vlkb-siav2
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
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
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
ViaLactea
vlkb-siav2
Commits
1b92c44b
Commit
1b92c44b
authored
1 year ago
by
Robert Butora
Browse files
Options
Downloads
Patches
Plain Diff
merges Parser into Coord and removes Parse class
parent
36262b8b
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
data-discovery/src/main/java/vlkb/common/Coord.java
+32
-5
32 additions, 5 deletions
data-discovery/src/main/java/vlkb/common/Coord.java
data-discovery/src/main/java/vlkb/common/Parser.java
+0
-36
0 additions, 36 deletions
data-discovery/src/main/java/vlkb/common/Parser.java
with
32 additions
and
41 deletions
data-discovery/src/main/java/vlkb/common/Coord.java
+
32
−
5
View file @
1b92c44b
...
...
@@ -48,12 +48,12 @@ class Coord
Coord
coord
=
null
;
pubdid
=
Parser
.
getFirstString
(
params
,
"ID"
);
String
[]
circle
=
Parser
.
getFirstStringArray
(
params
,
"CIRCLE"
,
" "
,
3
);
String
[]
vel
=
Parser
.
getFirstStringArray
(
params
,
"BAND"
,
" "
,
2
);
pubdid
=
getFirstString
(
params
,
"ID"
);
String
[]
circle
=
getFirstStringArray
(
params
,
"CIRCLE"
,
" "
,
3
);
String
[]
vel
=
getFirstStringArray
(
params
,
"BAND"
,
" "
,
2
);
String
skySystem
=
Parser
.
getFirstString
(
params
,
"skysystem"
);
// FIXME add sanity checks / use enum
String
skySystem
=
getFirstString
(
params
,
"skysystem"
);
// FIXME add sanity checks / use enum
if
(
skySystem
==
null
)
skySystem
=
"ICRS"
;
this
.
skySystem
=
skySystem
;
...
...
@@ -65,7 +65,7 @@ class Coord
this
.
shape
=
"CIRCLE"
;
String
specSystem
=
Parser
.
getFirstString
(
params
,
"specsystem"
);
String
specSystem
=
getFirstString
(
params
,
"specsystem"
);
if
(
specSystem
==
null
)
specSystem
=
"2"
;
// 2=WAVE BARY
if
(
(
vel
!=
null
)
&&
(
vel
.
length
>=
2
)
)
{
...
...
@@ -349,6 +349,33 @@ class Coord
return
sb
.
toString
();
}
String
getFirstString
(
Map
<
String
,
String
[]>
params
,
String
key
)
{
String
[]
values
=
params
.
get
(
key
);
if
(
values
==
null
)
return
null
;
if
(
values
.
length
<
1
)
throw
new
IllegalArgumentException
(
key
+
" has no valid value"
);
else
return
values
[
0
];
// FIXME if values[0] is null -> canot distinguish from key not found
}
String
[]
getFirstStringArray
(
Map
<
String
,
String
[]>
params
,
String
key
,
String
separator
,
int
arrayLength
)
{
String
array
=
getFirstString
(
params
,
key
);
if
(
array
==
null
)
return
null
;
String
[]
stringArray
=
array
.
split
(
separator
);
if
(
stringArray
.
length
!=
arrayLength
)
throw
new
IllegalArgumentException
(
key
+
" parameter has incorrect number of elements ("
+
stringArray
.
length
+
" vs "
+
arrayLength
+
") or incorrect separator used"
);
return
stringArray
;
}
...
...
This diff is collapsed.
Click to expand it.
data-discovery/src/main/java/vlkb/common/Parser.java
deleted
100644 → 0
+
0
−
36
View file @
36262b8b
import
java.util.Map
;
class
Parser
{
static
String
getFirstString
(
Map
<
String
,
String
[]>
params
,
String
key
)
{
String
[]
values
=
params
.
get
(
key
);
if
(
values
==
null
)
return
null
;
if
(
values
.
length
<
1
)
throw
new
IllegalArgumentException
(
key
+
" has no valid value"
);
else
return
values
[
0
];
// FIXME if values[0] is null -> canot distinguish from key not found
}
static
String
[]
getFirstStringArray
(
Map
<
String
,
String
[]>
params
,
String
key
,
String
separator
,
int
arrayLength
)
{
String
array
=
getFirstString
(
params
,
key
);
if
(
array
==
null
)
return
null
;
String
[]
stringArray
=
array
.
split
(
separator
);
if
(
stringArray
.
length
!=
arrayLength
)
throw
new
IllegalArgumentException
(
key
+
" parameter has incorrect number of elements ("
+
stringArray
.
length
+
" vs "
+
arrayLength
+
") or incorrect separator used"
);
return
stringArray
;
}
}
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