<commit_before>/*
 * Copyright 2017 <NAME>
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.ae.apps.common.managers.contact;

import android.graphics.Bitmap;

import com.ae.apps.common.vo.ContactVo;
import com.ae.apps.common.vo.MessageVo;

import java.util.List;

/**
 * A specification for a ContactManager used in AE App lab projects
 * <p>
 * <pre>
 *     Call @link{fetchAllContacts} or @link{fetchAllContactsAsync} to initialize the contacts
 * </pre>
 */
interface AeContactManager {

    /**
     * Invoke to fetch all contacts and use them right away
     *
     * @return
     */
    void fetchAllContacts();

    /**
     * Invoke to fetch contacts in a separate thread. Use if lazily creating an instance
     * of @link{{@link AeContactManager}}
     *
     * @param consumer consumer to be notified when the contacts have been read
     */
    void fetchAllContactsAsync(final ContactDataConsumer consumer);

    /**
     * Invoke to fetch all contacts once read from are read. Returns a copy of the contacts list.
     * Note that this is an expensive operation as a new list is created with original
     * values and returned to the caller.
     *
     * @return contacts list
     * @throws UnsupportedOperationException {@inheritDoc}
     */
    List<ContactVo> getAllContacts() throws UnsupportedOperationException;

    /**
     * Gets the total contacts read
     *
     * @return number of contacts
     */
    int getTotalContactCount();

    /**
     * Returns a random contactVo from the list if the list is non empty, null otherwise
     *
     * @return a ContactVo object
     */
    ContactVo getRandomContact();

    /**
     * Returns a contact with phone details
     *
     * @param contactId contact id
     * @return contact vo
     */
    ContactVo getContactWithPhoneDetails(final String contactId);

    /**
     * Returns a Bitmap object for the contact's photo, returning a default image
     *
     * @param contactId    contact id
     * @param defaultImage default image
     * @return contact photo
     */
    Bitmap getContactPhoto(final String contactId, final Bitmap defaultImage);

    /**
     * @param contactId contact id
     * @return contact vo
     */
    ContactVo getContactInfo(final String contactId);

    /**
     * Returns the list of messages for this contact with id
     *
     * @param contactId contact id
     * @return list of message vo s
     */
    List<MessageVo> getContactMessages(final String contactId);

    /**
     * Returns the contactId based on the rawContactId
     *
     * @param rawContactId ra contact id
     * @return
     */
    long getContactIdFromRawContactId(final String rawContactId);

    /**
     * Does a lookup on the contacts by phone number lookup
     *
     * @param address address
     * @return
     */
    String getContactIdFromAddress(final String address);

    /**
     * Returns a Bitmap object for the contact's photo
     *
     * @param contactId contact id
     * @return contact photo
     */
    Bitmap getContactPhoto(final String contactId);

}
<commit_msg>make AeContactManager public<commit_after>/*
 * Copyright 2017 <NAME>
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.ae.apps.common.managers.contact;

import android.graphics.Bitmap;

import com.ae.apps.common.vo.ContactVo;
import com.ae.apps.common.vo.MessageVo;

import java.util.List;

/**
 * A specification for a ContactManager used in AE App lab projects
 * <p>
 * <pre>
 *     Call @link{fetchAllContacts} or @link{fetchAllContactsAsync} to initialize the contacts
 * </pre>
 */
public interface AeContactManager {

    /**
     * Invoke to fetch all contacts and use them right away
     *
     * @return
     */
    void fetchAllContacts();

    /**
     * Invoke to fetch contacts in a separate thread. Use if lazily creating an instance
     * of @link{{@link AeContactManager}}
     *
     * @param consumer consumer to be notified when the contacts have been read
     */
    void fetchAllContactsAsync(final ContactDataConsumer consumer);

    /**
     * Invoke to fetch all contacts once read from are read. Returns a copy of the contacts list.
     * Note that this is an expensive operation as a new list is created with original
     * values and returned to the caller.
     *
     * @return contacts list
     * @throws UnsupportedOperationException {@inheritDoc}
     */
    List<ContactVo> getAllContacts() throws UnsupportedOperationException;

    /**
     * Gets the total contacts read
     *
     * @return number of contacts
     */
    int getTotalContactCount();

    /**
     * Returns a random contactVo from the list if the list is non empty, null otherwise
     *
     * @return a ContactVo object
     */
    ContactVo getRandomContact();

    /**
     * Returns a contact with phone details
     *
     * @param contactId contact id
     * @return contact vo
     */
    ContactVo getContactWithPhoneDetails(final String contactId);

    /**
     * Returns a Bitmap object for the contact's photo, returning a default image
     *
     * @param contactId    contact id
     * @param defaultImage default image
     * @return contact photo
     */
    Bitmap getContactPhoto(final String contactId, final Bitmap defaultImage);

    /**
     * @param contactId contact id
     * @return contact vo
     */
    ContactVo getContactInfo(final String contactId);

    /**
     * Returns the list of messages for this contact with id
     *
     * @param contactId contact id
     * @return list of message vo s
     */
    List<MessageVo> getContactMessages(final String contactId);

    /**
     * Returns the contactId based on the rawContactId
     *
     * @param rawContactId ra contact id
     * @return
     */
    long getContactIdFromRawContactId(final String rawContactId);

    /**
     * Does a lookup on the contacts by phone number lookup
     *
     * @param address address
     * @return
     */
    String getContactIdFromAddress(final String address);

    /**
     * Returns a Bitmap object for the contact's photo
     *
     * @param contactId contact id
     * @return contact photo
     */
    Bitmap getContactPhoto(final String contactId);

}

{'fraction_non_alphanumeric': 0.07749792416274565, 'fraction_numerical': 0.0022142264046498754, 'mean_word_length': 2.7329545454545454, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1466037', 'n_tokens_mistral': 1927, 'n_tokens_neox': 1872, 'n_words': 759}