text:
describe("chorus.views.ListContentDetails", function() {
    beforeEach(function() {
        this.collection = backboneFixtures.userSet();
        this.collection.pagination = {
            "total": 2,
            "page": 1,
            "records": 22
        };
        this.collection.loaded = true;
        this.view = new chorus.views.ListContentDetails({ collection: this.collection, modelClass: "User" });
    });

    describe("#render", function() {
        describe("buttons", function() {
            beforeEach(function() {
                this.view.render();
            });

            it("creates a buttons subview", function(){
                expect(this.view.buttonView).toBeA(chorus.views.ListContentDetailsButtonView);
                expect(this.view.buttonView.options).toBe(this.view.options);
            });

            it("contains a div to hold the buttons", function(){
                expect(this.view.$("div.button_holder")).toExist();
            });
        });

        context("when the multiSelect is falsy", function() {
            beforeEach(function() {
                this.view.options.multiSelect = false;
                this.view.render();
            });

            it("does not show the multi-select section", function() {
                expect(this.view.$(".multiselect")).not.toExist();
            });
        });

        context("when the multiSelect option is true", function() {
            beforeEach(function() {
                this.view.options.search = true;
                this.view.options.multiSelect = true;
                this.view.render();
                spyOn(chorus.PageEvents, "trigger");
            });

            it("does not show the 'explore' text", function() {
                expect(this.view.$("span.explore")).not.toExist();
            });

            describe("when the 'select all' checkbox is checked", function() {
                it("triggers the 'selectAll' page event", function() {
                    this.view.$(".multiselect .select_all").prop("checked", true);
                    this.view.$(".multiselect .select_all").change();
                    expect(chorus.PageEvents.trigger).toHaveBeenCalledWith("selectAll");
                });
            });

            describe("when the 'select all' checkbox is unchecked", function() {
                it("triggers the 'selectNone' page event", function() {
                    this.view.$(".multiselect .select_all").prop("checked", false);
                    this.view.$(".multiselect .select_all").change();
                    expect(chorus.PageEvents.trigger).toHaveBeenCalledWith("selectNone");
                });
            });

            it("renders the checked state", function () {
                this.view.$(".select_all").prop("checked", true).change();
                this.view.render();
                expect(this.view.$(".select_all").prop("checked")).toBeTruthy();
            });
        });

        context("when the collection is loaded", function() {
            context("and the hideCounts option is falsy", function() {
                beforeEach(function() {
                    this.view.options.hideCounts = false;
                    this.view.render();
                });

                it("renders the total number of items in the collection", function() {
                    expect(this.view.$(".count")).toContainText("22");
                });
            });

            context("and the hideCounts option is truthy", function() {
                beforeEach(function() {
                    this.view.options.hideCounts = true;
                    this.view.render();
                });

                it("does not render the total number of items in the collection", function() {
                    expect(this.view.$(".count")).not.toExist();
                });

                it("does not render the current page or total page count", function() {
                    expect(this.view.$(".pagination .page")).not.toExist();
                });
            });

            context("and there is only one page of items", function() {
                beforeEach(function() {
                    this.collection.pagination.page = "1";
                    this.collection.pagination.total = "1";
                    this.view.render();
                });

                it("does not display the pagination controls", function() {
                    expect(this.view.$(".pagination")).toHaveClass("hidden");
                });

                context("and the hideIfNoPagination option is falsy", function() {
                    beforeEach(function() {
                        this.view.options.hideIfNoPagination = false;
                        this.view.render();
                    });

                    it("does not add the hidden class to the container", function() {
                        expect($(this.view.el)).not.toHaveClass("hidden");
                    });
                });

                context("and the hideIfNoPagination option is truthy", function() {
                    beforeEach(function() {
                        this.view.options.hideIfNoPagination = true;
                        this.view.render();
                    });

                    it("adds the hidden class to the container", function() {
                        expect($(this.view.el)).toHaveClass("hidden");
                    });
                });
            });

            context("and there is more than one page of items", function() {
                beforeEach(function() {
                    this.collection.pagination.page = "1";
                    this.collection.pagination.total = "2";
                    this.view.render();
                });

                it("displays the pagination controls", function() {
                    expect(this.view.$(".pagination")).not.toHaveClass("hidden");
                });

                it("displays the page number of the collection", function() {
                    expect(this.view.$(".pagination .page .current").text().trim()).toBe(this.collection.pagination.page);
                });

                it("displays the total number of pages in the collection", function() {
                    expect(this.view.$(".pagination .page .total").text().trim()).toBe(this.collection.pagination.total);
                });

                it("does not add the hidden class to the container", function() {
                    expect($(this.view.el)).not.toHaveClass("hidden");
                });

                context("when there is a next page", function() {
                    beforeEach(function() {
                        this.collection.pagination.page = "1";
                        this.collection.pagination.total = "2";
                        this.view.render();
                    });

                    it("renders the next page link", function() {
                        expect(this.view.$(".pagination .links a.next")).not.toHaveClass("hidden");
                        expect(this.view.$(".pagination .links span.next")).toHaveClass("hidden");
                    });
                });

                context("when there is NO next page", function() {
                    beforeEach(function() {
                        this.collection.pagination.page = "2";
                        this.collection.pagination.total = "2";
                        this.view.render();
                    });

                    it("renders the next page link, but not as a link", function() {
                        expect(this.view.$(".pagination .links a.next")).toHaveClass("hidden");
                        expect(this.view.$(".pagination .links span.next")).not.toHaveClass("hidden");
                    });
                });

                context("when there is a previous page", function() {
                    beforeEach(function() {
                        this.collection.pagination.page = "2";
                        this.collection.pagination.total = "2";
                        this.view.render();
                    });

                    it("renders the previous page link", function() {
                        expect(this.view.$(".pagination .links a.previous")).not.toHaveClass("hidden");
                        expect(this.view.$(".pagination .links span.previous")).toHaveClass("hidden");
                    });
                });

                context("when there is NO previous page", function() {
                    beforeEach(function() {
                        this.collection.pagination.page = "1";
                        this.collection.pagination.total = "2";
                        this.view.render();
                    });

                    it("renders the previous page link, but not as a link", function() {
                        expect(this.view.$(".pagination .links a.previous")).toHaveClass("hidden");
                        expect(this.view.$(".pagination .links span.previous")).not.toHaveClass("hidden");
                    });
                });
            });

            context("and the collection is empty", function() {
                beforeEach(function() {
                    this.view.collection = new chorus.collections.UserSet();
                    this.view.collection.loaded = true;
                    this.view.render();
                });

                it("does not display the pagination controls", function() {
                    expect(this.view.$(".pagination")).toHaveClass("hidden");
                });

                context("and the hideIfNoPagination option is falsy", function() {
                    beforeEach(function() {
                        this.view.options.hideIfNoPagination = false;
                        this.view.render();
                    });

                    it("does not add the hidden class to the container", function() {
                        expect($(this.view.el)).not.toHaveClass("hidden");
                    });
                });

                context("and the hideIfNoPagination option is truthy", function() {
                    beforeEach(function() {
                        this.view.options.hideIfNoPagination = true;
                        this.view.render();
                    });

                    it("adds the hidden class to the container", function() {
                        expect($(this.view.el)).toHaveClass("hidden");
                    });
                });
            });
        });

        context("when the collection is not loaded", function() {
            beforeEach(function() {
                this.collection.loaded = undefined;
                this.view.render();
            });

            it("displays 'loading'", function() {
                expect(this.view.$(".loading_section")).toExist();
            });
        });
    });

    describe("multiSelect", function() {
        beforeEach(function() {
            spyOnEvent(chorus.PageEvents, "selectNone");
        });

        context("when the multiSelect option is true", function() {
            beforeEach(function() {
                this.view.options.multiSelect = true;
                this.view.setup();
            });

            it("deselects all after a search", function() {
                this.collection.trigger('searched');
                expect("selectNone").toHaveBeenTriggeredOn(chorus.PageEvents);
            });

            it("deselects all after paginating", function() {
                this.collection.trigger('paginate');
                expect("selectNone").toHaveBeenTriggeredOn(chorus.PageEvents);
            });

            it("deselects all after filtering", function() {
                chorus.PageEvents.trigger('choice:filter');
                expect("selectNone").toHaveBeenTriggeredOn(chorus.PageEvents);
            });

            it("deselects all after sorting", function() {
                chorus.PageEvents.trigger('choice:sort');
                expect("selectNone").toHaveBeenTriggeredOn(chorus.PageEvents);
            });
        });

        context("when multiSelect is false", function() {
            beforeEach(function() {
                this.view.options.multiSelect = false;
                this.view.setup();
            });

            it("does not deselect all after a search", function() {
                this.collection.trigger('searched');
                expect("selectNone").not.toHaveBeenTriggeredOn(chorus.PageEvents);
            });

            it("does not deselect all after paginating", function() {
                this.collection.trigger('paginate');
                expect("selectNone").not.toHaveBeenTriggeredOn(chorus.PageEvents);
            });

            it("does not deselect all after filtering", function() {
                chorus.PageEvents.trigger('choice:filter');
                expect("selectNone").not.toHaveBeenTriggeredOn(chorus.PageEvents);
            });

            it("does not deselect all after sorting", function() {
                chorus.PageEvents.trigger('choice:sort');
                expect("selectNone").not.toHaveBeenTriggeredOn(chorus.PageEvents);
            });
        });
    });

    describe("changing the collection", function() {
        it("renders the view", function() {
            this.collection.remove(this.collection.first());
            expect(this.view.$(".count")).toContainText(this.collection.totalRecordCount());
        });
    });

    describe("clicking the pagination links", function() {
        beforeEach(function() {
            this.collection.pagination.page = "2";
            this.collection.pagination.total = "3";
            spyOn(window, 'scroll');
            this.view.render();
        });

        describe("when the 'next' link is clicked", function() {
            beforeEach(function() {
                spyOn(this.collection, "fetchPage");
                this.view.$("a.next").click();
            });

            it("fetches the next page of the collection", function() {
                expect(this.collection.fetchPage).toHaveBeenCalledWith(3);
            });

            it("scrolls the viewport to the top of the page", function() {
                expect(window.scroll).toHaveBeenCalledWith(0, 0);
            });
        });

        describe("when the 'previous' link is clicked", function() {
            beforeEach(function() {
                spyOn(this.collection, "fetchPage");
                this.view.$("a.previous").click();
            });

            it("fetches the previous page of the collection", function() {
                expect(this.collection.fetchPage).toHaveBeenCalledWith(1);
            });

            it("scrolls the viewport to the top of the page", function() {
                expect(window.scroll).toHaveBeenCalledWith(0, 0);
            });
        });
    });

    describe("search", function() {
        beforeEach(function() {
            this.$list = $("<ul/>");
            spyOn(chorus, "search");
            this.view.options.search = {
                list: this.$list,
                placeholder: "SearchPlaceholder"
            };
            this.view.render();
        });

        it("calls chorus.search on the input field", function() {
            expect(chorus.search).toHaveBeenCalledWith(_.extend({
                    input: this.view.$("input.search:text"),
                    afterFilter: jasmine.any(Function)
                },
                this.view.options.search));
        });

        it("doesn't render a search bar if the placeholder key is not present in the search hash", function() {
            delete this.view.options.search.placeholder;
            this.view.render();

            expect(this.view.$("input.search:text")).not.toExist();
        });

        context("when the collection already has a value for its searchAttr", function() {
            beforeEach(function() {
                this.collection.searchAttr = "namePattern";
                this.collection.attributes.namePattern = "foo";
                this.view.render();
            });

            it("sets the value in the search input", function() {
                expect(this.view.$("input.search:text").val()).toEqual('foo');
            });
        });
    });

    describe("#startLoading", function() {
        beforeEach(function() {
            this.view.render();
        });
        it("shows the loading text in the right place", function() {
            expect(this.view.$(".count")).not.toContainTranslation("loading");
            this.view.startLoading(".count");
            expect(this.view.$(".count")).toContainTranslation("loading");
        });
    });

    context("when it's a dataset list content details view", function() {
        beforeEach(function() {
            this.modalSpy = stubModals();
            this.collection = new chorus.collections.WorkspaceDatasetSet();
            this.collection.attributes.workspaceId = 44;
            this.collection.loaded = true;
            this.view = new chorus.views.ListContentDetails({ collection: this.collection, modelClass: "WorkspaceDataset" });
            $("#jasmine_content").append(this.view.el);
        });
    });

    context("when initialized with a buttons subview", function(){
        beforeEach(function() {
            this.buttonView = new chorus.views.Base();
            this.view = new chorus.views.ListContentDetails({
                collection: this.collection,
                modelClass: "User",
                buttonView: this.buttonView
            });
        });
        it("has a buttons subview", function(){
            expect(this.view.buttonView).toBe(this.buttonView);
        });
    });
});


