<commit_before>/* Copyright 2015 Samsung Electronics Co., LTD
 *
 * 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 org.gearvrf;

import java.util.concurrent.Future;

/**
 * The API shared by {@link GVRMaterial} and {@link GVRPostEffect}.
 * 
 * <p>
 * <table border="1">
 * <tr>
 * <td>{@link GVRMaterialShaderManager} {@code implements}
 * {@link GVRShaderManagers}</td>
 * <td>{@link GVRMaterialMap} {@code implements} {@link GVRShaderMaps}</td>
 * <td>{@link GVRMaterial} {@code implements} {@link GVRShaders}</td>
 * </tr>
 * <tr>
 * <td>{@link GVRPostEffectShaderManager} {@code implements}
 * {@link GVRShaderManagers}</td>
 * <td>{@link GVRPostEffectMap} {@code implements} {@link GVRShaderMaps}</td>
 * <td>{@link GVRPostEffect} {@code implements} {@link GVRShaders}</td>
 * </tr>
 * </table>
 * </p>
 */
public interface GVRShaders<ID> {

    static final String MAIN_TEXTURE = "main_texture";

    /** @return The current shader id. */
    public ID getShaderType();

    /**
     * Set shader id
     * 
     * @param shaderId
     *            The new shader id. This is an opaque type, used to keep object
     *            and scene shader ids in distinct namespaces.
     */
    public void setShaderType(ID shaderId);

    /**
     * The {@link GVRTexture texture} currently bound to the
     * {@code main_texture} shader uniform.
     * 
     * With most shaders, this is the texture that is actually displayed.
     * 
     * @return The {@linkplain GVRTexture main texture}
     */
    public GVRTexture getMainTexture();

    /**
     * Bind a different {@link GVRTexture texture} to the {@code main_texture}
     * shader uniform.
     * 
     * <p>
     * <em>Note</em>: {@linkplain GVRTexture GVR textures} are reference
     * counted. While you can freely change the texture associated with a
     * {@link GVRMaterial} or a {@link GVRPostEffect}, a sequence like
     * 
     * <pre>
     * GVRTexture currentTexture = material.getMainTexture();
     * material.setMainTexture(otherTexture);
     * // ...
     * material.setMainTexture(currentTexture);
     * </pre>
     * 
     * may not do what you expect. The {@code setMainTexture(otherTexture)} call
     * will decrement the reference count on {@code currentTexture}: If the
     * reference count goes to 0, the texture will be released, and the
     * {@code setMainTexture(currentTexture)} call will leave the
     * {@link GVRMaterial} invisible (or will break the {@link GVRPostEffect}).
     * You can prevent this by adding a new reference
     * 
     * <pre>
     * material.setTexture(&quot;any_name_you're_not_otherwise_using&quot;, currentTexture);
     * </pre>
     * 
     * before you call {@code setMainTexture(otherTexture)}.
     * 
     * @param texture
     *            The {@link GVRTexture} to bind.
     */
    public void setMainTexture(GVRTexture texture);

    /**
     * Asynchronously bind a different {@link GVRTexture texture} to the
     * {@code main_texture} shader uniform.
     * 
     * Uses a background thread from the thread pool to wait for the
     * {@code Future.get()} method; unless you are loading dozens of textures
     * asynchronously, the extra overhead should be modest compared to the cost
     * of loading a texture.
     * 
     * <p>
     * Please see the notes on reference counting in the main
     * {@link #setMainTexture(GVRTexture)} overload.
     * 
     * @param texture
     *            A future texture, from one of the the
     *            {@link GVRContext#loadFutureTexture(GVRAndroidResource)}
     *            methods
     * 
     * @since 1.6.7
     */
    public void setMainTexture(Future<GVRTexture> texture);

    /**
     * Get the {@link GVRTexture texture} currently bound to the shader uniform
     * {@code key}.
     * 
     * @param key
     *            A texture name
     * @return The current {@link GVRTexture texture}.
     */
    public GVRTexture getTexture(String key);

    /**
     * Bind a {@link GVRTexture texture} to the shader uniform {@code key}.
     * 
     * <p>
     * Note that this will increment the reference count of the new texture, and
     * decrement the reference count of any current texture. See
     * {@link #setMainTexture(GVRTexture)} for more details.
     * 
     * @param key
     *            Name of the shader uniform to bind the texture to.
     * @param texture
     *            The {@link GVRTexture texture} to bind.
     */
    public void setTexture(String key, GVRTexture texture);

