<commit_before>/*
 * Copyright 2014-present Facebook, Inc.
 *
 * 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.facebook.litho.sections.widget;

import android.support.annotation.Nullable;
import com.facebook.litho.ComponentLogParams;
import com.facebook.litho.config.ComponentsConfiguration;
import com.facebook.litho.config.LayoutThreadPoolConfiguration;
import com.facebook.litho.sections.SectionTree;
import com.facebook.litho.sections.config.SectionsConfiguration;
import com.facebook.litho.widget.LayoutHandlerFactory;
import com.facebook.litho.widget.RecyclerBinder;
import java.util.List;

/** Configuration setting for {@link RecyclerBinder}. */
public class RecyclerBinderConfiguration {
  private final double mRangeRatio;
  @Nullable private final LayoutHandlerFactory mLayoutHandlerFactory;
  private final boolean mCanPrefetchDisplayLists;
  private final boolean mIsCircular;
  private final boolean mIsWrapContent;
  // TODO T34627443 make all fields final after removing setters
  private boolean mHasDynamicItemHeight;
  private boolean mUseBackgroundChangeSets = SectionsConfiguration.useBackgroundChangeSets;
  private boolean mHScrollAsyncMode;
  private boolean mEnableStableIds;
  private boolean mUseSharedLayoutStateFuture = ComponentsConfiguration.useSharedLayoutStateFuture;
  private LayoutThreadPoolConfiguration mThreadPoolForSharedLayoutStateFutureConfig =
      ComponentsConfiguration.sharedLayoutStateFutureThreadPoolConfig;
  private boolean mAsyncInitRange = ComponentsConfiguration.asyncInitRange;
  @Nullable private String mSplitLayoutTag;
  @Nullable private List<ComponentLogParams> mInvalidStateLogParamsList;

  public static Builder create() {
    return new Builder();
  }

  /** Use {@link #create()} instead. */
  @Deprecated
  public RecyclerBinderConfiguration(double rangeRatio) {
    this(rangeRatio, null, false);
  }

  /** Use {@link #create()} instead. */
  @Deprecated
  public RecyclerBinderConfiguration(
      double rangeRatio, @Nullable LayoutHandlerFactory idleExecutor) {
    this(rangeRatio, idleExecutor, false);
  }

  /** Use {@link #create()} instead. */
  @Deprecated
  public RecyclerBinderConfiguration(
      double rangeRatio,
      @Nullable LayoutHandlerFactory idleExecutor,
      boolean canPrefetchDisplayLists) {
    this(rangeRatio, idleExecutor, canPrefetchDisplayLists, false);
  }

  /** Use {@link #create()} instead. */
  @Deprecated
  public RecyclerBinderConfiguration(
      double rangeRatio,
      @Nullable LayoutHandlerFactory idleExecutor,
      boolean canPrefetchDisplayLists,
      boolean isCircular) {
    this(rangeRatio, idleExecutor, canPrefetchDisplayLists, isCircular, false);
  }

  /** Use {@link #create()} instead. */
  @Deprecated
  public RecyclerBinderConfiguration(
      double rangeRatio,
      @Nullable LayoutHandlerFactory idleExecutor,
      boolean canPrefetchDisplayLists,
      boolean isCircular,
      boolean isWrapContent) {
    mRangeRatio = rangeRatio > 0 ? rangeRatio : Builder.DEFAULT_RANGE;
    mLayoutHandlerFactory = idleExecutor;
    mCanPrefetchDisplayLists = canPrefetchDisplayLists;
    mIsCircular = isCircular;
    mIsWrapContent = isWrapContent;
  }

  RecyclerBinderConfiguration(
      double rangeRatio,
      @Nullable LayoutHandlerFactory layoutHandlerFactory,
      boolean canPrefetchDisplayLists,
      boolean circular,
      boolean wrapContent,
      @Nullable List<ComponentLogParams> invalidStateLogParamsList,
      @Nullable String splitLayoutTag,
      LayoutThreadPoolConfiguration threadPoolForSharedLayoutStateFutureConfig,
      boolean dynamicItemHeight,
      boolean useBackgroundChangeSets,
      boolean hScrollAsyncMode,
      boolean enableStableIds,
      boolean useSharedLayoutStateFuture,
      boolean asyncInitRange) {
    mRangeRatio = rangeRatio;
    mLayoutHandlerFactory = layoutHandlerFactory;
    mCanPrefetchDisplayLists = canPrefetchDisplayLists;
    mIsCircular = circular;
    mIsWrapContent = wrapContent;
    mInvalidStateLogParamsList = invalidStateLogParamsList;
    mSplitLayoutTag = splitLayoutTag;
    mThreadPoolForSharedLayoutStateFutureConfig = threadPoolForSharedLayoutStateFutureConfig;
    mHasDynamicItemHeight = dynamicItemHeight;
    mUseBackgroundChangeSets = useBackgroundChangeSets;
    mHScrollAsyncMode = hScrollAsyncMode;
    mEnableStableIds = enableStableIds;
    mUseSharedLayoutStateFuture = useSharedLayoutStateFuture;
    mAsyncInitRange = asyncInitRange;
  }

  /** TODO T34627443 replace usage with builder */
  public RecyclerBinderConfiguration setSplitLayoutTag(String splitLayoutTag) {
    mSplitLayoutTag = splitLayoutTag;
    return this;
  }