text:
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

/*
| -------------------------------------------------------------------------
| Email
| -------------------------------------------------------------------------
| This file lets you define parameters for sending emails.
| Please see the user guide for info:
|
|	http://codeigniter.com/user_guide/libraries/email.html
|
*/
$config['mailtype'] = 'html';
$config['charset'] = 'utf-8';
$config['newline'] = "\r\n";
$config['protocol'] = "smtp";
$config['smtp_host'] = "ssl://smtp.gmail.com";
$config['smtp_port'] = "465";
$config['smtp_user'] = "";  //give your email address here
$config['smtp_pass'] = "";  //give your email password here

/* End of file email.php */
/* Location: ./application/config/email.php */

redpajama_set_name: RedPajamaGithub


text:
package topom

import (
	"testing"

	"github.com/CodisLabs/codis/pkg/models"
	"github.com/CodisLabs/codis/pkg/utils/assert"
	"github.com/CodisLabs/codis/pkg/utils/log"
)

func newApiClient(t *Topom) *ApiClient {
	c := NewApiClient(t.model.AdminAddr)
	c.SetXAuth(t.config.ProductName)
	return c
}

func TestApiTopom(x *testing.T) {
	t := openTopom()
	defer t.Close()

	c := newApiClient(t)

	o, err := c.Model()
	assert.MustNoError(err)
	assert.Must(o != nil)

	assert.MustNoError(c.XPing())

	s, err := c.Stats()
	assert.MustNoError(err)
	assert.Must(s != nil)

	assert.MustNoError(c.LogLevel(log.LevelError))

	assert.MustNoError(c.Shutdown())
}

func TestApiSlots(x *testing.T) {
	t := openTopom()
	defer t.Close()

	s := newFakeServer()
	defer s.Close()

	const sid = 100
	const gid = 200

	c := newApiClient(t)

	assert.MustNoError(c.CreateGroup(gid))
	assert.MustNoError(c.GroupAddServer(gid, "", s.Addr))
	assert.MustNoError(c.SlotCreateAction(sid, gid))
	assert.MustNoError(c.SlotRemoveAction(sid))
	assert.MustNoError(c.SlotCreateActionRange(0, MaxSlotNum-1, gid))
	assert.MustNoError(c.SetSlotActionInterval(2000))
	assert.MustNoError(c.SetSlotActionDisabled(true))

	assert.MustNoError(c.SlotsAssignGroup([]*models.SlotMapping{
		&models.SlotMapping{Id: sid, GroupId: gid},
	}))

	slots, err := c.Slots()
	assert.MustNoError(err)
	assert.Must(len(slots) == MaxSlotNum)
	assert.Must(slots[sid].BackendAddr == s.Addr)
}

func TestApiGroup(x *testing.T) {
	t := openTopom()
	defer t.Close()

	s1 := newFakeServer()
	defer s1.Close()

	s2 := newFakeServer()
	defer s2.Close()

	const gid = 100

	c := newApiClient(t)

	assert.MustNoError(c.CreateGroup(gid))
	assert.MustNoError(c.GroupAddServer(gid, "", s1.Addr))
	assert.MustNoError(c.GroupAddServer(gid, "", s2.Addr))
	assert.MustNoError(c.SyncCreateAction(s1.Addr))
	assert.MustNoError(c.SyncRemoveAction(s1.Addr))
	assert.MustNoError(c.GroupPromoteServer(gid, s2.Addr))
	assert.MustNoError(c.GroupDelServer(gid, s1.Addr))
	assert.MustNoError(c.GroupDelServer(gid, s2.Addr))
	assert.MustNoError(c.RemoveGroup(gid))
}

