text:
package org.apache.pulsar.broker.service.persistent;

import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.testng.Assert.assertTrue;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.assertNull;
import java.io.ByteArrayOutputStream;
import java.lang.reflect.Field;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import com.google.common.collect.Multimap;
import com.google.common.collect.Sets;
import lombok.Cleanup;
import org.apache.bookkeeper.client.LedgerHandle;
import org.apache.bookkeeper.mledger.ManagedLedger;
import org.apache.pulsar.broker.service.BrokerTestBase;
import org.apache.pulsar.broker.stats.PrometheusMetricsTest;
import org.apache.pulsar.broker.stats.prometheus.PrometheusMetricsGenerator;
import org.apache.pulsar.client.api.*;
import org.apache.pulsar.common.naming.NamespaceBundle;
import org.apache.pulsar.common.naming.TopicName;
import org.apache.pulsar.common.policies.data.Policies;
import org.apache.pulsar.common.policies.data.TopicStats;
import org.awaitility.Awaitility;
import org.junit.Assert;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;

@Test(groups = "broker")
public class PersistentTopicTest extends BrokerTestBase {

    @BeforeMethod(alwaysRun = true)
    @Override
    protected void setup() throws Exception {
        super.baseSetup();
    }

    @AfterMethod(alwaysRun = true)
    @Override
    protected void cleanup() throws Exception {
        super.internalCleanup();
    }

    /**
     * Test validates that broker cleans up topic which failed to unload while bundle unloading.
     *
     * @throws Exception
     */
    @Test
    public void testCleanFailedUnloadTopic() throws Exception {
        final String topicName = "persistent://prop/ns-abc/failedUnload";

        // 1. producer connect
        Producer<byte[]> producer = pulsarClient.newProducer().topic(topicName).enableBatching(false)
                .messageRoutingMode(MessageRoutingMode.SinglePartition).create();

        PersistentTopic topicRef = (PersistentTopic) pulsar.getBrokerService().getTopicReference(topicName).get();
        assertNotNull(topicRef);

        ManagedLedger ml = topicRef.ledger;
        LedgerHandle ledger = mock(LedgerHandle.class);
        Field handleField = ml.getClass().getDeclaredField("currentLedger");
        handleField.setAccessible(true);
        handleField.set(ml, ledger);
        doNothing().when(ledger).asyncClose(any(), any());

        NamespaceBundle bundle = pulsar.getNamespaceService().getBundle(TopicName.get(topicName));
        pulsar.getNamespaceService().unloadNamespaceBundle(bundle, 5, TimeUnit.SECONDS).get();

        retryStrategically((test) -> !pulsar.getBrokerService().getTopicReference(topicName).isPresent(), 5, 500);
        assertFalse(pulsar.getBrokerService().getTopicReference(topicName).isPresent());

        producer.close();
    }

    /**
     * Test validates if topic's dispatcher is stuck then broker can doscover and unblock it.
     *
     * @throws Exception
     */
    @Test
    public void testUnblockStuckSubscription() throws Exception {
        final String topicName = "persistent://prop/ns-abc/stuckSubscriptionTopic";
        final String sharedSubName = "shared";
        final String failoverSubName = "failOver";

        Consumer<String> consumer1 = pulsarClient.newConsumer(Schema.STRING).topic(topicName)
                .subscriptionType(SubscriptionType.Shared).subscriptionName(sharedSubName).subscribe();
        Consumer<String> consumer2 = pulsarClient.newConsumer(Schema.STRING).topic(topicName)
                .subscriptionType(SubscriptionType.Failover).subscriptionName(failoverSubName).subscribe();
        Producer<String> producer = pulsarClient.newProducer(Schema.STRING).topic(topicName).create();

        PersistentTopic topic = (PersistentTopic) pulsar.getBrokerService().getTopicReference(topicName).get();
        PersistentSubscription sharedSub = topic.getSubscription(sharedSubName);
        PersistentSubscription failOverSub = topic.getSubscription(failoverSubName);

        PersistentDispatcherMultipleConsumers sharedDispatcher = (PersistentDispatcherMultipleConsumers) sharedSub
                .getDispatcher();
        PersistentDispatcherSingleActiveConsumer failOverDispatcher = (PersistentDispatcherSingleActiveConsumer) failOverSub
                .getDispatcher();

        // build backlog
        consumer1.close();
        consumer2.close();

        // block sub to read messages
        sharedDispatcher.havePendingRead = true;
        failOverDispatcher.havePendingRead = true;

        producer.newMessage().value("test").eventTime(5).send();
        producer.newMessage().value("test").eventTime(5).send();

        consumer1 = pulsarClient.newConsumer(Schema.STRING).topic(topicName).subscriptionType(SubscriptionType.Shared)
                .subscriptionName(sharedSubName).subscribe();
        consumer2 = pulsarClient.newConsumer(Schema.STRING).topic(topicName).subscriptionType(SubscriptionType.Failover)
                .subscriptionName(failoverSubName).subscribe();
        Message<String> msg = consumer1.receive(2, TimeUnit.SECONDS);
        assertNull(msg);
        msg = consumer2.receive(2, TimeUnit.SECONDS);
        assertNull(msg);

        // allow reads but dispatchers are still blocked
        sharedDispatcher.havePendingRead = false;
        failOverDispatcher.havePendingRead = false;

        // run task to unblock stuck dispatcher: first iteration sets the lastReadPosition and next iteration will
        // unblock the dispatcher read because read-position has not been moved since last iteration.
        sharedSub.checkAndUnblockIfStuck();
        failOverDispatcher.checkAndUnblockIfStuck();
        assertTrue(sharedSub.checkAndUnblockIfStuck());
        assertTrue(failOverDispatcher.checkAndUnblockIfStuck());

        msg = consumer1.receive(5, TimeUnit.SECONDS);
        assertNotNull(msg);
        msg = consumer2.receive(5, TimeUnit.SECONDS);
        assertNotNull(msg);
    }

    @Test
    public void testDeleteNamespaceInfiniteRetry() throws Exception {
        //init namespace
        final String myNamespace = "prop/ns" + UUID.randomUUID();
        admin.namespaces().createNamespace(myNamespace, Sets.newHashSet("test"));
        final String topic = "persistent://" + myNamespace + "/testDeleteNamespaceInfiniteRetry";
        conf.setForceDeleteNamespaceAllowed(true);
        //init topic and policies
        pulsarClient.newProducer().topic(topic).create().close();
        admin.namespaces().setMaxConsumersPerTopic(myNamespace, 0);
        Awaitility.await().atMost(3, TimeUnit.SECONDS).until(()
                -> admin.namespaces().getMaxConsumersPerTopic(myNamespace) == 0);

        PersistentTopic persistentTopic =
                spy((PersistentTopic) pulsar.getBrokerService().getTopicIfExists(topic).get().get());

        Policies policies = new Policies();
        policies.deleted = true;
        persistentTopic.onPoliciesUpdate(policies);
        verify(persistentTopic, times(0)).checkReplicationAndRetryOnFailure();

        policies.deleted = false;
        persistentTopic.onPoliciesUpdate(policies);
        verify(persistentTopic, times(1)).checkReplicationAndRetryOnFailure();
    }

    @Test
    public void testAccumulativeStats() throws Exception {
        final String topicName = "persistent://prop/ns-abc/aTopic";
        final String sharedSubName = "shared";
        final String failoverSubName = "failOver";

        Consumer<String> consumer1 = pulsarClient.newConsumer(Schema.STRING).topic(topicName)
                .subscriptionType(SubscriptionType.Shared).subscriptionName(sharedSubName).subscribe();
        Consumer<String> consumer2 = pulsarClient.newConsumer(Schema.STRING).topic(topicName)
                .subscriptionType(SubscriptionType.Failover).subscriptionName(failoverSubName).subscribe();
        Producer<String> producer = pulsarClient.newProducer(Schema.STRING).topic(topicName).create();

        PersistentTopic topic = (PersistentTopic) pulsar.getBrokerService().getTopicReference(topicName).get();

        // stats are at zero before any activity
        TopicStats stats = topic.getStats(false, false, false);
        assertEquals(stats.getBytesInCounter(), 0);
        assertEquals(stats.getMsgInCounter(), 0);
        assertEquals(stats.getBytesOutCounter(), 0);
        assertEquals(stats.getMsgOutCounter(), 0);

        producer.newMessage().value("test").eventTime(5).send();

        Message<String> msg = consumer1.receive();
        assertNotNull(msg);
        msg = consumer2.receive();
        assertNotNull(msg);

        // send/receive result in non-zero stats
        TopicStats statsBeforeUnsubscribe = topic.getStats(false, false, false);
        assertTrue(statsBeforeUnsubscribe.getBytesInCounter() > 0);
        assertTrue(statsBeforeUnsubscribe.getMsgInCounter() > 0);
        assertTrue(statsBeforeUnsubscribe.getBytesOutCounter() > 0);
        assertTrue(statsBeforeUnsubscribe.getMsgOutCounter() > 0);

        consumer1.unsubscribe();
        consumer2.unsubscribe();
        producer.close();
        topic.getProducers().values().forEach(topic::removeProducer);
        assertEquals(topic.getProducers().size(), 0);

        // consumer unsubscribe/producer removal does not result in stats loss
        TopicStats statsAfterUnsubscribe = topic.getStats(false, false, false);
        assertEquals(statsAfterUnsubscribe.getBytesInCounter(), statsBeforeUnsubscribe.getBytesInCounter());
        assertEquals(statsAfterUnsubscribe.getMsgInCounter(), statsBeforeUnsubscribe.getMsgInCounter());
        assertEquals(statsAfterUnsubscribe.getBytesOutCounter(), statsBeforeUnsubscribe.getBytesOutCounter());
        assertEquals(statsAfterUnsubscribe.getMsgOutCounter(), statsBeforeUnsubscribe.getMsgOutCounter());
    }

    @Test
    public void testPersistentPartitionedTopicUnload() throws Exception {
        final String topicName = "persistent://prop/ns/failedUnload";
        final String ns = "prop/ns";
        final int partitions = 5;
        final int producers = 1;
        // ensure that the number of bundle is greater than 1
        final int bundles = 2;

        admin.namespaces().createNamespace(ns, bundles);
        admin.topics().createPartitionedTopic(topicName, partitions);

        List<Producer> producerSet = new ArrayList<>();
        for (int i = 0; i < producers; i++) {
            producerSet.add(pulsarClient.newProducer(Schema.STRING).topic(topicName).create());
        }

        assertFalse(pulsar.getBrokerService().getTopics().containsKey(topicName));
        pulsar.getBrokerService().getTopicIfExists(topicName).get();
        assertTrue(pulsar.getBrokerService().getTopics().containsKey(topicName));

        // ref of partitioned-topic name should be empty
        assertFalse(pulsar.getBrokerService().getTopicReference(topicName).isPresent());

        NamespaceBundle bundle = pulsar.getNamespaceService().getBundle(TopicName.get(topicName));
        pulsar.getNamespaceService().unloadNamespaceBundle(bundle, 5, TimeUnit.SECONDS).get();

        for (Producer producer : producerSet) {
            producer.close();
        }
    }

    @DataProvider(name = "topicAndMetricsLevel")
    public Object[][] indexPatternTestData() {
        return new Object[][]{
                new Object[] {"persistent://prop/autoNs/test_delayed_message_metric", true},
                new Object[] {"persistent://prop/autoNs/test_delayed_message_metric", false},
        };
    }

