text:
package de.mrapp.android.dialog.decorator;

import android.os.Bundle;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;

import com.google.android.material.tabs.TabLayout;

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;

import androidx.annotation.ColorInt;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.StringRes;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.viewpager.widget.ViewPager.OnPageChangeListener;
import de.mrapp.android.dialog.R;
import de.mrapp.android.dialog.ScrollableArea.Area;
import de.mrapp.android.dialog.WizardDialog;
import de.mrapp.android.dialog.WizardDialog.TabPosition;
import de.mrapp.android.dialog.WizardDialog.WizardListener;
import de.mrapp.android.dialog.adapter.ViewPagerAdapter;
import de.mrapp.android.dialog.datastructure.ViewPagerItem;
import de.mrapp.android.dialog.view.DialogRootView.AreaViewType;
import de.mrapp.android.dialog.view.DialogRootView.ViewType;
import de.mrapp.android.dialog.view.ViewPager;
import de.mrapp.util.Condition;
import de.mrapp.util.datastructure.ListenerList;

/**
 * A decorator, which allows to modify the view hierarchy of a dialog, which is designed according
 * to Android 5's Material Design guidelines even on pre-Lollipop devices and provides a navigation
 * for switching between multiple fragments.
 *
 * @author Michael Rapp
 * @since 3.2.0
 */
