本文整理了Java中java.util.Stack.search()
方法的一些代码示例,展示了Stack.search()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Stack.search()
方法的具体详情如下:
包路径:java.util.Stack
类名称:Stack
方法名:search
[英]Returns the index of the first occurrence of the object, starting from the top of the stack.
[中]返回对象第一次出现的索引,从堆栈顶部开始。
代码示例来源:origin: robovm/robovm
/**
* Check to see if this is a recursive attribute definition.
*
* @param attrSet A non-null ElemAttributeSet reference.
*
* @return true if the attribute set is recursive.
*/
public boolean isRecursiveAttrSet(ElemAttributeSet attrSet)
{
if (null == m_attrSetStack)
{
m_attrSetStack = new Stack();
}
if (!m_attrSetStack.empty())
{
int loc = m_attrSetStack.search(attrSet);
if (loc > -1)
{
return true;
}
}
return false;
}
代码示例来源:origin: xalan/xalan
/**
* Check to see if this is a recursive attribute definition.
*
* @param attrSet A non-null ElemAttributeSet reference.
*
* @return true if the attribute set is recursive.
*/
public boolean isRecursiveAttrSet(ElemAttributeSet attrSet)
{
if (null == m_attrSetStack)
{
m_attrSetStack = new Stack();
}
if (!m_attrSetStack.empty())
{
int loc = m_attrSetStack.search(attrSet);
if (loc > -1)
{
return true;
}
}
return false;
}
代码示例来源:origin: wildfly/wildfly
/**
* DFS of dependency graph formed by Property annotations and dependsUpon parameter
* This is used to create a list of Properties in dependency order
*/
static void addPropertyToDependencyList(List<AccessibleObject> orderedList, Map<String, AccessibleObject> props, Stack<AccessibleObject> stack, AccessibleObject obj) {
if (orderedList.contains(obj))
return ;
if (stack.search(obj) > 0) {
throw new RuntimeException("Deadlock in @Property dependency processing") ;
}
// record the fact that we are processing obj
stack.push(obj) ;
// process dependencies for this object before adding it to the list
Property annotation = obj.getAnnotation(Property.class) ;
String dependsClause = annotation.dependsUpon() ;
StringTokenizer st = new StringTokenizer(dependsClause, ",") ;
while (st.hasMoreTokens()) {
String token = st.nextToken().trim();
AccessibleObject dep = props.get(token) ;
// if null, throw exception
addPropertyToDependencyList(orderedList, props, stack, dep) ;
}
// indicate we're done with processing dependencies
stack.pop() ;
// we can now add in dependency order
orderedList.add(obj) ;
}
代码示例来源:origin: sakaiproject/sakai
public synchronized int search(Object arg0)
{
// TODO Auto-generated method stub
return stack.search(arg0);
}
代码示例来源:origin: org.apache.tapestry/com.springsource.org.apache.tapestry
/**
* {@inheritDoc}
*/
public int renderStackSearch(IRender render)
{
return _renderStack.search(render);
}
代码示例来源:origin: org.apache.tapestry/tapestry-framework
/**
* {@inheritDoc}
*/
public int renderStackSearch(IRender render)
{
return _renderStack.search(render);
}
代码示例来源:origin: org.jacorb/jacorb-idl-compiler
public static boolean isRecursionScope( String typeName )
{
return ( recursionStack.search( typeName ) != -1 );
}
代码示例来源:origin: org.jacorb/idl-compiler
public static boolean isRecursionScope( String typeName )
{
return ( recursionStack.search( typeName ) != -1 );
}
代码示例来源:origin: JacORB/JacORB
public static boolean isRecursionScope( String typeName )
{
return ( recursionStack.search( typeName ) != -1 );
}
代码示例来源:origin: hltfbk/Excitement-Open-Platform
@Override synchronized public int search(Object o){return super.search(o);}
}
代码示例来源:origin: stackoverflow.com
public static Stack<String> deleteFrom(Stack<String> stack, String obj) {
if (stack.search(obj) == -1) {
System.out.println("Element doesn't exists in stack.");
return stack;
}
Stack<String> stack2 = new Stack<String>();
while (stack.search(obj) != -1)
stack2.push(stack.pop());
stack2.pop();
while (stack2.size() != 0)
stack.push(stack2.pop());
return stack;
}
代码示例来源:origin: org.alfresco/alfresco-repository
/**
* Indicates whether the this behaviour is current enabled or not
*
* @return true if the behaviour is enabled, false otherwise
*/
public boolean isEnabled()
{
Stack<Integer> stack = disabled.get();
return stack.search(hashCode()) == -1;
}
代码示例来源:origin: Alfresco/alfresco-repository
/**
* Indicates whether the this behaviour is current enabled or not
*
* @return true if the behaviour is enabled, false otherwise
*/
public boolean isEnabled()
{
Stack<Integer> stack = disabled.get();
return stack.search(hashCode()) == -1;
}
代码示例来源:origin: apache/fop
private void pushInlineContainers(List<InlineParent> ich) {
LinkedList<InlineParent> icl = new LinkedList<InlineParent>();
for (InlineParent ic : ich) {
if (icOrig.search(ic) >= 0) {
break;
} else {
icl.addFirst(ic);
}
}
for (InlineParent ic : icl) {
icOrig.push(ic);
icNew.push(generateInlineContainer(ic));
}
}
private void pushTextContainer(TextArea tc, InlineArea ia) {
代码示例来源:origin: stackoverflow.com
//in class A
@Override
String toString(){
return toString(new Stack<Object>());
}
/**
@Param stack Holds all objects that have been called
*/
String toString(Stack stack){
String text = /* details from current class */;
if (bRef != null && stack != null && stack.search(bRef) == -1)
{
stack.push(bRef);
text += bRef.toString(stack);
}
return text;
}
代码示例来源:origin: com.opensymphony/webwork
/**
* Finds the nearest ancestor of this component stack.
* @param clazz the class to look for, or if assignable from.
* @return the component if found, <tt>null</tt> if not.
*/
protected Component findAncestor(Class clazz) {
Stack componentStack = getComponentStack();
int currPosition = componentStack.search(this);
if (currPosition >= 0) {
int start = componentStack.size() - currPosition - 1;
//for (int i = componentStack.size() - 2; i >= 0; i--) {
for (int i = start; i >=0; i--) {
Component component = (Component) componentStack.get(i);
if (clazz.isAssignableFrom(component.getClass()) && component != this) {
return component;
}
}
}
return null;
}
代码示例来源:origin: org.eclipse.equinox.p2/repository
public void end(String name) {
if (this.elements.empty()) {
throw new EndWithoutStartError();
}
int index = this.elements.search(name);
if (index == -1) {
throw new EndWithoutStartError(name);
}
for (int i = 0; i < index; i += 1) {
end();
}
}
代码示例来源:origin: com.github.veithen.cosmos.bootstrap/org.eclipse.equinox.p2.repository
public void end(String name) {
if (this.elements.empty()) {
throw new EndWithoutStartError();
}
int index = this.elements.search(name);
if (index == -1) {
throw new EndWithoutStartError(name);
}
for (int i = 0; i < index; i += 1) {
end();
}
}
代码示例来源:origin: de.jflex/jflex
private void includeFile(String filePath) {
File f = new File(file.getParentFile(), filePath);
if ( !f.canRead() )
throw new ScannerException(file,ErrorMessages.NOT_READABLE, yyline);
// check for cycle
if (files.search(f) > 0)
throw new ScannerException(file,ErrorMessages.FILE_CYCLE, yyline);
try {
yypushStream( new FileReader(f) );
files.push(file);
file = f;
Out.println("Including \""+file+"\"");
}
catch (FileNotFoundException e) {
throw new ScannerException(file,ErrorMessages.NOT_READABLE, yyline);
}
}
代码示例来源:origin: octo-online/reactive-audit
@Test(expected = ReactiveAuditException.class)
public void search()
{
ReactiveAudit.off.commit();
Stack stack=new Stack();
TestTools.strict.commit();
stack.search(null);
}
}
内容来源于网络,如有侵权,请联系作者删除!