当前位置: 首页>>代码示例>>Java>>正文


Java ListIterator.hasPrevious方法代码示例

本文整理汇总了Java中java.util.ListIterator.hasPrevious方法的典型用法代码示例。如果您正苦于以下问题:Java ListIterator.hasPrevious方法的具体用法?Java ListIterator.hasPrevious怎么用?Java ListIterator.hasPrevious使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.util.ListIterator的用法示例。


在下文中一共展示了ListIterator.hasPrevious方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getPrevious

import java.util.ListIterator; //导入方法依赖的package包/类
private static CanvasObject getPrevious(CanvasObject query, List<CanvasObject> objs, CanvasModel model,
		Collection<? extends CanvasObject> ignore) {
	int index = getIndex(query, objs);
	if (index <= 0) {
		return null;
	} else {
		Set<CanvasObject> set = toSet(model.getObjectsOverlapping(query));
		ListIterator<CanvasObject> it = objs.listIterator(index);
		while (it.hasPrevious()) {
			CanvasObject o = it.previous();
			if (set.contains(o) && !ignore.contains(o))
				return o;
		}
		return null;
	}
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:17,代码来源:ZOrder.java

示例2: getConvertedTree

import java.util.ListIterator; //导入方法依赖的package包/类
public ElasticsearchPrel getConvertedTree() {
  ElasticsearchPrel subTree = (ElasticsearchPrel) this.child;


  if (filterExprs != null) {
    subTree = new ElasticsearchFilter(subTree.getCluster(), subTree.getTraitSet(), subTree, filterExprs, subTree.getPluginId());
  }

  if (projectExprs != null) {
    subTree = new ElasticsearchProject(subTree.getCluster(), subTree.getTraitSet(), subTree, projectExprs, projectDataType, subTree.getPluginId());
  }

  if (parents != null && !parents.isEmpty()) {
    ListIterator<ElasticsearchPrel> iterator = parents.listIterator(parents.size());
    while (iterator.hasPrevious()) {
      final ElasticsearchPrel parent = iterator.previous();
      subTree = (ElasticsearchPrel) parent.copy(parent.getTraitSet(), Collections.singletonList((RelNode) subTree));
    }
  }

  return subTree;
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:23,代码来源:ElasticRuleRelVisitor.java

示例3: descendingIterator

import java.util.ListIterator; //导入方法依赖的package包/类
@Override
public final Iterator<Object> descendingIterator() {
    final ListIterator<Object> it = listIterator(size());
    return new Iterator<Object>() {
        @Override
        public boolean hasNext() {
            return it.hasPrevious();
        }

        @Override
        public Object next() {
            return it.previous();
        }

        @Override
        public void remove() {
            it.remove();
        }
    };
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:21,代码来源:ListAdapter.java

示例4: testHasPrevious

import java.util.ListIterator; //导入方法依赖的package包/类
/**
 * Test of hasPrevious method, of class TreeListIterator.
 */
@Test
public void testHasPrevious() {
    ListIterator<TreeNode> treeListIterator1 = new TreeListIterator(tree1);
    boolean expResult = true;
    for(int i = 0; i < 14; i++) {
        treeListIterator1.next();
    }
    boolean result = treeListIterator1.hasPrevious();
    assertEquals("hasPrevious method, of class TreeListIterator's expected result is wrong.",
            expResult, result);

    ListIterator<TreeNode> treeListIterator2 = new TreeListIterator(tree2);
    expResult = false;
    result = treeListIterator2.hasPrevious();
    assertEquals("hasPrevious method, of class TreeListIterator's expected result is wrong.",
            expResult, result);
}
 
开发者ID:miyagilabs,项目名称:Blindfold,代码行数:21,代码来源:TreeListIteratorTest.java

示例5: getIterator

import java.util.ListIterator; //导入方法依赖的package包/类
/**
 * Returns an iterator for the specified glyphs, sorted either ascending or descending.
 * 
 * @param glyphs The glyphs to return if present
 * @return An iterator of the sorted list of glyphs
 */
private Iterator getIterator(List glyphs) {
	if (orderAscending) return glyphs.iterator();
	final ListIterator iter = glyphs.listIterator(glyphs.size());
	return new Iterator() {
		public boolean hasNext () {
			return iter.hasPrevious();
		}

		public Object next () {
			return iter.previous();
		}

		public void remove () {
			iter.remove();
		}
	};
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:24,代码来源:GlyphPage.java

示例6: checkType

import java.util.ListIterator; //导入方法依赖的package包/类
public TCType checkType(POExpression exp, TCType expected)
{
	ListIterator<POContext> p = this.listIterator(size());

	while (p.hasPrevious())
	{
		POContext c = p.previous();

		if (c.isScopeBoundary())
		{
			break;		// Change of name scope for expressions.
		}

		TCType t = c.checkType(exp);

		if (t != null)
		{
			return t;
		}
	}

	return expected;
}
 
开发者ID:nickbattle,项目名称:FJ-VDMJ,代码行数:24,代码来源:POContextStack.java

示例7: searchBackwards

import java.util.ListIterator; //导入方法依赖的package包/类
public int searchBackwards(String searchTerm, int startIndex, boolean startsWith) {
    ListIterator<History.Entry> it = history.entries(startIndex);
    while (it.hasPrevious()) {
        History.Entry e = it.previous();
        if (startsWith) {
            if (e.value().toString().startsWith(searchTerm)) {
                return e.index();
            }
        } else {
            if (e.value().toString().contains(searchTerm)) {
                return e.index();
            }
        }
    }
    return -1;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:17,代码来源:ConsoleReader.java

示例8: addSeenViews

import java.util.ListIterator; //导入方法依赖的package包/类
private static void addSeenViews(List<RouterTransaction> stack, ViewGroup container) {
  ListIterator<RouterTransaction> iterable = stack.listIterator(stack.size());
  int index = container.getChildCount();
  boolean isTop = true;
  while(iterable.hasPrevious()) {
    Controller controller = iterable.previous().controller();
    // Ensure the view is shown
    View view = controller.getView();
    if (view == null) {
      view = controller.inflate(container);
    }
    if (view.getParent() == null) {
      container.addView(view, index);
    }
    // Update index
    index = container.indexOfChild(view);
    // Check controller opacity
    int opacity = getControllerOpacity(controller);
    if (opacity == ControllerOpacity.OPAQUE ||
        (opacity == ControllerOpacity.TRANSLUCENT && !isTop)) {
      // The controllers below can't be seen
      break;
    }
    isTop = false;
  }
}
 
开发者ID:seven332,项目名称:conductor-attacher,代码行数:27,代码来源:ControllerAttacher.java

示例9: loadLastConfigs

import java.util.ListIterator; //导入方法依赖的package包/类
/**
 * @return last non-empty result from input persisters
 */
@Override
public List<ConfigSnapshotHolder> loadLastConfigs()  {
    // iterate in reverse order
    ListIterator<PersisterWithConfiguration> li = persisterWithConfigurations.listIterator(persisterWithConfigurations.size());
    while(li.hasPrevious()) {
        PersisterWithConfiguration persisterWithConfiguration = li.previous();
        List<ConfigSnapshotHolder> configs = null;
        try {
            configs = persisterWithConfiguration.storage.loadLastConfigs();
        } catch (final IOException e) {
            throw new RuntimeException("Error while calling loadLastConfig on " +  persisterWithConfiguration, e);
        }
        if (!configs.isEmpty()) {
            LOG.debug("Found non empty configs using {}:{}", persisterWithConfiguration, configs);
            return configs;
        }
    }
    // no storage had an answer
    LOG.debug("No non-empty list of configuration snapshots found");
    return Collections.emptyList();
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:25,代码来源:PersisterAggregator.java

示例10: destroy

import java.util.ListIterator; //导入方法依赖的package包/类
@Override
   @SuppressWarnings( {"unchecked"})
public void destroy() {
	if ( !active ) {
		return;
	}

	active = false;
	try {
		synchronized (serviceBindingList) {
			ListIterator<ServiceBinding> serviceBindingsIterator = serviceBindingList.listIterator(
					serviceBindingList.size()
			);
			while ( serviceBindingsIterator.hasPrevious() ) {
				final ServiceBinding serviceBinding = serviceBindingsIterator.previous();
				serviceBinding.getLifecycleOwner().stopService( serviceBinding );
			}
			serviceBindingList.clear();
		}
		serviceBindingMap.clear();
	}
	finally {
		parent.deRegisterChild( this );
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:26,代码来源:AbstractServiceRegistryImpl.java

示例11: _renderIconRowRtl

import java.util.ListIterator; //导入方法依赖的package包/类
private void _renderIconRowRtl(
  FacesContext     context,
  RenderingContext rc,
  UIXProcess       process,
  Train            train
  ) throws IOException
{
  ParentTrain parentTrain = train.getParentTrain();

  // Render parent end
  if(parentTrain != null && parentTrain.hasParentEnd())
  {
    _renderParentEndRtl(context, rc, process, train);
  }

  List<Station>         stations = train.getStations();
  ListIterator<Station> iterator = stations.listIterator(stations.size());
  while(iterator.hasPrevious())
  {
    _renderStationIconRtl(context, rc, process, iterator.previous());
  }

  // Render parent start
  if(parentTrain != null && parentTrain.hasParentStart())
  {
    _renderParentStartRtl(context, rc, process, train);
  }

}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:30,代码来源:TrainRenderer.java

示例12: resetOffset

import java.util.ListIterator; //导入方法依赖的package包/类
public boolean resetOffset(long offset) {
    MappedFile mappedFileLast = getLastMappedFile();

    if (mappedFileLast != null) {
        long lastOffset = mappedFileLast.getFileFromOffset() +
            mappedFileLast.getWrotePosition();
        long diff = lastOffset - offset;

        final int maxDiff = this.mappedFileSize * 2;
        if (diff > maxDiff)
            return false;
    }

    ListIterator<MappedFile> iterator = this.mappedFiles.listIterator();

    while (iterator.hasPrevious()) {
        mappedFileLast = iterator.previous();
        if (offset >= mappedFileLast.getFileFromOffset()) {
            int where = (int) (offset % mappedFileLast.getFileSize());
            mappedFileLast.setFlushedPosition(where);
            mappedFileLast.setWrotePosition(where);
            mappedFileLast.setCommittedPosition(where);
            break;
        } else {
            iterator.remove();
        }
    }
    return true;
}
 
开发者ID:lyy4j,项目名称:rmq4note,代码行数:30,代码来源:MappedFileQueue.java

示例13: pickCommentNoDoubleStar

import java.util.ListIterator; //导入方法依赖的package包/类
/**
 * Select comment closest to lookup element. Assume comments to be ordered list. Ignores comments starting with
 * doublestar.
 *
 * @param comments
 *            list of commnets on luukup elements
 * @throws InstantiationException
 *             if comment is malformed
 */
protected CommentCandidate pickCommentNoDoubleStar(List<INode> comments) throws InstantiationException {
	ListIterator<INode> iter = comments.listIterator(comments.size());
	String candidateTextString = null;
	while (iter.hasPrevious()) {
		candidateTextString = iter.previous().getText();
		if (!candidateTextString.startsWith("/**")) {
			return new CommentCandidate(candidateTextString);
		}
	}
	return null;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:21,代码来源:DocCommentLookup.java

示例14: dequeueKeyEvents

import java.util.ListIterator; //导入方法依赖的package包/类
/**
 * Releases for normal dispatching to the current focus owner all
 * KeyEvents which were enqueued because of a call to
 * {@code enqueueKeyEvents} with the same timestamp and Component.
 * If the given timestamp is less than zero, the outstanding enqueue
 * request for the given Component with the <b>oldest</b> timestamp (if
 * any) should be cancelled.
 *
 * @param after the timestamp specified in the call to
 *        {@code enqueueKeyEvents}, or any value &lt; 0
 * @param untilFocused the Component specified in the call to
 *        {@code enqueueKeyEvents}
 * @see #enqueueKeyEvents
 * @see #discardKeyEvents
 */
protected synchronized void dequeueKeyEvents(long after,
                                             Component untilFocused) {
    if (untilFocused == null) {
        return;
    }

    if (focusLog.isLoggable(PlatformLogger.Level.FINER)) {
        focusLog.finer("Dequeue at {0} for {1}",
                   after, untilFocused);
    }

    TypeAheadMarker marker;
    ListIterator<TypeAheadMarker> iter = typeAheadMarkers.listIterator
        ((after >= 0) ? typeAheadMarkers.size() : 0);

    if (after < 0) {
        while (iter.hasNext()) {
            marker = iter.next();
            if (marker.untilFocused == untilFocused)
            {
                iter.remove();
                return;
            }
        }
    } else {
        while (iter.hasPrevious()) {
            marker = iter.previous();
            if (marker.untilFocused == untilFocused &&
                marker.after == after)
            {
                iter.remove();
                return;
            }
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:52,代码来源:DefaultKeyboardFocusManager.java

示例15: freeCachedConnections

import java.util.ListIterator; //导入方法依赖的package包/类
private void freeCachedConnections() {
    /*
     * Remove each connection whose time out has expired.
     */
    synchronized (freeList) {
        int size = freeList.size();

        if (size > 0) {
            long time = System.currentTimeMillis();
            ListIterator<TCPConnection> iter = freeList.listIterator(size);

            while (iter.hasPrevious()) {
                TCPConnection conn = iter.previous();
                if (conn.expired(time)) {
                    TCPTransport.tcpLog.log(Log.VERBOSE,
                        "connection timeout expired");

                    try {
                        conn.close();
                    } catch (java.io.IOException e) {
                        // eat exception
                    }
                    iter.remove();
                }
            }
        }

        if (freeList.isEmpty()) {
            reaper.cancel(false);
            reaper = null;
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:34,代码来源:TCPChannel.java


注:本文中的java.util.ListIterator.hasPrevious方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。