當前位置: 首頁>>代碼示例>>Java>>正文


Java Pair.getValue0方法代碼示例

本文整理匯總了Java中org.javatuples.Pair.getValue0方法的典型用法代碼示例。如果您正苦於以下問題:Java Pair.getValue0方法的具體用法?Java Pair.getValue0怎麽用?Java Pair.getValue0使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.javatuples.Pair的用法示例。


在下文中一共展示了Pair.getValue0方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: show

import org.javatuples.Pair; //導入方法依賴的package包/類
/**
 * Constructs and displays dialog based on the FXML at the specified URL
 * 
 * @param url
 *            the location of the FXML file, relative to the
 *            {@code sic.nmsu.javafx} package
 * @param stateInit
 *            a consumer used to configure the controller before FXML injection
 * @return
 */
public static <R, C extends FXDialogController<R>> R show(String url, Consumer<C> stateInit) {
	final Pair<Parent, C> result = FXController.get(url, stateInit);
	final Parent view = result.getValue0();
	final C ctrl = result.getValue1();

	final Dialog<R> dialog = new Dialog<>();
	dialog.titleProperty().bind(ctrl.title);

	final DialogPane dialogPane = dialog.getDialogPane();
	dialogPane.setContent(view);
	dialogPane.getButtonTypes().add(ButtonType.CLOSE);

	final Stage window = (Stage) dialogPane.getScene().getWindow();
	window.getIcons().add(new Image("images/recipe_icon.png"));

	final Node closeButton = dialogPane.lookupButton(ButtonType.CLOSE);
	closeButton.managedProperty().bind(closeButton.visibleProperty());
	closeButton.setVisible(false);

	ctrl.dialog = dialog;
	ctrl.dialog.showAndWait();

	return ctrl.result;
}
 
開發者ID:NMSU-SIC-Club,項目名稱:JavaFX_Tutorial,代碼行數:35,代碼來源:FXDialogController.java

示例2: tryDrainNextWaiting

import org.javatuples.Pair; //導入方法依賴的package包/類
/**
 * Completes the next waiting future if there is one.
 */
private synchronized void tryDrainNextWaiting(final boolean force) {
    // need to peek because the number of available items needs to be >= the expected size for that future. if not
    // it needs to keep waiting
    final Pair<CompletableFuture<List<Result>>, Integer> nextWaiting = waiting.peek();
    if (nextWaiting != null && (force || (resultLinkedBlockingQueue.size() >= nextWaiting.getValue1() || readComplete.isDone()))) {
        final int items = nextWaiting.getValue1();
        final CompletableFuture<List<Result>> future = nextWaiting.getValue0();
        final List<Result> results = new ArrayList<>(items);
        resultLinkedBlockingQueue.drainTo(results, items);

        // it's important to check for error here because a future may have already been queued in "waiting" prior
        // to the first response back from the server. if that happens, any "waiting" futures should be completed
        // exceptionally otherwise it will look like success.
        if (null == error.get())
            future.complete(results);
        else
            future.completeExceptionally(error.get());

        waiting.remove(nextWaiting);
    }
}
 
開發者ID:PKUSilvester,項目名稱:LiteGraph,代碼行數:25,代碼來源:ResultQueue.java

示例3: chooseSerializer

import org.javatuples.Pair; //導入方法依賴的package包/類
private Pair<String,MessageTextSerializer> chooseSerializer(final String acceptString) {
    final List<Pair<String,Double>> ordered = Stream.of(acceptString.split(",")).map(mediaType -> {
        // parse out each mediaType with its params - keeping it simple and just looking for "quality".  if
        // that value isn't there, default it to 1.0.  not really validating here so users better get their
        // accept headers straight
        final Matcher matcher = pattern.matcher(mediaType);
        return (matcher.matches()) ? Pair.with(matcher.group(1), Double.parseDouble(matcher.group(2))) : Pair.with(mediaType, 1.0);
    }).sorted((o1, o2) -> o2.getValue0().compareTo(o1.getValue0())).collect(Collectors.toList());

    for (Pair<String,Double> p : ordered) {
        // this isn't perfect as it doesn't really account for wildcards.  that level of complexity doesn't seem
        // super useful for gremlin server really.
        final String accept = p.getValue0().equals("*/*") ? "application/json" : p.getValue0();
        if (serializers.containsKey(accept))
            return Pair.with(accept, (MessageTextSerializer) serializers.get(accept));
    }

    return null;
}
 
