Revision 3543a3cf
Added by Leszek Koltunski over 3 years ago
src/main/java/org/distorted/library/main/InternalNodeData.java | ||
---|---|---|
20 | 20 |
package org.distorted.library.main; |
21 | 21 |
|
22 | 22 |
import java.util.ArrayList; |
23 |
import java.util.HashMap; |
|
24 | 23 |
|
25 | 24 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
26 | 25 |
/** |
... | ... | |
28 | 27 |
*/ |
29 | 28 |
class InternalNodeData |
30 | 29 |
{ |
31 |
private static HashMap<ArrayList<Long>, InternalNodeData> mMapNodeID = new HashMap<>(); |
|
32 |
private static long mNextNodeID =0; |
|
33 |
|
|
34 |
private final ArrayList<Long> key; |
|
30 |
private final ArrayList<Long> mKey; |
|
35 | 31 |
private int numPointingNodes; |
36 | 32 |
private long currTime; |
37 | 33 |
|
... | ... | |
40 | 36 |
|
41 | 37 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
42 | 38 |
|
43 |
private InternalNodeData(long id, ArrayList<Long> k)
|
|
39 |
InternalNodeData(long id, ArrayList<Long> k) |
|
44 | 40 |
{ |
45 | 41 |
ID = id; |
46 |
key = k;
|
|
42 |
mKey = k;
|
|
47 | 43 |
numPointingNodes= 1; |
48 | 44 |
currTime =-1; |
49 | 45 |
mFBO = null; |
50 | 46 |
} |
51 | 47 |
|
52 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
53 |
|
|
54 |
static synchronized void onDestroy() |
|
55 |
{ |
|
56 |
mNextNodeID = 0; |
|
57 |
mMapNodeID.clear(); |
|
58 |
} |
|
59 |
|
|
60 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
61 |
|
|
62 |
@SuppressWarnings("unused") |
|
63 |
static void debugMap() |
|
64 |
{ |
|
65 |
InternalNodeData tmp; |
|
66 |
|
|
67 |
for(ArrayList<Long> key: mMapNodeID.keySet()) |
|
68 |
{ |
|
69 |
tmp = mMapNodeID.get(key); |
|
70 |
android.util.Log.e("NodeData", "NodeID: "+tmp.ID+" <-- "+key); |
|
71 |
} |
|
72 |
} |
|
73 |
|
|
74 | 48 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
75 | 49 |
|
76 | 50 |
static InternalNodeData returnData(ArrayList<Long> list) |
77 | 51 |
{ |
78 |
InternalNodeData newData = mMapNodeID.get(list);
|
|
52 |
InternalNodeData data = InternalStackFrameList.getMapID(list);
|
|
79 | 53 |
|
80 |
if( newData!=null )
|
|
54 |
if( data!=null )
|
|
81 | 55 |
{ |
82 |
newData.numPointingNodes++;
|
|
56 |
data.numPointingNodes++;
|
|
83 | 57 |
} |
84 | 58 |
else |
85 | 59 |
{ |
86 |
newData = new InternalNodeData(++mNextNodeID,list); |
|
87 |
mMapNodeID.put(list,newData); |
|
60 |
data = InternalStackFrameList.putNewDataToMap(list); |
|
88 | 61 |
} |
89 | 62 |
|
90 |
return newData;
|
|
63 |
return data;
|
|
91 | 64 |
} |
92 | 65 |
|
93 | 66 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
96 | 69 |
{ |
97 | 70 |
if( --numPointingNodes==0 ) |
98 | 71 |
{ |
99 |
mMapNodeID.remove(key);
|
|
72 |
InternalStackFrameList.removeKeyFromMap(mKey);
|
|
100 | 73 |
|
101 | 74 |
if( mFBO!=null ) return true; |
102 | 75 |
} |
Also available in: Unified diff
Put new things to the StackFrame.