func TestApiProxy(x *testing.T) {
	t := openTopom()
	defer t.Close()

	c := newApiClient(t)

	p, z := openProxy()
	defer z.Shutdown()

	assert.MustNoError(c.CreateProxy(p.AdminAddr))
	assert.MustNoError(c.ReinitProxy(p.Token))
	assert.MustNoError(c.RemoveProxy(p.Token, false))
}


text:
package androidx.camera.camera2.internal;

import static androidx.camera.core.impl.utils.AspectRatioUtil.ASPECT_RATIO_16_9;
import static androidx.camera.core.impl.utils.AspectRatioUtil.ASPECT_RATIO_3_4;
import static androidx.camera.core.impl.utils.AspectRatioUtil.ASPECT_RATIO_4_3;
import static androidx.camera.core.impl.utils.AspectRatioUtil.ASPECT_RATIO_9_16;
import static androidx.camera.core.impl.utils.AspectRatioUtil.hasMatchingAspectRatio;

import android.graphics.ImageFormat;
import android.graphics.Rect;
import android.hardware.camera2.CameraCharacteristics;
import android.hardware.camera2.params.StreamConfigurationMap;
import android.os.Build;
import android.util.Rational;
import android.util.Size;

import androidx.annotation.DoNotInline;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.camera.camera2.internal.compat.CameraCharacteristicsCompat;
import androidx.camera.camera2.internal.compat.StreamConfigurationMapCompat;
import androidx.camera.camera2.internal.compat.workaround.ExcludedSupportedSizesContainer;
import androidx.camera.camera2.internal.compat.workaround.ResolutionCorrector;
import androidx.camera.camera2.internal.compat.workaround.TargetAspectRatio;
import androidx.camera.core.AspectRatio;
import androidx.camera.core.Logger;
import androidx.camera.core.ResolutionSelector;
import androidx.camera.core.impl.ImageOutputConfig;
import androidx.camera.core.impl.SizeCoordinate;
import androidx.camera.core.impl.SurfaceConfig;
import androidx.camera.core.impl.utils.AspectRatioUtil;
import androidx.camera.core.impl.utils.CameraOrientationUtil;
import androidx.camera.core.impl.utils.CompareSizesByArea;
import androidx.camera.core.internal.utils.SizeUtil;
import androidx.core.util.Preconditions;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * The supported output sizes collector to help collect the available resolution candidate list
 * according to the use case config and the following settings in {@link ResolutionSelector}:
 *
 * 1. Preferred aspect ratio
 * 2. Preferred resolution
 * 3. Max resolution
 * 4. Is high resolution enabled
 *
 * The problematic resolutions retrieved from {@link ExcludedSupportedSizesContainer} will also
 * be execulded.
 */
@RequiresApi(21)
final class SupportedOutputSizesCollector {
    private static final String TAG = "SupportedOutputSizesCollector";
    private final String mCameraId;
    @NonNull
    private final CameraCharacteristicsCompat mCharacteristics;
    @NonNull
    private final DisplayInfoManager mDisplayInfoManager;
    private final ResolutionCorrector mResolutionCorrector = new ResolutionCorrector();
    private final Map<Integer, Size[]> mOutputSizesCache = new HashMap<>();
    private final Map<Integer, Size[]> mHighResolutionOutputSizesCache = new HashMap<>();
    private final Map<Integer, Size> mMaxSizeCache = new HashMap<>();
    private final ExcludedSupportedSizesContainer mExcludedSupportedSizesContainer;
    private final Map<Integer, List<Size>> mExcludedSizeListCache = new HashMap<>();
    private final boolean mIsSensorLandscapeResolution;
    private final boolean mIsBurstCaptureSupported;
    private final Size mActiveArraySize;
    private final int mSensorOrientation;
    private final int mLensFacing;

    SupportedOutputSizesCollector(@NonNull String cameraId,
            @NonNull CameraCharacteristicsCompat cameraCharacteristics,
            @NonNull DisplayInfoManager displayInfoManager) {
        mCameraId = cameraId;
        mCharacteristics = cameraCharacteristics;
        mDisplayInfoManager = displayInfoManager;

        mExcludedSupportedSizesContainer = new ExcludedSupportedSizesContainer(cameraId);

        mIsSensorLandscapeResolution = isSensorLandscapeResolution(mCharacteristics);
        mIsBurstCaptureSupported = isBurstCaptureSupported();

        Rect rect = mCharacteristics.get(CameraCharacteristics.SENSOR_INFO_ACTIVE_ARRAY_SIZE);
        mActiveArraySize = rect != null ? new Size(rect.width(), rect.height()) : null;

        mSensorOrientation = mCharacteristics.get(CameraCharacteristics.SENSOR_ORIENTATION);
        mLensFacing = mCharacteristics.get(CameraCharacteristics.LENS_FACING);
    }

    /**
     * Collects and sorts the resolution candidate list by the following steps:
     *
     * 1. Collects the candidate list by the high resolution enable setting.
     * 2. Filters out the candidate list according to the min size bound, max resolution or
     * excluded resolution quirk.
     * 3. Sorts the candidate list according to the rules of legacy resolution API or new
     * Resolution API.
     * 4. Forces select specific resolutions according to ResolutionCorrector workaround.
     */
    @NonNull
    List<Size> getSupportedOutputSizes(@NonNull ResolutionSelector resolutionSelector,
            int imageFormat, @Nullable Size miniBoundingSize, boolean isHighResolutionDisabled,
            @Nullable Size[] customizedSupportSizes) {
        // 1. Collects the candidate list by the high resolution enable setting.
        List<Size> resolutionCandidateList = collectResolutionCandidateList(resolutionSelector,
                imageFormat, isHighResolutionDisabled, customizedSupportSizes);

        // 2. Filters out the candidate list according to the min size bound, max resolution or
        // excluded resolution quirk.
        resolutionCandidateList = filterOutResolutionCandidateListBySettings(
                resolutionCandidateList, resolutionSelector, imageFormat);

        // 3. Sorts the candidate list according to the rules of new Resolution API.
        resolutionCandidateList = sortResolutionCandidateListByResolutionSelector(
                resolutionCandidateList, resolutionSelector,
                mDisplayInfoManager.getMaxSizeDisplay().getRotation(), miniBoundingSize);

        // 4. Forces select specific resolutions according to ResolutionCorrector workaround.
        resolutionCandidateList = mResolutionCorrector.insertOrPrioritize(
                SurfaceConfig.getConfigType(imageFormat), resolutionCandidateList);

        return resolutionCandidateList;
    }

    /**
     * Collects the resolution candidate list.
     *
     * 1. Customized supported resolutions list will be returned when it exists
     * 2. Otherwise, the sizes retrieved from {@link StreamConfigurationMap#getOutputSizes(int)}
     * will be the base of the resolution candidate list.
     * 3. High resolution sizes retrieved from
     * {@link StreamConfigurationMap#getHighResolutionOutputSizes(int)} will be included when
     * {@link ResolutionSelector#isHighResolutionEnabled()} returns true.
     *
     * The returned list will be sorted in descending order and duplicate items will be removed.
     */
    @NonNull
    private List<Size> collectResolutionCandidateList(
            @NonNull ResolutionSelector resolutionSelector, int imageFormat,
            boolean isHighResolutionDisabled, @Nullable Size[] customizedSupportedSizes) {
        Size[] outputSizes = customizedSupportedSizes;

        if (outputSizes == null) {
            boolean highResolutionEnabled =
                    !isHighResolutionDisabled && resolutionSelector.isHighResolutionEnabled();
            outputSizes = getAllOutputSizesByFormat(imageFormat, highResolutionEnabled);
        }

        // Sort the output sizes. The Comparator result must be reversed to have a descending order
        // result.
        Arrays.sort(outputSizes, new CompareSizesByArea(true));

        List<Size> resultList = Arrays.asList(outputSizes);

        if (resultList.isEmpty()) {
            throw new IllegalArgumentException(
                    "Resolution candidate list is empty when collecting by the settings!");
        }

        return resultList;
    }