開發者ID:PKUSilvester,項目名稱:LiteGraph,代碼行數:20,代碼來源:HttpGremlinEndpointHandler.java

示例4: channelRead0

import org.javatuples.Pair; //導入方法依賴的package包/類
@Override
protected void channelRead0(final ChannelHandlerContext ctx, final Pair<RequestMessage, ThrowingConsumer<Context>> objects) throws Exception {
    final RequestMessage msg = objects.getValue0();
    final ThrowingConsumer<Context> op = objects.getValue1();
    final Context gremlinServerContext = new Context(msg, ctx,
            settings, graphManager, gremlinExecutor, scheduledExecutorService);

    try {
        op.accept(gremlinServerContext);
    } catch (OpProcessorException ope) {
        // Ops may choose to throw OpProcessorException or write the error ResponseMessage down the line
        // themselves
        logger.warn(ope.getMessage(), ope);
        ctx.writeAndFlush(ope.getResponseMessage());
    } catch (Exception ex) {
        // It is possible that an unplanned exception might raise out of an OpProcessor execution. Build a general
        // error to send back to the client
        logger.warn(ex.getMessage(), ex);
        ctx.writeAndFlush(ResponseMessage.build(msg)
                .code(ResponseStatusCode.SERVER_ERROR)
                .statusMessage(ex.getMessage()).create());
    } finally {
        ReferenceCountUtil.release(objects);
    }
}
 
開發者ID:PKUSilvester,項目名稱:LiteGraph,代碼行數:26,代碼來源:OpExecutorHandler.java

示例5: getNumberOfAddedDatesOfParticularMonthAndYearFromDB

import org.javatuples.Pair; //導入方法依賴的package包/類
/**
 * Gets the number of added dates of particular month and year from db.
 *
 * @param date the date
 * @return the number of added dates of particular month and year from db
 */
public int getNumberOfAddedDatesOfParticularMonthAndYearFromDB(Date date) {
	Pair<Calendar, Calendar> from_to = MyDateUtils.getMaxAndMinOfMonth(date);
	Calendar from = from_to.getValue0();
	Calendar to = from_to.getValue1();	
	
	HibernateSupport.beginTransaction();
	
	long values_size = (long)HibernateSupport.getCurrentSession().createCriteria(MarketValue.class)
			.add(Restrictions.eq("company", this))
			.add(Restrictions.between("date", from.getTime(), to.getTime()))
			.setProjection(Projections.rowCount())
			.uniqueResult();
	
	HibernateSupport.commitTransaction();
	
	return (int) values_size;
}
 
開發者ID:mattmagic149,項目名稱:AnSoMia,代碼行數:24,代碼來源:Company.java

示例6: channelRead0

import org.javatuples.Pair; //導入方法依賴的package包/類
@Override
protected void channelRead0(final ChannelHandlerContext ctx, final Pair<RequestMessage, ThrowingConsumer<Context>> objects) throws Exception {
    final RequestMessage msg = objects.getValue0();
    final ThrowingConsumer<Context> op = objects.getValue1();
    final Context gremlinServerContext = new Context(msg, ctx,
            settings, graphManager, gremlinExecutor, scheduledExecutorService);

    try {
        op.accept(gremlinServerContext);
    } catch (OpProcessorException ope) {
        // Ops may choose to throw OpProcessorException or write the error ResponseMessage down the line
        // themselves
        logger.warn(ope.getMessage(), ope);
        ctx.writeAndFlush(ope.getResponseMessage());
    } catch (Exception ex) {
        // It is possible that an unplanned exception might raise out of an OpProcessor execution. Build a general
        // error to send back to the client
        logger.warn(ex.getMessage(), ex);
        ctx.writeAndFlush(ResponseMessage.build(msg)
                .code(ResponseStatusCode.SERVER_ERROR)
                .statusAttributeException(ex)
                .statusMessage(ex.getMessage()).create());
    } finally {
        ReferenceCountUtil.release(objects);
    }
}
 
