Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
BigDataViewer_Core_Extension
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
BioinformaticDataCompression
BigDataViewer_Core_Extension
Commits
b260420f
Commit
b260420f
authored
8 years ago
by
Tobias Pietzsch
Browse files
Options
Downloads
Patches
Plain Diff
rename getGlobalIfCached()/createGlobal() to getIfPresent()/get() (consistent with guava)
parent
524956f0
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/bdv/cache/LoadingVolatileCache.java
+10
-10
10 additions, 10 deletions
src/main/java/bdv/cache/LoadingVolatileCache.java
src/main/java/bdv/img/cache/VolatileGlobalCellCache.java
+2
-2
2 additions, 2 deletions
src/main/java/bdv/img/cache/VolatileGlobalCellCache.java
with
12 additions
and
12 deletions
src/main/java/bdv/cache/LoadingVolatileCache.java
+
10
−
10
View file @
b260420f
...
...
@@ -41,10 +41,10 @@ import bdv.img.cache.VolatileGlobalCellCache;
* a set of {@link FetcherThreads} that asynchronously load data for cached
* values.
* <p>
* Using {@link #
createGlobal
(Object, CacheHints, VolatileCacheValueLoader)}, a
*
key is
added to the cache, specifying a {@link VolatileCacheValueLoader} to
*
provide
the value for the key. After adding the key to the cache, it is
*
immediately
associated with a value. However, that value may be initially
* Using {@link #
get
(Object, CacheHints, VolatileCacheValueLoader)}, a
key is
* added to the cache, specifying a {@link VolatileCacheValueLoader} to
provide
* the value for the key. After adding the key to the cache, it is
immediately
* associated with a value. However, that value may be initially
* {@link VolatileCacheValue#isValid() invalid}. When the value is made valid
* (loaded) depends on the provided {@link CacheHints}, specifically the
* {@link CacheHints#getLoadingStrategy() loading strategy}. The strategy may be
...
...
@@ -52,10 +52,10 @@ import bdv.img.cache.VolatileGlobalCellCache;
* budget left, to enqueue it for asynchronous loading, or to not load it at
* all.
* <p>
* Using {@link #get
GlobalIfCached
(Object, CacheHints)} a value for the
*
specified key
is returned if the key is in the cache (otherwise {@code null}
*
is returned).
Again, the returned value may be invalid, and when the value is
*
loaded
depends on the provided {@link CacheHints}.
* Using {@link #get
IfPresent
(Object, CacheHints)} a value for the
specified key
* is returned if the key is in the cache (otherwise {@code null}
is returned).
* Again, the returned value may be invalid, and when the value is
loaded
* depends on the provided {@link CacheHints}.
*
* @param <K>
* the key type.
...
...
@@ -124,7 +124,7 @@ public final class LoadingVolatileCache< K, V extends VolatileCacheValue > imple
* {@link LoadingStrategy}, queue priority, and queue order.
* @return the value with the specified key in the cache or {@code null}.
*/
public
V
get
GlobalIfCached
(
final
K
key
,
final
CacheHints
cacheHints
)
public
V
get
IfPresent
(
final
K
key
,
final
CacheHints
cacheHints
)
{
final
Entry
entry
=
cache
.
get
(
key
);
if
(
entry
!=
null
)
...
...
@@ -172,7 +172,7 @@ public final class LoadingVolatileCache< K, V extends VolatileCacheValue > imple
* @param cacheLoader
* @return the value with the specified key in the cache.
*/
public
V
createGlobal
(
final
K
key
,
final
CacheHints
cacheHints
,
final
VolatileCacheValueLoader
<
?
extends
V
>
cacheLoader
)
public
V
get
(
final
K
key
,
final
CacheHints
cacheHints
,
final
VolatileCacheValueLoader
<
?
extends
V
>
cacheLoader
)
{
Entry
entry
=
null
;
...
...
This diff is collapsed.
Click to expand it.
src/main/java/bdv/img/cache/VolatileGlobalCellCache.java
+
2
−
2
View file @
b260420f
...
...
@@ -273,7 +273,7 @@ public class VolatileGlobalCellCache implements Cache
public
VolatileCell
<
A
>
get
(
final
long
index
)
{
final
Key
key
=
new
Key
(
timepoint
,
setup
,
level
,
index
);
return
(
VolatileCell
<
A
>
)
volatileCache
.
get
GlobalIfCached
(
key
,
cacheHints
);
return
(
VolatileCell
<
A
>
)
volatileCache
.
get
IfPresent
(
key
,
cacheHints
);
}
@SuppressWarnings
(
"unchecked"
)
...
...
@@ -282,7 +282,7 @@ public class VolatileGlobalCellCache implements Cache
{
final
Key
key
=
new
Key
(
timepoint
,
setup
,
level
,
index
);
final
VolatileCellLoader
<
A
>
loader
=
new
VolatileCellLoader
<>(
cacheArrayLoader
,
timepoint
,
setup
,
level
,
cellDims
,
cellMin
);
return
(
VolatileCell
<
A
>
)
volatileCache
.
createGlobal
(
key
,
cacheHints
,
loader
);
return
(
VolatileCell
<
A
>
)
volatileCache
.
get
(
key
,
cacheHints
,
loader
);
}
@Override
...
...
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