Search in sources :

Example 6 with Pair

use of org.apache.commons.math3.util.Pair in project cassandra by apache.

the class SampledOpDistributionFactory method get.

public OpDistribution get(boolean isWarmup, MeasurementSink sink) {
    PartitionGenerator generator = newGenerator();
    List<Pair<Operation, Double>> operations = new ArrayList<>();
    for (Map.Entry<T, Double> ratio : ratios.entrySet()) {
        List<? extends Operation> ops = get(new Timer(ratio.getKey().toString(), sink), generator, ratio.getKey(), isWarmup);
        for (Operation op : ops) operations.add(new Pair<>(op, ratio.getValue() / ops.size()));
    }
    return new SampledOpDistribution(new EnumeratedDistribution<>(operations), clustering.get());
}
Also used : PartitionGenerator(org.apache.cassandra.stress.generate.PartitionGenerator) ArrayList(java.util.ArrayList) Operation(org.apache.cassandra.stress.Operation) Timer(org.apache.cassandra.stress.report.Timer) Map(java.util.Map) Pair(org.apache.commons.math3.util.Pair)

Example 7 with Pair

use of org.apache.commons.math3.util.Pair in project Material-Animations by lgvalle.

the class BaseDetailActivity method transitionTo.

@SuppressWarnings("unchecked")
void transitionTo(Intent i) {
    final Pair<View, String>[] pairs = TransitionHelper.createSafeTransitionParticipants(this, true);
    ActivityOptionsCompat transitionActivityOptions = ActivityOptionsCompat.makeSceneTransitionAnimation(this, pairs);
    startActivity(i, transitionActivityOptions.toBundle());
}
Also used : ActivityOptionsCompat(android.support.v4.app.ActivityOptionsCompat) Pair(android.support.v4.util.Pair)

Example 8 with Pair

use of org.apache.commons.math3.util.Pair in project Material-Animations by lgvalle.

the class TransitionHelper method createSafeTransitionParticipants.

/**
     * Create the transition participants required during a activity transition while
     * avoiding glitches with the system UI.
     *
     * @param activity The activity used as start for the transition.
     * @param includeStatusBar If false, the status bar will not be added as the transition
     *        participant.
     * @return All transition participants.
     */
public static Pair<View, String>[] createSafeTransitionParticipants(@NonNull Activity activity, boolean includeStatusBar, @Nullable Pair... otherParticipants) {
    // Avoid system UI glitches as described here:
    // https://plus.google.com/+AlexLockwood/posts/RPtwZ5nNebb
    View decor = activity.getWindow().getDecorView();
    View statusBar = null;
    if (includeStatusBar) {
        statusBar = decor.findViewById(android.R.id.statusBarBackground);
    }
    View navBar = decor.findViewById(android.R.id.navigationBarBackground);
    // Create pair of transition participants.
    List<Pair> participants = new ArrayList<>(3);
    addNonNullViewToTransitionParticipants(statusBar, participants);
    addNonNullViewToTransitionParticipants(navBar, participants);
    // only add transition participants if there's at least one none-null element
    if (otherParticipants != null && !(otherParticipants.length == 1 && otherParticipants[0] == null)) {
        participants.addAll(Arrays.asList(otherParticipants));
    }
    return participants.toArray(new Pair[participants.size()]);
}
Also used : ArrayList(java.util.ArrayList) View(android.view.View) Pair(android.support.v4.util.Pair)

Example 9 with Pair

use of org.apache.commons.math3.util.Pair in project android-topeka by googlesamples.

the class CategorySelectionFragment method startQuizActivityWithTransition.

private void startQuizActivityWithTransition(Activity activity, View toolbar, Category category) {
    final Pair[] pairs = TransitionHelper.createSafeTransitionParticipants(activity, false, new Pair<>(toolbar, activity.getString(R.string.transition_toolbar)));
    @SuppressWarnings("unchecked") ActivityOptionsCompat sceneTransitionAnimation = ActivityOptionsCompat.makeSceneTransitionAnimation(activity, pairs);
    // Start the activity with the participants, animating from one to the other.
    final Bundle transitionBundle = sceneTransitionAnimation.toBundle();
    Intent startIntent = QuizActivity.getStartIntent(activity, category);
    ActivityCompat.startActivityForResult(activity, startIntent, REQUEST_CATEGORY, transitionBundle);
}
Also used : Bundle(android.os.Bundle) Intent(android.content.Intent) ActivityOptionsCompat(android.support.v4.app.ActivityOptionsCompat) Pair(android.support.v4.util.Pair)

Example 10 with Pair

use of org.apache.commons.math3.util.Pair in project android-page-transition by xmuSistone.

the class CommonFragment method gotoDetail.

@Override
public void gotoDetail() {
    Activity activity = (Activity) getContext();
    ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(activity, new Pair(imageView, DetailActivity.IMAGE_TRANSITION_NAME), new Pair(address1, DetailActivity.ADDRESS1_TRANSITION_NAME), new Pair(address2, DetailActivity.ADDRESS2_TRANSITION_NAME), new Pair(address3, DetailActivity.ADDRESS3_TRANSITION_NAME), new Pair(address4, DetailActivity.ADDRESS4_TRANSITION_NAME), new Pair(address5, DetailActivity.ADDRESS5_TRANSITION_NAME), new Pair(ratingBar, DetailActivity.RATINGBAR_TRANSITION_NAME), new Pair(head1, DetailActivity.HEAD1_TRANSITION_NAME), new Pair(head2, DetailActivity.HEAD2_TRANSITION_NAME), new Pair(head3, DetailActivity.HEAD3_TRANSITION_NAME), new Pair(head4, DetailActivity.HEAD4_TRANSITION_NAME));
    Intent intent = new Intent(activity, DetailActivity.class);
    intent.putExtra(DetailActivity.EXTRA_IMAGE_URL, imageUrl);
    ActivityCompat.startActivity(activity, intent, options.toBundle());
}
Also used : Activity(android.app.Activity) Intent(android.content.Intent) ActivityOptionsCompat(android.support.v4.app.ActivityOptionsCompat) Pair(android.support.v4.util.Pair)

Aggregations

Pair (android.support.v4.util.Pair)32 ArrayList (java.util.ArrayList)17 IntStream (java.util.stream.IntStream)16 View (android.view.View)14 Collectors (java.util.stream.Collectors)14 ActivityOptionsCompat (android.support.v4.app.ActivityOptionsCompat)12 Logger (org.apache.logging.log4j.Logger)12 ParamUtils (org.broadinstitute.hellbender.utils.param.ParamUtils)12 Intent (android.content.Intent)10 IOException (java.io.IOException)10 java.util (java.util)10 ImmutablePair (org.apache.commons.lang3.tuple.ImmutablePair)10 Pair (org.apache.commons.lang3.tuple.Pair)10 RealMatrix (org.apache.commons.math3.linear.RealMatrix)10 Pair (org.apache.commons.math3.util.Pair)10 File (java.io.File)9 Array2DRowRealMatrix (org.apache.commons.math3.linear.Array2DRowRealMatrix)8 UserException (org.broadinstitute.hellbender.exceptions.UserException)8 org.broadinstitute.hellbender.tools.exome (org.broadinstitute.hellbender.tools.exome)8 VisibleForTesting (com.google.common.annotations.VisibleForTesting)7