    /**
     * Filters out the resolution candidate list by the max resolution setting.
     *
     * The input size list should have been sorted in descending order.
     */
    private List<Size> filterOutResolutionCandidateListBySettings(
            @NonNull List<Size> resolutionCandidateList,
            @NonNull ResolutionSelector resolutionSelector, int imageFormat) {
        // Retrieves the max resolution setting. When ResolutionSelector is used, all resolution
        // selection logic should depend on ResolutionSelector's settings.
        Size maxResolution = resolutionSelector.getMaxResolution();

        // Filter out the resolution candidate list by the max resolution. Sizes that any edge
        // exceeds the max resolution will be filtered out.
        List<Size> resultList;

        if (maxResolution == null) {
            resultList = new ArrayList<>(resolutionCandidateList);
        } else {
            resultList = new ArrayList<>();
            for (Size outputSize : resolutionCandidateList) {
                if (!SizeUtil.isLongerInAnyEdge(outputSize, maxResolution)) {
                    resultList.add(outputSize);
                }
            }
        }

        resultList = excludeProblematicSizes(resultList, imageFormat);

        if (resultList.isEmpty()) {
            throw new IllegalArgumentException(
                    "Resolution candidate list is empty after filtering out by the settings!");
        }

        return resultList;
    }

    /**
     * Sorts the resolution candidate list according to the new ResolutionSelector API logic.
     *
     * The list will be sorted by the following order:
     * 1. size of preferred resolution
     * 2. a resolution with preferred aspect ratio, is not smaller than, and is closest to the
     * preferred resolution.
     * 3. resolutions with preferred aspect ratio and is smaller than the preferred resolution
     * size in descending order of resolution area size.
     * 4. Other sizes sorted by CompareAspectRatiosByMappingAreaInFullFovAspectRatioSpace and
     * area size.
     */
    @NonNull
    private List<Size> sortResolutionCandidateListByResolutionSelector(
            @NonNull List<Size> resolutionCandidateList,
            @NonNull ResolutionSelector resolutionSelector,
            @ImageOutputConfig.RotationValue int targetRotation,
            @Nullable Size miniBoundingSize) {
        Rational aspectRatio = getTargetAspectRatioByResolutionSelector(resolutionSelector);
        Preconditions.checkNotNull(aspectRatio, "ResolutionSelector should also have aspect ratio"
                + " value.");

        Size targetSize = getTargetSizeByResolutionSelector(resolutionSelector, targetRotation,
                mSensorOrientation, mLensFacing);
        List<Size> resultList = sortResolutionCandidateListByTargetAspectRatioAndSize(
                resolutionCandidateList, aspectRatio, miniBoundingSize);

        // Moves the target size to the first position if it exists in the resolution candidate
        // list and there is no quirk that needs to select specific aspect ratio sizes in priority.
        if (resultList.contains(targetSize) && canResolutionBeMovedToHead(targetSize)) {
            resultList.remove(targetSize);
            resultList.add(0, targetSize);
        }

        return resultList;
    }

    @NonNull
    private Size[] getAllOutputSizesByFormat(int imageFormat, boolean highResolutionEnabled) {
        Size[] outputs = mOutputSizesCache.get(imageFormat);
        if (outputs == null) {
            outputs = doGetOutputSizesByFormat(imageFormat);
            mOutputSizesCache.put(imageFormat, outputs);
        }

        Size[] highResolutionOutputs = null;

        // A device that does not support the BURST_CAPTURE capability,
        // StreamConfigurationMap#getHighResolutionOutputSizes() will return null.
        if (highResolutionEnabled && mIsBurstCaptureSupported) {
            highResolutionOutputs = mHighResolutionOutputSizesCache.get(imageFormat);

            // High resolution output sizes list may be empty. If it is empty and cached in the
            // map, don't need to query it again.
            if (highResolutionOutputs == null && !mHighResolutionOutputSizesCache.containsKey(
                    imageFormat)) {
                highResolutionOutputs = doGetHighResolutionOutputSizesByFormat(imageFormat);
                mHighResolutionOutputSizesCache.put(imageFormat, highResolutionOutputs);
            }
        }

        // Combines output sizes if high resolution sizes list is not empty.
        if (highResolutionOutputs != null) {
            Size[] allOutputs = Arrays.copyOf(highResolutionOutputs,
                    highResolutionOutputs.length + outputs.length);
            System.arraycopy(outputs, 0, allOutputs, highResolutionOutputs.length, outputs.length);
            outputs = allOutputs;
        }

        return outputs;
    }

    @NonNull
    private Size[] doGetOutputSizesByFormat(int imageFormat) {
        StreamConfigurationMap map =
                mCharacteristics.get(CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP);

        if (map == null) {
            throw new IllegalArgumentException("Can not retrieve SCALER_STREAM_CONFIGURATION_MAP");
        }

        StreamConfigurationMapCompat mapCompat =
                StreamConfigurationMapCompat.toStreamConfigurationMapCompat(map);
        Size[] outputSizes = mapCompat.getOutputSizes(imageFormat);
        if (outputSizes == null) {
            throw new IllegalArgumentException(
                    "Can not get supported output size for the format: " + imageFormat);
        }

        return outputSizes;
    }

    @Nullable
    private Size[] doGetHighResolutionOutputSizesByFormat(int imageFormat) {
        if (Build.VERSION.SDK_INT < 23) {
            return null;
        }

        Size[] outputSizes;

        StreamConfigurationMap map =
                mCharacteristics.get(CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP);

        if (map == null) {
            throw new IllegalArgumentException("Can not retrieve SCALER_STREAM_CONFIGURATION_MAP");
        }

        outputSizes = Api23Impl.getHighResolutionOutputSizes(map, imageFormat);

        return outputSizes;
    }

    /**
     * Returns the target aspect ratio value corrected by quirks.
     *
     * The final aspect ratio is determined by the following order:
     * 1. The aspect ratio returned by {@link TargetAspectRatio} if it is
     * {@link TargetAspectRatio#RATIO_4_3}, {@link TargetAspectRatio#RATIO_16_9} or
     * {@link TargetAspectRatio#RATIO_MAX_JPEG}.
     * 2. The use case's original aspect ratio if {@link TargetAspectRatio} returns
     * {@link TargetAspectRatio#RATIO_ORIGINAL} and the use case has target aspect ratio setting.
     *
     * @param resolutionSelector the resolution selector of the use case.
     */
    @Nullable
    private Rational getTargetAspectRatioByResolutionSelector(
            @NonNull ResolutionSelector resolutionSelector) {
        Rational outputRatio = getTargetAspectRatioFromQuirk();

        if (outputRatio == null) {
            @AspectRatio.Ratio int aspectRatio = resolutionSelector.getPreferredAspectRatio();
            switch (aspectRatio) {
                case AspectRatio.RATIO_4_3:
                    outputRatio = mIsSensorLandscapeResolution ? ASPECT_RATIO_4_3
                            : ASPECT_RATIO_3_4;
                    break;
                case AspectRatio.RATIO_16_9:
                    outputRatio = mIsSensorLandscapeResolution ? ASPECT_RATIO_16_9
                            : ASPECT_RATIO_9_16;
                    break;
                default:
                    Logger.e(TAG, "Undefined target aspect ratio: " + aspectRatio);
            }
        }
        return outputRatio;
    }

    /**
     * Returns the restricted target aspect ratio value from quirk. The returned value can be
     * null which means that no quirk to restrict the use case to use a specific target aspect
     * ratio value.
     */
    @Nullable
    private Rational getTargetAspectRatioFromQuirk() {
        Rational outputRatio = null;

        // Gets the corrected aspect ratio due to device constraints or null if no correction is
        // needed.
        @TargetAspectRatio.Ratio int targetAspectRatio =
                new TargetAspectRatio().get(mCameraId, mCharacteristics);
        switch (targetAspectRatio) {
            case TargetAspectRatio.RATIO_4_3:
                outputRatio = mIsSensorLandscapeResolution ? ASPECT_RATIO_4_3 : ASPECT_RATIO_3_4;
                break;
            case TargetAspectRatio.RATIO_16_9:
                outputRatio = mIsSensorLandscapeResolution ? ASPECT_RATIO_16_9 : ASPECT_RATIO_9_16;
                break;
            case TargetAspectRatio.RATIO_MAX_JPEG:
                Size maxJpegSize = fetchMaxNormalOutputSize(ImageFormat.JPEG);
                outputRatio = new Rational(maxJpegSize.getWidth(), maxJpegSize.getHeight());
                break;
            case TargetAspectRatio.RATIO_ORIGINAL:
                break;
        }

        return outputRatio;
    }

