Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
VTK
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor 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
Alex W.
VTK
Commits
af4e9020
Commit
af4e9020
authored
12 years ago
by
Sebastien Jourdain
Browse files
Options
Downloads
Patches
Plain Diff
Remove usage of generics and annotations
Change-Id: I168cce8362bd849015df93de2afad32854373dab
parent
8433dba1
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Wrapping/Java/vtk/vtkJavaMemoryManager.java
+1
-3
1 addition, 3 deletions
Wrapping/Java/vtk/vtkJavaMemoryManager.java
Wrapping/Java/vtk/vtkJavaMemoryManagerImpl.java
+6
-15
6 additions, 15 deletions
Wrapping/Java/vtk/vtkJavaMemoryManagerImpl.java
with
7 additions
and
18 deletions
Wrapping/Java/vtk/vtkJavaMemoryManager.java
+
1
−
3
View file @
af4e9020
...
...
@@ -18,14 +18,12 @@ public interface vtkJavaMemoryManager {
* Create or return an existing instance of the vtkObject that corresponds
* to the pointer id vtkId.
*
* @param <T>
* Type of the object that we want to return.
* @param vtkId
* is used to uniquely identify a vtkObject inside the C++ layer.
*
* @return a java object that map its underlying C++ instance.
*/
<
T
extends
vtkObjectBase
>
T
getJavaObject
(
Long
vtkId
);
vtkObjectBase
getJavaObject
(
Long
vtkId
);
/**
* Store the Java instance of a vtkObject inside a weak pointer map.
...
...
This diff is collapsed.
Click to expand it.
Wrapping/Java/vtk/vtkJavaMemoryManagerImpl.java
+
6
−
15
View file @
af4e9020
...
...
@@ -28,10 +28,8 @@ public class vtkJavaMemoryManagerImpl implements vtkJavaMemoryManager {
this
.
garbageCollector
=
new
vtkJavaGarbageCollector
();
}
@SuppressWarnings
(
"unchecked"
)
@Override
// Thread safe
public
<
T
extends
vtkObjectBase
>
T
getJavaObject
(
Long
vtkId
)
{
public
vtkObjectBase
getJavaObject
(
Long
vtkId
)
{
// Check pre-condition
if
(
vtkId
==
null
||
vtkId
.
longValue
()
==
0
)
{
throw
new
RuntimeException
(
"Invalid ID, can not be null or equal to 0."
);
...
...
@@ -53,7 +51,7 @@ public class vtkJavaMemoryManagerImpl implements vtkJavaMemoryManager {
value
=
objectMap
.
get
(
vtkId
);
resultObject
=
(
value
==
null
)
?
null
:
value
.
get
();
if
(
resultObject
!=
null
)
{
return
(
T
)
resultObject
;
return
resultObject
;
}
// We need to do the work of the gc
...
...
@@ -65,9 +63,9 @@ public class vtkJavaMemoryManagerImpl implements vtkJavaMemoryManager {
if
(
resultObject
==
null
)
{
try
{
String
className
=
vtkObjectBase
.
VTKGetClassNameFromReference
(
vtkId
.
longValue
());
Class
<
T
>
c
=
(
Class
<
T
>)
Class
.
forName
(
"vtk."
+
className
);
Constructor
<
T
>
cons
=
c
.
getConstructor
(
new
Class
[]
{
long
.
class
});
resultObject
=
cons
.
newInstance
(
new
Object
[]
{
vtkId
});
Class
c
=
Class
.
forName
(
"vtk."
+
className
);
Constructor
cons
=
c
.
getConstructor
(
new
Class
[]
{
long
.
class
});
resultObject
=
(
vtkObjectBase
)
cons
.
newInstance
(
new
Object
[]
{
vtkId
});
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
...
...
@@ -76,10 +74,9 @@ public class vtkJavaMemoryManagerImpl implements vtkJavaMemoryManager {
this
.
lock
.
unlock
();
}
}
return
(
T
)
resultObject
;
return
resultObject
;
}
@Override
// Thread safe
public
void
registerJavaObject
(
Long
id
,
vtkObjectBase
obj
)
{
try
{
...
...
@@ -91,7 +88,6 @@ public class vtkJavaMemoryManagerImpl implements vtkJavaMemoryManager {
}
}
@Override
// Thread safe
public
void
unRegisterJavaObject
(
Long
id
)
{
try
{
...
...
@@ -110,7 +106,6 @@ public class vtkJavaMemoryManagerImpl implements vtkJavaMemoryManager {
}
}
@Override
// Thread safe
public
vtkReferenceInformation
gc
(
boolean
debug
)
{
System
.
gc
();
...
...
@@ -134,12 +129,10 @@ public class vtkJavaMemoryManagerImpl implements vtkJavaMemoryManager {
}
}
@Override
public
vtkJavaGarbageCollector
getAutoGarbageCollector
()
{
return
this
.
garbageCollector
;
}
@Override
// Thread safe
public
int
deleteAll
()
{
int
size
=
this
.
objectMap
.
size
();
...
...
@@ -154,12 +147,10 @@ public class vtkJavaMemoryManagerImpl implements vtkJavaMemoryManager {
return
size
;
}
@Override
public
int
getSize
()
{
return
objectMap
.
size
();
}
@Override
public
vtkReferenceInformation
getLastReferenceInformation
()
{
return
this
.
lastGcResult
;
}
...
...
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