public class WizardDialogDecorator extends AbstractDialogFragmentDecorator<WizardDialog>
        implements de.mrapp.android.dialog.model.WizardDialogDecorator, OnPageChangeListener {

    /**
     * The name of the extra, which is used to store the position of the tabs, which indicate the
     * currently shown fragment, within a bundle.
     */
    private static final String TAB_POSITION_EXTRA =
            WizardDialogDecorator.class.getSimpleName() + "::tabPosition";

    /**
     * The name of the extra, which is used to store, whether the tabs, which indicate the currently
     * shown fragment, should be enabled, or not, within a bundle.
     */
    private static final String TAB_LAYOUT_ENABLED_EXTRA =
            WizardDialogDecorator.class.getSimpleName() + "::tabLayoutEnabled";

    /**
     * The name of the extra, which is used to store, whether the tabs, which indicate the currently
     * shown fragment, should be shown, or not, within a bundle.
     */
    private static final String TAB_LAYOUT_SHOWN_EXTRA =
            WizardDialogDecorator.class.getSimpleName() + "::tabLayoutShown";

    /**
     * The name of the extra, which is used to store the height of the indicator, which indicates
     * the currently shown fragment, within a bundle.
     */
    private static final String TAB_INDICATOR_HEIGHT_EXTRA =
            WizardDialogDecorator.class.getSimpleName() + "::tabIndicatorHeight";

    /**
     * The name of the extra, which is used to store the color of the indicator, which indicates the
     * currently shown fragment, within a bundle.
     */
    private static final String TAB_INDICATOR_COLOR_EXTRA =
            WizardDialogDecorator.class.getSimpleName() + "::tabIndicatorColor";

    /**
     * The name of the extra, which is used to store the color of the tabs, which indicate the
     * currently shown fragment, within a bundle.
     */
    private static final String TAB_TEXT_COLOR_EXTRA =
            WizardDialogDecorator.class.getSimpleName() + "::tabTextColor";

    /**
     * The name of the extra, which is used to store the selected text color of the tabs, which
     * indicate the currently shown fragment, within a bundle.
     */
    private static final String TAB_SELECTED_TEXT_COLOR_EXTRA =
            WizardDialogDecorator.class.getSimpleName() + "::tabSelectedTextColor";

    /**
     * The name of the extra, which is used to store, whether switching between fragments using
     * swipe gestures, should be enabled, or not, within a bundle.
     */
    private static final String SWIPE_ENABLED_EXTRA =
            WizardDialogDecorator.class.getSimpleName() + "::swipeEnabled";

    /**
     * The name of the extra, which is used to store, whether the dialog's buttons should be shown,
     * or not, within a bundle.
     */
    private static final String BUTTON_BAR_SHOWN_EXTRA =
            WizardDialogDecorator.class.getSimpleName() + "::buttonBarShown";

    /**
     * The name of the extra, which is used to store the color of the button texts of the dialog
     * within a bundle.
     */
    private static final String BUTTON_TEXT_COLOR_EXTRA =
            WizardDialogDecorator.class.getSimpleName() + "::buttonTextColor";

    /**
     * The name of the extra, which is used to store, whether the divider, which is located above
     * the dialog's buttons, should be shown, or not, within a bundle.
     */
    private static final String SHOW_BUTTON_BAR_DIVIDER_EXTRA =
            WizardDialogDecorator.class.getSimpleName() + "::showButtonBarDivider";

    /**
     * The name of the extra, which is used to store the color of the divider, which is located
     * above the dialog's buttons, within a bundle.
     */
    private static final String BUTTON_BAR_DIVIDER_COLOR_EXTRA =
            WizardDialogDecorator.class.getSimpleName() + "::buttonBarDividerColor";

    /**
     * The name of the extra, which is used to store the left and right margin of the divider, which
     * is located above the dialog's buttons, within a bundle.
     */
    private static final String BUTTON_BAR_DIVIDER_MARGIN_EXTRA =
            WizardDialogDecorator.class.getSimpleName() + "::buttonBarDividerMargin";

    /**
     * The name of the extra, which is used to store the text of the back button of the dialog
     * within a bundle.
     */
    private static final String BACK_BUTTON_TEXT_EXTRA =
            WizardDialogDecorator.class.getSimpleName() + "::backButtonText";

    /**
     * The name of the extra, which is used to store the text of the next button of the dialog
     * within a bundle.
     */
    private static final String NEXT_BUTTON_TEXT_EXTRA =
            WizardDialogDecorator.class.getSimpleName() + "::nextButtonText";

    /**
     * The name of the extra, which is used to store the text of the finish button of the dialog
     * within a bundle.
     */
    private static final String FINISH_BUTTON_TEXT_EXTRA =
            WizardDialogDecorator.class.getSimpleName() + "::finishButtonText";

    /**
     * The name of the extra, which is used to store items of the dialog's view pager within a
     * bundle.
     */
    private static final String VIEW_PAGER_ITEMS_EXTRA =
            WizardDialogDecorator.class.getSimpleName() + "::viewPagerItems";

    /**
     * An array list, which contains the items if the dialog's view pager.
     */
    private final ArrayList<ViewPagerItem> viewPagerItems;

    /**
     * The listeners, which should be notified, when the user navigates within the dialog.
     */
    private final ListenerList<WizardListener> wizardListeners;

    /**
     * The listeners, which should be notified, when the page of the dialog's view pager has been
     * changed.
     */
    private final ListenerList<OnPageChangeListener> onPageChangeListeners;

    /**
     * The adapter, which is used to manage the dialog's fragments.
     */
    private ViewPagerAdapter viewPagerAdapter;

    /**
     * The view pager, which is used to show the dialog's fragments.
     */
    private ViewPager viewPager;

    /**
     * The tabs, which indicate the currently shown fragment.
     */
    private TabLayout tabLayout;

    /**
     * The parent view of the layout, which is used to show the dialog's buttons.
     */
    private ViewGroup buttonBarContainer;

    /**
     * The back button of the dialog.
     */
    private Button backButton;

    /**
     * The next button of the dialog.
     */
    private Button nextButton;

    /**
     * The finish button of the dialog.
     */
    private Button finishButton;

    /**
     * The divider, which is shown above the dialog's buttons.
     */
    private View buttonBarDivider;

    /**
     * The position of the tabs, which indicate the currently shown fragment.
     */
    private TabPosition tabPosition;

    /**
     * True, if the tabs, which indicate the currently shown fragment, are enabled, false
     * otherwise.
     */
    private boolean tabLayoutEnabled;

    /**
     * True, if the tabs, which indicate the currently shown fragment, are shown, false otherwise.
     */
    private boolean tabLayoutShown;

    /**
     * The height of the indicator, which indicates the currently shown fragment.
     */
    private int tabIndicatorHeight;

    /**
     * The color of the indicator, which indicates the currently shown fragment.
     */
    private int tabIndicatorColor;

    /**
     * The text color of the tabs, which indicate the currently shown fragment.
     */
    private int tabTextColor;

    /**
     * The selected text color of the tabs, which indicate the currently shown fragment.
     */
    private int tabSelectedTextColor;

    /**
     * True, if switching between fragments using swipe gestures is enabled, false otherwise.
     */
    private boolean swipeEnabled;

    /**
     * True, if the dialogÄs buttons are shown, false otherwise.
     */
    private boolean buttonBarShown;

    /**
     * The color of the button texts of the dialog.
     */
    private int buttonTextColor;

    /**
     * The text of the back button of the dialog.
     */
    private CharSequence backButtonText;

    /**
     * The text of the next button of the dialog.
     */
    private CharSequence nextButtonText;

    /**
     * The text of the finish button of the dialog.
     */
    private CharSequence finishButtonText;

    /**
     * True, if the divider, which is located above the dialog's buttons, is shown, false
     * otherwise.
     */
    private boolean showButtonBarDivider;

    /**
     * The color of the divider, which is located above the dialog's buttons.
     */
    private int buttonBarDividerColor;

    /**
     * The left and right margin of the divider, which is located above the dialog's buttons.
     */
    private int buttonBarDividerMargin;

    /**
     * Re-inflates the tab layout, which indicates the currently shown fragment, if the dialog has
     * already been created.
     */
    private void reInflateTabLayout() {
        View rootView = getRootView();

        if (rootView != null) {
            View headerContentContainer = rootView.findViewById(R.id.header_content_container);
            View contentContainer = rootView.findViewById(R.id.content_container);

            if (headerContentContainer != null && contentContainer != null) {
                inflateTabLayout(headerContentContainer, contentContainer);
            }
        }
    }

    /**
     * Inflates the tab layout, which indicates the currently shown fragment.
     *
     * @param headerView
     *         The view, which contains the dialog's header, as an instance of the class {@link
     *         View}. The view may not be null
     * @param contentView
     *         The view, which contains the dialog's content, as an instance of the class {@link
     *         View}. The view may not be null
     */
    private void inflateTabLayout(@NonNull final View headerView, @NonNull final View contentView) {
        LayoutInflater layoutInflater = LayoutInflater.from(getContext());
        ViewGroup headerContentContainer = headerView.findViewById(R.id.header_content_container);
        ViewGroup contentContainer = contentView.findViewById(R.id.content_container);

        if (tabLayout != null) {
            headerContentContainer.removeViewInLayout(tabLayout);
            contentContainer.removeView(tabLayout);
            tabLayout = null;
        }

        if (getDialog().isHeaderShown() && getTabPosition() != TabPosition.NO_HEADER &&
                ((TextUtils.isEmpty(getDialog().getTitle()) &&
                        TextUtils.isEmpty(getDialog().getMessage())) ||
                        getTabPosition() == TabPosition.PREFER_HEADER)) {
            tabLayout = (TabLayout) layoutInflater
                    .inflate(R.layout.wizard_dialog_tab_layout, headerContentContainer, false);
            RelativeLayout.LayoutParams layoutParams =
                    new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT,
                            RelativeLayout.LayoutParams.WRAP_CONTENT);
            layoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
            headerContentContainer.addView(tabLayout, layoutParams);
        } else {
            tabLayout = (TabLayout) layoutInflater
                    .inflate(R.layout.wizard_dialog_tab_layout, contentContainer, false);
            contentContainer.addView(tabLayout, 0);
        }

        tabLayout.setupWithViewPager(viewPager);
    }

    /**
     * Inflates the layout, which is used to show the dialog's buttons.
     *
     * @return The view, which has been inflated, as an instance of the class {@link View} or null,
     * if no view has been inflated
     */
    private View inflateButtonBar() {
        ViewGroup rootView = getRootView();

        if (rootView != null) {
            LayoutInflater layoutInflater = LayoutInflater.from(getContext());
            buttonBarContainer = (ViewGroup) layoutInflater
                    .inflate(R.layout.button_bar_container, rootView, false);
            buttonBarDivider = buttonBarContainer.findViewById(R.id.button_bar_divider);
            rootView.addView(buttonBarContainer);
            View view = layoutInflater
                    .inflate(R.layout.horizontal_button_bar, buttonBarContainer, false);
            buttonBarContainer.addView(view);
            nextButton = view.findViewById(android.R.id.button1);
            finishButton = view.findViewById(android.R.id.button2);
            backButton = view.findViewById(android.R.id.button3);
            return buttonBarContainer;
        }

        return null;
    }

    /**
     * Adapts the tab layout, which indicates the currently shown fragment.
     */
    private void adaptTabLayout() {
        adaptTabLayoutEnableState();
        adaptTabLayoutVisibility();
        adaptTabIndicatorHeight();
        adaptTabIndicatorColor();
        adaptTabTextColor();
    }

    /**
     * Adapts the enable state of the tab layout, which indicates the currently shown fragment.
     */
    private void adaptTabLayoutEnableState() {
        if (tabLayout != null) {
            LinearLayout tabStrip = ((LinearLayout) tabLayout.getChildAt(0));
            tabStrip.setEnabled(tabLayoutEnabled);

            for (int i = 0; i < tabStrip.getChildCount(); i++) {
                tabStrip.getChildAt(i).setEnabled(tabLayoutEnabled);
            }
        }
    }

    /**
     * Adapts the visibility of the tab layout, which indicates the currently shown fragment.
     */
    private void adaptTabLayoutVisibility() {
        if (tabLayout != null) {
            tabLayout.setVisibility(tabLayoutShown ? View.VISIBLE : View.GONE);
        }
    }

    /**
     * Adapts the height of the indicator, which indicates the currently shown fragment.
     */
    private void adaptTabIndicatorHeight() {
        if (tabLayout != null) {
            tabLayout.setSelectedTabIndicatorHeight(tabIndicatorHeight);
        }
    }

    /**
     * Adapts the color of the indicator, which indicates the currently shown fragment.
     */
    private void adaptTabIndicatorColor() {
        if (tabLayout != null) {
            tabLayout.setSelectedTabIndicatorColor(tabIndicatorColor);
        }
    }

    /**
     * Adapts the text color of the tabs, which indicate the currently shown fragment.
     */
    private void adaptTabTextColor() {
        if (tabLayout != null) {
            tabLayout.setTabTextColors(tabTextColor, tabSelectedTextColor);
        }
    }

    /**
     * Adapts the view pager, which is used to show the dialog's fragments.
     */
    private void adaptViewPager() {
        if (viewPager != null) {
            viewPager.enableSwipe(swipeEnabled);
        }
    }

    /**
     * Adapts the text color of the dialog's buttons.
     */
    private void adaptButtonTextColor() {
        if (backButton != null) {
            backButton.setTextColor(buttonTextColor);
        }

        if (nextButton != null) {
            nextButton.setTextColor(buttonTextColor);
        }

        if (finishButton != null) {
            finishButton.setTextColor(buttonTextColor);
        }
    }

    /**
     * Adapts the dialog's back button.
     */
    private void adaptBackButton() {
        if (backButton != null) {
            backButton.setText(backButtonText.toString().toUpperCase(Locale.getDefault()));
            backButton.setOnClickListener(createBackButtonListener());
        }
    }

    /**
     * Creates and returns a listener, which allows to show the previous fragment, when the
     * corresponding button is clicked.
     *
     * @return The listener, which has been created, as an instance of the type {@link
     * OnClickListener}
     */
    private OnClickListener createBackButtonListener() {
        return new OnClickListener() {

            @Override
            public void onClick(final View v) {
                int selectedIndex = viewPager.getCurrentItem();

                if (notifyOnPrevious(selectedIndex)) {
                    viewPager.setCurrentItem(selectedIndex - 1);
                }
            }

        };
    }

    /**
     * Adapts the dialog's next button.
     */
    private void adaptNextButton() {
        if (nextButton != null) {
            nextButton.setText(nextButtonText.toString().toUpperCase(Locale.getDefault()));
            nextButton.setOnClickListener(createNextButtonListener());
        }
    }

    /**
     * Creates and returns a listener, which allows to show the next fragment, when the
     * corresponding button is clicked.
     *
     * @return The listener, which has been created, as an instance of the type {@link
     * OnClickListener}
     */
    private OnClickListener createNextButtonListener() {
        return new OnClickListener() {

            @Override
            public void onClick(final View v) {
                int selectedIndex = viewPager.getCurrentItem();

                if (notifyOnNext(selectedIndex)) {
                    viewPager.setCurrentItem(selectedIndex + 1);
                }
            }

        };
    }

    /**
     * Adapts the dialog's finish button.
     */
    private void adaptFinishButton() {
        if (finishButton != null) {
            finishButton.setText(finishButtonText.toString().toUpperCase(Locale.getDefault()));
            finishButton.setOnClickListener(createFinishButtonListener());
        }
    }

    /**
     * Creates and returns a listener, which allows to close the dialog, when the corresponding
     * button is clicked.
     *
     * @return The listener, which has been created, as an instance of the type {@link
     * OnClickListener}
     */
    private OnClickListener createFinishButtonListener() {
        return new OnClickListener() {

            @Override
            public void onClick(final View v) {
                int selectedIndex = viewPager.getCurrentItem();

                if (notifyOnFinish(selectedIndex)) {
                    getDialog().dismiss();
                }
            }

        };
    }

    /**
     * Adapts the visibility of the dialog's buttons.
     */
    private void adaptButtonBarVisibility() {
        if (buttonBarContainer != null) {
            buttonBarContainer.setVisibility(buttonBarShown ? View.VISIBLE : View.GONE);
        }
    }

    /**
     * Adapts the visibility of the divider, which is shown above the dialog's buttons.
     */
    private void adaptButtonBarDividerVisibility() {
        if (buttonBarDivider != null) {
            buttonBarDivider.setVisibility(showButtonBarDivider ? View.VISIBLE : View.GONE);
        }
    }

    /**
     * Adapts the color of the divider, which is shown above the dialog's buttons.
     */
    private void adaptButtonBarDividerColor() {
        if (buttonBarDivider != null) {
            buttonBarDivider.setBackgroundColor(buttonBarDividerColor);
        }
    }

    /**
     * Adapts the left and right margin of the divider, which is shown above the dialog's buttons.
     */
    private void adaptButtonBarDividerMargin() {
        if (buttonBarDivider != null) {
            LinearLayout.LayoutParams layoutParams =
                    (LinearLayout.LayoutParams) buttonBarDivider.getLayoutParams();
            layoutParams.leftMargin = buttonBarDividerMargin;
            layoutParams.rightMargin = buttonBarDividerMargin;
            buttonBarDivider.setLayoutParams(layoutParams);
        }
    }

    /**
     * Adapts the visibility of the dialog's buttons, depending on the currently shown fragment.
     */
    private void adaptButtonVisibility() {
        if (viewPager != null && viewPagerAdapter != null && backButton != null &&
                nextButton != null && finishButton != null) {
            int selectedIndex = viewPager.getCurrentItem();
            backButton.setVisibility(selectedIndex > 0 ? View.VISIBLE : View.GONE);
            nextButton.setVisibility(
                    selectedIndex < viewPagerAdapter.getCount() - 1 ? View.VISIBLE : View.GONE);
            finishButton.setVisibility(
                    selectedIndex == viewPagerAdapter.getCount() - 1 ? View.VISIBLE : View.GONE);
        }
    }

    /**
     * Notifies all listeners, when the next fragment is about to be shown.
     *
     * @param index
     *         The index of the fragment, which is about to be shown, as an {@link Integer} value
     * @return True, if the fragment is allowed to be shown, false otherwise
     */
    private boolean notifyOnNext(final int index) {
        boolean result = true;

        for (WizardListener listener : wizardListeners) {
            result &= listener.onNext(index, viewPagerAdapter.getItem(index));
        }

        return result;
    }

    /**
     * Notifies all listeners, when the previous fragment is about to be shown.
     *
     * @param index
     *         The index of the fragment, which is about to be shown, as an {@link Integer} value
     * @return True, if the fragment is allowed to be shown, false otherwise
     */
    private boolean notifyOnPrevious(final int index) {
        boolean result = true;

        for (WizardListener listener : wizardListeners) {
            result &= listener.onPrevious(index, viewPagerAdapter.getItem(index));
        }

        return result;
    }

    /**
     * Notifies all listeners, when the last fragment is about to be finished.
     *
     * @param index
     *         The index of the fragment, which is about to be finished, as an {@link Integer}
     *         value
     * @return True, if the last fragment is allowed to be finished, false otherwise
     */
    private boolean notifyOnFinish(final int index) {
        boolean result = true;

        for (WizardListener listener : wizardListeners) {
            result &= listener.onFinish(index, viewPagerAdapter.getItem(index));
        }

        return result;
    }

    /**
     * Creates a new decorator, which allows to modify the view hierarchy of a dialog, which is
     * designed according to Android 5's Material Design guidelines even on pre-Lollipop devices and
     * provides a navigation for switching between multiple fragments..
     *
     * @param dialog
     *         The dialog, whose view hierarchy should be modified by the decorator, as an instance
     *         of the generic type DialogType. The dialog may not be null
     */
    public WizardDialogDecorator(@NonNull final WizardDialog dialog) {
        super(dialog);
        this.viewPagerItems = new ArrayList<>();
        this.wizardListeners = new ListenerList<>();
        this.onPageChangeListeners = new ListenerList<>();
    }

    @Override
    public final ViewPager getViewPager() {
        return viewPager;
    }

    @Override
    public final TabLayout getTabLayout() {
        return tabLayout;
    }

    @Override
    public final Button getBackButton() {
        return backButton;
    }

    @Override
    public final Button getNextButton() {
        return nextButton;
    }

    @Override
    public final Button getFinishButton() {
        return finishButton;
    }

    @Override
    public final void addFragment(@NonNull final Class<? extends Fragment> fragmentClass) {
        addFragment(fragmentClass, null);
    }

    @Override
    public final void addFragment(@NonNull final Class<? extends Fragment> fragmentClass,
                                  @Nullable final Bundle arguments) {
        addFragment(null, fragmentClass, arguments);
    }

    @Override
    public final void addFragment(@StringRes final int resourceId,
                                  @NonNull final Class<? extends Fragment> fragmentClass) {
        addFragment(resourceId, fragmentClass, null);
    }

    @Override
    public final void addFragment(@StringRes final int resourceId,
                                  @NonNull final Class<? extends Fragment> fragmentClass,
                                  @Nullable final Bundle arguments) {
        addFragment(getContext().getText(resourceId), fragmentClass, arguments);
    }

    @Override
    public final void addFragment(@Nullable final CharSequence title,
                                  @NonNull final Class<? extends Fragment> fragmentClass) {
        addFragment(title, fragmentClass, null);
    }

    @Override
    public final void addFragment(@Nullable final CharSequence title,
                                  @NonNull final Class<? extends Fragment> fragmentClass,
                                  @Nullable final Bundle arguments) {
        Condition.INSTANCE.ensureNotNull(fragmentClass, "The fragment class may not be null");
        viewPagerItems.add(new ViewPagerItem(title, fragmentClass, arguments));

        if (viewPagerAdapter != null) {
            viewPagerAdapter.addItem(title, fragmentClass, arguments);
        }
    }

    @Override
    public final void removeFragment(final int index) {
        viewPagerItems.remove(index);

        if (viewPagerAdapter != null) {
            viewPagerAdapter.removeItem(index);
        }
    }

    @Override
    public final void clearFragments() {
        viewPagerItems.clear();

        if (viewPagerAdapter != null) {
            viewPagerAdapter.clear();
        }
    }

    @Override
    public final int indexOfFragment(@NonNull final Class<? extends Fragment> fragmentClass) {
        Condition.INSTANCE.ensureNotNull(fragmentClass, "The fragment class may not be null");

        for (int i = 0; i < viewPagerItems.size(); i++) {
            ViewPagerItem item = viewPagerItems.get(i);

            if (item.getFragmentClass().equals(fragmentClass)) {
                return i;
            }
        }

        return -1;
    }

    @Override
    public final int getFragmentCount() {
        return viewPagerItems.size();
    }

    @Override
    public final TabPosition getTabPosition() {
        return tabPosition;
    }

    @Override
    public final void setTabPosition(@NonNull final TabPosition tabPosition) {
        Condition.INSTANCE.ensureNotNull(tabPosition, "The tab position may not be null");
        this.tabPosition = tabPosition;
        reInflateTabLayout();
        adaptTabLayout();
    }

    @Override
    public final boolean isTabLayoutEnabled() {
        return tabLayoutEnabled;
    }

    @Override
    public final void enableTabLayout(final boolean enable) {
        this.tabLayoutEnabled = enable;
        adaptTabLayoutEnableState();
    }

    @Override
    public final boolean isTabLayoutShown() {
        return tabLayoutShown;
    }

    @Override
    public final void showTabLayout(final boolean show) {
        this.tabLayoutShown = show;
        adaptTabLayoutVisibility();
    }

    @Override
    public final int getTabIndicatorHeight() {
        return tabIndicatorHeight;
    }

    @Override
    public final void setTabIndicatorHeight(final int height) {
        Condition.INSTANCE.ensureAtLeast(height, 1, "The height must be at least 1");
        this.tabIndicatorHeight = height;
        adaptTabIndicatorHeight();
    }

    @Override
    public final int getTabIndicatorColor() {
        return tabIndicatorColor;
    }

    @Override
    public final void setTabIndicatorColor(@ColorInt final int color) {
        this.tabIndicatorColor = color;
        adaptTabIndicatorColor();
    }

    @Override
    public final int getTabTextColor() {
        return tabTextColor;
    }

    @Override
    public final void setTabTextColor(@ColorInt final int textColor) {
        this.tabTextColor = textColor;
        adaptTabTextColor();
    }

    @Override
    public final int getTabSelectedTextColor() {
        return tabSelectedTextColor;
    }

    @Override
    public final void setTabSelectedTextColor(@ColorInt final int selectedTextColor) {
        this.tabSelectedTextColor = selectedTextColor;
        adaptTabTextColor();
    }

    @Override
    public final boolean isSwipeEnabled() {
        return swipeEnabled;
    }

    @Override
    public final void enableSwipe(final boolean enable) {
        this.swipeEnabled = enable;
        adaptViewPager();
    }

    @Override
    public final boolean isButtonBarShown() {
        return buttonBarShown;
    }

    @Override
    public final void showButtonBar(final boolean show) {
        this.buttonBarShown = show;
        adaptButtonBarVisibility();
    }

    @Override
    public final int getButtonTextColor() {
        return buttonTextColor;
    }

    @Override
    public final void setButtonTextColor(@ColorInt final int color) {
        this.buttonTextColor = color;
        adaptButtonTextColor();
    }

    @Override
    public final boolean isButtonBarDividerShown() {
        return showButtonBarDivider;
    }

    @Override
    public final void showButtonBarDivider(final boolean show) {
        this.showButtonBarDivider = show;
        adaptButtonBarDividerVisibility();
    }

    @Override
    public final int getButtonBarDividerColor() {
        return buttonBarDividerColor;
    }

    @Override
    public final void setButtonBarDividerColor(final int color) {
        this.buttonBarDividerColor = color;
        adaptButtonBarDividerColor();
    }

    @Override
    public final int getButtonBarDividerMargin() {
        return buttonBarDividerMargin;
    }

    @Override
    public final void setButtonBarDividerMargin(final int margin) {
        Condition.INSTANCE.ensureAtLeast(margin, 0, "The margin must be at least 0");
        this.buttonBarDividerMargin = margin;
        adaptButtonBarDividerMargin();
    }

    @Override
    public final CharSequence getBackButtonText() {
        return backButtonText;
    }

    @Override
    public final void setBackButtonText(@StringRes final int resourceId) {
        setBackButtonText(getContext().getText(resourceId));
    }

    @Override
    public final void setBackButtonText(@NonNull final CharSequence text) {
        Condition.INSTANCE.ensureNotNull(text, "The text may not be null");
        Condition.INSTANCE.ensureNotEmpty(text, "The text may not be empty");
        this.backButtonText = text;
        adaptBackButton();
    }

    @Override
    public final CharSequence getNextButtonText() {
        return nextButtonText;
    }

    @Override
    public final void setNextButtonText(@StringRes final int resourceId) {
        setNextButtonText(getContext().getText(resourceId));
    }

    @Override
    public final void setNextButtonText(@NonNull final CharSequence text) {
        Condition.INSTANCE.ensureNotNull(text, "The text may not be null");
        Condition.INSTANCE.ensureNotEmpty(text, "The text may not be empty");
        this.nextButtonText = text;
        adaptNextButton();
    }

    @Override
    public final CharSequence getFinishButtonText() {
        return finishButtonText;
    }

    @Override
    public final void setFinishButtonText(@StringRes final int resourceId) {
        setFinishButtonText(getContext().getText(resourceId));
    }

    @Override
    public final void setFinishButtonText(@NonNull final CharSequence text) {
        Condition.INSTANCE.ensureNotNull(text, "The text may not be null");
        Condition.INSTANCE.ensureNotEmpty(text, "The text may not be empty");
        this.finishButtonText = text;
        adaptFinishButton();
    }

    @Override
    public final void addWizardListener(@NonNull final WizardListener listener) {
        Condition.INSTANCE.ensureNotNull(listener, "The listener may not be null");
        wizardListeners.add(listener);
    }

    @Override
    public final void removeWizardListener(@NonNull final WizardListener listener) {
        Condition.INSTANCE.ensureNotNull(listener, "The listener may not be null");
        wizardListeners.remove(listener);
    }

    @Override
    public final void addOnPageChangeListener(@NonNull final OnPageChangeListener listener) {
        Condition.INSTANCE.ensureNotNull(listener, "The listener may not be null");
        onPageChangeListeners.add(listener);

        if (viewPager != null) {
            viewPager.addOnPageChangeListener(listener);
        }
    }

    @Override
    public final void removeOnPageChangeListener(@NonNull final OnPageChangeListener listener) {
        Condition.INSTANCE.ensureNotNull(listener, "The listener may not be null");
        onPageChangeListeners.remove(listener);

        if (viewPager != null) {
            viewPager.removeOnPageChangeListener(listener);
        }
    }

    @Override
    public final void onPageScrolled(final int position, final float positionOffset,
                                     final int positionOffsetPixels) {

    }

    @Override
    public final void onPageSelected(final int position) {
        adaptButtonVisibility();
    }

    @Override
    public final void onPageScrollStateChanged(final int state) {

    }

    @Override
    public final void onSaveInstanceState(@NonNull final Bundle outState) {
        outState.putInt(TAB_POSITION_EXTRA, getTabPosition().getValue());
        outState.putBoolean(TAB_LAYOUT_ENABLED_EXTRA, isTabLayoutEnabled());
        outState.putBoolean(TAB_LAYOUT_SHOWN_EXTRA, isTabLayoutShown());
        outState.putInt(TAB_INDICATOR_HEIGHT_EXTRA, getTabIndicatorHeight());
        outState.putInt(TAB_INDICATOR_COLOR_EXTRA, getTabIndicatorColor());
        outState.putInt(TAB_TEXT_COLOR_EXTRA, getTabTextColor());
        outState.putInt(TAB_SELECTED_TEXT_COLOR_EXTRA, getTabSelectedTextColor());
        outState.putBoolean(SWIPE_ENABLED_EXTRA, isSwipeEnabled());
        outState.putBoolean(BUTTON_BAR_SHOWN_EXTRA, isButtonBarShown());
        outState.putInt(BUTTON_TEXT_COLOR_EXTRA, getButtonTextColor());
        outState.putBoolean(SHOW_BUTTON_BAR_DIVIDER_EXTRA, isButtonBarDividerShown());
        outState.putInt(BUTTON_BAR_DIVIDER_COLOR_EXTRA, getButtonBarDividerColor());
        outState.putInt(BUTTON_BAR_DIVIDER_MARGIN_EXTRA, getButtonBarDividerMargin());
        outState.putCharSequence(BACK_BUTTON_TEXT_EXTRA, getBackButtonText());
        outState.putCharSequence(NEXT_BUTTON_TEXT_EXTRA, getNextButtonText());
        outState.putCharSequence(FINISH_BUTTON_TEXT_EXTRA, getFinishButtonText());
        outState.putParcelableArrayList(VIEW_PAGER_ITEMS_EXTRA,
                getDialog().getRetainInstance() ? null : viewPagerItems);
    }

    @Override
    public final void onRestoreInstanceState(@NonNull final Bundle savedInstanceState) {
        setTabPosition(TabPosition.fromValue(savedInstanceState.getInt(TAB_POSITION_EXTRA)));
        enableTabLayout(savedInstanceState.getBoolean(TAB_LAYOUT_ENABLED_EXTRA));
        showTabLayout(savedInstanceState.getBoolean(TAB_LAYOUT_SHOWN_EXTRA));
        setTabIndicatorHeight(savedInstanceState.getInt(TAB_INDICATOR_HEIGHT_EXTRA));
        setTabIndicatorColor(savedInstanceState.getInt(TAB_INDICATOR_COLOR_EXTRA));
        setTabTextColor(savedInstanceState.getInt(TAB_TEXT_COLOR_EXTRA));
        setTabSelectedTextColor(savedInstanceState.getInt(TAB_SELECTED_TEXT_COLOR_EXTRA));
        enableSwipe(savedInstanceState.getBoolean(SWIPE_ENABLED_EXTRA));
        showButtonBar(savedInstanceState.getBoolean(BUTTON_BAR_SHOWN_EXTRA));
        setButtonTextColor(savedInstanceState.getInt(BUTTON_TEXT_COLOR_EXTRA));
        showButtonBarDivider(savedInstanceState.getBoolean(SHOW_BUTTON_BAR_DIVIDER_EXTRA));
        setButtonBarDividerColor(savedInstanceState.getInt(BUTTON_BAR_DIVIDER_COLOR_EXTRA));
        setButtonBarDividerMargin(savedInstanceState.getInt(BUTTON_BAR_DIVIDER_MARGIN_EXTRA));
        CharSequence backButtonText = savedInstanceState.getCharSequence(BACK_BUTTON_TEXT_EXTRA);
        CharSequence nextButtonText = savedInstanceState.getCharSequence(NEXT_BUTTON_TEXT_EXTRA);
        CharSequence finishButtonText =
                savedInstanceState.getCharSequence(FINISH_BUTTON_TEXT_EXTRA);

        if (!TextUtils.isEmpty(backButtonText)) {
            setBackButtonText(backButtonText);
        }

        if (!TextUtils.isEmpty(nextButtonText)) {
            setNextButtonText(nextButtonText);
        }

        if (!TextUtils.isEmpty(finishButtonText)) {
            setFinishButtonText(finishButtonText);
        }

        ArrayList<ViewPagerItem> viewPagerItems =
                savedInstanceState.getParcelableArrayList(VIEW_PAGER_ITEMS_EXTRA);

        if (viewPagerItems != null) {
            for (ViewPagerItem item : viewPagerItems) {
                addFragment(item.getTitle(), item.getFragmentClass(), item.getArguments());
            }
        }
    }

    @NonNull
    @Override
    protected final Map<ViewType, View> onAttach(@NonNull final Window window,
                                                 @NonNull final View view,
                                                 @NonNull final Map<ViewType, View> areas,
                                                 @NonNull final FragmentManager fragmentManager) {
        View headerView = areas.get(new AreaViewType(Area.HEADER));
        View contentView = areas.get(new AreaViewType(Area.CONTENT));

        if (headerView != null && contentView != null) {
            View viewPagerView = contentView.findViewById(R.id.view_pager);

            if (viewPagerView instanceof ViewPager) {
                View inflatedView = inflateButtonBar();

                if (inflatedView != null) {
                    viewPager = (ViewPager) viewPagerView;
                    viewPager.setDialog(getDialog());
                    viewPager.addOnPageChangeListener(this);
                    viewPagerAdapter =
                            new ViewPagerAdapter(getContext(), fragmentManager, viewPagerItems);

                    for (OnPageChangeListener listener : onPageChangeListeners) {
                        viewPager.addOnPageChangeListener(listener);
                    }

                    viewPager.setAdapter(viewPagerAdapter);
                    inflateTabLayout(headerView, contentView);
                    adaptTabLayout();
                    adaptViewPager();
                    adaptButtonTextColor();
                    adaptBackButton();
                    adaptNextButton();
                    adaptFinishButton();
                    adaptButtonBarVisibility();
                    adaptButtonBarDividerVisibility();
                    adaptButtonBarDividerColor();
                    adaptButtonBarDividerMargin();
                    adaptButtonVisibility();
                    Map<ViewType, View> result = new HashMap<>();
                    result.put(new AreaViewType(Area.BUTTON_BAR), inflatedView);
                    return result;
                }
            }
        }

        return Collections.emptyMap();
    }

    @Override
    protected final void onDetach() {
        if (buttonBarContainer != null) {
            buttonBarContainer.removeAllViews();
            buttonBarContainer = null;
        }

        tabLayout = null;
        viewPager = null;
        viewPagerAdapter = null;
        backButton = null;
        nextButton = null;
        finishButton = null;
        buttonBarDivider = null;
    }

}