    @Nullable
    static Size getTargetSizeByResolutionSelector(@NonNull ResolutionSelector resolutionSelector,
            int targetRotation, int sensorOrientation, int lensFacing) {
        Size targetSize = resolutionSelector.getPreferredResolution();

        // Calibrate targetSize by the target rotation value if it is set by the Android View
        // coordinate orientation.
        if (resolutionSelector.getSizeCoordinate() == SizeCoordinate.ANDROID_VIEW) {
            targetSize = flipSizeByRotation(targetSize, targetRotation, lensFacing,
                    sensorOrientation);
        }
        return targetSize;
    }

    private static boolean isRotationNeeded(int targetRotation, int lensFacing,
            int sensorOrientation) {
        int relativeRotationDegrees =
                CameraOrientationUtil.surfaceRotationToDegrees(targetRotation);

        // Currently this assumes that a back-facing camera is always opposite to the screen.
        // This may not be the case for all devices, so in the future we may need to handle that
        // scenario.
        boolean isOppositeFacingScreen = CameraCharacteristics.LENS_FACING_BACK == lensFacing;

        int sensorRotationDegrees = CameraOrientationUtil.getRelativeImageRotation(
                relativeRotationDegrees,
                sensorOrientation,
                isOppositeFacingScreen);
        return sensorRotationDegrees == 90 || sensorRotationDegrees == 270;
    }

    @NonNull
    private List<Size> excludeProblematicSizes(@NonNull List<Size> resolutionCandidateList,
            int imageFormat) {
        List<Size> excludedSizes = fetchExcludedSizes(imageFormat);
        resolutionCandidateList.removeAll(excludedSizes);
        return resolutionCandidateList;
    }

    @NonNull
    private List<Size> fetchExcludedSizes(int imageFormat) {
        List<Size> excludedSizes = mExcludedSizeListCache.get(imageFormat);

        if (excludedSizes == null) {
            excludedSizes = mExcludedSupportedSizesContainer.get(imageFormat);
            mExcludedSizeListCache.put(imageFormat, excludedSizes);
        }

        return excludedSizes;
    }

    /**
     * Sorts the resolution candidate list according to the target aspect ratio and size settings.
     *
     * 1. The resolution candidate list will be grouped by aspect ratio.
     * 2. Each group only keeps one size which is not smaller than the target size.
     * 3. The aspect ratios of groups will be sorted against to the target aspect ratio setting by
     * CompareAspectRatiosByMappingAreaInFullFovAspectRatioSpace.
     * 4. Concatenate all sizes as the result list
     */
    @NonNull
    private List<Size> sortResolutionCandidateListByTargetAspectRatioAndSize(
            @NonNull List<Size> resolutionCandidateList, @NonNull Rational aspectRatio,
            @Nullable Size miniBoundingSize) {
        // Rearrange the supported size to put the ones with the same aspect ratio in the front
        // of the list and put others in the end from large to small. Some low end devices may
        // not able to get an supported resolution that match the preferred aspect ratio.

        // Group output sizes by aspect ratio.
        Map<Rational, List<Size>> aspectRatioSizeListMap =
                groupSizesByAspectRatio(resolutionCandidateList);

        // If the target resolution is set, use it to remove unnecessary larger sizes.
        if (miniBoundingSize != null) {
            // Remove unnecessary larger sizes from each aspect ratio size list
            for (Rational key : aspectRatioSizeListMap.keySet()) {
                removeSupportedSizesByMiniBoundingSize(aspectRatioSizeListMap.get(key),
                        miniBoundingSize);
            }
        }

        // Sort the aspect ratio key set by the target aspect ratio.
        List<Rational> aspectRatios = new ArrayList<>(aspectRatioSizeListMap.keySet());
        Rational fullFovRatio = mActiveArraySize != null ? new Rational(
                mActiveArraySize.getWidth(), mActiveArraySize.getHeight()) : null;
        Collections.sort(aspectRatios,
                new AspectRatioUtil.CompareAspectRatiosByMappingAreaInFullFovAspectRatioSpace(
                        aspectRatio, fullFovRatio));

        List<Size> resultList = new ArrayList<>();

        // Put available sizes into final result list by aspect ratio distance to target ratio.
        for (Rational rational : aspectRatios) {
            for (Size size : aspectRatioSizeListMap.get(rational)) {
                // A size may exist in multiple groups in mod16 condition. Keep only one in
                // the final list.
                if (!resultList.contains(size)) {
                    resultList.add(size);
                }
            }
        }

        return resultList;
    }

    /**
     * Returns {@code true} if the input resolution can be moved to the head of resolution
     * candidate list.
     *
     * The resolution possibly can't be moved to head due to some quirks that sizes of
     * specific aspect ratio must be used to avoid problems.
     */
    private boolean canResolutionBeMovedToHead(@NonNull Size resolution) {
        @TargetAspectRatio.Ratio int targetAspectRatio =
                new TargetAspectRatio().get(mCameraId, mCharacteristics);

        switch (targetAspectRatio) {
            case TargetAspectRatio.RATIO_4_3:
                return hasMatchingAspectRatio(resolution, ASPECT_RATIO_4_3);
            case TargetAspectRatio.RATIO_16_9:
                return hasMatchingAspectRatio(resolution, ASPECT_RATIO_16_9);
            case TargetAspectRatio.RATIO_MAX_JPEG:
                Size maxJpegSize = fetchMaxNormalOutputSize(ImageFormat.JPEG);
                Rational maxJpegRatio = new Rational(maxJpegSize.getWidth(),
                        maxJpegSize.getHeight());
                return hasMatchingAspectRatio(resolution, maxJpegRatio);
        }

        return true;
    }

    private Size fetchMaxNormalOutputSize(int imageFormat) {
        Size size = mMaxSizeCache.get(imageFormat);
        if (size != null) {
            return size;
        }
        Size maxSize = getMaxNormalOutputSizeByFormat(imageFormat);
        mMaxSizeCache.put(imageFormat, maxSize);
        return maxSize;
    }

    /**
     * Gets max normal supported output size for specific image format.
     *
     * <p>Normal supported output sizes mean the sizes retrieved by the
     * {@link StreamConfigurationMap#getOutputSizes(int)}. The high resolution sizes retrieved by
     * the {@link StreamConfigurationMap#getHighResolutionOutputSizes(int)} are not included.
     *
     * @param imageFormat the image format info
     * @return the max normal supported output size for the image format
     */
    private Size getMaxNormalOutputSizeByFormat(int imageFormat) {
        Size[] outputSizes = getAllOutputSizesByFormat(imageFormat, false);

        return SizeUtil.getMaxSize(Arrays.asList(outputSizes));
    }

    private boolean isBurstCaptureSupported() {
        int[] availableCapabilities =
                mCharacteristics.get(CameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES);

        if (availableCapabilities != null) {
            for (int capability : availableCapabilities) {
                if (capability
                        == CameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES_BURST_CAPTURE) {
                    return true;
                }
            }
        }

        return false;
    }

    //////////////////////////////////////////////////////////////////////////////////////////
    // The following functions can be reused by the legacy resolution selection logic. The can be
    // changed as private function after the legacy resolution API is completely removed.
    //////////////////////////////////////////////////////////////////////////////////////////

    // Use target rotation to calibrate the size.
    @Nullable
    static Size flipSizeByRotation(@Nullable Size size, int targetRotation, int lensFacing,
            int sensorOrientation) {
        Size outputSize = size;
        // Calibrates the size with the display and sensor rotation degrees values.
        if (size != null && isRotationNeeded(targetRotation, lensFacing, sensorOrientation)) {
            outputSize = new Size(/* width= */size.getHeight(), /* height= */size.getWidth());
        }
        return outputSize;
    }

