text:
package com.hazelcast.multimap;

import com.hazelcast.config.Config;
import com.hazelcast.config.MultiMapConfig;
import com.hazelcast.core.EntryAdapter;
import com.hazelcast.core.EntryEvent;
import com.hazelcast.core.EntryListener;
import com.hazelcast.core.HazelcastInstance;
import com.hazelcast.internal.util.Clock;
import com.hazelcast.map.MapEvent;
import com.hazelcast.test.HazelcastParallelClassRunner;
import com.hazelcast.test.HazelcastTestSupport;
import com.hazelcast.test.TestHazelcastInstanceFactory;
import com.hazelcast.test.annotation.ParallelJVMTest;
import com.hazelcast.test.annotation.QuickTest;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Random;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Consumer;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;

@RunWith(HazelcastParallelClassRunner.class)
@Category({QuickTest.class, ParallelJVMTest.class})
public class MultiMapTest extends HazelcastTestSupport {

    @Test
    public void testMultiMapPutAndGet() {
        HazelcastInstance instance = createHazelcastInstance();

        MultiMap<String, String> multiMap = instance.getMultiMap("testMultiMapPutAndGet");
        multiMap.put("Hello", "World");
        Collection<String> values = multiMap.get("Hello");
        assertEquals("World", values.iterator().next());
        multiMap.put("Hello", "Europe");
        multiMap.put("Hello", "America");
        multiMap.put("Hello", "Asia");
        multiMap.put("Hello", "Africa");
        multiMap.put("Hello", "Antarctica");
        multiMap.put("Hello", "Australia");
        values = multiMap.get("Hello");
        assertEquals(7, values.size());
        assertFalse(multiMap.remove("Hello", "Unknown"));
        assertEquals(7, multiMap.get("Hello").size());
        assertTrue(multiMap.remove("Hello", "Antarctica"));
        assertEquals(6, multiMap.get("Hello").size());
    }

    @Test
    public void testMultiMapPutGetRemove() {
        HazelcastInstance instance = createHazelcastInstance();

        MultiMap<String, String> multiMap = instance.getMultiMap("testMultiMapPutGetRemove");
        multiMap.put("1", "C");
        multiMap.put("2", "x");
        multiMap.put("2", "y");
        multiMap.put("1", "A");
        multiMap.put("1", "B");
        Collection g1 = multiMap.get("1");
        assertContains(g1, "A");
        assertContains(g1, "B");
        assertContains(g1, "C");
        assertEquals(5, multiMap.size());
        assertTrue(multiMap.remove("1", "C"));
        assertEquals(4, multiMap.size());
        Collection g2 = multiMap.get("1");
        assertContains(g2, "A");
        assertContains(g2, "B");
        assertFalse(g2.contains("C"));
        Collection r1 = multiMap.remove("2");
        assertContains(r1, "x");
        assertContains(r1, "y");
        assertNotNull(multiMap.get("2"));
        assertTrue(multiMap.get("2").isEmpty());
        assertEquals(2, multiMap.size());
        Collection r2 = multiMap.remove("1");
        assertContains(r2, "A");
        assertContains(r2, "B");
        assertNotNull(multiMap.get("1"));
        assertTrue(multiMap.get("1").isEmpty());
        assertEquals(0, multiMap.size());
    }

    protected <K, V> EntryListener<K, V> putAllEntryListenerBuilder(Consumer<EntryEvent<K, V>> f) {
        return new EntryAdapter<K, V>() {
            public void entryAdded(EntryEvent<K, V> event) {
                f.accept(event);
            }

            public void entryRemoved(EntryEvent<K, V> event) {
            }

            public void entryEvicted(EntryEvent<K, V> event) {
                entryRemoved(event);
            }

            @Override
            public void mapEvicted(MapEvent event) {
            }

            @Override
            public void mapCleared(MapEvent event) {
            }
        };
    }

    protected HazelcastInstance testMultiMapPutAllSetup() {
        MultiMapConfig multiMapConfig1 = new MultiMapConfig()
                .setName("testMultiMapPutAllMapList")
                .setValueCollectionType(MultiMapConfig.ValueCollectionType.LIST)
                .setBinary(false);
        MultiMapConfig multiMapConfig2 = new MultiMapConfig()
                .setName("testMultiMapPutAllMapSet")
                .setValueCollectionType(MultiMapConfig.ValueCollectionType.SET)
                .setBinary(false);
        Config cfg = smallInstanceConfig()
                .addMultiMapConfig(multiMapConfig1)
                .addMultiMapConfig(multiMapConfig2);
        HazelcastInstance hz = createHazelcastInstanceFactory(1)
                .newInstances(cfg)[0];

        return hz;
    }

    public void testMultiMapPutAllTemplate(HazelcastInstance instance1,
                                           Map<String, Collection<? extends Integer>> expectedMultiMap,
                                           Consumer<MultiMap<String, Integer>> putAllOperation)
            throws InterruptedException {

        MultiMap<String, Integer> mmap1 = instance1.getMultiMap("testMultiMapPutAllMapList");
        MultiMap<String, Integer> mmap2 = instance1.getMultiMap("testMultiMapPutAllMapSet");
        Map<String, Collection<Integer>> resultMap1 = new ConcurrentHashMap<>();
        Map<String, Collection<Integer>> resultMap2 = new ConcurrentHashMap<>();

        int totalItems = 0;
        Set<String> ks = expectedMultiMap.keySet();
        for (String s : ks) {
            Collection expectedCollection = expectedMultiMap.get(s);
            totalItems += expectedCollection.size()
                    + ((Long) expectedCollection.stream().distinct().count()).intValue();
        }

        final CountDownLatch latchAdded = new CountDownLatch(totalItems);
        mmap1.addEntryListener(putAllEntryListenerBuilder((event) -> {
                    String key = (String) event.getKey();
                    Integer value = (Integer) event.getValue();
                    Collection<Integer> c;
                    if (!resultMap1.containsKey(key)) {
                        c = new ArrayList<>();
                    } else {
                        c = resultMap1.get(key);
                    }
                    c.add(value);
                    resultMap1.put(key, c);
                    latchAdded.countDown();
                }
        ), true);
        mmap2.addEntryListener(putAllEntryListenerBuilder((event) -> {
                    String key = (String) event.getKey();
                    Integer value = (Integer) event.getValue();
                    Collection<Integer> c;
                    if (!resultMap2.containsKey(key)) {
                        c = new ArrayList<>();
                    } else {
                        c = resultMap2.get(key);
                    }
                    c.add(value);

                    resultMap2.put(key, c);
                    latchAdded.countDown();
                }
        ), true);

        putAllOperation.accept(mmap1);
        putAllOperation.accept(mmap2);
        assertOpenEventually(latchAdded);

        for (String s : ks) {
            Collection c1 = resultMap1.get(s);
            Collection c2 = resultMap2.get(s);
            Collection expectedCollection = expectedMultiMap.get(s);
            assertEquals(expectedCollection.size(), c1.size());
            assertEquals(expectedCollection.stream().distinct().count(), c2.size());
        }
    }

    @Test
    public void testMultiMapPutAllAsyncMap() throws InterruptedException {
        Map<String, Collection<? extends Integer>> expectedMultiMap = new HashMap<>();
        expectedMultiMap.put("A", new ArrayList<>(Arrays.asList(1, 1, 1, 1, 2)));
        expectedMultiMap.put("B", new ArrayList<>(Arrays.asList(6, 6, 6, 9)));
        expectedMultiMap.put("C", new ArrayList<>(Arrays.asList(10, 10, 10, 10, 10, 15)));

        testMultiMapPutAllTemplate(testMultiMapPutAllSetup(),
                expectedMultiMap,
                (o) -> {
                    o.putAllAsync(expectedMultiMap);
                }
        );
    }

    @Test
    public void testMultiMapPutAllAsyncKey() throws InterruptedException {
        Map<String, Collection<? extends Integer>> expectedMultiMap = new HashMap<>();
        expectedMultiMap.put("A", new ArrayList<>(Arrays.asList(1, 1, 1, 1, 2)));
        expectedMultiMap.put("B", new ArrayList<>(Arrays.asList(6, 6, 6, 9)));
        expectedMultiMap.put("C", new ArrayList<>(Arrays.asList(10, 10, 10, 10, 10, 15)));

        testMultiMapPutAllTemplate(testMultiMapPutAllSetup(),
                expectedMultiMap,
                (o) -> {
                    expectedMultiMap.keySet().forEach(
                            (v) -> o.putAllAsync(v, expectedMultiMap.get(v))
                    );
                }
        );
    }

    @Test
    public void testMultiMapClear() {
        HazelcastInstance instance = createHazelcastInstance();
        MultiMap<String, String> multiMap = instance.getMultiMap("testMultiMapClear");
        multiMap.put("Hello", "World");
        assertEquals(1, multiMap.size());
        multiMap.clear();
        assertEquals(0, multiMap.size());
    }

    @Test
    public void testMultiMapContainsKey() {
        HazelcastInstance instance = createHazelcastInstance();
        MultiMap<String, String> multiMap = instance.getMultiMap("testMultiMapContainsKey");
        multiMap.put("Hello", "World");
        assertTrue(multiMap.containsKey("Hello"));
    }

    @Test
    public void testMultiMapContainsValue() {
        HazelcastInstance instance = createHazelcastInstance();
        MultiMap<String, String> multiMap = instance.getMultiMap("testMultiMapContainsValue");
        multiMap.put("Hello", "World");
        assertTrue(multiMap.containsValue("World"));
    }

    @Test
    public void testMultiMapContainsEntry() {
        HazelcastInstance instance = createHazelcastInstance();
        MultiMap<String, String> multiMap = instance.getMultiMap("testMultiMapContainsEntry");
        multiMap.put("Hello", "World");
        assertTrue(multiMap.containsEntry("Hello", "World"));
    }

    @Test
    public void testMultiMapDelete() {
        HazelcastInstance instance = createHazelcastInstance();
        MultiMap<String, String> map = instance.getMultiMap("testMultiMapContainsEntry");
        map.put("Hello", "World");
        map.delete("Hello");
        assertFalse(map.containsEntry("Hello", "World"));
    }

    /**
     * Issue 818
     */
    @Test
    public void testMultiMapWithCustomSerializable() {
        HazelcastInstance instance = createHazelcastInstance();

        MultiMap<String, CustomSerializable> multiMap = instance.getMultiMap("testMultiMapWithCustomSerializable");
        multiMap.put("1", new CustomSerializable());
        assertEquals(1, multiMap.size());
        multiMap.remove("1");
        assertEquals(0, multiMap.size());
    }

    @Test
    public void testContains() {
        MultiMapConfig multiMapConfigWithSet = new MultiMapConfig()
                .setName("testContains.set")
                .setValueCollectionType("SET")
                .setBinary(false);

        MultiMapConfig multiMapConfigWithList = new MultiMapConfig()
                .setName("testContains.list")
                .setValueCollectionType("LIST")
                .setBinary(false);

        Config config = smallInstanceConfig()
                .addMultiMapConfig(multiMapConfigWithSet)
                .addMultiMapConfig(multiMapConfigWithList);

        HazelcastInstance instance = createHazelcastInstance(config);

        // MultiMap with ValueCollectionType.SET
        MultiMap<String, ComplexValue> multiMapWithSet = instance.getMultiMap("testContains.set");
        assertTrue(multiMapWithSet.put("1", new ComplexValue("text", 1)));
        assertFalse(multiMapWithSet.put("1", new ComplexValue("text", 1)));
        assertFalse(multiMapWithSet.put("1", new ComplexValue("text", 2)));
        assertTrue(multiMapWithSet.containsValue(new ComplexValue("text", 1)));
        assertTrue(multiMapWithSet.containsValue(new ComplexValue("text", 2)));
        assertTrue(multiMapWithSet.remove("1", new ComplexValue("text", 3)));
        assertFalse(multiMapWithSet.remove("1", new ComplexValue("text", 1)));
        assertTrue(multiMapWithSet.put("1", new ComplexValue("text", 1)));
        assertTrue(multiMapWithSet.containsEntry("1", new ComplexValue("text", 1)));
        assertTrue(multiMapWithSet.containsEntry("1", new ComplexValue("text", 2)));
        assertTrue(multiMapWithSet.remove("1", new ComplexValue("text", 1)));

        // MultiMap with ValueCollectionType.LIST
        MultiMap<String, ComplexValue> multiMapWithList = instance.getMultiMap("testContains.list");
        assertTrue(multiMapWithList.put("1", new ComplexValue("text", 1)));
        assertTrue(multiMapWithList.put("1", new ComplexValue("text", 1)));
        assertTrue(multiMapWithList.put("1", new ComplexValue("text", 2)));
        assertEquals(3, multiMapWithList.size());
        assertTrue(multiMapWithList.remove("1", new ComplexValue("text", 4)));
        assertEquals(2, multiMapWithList.size());
    }