開發者ID:apache,項目名稱:tinkerpop,代碼行數:27,代碼來源:OpExecutorHandler.java

示例7: fieldsByName

import org.javatuples.Pair; //導入方法依賴的package包/類
private static <E extends Element> Map<String, Field> fieldsByName(Pair<Class, Predicate<Field>>
    predicatedType) {
  Class<E> elementType = predicatedType.getValue0();
  Predicate<Field> predicate = predicatedType.getValue1();
  List<Field> allFields = Arrays.asList(getAllFields(elementType));
  allFields.forEach(field -> {
    field.setAccessible(true);
  });
  Map<String, Field> fieldMap = allFields.stream()
      .filter(field -> predicate.test(field) && !isHiddenField(field))
      .collect(Collectors.toMap(Field::getName, Function.identity()));
  return fieldMap;
}
 
開發者ID:karthicks,項目名稱:gremlin-ogm,代碼行數:14,代碼來源:Fields.java

示例8: showTasks

import org.javatuples.Pair; //導入方法依賴的package包/類
public void showTasks(Pair<DiffUtil.DiffResult, List<Task>> pairOfDiffResultAndTasks, TasksFilterType filterType) {
    if(tasksAdapter != null) {
        DiffUtil.DiffResult diffResult = pairOfDiffResultAndTasks.getValue0();
        List<Task> tasks = pairOfDiffResultAndTasks.getValue1();
        tasksAdapter.setData(tasks);
        diffResult.dispatchUpdatesTo(tasksAdapter);
        if(tasks.isEmpty()) {
            filterType.showEmptyViews(this);
        } else {
            hideEmptyViews();
        }
    }
}
 
開發者ID:Zhuinden,項目名稱:navigator,代碼行數:14,代碼來源:TasksView.java

示例9: DetachedEdge

import org.javatuples.Pair; //導入方法依賴的package包/類
public DetachedEdge(final Object id, final String label,
                    final Map<String, Object> properties,
                    final Pair<Object, String> outV,
                    final Pair<Object, String> inV) {
    super(id, label);
    this.outVertex = new DetachedVertex(outV.getValue0(), outV.getValue1(), Collections.emptyMap());
    this.inVertex = new DetachedVertex(inV.getValue0(), inV.getValue1(), Collections.emptyMap());
    if (!properties.isEmpty()) {
        this.properties = new HashMap<>();
        properties.entrySet().stream().forEach(entry -> this.properties.put(entry.getKey(), Collections.singletonList(new DetachedProperty<>(entry.getKey(), entry.getValue(), this))));
    }
}
 
開發者ID:PKUSilvester,項目名稱:LiteGraph,代碼行數:13,代碼來源:DetachedEdge.java

示例10: encodeKey

import org.javatuples.Pair; //導入方法依賴的package包/類
/**
 * Encodes a string to be safe for use as a MongoDB field name.
 * @param key the unencoded key.
 * @return the encoded key.
 */
public static String encodeKey(final String key) {
    String encodedKey = key;
    for (final Pair<String, String> pair : ESCAPE_CHARACTERS) {
        final String unescapedCharacter = pair.getValue0();
        final String escapedCharacter = pair.getValue1();
        encodedKey = encodedKey.replace(unescapedCharacter, escapedCharacter);
    }

    return encodedKey;
}
 
開發者ID:apache,項目名稱:incubator-rya,代碼行數:16,代碼來源:MongoDbSafeKey.java

示例11: decodeKey

import org.javatuples.Pair; //導入方法依賴的package包/類
/**
 * Decodes a MongoDB safe field name to an unencoded string.
 * @param key the encoded key.
 * @return the unencoded key.
 */