    static Map<Rational, List<Size>> groupSizesByAspectRatio(List<Size> sizes) {
        Map<Rational, List<Size>> aspectRatioSizeListMap = new HashMap<>();

        List<Rational> aspectRatioKeys = getResolutionListGroupingAspectRatioKeys(sizes);

        for (Rational aspectRatio: aspectRatioKeys) {
            aspectRatioSizeListMap.put(aspectRatio, new ArrayList<>());
        }

        for (Size outputSize : sizes) {
            for (Rational key : aspectRatioSizeListMap.keySet()) {
                // Put the size into all groups that is matched in mod16 condition since a size
                // may match multiple aspect ratio in mod16 algorithm.
                if (hasMatchingAspectRatio(outputSize, key)) {
                    aspectRatioSizeListMap.get(key).add(outputSize);
                }
            }
        }

        return aspectRatioSizeListMap;
    }

    /**
     * Returns the grouping aspect ratio keys of the input resolution list.
     *
     * <p>Some sizes might be mod16 case. When grouping, those sizes will be grouped into an
     * existing aspect ratio group if the aspect ratio can match by the mod16 rule.
     */
    @NonNull
    static List<Rational> getResolutionListGroupingAspectRatioKeys(
            @NonNull List<Size> resolutionCandidateList) {
        List<Rational> aspectRatios = new ArrayList<>();

        // Adds the default 4:3 and 16:9 items first to avoid their mod16 sizes to create
        // additional items.
        aspectRatios.add(ASPECT_RATIO_4_3);
        aspectRatios.add(ASPECT_RATIO_16_9);

        // Tries to find the aspect ratio which the target size belongs to.
        for (Size size : resolutionCandidateList) {
            Rational newRatio = new Rational(size.getWidth(), size.getHeight());
            boolean aspectRatioFound = aspectRatios.contains(newRatio);

            // The checking size might be a mod16 size which can be mapped to an existing aspect
            // ratio group.
            if (!aspectRatioFound) {
                boolean hasMatchingAspectRatio = false;
                for (Rational aspectRatio : aspectRatios) {
                    if (hasMatchingAspectRatio(size, aspectRatio)) {
                        hasMatchingAspectRatio = true;
                        break;
                    }
                }
                if (!hasMatchingAspectRatio) {
                    aspectRatios.add(newRatio);
                }
            }
        }

        return aspectRatios;
    }

    /**
     * Removes unnecessary sizes by target size.
     *
     * <p>If the target resolution is set, a size that is equal to or closest to the target
     * resolution will be selected. If the list includes more than one size equal to or larger
     * than the target resolution, only one closest size needs to be kept. The other larger sizes
     * can be removed so that they won't be selected to use.
     *
     * @param supportedSizesList The list should have been sorted in descending order.
     * @param miniBoundingSize The target size used to remove unnecessary sizes.
     */
    static void removeSupportedSizesByMiniBoundingSize(List<Size> supportedSizesList,
            Size miniBoundingSize) {
        if (supportedSizesList == null || supportedSizesList.isEmpty()) {
            return;
        }

        int indexBigEnough = -1;
        List<Size> removeSizes = new ArrayList<>();

        // Get the index of the item that is equal to or closest to the target size.
        for (int i = 0; i < supportedSizesList.size(); i++) {
            Size outputSize = supportedSizesList.get(i);
            if (outputSize.getWidth() >= miniBoundingSize.getWidth()
                    && outputSize.getHeight() >= miniBoundingSize.getHeight()) {
                // New big enough item closer to the target size is found. Adding the previous
                // one into the sizes list that will be removed.
                if (indexBigEnough >= 0) {
                    removeSizes.add(supportedSizesList.get(indexBigEnough));
                }

                indexBigEnough = i;
            } else {
                // If duplicated miniBoundingSize items exist in the list, the size will be added
                // into the removeSizes list. Removes it from the removeSizes list to keep the
                // miniBoundingSize items in the final result list.
                if (indexBigEnough >= 0) {
                    removeSizes.remove(supportedSizesList.get(indexBigEnough));
                }
                break;
            }
        }

        // Remove the unnecessary items that are larger than the item closest to the target size.
        supportedSizesList.removeAll(removeSizes);
    }

    static boolean isSensorLandscapeResolution(
            @NonNull CameraCharacteristicsCompat characteristicsCompat) {
        Size pixelArraySize =
                characteristicsCompat.get(CameraCharacteristics.SENSOR_INFO_PIXEL_ARRAY_SIZE);

        // Make the default value is true since usually the sensor resolution is landscape.
        return pixelArraySize == null || pixelArraySize.getWidth() >= pixelArraySize.getHeight();
    }

    //////////////////////////////////////////////////////////////////////////////////////////
    // The above functions can be reused by the legacy resolution selection logic. The can be
    // changed as private function after the legacy resolution API is completely removed.
    //////////////////////////////////////////////////////////////////////////////////////////

    @RequiresApi(23)
    private static class Api23Impl {
        private Api23Impl() {
            // This class is not instantiable.
        }

        @DoNotInline
        static Size[] getHighResolutionOutputSizes(StreamConfigurationMap streamConfigurationMap,
                int format) {
            return streamConfigurationMap.getHighResolutionOutputSizes(format);
        }
    }
}


text:
/* Versions of the 'struct stat' data structure used in compatibility xstat
   functions.  */
#define _STAT_VER 0
#define _MKNOD_VER 0


text:
<!DOCTYPE html>

    <title>Blog Template</title>
    <link type="text/css" rel="stylesheet" href="../stylesheets/blog-stylesheet.css"/>

Search goes here

Other Blogs

Music

Sports

People

social media links here...

Posts

What are the best practices associated with using classes vs. ids?

In using a common CSS makes layout and formatting of your website pages, especially if it has more than one page or has a complex layout or formatting.

This is because if you have uniform styles for the content of the website but things like text size,emphasis like bold, italic and other styling options you may want to use need to be applied in the web page at the point they occur.

This is not a problem per se if the website doe's not change or change often, but presents extra effort where the change applies to multiple parts of the page content. So for example you use a particular style for paragraphs for technical details and there are several places and many pages where technical details are present. The way you would normally apply the change is to find every paragraph and every page technical content is present that the current style was applied to and update the style for each paragraph. This task would involve alot effort applying the same change, just to different parts of the website.

Thanks to CSS, there is a more efficient way to manage the application and updating of styles and layout in your website.

We can use class'es and id's to act as identifiers for elements that are to have the same type of formatting or positioning, across your website. These identifiers are added to the content tags where appropriate.

If we use the example from above where technical content all have the same style, then it might look something like this,

               if it were a class &ltp class="technical_content"> Some technical text&lt/p&gt

                or if were an id
                &ltp id="technical_content"> Some technical text&ltp&gt

, in our CSS We would have an entry that defined the "technical_content" class, something like this..

The '.' is used to prefix the class in the CSS
            .technical_content{ font-family: Arial; font-style: italic;}

            the '#' is used to prefix id's in the CSS
            #technical_content{ font-family: Arial; font-style: italic;}

We add the .technical_content class to any/every paragraph that contains technical content, this will format each of those the same way now as it was before. The big difference now is that if we want to make changes to the technical content style in future we only have to make the change in the technical_content class definition in our CSS and magically the new styling is applied everywhere this class was applied.

Classes and id's are both used to identify web page elements the key difference and reason for choosign the right one to use or define is whether or not the attributes you are wanting to apply is used only once on the web page or more than once. A particular class can be used more than once on a web page. An id can only be used once on each web page.Each page will only have one footer, one header, one search element so these would be best defined using id's, many elements of your page though may be the same font family, might be italic, might be centered so these elements would be best defined using class'es

id's are unique in a page, there is only one of you, many people can belong to a class, many people have black hair, many people wear glasses.

I would see the primary way I would use hashes and arrays is for ordering lists, searching for specific elements, and generally holding set's of elements, that may or may not be related.

    back to blog index

Footer aknowledgments etc.


text:
enum KBSTATE
{
    UP,
    DOWN,
    PRESS,
    RELEASE,
    RESET
};

class KBData;
typedef void (*KBHandler)( const KBData&, KBSTATE );

typedef void (*MouseHandler)( KBSTATE, int x, int y, int delx, int dely, int mod );