    @Test(dataProvider = "topicAndMetricsLevel")
    public void testDelayedDeliveryTrackerMemoryUsageMetric(String topic, boolean exposeTopicLevelMetrics) throws Exception {
        PulsarClient client = pulsar.getClient();
        String namespace = TopicName.get(topic).getNamespace();
        admin.namespaces().createNamespace(namespace);

        final int messages = 100;
        CountDownLatch latch = new CountDownLatch(messages);

        @Cleanup
        Producer<String> producer = client.newProducer(Schema.STRING).topic(topic).enableBatching(false).create();
        @Cleanup
        Consumer<String> consumer = client.newConsumer(Schema.STRING)
                .topic(topic)
                .subscriptionName("test_sub")
                .subscriptionType(SubscriptionType.Shared)
                .messageListener((MessageListener<String>) (consumer1, msg) -> {
                    try {
                        latch.countDown();
                        consumer1.acknowledge(msg);
                    } catch (PulsarClientException e) {
                        e.printStackTrace();
                    }
                })
                .subscribe();
        for (int a = 0; a < messages; a++) {
            producer.newMessage()
                    .value(UUID.randomUUID().toString())
                    .deliverAfter(30, TimeUnit.SECONDS)
                    .sendAsync();
        }
        producer.flush();

        latch.await(10, TimeUnit.SECONDS);
        ByteArrayOutputStream output = new ByteArrayOutputStream();
        PrometheusMetricsGenerator.generate(pulsar, exposeTopicLevelMetrics, true, true, output);
        String metricsStr = output.toString(StandardCharsets.UTF_8);

        Multimap<String, PrometheusMetricsTest.Metric> metricsMap = PrometheusMetricsTest.parseMetrics(metricsStr);
        Collection<PrometheusMetricsTest.Metric> metrics = metricsMap.get("pulsar_delayed_message_index_size_bytes");
        Assert.assertTrue(metrics.size() > 0);

        int topicLevelNum = 0;
        int namespaceLevelNum = 0;
        for (PrometheusMetricsTest.Metric metric : metrics) {
            if (exposeTopicLevelMetrics && metric.tags.get("topic").equals(topic)) {
                Assert.assertTrue(metric.value > 0);
                topicLevelNum++;
            } else if (!exposeTopicLevelMetrics && metric.tags.get("namespace").equals(namespace)) {
                Assert.assertTrue(metric.value > 0);
                namespaceLevelNum++;
            }
        }

        if (exposeTopicLevelMetrics) {
            Assert.assertTrue(topicLevelNum > 0);
            Assert.assertEquals(0, namespaceLevelNum);
        } else {
            Assert.assertTrue(namespaceLevelNum > 0);
            Assert.assertEquals(topicLevelNum, 0);
        }
    }

    @Test
    public void testUpdateCursorLastActive() throws Exception {
        final String topicName = "persistent://prop/ns-abc/aTopic";
        final String sharedSubName = "shared";
        final String failoverSubName = "failOver";

        long beforeAddConsumerTimestamp = System.currentTimeMillis();
        Thread.sleep(1);
        Consumer<String> consumer = pulsarClient.newConsumer(Schema.STRING).topic(topicName)
                .subscriptionType(SubscriptionType.Shared).subscriptionName(sharedSubName)
                .acknowledgmentGroupTime(0, TimeUnit.MILLISECONDS).subscribe();
        Consumer<String> consumer2 = pulsarClient.newConsumer(Schema.STRING).topic(topicName)
                .subscriptionType(SubscriptionType.Failover).subscriptionName(failoverSubName)
                .acknowledgmentGroupTime(0, TimeUnit.MILLISECONDS).subscribe();
        Producer<String> producer = pulsarClient.newProducer(Schema.STRING).topic(topicName).create();

        PersistentTopic topic = (PersistentTopic) pulsar.getBrokerService().getTopicReference(topicName).get();
        PersistentSubscription persistentSubscription =  topic.getSubscription(sharedSubName);
        PersistentSubscription persistentSubscription2 =  topic.getSubscription(failoverSubName);

        // `addConsumer` should update last active
        assertTrue(persistentSubscription.getCursor().getLastActive() > beforeAddConsumerTimestamp);
        assertTrue(persistentSubscription2.getCursor().getLastActive() > beforeAddConsumerTimestamp);

        long beforeAckTimestamp = System.currentTimeMillis();
        Thread.sleep(1);
        producer.newMessage().value("test").send();
        Message<String> msg = consumer.receive();
        assertNotNull(msg);
        consumer.acknowledge(msg);
        msg = consumer2.receive();
        assertNotNull(msg);
        consumer2.acknowledge(msg);

        // Make sure ack commands have been sent to broker
        Awaitility.waitAtMost(5, TimeUnit.SECONDS)
                .until(() -> persistentSubscription.getCursor().getLastActive() > beforeAckTimestamp);
        Awaitility.waitAtMost(5, TimeUnit.SECONDS)
                .until(() -> persistentSubscription2.getCursor().getLastActive() > beforeAckTimestamp);

        // `acknowledgeMessage` should update last active
        assertTrue(persistentSubscription.getCursor().getLastActive() > beforeAckTimestamp);
        assertTrue(persistentSubscription2.getCursor().getLastActive() > beforeAckTimestamp);

        long beforeRemoveConsumerTimestamp = System.currentTimeMillis();
        Thread.sleep(1);
        consumer.unsubscribe();
        consumer2.unsubscribe();
        producer.close();

        // `removeConsumer` should update last active
        assertTrue(persistentSubscription.getCursor().getLastActive() > beforeRemoveConsumerTimestamp);
        assertTrue(persistentSubscription2.getCursor().getLastActive() > beforeRemoveConsumerTimestamp);
    }
}


text:
using namespace search;
using namespace vespalib::datastore;
using namespace search::memoryindex;
using vespalib::MemoryUsage;

using Builder = CompactWordsStore::Builder;
using Iterator = CompactWordsStore::Iterator;
using WordRefVector = Builder::WordRefVector;

const EntryRef w1(1);
const EntryRef w2(2);
const EntryRef w3(3);
const EntryRef w4(4);
const uint32_t d1(111);
const uint32_t d2(222);
const uint32_t d3(333);
const uint32_t d4(444);

WordRefVector
build(Iterator itr)
{
    WordRefVector words;
    for (; itr.valid(); ++itr) {
        words.push_back(itr.wordRef());
    }
    return words;
}

vespalib::string
toStr(Iterator itr)
{
    WordRefVector words = build(itr);
    std::ostringstream oss;
    oss << "[";
    bool firstWord = true;
    for (auto word : words) {
        if (!firstWord) oss << ",";
        oss << word.ref();
        firstWord = false;
    }
    oss << "]";
    return oss.str();
}

struct SingleDocumentTest : public ::testing::Test {
    CompactWordsStore store;
    SingleDocumentTest() : store() {
        store.insert(Builder(d1).insert(w1).insert(w2).insert(w3));
    }
};

struct MultiDocumentTest : public ::testing::Test {
    CompactWordsStore store;
    MultiDocumentTest() : store() {
        store.insert(Builder(d1).insert(w1));
        store.insert(Builder(d2).insert(w2));
        store.insert(Builder(d3).insert(w3));
    }
};

TEST_F(SingleDocumentTest, fields_and_words_can_be_added_for_a_document)
{
    EXPECT_EQ("[1,2,3]", toStr(store.get(d1)));
}

TEST_F(MultiDocumentTest, multiple_documents_can_be_added)
{
    EXPECT_EQ("[1]", toStr(store.get(d1)));
    EXPECT_EQ("[2]", toStr(store.get(d2)));
    EXPECT_EQ("[3]", toStr(store.get(d3)));
    EXPECT_FALSE(store.get(d4).valid());
}

TEST_F(MultiDocumentTest, documents_can_be_removed)
{
    store.remove(d2);
    EXPECT_TRUE(store.get(d1).valid());
    EXPECT_FALSE(store.get(d2).valid());
    EXPECT_TRUE(store.get(d3).valid());
}

TEST_F(MultiDocumentTest, documents_can_be_removed_and_reinserted)
{
    store.remove(d2);
    store.insert(Builder(d2).insert(w4));
    EXPECT_EQ("[4]", toStr(store.get(d2)));
}

TEST(CompactWordStoreTest, multiple_words_can_be_inserted_retrieved_and_removed)
{
    CompactWordsStore store;
    for (uint32_t docId = 0; docId < 50; ++docId) {
        Builder b(docId);
        for (uint32_t wordRef = 0; wordRef < 20000; ++wordRef) {
            b.insert(EntryRef(wordRef));
        }
        store.insert(b);
        store.commit();
        MemoryUsage usage = store.getMemoryUsage();
        std::cout << "memory usage (insert): docId=" << docId << ", alloc=" << usage.allocatedBytes() << ", used=" << usage.usedBytes() << std::endl;
    }
    for (uint32_t docId = 0; docId < 50; ++docId) {
        WordRefVector words = build(store.get(docId));
        EXPECT_EQ(20000u, words.size());
        uint32_t wordRef = 0;
        for (auto word : words) {
            EXPECT_EQ(wordRef++, word.ref());
        }
        store.remove(docId);
        store.commit();
        MemoryUsage usage = store.getMemoryUsage();
        std::cout << "memory usage (remove): docId=" << docId << ", alloc=" << usage.allocatedBytes() << ", used=" << usage.usedBytes() << std::endl;
    }
}

TEST(CompactWordStoreTest, initial_memory_usage_is_reported)
{
    CompactWordsStore store;
    CompactWordsStore::DocumentWordsMap docs;
    CompactWordsStore::Store internalStore;
    MemoryUsage initExp;
    initExp.incAllocatedBytes(docs.getMemoryConsumption());
    initExp.incUsedBytes(docs.getMemoryUsed());
    initExp.merge(internalStore.getMemoryUsage());
    MemoryUsage init = store.getMemoryUsage();
    EXPECT_EQ(initExp.allocatedBytes(), init.allocatedBytes());
    EXPECT_EQ(initExp.usedBytes(), init.usedBytes());
    EXPECT_GT(init.allocatedBytes(), init.usedBytes());
    EXPECT_GT(init.allocatedBytes(), 0u);
    EXPECT_GT(init.usedBytes(), 0u);
}

TEST(CompactWordStoreTest, memory_usage_is_updated_after_insert)
{
    CompactWordsStore store;
    MemoryUsage init = store.getMemoryUsage();

    store.insert(Builder(d1).insert(w1));
    store.commit();
    MemoryUsage after = store.getMemoryUsage();
    EXPECT_GE(after.allocatedBytes(), init.allocatedBytes());
    EXPECT_GT(after.usedBytes(), init.usedBytes());
}

GTEST_MAIN_RUN_ALL_TESTS()

redpajama_set_name: RedPajamaGithub


text:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
using Rewired;
using RewiredConsts;
using LD37.Domain.Cousins;
using System;

public class GameSetupManager : MonoBehaviour {

    private List<Player> playersToRemoveFromUnused;
    private List<Player> unusedPlayers;
    private List<Player> players;
    private List<int> cousins;
    private List<Cousin> allCousins;
    private List<bool> ready;
    private List<Transform> playerUIs;
    private List<float> switchCoolDown;
    private bool setupCompleted = false;

    private const float SWITCH_COOLDOWN = 0.75f;

	void Start () {
        playersToRemoveFromUnused = new List<Player>(4);
        unusedPlayers = new List<Player>(4);
        players = new List<Player>(4);
        cousins = new List<int>(4);
        allCousins = new List<Cousin>(4);
        ready = new List<bool>(4);
        playerUIs = new List<Transform>(4);
        switchCoolDown = new List<float>(4);

        for (int i = 0; i < 4; i++) {
            unusedPlayers.Add(ReInput.players.GetPlayer(i));
            switchCoolDown.Add(0.0f);
            ready.Add(false);
        }

        allCousins.AddRange(Cousin.All);

        playerUIs.Add(GameObject.Find("PanelPlayer0").transform);
        playerUIs.Add(GameObject.Find("PanelPlayer1").transform);
        playerUIs.Add(GameObject.Find("PanelPlayer2").transform);
        playerUIs.Add(GameObject.Find("PanelPlayer3").transform);
    }