    @Test
    public void testMultiMapKeySet() {
        HazelcastInstance instance = createHazelcastInstance();
        MultiMap<String, String> multiMap = instance.getMultiMap("testMultiMapKeySet");
        multiMap.put("Hello", "World");
        multiMap.put("Hello", "Europe");
        multiMap.put("Hello", "America");
        multiMap.put("Hello", "Asia");
        multiMap.put("Hello", "Africa");
        multiMap.put("Hello", "Antarctica");
        multiMap.put("Hello", "Australia");
        Set<String> keys = multiMap.keySet();
        assertEquals(1, keys.size());
    }

    @Test
    public void testMultiMapValues() {
        HazelcastInstance instance = createHazelcastInstance();
        MultiMap<String, String> multiMap = instance.getMultiMap("testMultiMapValues");
        multiMap.put("Hello", "World");
        multiMap.put("Hello", "Europe");
        multiMap.put("Hello", "America");
        multiMap.put("Hello", "Asia");
        multiMap.put("Hello", "Africa");
        multiMap.put("Hello", "Antarctica");
        multiMap.put("Hello", "Australia");
        Collection<String> values = multiMap.values();
        assertEquals(7, values.size());
    }

    @Test
    public void testMultiMapRemove() {
        HazelcastInstance instance = createHazelcastInstance();
        MultiMap<String, String> multiMap = instance.getMultiMap("testMultiMapRemove");
        multiMap.put("Hello", "World");
        multiMap.put("Hello", "Europe");
        multiMap.put("Hello", "America");
        multiMap.put("Hello", "Asia");
        multiMap.put("Hello", "Africa");
        multiMap.put("Hello", "Antarctica");
        multiMap.put("Hello", "Australia");
        assertEquals(7, multiMap.size());
        assertEquals(1, multiMap.keySet().size());
        Collection<String> values = multiMap.remove("Hello");
        assertEquals(7, values.size());
        assertEquals(0, multiMap.size());
        assertEquals(0, multiMap.keySet().size());
        multiMap.put("Hello", "World");
        assertEquals(1, multiMap.size());
        assertEquals(1, multiMap.keySet().size());
    }

    @Test
    public void testMultiMapRemoveEntries() {
        HazelcastInstance instance = createHazelcastInstance();
        MultiMap<String, String> multiMap = instance.getMultiMap("testMultiMapRemoveEntries");
        multiMap.put("Hello", "World");
        multiMap.put("Hello", "Europe");
        multiMap.put("Hello", "America");
        multiMap.put("Hello", "Asia");
        multiMap.put("Hello", "Africa");
        multiMap.put("Hello", "Antarctica");
        multiMap.put("Hello", "Australia");
        boolean removed = multiMap.remove("Hello", "World");
        assertTrue(removed);
        assertEquals(6, multiMap.size());
    }

    @Test
    public void testMultiMapEntrySet() {
        HazelcastInstance instance = createHazelcastInstance();
        MultiMap<String, String> multiMap = instance.getMultiMap("testMultiMapEntrySet");
        multiMap.put("Hello", "World");
        multiMap.put("Hello", "Europe");
        multiMap.put("Hello", "America");
        multiMap.put("Hello", "Asia");
        multiMap.put("Hello", "Africa");
        multiMap.put("Hello", "Antarctica");
        multiMap.put("Hello", "Australia");
        Set<Map.Entry<String, String>> entries = multiMap.entrySet();
        assertEquals(7, entries.size());
        int itCount = 0;
        for (Map.Entry<String, String> entry : entries) {
            assertEquals("Hello", entry.getKey());
            itCount++;
        }
        assertEquals(7, itCount);
    }

    @Test
    public void testMultiMapValueCount() {
        HazelcastInstance instance = createHazelcastInstance();
        MultiMap<Integer, String> multiMap = instance.getMultiMap("testMultiMapValueCount");
        multiMap.put(1, "World");
        multiMap.put(2, "Africa");
        multiMap.put(1, "America");
        multiMap.put(2, "Antarctica");
        multiMap.put(1, "Asia");
        multiMap.put(1, "Europe");
        multiMap.put(2, "Australia");
        assertEquals(4, multiMap.valueCount(1));
        assertEquals(3, multiMap.valueCount(2));
    }

    /**
     * idGen is not set while replicating
     */
    @Test
    public void testIssue5220() {
        String name = randomString();
        TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(3);

        HazelcastInstance instance1 = factory.newHazelcastInstance();
        MultiMap<Object, Object> multiMap1 = instance1.getMultiMap(name);
        // populate multimap while instance1 is owner
        // records will have ids from 0 to 10
        for (int i = 0; i < 10; i++) {
            multiMap1.put("ping-address", "instance1-" + i);
        }

        HazelcastInstance instance2 = factory.newHazelcastInstance();
        MultiMap<Object, Object> multiMap2 = instance2.getMultiMap(name);
        // now the second instance is the owner
        // if idGen is not set while replicating
        // these entries will have ids from 0 to 10 too
        for (int i = 0; i < 10; i++) {
            multiMap2.put("ping-address", "instance2-" + i);
        }

        HazelcastInstance instance3 = factory.newHazelcastInstance();
        MultiMap<Object, Object> multiMap3 = instance3.getMultiMap(name);

        // since remove iterates all items and check equals it will remove correct item from owner-side
        // but for the backup we just sent the recordId. if idGen is not set while replicating
        // we may end up removing instance1's items
        for (int i = 0; i < 10; i++) {
            multiMap2.remove("ping-address", "instance2-" + i);
        }
        instance2.getLifecycleService().terminate();

        for (int i = 0; i < 10; i++) {
            multiMap1.remove("ping-address", "instance1-" + i);
        }
        instance1.shutdown();

        assertEquals(0, multiMap3.size());
    }

    /**
     * ConcurrentModificationExceptions
     */
    @Test
    public void testIssue1882() {
        String name = "mm";

        Config config = new Config();
        config.getMultiMapConfig(name)
                .setValueCollectionType(MultiMapConfig.ValueCollectionType.LIST);

        TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(2);
        HazelcastInstance instance = factory.newHazelcastInstance(config);
        factory.newHazelcastInstance(config);

        final String key = generateKeyOwnedBy(instance);
        final MultiMap<Object, Object> multiMap = instance.getMultiMap(name);
        multiMap.put(key, 1);
        multiMap.put(key, 2);

        final AtomicBoolean isRunning = new AtomicBoolean(true);
        Thread thread = new Thread() {
            @Override
            public void run() {
                int count = 3;
                while (isRunning.get()) {
                    multiMap.put(key, count++);
                }
            }
        };
        thread.start();

        for (int i = 0; i < 10; i++) {
            multiMap.get(key);
        }

        isRunning.set(false);
        assertJoinable(thread);
    }

    @Test
    public void testPutGetRemoveWhileCollectionTypeSet() {
        String name = "defMM";

        Config config = new Config();
        config.getMultiMapConfig(name)
                .setValueCollectionType(MultiMapConfig.ValueCollectionType.SET);

        TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(4);
        HazelcastInstance[] instances = factory.newInstances(config);

        assertTrue(getMultiMap(instances, name).put("key1", "key1_value1"));
        assertTrue(getMultiMap(instances, name).put("key1", "key1_value2"));

        assertTrue(getMultiMap(instances, name).put("key2", "key2_value1"));
        assertFalse(getMultiMap(instances, name).put("key2", "key2_value1"));

        assertEquals(getMultiMap(instances, name).valueCount("key1"), 2);
        assertEquals(getMultiMap(instances, name).valueCount("key2"), 1);
        assertEquals(getMultiMap(instances, name).size(), 3);

        Collection collection = getMultiMap(instances, name).get("key2");
        assertEquals(collection.size(), 1);
        Iterator iterator = collection.iterator();
        Object value = iterator.next();
        assertEquals(value, "key2_value1");

        assertTrue(getMultiMap(instances, name).remove("key1", "key1_value1"));
        assertFalse(getMultiMap(instances, name).remove("key1", "key1_value1"));
        assertTrue(getMultiMap(instances, name).remove("key1", "key1_value2"));

        collection = getMultiMap(instances, name).get("key1");
        assertEquals(collection.size(), 0);

        collection = getMultiMap(instances, name).remove("key2");
        assertEquals(collection.size(), 1);
        iterator = collection.iterator();
        value = iterator.next();
        assertEquals(value, "key2_value1");
    }

    @Test
    public void testContainsKey() {
        TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(1);
        MultiMap<Object, Object> multiMap = getMultiMap(factory.newInstances(), randomString());

        assertFalse(multiMap.containsKey("test"));

        multiMap.put("test", "test");
        assertTrue(multiMap.containsKey("test"));

        multiMap.remove("test");
        assertFalse(multiMap.containsKey("test"));
    }

    @Test(expected = NullPointerException.class)
    public void testGet_whenNullKey() {
        TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(1);
        MultiMap<Object, Object> multiMap = getMultiMap(factory.newInstances(), randomString());

        multiMap.get(null);
    }

    @Test(expected = NullPointerException.class)
    public void testPut_whenNullKey() {
        TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(1);
        MultiMap<Object, Object> multiMap = getMultiMap(factory.newInstances(), randomString());

        multiMap.put(null, "someVal");
    }

    @Test(expected = NullPointerException.class)
    public void testPut_whenNullValue() {
        TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(1);
        MultiMap<Object, Object> multiMap = getMultiMap(factory.newInstances(), randomString());

        multiMap.put("someVal", null);
    }

    @Test(expected = NullPointerException.class)
    public void testContainsKey_whenNullKey() {
        TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(1);
        MultiMap<Object, Object> multiMap = getMultiMap(factory.newInstances(), randomString());

        multiMap.containsKey(null);
    }

    @Test(expected = NullPointerException.class)
    public void testContainsValue_whenNullKey() {
        TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(1);
        MultiMap multiMap = getMultiMap(factory.newInstances(), randomString());

        multiMap.containsValue(null);
    }

    @Test(expected = NullPointerException.class)
    public void testContainsEntry_whenNullKey() {
        TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(1);
        MultiMap<Object, Object> multiMap = getMultiMap(factory.newInstances(), randomString());

        multiMap.containsEntry(null, "someVal");
    }

    @Test(expected = NullPointerException.class)
    public void testContainsEntry_whenNullValue() {
        TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(1);
        MultiMap<Object, Object> multiMap = getMultiMap(factory.newInstances(), randomString());

        multiMap.containsEntry("someVal", null);
    }

    @Test
    public void testPutGetRemoveWhileCollectionTypeList() {
        String name = "defMM";

        Config config = new Config();
        config.getMultiMapConfig(name)
                .setValueCollectionType(MultiMapConfig.ValueCollectionType.LIST);

        TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(4);
        HazelcastInstance[] instances = factory.newInstances(config);

        assertTrue(getMultiMap(instances, name).put("key1", "key1_value1"));
        assertTrue(getMultiMap(instances, name).put("key1", "key1_value2"));

        assertTrue(getMultiMap(instances, name).put("key2", "key2_value1"));
        assertTrue(getMultiMap(instances, name).put("key2", "key2_value1"));

        assertEquals(getMultiMap(instances, name).valueCount("key1"), 2);
        assertEquals(getMultiMap(instances, name).valueCount("key2"), 2);
        assertEquals(getMultiMap(instances, name).size(), 4);

        Collection<Object> collection = getMultiMap(instances, name).get("key1");
        assertEquals(collection.size(), 2);
        Iterator iterator = collection.iterator();
        assertEquals(iterator.next(), "key1_value1");
        assertEquals(iterator.next(), "key1_value2");

        assertTrue(getMultiMap(instances, name).remove("key1", "key1_value1"));
        assertFalse(getMultiMap(instances, name).remove("key1", "key1_value1"));
        assertTrue(getMultiMap(instances, name).remove("key1", "key1_value2"));

        collection = getMultiMap(instances, name).get("key1");
        assertEquals(collection.size(), 0);

        collection = getMultiMap(instances, name).remove("key2");
        assertEquals(collection.size(), 2);
        iterator = collection.iterator();
        assertEquals(iterator.next(), "key2_value1");
        assertEquals(iterator.next(), "key2_value1");
    }