#endif


text:
/*
 * Xero Payroll AU API
 * This is the Xero Payroll API for orgs in Australia region.
 *
 * Contact: api@xero.com
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */

package com.xero.models.payrollau;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.xero.api.StringUtil;
import io.swagger.annotations.ApiModelProperty;
import java.util.Objects;
import java.util.UUID;

/** SuperMembership */
public class SuperMembership {
  StringUtil util = new StringUtil();

  @JsonProperty("SuperMembershipID")
  private UUID superMembershipID;

  @JsonProperty("SuperFundID")
  private UUID superFundID;

  @JsonProperty("EmployeeNumber")
  private String employeeNumber;
  /**
   * Xero unique identifier for Super membership
   *
   * @param superMembershipID UUID
   * @return SuperMembership
   */
  public SuperMembership superMembershipID(UUID superMembershipID) {
    this.superMembershipID = superMembershipID;
    return this;
  }

  /**
   * Xero unique identifier for Super membership
   *
   * @return superMembershipID
   */
  @ApiModelProperty(
      example = "4333d5cd-53a5-4c31-98e5-a8b4e5676b0b",
      value = "Xero unique identifier for Super membership")
  /**
   * Xero unique identifier for Super membership
   *
   * @return superMembershipID UUID
   */
  public UUID getSuperMembershipID() {
    return superMembershipID;
  }

  /**
   * Xero unique identifier for Super membership
   *
   * @param superMembershipID UUID
   */
  public void setSuperMembershipID(UUID superMembershipID) {
    this.superMembershipID = superMembershipID;
  }

  /**
   * Xero identifier for super fund
   *
   * @param superFundID UUID
   * @return SuperMembership
   */
  public SuperMembership superFundID(UUID superFundID) {
    this.superFundID = superFundID;
    return this;
  }

  /**
   * Xero identifier for super fund
   *
   * @return superFundID
   */
  @ApiModelProperty(
      example = "2187a42b-639a-45cb-9eed-cd4ae488306a",
      required = true,
      value = "Xero identifier for super fund")
  /**
   * Xero identifier for super fund
   *
   * @return superFundID UUID
   */
  public UUID getSuperFundID() {
    return superFundID;
  }

  /**
   * Xero identifier for super fund
   *
   * @param superFundID UUID
   */
  public void setSuperFundID(UUID superFundID) {
    this.superFundID = superFundID;
  }

  /**
   * The membership number assigned to the employee by the super fund.
   *
   * @param employeeNumber String
   * @return SuperMembership
   */
  public SuperMembership employeeNumber(String employeeNumber) {
    this.employeeNumber = employeeNumber;
    return this;
  }

  /**
   * The membership number assigned to the employee by the super fund.
   *
   * @return employeeNumber
   */
  @ApiModelProperty(
      example = "1234",
      required = true,
      value = "The membership number assigned to the employee by the super fund.")
  /**
   * The membership number assigned to the employee by the super fund.
   *
   * @return employeeNumber String
   */
  public String getEmployeeNumber() {
    return employeeNumber;
  }

  /**
   * The membership number assigned to the employee by the super fund.
   *
   * @param employeeNumber String
   */
  public void setEmployeeNumber(String employeeNumber) {
    this.employeeNumber = employeeNumber;
  }

  @Override
  public boolean equals(java.lang.Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    SuperMembership superMembership = (SuperMembership) o;
    return Objects.equals(this.superMembershipID, superMembership.superMembershipID)
        && Objects.equals(this.superFundID, superMembership.superFundID)
        && Objects.equals(this.employeeNumber, superMembership.employeeNumber);
  }

  @Override
  public int hashCode() {
    return Objects.hash(superMembershipID, superFundID, employeeNumber);
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("class SuperMembership {\n");
    sb.append("    superMembershipID: ").append(toIndentedString(superMembershipID)).append("\n");
    sb.append("    superFundID: ").append(toIndentedString(superFundID)).append("\n");
    sb.append("    employeeNumber: ").append(toIndentedString(employeeNumber)).append("\n");
    sb.append("}");
    return sb.toString();
  }

  /**
   * Convert the given object to string with each line indented by 4 spaces (except the first line).
   */
  private String toIndentedString(java.lang.Object o) {
    if (o == null) {
      return "null";
    }
    return o.toString().replace("\n", "\n    ");
  }
}


text:
<?php

/**
 * Paypal Express Onepage checkout block
 *
 * @category   Mage
 * @package    Mage_Paypal
 * @author      Magento Core Team <core@magentocommerce.com>
 */
class Mage_Paypal_Block_Express_Review extends Mage_Core_Block_Template
{
    /**
     * @var Mage_Sales_Model_Quote
     */
    protected $_quote;

    /**
     * Currently selected shipping rate
     *
     * @var Mage_Sales_Model_Quote_Address_Rate
     */
    protected $_currentShippingRate = null;

    /**
     * Paypal action prefix
     *
     * @var string
     */
    protected $_paypalActionPrefix = 'paypal';

    /**
     * Quote object setter
     *
     * @param Mage_Sales_Model_Quote $quote
     * @return Mage_Paypal_Block_Express_Review
     */
    public function setQuote(Mage_Sales_Model_Quote $quote)
    {
        $this->_quote = $quote;
        return $this;
    }

    /**
     * Return quote billing address
     *
     * @return Mage_Sales_Model_Quote_Address
     */
    public function getBillingAddress()
    {
        return $this->_quote->getBillingAddress();
    }

    /**
     * Return quote shipping address
     *
     * @return Mage_Sales_Model_Quote_Address
     */
    public function getShippingAddress()
    {
        if ($this->_quote->getIsVirtual()) {
            return false;
        }
        return $this->_quote->getShippingAddress();
    }

    /**
     * Get HTML output for specified address
     *
     * @param Mage_Sales_Model_Quote_Address
     * @return string
     */
    public function renderAddress($address)
    {
        return $address->getFormated(true);
    }

    /**
     * Return carrier name from config, base on carrier code
     *
     * @param $carrierCode string
     * @return string
     */
    public function getCarrierName($carrierCode)
    {
        if ($name = Mage::getStoreConfig("carriers/{$carrierCode}/title")) {
            return $name;
        }
        return $carrierCode;
    }

    /**
     * Get either shipping rate code or empty value on error
     *
     * @param Varien_Object $rate
     * @return string
     */
    public function renderShippingRateValue(Varien_Object $rate)
    {
        if ($rate->getErrorMessage()) {
            return '';
        }
        return $rate->getCode();
    }

    /**
     * Get shipping rate code title and its price or error message
     *
     * @param Varien_Object $rate
     * @param string $format
     * @param string $inclTaxFormat
     * @return string
     */
    public function renderShippingRateOption($rate, $format = '%s - %s%s', $inclTaxFormat = ' (%s %s)')
    {
        $renderedInclTax = '';
        if ($rate->getErrorMessage()) {
            $price = $rate->getErrorMessage();
        } else {
            $price = $this->_getShippingPrice($rate->getPrice(),
                $this->helper('tax')->displayShippingPriceIncludingTax());

            $incl = $this->_getShippingPrice($rate->getPrice(), true);
            if (($incl != $price) && $this->helper('tax')->displayShippingBothPrices()) {
                $renderedInclTax = sprintf($inclTaxFormat, Mage::helper('tax')->__('Incl. Tax'), $incl);
            }
        }
        return sprintf($format, $this->escapeHtml($rate->getMethodTitle()), $price, $renderedInclTax);
    }

    /**
     * Getter for current shipping rate
     *
     * @return Mage_Sales_Model_Quote_Address_Rate
     */
    public function getCurrentShippingRate()
    {
        return $this->_currentShippingRate;
    }

    /**
     * Set paypal actions prefix
     */
    public function setPaypalActionPrefix($prefix)
    {
        $this->_paypalActionPrefix = $prefix;
    }

    /**
     * Return formatted shipping price
     *
     * @param float $price
     * @param bool $isInclTax
     *
     * @return bool
     */
    protected function _getShippingPrice($price, $isInclTax)
    {
        return $this->_formatPrice($this->helper('tax')->getShippingPrice($price, $isInclTax, $this->_address));
    }