text:
CKEDITOR.plugins.setLang( 'pastefromword', 'it', {
	confirmCleanup: 'Il testo da incollare sembra provenire da Word. Desideri pulirlo prima di incollare?',
	error: 'Non è stato possibile eliminare il testo incollato a causa di un errore interno.',
	title: 'Incolla da Word',
	toolbar: 'Incolla da Word'
});

redpajama_set_name: RedPajamaGithub


text:
/**
 * Calculate and assign x/y positions of all nodes in the given tree.
 */
DeltaJS.xcc.layout_tree = function(root, nx, ny, xinit) {
    // x position for new leaf nodes
    var mx = xinit || 1;

    // Visit nodes in postorder
    root.forEachPostorder(function(node) {
        if (node.children.length === 0) {
            // leaf node
            node.x = mx;
            node.y = ny * node.depth;
            mx += nx;
        }
        else {
            // internal node
            node.x = node.children[0].x / 2 +
                node.children[node.children.length-1].x / 2;
            node.y = ny * node.depth;
        }
    });

    return mx;
};

/**
 * Parse a string of the form 'r +a ++a1 ++a2 +b +c ++c1 ++c2' into a tree
 * structure.
 */
DeltaJS.xcc.parse_tree = function(str) {
    // Split input string, use plus-sign as separator.
    var s = str.split(/\+/),
        parents = [],
        depth = 0,
        root;

    if (s.length === 0) {
        return;
    }

    // Create root node
    root = new DeltaJS.tree.Node(s.shift().trim());
    parents[0] = root;

    s.forEach(function(label) {
        var node;
        label = label.trim();
        if (label) {
            node = new DeltaJS.tree.Node(label);
            parents[depth].append(node);
            parents[depth+1] = node;
            depth = 0;
        }
        else {
            // An empty string is produced by adjacent plus-signs. Increase
            // depth.
            depth++;
        }
    });

    return root;
};


