-
Notifications
You must be signed in to change notification settings - Fork 205
Expand file tree
/
Copy pathPolicyScope.java
More file actions
111 lines (90 loc) · 2.75 KB
/
PolicyScope.java
File metadata and controls
111 lines (90 loc) · 2.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
package io.dongtai.iast.common.scope;
import java.util.ArrayDeque;
import java.util.Deque;
public class PolicyScope {
private int agentLevel;
private int sourceLevel;
private int propagatorLevel;
private int propagatorSkipDepth;
private int sinkLevel;
private final Deque<String> sinkQueue = new ArrayDeque<>();
private int ignoreInternalLevel;
/**
* over max method pool size
*/
private boolean overCapacity;
public void enterAgent() {
this.agentLevel++;
}
public boolean inAgent() {
return this.agentLevel > 0;
}
/* renamed from: d */
public void leaveAgent() {
this.agentLevel = decrement(this.agentLevel);
}
public void enterSource() {
this.sourceLevel++;
}
public boolean isValidSource() {
return this.agentLevel == 0
&& this.ignoreInternalLevel == 0 && !this.overCapacity
&& this.sourceLevel == 1;
}
public void leaveSource() {
this.sourceLevel = decrement(this.sourceLevel);
}
public void enterPropagator(boolean skipScope) {
this.propagatorLevel++;
if (skipScope) {
this.propagatorSkipDepth++;
}
}
public boolean isValidPropagator() {
return this.agentLevel == 0
&& this.ignoreInternalLevel == 0 && !this.overCapacity && this.sourceLevel == 0
&& (this.propagatorLevel == 1 || this.propagatorSkipDepth > 0);
}
public void leavePropagator(boolean skipScope) {
this.propagatorLevel = decrement(this.propagatorLevel);
if (skipScope) {
this.propagatorSkipDepth = decrement(this.propagatorSkipDepth);
}
}
public void enterSink() {
this.sinkLevel++;
}
public boolean isValidSink() {
return this.agentLevel == 0
&& this.ignoreInternalLevel == 0 && !this.overCapacity && this.sourceLevel == 0
&& this.sinkLevel > 0;
}
public void leaveSink() {
this.sinkQueue.pop();
this.sinkLevel = decrement(this.sinkLevel);
}
public void enterIgnoreInternal() {
this.ignoreInternalLevel++;
}
public void leaveIgnoreInternal() {
this.ignoreInternalLevel = decrement(this.ignoreInternalLevel);
}
public boolean isOverCapacity() {
return this.overCapacity;
}
public void setOverCapacity(boolean overCapacity) {
this.overCapacity = overCapacity;
}
private int decrement(int level) {
if (level > 0) {
return level - 1;
}
return 0;
}
public Deque<String> getSinkQueue() {
return sinkQueue;
}
public void addSinkType(String sinkType) {
this.sinkQueue.push(sinkType);
}
}