org.apache.commons.lang3.tuple.Pair#setValue ( )源码实例Demo

下面列出了org.apache.commons.lang3.tuple.Pair#setValue ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: tomee   文件: TomcatHessianRegistry.java
@Override
public void undeploy(final String hostname, final String app, final String name) {
    Container host = engine.findChild(hostname);
    if (host == null) {
        host = engine.findChild(engine.getDefaultHost());
        if (host == null) {
            throw new IllegalArgumentException("Invalid virtual host '" + engine.getDefaultHost() + "'.  Do you have a matchiing Host entry in the server.xml?");
        }
    }

    final String contextRoot = contextName(app);
    final Pair<Context, Integer> fakeContext = fakeContexts.get(contextRoot);

    if (fakeContext != null) {
        fakeContext.setValue(fakeContext.getValue() - 1);
        if (fakeContext.getValue() == 0) {
            fakeContexts.remove(contextRoot);
            host.removeChild(fakeContext.getKey());
        }
    }
}
 
源代码2 项目: PneumaticCraft   文件: RenderDroneAI.java
public void update(){
    entityItem.age += 4;
    ChunkPosition lastPos = pos;
    pos = drone.getTargetedBlock();
    if(pos != null) {
        if(lastPos == null) {
            oldPos = pos;
        } else if(!pos.equals(lastPos)) {
            progress = 0;
            oldPos = lastPos;
        }
    } else {
        oldPos = null;
    }
    progress = Math.min((float)Math.PI, progress + 0.1F);

    Iterator<Pair<RenderCoordWireframe, Integer>> iterator = blackListWireframes.iterator();
    while(iterator.hasNext()) {
        Pair<RenderCoordWireframe, Integer> wireframe = iterator.next();
        wireframe.getKey().ticksExisted++;
        wireframe.setValue(wireframe.getValue() - 1);
        if(wireframe.getValue() <= 0) {
            iterator.remove();
        }
    }
}
 
源代码3 项目: attic-apex-malhar   文件: ApexStreamImpl.java
@Override
@SuppressWarnings("unchecked")
public ApexStream<T> with(DAG.Locality locality)
{
  if (lastBrick.lastStream != null) {
    for (DagMeta.NodeMeta parent : lastBrick.nodeMeta.getParent()) {
      Pair<List<Operator.InputPort>, DAG.Locality> p = parent.getNodeStreams().get(lastBrick.lastStream.getLeft());
      if (p != null) {
        p.setValue(locality);
      }
    }
  }
  return this;
}
 
源代码4 项目: tomee   文件: TomcatHessianRegistry.java
@Override
public String deploy(final ClassLoader loader, final HessianServer listener,
                     final String hostname, final String app,
                     final String authMethod, final String transportGuarantee,
                     final String realmName, final String name) throws URISyntaxException {
    Container host = engine.findChild(hostname);
    if (host == null) {
        host = engine.findChild(engine.getDefaultHost());
        if (host == null) {
            throw new IllegalArgumentException("Invalid virtual host '" + engine.getDefaultHost() + "'.  Do you have a matchiing Host entry in the server.xml?");
        }
    }

    final String contextRoot = contextName(app);
    Context context = Context.class.cast(host.findChild(contextRoot));
    if (context == null) {
        Pair<Context, Integer> fakeContext = fakeContexts.get(contextRoot);
        if (fakeContext != null) {
            context = fakeContext.getLeft();
            fakeContext.setValue(fakeContext.getValue() + 1);
        } else {
            context = Context.class.cast(host.findChild(contextRoot));
            if (context == null) {
                fakeContext = fakeContexts.get(contextRoot);
                if (fakeContext == null) {
                    context = createNewContext(loader, authMethod, transportGuarantee, realmName, app);
                    fakeContext = new MutablePair<>(context, 1);
                    fakeContexts.put(contextRoot, fakeContext);
                } else {
                    context = fakeContext.getLeft();
                    fakeContext.setValue(fakeContext.getValue() + 1);
                }
            }
        }
    }

    final String servletMapping = generateServletPath(name);

    Wrapper wrapper = Wrapper.class.cast(context.findChild(servletMapping));
    if (wrapper != null) {
        throw new IllegalArgumentException("Servlet " + servletMapping + " in web application context " + context.getName() + " already exists");
    }

    wrapper = context.createWrapper();
    wrapper.setName(HESSIAN.replace("/", "") + "_" + name);
    wrapper.setServlet(new OpenEJBHessianServlet(listener));
    context.addChild(wrapper);
    context.addServletMappingDecoded(servletMapping, wrapper.getName());

    if ("BASIC".equals(authMethod) && StandardContext.class.isInstance(context)) {
        final StandardContext standardContext = StandardContext.class.cast(context);

        boolean found = false;
        for (final Valve v : standardContext.getPipeline().getValves()) {
            if (LimitedBasicValve.class.isInstance(v) || BasicAuthenticator.class.isInstance(v)) {
                found = true;
                break;
            }
        }
        if (!found) {
            standardContext.addValve(new LimitedBasicValve());
        }
    }

    final List<String> addresses = new ArrayList<>();
    for (final Connector connector : connectors) {
        for (final String mapping : wrapper.findMappings()) {
            final URI address = new URI(connector.getScheme(), null, host.getName(), connector.getPort(), contextRoot + mapping, null, null);
            addresses.add(address.toString());
        }
    }
    return HttpUtil.selectSingleAddress(addresses);
}