text:
namespace SSS_Windows_Forms.Forms.Coordinator
{
    partial class TutorRatingsAListModal
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.components = new System.ComponentModel.Container();
            this.reportViewer1 = new Microsoft.Reporting.WinForms.ReportViewer();
            this.SuspendLayout();
            this.reportViewer1.Dock = System.Windows.Forms.DockStyle.Fill;
            this.reportViewer1.LocalReport.ReportEmbeddedResource = "SSS_Windows_Forms.Reports.Coordinator.LowTutorRating.TutorA.rdlc";
            this.reportViewer1.Location = new System.Drawing.Point(0, 0);
            this.reportViewer1.Name = "reportViewer1";
            this.reportViewer1.Size = new System.Drawing.Size(762, 539);
            this.reportViewer1.TabIndex = 0;
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(762, 539);
            this.ControlBox = false;
            this.Controls.Add(this.reportViewer1);
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
            this.Name = "TutorRatingsAListModal";
            this.Text = "LowTutorRatingsModal";
            this.Load += new System.EventHandler(this.LowTutorRatingsModal_Load);
            this.ResumeLayout(false);

        }

        #endregion

        private Microsoft.Reporting.WinForms.ReportViewer reportViewer1;
    }
}


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>OriginStamp Demo: JS Form Listener</title>

    <form class="originstamp">
      <input type="file" data-originstamp="content"/>
      <button type="submit">Submit your data</button>
    </form>


text:
// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package org.chromium.chrome.browser.media.ui;

import static org.mockito.Mockito.anyInt;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;

import android.content.res.Resources;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;

import org.robolectric.annotation.Implementation;
import org.robolectric.annotation.Implements;
import org.robolectric.shadows.ShadowResources;

/**
 * Dummy Robolectric shadow for Android Resources for MediaNotification tests.
 */
@Implements(Resources.class)
public class MediaNotificationTestShadowResources extends ShadowResources {
    public static final Resources sResources;

    static {
        sResources = mock(Resources.class);
        doReturn("mocked text").when(sResources).getText(anyInt());
        doReturn("mocked resource name").when(sResources).getResourceName(anyInt());
    }

    @Implementation
    public CharSequence getText(int id) {
        return sResources.getText(id);
    }

    @Implementation
    public CharSequence getResourceName(int id) {
        return sResources.getResourceName(id);
    }

    @Implementation
    public Drawable getDrawable(int id, Resources.Theme theme) {
        return new ColorDrawable(Color.RED);
    }
}


text:
package buffer

import (
	"testing"

	. "github.com/smartystreets/goconvey/convey"
	. "go.chromium.org/luci/common/testing/assertions"
)

func TestMovingAverage(t *testing.T) {
	Convey(`movingAverage`, t, func() {

		Convey(`construction`, func() {
			Convey(`panics on bad window`, func() {
				So(func() {
					newMovingAverage(0, 100)
				}, ShouldPanicLike, "window must be")
			})
		})

		Convey(`usage`, func() {
			ma := newMovingAverage(10, 17)

			Convey(`avg matches seed`, func() {
				So(ma.get(), ShouldEqual, 17.0)
			})

			Convey(`adding new data changes the average`, func() {
				ma.record(100)
				So(ma.get(), ShouldEqual, 25.3)
			})

			Convey(`adding a lot of data is fine`, func() {
				for i := 0; i < 100; i++ {
					ma.record(100)
				}
				So(ma.get(), ShouldEqual, 100.0)
			})
		})

	})
}


text:
{% extends "base.html" %}