    /**
     * test localKeySet, keySet, entrySet, values, contains, containsKey and containsValue methods
     */
    @Test
    public void testCollectionInterfaceMethods() {
        String name = "defMM";

        Config config = new Config();
        config.getMultiMapConfig(name)
                .setValueCollectionType(MultiMapConfig.ValueCollectionType.LIST);

        TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(4);
        HazelcastInstance[] instances = factory.newInstances(config);

        getMultiMap(instances, name).put("key1", "key1_val1");
        getMultiMap(instances, name).put("key1", "key1_val2");
        getMultiMap(instances, name).put("key1", "key1_val3");

        getMultiMap(instances, name).put("key2", "key2_val1");
        getMultiMap(instances, name).put("key2", "key2_val2");

        getMultiMap(instances, name).put("key3", "key3_val1");
        getMultiMap(instances, name).put("key3", "key3_val2");
        getMultiMap(instances, name).put("key3", "key3_val3");
        getMultiMap(instances, name).put("key3", "key3_val4");

        assertTrue(getMultiMap(instances, name).containsKey("key3"));
        assertTrue(getMultiMap(instances, name).containsValue("key3_val4"));

        Set<Object> localKeySet = instances[0].getMultiMap(name).localKeySet();
        Set<Object> totalKeySet = new HashSet<Object>(localKeySet);

        localKeySet = instances[1].getMultiMap(name).localKeySet();
        totalKeySet.addAll(localKeySet);

        localKeySet = instances[2].getMultiMap(name).localKeySet();
        totalKeySet.addAll(localKeySet);

        localKeySet = instances[3].getMultiMap(name).localKeySet();
        totalKeySet.addAll(localKeySet);
        assertEquals(3, totalKeySet.size());

        Set keySet = getMultiMap(instances, name).keySet();
        assertEquals(keySet.size(), 3);

        for (Object key : keySet) {
            assertContains(totalKeySet, key);
        }

        Set<Map.Entry<Object, Object>> entrySet = getMultiMap(instances, name).entrySet();
        assertEquals(entrySet.size(), 9);
        for (Map.Entry entry : entrySet) {
            String key = (String) entry.getKey();
            String val = (String) entry.getValue();
            assertTrue(val.startsWith(key));
        }

        Collection values = getMultiMap(instances, name).values();
        assertEquals(values.size(), 9);

        assertTrue(getMultiMap(instances, name).containsKey("key2"));
        assertFalse(getMultiMap(instances, name).containsKey("key4"));

        assertTrue(getMultiMap(instances, name).containsEntry("key3", "key3_val3"));
        assertFalse(getMultiMap(instances, name).containsEntry("key3", "key3_val7"));
        assertFalse(getMultiMap(instances, name).containsEntry("key2", "key3_val3"));

        assertTrue(getMultiMap(instances, name).containsValue("key2_val2"));
        assertFalse(getMultiMap(instances, name).containsValue("key2_val4"));
    }

    private MultiMap<Object, Object> getMultiMap(HazelcastInstance[] instances, String name) {
        Random random = new Random();
        return instances[random.nextInt(instances.length)].getMultiMap(name);
    }

    @SuppressWarnings("unused")
    private static class CustomSerializable implements Serializable {

        private long dummy1 = Clock.currentTimeMillis();
        private String dummy2 = String.valueOf(dummy1);
    }
}


text: require "state_select"

redpajama_set_name: RedPajamaGithub


text:
/**
 * 2016-12-20
 * 20th survey activity in the application
 * @author Pineapple
 * @version 1.0
 */

package pineapple.iq_quest;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.SystemClock;
import android.view.KeyEvent;
import android.view.View;
import android.widget.CheckBox;
import android.widget.Chronometer;

import pineapple.for_future.R;

import static pineapple.iq_quest.Survey1Activity.time;

/**
 * The type Survey 20 activity.
 */
public class Survey20Activity extends Activity{
    Chronometer chron;  // Chronometer declaration to measure time.

    @Override
    public void onCreate(Bundle savedInstanceState){
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_survey20);

        chron = (Chronometer) findViewById(R.id.chron);
        chron.setBase(SystemClock.elapsedRealtime());   //Set the chronometer time.
        chron.start();                                  //Start time measurement.
    }

    /**
     * onKeyDown.
     * It processes event of special key such as back button or enter button.
     * In this code, when keyCode is back, do nothing and prevent it from going back before you finish the evey survey activity.
     * @return Do nothing when back button is pressed, other keys work normally.
     * @param keyCode
     * @param event
     */
    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        switch (keyCode) {
            case KeyEvent.KEYCODE_BACK:
                return true;
        }
        return super.onKeyDown(keyCode, event);
    }

    /**
     * Method onClick 버튼 클릭 처리
     * @return 정답처리, 결과 엑티비티로 넘어가기
     */

    public void onClick(View view){
//        Intent intent = new Intent(getApplicationContext(), Survey2Activity.class);
//        startActivity(intent);
        long current = SystemClock.elapsedRealtime() - chron.getBase();
        time += current / 1000;
        chron.stop();

        finish();
        CheckBox answer_20_3 = (CheckBox) findViewById(R.id.answer_20_3);
        //option1.isChecked() 는 리턴값이 불
        // c
        if(answer_20_3.isChecked()){
            LoginActivity.one.setOk(1);
        }
        else{
            LoginActivity.one.setNo(1);
        }
        startActivity(new Intent(Survey20Activity.this,FinishActivity.class));
        overridePendingTransition(R.anim.anim_slide_in_right, R.anim.anim_slide_out_left);

    }
}


text:
package com.silentmatt.dss.bool;

/**
 * Binary boolean operator.
 *
 * @see BinaryBooleanExpression.
 *
 * @author Matthew Crumley
 */
public enum BooleanOperation {
    AND,
    OR,
    XOR
}


text:
@protocol THUserNotificationDelegate <NSObject>

- (BOOL)userNotificationWillActivate:(THUserNotification *)notification;
- (void)userNotification:(THUserNotification *)notification didActivateType:(THUserNotificationActivationType)type;

@end

@interface THUserNotification()<NSAnimationDelegate>
@property (strong) NSWindow *showWindow;
@property (strong) NSImageView *iconView;
@property (strong) NSTextField *titleField;
@property (strong) NSTextField *subtitleField;
@property (strong) NSTextField *informativeField;
@property (strong) NSButton *bgButton;
@property (strong) NSButton *actionButton;
@property (strong) NSButton *otherButton;
@property (assign,getter = isVisible) BOOL visible;
@property (assign,getter = isAnimating) BOOL animating;
@property (strong) NSViewAnimation *viewAnimation;

@property (assign) id<THUserNotificationDelegate> delegate;

- (void)presentedNotification;

@end

@implementation THUserNotification
@synthesize title;
@synthesize subtitle;
@synthesize informativeText;
@synthesize actionButtonTitle;
@synthesize userInfo;
@synthesize deliveryDate;
@synthesize deliveryTimeZone;
@synthesize deliveryRepeatInterval;
@synthesize actualDeliveryDate;
@synthesize presented;
@synthesize remote;
@synthesize soundName;
@synthesize hasActionButton;
@synthesize bgButton;
@synthesize activationType;
@synthesize otherButtonTitle;

@synthesize showWindow;
@synthesize iconView;
@synthesize titleField;
@synthesize subtitleField;
@synthesize informativeField;
@synthesize actionButton;
@synthesize otherButton;
@synthesize visible;
@synthesize animating;
@synthesize viewAnimation;

@synthesize delegate;

+ (id)notification
{
    Class aClass = NSClassFromString(@"NSUserNotification");
    if (aClass == nil)
    {
        aClass = [self class];
    }

    id instance = [[aClass alloc] init];
    return instance;
}

- (id)init
{
    self = [super init];
    if (self)
    {
        hasActionButton = YES;

        //create UI
        showWindow = [[NSWindow alloc] initWithContentRect:NSMakeRect(0, 0, 328, 100)
                                                 styleMask:NSBorderlessWindowMask
                                                   backing:NSBackingStoreBuffered
                                                     defer:NO];
        [showWindow setReleasedWhenClosed:NO];
        [showWindow setMovableByWindowBackground:NO];
        [showWindow setBackgroundColor:[NSColor clearColor]];
        [showWindow setLevel:NSStatusWindowLevel];
        [showWindow setOpaque:NO];
        [showWindow setHasShadow:YES];
        [showWindow setCollectionBehavior:NSWindowCollectionBehaviorCanJoinAllSpaces];

        static NSImage *bgImg = nil;
        static dispatch_once_t onceToken;
        dispatch_once(&onceToken, ^{
            NSString *bgPath = [[NSBundle bundleForClass:self.class] pathForImageResource:@"banner2lines"];
            bgImg = [[NSImage alloc] initWithContentsOfFile:bgPath];
            //bgImg = [NSImage image:bgImg leftCapWidth:30 middleWidth:NSWidth(showWindow.frame)-60 rightCapWidth:30];
            bgImg = [bgImg drawStretchableInRect:[[showWindow contentView] bounds] edgeInsets:NSEdgeInsetsMake(30, 30, 30, 30)];
        });
        NSImageView *bgView = [[NSImageView alloc] initWithFrame:[[showWindow contentView] bounds]];
        [bgView setImageScaling:NSImageScaleAxesIndependently];
        [bgView.cell setImageScaling:NSImageScaleAxesIndependently];
        [bgView setImage:bgImg];
        [[showWindow contentView] addSubview:bgView];

        NSString *iconPath = [[NSBundle mainBundle] bundlePath];
        NSImage *icon = [[NSWorkspace sharedWorkspace] iconForFile:iconPath];
        [icon setSize:NSMakeSize(32, 32)];
        iconView = [[NSImageView alloc] initWithFrame:NSMakeRect(20, 50, 32, 32)];
        [iconView setImageScaling:NSScaleProportionally];
        [iconView setImageAlignment:NSImageAlignCenter];
        [iconView setImage:icon];
        [[showWindow contentView] addSubview:iconView];

        titleField = [[NSTextField alloc] initWithFrame:NSMakeRect(56, 62, 180, 18)];
        [titleField setAlignment:NSLeftTextAlignment];
        [titleField setFont:[NSFont systemFontOfSize:13]];
        float colorDeep = 50;
        [titleField setTextColor:[NSColor colorWithCalibratedRed:colorDeep/255 green:colorDeep/255 blue:colorDeep/255 alpha:1.0]];
        [titleField.cell setTruncatesLastVisibleLine:YES];
        [titleField setSelectable:NO];
        [titleField setEditable:NO];
        [titleField setBordered:NO];
        [titleField setDrawsBackground:NO];

        subtitleField = [[NSTextField alloc] initWithFrame:NSMakeRect(56, 44, 190, 18)];
        [subtitleField setAlignment:NSLeftTextAlignment];
        [subtitleField setFont:[NSFont systemFontOfSize:12]];
        colorDeep = 70;
        [subtitleField setTextColor:[NSColor colorWithCalibratedRed:colorDeep/255 green:colorDeep/255 blue:colorDeep/255 alpha:1.0]];
        [subtitleField.cell setTruncatesLastVisibleLine:YES];
        [subtitleField setSelectable:NO];
        [subtitleField setEditable:NO];
        [subtitleField setBordered:NO];
        [subtitleField setDrawsBackground:NO];

        informativeField = [[NSTextField alloc] initWithFrame:NSMakeRect(56, 26, 190, 18)];
        [informativeField setAlignment:NSLeftTextAlignment];
        [informativeField setFont:[NSFont systemFontOfSize:11]];
        colorDeep = 90;
        [informativeField setTextColor:[NSColor colorWithCalibratedRed:colorDeep/255 green:colorDeep/255 blue:colorDeep/255 alpha:1.0]];
        [informativeField.cell setTruncatesLastVisibleLine:YES];
        [informativeField setSelectable:NO];
        [informativeField setEditable:NO];
        [informativeField setBordered:NO];
        [informativeField setDrawsBackground:NO];

        [[showWindow contentView] addSubview:titleField];
        [[showWindow contentView] addSubview:subtitleField];
        [[showWindow contentView] addSubview:informativeField];

        bgButton = [[NSButton alloc] initWithFrame:[[showWindow contentView] bounds]];
        [bgButton setBezelStyle:NSTexturedRoundedBezelStyle];
        [bgButton setButtonType:NSToggleButton];
        [bgButton setBordered:NO];
        [bgButton setTitle:@""];
        [bgButton setTarget:self];
        [bgButton setAction:@selector(buttonClick:)];
        [[showWindow contentView] addSubview:bgButton];

        actionButton = [[NSButton alloc] initWithFrame:NSMakeRect(254, 30, 52, 22)];
        [actionButton setBezelStyle:NSTexturedRoundedBezelStyle];
        [actionButton setButtonType:NSToggleButton];
        [actionButton setTarget:self];
        [actionButton setAction:@selector(buttonClick:)];

        otherButton = [[NSButton alloc] initWithFrame:NSMakeRect(254, 58, 52, 22)];
        [otherButton setBezelStyle:NSTexturedRoundedBezelStyle];
        [otherButton setButtonType:NSToggleButton];
        [otherButton setTarget:self];
        [otherButton setAction:@selector(buttonClick:)];

        [[showWindow contentView] addSubview:actionButton];
        [[showWindow contentView] addSubview:otherButton];
    }
    return self;
}