  /** TODO T34627443 replace usage with builder */
  public RecyclerBinderConfiguration setUseBackgroundChangeSets(boolean useBackgroundChangeSets) {
    mUseBackgroundChangeSets = useBackgroundChangeSets;
    return this;
  }
<commit_msg>Cleaned up setSplitLayoutTag on RecyclerBinderConfiguration<commit_after>/*
 * Copyright 2014-present Facebook, Inc.
 *
 * 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.facebook.litho.sections.widget;

import android.support.annotation.Nullable;
import com.facebook.litho.ComponentLogParams;
import com.facebook.litho.config.ComponentsConfiguration;
import com.facebook.litho.config.LayoutThreadPoolConfiguration;
import com.facebook.litho.sections.SectionTree;
import com.facebook.litho.sections.config.SectionsConfiguration;
import com.facebook.litho.widget.LayoutHandlerFactory;
import com.facebook.litho.widget.RecyclerBinder;
import java.util.List;

/** Configuration setting for {@link RecyclerBinder}. */
public class RecyclerBinderConfiguration {
  private final double mRangeRatio;
  @Nullable private final LayoutHandlerFactory mLayoutHandlerFactory;
  private final boolean mCanPrefetchDisplayLists;
  private final boolean mIsCircular;
  private final boolean mIsWrapContent;
  // TODO T34627443 make all fields final after removing setters
  private boolean mHasDynamicItemHeight;
  private boolean mUseBackgroundChangeSets = SectionsConfiguration.useBackgroundChangeSets;
  private boolean mHScrollAsyncMode;
  private boolean mEnableStableIds;
  private boolean mUseSharedLayoutStateFuture = ComponentsConfiguration.useSharedLayoutStateFuture;
  private LayoutThreadPoolConfiguration mThreadPoolForSharedLayoutStateFutureConfig =
      ComponentsConfiguration.sharedLayoutStateFutureThreadPoolConfig;
  private boolean mAsyncInitRange = ComponentsConfiguration.asyncInitRange;
  @Nullable private String mSplitLayoutTag;
  @Nullable private List<ComponentLogParams> mInvalidStateLogParamsList;

  public static Builder create() {
    return new Builder();
  }

  /** Use {@link #create()} instead. */
  @Deprecated
  public RecyclerBinderConfiguration(double rangeRatio) {
    this(rangeRatio, null, false);
  }

  /** Use {@link #create()} instead. */
  @Deprecated
  public RecyclerBinderConfiguration(
      double rangeRatio, @Nullable LayoutHandlerFactory idleExecutor) {
    this(rangeRatio, idleExecutor, false);
  }

  /** Use {@link #create()} instead. */
  @Deprecated
  public RecyclerBinderConfiguration(
      double rangeRatio,
      @Nullable LayoutHandlerFactory idleExecutor,
      boolean canPrefetchDisplayLists) {
    this(rangeRatio, idleExecutor, canPrefetchDisplayLists, false);
  }

  /** Use {@link #create()} instead. */
  @Deprecated
  public RecyclerBinderConfiguration(
      double rangeRatio,
      @Nullable LayoutHandlerFactory idleExecutor,
      boolean canPrefetchDisplayLists,
      boolean isCircular) {
    this(rangeRatio, idleExecutor, canPrefetchDisplayLists, isCircular, false);
  }

  /** Use {@link #create()} instead. */
  @Deprecated
  public RecyclerBinderConfiguration(
      double rangeRatio,
      @Nullable LayoutHandlerFactory idleExecutor,
      boolean canPrefetchDisplayLists,
      boolean isCircular,
      boolean isWrapContent) {
    mRangeRatio = rangeRatio > 0 ? rangeRatio : Builder.DEFAULT_RANGE;
    mLayoutHandlerFactory = idleExecutor;
    mCanPrefetchDisplayLists = canPrefetchDisplayLists;
    mIsCircular = isCircular;
    mIsWrapContent = isWrapContent;
  }

  RecyclerBinderConfiguration(
      double rangeRatio,
      @Nullable LayoutHandlerFactory layoutHandlerFactory,
      boolean canPrefetchDisplayLists,
      boolean circular,
      boolean wrapContent,
      @Nullable List<ComponentLogParams> invalidStateLogParamsList,
      @Nullable String splitLayoutTag,
      LayoutThreadPoolConfiguration threadPoolForSharedLayoutStateFutureConfig,
      boolean dynamicItemHeight,
      boolean useBackgroundChangeSets,
      boolean hScrollAsyncMode,
      boolean enableStableIds,
      boolean useSharedLayoutStateFuture,
      boolean asyncInitRange) {
    mRangeRatio = rangeRatio;
    mLayoutHandlerFactory = layoutHandlerFactory;
    mCanPrefetchDisplayLists = canPrefetchDisplayLists;
    mIsCircular = circular;
    mIsWrapContent = wrapContent;
    mInvalidStateLogParamsList = invalidStateLogParamsList;
    mSplitLayoutTag = splitLayoutTag;
    mThreadPoolForSharedLayoutStateFutureConfig = threadPoolForSharedLayoutStateFutureConfig;
    mHasDynamicItemHeight = dynamicItemHeight;
    mUseBackgroundChangeSets = useBackgroundChangeSets;
    mHScrollAsyncMode = hScrollAsyncMode;
    mEnableStableIds = enableStableIds;
    mUseSharedLayoutStateFuture = useSharedLayoutStateFuture;
    mAsyncInitRange = asyncInitRange;
  }

  /** TODO T34627443 replace usage with builder */
  public RecyclerBinderConfiguration setUseBackgroundChangeSets(boolean useBackgroundChangeSets) {
    mUseBackgroundChangeSets = useBackgroundChangeSets;
    return this;
  }

{'fraction_non_alphanumeric': 0.06432912575970079, 'fraction_numerical': 0.005423094904160822, 'mean_word_length': 4.893112947658402, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5330992', 'n_tokens_mistral': 2802, 'n_tokens_neox': 2701, 'n_words': 720}