本文整理了Java中java.util.Stack.elementAt()
方法的一些代码示例,展示了Stack.elementAt()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Stack.elementAt()
方法的具体详情如下:
包路径:java.util.Stack
类名称:Stack
方法名:elementAt
暂无
代码示例来源:origin: javax.el/javax.el-api
/**
* Inquires if the name is a LambdaArgument
* @param arg A possible Lambda formal parameter name
* @return true if arg is a LambdaArgument, false otherwise.
*/
public boolean isLambdaArgument(String arg) {
if (lambdaArgs == null) {
return false;
}
for (int i = lambdaArgs.size() - 1; i >= 0; i--) {
Map<String, Object> lmap = lambdaArgs.elementAt(i);
if (lmap.containsKey(arg)) {
return true;
}
}
return false;
}
代码示例来源:origin: alibaba/mdrill
/** Transfer an element from the real to the virtual stack. This assumes
* that the virtual stack is currently empty.
*/
@SuppressWarnings("unchecked")
protected void get_from_real()
{
Symbol stack_sym;
/* don't transfer if the real stack is empty */
if (real_next >= real_stack.size()) return;
/* get a copy of the first Symbol we have not transfered */
stack_sym = (Symbol)real_stack.elementAt(real_stack.size()-1-real_next);
/* record the transfer */
real_next++;
/* put the state number from the Symbol onto the virtual stack */
vstack.push(new Integer(stack_sym.parse_state));
}
代码示例来源:origin: robovm/robovm
/**
* Utility function to see if the stack contains the given URL.
*
* @param stack non-null reference to a Stack.
* @param url URL string on which an equality test will be performed.
*
* @return true if the stack contains the url argument.
*/
private boolean stackContains(Stack stack, String url)
{
int n = stack.size();
boolean contains = false;
for (int i = 0; i < n; i++)
{
String url2 = (String) stack.elementAt(i);
if (url2.equals(url))
{
contains = true;
break;
}
}
return contains;
}
代码示例来源:origin: xalan/xalan
/**
* Utility function to see if the stack contains the given URL.
*
* @param stack non-null reference to a Stack.
* @param url URL string on which an equality test will be performed.
*
* @return true if the stack contains the url argument.
*/
private boolean stackContains(Stack stack, String url)
{
int n = stack.size();
boolean contains = false;
for (int i = 0; i < n; i++)
{
String url2 = (String) stack.elementAt(i);
if (url2.equals(url))
{
contains = true;
break;
}
}
return contains;
}
代码示例来源:origin: alibaba/mdrill
/** Do debug output for stack state. [CSA]
*/
public void debug_stack() {
StringBuffer sb=new StringBuffer("## STACK:");
for (int i=0; i<stack.size(); i++) {
Symbol s = (Symbol) stack.elementAt(i);
sb.append(" <state "+s.parse_state+", sym "+s.sym+">");
if ((i%3)==2 || (i==(stack.size()-1))) {
debug_message(sb.toString());
sb = new StringBuffer(" ");
}
}
}
代码示例来源:origin: javax.el/javax.el-api
/**
* Retrieves the Lambda argument associated with a formal parameter.
* If the Lambda expression is nested within other Lambda expressions, the
* arguments for the current Lambda expression is first searched, and if
* not found, the arguments for the immediate nesting Lambda expression
* then searched, and so on.
*
* @param arg The formal parameter for the Lambda argument
* @return The object associated with formal parameter. Null if
* no object has been associated with the parameter.
* @since EL 3.0
*/
public Object getLambdaArgument(String arg) {
if (lambdaArgs == null) {
return null;
}
for (int i = lambdaArgs.size() - 1; i >= 0; i--) {
Map<String, Object> lmap = lambdaArgs.elementAt(i);
Object v = lmap.get(arg);
if (v != null) {
return v;
}
}
return null;
}
代码示例来源:origin: gocd/gocd
if (s.size() < 2) {
for (int i = 0; i < s.size(); i++) {
if (i > 1) {
sb.append(s.elementAt(i));
代码示例来源:origin: alibaba/mdrill
/** Dump the parse stack for debugging purposes. */
public void dump_stack()
{
if (stack == null)
{
debug_message("# Stack dump requested, but stack is null");
return;
}
debug_message("============ Parse Stack Dump ============");
/* dump the stack */
for (int i=0; i<stack.size(); i++)
{
debug_message("Symbol: " + ((Symbol)stack.elementAt(i)).sym +
" State: " + ((Symbol)stack.elementAt(i)).parse_state);
}
debug_message("==========================================");
}
代码示例来源:origin: org.apache.ant/ant
if (s.size() < 2) {
final int size = s.size();
for (int i = 0; i < size; i++) {
if (i > 1) {
sb.append(s.elementAt(i));
代码示例来源:origin: robovm/robovm
int depth = namespaces.size();
NameSpace ns = (NameSpace) namespaces.elementAt(i);
代码示例来源:origin: xalan/xalan
int depth = namespaces.size();
NameSpace ns = (NameSpace) namespaces.elementAt(i);
代码示例来源:origin: oubowu/OuNews
public Activity getPreActivity() {
if (mActivityStack == null) {
return null;
}
int size = mActivityStack.size();
if (size < 2) {
return null;
}
return mActivityStack.elementAt(size - 2);
}
代码示例来源:origin: bcel/bcel
/**
* @param level nesting level, i.e., 0 returns the direct predecessor
* @return container of current entitity, i.e., predecessor during traversal
*/
public Object predecessor(int level) {
int size = stack.size();
if((size < 2) || (level < 0))
return null;
else
return stack.elementAt(size - (level + 2)); // size - 1 == current
}
代码示例来源:origin: com.sun.xml.parsers/jaxp-ri
/**
* @param level nesting level, i.e., 0 returns the direct predecessor
* @return container of current entitity, i.e., predecessor during traversal
*/
public Object predecessor(int level) {
int size = stack.size();
if((size < 2) || (level < 0))
return null;
else
return stack.elementAt(size - (level + 2)); // size - 1 == current
}
代码示例来源:origin: org.eclipse.epsilon/epsilon-core
/**
* @return the executable template specification
* that is one below the top() of the stack.
*/
public ExecutableTemplateSpecification second() {
return specs.elementAt(specs.size()-2);
}
代码示例来源:origin: com.thaiopensource/jing
public String getNamespaceUri(String prefix) {
for (int i = prefixes.size(); i > 0; i -= 2) {
if (prefixes.elementAt(i - 2).equals(prefix))
return (String)prefixes.elementAt(i - 1);
}
return null;
}
代码示例来源:origin: org.daisy.libs/jing
public String getNamespaceUri(String prefix) {
for (int i = prefixes.size(); i > 0; i -= 2) {
if (prefixes.elementAt(i - 2).equals(prefix))
return (String)prefixes.elementAt(i - 1);
}
return null;
}
代码示例来源:origin: httpunit/httpunit
/**
* Returns the most recently pushed context which implements the specified class.
* Will return null if no matching context is found.
*/
public Object getClosestContext( Class matchingClass ) {
for (int i = _traversalContext.size()-1; i >= 0; i-- ) {
Object o = _traversalContext.elementAt( i );
if (matchingClass.isInstance(o)) return o;
}
return null;
}
代码示例来源:origin: org.jboss.jbossts.xts/jbossxts
public String toString ()
{
String toReturn = "Activity context:";
if ((_hierarchy == null) || (_hierarchy.size() == 0))
toReturn += " null";
else
{
for (int i = 0; i < _hierarchy.size(); i++)
toReturn += " "+_hierarchy.elementAt(i);
}
return toReturn;
}
代码示例来源:origin: org.jboss.jbossts/jbossxts
public String toString ()
{
String toReturn = "Activity context:";
if ((_hierarchy == null) || (_hierarchy.size() == 0))
toReturn += " null";
else
{
for (int i = 0; i < _hierarchy.size(); i++)
toReturn += " "+_hierarchy.elementAt(i);
}
return toReturn;
}
内容来源于网络,如有侵权,请联系作者删除!