	void Update () {
        if (setupCompleted) {
            return;
        }

        for (int i = 0; i < switchCoolDown.Count; i++) {
            switchCoolDown[i] -= Time.deltaTime;
        }

        foreach (Player player in unusedPlayers) {
            if (player.GetButton(RewiredConsts.Action.Activate)) {
                players.Add(player);
                playersToRemoveFromUnused.Add(player);

                ready.Add(false);
                cousins.Add(GetNextAvailableCousin(0));

                switchCoolDown[players.Count - 1] = SWITCH_COOLDOWN; // Prevent instant READY

                UpdateUIForPlayer(players.Count - 1);

                //TODO: player.GetCurrentInputSources and show correct instructions
            }
        }

        if (playersToRemoveFromUnused.Count > 0) {
            unusedPlayers.RemoveAll(playersToRemoveFromUnused.Contains);
            playersToRemoveFromUnused.Clear();
        }

        bool allReady = true;
        foreach (Player player in players) {
            int playerIndex = players.IndexOf(player);
            allReady = allReady && ready[playerIndex];

            if (ready[playerIndex]) {
                continue;
            }

            if (switchCoolDown[playerIndex] > 0.0f) {
                continue;
            }

            float xAxis = player.GetAxis(RewiredConsts.Action.MoveHorizontal);
            if (player.GetButton(RewiredConsts.Action.Activate)) {
                ready[playerIndex] = true;
                UpdateUIForPlayer(playerIndex);
            } else if (xAxis < 0) {
                switchCoolDown[playerIndex] = SWITCH_COOLDOWN;
                cousins[playerIndex] = GetPreviousAvailableCousin(cousins[playerIndex]);
                UpdateUIForPlayer(playerIndex);
            } else if (xAxis > 0) {
                switchCoolDown[playerIndex] = SWITCH_COOLDOWN;
                cousins[playerIndex] = GetNextAvailableCousin(cousins[playerIndex]);
                UpdateUIForPlayer(playerIndex);
            }
        }

        if (players.Count > 0 && allReady) {
            for (int i = 0; i < players.Count; i++) {
                GameController.Instance.AddGamePlayer(allCousins[cousins[i]], players[i]);
            }

            GameObject.Find("Canvas").transform.FindChild("Fade").gameObject.SetActive(true);

            setupCompleted = true;
            SceneManager.LoadScene("Test");
        }
    }

    private int GetNextAvailableCousin(int from) {
        for (int i = from + 1; i < from + allCousins.Count; i++) {
            int index = i < allCousins.Count ? i : i - allCousins.Count;

            if (!cousins.Contains(index)) {
                return index;
            }
        }

        return 0;
    }

    private int GetPreviousAvailableCousin(int from) {
        for (int i = from - 1; i > from - allCousins.Count; i--) {
            int index = i >= 0 ? i : allCousins.Count + i;

            if (!cousins.Contains(index)) {
                return index;
            }
        }

        return 0;
    }

    void UpdateUIForPlayer(int index) {
        Transform uiTransform = playerUIs[index];

        if (!ready[index]) {
            var joinText = uiTransform.FindChild("JoinText").gameObject;
            if (joinText.activeSelf) {
                joinText.SetActive(false);
            }

            var nameText = uiTransform.FindChild("NameText").gameObject;
            if (!nameText.activeSelf) {
                nameText.gameObject.SetActive(true);
            }
            nameText.GetComponent<Text>().text = allCousins[cousins[index]].Name;

            var readyText = uiTransform.FindChild("ReadyText").gameObject;
            if (!readyText.activeSelf) {
                readyText.SetActive(true);
            }
        } else {
            var nameText = uiTransform.FindChild("NameText").gameObject;

            var arrowLeft = nameText.transform.FindChild("ArrowLeftImage").gameObject;
            if (arrowLeft.activeSelf) {
                arrowLeft.SetActive(false);
            }

            var arrowRight = nameText.transform.FindChild("ArrowRightImage").gameObject;
            if (arrowRight.activeSelf) {
                arrowRight.SetActive(false);
            }

            var readyText = uiTransform.FindChild("ReadyText").gameObject;
            if (readyText.activeSelf) {
                readyText.SetActive(false);
            }

            var isReadyText = uiTransform.FindChild("IsReadyText").gameObject;
            if (!isReadyText.activeSelf) {
                isReadyText.SetActive(true);
            }
        }
    }
}


text:
exports.run = (client, msg) => {
  if (msg.guildConf.deleteCommand === true) msg.delete();
  return false;
};

exports.conf = {
  enabled: true,
  requiredModules: [],
};

exports.help = {
  name: "deleteCommand",
  type: "inhibitors",
  description: "Enables the ability for Guild/Bot owners to decide if they want all messages that initiate a command to be deleted.",
};

// Uncompatible with Komada SettingGateway
exports.init = (client) => {
  if (!client.funcs.confs.hasKey("deleteCommand")) {
    client.funcs.confs.addKey("deleteCommand", false);
  }
};


text:
using Resonance.Data.Media.Common;

namespace Resonance.Data.Media.Tag
{
    public class TagReaderFactory<TTagReader> : ITagReaderFactory where TTagReader : ITagReader, new()
    {
        public ITagReader CreateTagReader(string path, bool readMediaPropertes = true, bool readCoverArt = true)
        {
            var tagReader = new TTagReader();

            tagReader.ReadTag(path, readMediaPropertes, readCoverArt);

            return tagReader;
        }
    }
}


text:
{% include  "header.html" %}

                    Create your meme

            {% for template in templates %}

            {% endfor %}

{% include  "footer.html" %}


text: export { default } from './GithubBox';


text:
import {Board} from "./kore/Board";
import { Direction } from "./kore/Direction";
import { ShipyardAction } from "./kore/ShipyardAction";
import { KoreIO } from "./kore/KoreIO";

export const tick = async (board: Board): Promise<Board> => {
    return board;
}

const io = new KoreIO();
io.run(tick);


text:
import DS from 'ember-data';

export default DS.Model.extend({
  name: DS.attr("string"),
  tagline: DS.attr("string"),
  description: DS.attr("string"),
  status: DS.attr("string"),
  year_compl: DS.attr("number"),
  // program: DS.attr("string"),

  redevelopment: DS.attr("boolean"),
  asofright: DS.attr("boolean"),
  age_restricted: DS.attr("boolean"),
  clusteros: DS.attr("boolean"),
  phased: DS.attr("boolean"),
  cancelled: DS.attr("boolean"),
  "private": DS.attr("boolean"),
  forty_b: DS.attr("boolean"),
  // mixed_use: DS.attr("boolean"),
  residential: DS.attr("boolean"),
  commercial: DS.attr("boolean"),

  onsitepark: DS.attr("number", { defaultValue: 0 }),

  address: DS.attr("string"),
  latitude: DS.attr("number"),
  longitude: DS.attr("number"),
  location: function() {
    var longitude = this.get("longitude"),
    latitude = this.get("latitude");

     if (longitude && latitude) { return [longitude, latitude]; } else
                                { return undefined; }
  }.property("latitude", "longitude"),

  street_view_latitude: DS.attr("number", { defaultValue: (model) => { return model.get('latitude'); } }),
  street_view_longitude: DS.attr("number", { defaultValue: (model) => { return model.get('longitude'); } }),

  street_view_heading: DS.attr("number"),
  street_view_pitch: DS.attr("number"),

  tothu: DS.attr("number"),
  prjarea: DS.attr("number"),
  stories: DS.attr("number"),
  height: DS.attr("number"),

  singfamhu: DS.attr("number"),
  twnhsmmult: DS.attr("number"),
  lgmultifam: DS.attr("number"),
  affordable: DS.attr("number"),
  gqpop: DS.attr("number"),

  "refined-lng": DS.attr("number"),
  "refined-lat": DS.attr("number"),

  fa_ret: DS.attr("number"),
  fa_ofcmd: DS.attr("number"),
  fa_indmf: DS.attr("number"),
  fa_whs: DS.attr("number"),
  fa_rnd: DS.attr("number"),
  fa_other: DS.attr("number"),
  fa_edinst: DS.attr("number"),
  commsf: DS.attr("number"),
  fa_hotel: DS.attr("number"),
  hotelrms: DS.attr("number"),

  rptdemp: DS.attr("number"),
  emploss: DS.attr("number"),

  teamMemberships: DS.hasMany("team-membership", { async: true }),
  developmentTeamMemberships: DS.hasMany("development-team-membership", { async: true })

});


text:
package diplomacy

import Chisel._
import scala.collection.mutable.ListBuffer
import chisel3.internal.sourceinfo.SourceInfo

// DI = Downwards flowing Parameters received on the inner side of the node
// UI = Upwards   flowing Parameters generated by the inner side of the node
// EI = Edge Parameters describing a connection on the inner side of the node
// BI = Bundle type used when connecting to the inner side of the node
trait InwardNodeImp[DI, UI, EI, BI <: Data]
{
  def edgeI(pd: DI, pu: UI): EI
  def bundleI(ei: Seq[EI]): Vec[BI]
  def colour: String
  def connect(bo: => BI, bi: => BI, e: => EI)(implicit sourceInfo: SourceInfo): (Option[LazyModule], () => Unit)

  // optional methods to track node graph
  def mixI(pu: UI, node: InwardNode[DI, UI, BI]): UI = pu // insert node into parameters
  def getO(pu: UI): Option[BaseNode] = None // most-outward common node
}

// DO = Downwards flowing Parameters generated by the outer side of the node
// UO = Upwards   flowing Parameters received on the outer side of the node
// EO = Edge Parameters describing a connection on the outer side of the node
// BO = Bundle type used when connecting to the outer side of the node
trait OutwardNodeImp[DO, UO, EO, BO <: Data]
{
  def edgeO(pd: DO, pu: UO): EO
  def bundleO(eo: Seq[EO]): Vec[BO]

  // optional methods to track node graph
  def mixO(pd: DO, node: OutwardNode[DO, UO, BO]): DO = pd // insert node into parameters
  def getI(pd: DO): Option[BaseNode] = None // most-inward common node
}

abstract class NodeImp[D, U, EO, EI, B <: Data]
  extends Object with InwardNodeImp[D, U, EI, B] with OutwardNodeImp[D, U, EO, B]

abstract class BaseNode
{
  // You cannot create a Node outside a LazyModule!
  require (!LazyModule.stack.isEmpty)

  val lazyModule = LazyModule.stack.head
  val index = lazyModule.nodes.size
  lazyModule.nodes = this :: lazyModule.nodes

  def nodename = getClass.getName.split('.').last
  def name = lazyModule.name + "." + nodename
  def omitGraphML = outputs.isEmpty && inputs.isEmpty

  protected[diplomacy] def gci: Option[BaseNode] // greatest common inner
  protected[diplomacy] def gco: Option[BaseNode] // greatest common outer
  protected[diplomacy] def outputs: Seq[BaseNode]
  protected[diplomacy] def inputs:  Seq[BaseNode]
  protected[diplomacy] def colour:  String
}

case class NodeHandle[DI, UI, BI <: Data, DO, UO, BO <: Data]
  (inward: InwardNode[DI, UI, BI], outward: OutwardNode[DO, UO, BO])
  extends Object with InwardNodeHandle[DI, UI, BI] with OutwardNodeHandle[DO, UO, BO]