- (void)dealloc {
    viewAnimation.delegate = nil;
    self.delegate = nil;
}

- (void)presentedNotification
{
    presented = YES;
    actualDeliveryDate = [NSDate date];
}

- (void)setup:(THUserNotificationCenterType)type
{
    //default value
    titleField.stringValue = @"";
    subtitleField.stringValue = @"";
    informativeField.stringValue = @"";
    [actionButton setTitle:@"Show"];
    [otherButton setTitle:@"Close"];
    [actionButton setHidden:NO];
    [otherButton setHidden:NO];

    titleField.frame = NSMakeRect(56, 62, 180, 18);
    subtitleField.frame = NSMakeRect(56, 44, 190, 18);
    informativeField.frame = NSMakeRect(56, 26, 190, 18);

    //set UI value
    if (self.title) titleField.stringValue = self.title;
    if (self.subtitle) subtitleField.stringValue = self.subtitle;
    if (self.informativeText) informativeField.stringValue = self.informativeText;
    if (self.actionButtonTitle) [actionButton setTitle:self.actionButtonTitle];
    if (self.otherButtonTitle) [otherButton setTitle:self.otherButtonTitle];

    [actionButton setHidden:!hasActionButton];

    if (type == THUserNotificationCenterTypeBanner)
    {
        [actionButton setHidden:YES];
        [otherButton setHidden:YES];

        titleField.frame = NSMakeRect(56, 62, 240, 18);
        subtitleField.frame = NSMakeRect(56, 44, 250, 18);
        informativeField.frame = NSMakeRect(56, 26, 250, 18);
    }
}

- (void)buttonClick:(id)sender
{
    if ([sender isKindOfClass:[NSButton class]])
    {
        [sender setState:NSOffState];
    }

    if (![delegate userNotificationWillActivate:self])
    {
        return;
    }

    THUserNotificationActivationType type = THUserNotificationActivationTypeNone;
    if (sender == actionButton)
    {
        type = THUserNotificationActivationTypeActionButtonClicked;
    }
    else if (sender == bgButton)
    {
        type = THUserNotificationActivationTypeContentsClicked;
    }
    activationType = type;
    [delegate userNotification:self didActivateType:type];
}

#pragma mark -
#pragma mark Animation

- (void)moveInAnimation
{
    if (animating)
    {
        return;
    }
    animating = YES;
    visible = YES;
    NSPoint startPoint = NSMakePoint(McShowPoint(showWindow).x,
                                     NSHeight([NSScreen mainScreen].frame));
    [showWindow setFrameOrigin:startPoint];
    NSPoint endPoint = McShowPoint(showWindow);

    [showWindow orderFront:nil];
    [[showWindow contentView] setWantsLayer:YES];
    [McAnimationUtility setAnchorPoint:CGPointMake(0.5, 0.0) forView:showWindow.contentView];

    NSTimeInterval duration = 0.5;
    CABasicAnimation *rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.x"];
    rotationAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn];
    rotationAnimation.removedOnCompletion = NO;
    rotationAnimation.fillMode = kCAFillModeForwards;
    rotationAnimation.fromValue = [NSNumber numberWithFloat:M_PI/2];
    rotationAnimation.toValue = [NSNumber numberWithFloat:0];
    rotationAnimation.duration = duration;
    rotationAnimation.delegate = self;
    [[[showWindow contentView] layer] addAnimation:rotationAnimation forKey:@"rotation"];

    NSRect startRect = showWindow.frame;
    startRect.origin = startPoint;
    NSRect endRect = showWindow.frame;
    endRect.origin = endPoint;
    NSDictionary *dictionary = [NSDictionary dictionaryWithObjectsAndKeys:
                                showWindow,NSViewAnimationTargetKey,
                                [NSValue valueWithRect:startRect],NSViewAnimationStartFrameKey,
                                [NSValue valueWithRect:endRect],NSViewAnimationEndFrameKey,
                                NSViewAnimationFadeInEffect,NSViewAnimationEffectKey,nil];
    viewAnimation = [[NSViewAnimation alloc] initWithViewAnimations:[NSArray arrayWithObject:dictionary]];
    [viewAnimation setDuration:duration];
    [viewAnimation setAnimationBlockingMode:NSAnimationNonblockingThreaded];
    [viewAnimation setDelegate:self];
    [viewAnimation startAnimation];
}

- (void)moveAnimation:(NSPoint)point
{
    if (animating)
    {
        return;
    }

    animating = YES;
    NSTimeInterval duration = 0.5;
    NSRect startRect = showWindow.frame;
    NSRect endRect = showWindow.frame;
    endRect.origin = point;
    if (NSEqualRects(startRect, endRect))
    {
        animating = NO;
        return;
    }
    NSDictionary *dictionary = [NSDictionary dictionaryWithObjectsAndKeys:
                                showWindow,NSViewAnimationTargetKey,
                                [NSValue valueWithRect:startRect],NSViewAnimationStartFrameKey,
                                [NSValue valueWithRect:endRect],NSViewAnimationEndFrameKey,nil];
    viewAnimation = [[NSViewAnimation alloc] initWithViewAnimations:[NSArray arrayWithObject:dictionary]];
    [viewAnimation setDuration:duration];
    [viewAnimation setAnimationBlockingMode:NSAnimationNonblockingThreaded];
    [viewAnimation setDelegate:self];
    [viewAnimation startAnimation];
}

- (void)moveOutAnimation
{
    if (animating)
    {
        return;
    }
    animating = YES;
    visible = NO;
    NSPoint endPoint = [self.showWindow frame].origin;
    endPoint.x = NSWidth([NSScreen mainScreen].frame)-NSWidth(self.showWindow.frame)/2;

    NSTimeInterval duration = 0.5;
    NSRect startRect = showWindow.frame;
    NSRect endRect = showWindow.frame;
    endRect.origin = endPoint;
    NSDictionary *dictionary = [NSDictionary dictionaryWithObjectsAndKeys:
                                showWindow,NSViewAnimationTargetKey,
                                [NSValue valueWithRect:startRect],NSViewAnimationStartFrameKey,
                                [NSValue valueWithRect:endRect],NSViewAnimationEndFrameKey,
                                NSViewAnimationFadeOutEffect,NSViewAnimationEffectKey,nil];
    viewAnimation = [[NSViewAnimation alloc] initWithViewAnimations:[NSArray arrayWithObject:dictionary]];
    [viewAnimation setDuration:duration];
    [viewAnimation setAnimationBlockingMode:NSAnimationNonblockingThreaded];
    [viewAnimation setDelegate:self];
    [viewAnimation startAnimation];

}

- (void)fadeOutAnimation
{
    if (animating)
    {
        return;
    }
    animating = YES;
    visible = NO;
    NSTimeInterval duration = 0.5;
    NSDictionary *dictionary = [NSDictionary dictionaryWithObjectsAndKeys:
                                showWindow,NSViewAnimationTargetKey,
                                NSViewAnimationFadeOutEffect,NSViewAnimationEffectKey,nil];
    viewAnimation = [[NSViewAnimation alloc] initWithViewAnimations:[NSArray arrayWithObject:dictionary]];
    [viewAnimation setDuration:duration];
    [viewAnimation setAnimationBlockingMode:NSAnimationNonblockingThreaded];
    [viewAnimation setDelegate:self];
    [viewAnimation startAnimation];
}

- (void)animationFinished:(NSAnimation*)animation
{
    [[[showWindow contentView] layer] removeAllAnimations];
    [[showWindow contentView] setWantsLayer:NO];
    animating = NO;

    if (animation)
    {
        NSArray *viewAnimations = [(NSViewAnimation *)animation viewAnimations];
        if ([viewAnimations count] == 0)
        {
            return;
        }
        NSDictionary *info = [viewAnimations objectAtIndex:0];
        if ([info objectForKey:NSViewAnimationEffectKey] == NSViewAnimationFadeOutEffect)
        {
            [showWindow orderOut:nil];
        }
    }
}

- (void)animationDidEnd:(NSAnimation*)animation
{
    [self performSelectorOnMainThread:@selector(animationFinished:) withObject:animation waitUntilDone:NO];
}

- (void)animationDidStop:(NSAnimation*)animation
{
    [self animationDidEnd:animation];
}

- (void)animationDidStop:(CAAnimation *)theAnimation finished:(BOOL)flag
{
    [self animationFinished:nil];
}

@end

@interface THUserNotificationCenter ()<THUserNotificationDelegate>
@property (strong) NSTimer *timer;
@end

@implementation THUserNotificationCenter
@synthesize delegate;
@synthesize deliveredNotifications;
@synthesize scheduledNotifications;
@synthesize timer;
@synthesize centerType;

+ (id)notificationCenter
{
    Class aClass = NSClassFromString(@"NSUserNotificationCenter");
    if (aClass == nil)
    {
        aClass = [self class];
    }

    return [aClass defaultUserNotificationCenter];
}

+ (THUserNotificationCenter *)defaultUserNotificationCenter
{
    static id instance = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        instance = [[[self class] alloc] init];
    });

    return instance;
}

- (id)init
{
    self = [super init];
    if (self)
    {
        centerType = THUserNotificationCenterTypeAlert;
        scheduledNotifications = [[NSMutableArray alloc] init];
        deliveredNotifications = [[NSMutableArray alloc] init];
        timer = [[NSTimer alloc] initWithFireDate:[NSDate date] interval:1.0 target:self selector:@selector(checkMethod:) userInfo:nil repeats:YES];
        [[NSRunLoop currentRunLoop] addTimer:timer forMode:NSDefaultRunLoopMode];
    }
    return self;
}

- (void)sortVisibleNotifications
{
    NSMutableArray *visibleNotifications = [NSMutableArray array];
    for (THUserNotification *aNotification in deliveredNotifications)
    {
        if (aNotification.isVisible)
        {
            [visibleNotifications addObject:aNotification];
        }
    }
    //按实际递交时间排序,最近递交的在前面
    [visibleNotifications sortUsingComparator:^NSComparisonResult(id obj1, id obj2) {
        return 0-[[(THUserNotification *)obj1 actualDeliveryDate] compare:[(THUserNotification *)obj2 actualDeliveryDate]];
    }];

    int maxShowCount = 6;
    for (int i=0;i<[visibleNotifications count];i++)
    {
        THUserNotification *aNotification = [visibleNotifications objectAtIndex:i];
        [aNotification.showWindow setLevel:NSStatusWindowLevel+[visibleNotifications count]-i];
        NSPoint point = McShowPoint(aNotification.showWindow);
        if (i < maxShowCount)
        {
            point.y -= i*(NSHeight(aNotification.showWindow.frame)-10);
        }
        else if ( i < maxShowCount+2)
        {
            point.y -= (maxShowCount-1)*(NSHeight(aNotification.showWindow.frame)-10)+(i-maxShowCount+1)*5;
        }else
        {
            point.y -= (maxShowCount-1)*(NSHeight(aNotification.showWindow.frame)-10)+3*5;
        }
        [aNotification moveAnimation:point];
    }
}