    /**
     * Format price base on store convert price method
     *
     * @param float $price
     * @return string
     */
    protected function _formatPrice($price)
    {
        return $this->_quote->getStore()->convertPrice($price, true);
    }

    /**
     * Retrieve payment method and assign additional template values
     *
     * @return Mage_Paypal_Block_Express_Review
     */
    protected function _beforeToHtml()
    {
        $methodInstance = $this->_quote->getPayment()->getMethodInstance();
        $this->setPaymentMethodTitle($methodInstance->getTitle());

        $this->setShippingRateRequired(true);
        if ($this->_quote->getIsVirtual()) {
            $this->setShippingRateRequired(false);
        } else {
            // prepare shipping rates
            $this->_address = $this->_quote->getShippingAddress();
            $groups = $this->_address->getGroupedAllShippingRates();
            if ($groups && $this->_address) {
                $this->setShippingRateGroups($groups);
                // determine current selected code & name
                foreach ($groups as $code => $rates) {
                    foreach ($rates as $rate) {
                        if ($this->_address->getShippingMethod() == $rate->getCode()) {
                            $this->_currentShippingRate = $rate;
                            break(2);
                        }
                    }
                }
            }

            $canEditShippingAddress = $this->_quote->getMayEditShippingAddress() && $this->_quote->getPayment()
                    ->getAdditionalInformation(Mage_Paypal_Model_Express_Checkout::PAYMENT_INFO_BUTTON) == 1;
            // misc shipping parameters
            $this->setShippingMethodSubmitUrl($this->getUrl("{$this->_paypalActionPrefix}/express/saveShippingMethod"))
                ->setCanEditShippingAddress($canEditShippingAddress)
                ->setCanEditShippingMethod($this->_quote->getMayEditShippingMethod())
            ;
        }

        $this->setEditUrl($this->getUrl("{$this->_paypalActionPrefix}/express/edit"))
            ->setPlaceOrderUrl($this->getUrl("{$this->_paypalActionPrefix}/express/placeOrder"));

        return parent::_beforeToHtml();
    }
}


text:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>string::reference</title>
<link rel="stylesheet" href="../../../../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../../../index.html" title="Chapter 1. Boost.JSON">
<link rel="up" href="../boost__json__string.html" title="string">
<link rel="prev" href="const_pointer.html" title="string::const_pointer">
<link rel="next" href="const_reference.html" title="string::const_reference">

Home
Libraries
People
FAQ
More

string::reference

          A reference to an element.

          Synopsis

using reference = char&;

Copyright © 2019, 2020 Vinnie Falco
Copyright © 2020 Krystian Stasiowski

        Distributed under the Boost Software License, Version 1.0. (See accompanying
        file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)


text:
package com.valarhao.valarnews.module.zhihu.common;

import android.content.Context;
import android.support.v7.widget.CardView;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.valarhao.valarnews.R;
import com.valarhao.valarnews.common.util.GlideUtil;

import java.util.ArrayList;
import java.util.List;

public class RecyclerListAdapter extends RecyclerView.Adapter<RecyclerListAdapter.ViewHolder> {

    private List<RecyclerItem> mRecyclerItems;
    private LayoutInflater mInflater;
    private Context mContext;
    private OnItemClickListener mOnItemClickListener;
    private OnBottomListener mOnBottomListener;

    public RecyclerListAdapter(Context context) {
        mContext = context;
        mInflater = LayoutInflater.from(mContext);
        mRecyclerItems = new ArrayList<>();
    }

    public void addRecyclerItem(RecyclerItem recyclerItem) {
        if (!mRecyclerItems.contains(recyclerItem)) {
            mRecyclerItems.add(recyclerItem);
        }
    }

    public RecyclerItem getRecyclerItem(int position) {
        return mRecyclerItems.get(position);
    }

    public void clear() {
        mRecyclerItems.clear();
    }

    @Override
    public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = mInflater.inflate(R.layout.zhihu_item_list, parent, false);
        return new ViewHolder(view);
    }

    @Override
    public void onBindViewHolder(final ViewHolder holder, int position) {
        RecyclerItem recyclerItem = mRecyclerItems.get(position);
        holder.itemTxtTitle.setText(recyclerItem.getTitle());
        //加载图片
        if (recyclerItem.getImgLink() != null) {
            GlideUtil.load(mContext, recyclerItem.getImgLink(), holder.itemImg);
        }
        //点击item监听
        if (mOnItemClickListener != null) {
            holder.itemCard.setBackgroundResource(R.drawable.ripple); //点击水波纹效果
            holder.itemCard.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    int position = holder.getLayoutPosition();
                    mOnItemClickListener.onItemClick(holder.itemCard, position);
                }
            });
        }
        //下拉到底部监听
        if (mOnBottomListener != null) {
            if (position == getItemCount() - 1) {
                mOnBottomListener.OnBottom();
            }
        }
    }

    @Override
    public int getItemCount() {
        return mRecyclerItems.size();
    }

    public class ViewHolder extends RecyclerView.ViewHolder {

        public CardView itemCard;
        public ImageView itemImg;
        public TextView itemTxtTitle;

        public ViewHolder(View view) {
            super(view);
            itemCard = (CardView) view.findViewById(R.id.cardItemList);
            itemImg = (ImageView) view.findViewById(R.id.imgItemList);
            itemTxtTitle = (TextView) view.findViewById(R.id.txtItemList);
        }
    }

    public interface OnItemClickListener {
        void onItemClick(View view, int position);
    }

    public interface OnBottomListener {
        void OnBottom();
    }

    public void setOnItemClickListener(OnItemClickListener onItemClickListener) {
        mOnItemClickListener = onItemClickListener;
    }

    public void setOnBottomListener(OnBottomListener onBottomListener) {
        mOnBottomListener = onBottomListener;
    }
}


text:
import { BRAND_SYMBOL } from '../utils/brand';

type RelationshipsSchema = import('./record-data-schemas').RelationshipsSchema;
type AttributesSchema = import('./record-data-schemas').AttributesSchema;

/**
  @module @ember-data/store
*/

/**
 * Provides a encapsulated API access to a subset of store methods
 * for RecordData implementations.
 */
export interface RecordDataStoreWrapper {
  /**
   * @internal
   */
  [BRAND_SYMBOL]: 'RecordDataStoreWrapper';

  relationshipsDefinitionFor(modelName: string): RelationshipsSchema;
  attributesDefinitionFor(modelName: string): AttributesSchema;

  /**
   * update the `id` for the record of type `modelName` with the corresponding `clientId`
   * This operation can only be done for records whose `id` is `null`.
   */
  setRecordId(modelName: string, id: string, clientId: string): void;

  disconnectRecord(modelName: string, id: string | null, clientId: string): void;
  disconnectRecord(modelName: string, id: string, clientId?: string | null): void;
  disconnectRecord(modelName: string, id: string | null, clientId?: string | null): void;

  isRecordInUse(modelName: string, id: string | null, clientId: string): boolean;
  isRecordInUse(modelName: string, id: string, clientId?: string | null): boolean;
  isRecordInUse(modelName: string, id: string | null, clientId?: string | null): boolean;

  notifyPropertyChange(modelName: string, id: string | null, clientId: string | null, key: string): void;

  notifyHasManyChange(modelName: string, id: string | null, clientId: string, key: string): void;
  notifyHasManyChange(modelName: string, id: string, clientId: string | null | undefined, key: string): void;
  notifyHasManyChange(modelName: string, id: string | null, clientId: string | null | undefined, key: string): void;

  recordDataFor(modelName: string, id: string, clientId?: string): unknown;

  notifyBelongsToChange(modelName: string, id: string | null, clientId: string, key: string): void;
  notifyBelongsToChange(modelName: string, id: string, clientId: string | null | undefined, key: string): void;
  notifyBelongsToChange(modelName: string, id: string | null, clientId: string | null | undefined, key: string): void;

  inverseForRelationship(modelName: string, key: string): string | null;

  inverseIsAsyncForRelationship(modelName: string, key: string): boolean;
  notifyErrorsChange(modelName: string, id: string | null, clientId: string | null): void;
  notifyStateChange(modelName: string, id: string | null, clientId: string | null, key?: string): void;
}