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
78939eb7
Commit
78939eb7
authored
17 years ago
by
ribeaudc
Browse files
Options
Downloads
Patches
Plain Diff
add: - Constructors that do not need an Iterable as parameter.
SVN: 5453
parent
c136d7b4
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
common/source/java/ch/systemsx/cisd/common/collections/TableMap.java
+32
-6
32 additions, 6 deletions
...ce/java/ch/systemsx/cisd/common/collections/TableMap.java
with
32 additions
and
6 deletions
common/source/java/ch/systemsx/cisd/common/collections/TableMap.java
+
32
−
6
View file @
78939eb7
...
@@ -55,6 +55,30 @@ public class TableMap<K, E> implements Iterable<E>
...
@@ -55,6 +55,30 @@ public class TableMap<K, E> implements Iterable<E>
private
final
UniqueKeyViolationStrategy
uniqueKeyViolationStrategy
;
private
final
UniqueKeyViolationStrategy
uniqueKeyViolationStrategy
;
/**
* Creates a new instance for specified key extractor.
*
* @param extractor Strategy to extract a key of type <code>E</code> for an object of type
* <code>E</code>.
*/
public
TableMap
(
final
IKeyExtractor
<
K
,
E
>
extractor
)
{
this
(
null
,
extractor
,
UniqueKeyViolationStrategy
.
ERROR
);
}
/**
* Creates a new instance for the specified rows and key extractor.
*
* @param extractor Strategy to extract a key of type <code>E</code> for an object of type
* <code>E</code>.
* @param uniqueKeyViolationStrategy Strategy to react on unique key violations.
*/
public
TableMap
(
final
IKeyExtractor
<
K
,
E
>
extractor
,
final
UniqueKeyViolationStrategy
uniqueKeyViolationStrategy
)
{
this
(
null
,
extractor
,
uniqueKeyViolationStrategy
);
}
/**
/**
* Creates a new instance for the specified rows and key extractor.
* Creates a new instance for the specified rows and key extractor.
*
*
...
@@ -72,24 +96,26 @@ public class TableMap<K, E> implements Iterable<E>
...
@@ -72,24 +96,26 @@ public class TableMap<K, E> implements Iterable<E>
/**
/**
* Creates a new instance for the specified rows and key extractor.
* Creates a new instance for the specified rows and key extractor.
*
*
* @param rows Collection of rows of type <code>E</code>.
* @param rows
OrNull
Collection of rows of type <code>E</code>.
* @param extractor Strategy to extract a key of type <code>E</code> for an object of type
* @param extractor Strategy to extract a key of type <code>E</code> for an object of type
* <code>E</code>.
* <code>E</code>.
* @param uniqueKeyViolationStrategy Strategy to react on unique key violations.
* @param uniqueKeyViolationStrategy Strategy to react on unique key violations.
* @throws UniqueKeyViolationException If the keys of <var>rows</var> are not unique and a
* @throws UniqueKeyViolationException If the keys of <var>rows</var> are not unique and a
* <var>uniqueKeyViolationStrategy</var> of <code>ERROR</code> has been chosen.
* <var>uniqueKeyViolationStrategy</var> of <code>ERROR</code> has been chosen.
*/
*/
public
TableMap
(
final
Iterable
<
E
>
rows
,
final
IKeyExtractor
<
K
,
E
>
extractor
,
public
TableMap
(
final
Iterable
<
E
>
rows
OrNull
,
final
IKeyExtractor
<
K
,
E
>
extractor
,
final
UniqueKeyViolationStrategy
uniqueKeyViolationStrategy
)
final
UniqueKeyViolationStrategy
uniqueKeyViolationStrategy
)
{
{
assert
rows
!=
null
:
"Unspecified collection of rows."
;
assert
extractor
!=
null
:
"Unspecified key extractor."
;
assert
extractor
!=
null
:
"Unspecified key extractor."
;
assert
uniqueKeyViolationStrategy
!=
null
:
"Un
i
specified unique key violation strategy."
;
assert
uniqueKeyViolationStrategy
!=
null
:
"Unspecified unique key violation strategy."
;
this
.
extractor
=
extractor
;
this
.
extractor
=
extractor
;
this
.
uniqueKeyViolationStrategy
=
uniqueKeyViolationStrategy
;
this
.
uniqueKeyViolationStrategy
=
uniqueKeyViolationStrategy
;
for
(
final
E
row
:
rows
)
if
(
rowsOrNull
!=
null
)
{
{
add
(
row
);
for
(
final
E
row
:
rowsOrNull
)
{
add
(
row
);
}
}
}
}
}
...
...
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