{% block body %}

                <form class="bs-example form-horizontal" method="post" action="">
                    {% csrf_token %}
                    <fieldset>
                        <legend>Create a New Account</legend>
                        {% if messages %}
                            {% for message in messages %}

                                    <button type="button" class="close" data-dismiss="alert">×</button>
                                    {{ message }}

                            {% endfor %}
                        {% endif %}
                        {% if form.non_field_errors %}

                                <button type="button" class="close" data-dismiss="alert">×</button>
                                {{ form.non_field_errors }}

                        {% endif %}

                            Registering for this site will create a new user account for you via
                            Stormpath, then log you in
                            automatically.

                            <button type="button" class="close" data-dismiss="alert">×</button>
                            NOTE Your password must be between 8 and 100
                            characters, and must contain lowercase letters, uppercase letters,
                            and numbers.

                            Username

                                <input type="text" class="form-control" id="username" name="username" placeholder="Username" {% if form.username.value %}value={{ form.username.value }}{% endif %} autofocus>
                                {% if form.username.errors %}

                                        {% for error in form.username.errors %}{{ error }}{% endfor %}

                                {% endif %}

                            Email

                                <input type="email" class="form-control" id="email" name="email" placeholder="E-mail" {% if form.email.value %}value={{ form.email.value }}{% endif %}>
                                {% if form.email.errors %}

                                        {% for error in form.email.errors %}{{ error }}{% endfor %}

                                {% endif %}

                            Given name

                                <input type="text" class="form-control" id="given_name" name="given_name" placeholder="Given name" {% if form.given_name.value %}value={{ form.given_name.value }}{% endif %}>
                                {% if form.given_name.errors %}

                                        {% for error in form.given_name.errors %}{{ error }}{% endfor %}

                                {% endif %}

                            Surname

                                <input type="text" class="form-control" id="surname" name="surname" placeholder="Surname" {% if form.surname.value %}value={{ form.surname.value }}{% endif %}>
                                {% if form.surname.errors %}

                                        {% for error in form.surname.errors %}{{ error }}{% endfor %}

                                {% endif %}

                            Password

                                <input type="password" class="form-control" id="password1" name="password1" placeholder="Password">
                                {% if form.password1.errors %}

                                        {% for error in form.password1.errors %}{{ error }}{% endfor %}

                                {% endif %}

                            Password confirmation

                                <input type="password" class="form-control" id="password2" name="password2" placeholder="Password">
                                {% if form.password2.errors %}

                                        {% for error in form.password2.errors %}{{ error }}{% endfor %}

                                {% endif %}

                                <button type="submit" class="btn btn-primary">Register</button>

                    </fieldset>
                </form>

A Note About Stormpath Security

                    In a real environment, you should only deploy your application
                    behind SSL / TLS to avoid having user credentials sent in plain text
                    over the network.

                    Stormpath user creation is incredibly secure, is not susceptible to any
                    known vulnerabilities (MITM, hashing issues, replay attacks, etc.), and
                    provides you with a number of options to improve security (including
                    built-in email verification, among other things).  We will not verify
                    your account by email now, but this can be easily enabled.

                    Stormpath can also be configured to allow for weaker (or force stronger)
                    passwords, so it can fit into any application workflow.

{% endblock %}


text:
module ActiveWindowX

  # binding for XClientMessageEvent on X11
  class ClientMessageEvent < Event

    # the number of last request processed by server
    attr_reader :serial

    # true if this came from a SendEvent request
    attr_reader :send_event

    # Display the event was read from
    attr_reader :display

    # the window whose associated property was changed
    attr_reader :window

    # an atom that indicates how the data should be interpreted
    # by the receiving client
    attr_reader :message_type

    # 8, 16, or 32 and specifies whether the data should be viewed
    # as a list of bytes, shorts, or longs
    attr_reader :format

    # a union that contains the members b, s, and l.  The b, s, and l members
    # represent data of twenty 8-bit values, ten 16-bit values,
    # and five 32-bit values
    attr_reader :data

    def initialize display, raw
      super
      @serial = raw.serial
      @send_event = (raw.send_event != 0)
      @display = display
      @window = Window.new display, raw.window
      @message_type = Atom.new display, raw.message_type
      @format = raw.message_type
      @data = raw.data
    end
  end
end


text:
namespace android.widget
{
	[global::MonoJavaBridge.JavaClass()]
	public partial class Scroller : java.lang.Object
	{
		internal new static global::MonoJavaBridge.JniGlobalHandle staticClass;
		protected Scroller(global::MonoJavaBridge.JNIEnv @__env) : base(@__env)
		{
		}
		public new int Duration
		{
			get
			{
				return getDuration();
			}
		}
		private static global::MonoJavaBridge.MethodId _m0;
		public virtual int getDuration()
		{
			return global::MonoJavaBridge.JavaBridge.CallIntMethod(this, global::android.widget.Scroller.staticClass, "getDuration", "()I", ref global::android.widget.Scroller._m0);
		}
		private static global::MonoJavaBridge.MethodId _m1;
		public virtual bool isFinished()
		{
			return global::MonoJavaBridge.JavaBridge.CallBooleanMethod(this, global::android.widget.Scroller.staticClass, "isFinished", "()Z", ref global::android.widget.Scroller._m1);
		}
		private static global::MonoJavaBridge.MethodId _m2;
		public virtual void forceFinished(bool arg0)
		{
			global::MonoJavaBridge.JavaBridge.CallVoidMethod(this, global::android.widget.Scroller.staticClass, "forceFinished", "(Z)V", ref global::android.widget.Scroller._m2, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0));
		}
		public new int CurrX
		{
			get
			{
				return getCurrX();
			}
		}
		private static global::MonoJavaBridge.MethodId _m3;
		public virtual int getCurrX()
		{
			return global::MonoJavaBridge.JavaBridge.CallIntMethod(this, global::android.widget.Scroller.staticClass, "getCurrX", "()I", ref global::android.widget.Scroller._m3);
		}
		public new int CurrY
		{
			get
			{
				return getCurrY();
			}
		}
		private static global::MonoJavaBridge.MethodId _m4;
		public virtual int getCurrY()
		{
			return global::MonoJavaBridge.JavaBridge.CallIntMethod(this, global::android.widget.Scroller.staticClass, "getCurrY", "()I", ref global::android.widget.Scroller._m4);
		}
		public new int StartX
		{
			get
			{
				return getStartX();
			}
		}
		private static global::MonoJavaBridge.MethodId _m5;
		public virtual int getStartX()
		{
			return global::MonoJavaBridge.JavaBridge.CallIntMethod(this, global::android.widget.Scroller.staticClass, "getStartX", "()I", ref global::android.widget.Scroller._m5);
		}
		public new int StartY
		{
			get
			{
				return getStartY();
			}
		}
		private static global::MonoJavaBridge.MethodId _m6;
		public virtual int getStartY()
		{
			return global::MonoJavaBridge.JavaBridge.CallIntMethod(this, global::android.widget.Scroller.staticClass, "getStartY", "()I", ref global::android.widget.Scroller._m6);
		}
		public new int FinalX
		{
			get
			{
				return getFinalX();
			}
			set
			{
				setFinalX(value);
			}
		}
		private static global::MonoJavaBridge.MethodId _m7;
		public virtual int getFinalX()
		{
			return global::MonoJavaBridge.JavaBridge.CallIntMethod(this, global::android.widget.Scroller.staticClass, "getFinalX", "()I", ref global::android.widget.Scroller._m7);
		}
		public new int FinalY
		{
			get
			{
				return getFinalY();
			}
			set
			{
				setFinalY(value);
			}
		}
		private static global::MonoJavaBridge.MethodId _m8;
		public virtual int getFinalY()
		{
			return global::MonoJavaBridge.JavaBridge.CallIntMethod(this, global::android.widget.Scroller.staticClass, "getFinalY", "()I", ref global::android.widget.Scroller._m8);
		}
		private static global::MonoJavaBridge.MethodId _m9;
		public virtual bool computeScrollOffset()
		{
			return global::MonoJavaBridge.JavaBridge.CallBooleanMethod(this, global::android.widget.Scroller.staticClass, "computeScrollOffset", "()Z", ref global::android.widget.Scroller._m9);
		}
		private static global::MonoJavaBridge.MethodId _m10;
		public virtual void startScroll(int arg0, int arg1, int arg2, int arg3)
		{
			global::MonoJavaBridge.JavaBridge.CallVoidMethod(this, global::android.widget.Scroller.staticClass, "startScroll", "(IIII)V", ref global::android.widget.Scroller._m10, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg1), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg2), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg3));
		}
		private static global::MonoJavaBridge.MethodId _m11;
		public virtual void startScroll(int arg0, int arg1, int arg2, int arg3, int arg4)
		{
			global::MonoJavaBridge.JavaBridge.CallVoidMethod(this, global::android.widget.Scroller.staticClass, "startScroll", "(IIIII)V", ref global::android.widget.Scroller._m11, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg1), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg2), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg3), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg4));
		}
		private static global::MonoJavaBridge.MethodId _m12;
		public virtual void fling(int arg0, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7)
		{
			global::MonoJavaBridge.JavaBridge.CallVoidMethod(this, global::android.widget.Scroller.staticClass, "fling", "(IIIIIIII)V", ref global::android.widget.Scroller._m12, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg1), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg2), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg3), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg4), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg5), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg6), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg7));
		}
		private static global::MonoJavaBridge.MethodId _m13;
		public virtual void abortAnimation()
		{
			global::MonoJavaBridge.JavaBridge.CallVoidMethod(this, global::android.widget.Scroller.staticClass, "abortAnimation", "()V", ref global::android.widget.Scroller._m13);
		}
		private static global::MonoJavaBridge.MethodId _m14;
		public virtual void extendDuration(int arg0)
		{
			global::MonoJavaBridge.JavaBridge.CallVoidMethod(this, global::android.widget.Scroller.staticClass, "extendDuration", "(I)V", ref global::android.widget.Scroller._m14, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0));
		}
		private static global::MonoJavaBridge.MethodId _m15;
		public virtual int timePassed()
		{
			return global::MonoJavaBridge.JavaBridge.CallIntMethod(this, global::android.widget.Scroller.staticClass, "timePassed", "()I", ref global::android.widget.Scroller._m15);
		}
		private static global::MonoJavaBridge.MethodId _m16;
		public virtual void setFinalX(int arg0)
		{
			global::MonoJavaBridge.JavaBridge.CallVoidMethod(this, global::android.widget.Scroller.staticClass, "setFinalX", "(I)V", ref global::android.widget.Scroller._m16, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0));
		}
		private static global::MonoJavaBridge.MethodId _m17;
		public virtual void setFinalY(int arg0)
		{
			global::MonoJavaBridge.JavaBridge.CallVoidMethod(this, global::android.widget.Scroller.staticClass, "setFinalY", "(I)V", ref global::android.widget.Scroller._m17, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0));
		}
		private static global::MonoJavaBridge.MethodId _m18;
		public Scroller(android.content.Context arg0) : base(global::MonoJavaBridge.JNIEnv.ThreadEnv)
		{
			global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
			if (global::android.widget.Scroller._m18.native == global::System.IntPtr.Zero)
				global::android.widget.Scroller._m18 = @__env.GetMethodIDNoThrow(global::android.widget.Scroller.staticClass, "<init>", "(Landroid/content/Context;)V");
			global::MonoJavaBridge.JniLocalHandle handle = @__env.NewObject(android.widget.Scroller.staticClass, global::android.widget.Scroller._m18, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0));
			Init(@__env, handle);
		}
		private static global::MonoJavaBridge.MethodId _m19;
		public Scroller(android.content.Context arg0, android.view.animation.Interpolator arg1) : base(global::MonoJavaBridge.JNIEnv.ThreadEnv)
		{
			global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
			if (global::android.widget.Scroller._m19.native == global::System.IntPtr.Zero)
				global::android.widget.Scroller._m19 = @__env.GetMethodIDNoThrow(global::android.widget.Scroller.staticClass, "<init>", "(Landroid/content/Context;Landroid/view/animation/Interpolator;)V");
			global::MonoJavaBridge.JniLocalHandle handle = @__env.NewObject(android.widget.Scroller.staticClass, global::android.widget.Scroller._m19, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg1));
			Init(@__env, handle);
		}
		static Scroller()
		{
			global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
			global::android.widget.Scroller.staticClass = @__env.NewGlobalRef(@__env.FindClass("android/widget/Scroller"));
		}
	}
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<feed xml:lang="en-US" xmlns="http://www.w3.org/2005/Atom" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:georss="http://www.georss.org/georss"
    xmlns:activity="http://activitystrea.ms/spec/1.0/" xmlns:media="http://purl.org/syndication/atommedia" xmlns:poco="http://portablecontacts.net/spec/1.0"
    xmlns:ostatus="http://ostatus.org/schema/1.0" xmlns:statusnet="http://status.net/schema/api/1/">
    <generator uri="https://gnu.io/social" version="1.2.0-beta4">GNU social</generator>
    <id>tag:gs1.karp.id.au,2017-01-16:PublicTimeline</id>
    <title>gs1test public timeline</title>
    <subtitle>gs1test updates from everyone!</subtitle>
    <logo>https://gs1.karp.id.au/theme/neo-gnu/logo.png</logo>
    <updated>2017-01-16T10:11:39+00:00</updated>
    <link href="https://gs1.karp.id.au/main/public" rel="alternate" type="text/html" />
    <link href="https://gs1.karp.id.au/api/statuses/public_timeline.atom?count=1&page=1" rel="self" type="application/atom+xml"
    />
    <entry>
        <activity:object-type>http://activitystrea.ms/schema/1.0/note</activity:object-type>
        <id>tag:gs1.karp.id.au,2017-01-16:noticeId=14:objectType=note</id>
        <title>New note by user1</title>
        <content type="html">pgp yo https://gs1.karp.id.au/attachment/1</content>
        <link rel="alternate" type="text/html" href="https://gs1.karp.id.au/notice/14" />
        <status_net notice_id="14"></status_net>
        <activity:verb>http://activitystrea.ms/schema/1.0/post</activity:verb>
        <published>2017-01-16T10:11:03+00:00</published>
        <updated>2017-01-16T10:11:03+00:00</updated>
        <author>
            <activity:object-type>http://activitystrea.ms/schema/1.0/person</activity:object-type>
            <uri>https://gs1.karp.id.au/user/2</uri>
            <name>user1</name>
            <link rel="alternate" type="text/html" href="https://gs1.karp.id.au/user1" />
            <link rel="avatar" type="image/png" media:width="96" media:height="96" href="https://gs1.karp.id.au/theme/neo-gnu/default-avatar-profile.png"
            />
            <link rel="avatar" type="image/png" media:width="48" media:height="48" href="https://gs1.karp.id.au/theme/neo-gnu/default-avatar-stream.png"
            />
            <link rel="avatar" type="image/png" media:width="24" media:height="24" href="https://gs1.karp.id.au/theme/neo-gnu/default-avatar-mini.png"
            />
            <poco:preferredUsername>user1</poco:preferredUsername>
            <poco:displayName>user1</poco:displayName>
            <followers url="https://gs1.karp.id.au/user1/subscribers"></followers>
            <statusnet:profile_info local_id="2"></statusnet:profile_info>
        </author>
        <link rel="ostatus:conversation" href="https://gs1.karp.id.au/conversation/7" />
        <ostatus:conversation href="https://gs1.karp.id.au/conversation/7" local_id="7" ref="tag:gs1.karp.id.au,2017-01-16:objectType=thread:nonce=32c12108519521c8">tag:gs1.karp.id.au,2017-01-16:objectType=thread:nonce=32c12108519521c8</ostatus:conversation>
        <link rel="mentioned" ostatus:object-type="http://activitystrea.ms/schema/1.0/collection" href="http://activityschema.org/collection/public"
        />
        <link rel="enclosure" href="https://gs1.karp.id.au/file/cc38cb87dc2b955f3b7b6630b2d6e6506df65b4166fbabe8d5a08b27678d4b1c.png"
            type="image/png" length="32470" />
        <source>
        <id>https://gs1.karp.id.au/api/statuses/user_timeline/2.atom</id>
        <title>user1</title>
        <link rel="alternate" type="text/html" href="https://gs1.karp.id.au/user1" />
        <link rel="self" type="application/atom+xml" href="https://gs1.karp.id.au/api/statuses/user_timeline/2.atom" />
        <link rel="license" href="https://creativecommons.org/licenses/by/3.0/" />
        <icon>https://gs1.karp.id.au/theme/neo-gnu/default-avatar-profile.png</icon>
        <updated>2017-01-16T10:11:03+00:00</updated>
        </source>
        <link rel="self" type="application/atom+xml" href="https://gs1.karp.id.au/api/statuses/show/14.atom" />
        <link rel="edit" type="application/atom+xml" href="https://gs1.karp.id.au/api/statuses/show/14.atom" />
        <statusnet:notice_info local_id="14" source="web"></statusnet:notice_info>
    </entry>
    </feed>