trait InwardNodeHandle[DI, UI, BI <: Data]
{
  val inward: InwardNode[DI, UI, BI]
  def := (h: OutwardNodeHandle[DI, UI, BI])(implicit sourceInfo: SourceInfo): Option[LazyModule] =
    inward.:=(h)(sourceInfo)
}

trait InwardNode[DI, UI, BI <: Data] extends BaseNode with InwardNodeHandle[DI, UI, BI]
{
  val inward = this

  protected[diplomacy] val numPI: Range.Inclusive
  require (!numPI.isEmpty, s"No number of inputs would be acceptable to ${name}${lazyModule.line}")
  require (numPI.start >= 0, s"${name} accepts a negative number of inputs${lazyModule.line}")

  private val accPI = ListBuffer[(Int, OutwardNode[DI, UI, BI])]()
  private var iRealized = false

  protected[diplomacy] def iPushed = accPI.size
  protected[diplomacy] def iPush(index: Int, node: OutwardNode[DI, UI, BI])(implicit sourceInfo: SourceInfo) {
    val info = sourceLine(sourceInfo, " at ", "")
    val noIs = numPI.size == 1 && numPI.contains(0)
    require (!noIs, s"${name}${lazyModule.line} was incorrectly connected as a sink" + info)
    require (!iRealized, s"${name}${lazyModule.line} was incorrectly connected as a sink after it's .module was used" + info)
    accPI += ((index, node))
  }

  private def reqI() = require(numPI.contains(accPI.size), s"${name} has ${accPI.size} inputs, expected ${numPI}${lazyModule.line}")
  protected[diplomacy] lazy val iPorts = { iRealized = true; reqI(); accPI.result() }

  protected[diplomacy] val iParams: Seq[UI]
  protected[diplomacy] def iConnect: Vec[BI]
}

trait OutwardNodeHandle[DO, UO, BO <: Data]
{
  val outward: OutwardNode[DO, UO, BO]
}

trait OutwardNode[DO, UO, BO <: Data] extends BaseNode with OutwardNodeHandle[DO, UO, BO]
{
  val outward = this

  protected[diplomacy] val numPO: Range.Inclusive
  require (!numPO.isEmpty, s"No number of outputs would be acceptable to ${name}${lazyModule.line}")
  require (numPO.start >= 0, s"${name} accepts a negative number of outputs${lazyModule.line}")

  private val accPO = ListBuffer[(Int, InwardNode [DO, UO, BO])]()
  private var oRealized = false

  protected[diplomacy] def oPushed = accPO.size
  protected[diplomacy] def oPush(index: Int, node: InwardNode [DO, UO, BO])(implicit sourceInfo: SourceInfo) {
    val info = sourceLine(sourceInfo, " at ", "")
    val noOs = numPO.size == 1 && numPO.contains(0)
    require (!noOs, s"${name}${lazyModule.line} was incorrectly connected as a source" + info)
    require (!oRealized, s"${name}${lazyModule.line} was incorrectly connected as a source after it's .module was used" + info)
    accPO += ((index, node))
  }

  private def reqO() = require(numPO.contains(accPO.size), s"${name} has ${accPO.size} outputs, expected ${numPO}${lazyModule.line}")
  protected[diplomacy] lazy val oPorts = { oRealized = true; reqO(); accPO.result() }

  protected[diplomacy] val oParams: Seq[DO]
  protected[diplomacy] def oConnect: Vec[BO]
}

class MixedNode[DI, UI, EI, BI <: Data, DO, UO, EO, BO <: Data](
  inner: InwardNodeImp [DI, UI, EI, BI],
  outer: OutwardNodeImp[DO, UO, EO, BO])(
  private val dFn: (Int, Seq[DI]) => Seq[DO],
  private val uFn: (Int, Seq[UO]) => Seq[UI],
  protected[diplomacy] val numPO: Range.Inclusive,
  protected[diplomacy] val numPI: Range.Inclusive)
  extends BaseNode with InwardNode[DI, UI, BI] with OutwardNode[DO, UO, BO]
{
  // meta-data for printing the node graph
  protected[diplomacy] def colour  = inner.colour
  protected[diplomacy] def outputs = oPorts.map(_._2)
  protected[diplomacy] def inputs  = iPorts.map(_._2)

  private def reqE(o: Int, i: Int) = require(i == o, s"${name} has ${i} inputs and ${o} outputs; they must match${lazyModule.line}")
  protected[diplomacy] lazy val oParams: Seq[DO] = {
    val o = dFn(oPorts.size, iPorts.map { case (i, n) => n.oParams(i) })
    reqE(oPorts.size, o.size)
    o.map(outer.mixO(_, this))
  }
  protected[diplomacy] lazy val iParams: Seq[UI] = {
    val i = uFn(iPorts.size, oPorts.map { case (o, n) => n.iParams(o) })
    reqE(i.size, iPorts.size)
    i.map(inner.mixI(_, this))
  }

  protected[diplomacy] def gco = if (iParams.size != 1) None else inner.getO(iParams(0))
  protected[diplomacy] def gci = if (oParams.size != 1) None else outer.getI(oParams(0))

  lazy val edgesOut = (oPorts zip oParams).map { case ((i, n), o) => outer.edgeO(o, n.iParams(i)) }
  lazy val edgesIn  = (iPorts zip iParams).map { case ((o, n), i) => inner.edgeI(n.oParams(o), i) }

  lazy val bundleOut = outer.bundleO(edgesOut)
  lazy val bundleIn  = inner.bundleI(edgesIn)

  def oConnect = bundleOut
  def iConnect = bundleIn

  // connects the outward part of a node with the inward part of this node
  override def := (h: OutwardNodeHandle[DI, UI, BI])(implicit sourceInfo: SourceInfo): Option[LazyModule] = {
    val x = this // x := y
    val y = h.outward
    val info = sourceLine(sourceInfo, " at ", "")
    require (!LazyModule.stack.isEmpty, s"${y.name} cannot be connected to ${x.name} outside of LazyModule scope" + info)
    val i = x.iPushed
    val o = y.oPushed
    y.oPush(i, x)
    x.iPush(o, y)
    val (out, binding) = inner.connect(y.oConnect(o), x.iConnect(i), x.edgesIn(i))
    LazyModule.stack.head.bindings = binding :: LazyModule.stack.head.bindings
    out
  }
}

class SimpleNode[D, U, EO, EI, B <: Data](imp: NodeImp[D, U, EO, EI, B])(
  oFn: (Int, Seq[D]) => Seq[D],
  iFn: (Int, Seq[U]) => Seq[U],
  numPO: Range.Inclusive,
  numPI: Range.Inclusive)
    extends MixedNode[D, U, EI, B, D, U, EO, B](imp, imp)(oFn, iFn, numPO, numPI)

class IdentityNode[PO, PI, EO, EI, B <: Data](imp: NodeImp[PO, PI, EO, EI, B])
  extends SimpleNode(imp)({case (_, s) => s}, {case (_, s) => s}, 0 to 999, 0 to 999)

class OutputNode[PO, PI, EO, EI, B <: Data](imp: NodeImp[PO, PI, EO, EI, B]) extends IdentityNode(imp)
{
  override def oConnect = bundleOut
  override def iConnect = bundleOut
}

class InputNode[PO, PI, EO, EI, B <: Data](imp: NodeImp[PO, PI, EO, EI, B]) extends IdentityNode(imp)
{
  override def oConnect = bundleIn
  override def iConnect = bundleIn
}

class SourceNode[PO, PI, EO, EI, B <: Data](imp: NodeImp[PO, PI, EO, EI, B])(po: PO, num: Range.Inclusive = 1 to 1)
  extends SimpleNode(imp)({case (n, Seq()) => Seq.fill(n)(po)}, {case (0, _) => Seq()}, num, 0 to 0)
{
  require (num.end >= 1, s"${name} is a source which does not accept outputs${lazyModule.line}")
}

class SinkNode[PO, PI, EO, EI, B <: Data](imp: NodeImp[PO, PI, EO, EI, B])(pi: PI, num: Range.Inclusive = 1 to 1)
  extends SimpleNode(imp)({case (0, _) => Seq()}, {case (n, Seq()) => Seq.fill(n)(pi)}, 0 to 0, num)
{
  require (num.end >= 1, s"${name} is a sink which does not accept inputs${lazyModule.line}")
}

class InteriorNode[PO, PI, EO, EI, B <: Data](imp: NodeImp[PO, PI, EO, EI, B])
  (oFn: Seq[PO] => PO, iFn: Seq[PI] => PI, numPO: Range.Inclusive, numPI: Range.Inclusive)
  extends SimpleNode(imp)({case (n,s) => Seq.fill(n)(oFn(s))}, {case (n,s) => Seq.fill(n)(iFn(s))}, numPO, numPI)
{
  require (numPO.end >= 1, s"${name} is an adapter which does not accept outputs${lazyModule.line}")
  require (numPI.end >= 1, s"${name} is an adapter which does not accept inputs${lazyModule.line}")
}