- (void)presentedNotification:(THUserNotification *)notification
{
    if (![deliveredNotifications containsObject:notification])
    {
        [(NSMutableArray *)deliveredNotifications addObject:notification];
    }
    if ([scheduledNotifications containsObject:notification])
    {
        [(NSMutableArray *)scheduledNotifications removeObject:notification];
    }

    if (notification.isVisible)
    {
        [notification setup:centerType];
        [notification presentedNotification];
        [self sortVisibleNotifications];
        return;
    }

    //显现该条消息
    [notification setup:centerType];
    notification.delegate = self;
    [notification presentedNotification];
    [notification moveInAnimation];

    //重新排列已经显示的消息
    [self sortVisibleNotifications];

    if ([delegate respondsToSelector:@selector(userNotificationCenter:didDeliverNotification:)])
    {
        [delegate userNotificationCenter:self didDeliverNotification:notification];
    }
}

- (void)checkMethod:(id)sender
{
    //如果有动画在执行,则跳过
    for (THUserNotification *aNotification in deliveredNotifications)
    {
        if (aNotification.isAnimating)
        {
            return;
        }
    }

    //如果设置通知的样式为空,则跳过
    if (centerType == THUserNotificationActivationTypeNone)
    {
        return;
    }

    //防止在快速循环中对数组进行修改
    NSArray *scheduledNotificationsCopy = [scheduledNotifications copy];
    NSArray *deliveredNotificationsCopy = [deliveredNotifications copy];

    //如果通知样式为横幅,检测是否已经显示超过5秒,如果是则移出
    if (centerType == THUserNotificationCenterTypeBanner)
    {
        for (THUserNotification *aNotification in deliveredNotificationsCopy)
        {
            if (aNotification.isVisible)
            {
                if ([aNotification.actualDeliveryDate timeIntervalSinceNow] <= -5)
                {
                    [aNotification moveOutAnimation];
                }else
                {
                    //如果当前横幅显示在5秒之内,则跳出,让它继续展示
                    return;
                }
            }
        }
    }

    //先检测是否有计划任务触发(相比周期任务优先级高一些)
    for (THUserNotification *aNotification in scheduledNotificationsCopy)
    {
        if ([[aNotification deliveryDate] timeIntervalSinceNow] <= 0)
        {
            [self presentedNotification:aNotification];
            return;
        }
    }

    //然后检测是否有周期性任务触发
    for (THUserNotification *aNotification in deliveredNotificationsCopy)
    {
        if (aNotification.deliveryRepeatInterval)
        {
            NSDateComponents *comps = aNotification.deliveryRepeatInterval;
            NSTimeInterval interval = 0;
            //if ([comps year]!=NSUndefinedDateComponent) interval+=[comps year]*(365*24*60*60);
            //if ([comps month]!=NSUndefinedDateComponent) interval+=[comps month]*(30*24*60*60);
            if ([comps weekday]!=NSUndefinedDateComponent) interval+=[comps weekday]*(7*60*60);
            if ([comps day]!=NSUndefinedDateComponent) interval+=[comps day]*(24*60*60);
            if ([comps hour]!=NSUndefinedDateComponent) interval+=[comps hour]*(60*60);
            if ([comps minute]!=NSUndefinedDateComponent) interval+=[comps minute]*60;
            if ([comps second]!=NSUndefinedDateComponent) interval+=[comps second];

            if (interval < 60)
            {
                continue;
            }

            NSDate *date = [aNotification.actualDeliveryDate dateByAddingTimeInterval:interval];

            if ([date timeIntervalSinceNow] <= 0)
            {
                [self presentedNotification:aNotification];
                return;
            }
        }
    }
}

- (THUserNotificationCenterType)centerType
{
    return centerType;
}

- (void)setCenterType:(THUserNotificationCenterType)type
{
    centerType = type;
    if (centerType == THUserNotificationCenterTypeBanner || centerType == THUserNotificationCenterTypeNone)
    {
        NSArray *deliveredNotificationsCopy = [deliveredNotifications copy];
        for (THUserNotification *aNotification in deliveredNotificationsCopy)
        {
            if (aNotification.isVisible)
            {
                [aNotification moveOutAnimation];
            }
        }
    }
}

- (void)scheduleNotification:(THUserNotification *)notification
{
    if (![scheduledNotifications containsObject:notification])
    {
        [(NSMutableArray *)scheduledNotifications addObject:notification];
    }
}

- (void)removeScheduledNotification:(THUserNotification *)notification
{
    [(NSMutableArray *)scheduledNotifications removeObject:notification];
}

- (void)deliverNotification:(THUserNotification *)notification
{
    if (centerType == THUserNotificationCenterTypeNone)
    {
        if (![deliveredNotifications containsObject:notification])
        {
            [(NSMutableArray *)deliveredNotifications addObject:notification];
        }
        return;
    }

    if (centerType == THUserNotificationCenterTypeBanner)
    {
        NSArray *deliveredNotificationsCopy = [deliveredNotifications copy];
        for (THUserNotification *aNotification in deliveredNotificationsCopy)
        {
            if (aNotification.isVisible)
            {
                [aNotification moveOutAnimation];
            }
        }
    }

    [self presentedNotification:notification];
}

- (void)removeDeliveredNotification:(THUserNotification *)notification
{
    [notification moveOutAnimation];
    [(NSMutableArray *)deliveredNotifications removeObject:notification];
}

- (void)removeAllDeliveredNotifications
{
    [(NSMutableArray *)deliveredNotifications removeAllObjects];
}

#pragma mark -
#pragma mark THUserNotificationDelegate

- (BOOL)userNotificationWillActivate:(THUserNotification *)notification
{
    for (THUserNotification *aNotification in deliveredNotifications)
    {
        if (aNotification.isAnimating)
        {
            return NO;
        }
    }
    return YES;
}

- (void)userNotification:(THUserNotification *)notification didActivateType:(THUserNotificationActivationType)type
{
    if (centerType == THUserNotificationCenterTypeBanner)
    {
        [notification moveOutAnimation];
    }else
    {
        if (type == THUserNotificationActivationTypeNone || type == THUserNotificationActivationTypeActionButtonClicked)
        {
            [notification fadeOutAnimation];
            [self sortVisibleNotifications];
        }
    }
    if (type != THUserNotificationActivationTypeNone &&
        [delegate respondsToSelector:@selector(userNotificationCenter:didActivateNotification:)])
    {
        [delegate userNotificationCenter:self didActivateNotification:notification];
    }
}

@end


text:
<?xml version="1.0" ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<link rel="stylesheet" type="text/css" href="../../../scineplex.css">
<title></title>
<link rel="stylesheet" href="../../../Active.css" type="text/css" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:" />

NAME

DESCRIPTION

AUTHOR

LICENCE AND COPYRIGHT

NAME

DBI::Gofer::Request - Encapsulate a request from DBD::Gofer to DBI::Gofer::Execute

DESCRIPTION

This is an internal class.

AUTHOR

Tim Bunce, http://www.tim.bunce.name

LICENCE AND COPYRIGHT

Copyright (c) 2007, Tim Bunce, Ireland. All rights reserved.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.


text:
import { IterableX } from '../../iterable';
import { publish } from '../../iterable/publish';

export function publishProto<TSource>(
    this: Iterable<TSource>): IterableX<TSource>;
export function publishProto<TSource, TResult>(
    this: Iterable<TSource>,
    selector?: (value: Iterable<TSource>) => Iterable<TResult>): IterableX<TResult>;
/**
 * @ignore
 */
export function publishProto<TSource, TResult>(
    this: Iterable<TSource>,
    selector?: (value: Iterable<TSource>) => Iterable<TResult>): IterableX<TSource | TResult> {
  return publish(this, selector);
}

IterableX.prototype.publish = publishProto;

declare module '../../iterable' {
  interface IterableX<T> {
    publish: typeof publishProto;
  }
}


text:
@interface CXStudyViewController : YZDisplayViewController

@end


text:
import argparse
import copy
import re
import os
from time import gmtime, strftime
import gzip
import numpy as np

def main():
    parser = argparse.ArgumentParser(description='')
    parser.add_argument('--scores_by_chromosome',default='/ifs/scratch/oursu/paper_2017-12-20/results/rao/res50000.final/compiled_scores/GenomeDISCO.scores.multiple_t.by_chromosome.txt.gz')
    parser.add_argument('--out',default='/ifs/scratch/oursu/paper_2017-12-20/results/rao/res50000.final/compiled_scores/GenomeDISCO.scores.multiple_t.genomewide.txt.gz')
    args = parser.parse_args()

    score_dict={}
    for line in gzip.open(args.scores_by_chromosome):
        items=line.strip().split('\t')
        chromo,m1,m2=items[0],items[1],items[2]
        print chromo
        comparison=m1+'\t'+m2
        if comparison not in score_dict:
            score_dict[comparison]={}

        score_cols=range(3,len(items))
        for score_col in score_cols:
            if score_col not in score_dict[comparison]:
                score_dict[comparison][score_col]=[]
            score=float(items[score_col])
            score_dict[comparison][score_col].append(score)

    out=gzip.open(args.out,'w')
    for comparison in score_dict:
        scores=[]
        for score_col_idx in range(len(score_cols)):
            score_col=score_cols[score_col_idx]
            genomewide=np.mean(np.array(score_dict[comparison][score_col]))
            scores.append(str(genomewide))
        out.write('genomewide'+'\t'+comparison+'\t'+'\t'.join(scores)+'\n')
    out.close()
    print args.out

main()


text:
package keysutil

import (
	"errors"
	"fmt"
	"sync"

	"github.com/hashicorp/vault/helper/jsonutil"
	"github.com/hashicorp/vault/logical"
)

const (
	shared    = false
	exclusive = true
)

var (
	errNeedExclusiveLock = errors.New("an exclusive lock is needed for this operation")
)

// PolicyRequest holds values used when requesting a policy. Most values are
// only used during an upsert.
type PolicyRequest struct {
	// The storage to use
	Storage logical.Storage

	// The name of the policy
	Name string

	// The key type
	KeyType KeyType

	// Whether it should be derived
	Derived bool

	// Whether to enable convergent encryption
	Convergent bool

	// Whether to upsert
	Upsert bool
}

type LockManager struct {
	// A lock for each named key
	locks map[string]*sync.RWMutex

	// A mutex for the map itself
	locksMutex sync.RWMutex

	// If caching is enabled, the map of name to in-memory policy cache
	cache map[string]*Policy

	// Used for global locking, and as the cache map mutex
	cacheMutex sync.RWMutex
}

func NewLockManager(cacheDisabled bool) *LockManager {
	lm := &LockManager{
		locks: map[string]*sync.RWMutex{},
	}
	if !cacheDisabled {
		lm.cache = map[string]*Policy{}
	}
	return lm
}

func (lm *LockManager) CacheActive() bool {
	return lm.cache != nil
}

func (lm *LockManager) policyLock(name string, lockType bool) *sync.RWMutex {
	lm.locksMutex.RLock()
	lock := lm.locks[name]
	if lock != nil {
		// We want to give this up before locking the lock, but it's safe --
		// the only time we ever write to a value in this map is the first time
		// we access the value, so it won't be changing out from under us
		lm.locksMutex.RUnlock()
		if lockType == exclusive {
			lock.Lock()
		} else {
			lock.RLock()
		}
		return lock
	}

	lm.locksMutex.RUnlock()
	lm.locksMutex.Lock()

	// Don't defer the unlock call because if we get a valid lock below we want
	// to release the lock mutex right away to avoid the possibility of
	// deadlock by trying to grab the second lock

	// Check to make sure it hasn't been created since
	lock = lm.locks[name]
	if lock != nil {
		lm.locksMutex.Unlock()
		if lockType == exclusive {
			lock.Lock()
		} else {
			lock.RLock()
		}
		return lock
	}

	lock = &sync.RWMutex{}
	lm.locks[name] = lock
	lm.locksMutex.Unlock()
	if lockType == exclusive {
		lock.Lock()
	} else {
		lock.RLock()
	}

	return lock
}