text:
+++
hook = "TODO"
published_at = 2018-07-19T15:32:08Z
title = "Who wrote that shitty code?"
+++

## Redux (#redux)

There is something you can do.

The next time you find yourself thinking, "well this is the
wrong thing to do, but I have to get this done," stop
yourself and _don't_.


text:
<select name="" data-ng-model="fake"
data-fx-prop-input class="form-control" data-ng-options="query.id as query.Name for query in possibletracdown">
	<option value="" ></option>
</select>


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<link rel="stylesheet" type="text/css" href="./css/style.css"/>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
<meta name="author" value="Apache JMeter Project">
<meta name="email" value="dev.AT.jmeter.DOT.apache.DOT.org">

<title>Apache JMeter - Mailing Lists</title>

 Tweet

 Follow

About

Overview

Changes

Subscribe to What's New

JMeter on Twitter

Issue Tracking

License

Contributors

Download

Download Releases

Developer (Nightly) Builds

Documentation

User Manual

Best Practices

Component Reference

Functions Reference

Javadocs

Localisation (Translator's Guide)

Building JMeter and Add-Ons

JMeter Wiki

FAQ (Wiki)

Tutorials (PDF format)

Distributed Testing

Recording Tests

JUnit Sampler

Access Log Sampler

Extending JMeter

Community

Mailing Lists

SVN Repositories

Foundation

ASF

Get Involved in the ASF

Sponsorship

Thanks

Mailing Lists - Guidelines

A mailing list is an electronic discussion forum that anyone can
subscribe to. When someone sends an email message to the mailing list,
a copy of that message is broadcast to everyone who is subscribed to
that mailing list. Mailing lists provide a simple and effective
communication mechanism. With potentially thousands of subscribers,
there is a common set of etiquette guidelines that you should observe.
Please keep on reading.

Please note that usage of these mailing lists is subject to the

Public Forum Archive Policy

.

      Respect the mailing list type

 There are generally two types of lists.

    The "User" lists where you can send questions and comments about
    configuration, setup, usage and other "user" types of questions.

    The "Developer" lists where you can send questions and
    comments about the actual software source code and general
    "development" types of questions.

Some questions are appropriate for posting on both the "user" and
the "developer" lists. In this case, pick one and only one. Do not
cross post.

Asking a configuration question on the developers list is frowned
upon because developers' time is as precious as yours. By contacting
them directly instead of the user base you are abusing resources. In
fact, it is unlikely that you will get a quicker answer, if at
all.

      Join the lists that are appropriate for your discussion.

Please make sure that you are joining the list that is appropriate for the
topic or product that you would like to discuss. For example,
please do not join the Regexp mailing list and ask questions about Tomcat.
Instead, you should join the Tomcat User list and ask your questions
there.

    Ask smart questions.

Every volunteer project obtains its strength from the people involved
in it. You are welcome to join any of our mailing lists.  You can
choose to lurk, or actively participate; it's up to you.  The level of
community responsiveness to specific questions is generally directly
proportional to the amount of effort you spend formulating your
question. Eric Raymond and Rick Moen have even written an essay entitled

"

Asking
Smart Questions

"

 precisely on this topic.  Although somewhat
militant, it is definitely worth reading.

Note

: Please do NOT send your Java problems to the two authors. They welcome feedback on the FAQ's contents, but are simply not a Java help resource. Follow the essay's advice and

choose your forum

 carefully.

    Give feedback when you get a good answer.

If an answer given to you helped you solve your problem then send a mail saying so and don't forget to say

THANKS

.
If you fixed the problem yourself then contribute to the mailing list by writing how you solved your issue.
Giving feedback is useful to people who faced/will face same problems as you and will be your way
to contribute to the project. Don't forget that people answering your questions are volunteers
doing so on their personal time.

    Keep your email short and to the point; use a suitable subject line.

If your email is more than about a page of text, chances are that it
won't get read by very many people. It is much better to try to pack a
lot of informative information (see above about asking smart questions)
into as small of an email as possible. If you are replying to a previous
email, it is a good idea to only quote the parts that you are replying
to and to remove the unnecessary bits. This makes it easier for people
to follow a thread as well as making the email archives easier to search
and read.

    Start a new thread for a new topic

When asing a new question, please start a new thread with an appropriate new subject line.
This makes it easier to read, and to find later in the archives.

    Do your best to ensure that you are not sending HTML or
    "Stylelized" email to the list.

If you are using Outlook or Outlook Express or Eudora, chances are that
you are sending HTML email by default. There is usually a setting that
will allow you to send "Plain Text" email. If you are using Microsoft
products to send email, there are several bugs in the software that
prevent you from turning off the sending of HTML email.

Please don't send attachments or include large chunks of code

Attachments can be difficult to read and are rarely needed by all recipients.
Some mailing lists are set up to drop them.
If you need to send more than a few lines of code, ask first.
Note that code is often mangled by word-wrapping, so it is better to provide a link to a downloadable file.
If necessary, arrange with the person(s) responding to the posting how best to give access to the data,
should it prove necessary.

    Watch where you are sending email.

The majority of our mailing lists have set the Reply-To to go back to the
list. That means that when you Reply to a message, it will go to the list
and not to the original author directly. The reason is because it helps
facilitate discussion on the list for everyone to benefit from. Be careful
of this as sometimes you may intend to reply to a message directly to someone
instead of the entire list.

The appropriate contents of the Reply-To header is an age-old debate that
should not be brought up on the mailing lists.  You can
examine opposing points of view

condemning

our convention and

condoning

it.  Bringing this up for debate on a mailing list will add nothing
new and is considered off-topic.

    Do not cross post messages.

In other words, pick a mailing list and send your messages to that mailing
list only. Do not send your messages to multiple mailing lists. The reason is
that people may be subscribed to one list and not to the other. Therefore,
some people will only see part of the conversation.

Conclusion

Now that you have read the guidelines above

,

here

 is the page that gives
you a listing of the different mailing lists that you can join. If you
managed to find this without reading the above information, chances
are you will be sent back here. You might as well read it now and save
yourself the embarrassment.

Copyright © 1999-2013, Apache Software Foundation

Apache, Apache JMeter, JMeter, the Apache feather, and the Apache JMeter logo are
trademarks of the Apache Software Foundation.


text:
import Graphics from '../common/Graphics';

const SPRITE_WIDTH = 234;

export default class ColorIndicator {
  constructor(phaserGame) {
    this.game = phaserGame;
  }

  appendTo(entity) {
    this.sprite = this.createSpriteByParent(entity);

    // Add the selection to the appropriate graphics group as per its type
    const groupName = 'color-indicators';
    Graphics.getInstance()
      .getGroup(groupName)
      .add(this.sprite);

    entity.on('remove', this.remove.bind(this));
    entity.on('hibernate', this.hide.bind(this));
    entity.on('reactivated', this.show.bind(this));

    // the sprite is not a child of the entity for various overlapping issues
    // therefore it needs to follow it upon every tick
    this.sprite.update = function update() {
      this.x = entity.getSprite().x;
      this.y = entity.getSprite().y;
    };

    this.parent = entity;
  }

  createSpriteByParent(entity) {
    const team = entity.getPlayer().getTeam();
    const width = entity.getDataObject().getWidth();
    const ratio = width / SPRITE_WIDTH * 1.75;
    const sprite = this.game.add.image(0, 0, 'color-indicator');

    sprite.visible = true;
    sprite.anchor.setTo(0.5, 0.5);
    sprite.scale.setTo(ratio, ratio);
    sprite.frame = team - 1;

    return sprite;
  }

  show() {
    this.sprite.visible = true;
  }

  hide() {
    this.sprite.visible = false;
  }

  remove() {
    this.sprite.destroy(true);
  }
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using ObserverPattern.WeatherApp.Observer;
using ObserverPattern.WeatherApp.Subject;

namespace ObserverPattern
{
  class Program
  {
    static void Main(string[] args)
    {
      //StockInvestorExample();

      NotifyWeatherData();

      Console.ReadKey();
    }

    private static void NotifyWeatherData()
    {
      ISubject weatherData = new WeatherData();
      IObserver dogObserver = new ObserverObject("Dog");
      IObserver duckObserver = new ObserverObject("Duckling");
      IObserver sheepObserver = new ObserverObject("Sheep");
      IObserver cowObserver = new ObserverObject("CowOx");

      weatherData.RegisterObserver(dogObserver);
      weatherData.RegisterObserver(cowObserver);
      weatherData.RegisterObserver(sheepObserver);
      weatherData.RegisterObserver(duckObserver);

      weatherData.NotifyObserver(sheepObserver);

      weatherData.NotifyAll();
    }

    private static void StockInvestorExample()
    {
      var stockList = new List<IStock>();
      IStock ibmStock = new Stock("IBM", 12.34);
      IStock hclStock = new Stock("HCL", 02.98);
      IStock pslStock = new Stock("PSL", 16.67);
      IStock msStock = new Stock("MS", 20.3);

      stockList.Add(ibmStock);
      stockList.Add(hclStock);
      stockList.Add(pslStock);
      stockList.Add(msStock);

      IInvestor investor01 = new Investor("Siddharth");
      ibmStock.RegisterInvestor(investor01);
      msStock.RegisterInvestor(investor01);

      IInvestor investor02 = new Investor("Pradeep");
      pslStock.RegisterInvestor(investor02);

      IInvestor investor03 = new Investor("Richa");
      msStock.RegisterInvestor(investor03);
      pslStock.RegisterInvestor(investor03);

      IInvestor investor04 = new Investor("Krishna Chandra Mishra");
      hclStock.RegisterInvestor(investor04);
      msStock.RegisterInvestor(investor04);
      ibmStock.RegisterInvestor(investor04);

      var exit = false;

      while (!exit)
      {
        Console.WriteLine("Enter Stock Symbol:");
        var symbol = Console.ReadLine();
        Console.WriteLine("Enter Stock Price: ");
        var price = Console.ReadLine();

        var stock = stockList.Where(s => s.Symbol.ToLowerInvariant().Equals(symbol.ToLowerInvariant())).FirstOrDefault();
        if (stock == null)
          Console.WriteLine("Stock not found");
        else
        {
          stock.Price = Convert.ToDouble(price);
        }
      }
    }
  }
}


text:
Param (
  [switch] $generateReport,
  [switch] $uploadCodecov
  )

$currentPath = Split-Path $MyInvocation.MyCommand.Path
$coverageOutputDirectory = Join-Path $currentPath "coverage"
$coverageFile = "coverage-results.xml"

Remove-Item $coverageOutputDirectory -Force -Recurse -ErrorAction SilentlyContinue
Remove-Item $coverageFile -ErrorAction SilentlyContinue

nuget install -Verbosity quiet -OutputDirectory packages -Version 4.6.519 OpenCover

$openCoverConsole = "packages\OpenCover.4.6.519\tools\OpenCover.Console.exe"
# OpenCover currently not supporting portable pdbs (https://github.com/OpenCover/opencover/issues/601)
$configuration = "Coverage"

Get-ChildItem -Filter .\test\ |
    ForEach-Object {
      $csprojPath = $_.FullName
      $testProjectName = $_.Name
      $projectName = $testProjectName -replace ".{6}$"
        cmd.exe /c $openCoverConsole `
          -target:"c:\Program Files\dotnet\dotnet.exe" `
          -targetargs:"test -c $configuration $csprojPath\$testProjectName.csproj" `
          -mergeoutput `
          -hideskipped:File `
          -output:$coverageFile `
          -oldStyle `
          -filter:"+[$projectName]* -[$testProjectName]* -[Greentube.Monitoring]*Attribute -[xunit*]*" `
          -searchdirs:"$csprojPath\bin\$configuration\netcoreapp1.0\;$csprojPath\bin\$configuration\net46\" `
          -register:user
    }

If ($generateReport) {
  nuget install -Verbosity quiet -OutputDirectory packages -Version 2.4.5.0 ReportGenerator
  $reportGenerator = "packages\ReportGenerator.2.4.5.0\tools\ReportGenerator.exe"
  cmd.exe /c $reportGenerator `
    -reports:$coverageFile `
    -targetdir:$coverageOutputDirectory `
    -verbosity:Error
}

If ($uploadCodeCov) {
  nuget install -Verbosity quiet -OutputDirectory packages -Version 1.0.1 Codecov
  $Codecov = "packages\Codecov.1.0.1\tools\Codecov.exe"
  cmd.exe /c $Codecov -f $coverageFile
}


text:
"""Non-deterministic dataset transformations."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

from tensorflow.python.data.experimental.ops import random_ops
from tensorflow.python.data.ops import dataset_ops
from tensorflow.python.data.util import convert
from tensorflow.python.data.util import nest
from tensorflow.python.data.util import structure
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import ops
from tensorflow.python.ops import array_ops
from tensorflow.python.ops import gen_experimental_dataset_ops as ged_ops
from tensorflow.python.ops import gen_stateless_random_ops
from tensorflow.python.ops import math_ops
from tensorflow.python.util.tf_export import tf_export

class _ParallelInterleaveDataset(dataset_ops.UnaryDataset):
  """A `Dataset` that maps a function over its input and flattens the result."""

  def __init__(self, input_dataset, map_func, cycle_length, block_length,
               sloppy, buffer_output_elements, prefetch_input_elements):
    """See `tf.data.experimental.parallel_interleave()` for details."""
    self._input_dataset = input_dataset
    self._map_func = dataset_ops.StructuredFunctionWrapper(
        map_func, self._transformation_name(), dataset=input_dataset)
    if not isinstance(self._map_func.output_structure,
                      dataset_ops.DatasetStructure):
      raise TypeError("`map_func` must return a `Dataset` object.")
    self._structure = self._map_func.output_structure._element_structure  # pylint: disable=protected-access
    self._cycle_length = ops.convert_to_tensor(
        cycle_length, dtype=dtypes.int64, name="cycle_length")
    self._block_length = ops.convert_to_tensor(
        block_length, dtype=dtypes.int64, name="block_length")
    self._sloppy = ops.convert_to_tensor(
        sloppy, dtype=dtypes.bool, name="sloppy")
    self._buffer_output_elements = convert.optional_param_to_tensor(
        "buffer_output_elements",
        buffer_output_elements,
        argument_default=2 * block_length)
    self._prefetch_input_elements = convert.optional_param_to_tensor(
        "prefetch_input_elements",
        prefetch_input_elements,
        argument_default=2 * cycle_length)
    variant_tensor = ged_ops.experimental_parallel_interleave_dataset(
        self._input_dataset._variant_tensor,  # pylint: disable=protected-access
        self._map_func.function.captured_inputs,
        self._cycle_length,
        self._block_length,
        self._sloppy,
        self._buffer_output_elements,
        self._prefetch_input_elements,
        f=self._map_func.function,
        **dataset_ops.flat_structure(self))
    super(_ParallelInterleaveDataset, self).__init__(input_dataset,
                                                     variant_tensor)

  def _functions(self):
    return [self._map_func]

  @property
  def _element_structure(self):
    return self._structure

  def _transformation_name(self):
    return "tf.data.experimental.parallel_interleave()"

@tf_export("data.experimental.parallel_interleave")
def parallel_interleave(map_func,
                        cycle_length,
                        block_length=1,
                        sloppy=False,
                        buffer_output_elements=None,
                        prefetch_input_elements=None):
  """A parallel version of the `Dataset.interleave()` transformation.

  `parallel_interleave()` maps `map_func` across its input to produce nested
  datasets, and outputs their elements interleaved. Unlike
  `tf.data.Dataset.interleave`, it gets elements from `cycle_length` nested
  datasets in parallel, which increases the throughput, especially in the
  presence of stragglers. Furthermore, the `sloppy` argument can be used to
  improve performance, by relaxing the requirement that the outputs are produced
  in a deterministic order, and allowing the implementation to skip over nested
  datasets whose elements are not readily available when requested.

  Example usage:

  ```python
  # Preprocess 4 files concurrently.
  filenames = tf.data.Dataset.list_files("/path/to/data/train*.tfrecords")
  dataset = filenames.apply(
      tf.data.experimental.parallel_interleave(
          lambda filename: tf.data.TFRecordDataset(filename),
          cycle_length=4))
  ```

  WARNING: If `sloppy` is `True`, the order of produced elements is not
  deterministic.

  Args:
    map_func: A function mapping a nested structure of tensors to a `Dataset`.
    cycle_length: The number of input `Dataset`s to interleave from in parallel.
    block_length: The number of consecutive elements to pull from an input
      `Dataset` before advancing to the next input `Dataset`.
    sloppy: If false, elements are produced in deterministic order. Otherwise,
      the implementation is allowed, for the sake of expediency, to produce
      elements in a non-deterministic order.
    buffer_output_elements: The number of elements each iterator being
      interleaved should buffer (similar to the `.prefetch()` transformation for
      each interleaved iterator).
    prefetch_input_elements: The number of input elements to transform to
      iterators before they are needed for interleaving.

  Returns:
    A `Dataset` transformation function, which can be passed to
    `tf.data.Dataset.apply`.
  """
  def _apply_fn(dataset):
    return _ParallelInterleaveDataset(
        dataset, map_func, cycle_length, block_length, sloppy,
        buffer_output_elements, prefetch_input_elements)

  return _apply_fn

class _DirectedInterleaveDataset(dataset_ops.Dataset):
  """A substitute for `Dataset.interleave()` on a fixed list of datasets."""

  def __init__(self, selector_input, data_inputs):
    self._selector_input = selector_input
    self._data_inputs = list(data_inputs)

    first_output_types = dataset_ops.get_legacy_output_types(data_inputs[0])
    first_output_classes = dataset_ops.get_legacy_output_classes(data_inputs[0])

    for data_input in data_inputs[1:]:
      if (dataset_ops.get_legacy_output_types(data_input) != first_output_types
          or dataset_ops.get_legacy_output_classes(data_input)
          != first_output_classes):
        raise TypeError("All datasets must have the same type and class.")

    output_shapes = dataset_ops.get_legacy_output_shapes(self._data_inputs[0])
    for data_input in self._data_inputs[1:]:
      output_shapes = nest.pack_sequence_as(output_shapes, [
          ts1.most_specific_compatible_shape(ts2) for (ts1, ts2) in zip(
              nest.flatten(output_shapes),
              nest.flatten(dataset_ops.get_legacy_output_shapes(data_input)))
      ])

    self._structure = structure.convert_legacy_structure(
        first_output_types, output_shapes, first_output_classes)
    super(_DirectedInterleaveDataset, self).__init__()

  def _as_variant_tensor(self):
    # pylint: disable=protected-access
    return (ged_ops.experimental_directed_interleave_dataset(
        self._selector_input._variant_tensor,
        [data_input._variant_tensor for data_input in self._data_inputs],
        **dataset_ops.flat_structure(self)))
    # pylint: enable=protected-access

  def _inputs(self):
    return [self._selector_input] + self._data_inputs

  @property
  def _element_structure(self):
    return self._structure

@tf_export("data.experimental.sample_from_datasets", v1=[])
def sample_from_datasets_v2(datasets, weights=None, seed=None):
  """Samples elements at random from the datasets in `datasets`.

  Args:
    datasets: A list of `tf.data.Dataset` objects with compatible structure.
    weights: (Optional.) A list of `len(datasets)` floating-point values where
      `weights[i]` represents the probability with which an element should be
      sampled from `datasets[i]`, or a `tf.data.Dataset` object where each
      element is such a list. Defaults to a uniform distribution across
      `datasets`.
    seed: (Optional.) A `tf.int64` scalar `tf.Tensor`, representing the
      random seed that will be used to create the distribution. See
      `tf.set_random_seed` for behavior.

  Returns:
    A dataset that interleaves elements from `datasets` at random, according to
    `weights` if provided, otherwise with uniform probability.

  Raises:
    TypeError: If the `datasets` or `weights` arguments have the wrong type.
    ValueError: If the `weights` argument is specified and does not match the
      length of the `datasets` element.
  """
  num_datasets = len(datasets)
  if not isinstance(weights, dataset_ops.DatasetV2):
    if weights is None:
      # Select inputs with uniform probability.
      logits = [[1.0] * num_datasets]

    else:
      # Use the given `weights` as the probability of choosing the respective
      # input.
      weights = ops.convert_to_tensor(weights, name="weights")
      if weights.dtype not in (dtypes.float32, dtypes.float64):
        raise TypeError("`weights` must be convertible to a tensor of "
                        "`tf.float32` or `tf.float64` elements.")
      if not weights.shape.is_compatible_with([num_datasets]):
        raise ValueError(
            "`weights` must be a vector of length `len(datasets)`.")

      # The `stateless_multinomial()` op expects log-probabilities, as opposed
      # to weights.
      logits = array_ops.expand_dims(math_ops.log(weights, name="logits"), 0)

    # NOTE(mrry): We only specialize when `weights` is not a `Dataset`. When it
    # is a `Dataset`, it is possible that evaluating it has a side effect the
    # user depends on.
    if len(datasets) == 1:
      return datasets[0]

    def select_dataset_constant_logits(seed):
      return array_ops.squeeze(
          gen_stateless_random_ops.stateless_multinomial(logits, 1, seed=seed),
          axis=[0, 1])

    selector_input = dataset_ops.MapDataset(
        random_ops.RandomDataset(seed).batch(2),
        select_dataset_constant_logits,
        use_inter_op_parallelism=False)

  else:
    # Use each element of the given `weights` dataset as the probability of
    # choosing the respective input.

    # The `stateless_multinomial()` op expects log-probabilities, as opposed to
    # weights.
    logits_ds = weights.map(lambda *p: math_ops.log(p, name="logits"))

    def select_dataset_varying_logits(logits, seed):
      return array_ops.squeeze(
          gen_stateless_random_ops.stateless_multinomial(logits, 1, seed=seed),
          axis=[0, 1])

    logits_and_seeds = dataset_ops.Dataset.zip(
        (logits_ds, random_ops.RandomDataset(seed).batch(2)))
    selector_input = dataset_ops.MapDataset(
        logits_and_seeds,
        select_dataset_varying_logits,
        use_inter_op_parallelism=False)

  return _DirectedInterleaveDataset(selector_input, datasets)

@tf_export(v1=["data.experimental.sample_from_datasets"])
def sample_from_datasets_v1(datasets, weights=None, seed=None):
  return dataset_ops.DatasetV1Adapter(
      sample_from_datasets_v2(datasets, weights, seed))
sample_from_datasets_v1.__doc__ = sample_from_datasets_v2.__doc__

@tf_export("data.experimental.choose_from_datasets", v1=[])
def choose_from_datasets_v2(datasets, choice_dataset):
  """Creates a dataset that deterministically chooses elements from `datasets`.

  For example, given the following datasets:

  ```python
  datasets = [tf.data.Dataset.from_tensors("foo").repeat(),
              tf.data.Dataset.from_tensors("bar").repeat(),
              tf.data.Dataset.from_tensors("baz").repeat()]

  # Define a dataset containing `[0, 1, 2, 0, 1, 2, 0, 1, 2]`.
  choice_dataset = tf.data.Dataset.range(3).repeat(3)

  result = tf.data.experimental.choose_from_datasets(datasets, choice_dataset)
  ```

  The elements of `result` will be:

  ```
  "foo", "bar", "baz", "foo", "bar", "baz", "foo", "bar", "baz"
  ```

  Args:
    datasets: A list of `tf.data.Dataset` objects with compatible structure.
    choice_dataset: A `tf.data.Dataset` of scalar `tf.int64` tensors between
      `0` and `len(datasets) - 1`.

  Returns:
    A dataset that interleaves elements from `datasets` according to the values
    of `choice_dataset`.

  Raises:
    TypeError: If the `datasets` or `choice_dataset` arguments have the wrong
      type.
  """
  if not dataset_ops.get_structure(choice_dataset).is_compatible_with(
      structure.TensorStructure(dtypes.int64, [])):
    raise TypeError("`choice_dataset` must be a dataset of scalar "
                    "`tf.int64` tensors.")
  return _DirectedInterleaveDataset(choice_dataset, datasets)

@tf_export(v1=["data.experimental.choose_from_datasets"])
def choose_from_datasets_v1(datasets, choice_dataset):
  return dataset_ops.DatasetV1Adapter(
      choose_from_datasets_v2(datasets, choice_dataset))
choose_from_datasets_v1.__doc__ = choose_from_datasets_v2.__doc__

# TODO(b/119044825): Until all `tf.data` unit tests are converted to V2, keep
# these aliases in place.
choose_from_datasets = choose_from_datasets_v1
sample_from_datasets = sample_from_datasets_v1


text:
external help file: Microsoft.WindowsAzure.Commands.Storage.dll-Help.xml
ms.assetid: 3E79EE05-7E52-4C54-B985-441BC2599925
online version:
schema: 2.0.0
---

# Remove-AzureStorageContainerStoredAccessPolicy

## SYNOPSIS
Removes a stored access policy from an Azure storage container.

## SYNTAX

```
Remove-AzureStorageContainerStoredAccessPolicy [-Container] <String> [-Policy] <String> [-PassThru]
 [-Context <AzureStorageContext>] [-ServerTimeoutPerRequest <Int32>] [-ClientTimeoutPerRequest <Int32>]
 [-ConcurrentTaskCount <Int32>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

## DESCRIPTION
The **Remove-AzureStorageContainerStoredAccessPolicy** cmdlet removes a stored access policy from an Azure storage container.

## EXAMPLES

### Example 1: Remove a stored access policy from a storage container
```
PS C:\>Remove-AzureStorageContainerStoredAccessPolicy -Container "MyContainer" -Policy "Policy03"
```

This command removes an access policy named Policy03 from the stored container named MyContainer.

## PARAMETERS

### -ClientTimeoutPerRequest
Specifies the client-side time-out interval, in seconds, for one service request.
If the previous call fails in the specified interval, this cmdlet retries the request.
If this cmdlet does not receive a successful response before the interval elapses, this cmdlet returns an error.

```yaml
Type: Int32
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -ConcurrentTaskCount
Specifies the maximum concurrent network calls.
You can use this parameter to limit the concurrency to throttle local CPU and bandwidth usage by specifying the maximum number of concurrent network calls.
The specified value is an absolute count and is not multiplied by the core count.
This parameter can help reduce network connection problems in low bandwidth environments, such as 100 kilobits per second.
The default value is 10.

```yaml
Type: Int32
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Container
Specifies the Azure storage container name.

```yaml
Type: String
Parameter Sets: (All)
Aliases: N, Name

Required: True
Position: 0
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
```

### -Context
Specifies an Azure storage context.
To obtain a storage context, use the New-AzureStorageContext cmdlet.

```yaml
Type: AzureStorageContext
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName, ByValue)
Accept wildcard characters: False
```

### -PassThru
Indicates that this cmdlet returns a **Boolean** that reflects the success of the operation.
By default, this cmdlet does not return a value.

```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Policy
Specifies the name of the stored access policy that this cmdlet removes.

```yaml
Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
```

### -ServerTimeoutPerRequest
Specifies the client-side time-out interval, in seconds, for one service request.
If the previous call fails in the specified interval, this cmdlet retries the request.
If this cmdlet does not receive a successful response before the interval elapses, this cmdlet returns an error.

```yaml
Type: Int32
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Confirm
Prompts you for confirmation before running the cmdlet.

```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
```

### -WhatIf
Shows what would happen if the cmdlet runs.
The cmdlet is not run.

```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
```

### CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).

## INPUTS

## OUTPUTS

## NOTES

## RELATED LINKS

[Get-AzureStorageContainerStoredAccessPolicy](./Get-AzureStorageContainerStoredAccessPolicy.md)

[New-AzureStorageContainerStoredAccessPolicy](./New-AzureStorageContainerStoredAccessPolicy.md)

[New-AzureStorageContext](./New-AzureStorageContext.md)

[Set-AzureStorageContainerStoredAccessPolicy](./Set-AzureStorageContainerStoredAccessPolicy.md)