1e29d52aa72c96c3147fa91d83aeb8dafc6d1f578Mathew Inwood/*
2e29d52aa72c96c3147fa91d83aeb8dafc6d1f578Mathew Inwood * Copyright (C) 2010 The Android Open Source Project
3e29d52aa72c96c3147fa91d83aeb8dafc6d1f578Mathew Inwood *
4e29d52aa72c96c3147fa91d83aeb8dafc6d1f578Mathew Inwood * Licensed under the Apache License, Version 2.0 (the "License");
5e29d52aa72c96c3147fa91d83aeb8dafc6d1f578Mathew Inwood * you may not use this file except in compliance with the License.
6e29d52aa72c96c3147fa91d83aeb8dafc6d1f578Mathew Inwood * You may obtain a copy of the License at
7e29d52aa72c96c3147fa91d83aeb8dafc6d1f578Mathew Inwood *
8e29d52aa72c96c3147fa91d83aeb8dafc6d1f578Mathew Inwood *      http://www.apache.org/licenses/LICENSE-2.0
9e29d52aa72c96c3147fa91d83aeb8dafc6d1f578Mathew Inwood *
10e29d52aa72c96c3147fa91d83aeb8dafc6d1f578Mathew Inwood * Unless required by applicable law or agreed to in writing, software
11e29d52aa72c96c3147fa91d83aeb8dafc6d1f578Mathew Inwood * distributed under the License is distributed on an "AS IS" BASIS,
12e29d52aa72c96c3147fa91d83aeb8dafc6d1f578Mathew Inwood * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13e29d52aa72c96c3147fa91d83aeb8dafc6d1f578Mathew Inwood * See the License for the specific language governing permissions and
14e29d52aa72c96c3147fa91d83aeb8dafc6d1f578Mathew Inwood * limitations under the License.
15e29d52aa72c96c3147fa91d83aeb8dafc6d1f578Mathew Inwood */
16e29d52aa72c96c3147fa91d83aeb8dafc6d1f578Mathew Inwoodpackage com.android.quicksearchbox.util;
17e29d52aa72c96c3147fa91d83aeb8dafc6d1f578Mathew Inwood
18e29d52aa72c96c3147fa91d83aeb8dafc6d1f578Mathew Inwood/**
19e29d52aa72c96c3147fa91d83aeb8dafc6d1f578Mathew Inwood * A {@link NowOrLater} object that is always ready now.
20e29d52aa72c96c3147fa91d83aeb8dafc6d1f578Mathew Inwood */
21e29d52aa72c96c3147fa91d83aeb8dafc6d1f578Mathew Inwoodpublic class Now<C> implements NowOrLater<C> {
22e29d52aa72c96c3147fa91d83aeb8dafc6d1f578Mathew Inwood
23e29d52aa72c96c3147fa91d83aeb8dafc6d1f578Mathew Inwood    private final C mValue;
24e29d52aa72c96c3147fa91d83aeb8dafc6d1f578Mathew Inwood
25e29d52aa72c96c3147fa91d83aeb8dafc6d1f578Mathew Inwood    public Now(C value) {
26e29d52aa72c96c3147fa91d83aeb8dafc6d1f578Mathew Inwood        mValue = value;
27e29d52aa72c96c3147fa91d83aeb8dafc6d1f578Mathew Inwood    }
28e29d52aa72c96c3147fa91d83aeb8dafc6d1f578Mathew Inwood
29e29d52aa72c96c3147fa91d83aeb8dafc6d1f578Mathew Inwood    public void getLater(Consumer<? super C> consumer) {
30e29d52aa72c96c3147fa91d83aeb8dafc6d1f578Mathew Inwood        consumer.consume(getNow());
31e29d52aa72c96c3147fa91d83aeb8dafc6d1f578Mathew Inwood    }
32e29d52aa72c96c3147fa91d83aeb8dafc6d1f578Mathew Inwood
33e29d52aa72c96c3147fa91d83aeb8dafc6d1f578Mathew Inwood    public C getNow() {
34e29d52aa72c96c3147fa91d83aeb8dafc6d1f578Mathew Inwood        return mValue;
35e29d52aa72c96c3147fa91d83aeb8dafc6d1f578Mathew Inwood    }
36e29d52aa72c96c3147fa91d83aeb8dafc6d1f578Mathew Inwood
37e29d52aa72c96c3147fa91d83aeb8dafc6d1f578Mathew Inwood    public boolean haveNow() {
38e29d52aa72c96c3147fa91d83aeb8dafc6d1f578Mathew Inwood        return true;
39e29d52aa72c96c3147fa91d83aeb8dafc6d1f578Mathew Inwood    }
40e29d52aa72c96c3147fa91d83aeb8dafc6d1f578Mathew Inwood
41e29d52aa72c96c3147fa91d83aeb8dafc6d1f578Mathew Inwood}
42