func (lm *LockManager) UnlockPolicy(lock *sync.RWMutex, lockType bool) {
	if lockType == exclusive {
		lock.Unlock()
	} else {
		lock.RUnlock()
	}
}

// Get the policy with a read lock. If we get an error saying an exclusive lock
// is needed (for instance, for an upgrade/migration), give up the read lock,
// call again with an exclusive lock, then swap back out for a read lock.
func (lm *LockManager) GetPolicyShared(storage logical.Storage, name string) (*Policy, *sync.RWMutex, error) {
	p, lock, _, err := lm.getPolicyCommon(PolicyRequest{
		Storage: storage,
		Name:    name,
	}, shared)
	if err == nil ||
		(err != nil && err != errNeedExclusiveLock) {
		return p, lock, err
	}

	// Try again while asking for an exlusive lock
	p, lock, _, err = lm.getPolicyCommon(PolicyRequest{
		Storage: storage,
		Name:    name,
	}, exclusive)
	if err != nil || p == nil || lock == nil {
		return p, lock, err
	}

	lock.Unlock()

	p, lock, _, err = lm.getPolicyCommon(PolicyRequest{
		Storage: storage,
		Name:    name,
	}, shared)
	return p, lock, err
}

// Get the policy with an exclusive lock
func (lm *LockManager) GetPolicyExclusive(storage logical.Storage, name string) (*Policy, *sync.RWMutex, error) {
	p, lock, _, err := lm.getPolicyCommon(PolicyRequest{
		Storage: storage,
		Name:    name,
	}, exclusive)
	return p, lock, err
}

// Get the policy with a read lock; if it returns that an exclusive lock is
// needed, retry. If successful, call one more time to get a read lock and
// return the value.
func (lm *LockManager) GetPolicyUpsert(req PolicyRequest) (*Policy, *sync.RWMutex, bool, error) {
	req.Upsert = true

	p, lock, _, err := lm.getPolicyCommon(req, shared)
	if err == nil ||
		(err != nil && err != errNeedExclusiveLock) {
		return p, lock, false, err
	}

	// Try again while asking for an exlusive lock
	p, lock, upserted, err := lm.getPolicyCommon(req, exclusive)
	if err != nil || p == nil || lock == nil {
		return p, lock, upserted, err
	}
	lock.Unlock()

	req.Upsert = false
	// Now get a shared lock for the return, but preserve the value of upserted
	p, lock, _, err = lm.getPolicyCommon(req, shared)

	return p, lock, upserted, err
}

// When the function returns, a lock will be held on the policy if err == nil.
// It is the caller's responsibility to unlock.
func (lm *LockManager) getPolicyCommon(req PolicyRequest, lockType bool) (*Policy, *sync.RWMutex, bool, error) {
	lock := lm.policyLock(req.Name, lockType)

	var p *Policy
	var err error

	// Check if it's in our cache. If so, return right away.
	if lm.CacheActive() {
		lm.cacheMutex.RLock()
		p = lm.cache[req.Name]
		if p != nil {
			lm.cacheMutex.RUnlock()
			return p, lock, false, nil
		}
		lm.cacheMutex.RUnlock()
	}

	// Load it from storage
	p, err = lm.getStoredPolicy(req.Storage, req.Name)
	if err != nil {
		lm.UnlockPolicy(lock, lockType)
		return nil, nil, false, err
	}

	if p == nil {
		// This is the only place we upsert a new policy, so if upsert is not
		// specified, or the lock type is wrong, unlock before returning
		if !req.Upsert {
			lm.UnlockPolicy(lock, lockType)
			return nil, nil, false, nil
		}

		if lockType != exclusive {
			lm.UnlockPolicy(lock, lockType)
			return nil, nil, false, errNeedExclusiveLock
		}

		switch req.KeyType {
		case KeyType_AES256_GCM96:
			if req.Convergent && !req.Derived {
				return nil, nil, false, fmt.Errorf("convergent encryption requires derivation to be enabled")
			}

		case KeyType_ECDSA_P256:
			if req.Derived || req.Convergent {
				return nil, nil, false, fmt.Errorf("key derivation and convergent encryption not supported for keys of type %s", KeyType_ECDSA_P256)
			}

		default:
			return nil, nil, false, fmt.Errorf("unsupported key type %v", req.KeyType)
		}

		p = &Policy{
			Name:    req.Name,
			Type:    req.KeyType,
			Derived: req.Derived,
		}
		if req.Derived {
			p.KDF = Kdf_hkdf_sha256
			p.ConvergentEncryption = req.Convergent
			p.ConvergentVersion = 2
		}

		err = p.Rotate(req.Storage)
		if err != nil {
			lm.UnlockPolicy(lock, lockType)
			return nil, nil, false, err
		}

		if lm.CacheActive() {
			// Since we didn't have the policy in the cache, if there was no
			// error, write the value in.
			lm.cacheMutex.Lock()
			defer lm.cacheMutex.Unlock()
			// Make sure a policy didn't appear. If so, it will only be set if
			// there was no error, so assume it's good and return that
			exp := lm.cache[req.Name]
			if exp != nil {
				return exp, lock, false, nil
			}
			if err == nil {
				lm.cache[req.Name] = p
			}
		}

		// We don't need to worry about upgrading since it will be a new policy
		return p, lock, true, nil
	}

	if p.NeedsUpgrade() {
		if lockType == shared {
			lm.UnlockPolicy(lock, lockType)
			return nil, nil, false, errNeedExclusiveLock
		}

		err = p.Upgrade(req.Storage)
		if err != nil {
			lm.UnlockPolicy(lock, lockType)
			return nil, nil, false, err
		}
	}

	if lm.CacheActive() {
		// Since we didn't have the policy in the cache, if there was no
		// error, write the value in.
		lm.cacheMutex.Lock()
		defer lm.cacheMutex.Unlock()
		// Make sure a policy didn't appear. If so, it will only be set if
		// there was no error, so assume it's good and return that
		exp := lm.cache[req.Name]
		if exp != nil {
			return exp, lock, false, nil
		}
		if err == nil {
			lm.cache[req.Name] = p
		}
	}

	return p, lock, false, nil
}

func (lm *LockManager) DeletePolicy(storage logical.Storage, name string) error {
	lm.cacheMutex.Lock()
	lock := lm.policyLock(name, exclusive)
	defer lock.Unlock()
	defer lm.cacheMutex.Unlock()

	var p *Policy
	var err error

	if lm.CacheActive() {
		p = lm.cache[name]
	}
	if p == nil {
		p, err = lm.getStoredPolicy(storage, name)
		if err != nil {
			return err
		}
		if p == nil {
			return fmt.Errorf("could not delete policy; not found")
		}
	}

	if !p.DeletionAllowed {
		return fmt.Errorf("deletion is not allowed for this policy")
	}

	err = storage.Delete("policy/" + name)
	if err != nil {
		return fmt.Errorf("error deleting policy %s: %s", name, err)
	}

	err = storage.Delete("archive/" + name)
	if err != nil {
		return fmt.Errorf("error deleting archive %s: %s", name, err)
	}

	if lm.CacheActive() {
		delete(lm.cache, name)
	}

	return nil
}

func (lm *LockManager) getStoredPolicy(storage logical.Storage, name string) (*Policy, error) {
	// Check if the policy already exists
	raw, err := storage.Get("policy/" + name)
	if err != nil {
		return nil, err
	}
	if raw == nil {
		return nil, nil
	}

	// Decode the policy
	policy := &Policy{
		Keys: keyEntryMap{},
	}
	err = jsonutil.DecodeJSON(raw.Value, policy)
	if err != nil {
		return nil, err
	}

	return policy, nil
}


text:
const Promise = require('bluebird');
const bookshelf = require('../../app/config/bookshelf');
const MysqlVideo = require('../models/mysql/video');

exports.mysqlGetVideo = function({ video_id }) {
  return new Promise(function(resolve, reject) {
        MysqlVideo.where({ video_id })
          .fetch({ withRelated: ['user'] })
          .then(video => resolve(video))
          .catch(err => reject(err));
    });
};


text:
<table border="0" cellpadding="0" cellspacing="1" width="980" align="center" bgcolor="<?php echo $colors["border"]; ?>" class="centerd">

<td bgcolor="<?php echo $colors["background"]; ?>" style="background-image: url(<?php echo $master["currentskin"].$images["title"]; ?>); background-repeat: no-repeat">

<?php spacer(833,119,1); ?>
			<?php spacer('100%',119,1); ?>

	<table border="0" cellpadding="2" cellspacing="2" width="100%" bgcolor="<?php echo $colors["cell_title"]; ?>">

        <?php include('include/_top_menu.php'); ?>

	<?php spacer(1,4,1); ?>
	<table border="0" cellpadding="0" cellspacing="2" width="100%" bgcolor="<?php echo $colors["cell_title"]; ?>" class="smm">

		<?php spacer(20,1); ?><?php echo mini_menu(); //include/_functions.php ?>

		<?php echo cp_menu(); //include/_functions.php ?>
		<?php spacer($container["horizontalpadding"],1,1); ?>

			<td width="<?php $modules->get_Width("left"); ?>" valign="top"><?php $modules->display_all_modules("left"); ?>


text:
<!DOCTYPE html>

    <link rel="icon" type="image/png" href="icon.png">
    <link rel="stylesheet" href="js/jquery.mobile-1.4.5.min.css" />
    <link rel="stylesheet" href="js/theme.min.css" />
    <link rel="stylesheet" href="js/jquery.mobile.icons.min.css" />
    <link rel="stylesheet" href="css/splash.css" />

    <title>PARC Pocket Job Coach</title>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1">

    Back

PARC Pocket Job Coach

    Options

My Account

Log Out

Add Task

    <form class="ui-body ui-body-a" id="taskForm">
        Name
        <input type="text" name="taskName" id="taskName" />

        Description
        <textarea cols="40" rows="100" name="task" id="taskDesc"></textarea>

        Category
        <select name="taskCat" id="taskCat">
            <option value="Custodial">Custodial</option>
            <option value="Hosting">Hosting</option>
            <option value="Maintenance">Maintenance</option>
            <option value="Gardening">Gardening</option>
            <option value="Help">Help</option>
        </select>

        Timed
        <input type="checkbox" name="taskTimed" id="taskTimed"/>

        Expected Duration (HH:MM:SS)
        <input type="text" name="taskExpected" id="taskExpected"/>

                    Add Feedback

Save

Cancel

    </form>

???

        Okay

Home


text:
package org.trianacode.shiwaall.dax;

// TODO: Auto-generated Javadoc
/**
 * The Class FileHolder.
 *
 * @author Andrew Harrison
 * @version 1.0.0 Jul 16, 2010
 */

public class FileHolder {

    /** The type. */
    private String type;

    /** The real name. */
    private String realName;

    /**
     * Instantiates a new file holder.
     *
     * @param type the type
     */
    public FileHolder(String type) {
        this.type = type;
    }

    /**
     * Gets the type.
     *
     * @return the type
     */
    public String getType() {
        return type;
    }

    /**
     * Gets the real name.
     *
     * @return the real name
     */
    public String getRealName() {
        return realName;
    }

    /**
     * Sets the real name.
     *
     * @param realName the new real name
     */
    public void setRealName(String realName) {
        this.realName = realName;
    }
}


text:
create table mdt_part_tbl_add (a char, b int, d char)
partition by range (b)
subpartition by list (d)
subpartition template (
 subpartition sp1 values ('a'),
 subpartition sp2 values ('b'))
(
start (1) end (10) every (5)
);

alter table mdt_part_tbl_add set subpartition template ();
alter table mdt_part_tbl_add add partition p3 end (13) (subpartition sp3 values ('c'));

drop table mdt_part_tbl_add;


