本文整理了Java中java.util.Stack.contains()
方法的一些代码示例,展示了Stack.contains()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Stack.contains()
方法的具体详情如下:
包路径:java.util.Stack
类名称:Stack
方法名:contains
暂无
代码示例来源:origin: JingYeoh/FragmentRigger
/**
* Pushes the specified object onto the top of the stack.
*
* @param fragmentTag Fragment's tag
* @param containerViewId the containerView that fragment is added.
*/
public boolean push(String fragmentTag, @IdRes int containerViewId) {
if (mFragmentStack.contains(fragmentTag)) return false;
mFragmentStack.push(fragmentTag);
mFragmentContainerMap.put(fragmentTag, containerViewId);
return true;
}
代码示例来源:origin: org.testng/testng
private void run(Graph<T> graph, T v) {
m_indices.put(v, m_index);
m_lowlinks.put(v, m_index);
m_index++;
m_s.push(v);
for (T vprime : graph.getPredecessors(v)) {
if (! m_indices.containsKey(vprime)) {
run(graph, vprime);
int min = Math.min(m_lowlinks.get(v), m_lowlinks.get(vprime));
m_lowlinks.put(v, min);
}
else if (m_s.contains(vprime)) {
m_lowlinks.put(v, Math.min(m_lowlinks.get(v), m_indices.get(vprime)));
}
}
if (Objects.equals(m_lowlinks.get(v), m_indices.get(v))) {
m_cycle = Lists.newArrayList();
T n;
do {
n = m_s.pop();
m_cycle.add(n);
} while (! n.equals(v));
}
}
代码示例来源:origin: cbeust/testng
private void run(Graph<T> graph, T v) {
m_indices.put(v, m_index);
m_lowlinks.put(v, m_index);
m_index++;
m_s.push(v);
for (T vprime : graph.getPredecessors(v)) {
if (!m_indices.containsKey(vprime)) {
run(graph, vprime);
int min = Math.min(m_lowlinks.get(v), m_lowlinks.get(vprime));
m_lowlinks.put(v, min);
} else if (m_s.contains(vprime)) {
m_lowlinks.put(v, Math.min(m_lowlinks.get(v), m_indices.get(vprime)));
}
}
if (Objects.equals(m_lowlinks.get(v), m_indices.get(v))) {
m_cycle = Lists.newArrayList();
T n;
do {
n = m_s.pop();
m_cycle.add(n);
} while (!n.equals(v));
}
}
代码示例来源:origin: Sable/soot
lowlinkForNode.put(v, lowLinkForNodeV = index);
index++;
s.push(v);
recurse(succ);
lowlinkForNode.put(v, lowLinkForNodeV = Math.min(lowLinkForNodeV, lowlinkForNode.get(succ)));
} else if (s.contains(succ)) {
lowlinkForNode.put(v, lowLinkForNodeV = Math.min(lowLinkForNodeV, indexForNodeSucc));
代码示例来源:origin: apache/hive
lowLinks.put(o, index.get());
index.incrementAndGet();
nodes.push(o);
connect(child, index, nodes, indexes, lowLinks, components);
lowLinks.put(o, Math.min(lowLinks.get(o), lowLinks.get(child)));
} else if (nodes.contains(child)) {
lowLinks.put(o, Math.min(lowLinks.get(o), indexes.get(child)));
代码示例来源:origin: Sable/soot
lowlinkForNode.put(v, index);
index++;
s.push(v);
isForward = true;
} else if (isForward && s.contains(succ)) {
int lowLinkForNodeV = lowlinkForNode.get(v);
lowlinkForNode.put(v, Math.min(lowLinkForNodeV, indexForNodeSucc));
代码示例来源:origin: apache/drill
lowLinks.put(o, index.get());
index.incrementAndGet();
nodes.push(o);
connect(child, index, nodes, indexes, lowLinks, components);
lowLinks.put(o, Math.min(lowLinks.get(o), lowLinks.get(child)));
} else if (nodes.contains(child)) {
lowLinks.put(o, Math.min(lowLinks.get(o), indexes.get(child)));
代码示例来源:origin: apache/drill
lowLinks.put(o, index.get());
index.incrementAndGet();
nodes.push(o);
connect(child, index, nodes, indexes, lowLinks, components, parseContext);
lowLinks.put(o, Math.min(lowLinks.get(o), lowLinks.get(child)));
} else if (nodes.contains(child)) {
lowLinks.put(o, Math.min(lowLinks.get(o), indexes.get(child)));
代码示例来源:origin: apache/hive
lowLinks.put(o, index.get());
index.incrementAndGet();
nodes.push(o);
connect(child, index, nodes, indexes, lowLinks, components, parseContext);
lowLinks.put(o, Math.min(lowLinks.get(o), lowLinks.get(child)));
} else if (nodes.contains(child)) {
lowLinks.put(o, Math.min(lowLinks.get(o), indexes.get(child)));
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
if (!bonesStack.contains(bone)) {
bonesStack.push(bone);
BoneContext boneContext = blenderContext.getBoneContext(bone);
if (!applied.contains(boneContext.getBoneOma())) {
代码示例来源:origin: weexteam/weex-hackernews
@Override
public V put(K key, V value) {
if (key != null && key.toString() != null) {
if (instancesStack.contains(key)) {
instancesStack.remove(key);
}
instancesStack.push(key.toString());
}
return super.put(key, value);
}
代码示例来源:origin: com.google.gwt/gwt-servlet
@Override
public boolean visit(AutoBean<?> bean, Context ctx) {
if (state.seen.contains(bean)) {
throw new HaltException(new UnsupportedOperationException("Cycles not supported"));
}
state.seen.push(bean);
state.sb.append("{");
return true;
}
代码示例来源:origin: cincheo/jsweet
private static <T> void dumpCycles(List<Node<T>> nodes, Stack<Node<T>> path, Function<T, String> toString) {
path.peek().outEdges.stream().map(e -> e.to).forEach(node -> {
if (nodes.contains(node)) {
if (path.contains(node)) {
System.out.println(
"cycle: " + path.stream().map(n -> toString.apply(n.element)).collect(Collectors.toList()));
} else {
path.push(node);
dumpCycles(nodes, path, toString);
path.pop();
}
}
});
;
}
代码示例来源:origin: zstackio/zstack
private void buildObject(Object obj) throws IllegalAccessException {
if (paths.contains(obj)) {
paths.push(obj);
throw new CloudRuntimeException(String.format("recursive object graph: %s", StringUtils.join(paths, " --> ")));
paths.push(obj);
List<Field> fs = FieldUtils.getAllFields(obj.getClass());
for (Field f : fs) {
trace.push(f.getName());
take(f, obj);
trace.pop();
代码示例来源:origin: zstackio/zstack
private static JSONObject dumpObject(Class<?> clazz, Stack<Class> hasDone) throws JSONException {
JSONObject jo = nj();
if (hasDone.contains(clazz)) {
jo.put("refer to", clazz.getName());
return jo;
hasDone.push(clazz);
代码示例来源:origin: zstackio/zstack
private void buildList(Field f, Object obj) throws IllegalAccessException {
CollectionGenericType type = (CollectionGenericType) FieldUtils.inferGenericTypeOnMapOrCollectionField(f);
DebugUtils.Assert(List.class.isAssignableFrom(f.getType()), String.format("Collection must be List, but %s is %s", makePath(), type.getValueType().getName()));
DebugUtils.Assert(type.isInferred(), String.format("Collection must use Generic, %s is not", makePath()));
if (isNullValue(f, obj)) {
return;
}
Object value = getValue(f, obj);
List col = (List) value;
if (col.isEmpty()) {
return;
}
if (paths.contains(value)) {
paths.push(value);
throw new CloudRuntimeException(String.format("recursive object graph: %s", StringUtils.join(paths, " --> ")));
}
paths.push(value);
for (Object item : col) {
String itemName = String.format("%s[%s]", f.getName(), col.indexOf(item));
trace.push(itemName);
if (canDeserialize(type.getValueType())) {
take(item);
} else {
buildObject(item);
}
trace.pop();
}
paths.pop();
}
代码示例来源:origin: zstackio/zstack
if (paths.contains(value)) {
paths.push(value);
throw new CloudRuntimeException(String.format("recursive object graph: %s", StringUtils.join(paths, " --> ")));
paths.push(obj);
Iterator<Entry> it = map.entrySet().iterator();
while (it.hasNext()) {
Object item = e.getValue();
String itemName = String.format("%s[\"%s\"]", f.getName(), key);
trace.push(itemName);
if (canDeserialize(type.getValueType())) {
take(item);
代码示例来源:origin: SpigotMC/BungeeCord
if ( dependStack.contains( depend ) )
} else
dependStack.push( plugin );
dependStatus = this.enablePlugin( pluginStatuses, dependStack, depend );
dependStack.pop();
代码示例来源:origin: TEAMMATES/teammates
/**
* Switches to new browser window for browsing.
*/
public void switchToNewWindow() {
String curWin = driver.getWindowHandle();
for (String handle : driver.getWindowHandles()) {
if (!handle.equals(curWin) && !windowHandles.contains(curWin)) {
windowHandles.push(curWin);
driver.switchTo().window(handle);
break;
}
}
}
代码示例来源:origin: geotools/geotools
if (processingTypes.contains(assignedName)) {
if (LOGGER.isLoggable(Level.FINE)) {
LOGGER.fine("Recursion found for type " + assignedName + ". Proxying it.");
return attType;
processingTypes.push(assignedName);
内容来源于网络,如有侵权,请联系作者删除!