text:
[![Build Status](https://scrutinizer-ci.com/g/fpietka/Zend-Nested-Set/badges/build.png?b=master)](https://scrutinizer-ci.com/g/fpietka/Zend-Nested-Set/build-status/master) [![Code Coverage](https://scrutinizer-ci.com/g/fpietka/Zend-Nested-Set/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/fpietka/Zend-Nested-Set/?branch=master) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/fpietka/Zend-Nested-Set/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/fpietka/Zend-Nested-Set/?branch=master) [![StyleCI](https://styleci.io/repos/452790/shield)](https://styleci.io/repos/452790)

INSTALLATION
=======================================================================

The minimum requirement is that your Web server supports PHP 5.4.

This application requires that you either have Zend Framework on your
include_path, or that you will be symlinking your Zend Framework library
into the library directory. If you do not yet have Zend Framework, you
can get it from one of the following sources:

  * Official Release:
http://framework.zend.com/downloads/latest#ZF1

  * Using Subversion; use either the current trunk or the 1.12.7 release branch:

svn checkout http://framework.zend.com/svn/framework/standard/trunk/library/Zend
svn checkout http://framework.zend.com/svn/framework/standard/branches/release-1.12/library/Zend

  * Using Git; use either the current master or the 1.12.7 release branch:

git clone https://github.com/zendframework/zf1
git checkout release-1.12.7

DEPENDENCY
=======================================================================

* PHP Package

php5 php-pear php5-sqlite php5-curl php5-xmlrpc php5-json

* PHAR Package

wget https://phar.phpunit.de/phpunit.phar

DOCUMENTATION
======================================================================

To lauch unit tests:
    php mageekguy.atoum.phar -d tests/

REQUESTS
=======================================================================
If you have any feature requests, feel free to send them to:

    François Pietka
    francois [at] pietka [dot] fr

I may or may not honor them. :)

LICENSE
=======================================================================
Please see COPYING


text:
using System;
using OpenADK.Library;
using NUnit.Framework;
using OpenADK.Library.Impl;
using OpenADK.Library.Infra;

//import com.OpenADK.Library.ADKTransportException;
//import com.OpenADK.Library.TransportProperties;
//import com.OpenADK.Library.Zone;
//import com.OpenADK.Library.impl.IProtocolHandler;
//import com.OpenADK.Library.impl.Transport;
//import com.OpenADK.Library.impl.TransportImpl;
//import com.OpenADK.Library.infra.SIF_Protocol;

namespace Library.UnitTesting.Framework
{
   public class InMemoryTransport : TransportImpl
   {

      private Boolean fActive;

      public InMemoryTransport(TransportProperties props):base(props)
      {
         // TODO Auto-generated constructor stub
      }

      //  Definition changed. now takes mode arg. Not used in for InMemoryProtocolhandler
      public override IProtocolHandler CreateProtocolHandler(AgentMessagingMode mode)
      {
         return new InMemoryProtocolHandler();
      }

      public override object Clone()
      {
         // TODO Auto-generated method stub
         return null;
      }

      public override void Activate(IZone zone)
      {
         fActive = true;
      }

      public override bool IsActive(IZone zone)
      {
         return fActive;
      }

      public override void Shutdown()
      {
         fActive = false;
      }

      public override string Name
      {
         get
         {
            // TODO Auto-generated method stub
            return "ADK In Memory Tranport Handler";
         }
      }

      public override String Protocol
      {
         get
         {
            // TODO Auto-generated method stub
            return "AdkInMemory";
         }
      }

      public override Boolean Secure
      {//TODO Auto-generated method stub
         get
         {
            return false;
         }
      }

       /// <summary>
       /// Activate the transport for this agent. This mehods is called
       /// when the agent is being initialized
       /// </summary>
       /// <param name="agent"></param>
       public override void Activate( Agent agent )
       {

       }
   }//end class
}//end namespace


text:
'use strict';

// ------------------------------------------------------------------------------
// Requirements
// ------------------------------------------------------------------------------

var rule = require('../rules/no-angular-mock');
var RuleTester = require('eslint').RuleTester;
var commonFalsePositives = require('./utils/commonFalsePositives');

// ------------------------------------------------------------------------------
// Tests
// ------------------------------------------------------------------------------

var eslintTester = new RuleTester();
eslintTester.run('no-angular-mock', rule, {
    valid: [
        'dump();',
        'inject();',
        'module();'
    ].concat(commonFalsePositives),
    invalid: [{
        code: 'angular.mock.dump();',
        errors: [{message: 'You should use the "dump" method available in the window object.'}]
    }, {
        code: 'angular.mock.inject();',
        errors: [{message: 'You should use the "inject" method available in the window object.'}]
    }, {
        code: 'angular.mock.module();',
        errors: [{message: 'You should use the "module" method available in the window object.'}]
    }
    ]
});


text:
<?php

// command: restore_deleted_messages
// Recover specific recently deleted messages.

class RestoreDeletedMessages {

	public static function call($data) {
		if (self::validate($data)) {
    		return OMA::send_cmd("restore_deleted_messages", $data);
    	}
	}

    public static function validate($data) {
    	if(empty($data['user']) || empty($data['ids'])){
			trigger_error("oSRS Error - User/IDs required\n", E_USER_WARNING);
		} else {
			return true;
		}
  	}
}
?>


text:
// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: google/monitoring/v3/group_service.proto

package com.google.monitoring.v3;

/**
 *
 *
 *

 * The `ListGroupMembers` response.
 *

 *
 * Protobuf type {@code google.monitoring.v3.ListGroupMembersResponse}
 */
public final class ListGroupMembersResponse extends com.google.protobuf.GeneratedMessageV3
    implements
    // @@protoc_insertion_point(message_implements:google.monitoring.v3.ListGroupMembersResponse)
    ListGroupMembersResponseOrBuilder {
  private static final long serialVersionUID = 0L;
  // Use ListGroupMembersResponse.newBuilder() to construct.
  private ListGroupMembersResponse(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
    super(builder);
  }

  private ListGroupMembersResponse() {
    members_ = java.util.Collections.emptyList();
    nextPageToken_ = "";
  }

  @java.lang.Override
  @SuppressWarnings({"unused"})
  protected java.lang.Object newInstance(UnusedPrivateParameter unused) {
    return new ListGroupMembersResponse();
  }

  @java.lang.Override
  public final com.google.protobuf.UnknownFieldSet getUnknownFields() {
    return this.unknownFields;
  }

  public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
    return com.google.monitoring.v3.GroupServiceProto
        .internal_static_google_monitoring_v3_ListGroupMembersResponse_descriptor;
  }

  @java.lang.Override
  protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internalGetFieldAccessorTable() {
    return com.google.monitoring.v3.GroupServiceProto
        .internal_static_google_monitoring_v3_ListGroupMembersResponse_fieldAccessorTable
        .ensureFieldAccessorsInitialized(
            com.google.monitoring.v3.ListGroupMembersResponse.class,
            com.google.monitoring.v3.ListGroupMembersResponse.Builder.class);
  }

  public static final int MEMBERS_FIELD_NUMBER = 1;
  private java.util.List<com.google.api.MonitoredResource> members_;
  /**
   *
   *
   *

   * A set of monitored resources in the group.
   *

   *
   * repeated .google.api.MonitoredResource members = 1;
   */
  @java.lang.Override
  public java.util.List<com.google.api.MonitoredResource> getMembersList() {
    return members_;
  }
  /**
   *
   *
   *

   * A set of monitored resources in the group.
   *

   *
   * repeated .google.api.MonitoredResource members = 1;
   */
  @java.lang.Override
  public java.util.List<? extends com.google.api.MonitoredResourceOrBuilder>
      getMembersOrBuilderList() {
    return members_;
  }
  /**
   *
   *
   *

   * A set of monitored resources in the group.
   *

   *
   * repeated .google.api.MonitoredResource members = 1;
   */
  @java.lang.Override
  public int getMembersCount() {
    return members_.size();
  }
  /**
   *
   *
   *

   * A set of monitored resources in the group.
   *

   *
   * repeated .google.api.MonitoredResource members = 1;
   */
  @java.lang.Override
  public com.google.api.MonitoredResource getMembers(int index) {
    return members_.get(index);
  }
  /**
   *
   *
   *

   * A set of monitored resources in the group.
   *

   *
   * repeated .google.api.MonitoredResource members = 1;
   */
  @java.lang.Override
  public com.google.api.MonitoredResourceOrBuilder getMembersOrBuilder(int index) {
    return members_.get(index);
  }

  public static final int NEXT_PAGE_TOKEN_FIELD_NUMBER = 2;
  private volatile java.lang.Object nextPageToken_;
  /**
   *
   *
   *

   * If there are more results than have been returned, then this field is
   * set to a non-empty value.  To see the additional results, use that value as
   * `page_token` in the next call to this method.
   *

   *
   * string next_page_token = 2;
   *
   * @return The nextPageToken.
   */
  @java.lang.Override
  public java.lang.String getNextPageToken() {
    java.lang.Object ref = nextPageToken_;
    if (ref instanceof java.lang.String) {
      return (java.lang.String) ref;
    } else {
      com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
      java.lang.String s = bs.toStringUtf8();
      nextPageToken_ = s;
      return s;
    }
  }
  /**
   *
   *
   *

   * If there are more results than have been returned, then this field is
   * set to a non-empty value.  To see the additional results, use that value as
   * `page_token` in the next call to this method.
   *

   *
   * string next_page_token = 2;
   *
   * @return The bytes for nextPageToken.
   */
  @java.lang.Override
  public com.google.protobuf.ByteString getNextPageTokenBytes() {
    java.lang.Object ref = nextPageToken_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b =
          com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
      nextPageToken_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int TOTAL_SIZE_FIELD_NUMBER = 3;
  private int totalSize_;
  /**
   *
   *
   *

   * The total number of elements matching this request.
   *

   *
   * int32 total_size = 3;
   *
   * @return The totalSize.
   */
  @java.lang.Override
  public int getTotalSize() {
    return totalSize_;
  }

  private byte memoizedIsInitialized = -1;

  @java.lang.Override
  public final boolean isInitialized() {
    byte isInitialized = memoizedIsInitialized;
    if (isInitialized == 1) return true;
    if (isInitialized == 0) return false;

    memoizedIsInitialized = 1;
    return true;
  }

  @java.lang.Override
  public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException {
    for (int i = 0; i < members_.size(); i++) {
      output.writeMessage(1, members_.get(i));
    }
    if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(nextPageToken_)) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 2, nextPageToken_);
    }
    if (totalSize_ != 0) {
      output.writeInt32(3, totalSize_);
    }
    getUnknownFields().writeTo(output);
  }

  @java.lang.Override
  public int getSerializedSize() {
    int size = memoizedSize;
    if (size != -1) return size;

    size = 0;
    for (int i = 0; i < members_.size(); i++) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, members_.get(i));
    }
    if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(nextPageToken_)) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, nextPageToken_);
    }
    if (totalSize_ != 0) {
      size += com.google.protobuf.CodedOutputStream.computeInt32Size(3, totalSize_);
    }
    size += getUnknownFields().getSerializedSize();
    memoizedSize = size;
    return size;
  }

  @java.lang.Override
  public boolean equals(final java.lang.Object obj) {
    if (obj == this) {
      return true;
    }
    if (!(obj instanceof com.google.monitoring.v3.ListGroupMembersResponse)) {
      return super.equals(obj);
    }
    com.google.monitoring.v3.ListGroupMembersResponse other =
        (com.google.monitoring.v3.ListGroupMembersResponse) obj;

    if (!getMembersList().equals(other.getMembersList())) return false;
    if (!getNextPageToken().equals(other.getNextPageToken())) return false;
    if (getTotalSize() != other.getTotalSize()) return false;
    if (!getUnknownFields().equals(other.getUnknownFields())) return false;
    return true;
  }

  @java.lang.Override
  public int hashCode() {
    if (memoizedHashCode != 0) {
      return memoizedHashCode;
    }
    int hash = 41;
    hash = (19 * hash) + getDescriptor().hashCode();
    if (getMembersCount() > 0) {
      hash = (37 * hash) + MEMBERS_FIELD_NUMBER;
      hash = (53 * hash) + getMembersList().hashCode();
    }
    hash = (37 * hash) + NEXT_PAGE_TOKEN_FIELD_NUMBER;
    hash = (53 * hash) + getNextPageToken().hashCode();
    hash = (37 * hash) + TOTAL_SIZE_FIELD_NUMBER;
    hash = (53 * hash) + getTotalSize();
    hash = (29 * hash) + getUnknownFields().hashCode();
    memoizedHashCode = hash;
    return hash;
  }

  public static com.google.monitoring.v3.ListGroupMembersResponse parseFrom(
      java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

  public static com.google.monitoring.v3.ListGroupMembersResponse parseFrom(
      java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }

  public static com.google.monitoring.v3.ListGroupMembersResponse parseFrom(
      com.google.protobuf.ByteString data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

  public static com.google.monitoring.v3.ListGroupMembersResponse parseFrom(
      com.google.protobuf.ByteString data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }

  public static com.google.monitoring.v3.ListGroupMembersResponse parseFrom(byte[] data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

  public static com.google.monitoring.v3.ListGroupMembersResponse parseFrom(
      byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }

  public static com.google.monitoring.v3.ListGroupMembersResponse parseFrom(
      java.io.InputStream input) throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
  }

  public static com.google.monitoring.v3.ListGroupMembersResponse parseFrom(
      java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseWithIOException(
        PARSER, input, extensionRegistry);
  }

  public static com.google.monitoring.v3.ListGroupMembersResponse parseDelimitedFrom(
      java.io.InputStream input) throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input);
  }

  public static com.google.monitoring.v3.ListGroupMembersResponse parseDelimitedFrom(
      java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(
        PARSER, input, extensionRegistry);
  }

  public static com.google.monitoring.v3.ListGroupMembersResponse parseFrom(
      com.google.protobuf.CodedInputStream input) throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
  }

  public static com.google.monitoring.v3.ListGroupMembersResponse parseFrom(
      com.google.protobuf.CodedInputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseWithIOException(
        PARSER, input, extensionRegistry);
  }

  @java.lang.Override
  public Builder newBuilderForType() {
    return newBuilder();
  }

  public static Builder newBuilder() {
    return DEFAULT_INSTANCE.toBuilder();
  }

  public static Builder newBuilder(com.google.monitoring.v3.ListGroupMembersResponse prototype) {
    return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
  }

  @java.lang.Override
  public Builder toBuilder() {
    return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this);
  }

  @java.lang.Override
  protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
    Builder builder = new Builder(parent);
    return builder;
  }
  /**
   *
   *
   *

   * The `ListGroupMembers` response.
   *

   *
   * Protobuf type {@code google.monitoring.v3.ListGroupMembersResponse}
   */
  public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder>
      implements
      // @@protoc_insertion_point(builder_implements:google.monitoring.v3.ListGroupMembersResponse)
      com.google.monitoring.v3.ListGroupMembersResponseOrBuilder {
    public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
      return com.google.monitoring.v3.GroupServiceProto
          .internal_static_google_monitoring_v3_ListGroupMembersResponse_descriptor;
    }

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.google.monitoring.v3.GroupServiceProto
          .internal_static_google_monitoring_v3_ListGroupMembersResponse_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.google.monitoring.v3.ListGroupMembersResponse.class,
              com.google.monitoring.v3.ListGroupMembersResponse.Builder.class);
    }

    // Construct using com.google.monitoring.v3.ListGroupMembersResponse.newBuilder()
    private Builder() {}

    private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
      super(parent);
    }

    @java.lang.Override
    public Builder clear() {
      super.clear();
      if (membersBuilder_ == null) {
        members_ = java.util.Collections.emptyList();
      } else {
        members_ = null;
        membersBuilder_.clear();
      }
      bitField0_ = (bitField0_ & ~0x00000001);
      nextPageToken_ = "";

      totalSize_ = 0;

      return this;
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
      return com.google.monitoring.v3.GroupServiceProto
          .internal_static_google_monitoring_v3_ListGroupMembersResponse_descriptor;
    }

    @java.lang.Override
    public com.google.monitoring.v3.ListGroupMembersResponse getDefaultInstanceForType() {
      return com.google.monitoring.v3.ListGroupMembersResponse.getDefaultInstance();
    }

    @java.lang.Override
    public com.google.monitoring.v3.ListGroupMembersResponse build() {
      com.google.monitoring.v3.ListGroupMembersResponse result = buildPartial();
      if (!result.isInitialized()) {
        throw newUninitializedMessageException(result);
      }
      return result;
    }

    @java.lang.Override
    public com.google.monitoring.v3.ListGroupMembersResponse buildPartial() {
      com.google.monitoring.v3.ListGroupMembersResponse result =
          new com.google.monitoring.v3.ListGroupMembersResponse(this);
      int from_bitField0_ = bitField0_;
      if (membersBuilder_ == null) {
        if (((bitField0_ & 0x00000001) != 0)) {
          members_ = java.util.Collections.unmodifiableList(members_);
          bitField0_ = (bitField0_ & ~0x00000001);
        }
        result.members_ = members_;
      } else {
        result.members_ = membersBuilder_.build();
      }
      result.nextPageToken_ = nextPageToken_;
      result.totalSize_ = totalSize_;
      onBuilt();
      return result;
    }

    @java.lang.Override
    public Builder clone() {
      return super.clone();
    }

    @java.lang.Override
    public Builder setField(
        com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) {
      return super.setField(field, value);
    }

    @java.lang.Override
    public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) {
      return super.clearField(field);
    }

    @java.lang.Override
    public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) {
      return super.clearOneof(oneof);
    }

    @java.lang.Override
    public Builder setRepeatedField(
        com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) {
      return super.setRepeatedField(field, index, value);
    }

    @java.lang.Override
    public Builder addRepeatedField(
        com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) {
      return super.addRepeatedField(field, value);
    }

    @java.lang.Override
    public Builder mergeFrom(com.google.protobuf.Message other) {
      if (other instanceof com.google.monitoring.v3.ListGroupMembersResponse) {
        return mergeFrom((com.google.monitoring.v3.ListGroupMembersResponse) other);
      } else {
        super.mergeFrom(other);
        return this;
      }
    }

    public Builder mergeFrom(com.google.monitoring.v3.ListGroupMembersResponse other) {
      if (other == com.google.monitoring.v3.ListGroupMembersResponse.getDefaultInstance())
        return this;
      if (membersBuilder_ == null) {
        if (!other.members_.isEmpty()) {
          if (members_.isEmpty()) {
            members_ = other.members_;
            bitField0_ = (bitField0_ & ~0x00000001);
          } else {
            ensureMembersIsMutable();
            members_.addAll(other.members_);
          }
          onChanged();
        }
      } else {
        if (!other.members_.isEmpty()) {
          if (membersBuilder_.isEmpty()) {
            membersBuilder_.dispose();
            membersBuilder_ = null;
            members_ = other.members_;
            bitField0_ = (bitField0_ & ~0x00000001);
            membersBuilder_ =
                com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders
                    ? getMembersFieldBuilder()
                    : null;
          } else {
            membersBuilder_.addAllMessages(other.members_);
          }
        }
      }
      if (!other.getNextPageToken().isEmpty()) {
        nextPageToken_ = other.nextPageToken_;
        onChanged();
      }
      if (other.getTotalSize() != 0) {
        setTotalSize(other.getTotalSize());
      }
      this.mergeUnknownFields(other.getUnknownFields());
      onChanged();
      return this;
    }

    @java.lang.Override
    public final boolean isInitialized() {
      return true;
    }

    @java.lang.Override
    public Builder mergeFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      if (extensionRegistry == null) {
        throw new java.lang.NullPointerException();
      }
      try {
        boolean done = false;
        while (!done) {
          int tag = input.readTag();
          switch (tag) {
            case 0:
              done = true;
              break;
            case 10:
              {
                com.google.api.MonitoredResource m =
                    input.readMessage(com.google.api.MonitoredResource.parser(), extensionRegistry);
                if (membersBuilder_ == null) {
                  ensureMembersIsMutable();
                  members_.add(m);
                } else {
                  membersBuilder_.addMessage(m);
                }
                break;
              } // case 10
            case 18:
              {
                nextPageToken_ = input.readStringRequireUtf8();

                break;
              } // case 18
            case 24:
              {
                totalSize_ = input.readInt32();

                break;
              } // case 24
            default:
              {
                if (!super.parseUnknownField(input, extensionRegistry, tag)) {
                  done = true; // was an endgroup tag
                }
                break;
              } // default:
          } // switch (tag)
        } // while (!done)
      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
        throw e.unwrapIOException();
      } finally {
        onChanged();
      } // finally
      return this;
    }

    private int bitField0_;

    private java.util.List<com.google.api.MonitoredResource> members_ =
        java.util.Collections.emptyList();

    private void ensureMembersIsMutable() {
      if (!((bitField0_ & 0x00000001) != 0)) {
        members_ = new java.util.ArrayList<com.google.api.MonitoredResource>(members_);
        bitField0_ |= 0x00000001;
      }
    }

    private com.google.protobuf.RepeatedFieldBuilderV3<
            com.google.api.MonitoredResource,
            com.google.api.MonitoredResource.Builder,
            com.google.api.MonitoredResourceOrBuilder>
        membersBuilder_;

    /**
     *
     *
     *

     * A set of monitored resources in the group.
     *

     *
     * repeated .google.api.MonitoredResource members = 1;
     */
    public java.util.List<com.google.api.MonitoredResource> getMembersList() {
      if (membersBuilder_ == null) {
        return java.util.Collections.unmodifiableList(members_);
      } else {
        return membersBuilder_.getMessageList();
      }
    }
    /**
     *
     *
     *

     * A set of monitored resources in the group.
     *

     *
     * repeated .google.api.MonitoredResource members = 1;
     */
    public int getMembersCount() {
      if (membersBuilder_ == null) {
        return members_.size();
      } else {
        return membersBuilder_.getCount();
      }
    }
    /**
     *
     *
     *

     * A set of monitored resources in the group.
     *

     *
     * repeated .google.api.MonitoredResource members = 1;
     */
    public com.google.api.MonitoredResource getMembers(int index) {
      if (membersBuilder_ == null) {
        return members_.get(index);
      } else {
        return membersBuilder_.getMessage(index);
      }
    }
    /**
     *
     *
     *

     * A set of monitored resources in the group.
     *

     *
     * repeated .google.api.MonitoredResource members = 1;
     */
    public Builder setMembers(int index, com.google.api.MonitoredResource value) {
      if (membersBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureMembersIsMutable();
        members_.set(index, value);
        onChanged();
      } else {
        membersBuilder_.setMessage(index, value);
      }
      return this;
    }
    /**
     *
     *
     *

     * A set of monitored resources in the group.
     *

     *
     * repeated .google.api.MonitoredResource members = 1;
     */
    public Builder setMembers(int index, com.google.api.MonitoredResource.Builder builderForValue) {
      if (membersBuilder_ == null) {
        ensureMembersIsMutable();
        members_.set(index, builderForValue.build());
        onChanged();
      } else {
        membersBuilder_.setMessage(index, builderForValue.build());
      }
      return this;
    }
    /**
     *
     *
     *

     * A set of monitored resources in the group.
     *

     *
     * repeated .google.api.MonitoredResource members = 1;
     */
    public Builder addMembers(com.google.api.MonitoredResource value) {
      if (membersBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureMembersIsMutable();
        members_.add(value);
        onChanged();
      } else {
        membersBuilder_.addMessage(value);
      }
      return this;
    }
    /**
     *
     *
     *

     * A set of monitored resources in the group.
     *

     *
     * repeated .google.api.MonitoredResource members = 1;
     */
    public Builder addMembers(int index, com.google.api.MonitoredResource value) {
      if (membersBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureMembersIsMutable();
        members_.add(index, value);
        onChanged();
      } else {
        membersBuilder_.addMessage(index, value);
      }
      return this;
    }
    /**
     *
     *
     *

     * A set of monitored resources in the group.
     *

     *
     * repeated .google.api.MonitoredResource members = 1;
     */
    public Builder addMembers(com.google.api.MonitoredResource.Builder builderForValue) {
      if (membersBuilder_ == null) {
        ensureMembersIsMutable();
        members_.add(builderForValue.build());
        onChanged();
      } else {
        membersBuilder_.addMessage(builderForValue.build());
      }
      return this;
    }
    /**
     *
     *
     *

     * A set of monitored resources in the group.
     *

     *
     * repeated .google.api.MonitoredResource members = 1;
     */
    public Builder addMembers(int index, com.google.api.MonitoredResource.Builder builderForValue) {
      if (membersBuilder_ == null) {
        ensureMembersIsMutable();
        members_.add(index, builderForValue.build());
        onChanged();
      } else {
        membersBuilder_.addMessage(index, builderForValue.build());
      }
      return this;
    }
    /**
     *
     *
     *

     * A set of monitored resources in the group.
     *

     *
     * repeated .google.api.MonitoredResource members = 1;
     */
    public Builder addAllMembers(
        java.lang.Iterable<? extends com.google.api.MonitoredResource> values) {
      if (membersBuilder_ == null) {
        ensureMembersIsMutable();
        com.google.protobuf.AbstractMessageLite.Builder.addAll(values, members_);
        onChanged();
      } else {
        membersBuilder_.addAllMessages(values);
      }
      return this;
    }
    /**
     *
     *
     *

     * A set of monitored resources in the group.
     *

     *
     * repeated .google.api.MonitoredResource members = 1;
     */
    public Builder clearMembers() {
      if (membersBuilder_ == null) {
        members_ = java.util.Collections.emptyList();
        bitField0_ = (bitField0_ & ~0x00000001);
        onChanged();
      } else {
        membersBuilder_.clear();
      }
      return this;
    }
    /**
     *
     *
     *

     * A set of monitored resources in the group.
     *

     *
     * repeated .google.api.MonitoredResource members = 1;
     */
    public Builder removeMembers(int index) {
      if (membersBuilder_ == null) {
        ensureMembersIsMutable();
        members_.remove(index);
        onChanged();
      } else {
        membersBuilder_.remove(index);
      }
      return this;
    }
    /**
     *
     *
     *

     * A set of monitored resources in the group.
     *

     *
     * repeated .google.api.MonitoredResource members = 1;
     */
    public com.google.api.MonitoredResource.Builder getMembersBuilder(int index) {
      return getMembersFieldBuilder().getBuilder(index);
    }
    /**
     *
     *
     *

     * A set of monitored resources in the group.
     *

     *
     * repeated .google.api.MonitoredResource members = 1;
     */
    public com.google.api.MonitoredResourceOrBuilder getMembersOrBuilder(int index) {
      if (membersBuilder_ == null) {
        return members_.get(index);
      } else {
        return membersBuilder_.getMessageOrBuilder(index);
      }
    }
    /**
     *
     *
     *

     * A set of monitored resources in the group.
     *

     *
     * repeated .google.api.MonitoredResource members = 1;
     */
    public java.util.List<? extends com.google.api.MonitoredResourceOrBuilder>
        getMembersOrBuilderList() {
      if (membersBuilder_ != null) {
        return membersBuilder_.getMessageOrBuilderList();
      } else {
        return java.util.Collections.unmodifiableList(members_);
      }
    }
    /**
     *
     *
     *

     * A set of monitored resources in the group.
     *

     *
     * repeated .google.api.MonitoredResource members = 1;
     */
    public com.google.api.MonitoredResource.Builder addMembersBuilder() {
      return getMembersFieldBuilder()
          .addBuilder(com.google.api.MonitoredResource.getDefaultInstance());
    }
    /**
     *
     *
     *

     * A set of monitored resources in the group.
     *

     *
     * repeated .google.api.MonitoredResource members = 1;
     */
    public com.google.api.MonitoredResource.Builder addMembersBuilder(int index) {
      return getMembersFieldBuilder()
          .addBuilder(index, com.google.api.MonitoredResource.getDefaultInstance());
    }
    /**
     *
     *
     *

     * A set of monitored resources in the group.
     *

     *
     * repeated .google.api.MonitoredResource members = 1;
     */
    public java.util.List<com.google.api.MonitoredResource.Builder> getMembersBuilderList() {
      return getMembersFieldBuilder().getBuilderList();
    }

    private com.google.protobuf.RepeatedFieldBuilderV3<
            com.google.api.MonitoredResource,
            com.google.api.MonitoredResource.Builder,
            com.google.api.MonitoredResourceOrBuilder>
        getMembersFieldBuilder() {
      if (membersBuilder_ == null) {
        membersBuilder_ =
            new com.google.protobuf.RepeatedFieldBuilderV3<
                com.google.api.MonitoredResource,
                com.google.api.MonitoredResource.Builder,
                com.google.api.MonitoredResourceOrBuilder>(
                members_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean());
        members_ = null;
      }
      return membersBuilder_;
    }

    private java.lang.Object nextPageToken_ = "";
    /**
     *
     *
     *

     * If there are more results than have been returned, then this field is
     * set to a non-empty value.  To see the additional results, use that value as
     * `page_token` in the next call to this method.
     *

     *
     * string next_page_token = 2;
     *
     * @return The nextPageToken.
     */
    public java.lang.String getNextPageToken() {
      java.lang.Object ref = nextPageToken_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        nextPageToken_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     *
     *
     *

     * If there are more results than have been returned, then this field is
     * set to a non-empty value.  To see the additional results, use that value as
     * `page_token` in the next call to this method.
     *

     *
     * string next_page_token = 2;
     *
     * @return The bytes for nextPageToken.
     */
    public com.google.protobuf.ByteString getNextPageTokenBytes() {
      java.lang.Object ref = nextPageToken_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b =
            com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
        nextPageToken_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     *
     *
     *

     * If there are more results than have been returned, then this field is
     * set to a non-empty value.  To see the additional results, use that value as
     * `page_token` in the next call to this method.
     *

     *
     * string next_page_token = 2;
     *
     * @param value The nextPageToken to set.
     * @return This builder for chaining.
     */
    public Builder setNextPageToken(java.lang.String value) {
      if (value == null) {
        throw new NullPointerException();
      }

      nextPageToken_ = value;
      onChanged();
      return this;
    }
    /**
     *
     *
     *

     * If there are more results than have been returned, then this field is
     * set to a non-empty value.  To see the additional results, use that value as
     * `page_token` in the next call to this method.
     *

     *
     * string next_page_token = 2;
     *
     * @return This builder for chaining.
     */
    public Builder clearNextPageToken() {

      nextPageToken_ = getDefaultInstance().getNextPageToken();
      onChanged();
      return this;
    }
    /**
     *
     *
     *

     * If there are more results than have been returned, then this field is
     * set to a non-empty value.  To see the additional results, use that value as
     * `page_token` in the next call to this method.
     *

     *
     * string next_page_token = 2;
     *
     * @param value The bytes for nextPageToken to set.
     * @return This builder for chaining.
     */
    public Builder setNextPageTokenBytes(com.google.protobuf.ByteString value) {
      if (value == null) {
        throw new NullPointerException();
      }
      checkByteStringIsUtf8(value);

      nextPageToken_ = value;
      onChanged();
      return this;
    }

    private int totalSize_;
    /**
     *
     *
     *

     * The total number of elements matching this request.
     *

     *
     * int32 total_size = 3;
     *
     * @return The totalSize.
     */
    @java.lang.Override
    public int getTotalSize() {
      return totalSize_;
    }
    /**
     *
     *
     *

     * The total number of elements matching this request.
     *

     *
     * int32 total_size = 3;
     *
     * @param value The totalSize to set.
     * @return This builder for chaining.
     */
    public Builder setTotalSize(int value) {

      totalSize_ = value;
      onChanged();
      return this;
    }
    /**
     *
     *
     *

     * The total number of elements matching this request.
     *

     *
     * int32 total_size = 3;
     *
     * @return This builder for chaining.
     */
    public Builder clearTotalSize() {

      totalSize_ = 0;
      onChanged();
      return this;
    }

    @java.lang.Override
    public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) {
      return super.setUnknownFields(unknownFields);
    }

    @java.lang.Override
    public final Builder mergeUnknownFields(
        final com.google.protobuf.UnknownFieldSet unknownFields) {
      return super.mergeUnknownFields(unknownFields);
    }

    // @@protoc_insertion_point(builder_scope:google.monitoring.v3.ListGroupMembersResponse)
  }

  // @@protoc_insertion_point(class_scope:google.monitoring.v3.ListGroupMembersResponse)
  private static final com.google.monitoring.v3.ListGroupMembersResponse DEFAULT_INSTANCE;

  static {
    DEFAULT_INSTANCE = new com.google.monitoring.v3.ListGroupMembersResponse();
  }

  public static com.google.monitoring.v3.ListGroupMembersResponse getDefaultInstance() {
    return DEFAULT_INSTANCE;
  }

  private static final com.google.protobuf.Parser<ListGroupMembersResponse> PARSER =
      new com.google.protobuf.AbstractParser<ListGroupMembersResponse>() {
        @java.lang.Override
        public ListGroupMembersResponse parsePartialFrom(
            com.google.protobuf.CodedInputStream input,
            com.google.protobuf.ExtensionRegistryLite extensionRegistry)
            throws com.google.protobuf.InvalidProtocolBufferException {
          Builder builder = newBuilder();
          try {
            builder.mergeFrom(input, extensionRegistry);
          } catch (com.google.protobuf.InvalidProtocolBufferException e) {
            throw e.setUnfinishedMessage(builder.buildPartial());
          } catch (com.google.protobuf.UninitializedMessageException e) {
            throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial());
          } catch (java.io.IOException e) {
            throw new com.google.protobuf.InvalidProtocolBufferException(e)
                .setUnfinishedMessage(builder.buildPartial());
          }
          return builder.buildPartial();
        }
      };

  public static com.google.protobuf.Parser<ListGroupMembersResponse> parser() {
    return PARSER;
  }

  @java.lang.Override
  public com.google.protobuf.Parser<ListGroupMembersResponse> getParserForType() {
    return PARSER;
  }

  @java.lang.Override
  public com.google.monitoring.v3.ListGroupMembersResponse getDefaultInstanceForType() {
    return DEFAULT_INSTANCE;
  }
}