text:
<!DOCTYPE html>
<html>
<head>
    <title>ReactJs document-viewer</title>
    <meta charset="utf-8" />
	<link href="/package/docviewer.min.cssj" type="text/css" rel="stylesheet" >
	<link href="http://docviewer.qalet.com/package/qalet_giant_plugin_direct.css?plus=all" type="text/css" rel="stylesheet" >
	<script src="http://docviewer.qalet.com/package/qalet_giant_plugin_direct.jsx?plus=all&callback=_CALLBACK_"></script>
	<style>
		.scrollable-menu {
		    height: auto;
		    max-height: 400px;
		    overflow-x: hidden;
		}
	</style>
</head>
<body>
	<qalet>{"module":"giant_react" }</qalet>
	<qalet>{"module":"video"}</qalet>
	<qalet>{"module":"giant_angular", "code":"001"}</qalet>
	<qalet>{"module":"giant_jsmarty"}</qalet>
	<qalet>{"module":"giant_jsmarty","css":"/css/giant_smarty/mservice1.css"}</qalet>
	<qalet>{"module":"docviewer"}</qalet>
</body>
</html>


text:
module Gestpay
  module Result
    class Base

      attr_reader :data

      def initialize(data)
        @data = data
      end

      def success?
        transaction_result == 'OK'
      end

      def error
        "Error #{ error_code }: #{ error_description }" if error_code
      end

      def method_missing(method_name, *args)
        data.has_key?(method_name) ? data[method_name] : super
      end

    end
  end
end


text:
using System.ComponentModel.DataAnnotations;

namespace FormatterWebSite;

// A System.Security.Principal.SecurityIdentifier like type that works on xplat
public class RecursiveIdentifier : IValidatableObject
{
    public RecursiveIdentifier(string identifier)
    {
        Value = identifier;
    }

    [Required]
    public string Value { get; }

    public RecursiveIdentifier AccountIdentifier => new RecursiveIdentifier(Value);

    public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
    {
        return Enumerable.Empty<ValidationResult>();
    }
}


text:
namespace UDIR.PAS2.OAuth.Lib
{
    public class AuthenticatedClientOptions
    {
        public string ClientId { get; set; }

        public string ClientSecret { get; set; }

        public string Scope { get; set; }

        public AuthorizationServer AuthorizationServer { get; set; }
    }
}


text:
using Org.SbeTool.Sbe.Dll;
using Uk.Co.Real_logic.Sbe.Benchmarks.Fix;

namespace Org.SbeTool.Sbe.Benchmarks
{
    public static class MarketDataBenchmark
    {
        public static int Encode(MessageHeader messageHeader,
            MarketDataIncrementalRefreshTrades marketData,
            DirectBuffer buffer,
            int bufferIndex)
        {
            messageHeader.Wrap(buffer, bufferIndex, 0);
            messageHeader.BlockLength = MarketDataIncrementalRefreshTrades.BlockLength;
            messageHeader.TemplateId = MarketDataIncrementalRefreshTrades.TemplateId;
            messageHeader.SchemaId = MarketDataIncrementalRefreshTrades.SchemaId;
            messageHeader.Version = MarketDataIncrementalRefreshTrades.SchemaVersion;

            marketData.WrapForEncode(buffer, bufferIndex + MessageHeader.Size);
            marketData.TransactTime = 1234L;
            marketData.EventTimeDelta = 987;
            marketData.MatchEventIndicator = MatchEventIndicator.END_EVENT;

            var mdIncGrp = marketData.MdIncGrpCount(2);

            mdIncGrp.Next();
            mdIncGrp.TradeId = 1234L;
            mdIncGrp.SecurityId = 56789L;
            mdIncGrp.MdEntryPx.Mantissa = 50;
            mdIncGrp.MdEntrySize.Mantissa = 10;
            mdIncGrp.NumberOfOrders = 1;
            mdIncGrp.MdUpdateAction = MDUpdateAction.NEW;
            mdIncGrp.RptSeq = 1;
            mdIncGrp.AggressorSide = Side.BUY;
            mdIncGrp.MdEntryType = MDEntryType.BID;

            mdIncGrp.Next();
            mdIncGrp.TradeId = 1234L;
            mdIncGrp.SecurityId = 56789L;
            mdIncGrp.MdEntryPx.Mantissa = 50;
            mdIncGrp.MdEntrySize.Mantissa = 10;
            mdIncGrp.NumberOfOrders = 1;
            mdIncGrp.MdUpdateAction = MDUpdateAction.NEW;
            mdIncGrp.RptSeq = 1;
            mdIncGrp.AggressorSide = Side.SELL;
            mdIncGrp.MdEntryType = MDEntryType.OFFER;

            return marketData.Size;
        }

        public static int Decode(MessageHeader messageHeader,
            MarketDataIncrementalRefreshTrades marketData,
            DirectBuffer buffer,
            int bufferIndex)
        {
            messageHeader.Wrap(buffer, bufferIndex, 0);

            int actingVersion = messageHeader.Version;
            int actingBlockLength = messageHeader.BlockLength;

            marketData.WrapForDecode(buffer, bufferIndex + MessageHeader.Size, actingBlockLength, actingVersion);

            var transactTime = marketData.TransactTime;
            var matchEventIndicator = marketData.MatchEventIndicator;

            var mdIncGrpGroup = marketData.MdIncGrp;
            while (mdIncGrpGroup.HasNext)
            {
                mdIncGrpGroup.Next();
                var tradeId = mdIncGrpGroup.TradeId;
                var securityId = mdIncGrpGroup.SecurityId;
                var mantissa = mdIncGrpGroup.MdEntryPx.Mantissa;
                var i = mdIncGrpGroup.MdEntrySize.Mantissa;
                var numberOfOrders = mdIncGrpGroup.NumberOfOrders;
                var mdUpdateAction = mdIncGrpGroup.MdUpdateAction;
                var rptSeq = mdIncGrpGroup.RptSeq;
                var aggressorSide = mdIncGrpGroup.AggressorSide;
                var mdEntryType = mdIncGrpGroup.MdEntryType;
            }

            return marketData.Size;
        }
    }
}


text:
declare module dnJsonRpc {
    class Error {
        public name: string;
        public message: string;
        public stack: string;
        constructor(message?: string);
    }
    var $$internalIdCounter: number;
    enum RESPONSE_ERRORS {
        PARSE_ERROR = -33700,
        INVALID_RESPONSE = -33600,
    }
    class JsonRpcError extends Error {
        public code: number;
        public message: string;
        public data: any;
        constructor(code: number, message: string, data?: any);
        public toString(): string;
    }
    class JsonRpcRequestError extends JsonRpcError {
        constructor(code: number, message: string, data?: any);
    }
    class JsonRpcResponseError extends JsonRpcError {
        constructor(code: number, message: string, data?: any);
    }
    class JsonRpcHttpError extends JsonRpcError {
        static ERRORS: {
            404: string;
        };
        constructor(code: number, data?: any);
    }
    class DnJsonRpcService {
        private $http;
        private $q;
        static '$inject': string[];
        private jsonBuilder;
        constructor($http: ng.IHttpService, $q: ng.IQService);
        public request(path: string, method: string, params?: any[], config?: ng.IRequestShortcutConfig): any;
        public request(path: string, method: string, params?: {
            [argName: string]: any;
        }, config?: ng.IRequestShortcutConfig): any;
        public notify(path: string, method: string, params?: any[], config?: ng.IRequestShortcutConfig): any;
        public notify(path: string, method: string, params?: {
            [argName: string]: any;
        }, config?: ng.IRequestShortcutConfig): any;
        public batch(path: string, config?: ng.IRequestShortcutConfig): {
            request: (method: string, params?: any) => any;
            notify: (method: string, params?: any) => any;
            exec: () => any;
        };
    }
}


text:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package z7a5;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

/**
 *
 * @author frasiek
 */
public class Z7a5 {

     /* dane dostepowe do bazy danych */
    private final static String host = "localhost";
    private final static Integer port = 3306;
    private final static String user = "root";
    private final static String pass = "root";
    private final static String dbname = "java";

    /* aby nie zaciemniac kodu - wyjatki sa wyrzucane poza program */
    public static void main(String[] args) throws SQLException, ClassNotFoundException {
        String url = "jdbc:mysql://" + host + ":" + port + "/" + dbname;
        Connection connection = null;

        try {
            connection = DriverManager.getConnection(url, user, pass);
            Statement statement = connection.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
            ResultSet resultSet = statement.executeQuery("select * from jps_employees where emp_no < 10004");
            while(resultSet.next()){
                String gender = resultSet.getString("gender");
                if(gender.toUpperCase().equals("M")){
                    gender = "F";
                } else {
                    gender = "M";
                }
                resultSet.updateString("gender", gender);
                resultSet.updateRow();
            }
            resultSet.close();
            if (connection.isValid(2)) {
                System.out.println("Połączenie zakończone sukcesem");
            }
        } finally {
            if (connection != null) {
                connection.close();
            }
        }
    }

}


text:
class AddUnsubscribedAtToHiThereSubscriptions < ActiveRecord::Migration
  def change
    add_column :hi_there_subscriptions, :unsubscribed_at, :datetime
    add_index :hi_there_subscriptions, :unsubscribed_at
  end
end


text:
[See proxyAuthenticator code](proxyAuthenticator.js)

```javascript
   var proxyAuthenticator = require('jsntlm/examples/proxyAuthenticator');
   var options = {
      host: "proxyserver",
      port: 8080,
      path: "http://www.google.com/",
      headers: {
         Host: "www.google.com"
      }
   };
   var callback = function(response) {
      console.log("RESPONSE STATUS: "+response.statusCode);
      console.log("RESPONSE BODY: "+response.body);
   };
   proxyAuthenticator.httpRequest("DOMAIN", "MyUser", "MyPassword", options, callback);
```


text: © {{ site.time | date: '%Y' }} {{ site.owner.name }}. Powered by Jekyll ,based on the leonids theme


text:
require 'socket'
require 'timeout'

module VagrantSshHelper
  def vagrant_ssh(str)
    old_term = ENV['TERM']

    sleep 1
    ENV['TERM'] = 'xterm'
    ret = VagrantWrapper.new.get_output(['ssh', '-c', "\"#{str}\""]).gsub("\r\n", "\n")

    ENV['TERM'] = old_term
    ret
  end

  def vagrant_check_port_open(port)
    expect(is_vagrant_port_open?(port)).to be_truthy
  end

  def vagrant_check_port_closed(port)
    expect(is_vagrant_port_open?(port)).to be_falsey
  end

  private

  def is_vagrant_port_open?(port)
    vagrant_ssh("sudo iptables -nL") =~ /ACCEPT .*tcp dpt:#{port}\s*$/
  end
end


text:
Package.describe({
  name: 'forwarder:autoform-wizard-iron-router',
  summary: 'Iron Router bindings for AutoForm Wizard.',
  version: '0.1.4',
  git: 'https://github.com/forwarder/meteor-wizard-iron-router.git'
});

Package.onUse(function(api) {
  api.versionsFrom('1.0');

  api.use([
    'forwarder:autoform-wizard@0.9.0',
    'iron:router@1.0.0'
  ], 'client');

  api.addFiles([
    'client.js'
  ], 'client');
});


text:
<?php
/**
 * Class Jetpack_Tracks_Event. Legacy.
 *
 * @package automattic/jetpack-sync
 */

/*
 * @autounit nosara tracks-client
 *
 * Example Usage:
```php
	require_once( dirname(__FILE__) . 'path/to/tracks/class-jetpack-tracks-event.php' );

	$event = new Jetpack_Tracks_Event( array(
		'_en'        => $event_name,       // required
		'_ui'        => $user_id,          // required unless _ul is provided
		'_ul'        => $user_login,       // required unless _ui is provided

		// Optional, but recommended
		'_via_ip'    => $client_ip,        // for geo, etc.

		// Possibly useful to set some context for the event
		'_via_ua'    => $client_user_agent,
		'_via_url'   => $client_url,
		'_via_ref'   => $client_referrer,

		// For user-targeted tests
		'abtest_name'        => $abtest_name,
		'abtest_variation'   => $abtest_variation,

		// Your application-specific properties
		'custom_property'    => $some_value,
	) );

	if ( is_wp_error( $event->error ) ) {
		// Handle the error in your app
	}

	$bump_and_redirect_pixel = $event->build_signed_pixel_url();
```
 */