    /**
     * Asynchronously bind a {@link GVRTexture texture} to the shader uniform
     * {@code key}.
     * 
     * Uses a background thread from the thread pool to wait for the
     * {@code Future.get()} method; unless you are loading dozens of textures
     * asynchronously, the extra overhead should be modest compared to the cost
     * of loading a texture.
     * 
     * <p>
     * Note that this will increment the reference count of the new texture, and
     * decrement the reference count of any current texture. See
     * {@link #setMainTexture(GVRTexture)} for more details.
     * 
     * @param key
     *            Name of the shader uniform to bind the texture to.
     * @param texture
     *            The {@link GVRTexture texture} to bind.
     * 
     * @since 1.6.7
     */
    public void setTexture(String key, Future<GVRTexture> texture);<commit_msg>Remove the JavaDoc about texture reference counting.<commit_after>/* Copyright 2015 Samsung Electronics Co., LTD
 *
 * 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 org.gearvrf;

import java.util.concurrent.Future;

/**
 * The API shared by {@link GVRMaterial} and {@link GVRPostEffect}.
 * 
 * <p>
 * <table border="1">
 * <tr>
 * <td>{@link GVRMaterialShaderManager} {@code implements}
 * {@link GVRShaderManagers}</td>
 * <td>{@link GVRMaterialMap} {@code implements} {@link GVRShaderMaps}</td>
 * <td>{@link GVRMaterial} {@code implements} {@link GVRShaders}</td>
 * </tr>
 * <tr>
 * <td>{@link GVRPostEffectShaderManager} {@code implements}
 * {@link GVRShaderManagers}</td>
 * <td>{@link GVRPostEffectMap} {@code implements} {@link GVRShaderMaps}</td>
 * <td>{@link GVRPostEffect} {@code implements} {@link GVRShaders}</td>
 * </tr>
 * </table>
 * </p>
 */
public interface GVRShaders<ID> {

    static final String MAIN_TEXTURE = "main_texture";

    /** @return The current shader id. */
    public ID getShaderType();

    /**
     * Set shader id
     * 
     * @param shaderId
     *            The new shader id. This is an opaque type, used to keep object
     *            and scene shader ids in distinct namespaces.
     */
    public void setShaderType(ID shaderId);

    /**
     * The {@link GVRTexture texture} currently bound to the
     * {@code main_texture} shader uniform.
     * 
     * With most shaders, this is the texture that is actually displayed.
     * 
     * @return The {@linkplain GVRTexture main texture}
     */
    public GVRTexture getMainTexture();

    /**
     * Bind a different {@link GVRTexture texture} to the {@code main_texture}
     * shader uniform.
     * 
     * @param texture
     *            The {@link GVRTexture} to bind.
     */
    public void setMainTexture(GVRTexture texture);

    /**
     * Asynchronously bind a different {@link GVRTexture texture} to the
     * {@code main_texture} shader uniform.
     * 
     * Uses a background thread from the thread pool to wait for the
     * {@code Future.get()} method; unless you are loading dozens of textures
     * asynchronously, the extra overhead should be modest compared to the cost
     * of loading a texture.
     * 
     * @param texture
     *            A future texture, from one of the the
     *            {@link GVRContext#loadFutureTexture(GVRAndroidResource)}
     *            methods
     * 
     * @since 1.6.7
     */
    public void setMainTexture(Future<GVRTexture> texture);

    /**
     * Get the {@link GVRTexture texture} currently bound to the shader uniform
     * {@code key}.
     * 
     * @param key
     *            A texture name
     * @return The current {@link GVRTexture texture}.
     */
    public GVRTexture getTexture(String key);

    /**
     * Bind a {@link GVRTexture texture} to the shader uniform {@code key}.
     * 
     * @param key
     *            Name of the shader uniform to bind the texture to.
     * @param texture
     *            The {@link GVRTexture texture} to bind.
     */
    public void setTexture(String key, GVRTexture texture);

    /**
     * Asynchronously bind a {@link GVRTexture texture} to the shader uniform
     * {@code key}.
     * 
     * Uses a background thread from the thread pool to wait for the
     * {@code Future.get()} method; unless you are loading dozens of textures
     * asynchronously, the extra overhead should be modest compared to the cost
     * of loading a texture.
     * 
     * @param key
     *            Name of the shader uniform to bind the texture to.
     * @param texture
     *            The {@link GVRTexture texture} to bind.
     * 
     * @since 1.6.7
     */
    public void setTexture(String key, Future<GVRTexture> texture);
{'fraction_non_alphanumeric': 0.10038231545926869, 'fraction_numerical': 0.0030389177531614546, 'mean_word_length': 2.594785059901339, 'pattern_counts': {'":': 0, '<': 59, '<?xml version=': 0, '>': 59, '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': '4033940', 'n_tokens_mistral': 2892, 'n_tokens_neox': 2793, 'n_words': 1083}