text:
package liquibase.sqlgenerator.core;

import liquibase.database.Database;
import liquibase.database.core.H2Database;
import liquibase.database.core.HsqlDatabase;
import liquibase.database.structure.Column;
import liquibase.database.structure.Table;
import liquibase.sql.Sql;
import liquibase.sql.UnparsedSql;
import liquibase.sqlgenerator.SqlGeneratorChain;
import liquibase.statement.core.AddAutoIncrementStatement;

public class AddAutoIncrementGeneratorHsqlH2 extends AddAutoIncrementGenerator {

    @Override
    public int getPriority() {
        return PRIORITY_DATABASE;
    }

    @Override
    public boolean supports(AddAutoIncrementStatement statement, Database database) {
        return database instanceof HsqlDatabase || database instanceof H2Database;
    }

    @Override
    public Sql[] generateSql(AddAutoIncrementStatement statement, Database database, SqlGeneratorChain sqlGeneratorChain) {
        return new Sql[]{
                new UnparsedSql("ALTER TABLE " + database.escapeTableName(statement.getSchemaName(), statement.getTableName()) + " ALTER COLUMN " + database.escapeColumnName(statement.getSchemaName(), statement.getTableName(), statement.getColumnName()) + " " + statement.getColumnDataType() + " GENERATED BY DEFAULT AS IDENTITY IDENTITY",
                        new Column()
                                .setTable(new Table(statement.getTableName()).setSchema(statement.getSchemaName()))
                                .setName(statement.getColumnName()))
        };
    }
}