/**
 * Class Jetpack_Tracks_Event
 */
class Jetpack_Tracks_Event {
	const EVENT_NAME_REGEX = '/^(([a-z0-9]+)_){2}([a-z0-9_]+)$/';
	const PROP_NAME_REGEX  = '/^[a-z_][a-z0-9_]*$/';

	/**
	 * Tracks Event Error.
	 *
	 * @var mixed Error.
	 */
	public $error;

	/**
	 * Jetpack_Tracks_Event constructor.
	 *
	 * @param object $event Tracks event.
	 */
	public function __construct( $event ) {
		$_event = self::validate_and_sanitize( $event );
		if ( is_wp_error( $_event ) ) {
			$this->error = $_event;
			return;
		}

		foreach ( $_event as $key => $value ) {
			$this->{$key} = $value;
		}
	}

	/**
	 * Record a track event.
	 */
	public function record() {
		return Jetpack_Tracks_Client::record_event( $this );
	}

	/**
	 * Annotate the event with all relevant info.
	 *
	 * @param  mixed $event Object or (flat) array.
	 * @return mixed        The transformed event array or WP_Error on failure.
	 */
	public static function validate_and_sanitize( $event ) {
		$event = (object) $event;

		// Required.
		if ( ! $event->_en ) {
			return new WP_Error( 'invalid_event', 'A valid event must be specified via `_en`', 400 );
		}

		// delete non-routable addresses otherwise geoip will discard the record entirely.
		if ( property_exists( $event, '_via_ip' ) && preg_match( '/^192\.168|^10\./', $event->_via_ip ) ) {
			unset( $event->_via_ip );
		}

		$validated = array(
			'browser_type' => Jetpack_Tracks_Client::BROWSER_TYPE,
			'_aua'         => Jetpack_Tracks_Client::get_user_agent(),
		);

		$_event = (object) array_merge( (array) $event, $validated );

		// If you want to block property names, do it here.

		// Make sure we have an event timestamp.
		if ( ! isset( $_event->_ts ) ) {
			$_event->_ts = Jetpack_Tracks_Client::build_timestamp();
		}

		return $_event;
	}

	/**
	 * Build a pixel URL that will send a Tracks event when fired.
	 * On error, returns an empty string ('').
	 *
	 * @return string A pixel URL or empty string ('') if there were invalid args.
	 */
	public function build_pixel_url() {
		if ( $this->error ) {
			return '';
		}

		$args = get_object_vars( $this );

		// Request Timestamp and URL Terminator must be added just before the HTTP request or not at all.
		unset( $args['_rt'] );
		unset( $args['_'] );

		$validated = self::validate_and_sanitize( $args );

		if ( is_wp_error( $validated ) ) {
			return '';
		}

		return Jetpack_Tracks_Client::PIXEL . '?' . http_build_query( $validated );
	}

	/**
	 * Validate the event name.
	 *
	 * @param string $name Event name.
	 * @return false|int
	 */
	public static function event_name_is_valid( $name ) {
		return preg_match( self::EVENT_NAME_REGEX, $name );
	}

	/**
	 * Validates prop name
	 *
	 * @param string $name Property name.
	 *
	 * @return false|int Truthy value.
	 */
	public static function prop_name_is_valid( $name ) {
		return preg_match( self::PROP_NAME_REGEX, $name );
	}

	/**
	 * Scrutinize event name.
	 *
	 * @param object $event Tracks event.
	 */
	public static function scrutinize_event_names( $event ) {
		if ( ! self::event_name_is_valid( $event->_en ) ) {
			return;
		}

		$whitelisted_key_names = array(
			'anonId',
			'Browser_Type',
		);

		foreach ( array_keys( (array) $event ) as $key ) {
			if ( in_array( $key, $whitelisted_key_names, true ) ) {
				continue;
			}
			if ( ! self::prop_name_is_valid( $key ) ) {
				return;
			}
		}
	}
}


text:
namespace SpeedHero.Web.Areas.Administration.ViewModels.Comments
{
    using System.ComponentModel.DataAnnotations;

    using SpeedHero.Data.Models;
    using SpeedHero.Web.Areas.Administration.ViewModels.Base;
    using SpeedHero.Web.Infrastructure.Mapping;

    public class ShowCommentsViewModel : AdministrationViewModel, IMapFrom<Comment>
    {
        public int Id { get; set; }

        public string Content { get; set; }

        [Display(Name = "Author")]
        public string AuthorUserName { get; set; }
    }
}


text:
package jp.co.flect.salesforce;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import javax.xml.stream.XMLStreamReader;
import javax.xml.stream.XMLStreamException;

import jp.co.flect.xml.StAXConstructException;
import jp.co.flect.xmlschema.ComplexType;
import jp.co.flect.xmlschema.SimpleType;
import jp.co.flect.xmlschema.TypeDef;

public class FieldDef extends AbstractDef {

	private static final long serialVersionUID = 4822415064903856131L;

	private transient SimpleType soapType;

	public FieldDef(Metadata meta) {
		super(meta);
	}

	protected ComplexType getTypeFromMetadata() {
		return (ComplexType)getMetadata().getMessageType("Field");
	}

	public String getName() { return getString("name");}
	public String getLabel() { return getString("label");}

	public String getRelationshipName() { return getString("relationshipName");}
	public List<String> getReferenceTo() {
		Object o = get("referenceTo");
		if (o == null) {
			return Collections.<String>emptyList();
		}
		List<String> list = new ArrayList<String>();
		if (o instanceof String) {
			list.add(o.toString());
		} else if (o instanceof List) {
			for (Object value : (List)o) {
				list.add(value.toString());
			}
		} else {
			throw new IllegalStateException();
		}
		return list;
	}

	public String getReferenceToName() {
		Object o = get("referenceTo");
		if (o == null) {
			return null;
		}
		if (o instanceof String) {
			return o.toString();
		} else if (o instanceof List) {
			return "Name";
		} else {
			throw new IllegalStateException();
		}
	}

	public boolean isExternalId() { return getBoolean("externalId");}

	public boolean isCreateable() { return getBoolean("createable");}
	public boolean isUpdateable() { return getBoolean("updateable");}

	public boolean isNillable() { return getBoolean("nillable");}
	public boolean isRequired() { return !isNillable();}

	public String getFieldType() { return getString("type");}

	public SimpleType getSoapType() {
		if (this.soapType != null) {
			return this.soapType;
		}
		String strType = getString("soapType");
		if (strType == null) {
			return null;
		}
		strType = strType.substring(strType.indexOf(':') + 1);
		TypeDef type = getMetadata().getMessageType(strType);
		if (type != null) {
			this.soapType = (SimpleType)type;
		} else {
			this.soapType = SimpleType.getBuiltinType(strType);
		}
		return this.soapType;
	}

	@Override
	public FieldDef newInstance() {
		return (FieldDef)super.newInstance();
	}

	public SalesforceException validate(Object value) {
		//ToDo データ型チェック
		return null;
	}

	@Override
	protected boolean startElement(XMLStreamReader reader) throws XMLStreamException, StAXConstructException {
		String name = reader.getLocalName();
		if (name.equals("picklistValues")) {
			List<PicklistEntry> list = (List<PicklistEntry>)get("picklistValues");
			if (list == null) {
				list = new ArrayList<PicklistEntry>();
				set("picklistValues", list);
			}
			PicklistEntry pl = new PicklistEntry(getMetadata());
			pl.build(reader);
			list.add(pl);
			return true;
		} else {
			return super.startElement(reader);
		}
	}
}


text:
classdef revisionTest < TestCase
    methods
        function this = revisionTest(name)
            this = this@TestCase(name);
        end

        function testRevision(~)
            [rev, differences] = edu.stanford.covert.util.revision();

            assertTrue(isa(rev, 'double'));
            assertIn(rev, [1 inf]);
            assertEqual(fix(rev), rev);

            assertTrue(isa(differences, 'char'));
        end
    end
end


text:
"use strict";

// module Leaflet.Polyline

exports.polylineToILayer = function (l) {
    return l;
}

exports.addPolylineToMap = function (p) {
    return function(m) {
        return function() {
            return p.addTo(m);
        }
    }
}

exports.polyline = function (latlngs) {
    return function(options) {
        return L.polyline(latlngs, options);
    }
}

exports.addLatLng = function (l) {
    return function(p) {
        return function() {
            return p.addLatLng(l);
        }
    }
}

exports.setLatLngs = function (l) {
    return function(p) {
        return function() {
            return p.setLatLngs(l);
        }
    }
}


text:
"""Record of phased-in incompatible language changes.

Each line is of the form:

    FeatureName = "_Feature(" OptionalRelease "," MandatoryRelease ")"

where, normally, OptionalRelease < MandatoryRelease, and both are 5-tuples
of the same form as sys.version_info:

    (PY_MAJOR_VERSION, # the 2 in 2.1.0a3; an int
     PY_MINOR_VERSION, # the 1; an int
     PY_MICRO_VERSION, # the 0; an int
     PY_RELEASE_LEVEL, # "alpha", "beta", "candidate" or "final"; string
     PY_RELEASE_SERIAL # the 3; an int
    )

OptionalRelease records the first release in which

    from __future__ import FeatureName

was accepted.

In the case of MandatoryReleases that have not yet occurred,
MandatoryRelease predicts the release in which the feature will become part
of the language.

Else MandatoryRelease records when the feature became part of the language;
in releases at or after that, modules no longer need

    from __future__ import FeatureName

to use the feature in question, but may continue to use such imports.

MandatoryRelease may also be None, meaning that a planned feature got
dropped.

Instances of class _Feature have two corresponding methods,
.getOptionalRelease() and .getMandatoryRelease().

No feature line is ever to be deleted from this file.
"""

class _Feature:
    def __init__(self, optionalRelease, mandatoryRelease):
        self.optional = optionalRelease
        self.mandatory = mandatoryRelease

    def getOptionalRelease(self):
        """Return first release in which this feature was recognized.

        This is a 5-tuple, of the same form as sys.version_info.
        """

        return self.optional

    def getMandatoryRelease(self):
        """Return release in which this feature will become mandatory.

        This is a 5-tuple, of the same form as sys.version_info, or, if
        the feature was dropped, is None.
        """

        return self.mandatory

    def __repr__(self):
        return "Feature(" + `self.getOptionalRelease()` + ", " + \
                            `self.getMandatoryRelease()` + ")"

nested_scopes = _Feature((2, 1, 0, "beta", 1), (2, 2, 0, "final", 0))


text:
<?xml version="1.0" encoding="utf-8"?>
<com.nd.commplatform.widget.NdWrappingSlidingDrawer xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:id="@+id/nd_slidingdrawer"
    android:handle="@+id/nd_handle"
    android:content="@+id/nd_content"
    android:orientation="vertical">

    <ImageView
    android:id="@id/nd_handle"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:background="@drawable/nd_slider_handle_h_expand" />

    <RelativeLayout
    android:id="@id/nd_content"
    android:layout_width="fill_parent"
	android:layout_height="wrap_content"
	android:background="@drawable/nd_slider_content_h">
        <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_margin="10dip"
        android:layout_centerVertical="true"
        android:layout_alignParentLeft="true"
        android:src="@drawable/nd_slider_pre_h"
        android:id="@+id/nd_pre"/>

	    <HorizontalScrollView
	    android:layout_width="0dip"
	    android:layout_height="wrap_content"
	    android:layout_centerVertical="true"
	    android:layout_toRightOf="@id/nd_pre"
	    android:layout_toLeftOf="@+id/nd_next"
	    android:scrollbars="horizontal">
	        <LinearLayout
	        android:layout_width="wrap_content"
	        android:layout_height="wrap_content"
	        android:orientation="horizontal"
	        android:id="@+id/nd_apps"/>
	    </HorizontalScrollView>

	    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_margin="10dip"
        android:layout_centerVertical="true"
        android:layout_alignParentRight="true"
        android:src="@drawable/nd_slider_next_h"
        android:id="@id/nd_next"/>
    </RelativeLayout>

</com.nd.commplatform.widget.NdWrappingSlidingDrawer>