public static String decodeKey(final String key) {
    String decodedKey = key;
    for (final Pair<String, String> pair : UNESCAPE_CHARACTERS) {
        final String unescapedCharacter = pair.getValue0();
        final String escapedCharacter = pair.getValue1();
        decodedKey = decodedKey.replace(escapedCharacter, unescapedCharacter);
    }

    return decodedKey;
}
 
開發者ID:apache,項目名稱:incubator-rya,代碼行數:16,代碼來源:MongoDbSafeKey.java

示例12: fetchEnd

import org.javatuples.Pair; //導入方法依賴的package包/類
@Override
public void fetchEnd(ExecuteContext ctx) {
    super.fetchEnd(ctx);

    Pair<Long, Integer> stopWatchIntegerPair = timing.get(ctx.query().toString());
    long duration = System.nanoTime() - stopWatchIntegerPair.getValue0();
    timing.put(ctx.query().toString(), new Pair<>(duration, ctx.result().size()));
}
 
開發者ID:unipop-graph,項目名稱:unipop,代碼行數:9,代碼來源:TimingExecuterListener.java

示例13: getRegistrationInformation

import org.javatuples.Pair; //導入方法依賴的package包/類
private <T> Pair<Converter<String, T>, Supplier<T>> getRegistrationInformation(PropertyId<T> propertyId) {
	PropertyIdTemplate<T, ?> template = propertyId.getTemplate();
	@SuppressWarnings("unchecked")
	Pair<Converter<String, T>, Supplier<T>> information = (Pair<Converter<String, T>, Supplier<T>>)
			propertyInformationMap.get(template != null ? template : propertyId);
	
	if (information == null || information.getValue0() == null) {
		throw new PropertyServiceIncompleteRegistrationException(
				String.format("The following property was not properly registered: %1s", propertyId)
		);
	}
	
	return information;
}
 
開發者ID:openwide-java,項目名稱:owsi-core-parent,代碼行數:15,代碼來源:PropertyServiceImpl.java

示例14: onDetach

import org.javatuples.Pair; //導入方法依賴的package包/類
@Override
protected void onDetach() {
	super.onDetach();
	for (Pair<IModel<?>, Condition> conditionnalModel : conditionnalModels) {
		if (conditionnalModel != null && conditionnalModel.getValue0() != null) {
			conditionnalModel.getValue0().detach();
			conditionnalModel.getValue1().detach();
		}
	}
}
 
開發者ID:openwide-java,項目名稱:owsi-core-parent,代碼行數:11,代碼來源:JoinerModel.java

示例15: runHex

import org.javatuples.Pair; //導入方法依賴的package包/類
/**
 * Runs a macro, treating the sequence as a hex sequence.
 * @param macro
 */
private void runHex(Macro macro) {

    Pair<List<Byte>, EncodingUtils.ReturnId> result = EncodingUtils.hexStringToByteArray(macro.sequence.get());
    List<Byte> bytes = result.getValue0();
    EncodingUtils.ReturnId returnId = result.getValue1();

    switch(returnId) {
        case OK:
            break;
        case STRING_DID_NOT_HAVE_EVEN_NUMBER_OF_CHARS:
            model.status.addErr("Macro hex string \"" + macro.sequence.get() + "\" does not have an even number of characters.");
            return;
        case INVALID_CHAR:
            model.status.addErr("Macro hex string \"" + macro.sequence.get() + "\" contains invalid chars (must only contain numbers or the letters A-F).");
            return;
        default:
            throw new RuntimeException("ReturnCode was not recognised.");
    }

    byte[] byteArray = new byte[bytes.size()];
    for(int i = 0; i < bytes.size(); i++) {
        byteArray[i] = bytes.get(i);
    }

    // Send the un-escaped string to the COM port
    terminal.txRx.addTxCharsToSend(byteArray);

    if(macro.sendSequenceImmediately.get())
        terminal.txRx.sendBufferedTxDataToSerialPort();

}
 
開發者ID:mbedded-ninja,項目名稱:NinjaTerm,代碼行數:36,代碼來源:MacroManager.java


注:本文中的org.javatuples.Pair.getValue0方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。