text:
  Cuzac est
       un village
       géographiquement positionné dans le département de Lot en Midi-Pyrénées. Elle totalisait 221 habitants en 2008.

À coté de Cuzac sont localisées les villes de
Beaumat à 3 km, 74 habitants,
Vaillac localisée à 4 km, 93 habitants,
Ussel située à 5 km, 71 habitants,
Soulomès située à 3 km, 114 habitants,
Labastide-Murat à 2 km, 653 habitants,
Caniac-du-Causse située à 6 km, 318 habitants,
 entre autres. De plus, Cuzac est située à seulement 20 km de Cahors.

Le nombre d'habitations, à Cuzac, était réparti en 2011 en trois appartements et 132 maisons soit
 un marché plutôt équilibré.

Si vous envisagez de venir habiter à Cuzac, vous pourrez aisément trouver une maison à acheter.

La ville compte quelques  équipements, elle dispose, entre autres, de une boucle de randonnée.


text:
typedef int A;	// { dg-error "previous" }
enum ::A {};	// { dg-error "typedef-name|expected unqualified-id" }


text:
package org.zstack.sdk;

public class CleanInvalidLdapIAM2BindingResult {
    public java.util.List inventories;
    public void setInventories(java.util.List inventories) {
        this.inventories = inventories;
    }
    public java.util.List getInventories() {
        return this.inventories;
    }

}


text:
let next_timerender_id = 0;

const set_to_start_of_day = function (time) {
    return time.setMilliseconds(0).setSeconds(0).setMinutes(0).setHours(0);
};

