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


Java MutableObject.getValue方法代码示例

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


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

示例1: blockingSynchronize

import org.apache.commons.lang3.mutable.MutableObject; //导入方法依赖的package包/类
/**
 * Request a remote synchronization. This call blocks until the operation is complete,
 * or the thread is interrupted.
 * 
 * @throws InterruptedException
 */
public SynchronizeResult blockingSynchronize() throws InterruptedException
{
	log.info("Queuing a blocking sync request");
	final MutableObject<SynchronizeResult> result = new MutableObject<SynchronizeResult>();
	final CountDownLatch cdl = new CountDownLatch(1);
	Consumer<SynchronizeResult> callback = new Consumer<SynchronizeResult>()
	{
		@Override
		public void accept(SynchronizeResult t)
		{
			result.setValue(t);
			cdl.countDown();
		}
	};

	synchronize(callback);
	cdl.await();
	return result.getValue();
}
 
开发者ID:Apelon-VA,项目名称:ISAAC,代码行数:26,代码来源:RemoteSynchronizer.java

示例2: onEvent

import org.apache.commons.lang3.mutable.MutableObject; //导入方法依赖的package包/类
@Override
public Object onEvent(T stateful, String event, Object... parms) throws TooBusyException {
	ArrayList<Object> parmList = new ArrayList<Object>(Arrays.asList(parms));
	
	// Create a Mutable Object and add it to the Parameter List - it will be used
	// to return the returned value from the Controller as the FSM returns the State
	//
	MutableObject<T> returnValue = new MutableObject<T>();
	ArrayList<Object> invokeParmlist = new ArrayList<Object>(parms.length + 1);
	invokeParmlist.add(returnValue);
	invokeParmlist.addAll(parmList);
	
	// Call the FSM
	// 
	fsm.onEvent(stateful, event, invokeParmlist.toArray());
	return returnValue.getValue();
}
 
开发者ID:statefulj,项目名称:statefulj,代码行数:18,代码来源:StatefulFSMImpl.java

示例3: getString

import org.apache.commons.lang3.mutable.MutableObject; //导入方法依赖的package包/类
private String getString(String name)
{
	int functionId = this.getNewId();
	this.sendString(String.format("GET %s %i\r\n\r\n", name, functionId));
	String pattern = String.format("RESP %i (.*)\r\n\r\n", functionId);
	MutableObject<String> result = new MutableObject<>(null);
	Consumer<String> callback = (input) ->
	{
		result.setValue(Pattern.compile(pattern).matcher(input).group(1));
	};
	this.awaitMessage("", callback);
	while(result.getValue() == null)
		this.getNextMessage();
	return result.getValue();
}
 
开发者ID:slaymaker1907,项目名称:triple-triad-ai,代码行数:16,代码来源:ClientController.java

示例4: hierarchy

import org.apache.commons.lang3.mutable.MutableObject; //导入方法依赖的package包/类
public static Iterable<Class<?>> hierarchy(final Class<?> type, final Interfaces interfacesBehavior) {
    final Iterable<Class<?>> classes = new Iterable<Class<?>>() {

        @Override
        public Iterator<Class<?>> iterator() {
            final MutableObject<Class<?>> next = new MutableObject<Class<?>>(type);
            return new Iterator<Class<?>>() {

                @Override
                public boolean hasNext() {
                    return next.getValue() != null;
                }

                @Override
                public Class<?> next() {
                    final Class<?> result = next.getValue();
                    next.setValue(result.getSuperclass());
                    return result;
                }

                @Override
                public void remove() {
                    throw new UnsupportedOperationException();
                }

            };
        }

    };
    if (interfacesBehavior != Interfaces.INCLUDE) {
        return classes;
    }
    return new Iterable<Class<?>>() {

        @Override
        public Iterator<Class<?>> iterator() {
            final Set<Class<?>> seenInterfaces = new HashSet<Class<?>>();
            final Iterator<Class<?>> wrapped = classes.iterator();

            return new Iterator<Class<?>>() {
                Iterator<Class<?>> interfaces = Collections.<Class<?>> emptySet().iterator();

                @Override
                public boolean hasNext() {
                    return interfaces.hasNext() || wrapped.hasNext();
                }

                @Override
                public Class<?> next() {
                    if (interfaces.hasNext()) {
                        final Class<?> nextInterface = interfaces.next();
                        seenInterfaces.add(nextInterface);
                        return nextInterface;
                    }
                    final Class<?> nextSuperclass = wrapped.next();
                    final Set<Class<?>> currentInterfaces = new LinkedHashSet<Class<?>>();
                    walkInterfaces(currentInterfaces, nextSuperclass);
                    interfaces = currentInterfaces.iterator();
                    return nextSuperclass;
                }

                private void walkInterfaces(final Set<Class<?>> addTo, final Class<?> c) {
                    for (final Class<?> iface : c.getInterfaces()) {
                        if (!seenInterfaces.contains(iface)) {
                            addTo.add(iface);
                        }
                        walkInterfaces(addTo, iface);
                    }
                }

                @Override
                public void remove() {
                    throw new UnsupportedOperationException();
                }

            };
        }
    };
}
 
开发者ID:EvoSuite,项目名称:evosuite,代码行数:80,代码来源:ClassHierarchyIncludingInterfaces.java


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