// Given an XDate object 'time', returns an object:
// {
//      time_str:        a string for the current human-formatted version
//      formal_time_str: a string for the current formally formatted version
//                          e.g. "Monday, April 15, 2017"
//      needs_update:    a boolean for if it will need to be updated when the
//                       day changes
// }
exports.render_now = function (time, today) {
    const start_of_today = set_to_start_of_day(today || new XDate());
    const start_of_other_day = set_to_start_of_day(time.clone());

    let time_str = '';
    let needs_update = false;
    // render formal time to be used as title attr tooltip
    // "\xa0" is U+00A0 NO-BREAK SPACE.
    // Can't use   as that represents the literal string " ".
    const formal_time_str = time.toString('dddd,\xa0MMMM\xa0d,\xa0yyyy');

    // How many days old is 'time'? 0 = today, 1 = yesterday, 7 = a
    // week ago, -1 = tomorrow, etc.

    // Presumably the result of diffDays will be an integer in this
    // case, but round it to be sure before comparing to integer
    // constants.
    const days_old = Math.round(start_of_other_day.diffDays(start_of_today));

    const is_older_year =
        start_of_today.getFullYear() - start_of_other_day.getFullYear() > 0;

    if (days_old === 0) {
        time_str = i18n.t("Today");
        needs_update = true;
    } else if (days_old === 1) {
        time_str = i18n.t("Yesterday");
        needs_update = true;
    } else if (is_older_year) {
        // For long running servers, searching backlog can get ambiguous
        // without a year stamp. Only show year if message is from an older year
        time_str = time.toString("MMM\xa0dd,\xa0yyyy");
        needs_update = false;
    } else {
        // For now, if we get a message from tomorrow, we don't bother
        // rewriting the timestamp when it gets to be tomorrow.
        time_str = time.toString("MMM\xa0dd");
        needs_update = false;
    }
    return {
        time_str: time_str,
        formal_time_str: formal_time_str,
        needs_update: needs_update,
    };
};

// Current date is passed as an argument for unit testing
exports.last_seen_status_from_date = function (last_active_date, current_date) {
    if (typeof  current_date === 'undefined') {
        current_date = new XDate();
    }

    const minutes = Math.floor(last_active_date.diffMinutes(current_date));
    if (minutes <= 2) {
        return i18n.t("Just now");
    }
    if (minutes < 60) {
        return i18n.t("__minutes__ minutes ago", {minutes: minutes});
    }

    const hours = Math.floor(minutes / 60);
    if (hours === 1) {
        return i18n.t("An hour ago");
    }
    if (hours < 24) {
        return i18n.t("__hours__ hours ago", {hours: hours});
    }

    const days = Math.floor(hours / 24);
    if (days === 1) {
        return i18n.t("Yesterday");
    }

    if (days < 90) {
        return i18n.t("__days__ days ago", {days: days});
    } else if (days > 90 && days < 365) {
        if (current_date.getFullYear() === last_active_date.getFullYear()) {
            // Online more than 90 days ago, in the same year
            return i18n.t("__last_active_date__",
                          {last_active_date: last_active_date.toString("MMM\xa0dd")});
        }
    }
    return i18n.t("__last_active_date__",
                  {last_active_date: last_active_date.toString("MMM\xa0dd,\xa0yyyy")});
};

// List of the dates that need to be updated when the day changes.
// Each timestamp is represented as a list of length 2:
//   [id of the span element, XDate representing the time]
let update_list = [];

// The time at the beginning of the next day, when the timestamps are updated.
// Represented as an XDate with hour, minute, second, millisecond 0.
let next_update;
exports.initialize = function () {
    next_update = set_to_start_of_day(new XDate()).addDays(1);
};

// time_above is an optional argument, to support dates that look like:
// --- ▲ Yesterday ▲ ------ ▼ Today ▼ ---
function maybe_add_update_list_entry(entry) {
    if (entry.needs_update) {
        update_list.push(entry);
    }
}

function render_date_span(elem, rendered_time, rendered_time_above) {
    elem.text("");
    if (rendered_time_above !== undefined) {
        const pieces = [
            '',
            rendered_time_above.time_str,
            '
',
            '',
            rendered_time.time_str,
        ];
        elem.append(pieces);
        return elem;
    }
    elem.append(rendered_time.time_str);
    return elem.attr('title', rendered_time.formal_time_str);
}

// Given an XDate object 'time', return a DOM node that initially
// displays the human-formatted date, and is updated automatically as
// necessary (e.g. changing "Today" to "Yesterday" to "Jul 1").
// If two dates are given, it renders them as:
// --- ▲ Yesterday ▲ ------ ▼ Today ▼ ---

// (What's actually spliced into the message template is the contents
// of this DOM node as HTML, so effectively a copy of the node. That's
// okay since to update the time later we look up the node by its id.)
exports.render_date = function (time, time_above, today) {
    const className = "timerender" + next_timerender_id;
    next_timerender_id += 1;
    const rendered_time = exports.render_now(time, today);
    let node = $("").attr('class', className);
    if (time_above !== undefined) {
        const rendered_time_above = exports.render_now(time_above, today);
        node = render_date_span(node, rendered_time, rendered_time_above);
    } else {
        node = render_date_span(node, rendered_time);
    }
    maybe_add_update_list_entry({
        needs_update: rendered_time.needs_update,
        className: className,
        time: time,
        time_above: time_above,
    });
    return node;
};

// Renders the timestamp returned by the !time() markdown syntax.
exports.render_markdown_timestamp = function (time, now, text) {
    now = now || moment();
    if (page_params.timezone) {
        now = now.tz(page_params.timezone);
        time = time.tz(page_params.timezone);
    }
    const timestring = time.format('ddd, MMM D YYYY, h:mm A');
    const titlestring = "This time is in your timezone. Original text was '" + text + "'.";
    return {
        text: timestring,
        title: titlestring,
    };
};

// This isn't expected to be called externally except manually for
// testing purposes.
exports.update_timestamps = function () {
    const now = new XDate();
    if (now >= next_update) {
        const to_process = update_list;
        update_list = [];

        for (const entry of to_process) {
            const className = entry.className;
            const elements = $('.' + className);
            // The element might not exist any more (because it
            // was in the zfilt table, or because we added
            // messages above it and re-collapsed).
            if (elements !== null) {
                for (const element of elements) {
                    const time = entry.time;
                    const time_above = entry.time_above;
                    const rendered_time = exports.render_now(time);
                    if (time_above) {
                        const rendered_time_above = exports.render_now(time_above);
                        render_date_span($(element), rendered_time, rendered_time_above);
                    } else {
                        render_date_span($(element), rendered_time);
                    }
                    maybe_add_update_list_entry({
                        needs_update: rendered_time.needs_update,
                        className: className,
                        time: time,
                        time_above: time_above,
                    });
                }
            }
        }

        next_update = set_to_start_of_day(now.clone().addDays(1));
    }
};

setInterval(exports.update_timestamps, 60 * 1000);

// Transform a Unix timestamp into a ISO 8601 formatted date string.
//   Example: 1978-10-31T13:37:42Z
exports.get_full_time = function (timestamp) {
    return new XDate(timestamp * 1000).toISOString();
};

exports.stringify_time = function (time) {
    if (page_params.twenty_four_hour_time) {
        return time.toString('HH:mm');
    }
    return time.toString('h:mm TT');
};

// this is for rendering absolute time based off the preferences for twenty-four
// hour time in the format of "%mmm %d, %h:%m %p".
exports.absolute_time = (function () {
    const MONTHS = [
        "Jan", "Feb", "Mar", "Apr", "May", "Jun",
        "Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
    ];

    const fmt_time = function (date, H_24) {
        const payload = {
            hours: date.getHours(),
            minutes: date.getMinutes(),
        };

        if (payload.hours > 12 && !H_24) {
            payload.hours -= 12;
            payload.is_pm = true;
        }

        let str = ("0" + payload.hours).slice(-2) + ":" + ("0" + payload.minutes).slice(-2);

        if (!H_24) {
            str += payload.is_pm ? " PM" : " AM";
        }

        return str;
    };

    return function (timestamp, today) {
        if (typeof today === 'undefined') {
            today = new Date();
        }
        const date = new Date(timestamp);
        const is_older_year = today.getFullYear() - date.getFullYear() > 0;
        const H_24 = page_params.twenty_four_hour_time;
        let str = MONTHS[date.getMonth()] + " " + date.getDate();
        // include year if message date is from a previous year
        if (is_older_year) {
            str += ", " + date.getFullYear();
        }
        str += " " + fmt_time(date, H_24);
        return str;
    };
}());

exports.get_full_datetime = function (time) {
    // Convert to number of hours ahead/behind UTC.
    // The sign of getTimezoneOffset() is reversed wrt
    // the conventional meaning of UTC+n / UTC-n
    const tz_offset = -time.getTimezoneOffset() / 60;
    return {
        date: time.toLocaleDateString(),
        time: time.toLocaleTimeString() +
        ' (UTC' + (tz_offset < 0 ? '' : '+') + tz_offset + ')',
    };
};

// XDate.toLocaleDateString and XDate.toLocaleTimeString are
// expensive, so we delay running the following code until we need
// the full date and time strings.
exports.set_full_datetime = function timerender_set_full_datetime(message, time_elem) {
    if (message.full_date_str !== undefined) {
        return;
    }

    const time = new XDate(message.timestamp * 1000);
    const full_datetime = exports.get_full_datetime(time);

    message.full_date_str = full_datetime.date;
    message.full_time_str = full_datetime.time;

    time_elem.attr('title', message.full_date_str + ' ' + message.full_time_str);
};

window.timerender = exports;


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

<meta http-equiv="Content-Type" content="text/html" charset="utf-8">
<title>Uses of Class org.apache.lucene.analysis.util.CharFilterFactory (Lucene 4.6.1 API)</title>
<meta name="date" content="2014-01-23">
<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Use

Tree

Deprecated

Help

PREV

NEXT

FRAMES

NO FRAMES

All Classes

Uses of Class
org.apache.lucene.analysis.util.CharFilterFactory

Packages that use CharFilterFactory

Package
Description

org.apache.lucene.analysis.charfilter

Normalization of text before the tokenizer.

org.apache.lucene.analysis.fa

Analyzer for Persian.

org.apache.lucene.analysis.pattern

Set of components for pattern-based (regex) analysis.

org.apache.lucene.analysis.util

Utility functions for text analysis.

Uses of CharFilterFactory in org.apache.lucene.analysis.charfilter

Subclasses of CharFilterFactory in org.apache.lucene.analysis.charfilter

Modifier and Type
Class and Description

class
HTMLStripCharFilterFactory

Factory for HTMLStripCharFilter.

class
MappingCharFilterFactory

Factory for MappingCharFilter.

Uses of CharFilterFactory in org.apache.lucene.analysis.fa

Subclasses of CharFilterFactory in org.apache.lucene.analysis.fa

Modifier and Type
Class and Description

class
PersianCharFilterFactory

Factory for PersianCharFilter.

Uses of CharFilterFactory in org.apache.lucene.analysis.pattern

Subclasses of CharFilterFactory in org.apache.lucene.analysis.pattern

Modifier and Type
Class and Description

class
PatternReplaceCharFilterFactory

Factory for PatternReplaceCharFilter.

Uses of CharFilterFactory in org.apache.lucene.analysis.util

Methods in org.apache.lucene.analysis.util that return CharFilterFactory

Modifier and Type
Method and Description

static CharFilterFactory
CharFilterFactory.forName(String name,
       Map<String,String> args)

looks up a charfilter by name from context classpath

Methods in org.apache.lucene.analysis.util that return types with arguments of type CharFilterFactory

Modifier and Type
Method and Description

static Class<? extends CharFilterFactory>
CharFilterFactory.lookupClass(String name)

looks up a charfilter class by name from context classpath

Overview

Package

Class

Use

Tree

Deprecated

Help

PREV

NEXT

FRAMES

NO FRAMES

All Classes

          Copyright © 2000-2014 Apache Software Foundation.  All Rights Reserved.