Java Examples for java.util.Set

The following java examples will help you to understand the usage of java.util.Set. These source code samples are taken from different open source projects.

Example 1
Project: mapdb-master  File: HTreeSet_Harmony_Test.java View source code
/**
	 * @tests java.util.Set#add(java.lang.Object)
	 */
public void test_addLjava_lang_Object() {
    // Test for method boolean java.util.Set.add(java.lang.Object)
    int size = hs.size();
    hs.add(new Integer(8));
    assertTrue("Added element already contained by set", hs.size() == size);
    hs.add(new Integer(-9));
    assertTrue("Failed to increment set size after add", hs.size() == size + 1);
    assertTrue("Failed to add element to set", hs.contains(new Integer(-9)));
}
Example 2
Project: Breakbulk-master  File: URISetArraySerializer.java View source code
/**
     * Deserialize from a String to type T
     * 
     * @param serialized
     *            String representation of object type T
     * @param format
     *            Format of the String
     * @return T deserialized object
     * @throws AnzoException
     *             if there was a problem deserializing the object
     */
@SuppressWarnings("unchecked")
public static java.util.Set<org.openanzo.rdf.URI>[] deserialize(String serialized, String format) throws AnzoException {
    if (serialized == null || serialized.length() == 0)
        return new java.util.Set[] { Collections.<org.openanzo.rdf.URI>emptySet(), Collections.<org.openanzo.rdf.URI>emptySet() };
    ArrayList<java.util.Set<org.openanzo.rdf.URI>> sets = new ArrayList<java.util.Set<org.openanzo.rdf.URI>>();
    BufferedReader br = new BufferedReader(new StringReader(serialized));
    try {
        String line = br.readLine();
        while (line != null) {
            sets.add(org.openanzo.rdf.utils.SerializationUtils.convertStringToSet(serialized, format));
            line = br.readLine();
        }
    } catch (IOException ioe) {
    }
    return sets.toArray(new java.util.Set[0]);
}
Example 3
Project: webtools.javaee-master  File: FileExtensionsFilterImpl.java View source code
/**
	 * @see com.ibm.etools.archive.SaveFilter
	 */
@Override
public boolean shouldSave(String uri, Archive anArchive) {
    String extension = org.eclipse.jst.j2ee.commonarchivecore.internal.util.ArchiveUtil.getFileNameExtension(uri);
    if (//$NON-NLS-1$
    extension.equals(""))
        return true;
    Set excluded;
    if (isCaseSensitive()) {
        excluded = getExcludedExtensions();
    } else {
        excluded = getExcludedExtensionsAsUppercase();
        extension = extension.toUpperCase();
    }
    return !excluded.contains(extension);
}
Example 4
Project: vebugger-master  File: SetTemplate.java View source code
@Override
public void render(StringBuilder sb, Object obj) {
    Set<?> set = (Set<?>) obj;
    int size = set.size();
    int cloudSpan = (int) Math.ceil(Math.sqrt(size));
    Iterator<?> iterator = set.iterator();
    sb.append("<style>");
    sb.append("table.java-util-Set > tbody > tr > td > div {border: 1px dotted silver; -webkit-border-radius: 10px; -moz-border-radius: 10px; border-radius: 10px; padding: 10px}");
    sb.append("</style>");
    sb.append("<table class=\"java-util-Set\"><tbody>");
    for (int i = 0; i < cloudSpan; i++) {
        sb.append("<tr>");
        for (int j = 0; j < cloudSpan; j++) {
            if (iterator.hasNext()) {
                sb.append("<td><div>").append(VisualDebuggerAid.toString(iterator.next())).append("</div></td>");
            } else {
                sb.append("<td></td>");
            }
        }
        sb.append("</tr>");
    }
    sb.append("</tbody></table>");
}
Example 5
Project: AlgoDS-master  File: Bayan1563.java View source code
public static void main(String[] args) {
    Scanner in = new Scanner(System.in);
    int n = Integer.parseInt(in.nextLine());
    Set<String> set = new HashSet<>();
    int count = 0;
    for (int i = 0; i < n; i++) {
        String s = in.nextLine();
        if (set.contains(s))
            count++;
        else
            set.add(s);
    }
    System.out.println(count);
}
Example 6
Project: GDCN-master  File: DeceitfulFileUtils.java View source code
public static String deduceTask(TaskMeta meta) {
    final Set<Number160> files = new TreeSet<>();
    files.add(meta.getModule().getDhtKey());
    for (FileDep file : meta.getDependencies()) {
        files.add(file.getDhtKey());
    }
    String answer = "";
    for (Number160 s : files) {
        answer += s.toString();
    }
    return answer;
}
Example 7
Project: intellij-community-master  File: SetUtil.java View source code
/**
   * Intersects two sets
   */
public static <T> Set<T> intersect(final Set<T> set1, final Set<T> set2) {
    if (set1.equals(set2)) {
        return set1;
    }
    final HashSet<T> result = new HashSet<>();
    Set<T> minSet;
    Set<T> otherSet;
    if (set1.size() < set2.size()) {
        minSet = set1;
        otherSet = set2;
    } else {
        minSet = set2;
        otherSet = set1;
    }
    for (T s : minSet) {
        if (otherSet.contains(s)) {
            result.add(s);
        }
    }
    return result;
}
Example 8
Project: license-check-master  File: OpenSourceLicenseCheckMojoTest.java View source code
@Test
public void testGetAsLowerCaseSet() {
    String src[] = { "Test1", "Test2", "Test3" };
    Set<String> expected = new HashSet<String>();
    expected.add("test1");
    expected.add("test2");
    expected.add("test3");
    Set<String> result = new OpenSourceLicenseCheckMojo().getAsLowerCaseSet(src);
    assertTrue(result.containsAll(expected));
}
Example 9
Project: limewire5-ruby-master  File: MessagesSupportedVendorMessageStubHelper.java View source code
public static MessagesSupportedVendorMessage makeMSVMWithoutOOBProxyControl() throws Exception {
    Set<SupportedMessageBlock> supportedMessageBlocks = new HashSet<SupportedMessageBlock>();
    MessagesSupportedVendorMessage.addSupportedMessages(supportedMessageBlocks);
    supportedMessageBlocks.remove(new MessagesSupportedVendorMessage.SupportedMessageBlock(VendorMessage.F_LIME_VENDOR_ID, VendorMessage.F_OOB_PROXYING_CONTROL, OOBProxyControlVendorMessage.VERSION));
    return new MessagesSupportedVendorMessage(supportedMessageBlocks);
}
Example 10
Project: molgenis-master  File: FileExtensionUtils.java View source code
public static String findExtensionFromPossibilities(String fileName, Set<String> fileExtensions) {
    String name = fileName.toLowerCase();
    List<String> possibleExtensions = new ArrayList<String>();
    for (String extention : fileExtensions) {
        if (name.endsWith('.' + extention)) {
            possibleExtensions.add(extention);
        }
    }
    String longestExtension = null;
    for (String possibleExtension : possibleExtensions) {
        if (null == longestExtension) {
            longestExtension = possibleExtension;
            continue;
        } else {
            if (longestExtension.length() < possibleExtension.length())
                longestExtension = possibleExtension;
        }
    }
    return longestExtension;
}
Example 11
Project: multiregexp-master  File: DkBricsAutomatonHelper.java View source code
public static char[] pointsUnion(final Iterable<Automaton> automata) {
    Set<Character> points = new TreeSet<>();
    for (Automaton automaton : automata) {
        for (char c : automaton.getStartPoints()) {
            points.add(c);
        }
    }
    char[] pointsArr = new char[points.size()];
    int i = 0;
    for (Character c : points) {
        pointsArr[i] = c;
        i++;
    }
    return pointsArr;
}
Example 12
Project: NucleusFramework-master  File: SyncSetTest.java View source code
@Test
public void basicTest() {
    SetWrapper<String> set = new SetWrapper<String>() {

        Set<String> hashSet = new HashSet<>(10);

        @Override
        protected Set<String> set() {
            return hashSet;
        }
    };
    SetRunnable<String> test = new SetRunnable<>(set, "a", "b", "c");
    test.run();
}
Example 13
Project: pigeon-master  File: Protocol.java View source code
public static void main(String[] args) {
    HostInfo hostInfo1 = new HostInfo("11", 11, 0);
    HostInfo hostInfo2 = new HostInfo("11", 11, 1);
    Set<HostInfo> hostInfos = Sets.newHashSet();
    hostInfos.add(hostInfo1);
    hostInfos.remove(hostInfo2);
    hostInfos.add(hostInfo2);
    for (HostInfo hostInfo : hostInfos) {
        System.out.println(hostInfo);
    }
}
Example 14
Project: webmagic-master  File: ClassUtils.java View source code
public static Set<Field> getFieldsIncludeSuperClass(Class clazz) {
    Set<Field> fields = new LinkedHashSet<Field>();
    Class current = clazz;
    while (current != null) {
        Field[] currentFields = current.getDeclaredFields();
        for (Field currentField : currentFields) {
            fields.add(currentField);
        }
        current = current.getSuperclass();
    }
    return fields;
}
Example 15
Project: turmeric-eclipse-master  File: TestCollectionUtil.java View source code
/**
	 * Test method for {@link org.ebayopensource.turmeric.eclipse.utils.collections.CollectionUtil#intersection(java.util.Set, java.util.Set)}.
	 */
@Test
public void testIntersection() {
    Set<String> collection = new HashSet<String>();
    collection.add("3dfx");
    collection.add("Nvidia");
    collection.add("ATI");
    Set<String> collection2 = new HashSet<String>();
    collection2.add("3dfx");
    collection2.add("ATI");
    collection2.add("Trident");
    Set<String> expected = new HashSet<String>();
    expected.add("3dfx");
    expected.add("ATI");
    Set<String> data = CollectionUtil.intersection(collection, collection2);
    TestSetUtil.assertSetEquals(expected, data);
}
Example 16
Project: SPQR-master  File: MicroPipelineValidatorTest.java View source code
/**
	 * Test case for {@link MicroPipelineValidator#validateQueue(StreamingMessageQueueConfiguration, Set)} being provided a 
	 * configuration with non-unique id
	 */
@Test
public void testValidateQueue_withDuplicateQueueId() {
    Set<String> queueIdentifiers = new HashSet<String>();
    queueIdentifiers.add("test-id");
    Assert.assertEquals("Missing queue configuration", MicroPipelineValidationResult.NON_UNIQUE_QUEUE_ID, new MicroPipelineValidator().validateQueue(new StreamingMessageQueueConfiguration("test-id"), queueIdentifiers));
}
Example 17
Project: Suraq-master  File: PropositionalEq.java View source code
@Override
public Formula replaceEquivalences(Formula topLeveFormula, Map<EqualityFormula, String> replacements, Set<Token> noDependenceVars) {
    ArrayList<Term> terms2 = new ArrayList<Term>();
    for (int i = 0; i < terms.size(); i++) {
        PropositionalTerm term = (PropositionalTerm) terms.get(i);
        Formula newterm = term.replaceEquivalences(topLeveFormula, replacements, noDependenceVars);
        terms2.add((PropositionalTerm) newterm);
    }
    try {
        return EqualityFormula.create(terms2, equal);
    } catch (IncomparableTermsException e) {
        e.printStackTrace();
        throw new RuntimeException(e);
    }
}
Example 18
Project: Fudan-Sakai-master  File: CQLSearchQuery.java View source code
private String criteriaCleanup(java.util.Set<String> criteriaSet, String criteriaName) {
    java.util.Iterator criteria = criteriaSet.iterator();
    StringBuilder result = new StringBuilder();
    while (criteria.hasNext()) {
        result.append(" " + criteriaName + "=");
        String criterion = (String) criteria.next();
        // remove any punctuation
        criterion = criterion.replaceAll("\\p{Punct}", " ");
        criterion = criterion.trim();
        // take care of any adjacent spaces
        criterion = criterion.replaceAll("\\s+", " ");
        // replace spaces with +
        criterion = criterion.replaceAll("\\s", "+");
        // append this keyword
        result.append(criterion);
    }
    return (result.toString().trim().equals("")) ? null : result.toString().trim();
}
Example 19
Project: sakai-cle-master  File: CQLSearchQuery.java View source code
private String criteriaCleanup(java.util.Set<String> criteriaSet, String criteriaName) {
    java.util.Iterator criteria = criteriaSet.iterator();
    StringBuilder result = new StringBuilder();
    while (criteria.hasNext()) {
        result.append(" " + criteriaName + "=");
        String criterion = (String) criteria.next();
        // remove any punctuation
        criterion = criterion.replaceAll("\\p{Punct}", " ");
        criterion = criterion.trim();
        // take care of any adjacent spaces
        criterion = criterion.replaceAll("\\s+", " ");
        // replace spaces with +
        criterion = criterion.replaceAll("\\s", "+");
        // append this keyword
        result.append(criterion);
    }
    return (result.toString().trim().equals("")) ? null : result.toString().trim();
}
Example 20
Project: Hibernate-Core-3.5.6-Final-patched-with--True-Coalesce--enhancement-master  File: PersistentSet.java View source code
public Serializable getSnapshot(CollectionPersister persister) throws HibernateException {
    EntityMode entityMode = getSession().getEntityMode();
    //if (set==null) return new Set(session);
    HashMap clonedSet = new HashMap(set.size());
    Iterator iter = set.iterator();
    while (iter.hasNext()) {
        Object copied = persister.getElementType().deepCopy(iter.next(), entityMode, persister.getFactory());
        clonedSet.put(copied, copied);
    }
    return clonedSet;
}
Example 21
Project: hibernate-core-3.6.x-mod-master  File: PersistentSet.java View source code
public Serializable getSnapshot(CollectionPersister persister) throws HibernateException {
    EntityMode entityMode = getSession().getEntityMode();
    //if (set==null) return new Set(session);
    HashMap clonedSet = new HashMap(set.size());
    Iterator iter = set.iterator();
    while (iter.hasNext()) {
        Object copied = persister.getElementType().deepCopy(iter.next(), entityMode, persister.getFactory());
        clonedSet.put(copied, copied);
    }
    return clonedSet;
}
Example 22
Project: google-web-toolkit-svnmirror-master  File: TreeSetTest.java View source code
/**
   * Test method for 'java.util.Set.add(Object)'.
   * 
   * @see java.util.Set#add(Object)
   */
public void testAdd_entries3() {
    // verify that the method is not supported.
    if (isAddSupported) {
        // populate the set
        Set<E> set = createSet();
        set.add(getKeys()[0]);
        set.add(getKeys()[1]);
        set.add(getKeys()[2]);
        // test contents
        assertFalse(set.isEmpty());
        assertEquals(3, set.size());
        Collection<E> keys = set;
        // test contains all keys
        assertTrue(keys.contains(getKeys()[0]));
        assertTrue(keys.contains(getKeys()[1]));
        assertTrue(keys.contains(getKeys()[2]));
    }
}
Example 23
Project: gwt-sandbox-master  File: TreeSetTest.java View source code
/**
   * Test method for 'java.util.Set.add(Object)'.
   * 
   * @see java.util.Set#add(Object)
   */
public void testAdd_entries3() {
    // verify that the method is not supported.
    if (isAddSupported) {
        // populate the set
        Set<E> set = createSet();
        set.add(getKeys()[0]);
        set.add(getKeys()[1]);
        set.add(getKeys()[2]);
        // test contents
        assertFalse(set.isEmpty());
        assertEquals(3, set.size());
        Collection<E> keys = set;
        // test contains all keys
        assertTrue(keys.contains(getKeys()[0]));
        assertTrue(keys.contains(getKeys()[1]));
        assertTrue(keys.contains(getKeys()[2]));
    }
}
Example 24
Project: gwt.svn-master  File: TreeSetTest.java View source code
/**
   * Test method for 'java.util.Set.add(Object)'.
   * 
   * @see java.util.Set#add(Object)
   */
public void testAdd_entries3() {
    // verify that the method is not supported.
    if (isAddSupported) {
        // populate the set
        Set<E> set = createSet();
        set.add(getKeys()[0]);
        set.add(getKeys()[1]);
        set.add(getKeys()[2]);
        // test contents
        assertFalse(set.isEmpty());
        assertEquals(3, set.size());
        Collection<E> keys = set;
        // test contains all keys
        assertTrue(keys.contains(getKeys()[0]));
        assertTrue(keys.contains(getKeys()[1]));
        assertTrue(keys.contains(getKeys()[2]));
    }
}
Example 25
Project: scalagwt-gwt-master  File: TreeSetTest.java View source code
/**
   * Test method for 'java.util.Set.add(Object)'.
   * 
   * @see java.util.Set#add(Object)
   */
public void testAdd_entries3() {
    // verify that the method is not supported.
    if (isAddSupported) {
        // populate the set
        Set<E> set = createSet();
        set.add(getKeys()[0]);
        set.add(getKeys()[1]);
        set.add(getKeys()[2]);
        // test contents
        assertFalse(set.isEmpty());
        assertEquals(3, set.size());
        Collection<E> keys = set;
        // test contains all keys
        assertTrue(keys.contains(getKeys()[0]));
        assertTrue(keys.contains(getKeys()[1]));
        assertTrue(keys.contains(getKeys()[2]));
    }
}
Example 26
Project: k3-master  File: RobotExpectedEnumerationTerminal.java View source code
public java.util.Set<String> getTokenNames() {
    // EnumerationTerminals are associated with multiple tokens, one for each literal
    // that was mapped to a string
    java.util.Set<String> tokenNames = new java.util.LinkedHashSet<String>();
    java.util.Map<String, String> mapping = enumerationTerminal.getLiteralMapping();
    for (String literalName : mapping.keySet()) {
        String text = mapping.get(literalName);
        if (text != null && !"".equals(text)) {
            tokenNames.add("'" + text + "'");
        }
    }
    return tokenNames;
}
Example 27
Project: ttc2011-master  File: SslExpectedBooleanTerminal.java View source code
public java.util.Set<String> getTokenNames() {
    // BooleanTerminals are associated with two or one token(s)
    java.util.Set<String> tokenNames = new java.util.LinkedHashSet<String>(2);
    String trueLiteral = booleanTerminal.getTrueLiteral();
    if (!"".equals(trueLiteral)) {
        tokenNames.add("'" + trueLiteral + "'");
    }
    String falseLiteral = booleanTerminal.getFalseLiteral();
    if (!"".equals(falseLiteral)) {
        tokenNames.add("'" + falseLiteral + "'");
    }
    return tokenNames;
}
Example 28
Project: expenditures-master  File: MissionSystem.java View source code
/**
     * Use AUTHORIZATION_PREDICATE instead
     */
@Deprecated
public Set<AccountabilityType> getAccountabilityTypesThatAuthorize() {
    final Set<AccountabilityType> accountabilityTypes = new HashSet<AccountabilityType>();
    for (final MissionAuthorizationAccountabilityType missionAuthorizationAccountabilityType : getMissionAuthorizationAccountabilityTypesSet()) {
        accountabilityTypes.addAll(missionAuthorizationAccountabilityType.getAccountabilityTypesSet());
    }
    return accountabilityTypes;
}
Example 29
Project: algorithmic-programming-master  File: Prob2_1_UnsortedLinkedList.java View source code
/**
     * Running time = O(n)
     *
     * @param singlyLinkedListNode
     * @return
     */
public static SinglyLinkedListNode removeDuplicates(SinglyLinkedListNode singlyLinkedListNode) {
    SinglyLinkedListNode dedupedListNode = singlyLinkedListNode;
    SinglyLinkedListNode currentNode = singlyLinkedListNode;
    Set<String> duplicateDetectionSet = new HashSet<>();
    duplicateDetectionSet.add(dedupedListNode.getPayload());
    currentNode = currentNode.getNext();
    while (currentNode != null) {
        if (duplicateDetectionSet.add(currentNode.getPayload())) {
            dedupedListNode.setNext(currentNode);
            dedupedListNode = dedupedListNode.getNext();
        }
        currentNode = currentNode.getNext();
    }
    return singlyLinkedListNode;
}
Example 30
Project: amu_automata_2011-master  File: AutomatonUtilities.java View source code
/**
     * Ustala alfabet.
     */
public static Set<Character> getAlphabet(AutomatonSpecification automaton, Set<Character> superset) {
    Set<Character> alphabet = new HashSet<Character>();
    for (State s : automaton.allStates()) {
        for (OutgoingTransition ot : automaton.allOutgoingTransitions(s)) {
            for (Character c : superset) {
                boolean isAlreadyIn = false;
                for (Character ch : alphabet) {
                    if (ch.equals(c)) {
                        isAlreadyIn = true;
                        break;
                    }
                }
                if (!isAlreadyIn && ot.getTransitionLabel().canAcceptCharacter(c)) {
                    alphabet.add(c);
                }
            }
        }
    }
    return alphabet;
}
Example 31
Project: AnimeTaste-master  File: ApiUtils.java View source code
public static String getAccessToken(TreeMap<String, String> map, String app_secret) {
    String toMd5 = "";
    Set<String> keys = map.keySet();
    Iterator<String> iterator = keys.iterator();
    while (iterator.hasNext()) {
        String key = iterator.next();
        toMd5 += key + "=" + map.get(key) + "&";
    }
    toMd5 = toMd5.substring(0, toMd5.length() - 1);
    toMd5 += app_secret;
    return MD5.digest(toMd5);
}
Example 32
Project: ApAM-master  File: SpellSimple.java View source code
public Set<String> check(String passage) {
    if ((passage == null) || (passage.length() == 0)) {
        return null;
    }
    Set<String> errorList = new HashSet<String>();
    StringTokenizer st = new StringTokenizer(passage, " ,.!?;:");
    while (st.hasMoreTokens()) {
        String word = st.nextToken();
        if (!dictionary.check(word)) {
            errorList.add(word);
        }
    }
    return errorList;
}
Example 33
Project: AutoReferee-master  File: RegionFlagCoverageTest.java View source code
@Test
public void test() {
    Set<Character> optionsGiven, optionsComputed;
    optionsGiven = Sets.newHashSet();
    for (char c : AutoRefRegion.Flag.OPTIONS.toCharArray()) optionsGiven.add(c);
    optionsComputed = Sets.newHashSet();
    for (AutoRefRegion.Flag flag : AutoRefRegion.Flag.values()) optionsComputed.add(flag.getMark());
    Assert.assertEquals(optionsGiven, optionsComputed);
}
Example 34
Project: batfish-master  File: CommunitySet.java View source code
public Set<String> asStringSet() {
    Set<Long> sortedCommunities = new TreeSet<>();
    sortedCommunities.addAll(this);
    Set<String> strings = new LinkedHashSet<>();
    for (long communityLong : sortedCommunities) {
        String commmunityStr = CommonUtil.longToCommunity(communityLong);
        strings.add(commmunityStr);
    }
    return strings;
}
Example 35
Project: bluetooth_social-master  File: HttpUtils.java View source code
public static Map<String, String> decodeByDecodeNames(List<String> decodeNames, Map<String, String> map) {
    Set<String> keys = map.keySet();
    Iterator<String> it = keys.iterator();
    while (it.hasNext()) {
        String key = it.next();
        String value = map.get(key);
        for (String decodeName : decodeNames) {
            if (key.equals(decodeName)) {
                value = URLDecoder.decode(value);
                map.put(key, value);
            }
        }
    }
    return map;
}
Example 36
Project: brooklyn-service-broker-master  File: ServiceUtilTest.java View source code
@Test
public void testGetUniqueName() {
    Set<String> names = Sets.newHashSet();
    String name1 = ServiceUtil.getUniqueName("foo", names);
    Assert.assertEquals(name1, "foo");
    String name2 = ServiceUtil.getUniqueName("foo", names);
    Assert.assertEquals(name2, "foo_1");
    String name3 = ServiceUtil.getUniqueName("foo", names);
    Assert.assertEquals(name3, "foo_2");
}
Example 37
Project: build-info-master  File: IssuesTrackerUtils.java View source code
public static Set<Issue> getAffectedIssuesSet(String affectedIssues) {
    Set<Issue> affectedIssuesSet = Sets.newHashSet();
    if (StringUtils.isNotBlank(affectedIssues)) {
        String[] issuePairs = affectedIssues.split(",");
        for (String pair : issuePairs) {
            String[] idAndUrl = pair.split(">>");
            if (idAndUrl.length == 3) {
                affectedIssuesSet.add(new Issue(idAndUrl[0], idAndUrl[1], idAndUrl[2]));
            }
        }
    }
    return affectedIssuesSet;
}
Example 38
Project: cagrid2-master  File: DNDissector.java View source code
public static Set<Attribute> dissect(LdapName ldapName) throws NamingException {
    Set<Attribute> attributes = new HashSet<Attribute>();
    for (Rdn rdn : ldapName.getRdns()) {
        NamingEnumeration<? extends Attribute> ne = rdn.toAttributes().getAll();
        while (ne.hasMore()) {
            Attribute att = ne.next();
            attributes.add(att);
        }
    }
    return attributes;
}
Example 39
Project: cloudbreak-master  File: TopologyUtil.java View source code
public static void checkTopologyForResource(Set<TopologyResponse> publics, Long topologyId, String platform) {
    if (publics != null && topologyId != null) {
        for (TopologyResponse t : publics) {
            if (t.getId().equals(topologyId)) {
                if (t.getCloudPlatform().equals(platform)) {
                    return;
                } else {
                    throw new RuntimeException("The selected platform belongs to a different cloudplatform");
                }
            }
        }
        throw new RuntimeException("Not found platform with id: " + topologyId);
    }
}
Example 40
Project: CloudSim-master  File: ContainerPlacementPolicyMostFull.java View source code
@Override
public ContainerVm getContainerVm(List<ContainerVm> vmList, Object obj, Set<? extends ContainerVm> excludedVmList) {
    ContainerVm selectedVm = null;
    double maxMips = Double.MIN_VALUE;
    for (ContainerVm containerVm1 : vmList) {
        if (excludedVmList.contains(containerVm1)) {
            continue;
        }
        double containerUsage = containerVm1.getContainerScheduler().getAvailableMips();
        if (containerUsage > maxMips) {
            maxMips = containerUsage;
            selectedVm = containerVm1;
        }
    }
    return selectedVm;
}
Example 41
Project: common-java-cookbook-master  File: SetUnionExample.java View source code
public static void main(String[] args) {
    Set<String> names1 = Sets.newHashSet();
    names1.add("Tim");
    names1.add("Tom");
    names1.add("Ted");
    Set<String> names2 = Sets.newHashSet();
    names2.add("Susan");
    names2.add("Tony");
    names2.add("Ted");
    Set<String> union = Sets.union(names1, names2);
    for (String name : union) {
        System.out.printf("%s\n", name);
    }
}
Example 42
Project: CoreNLP-master  File: AnnotatedTextReaderTest.java View source code
public void testParse() {
    try {
        String text = "I am going to be in <LOC> Italy </LOC> sometime, soon. Specifically in <LOC> Tuscany </LOC> .";
        Set<String> labels = new HashSet<String>();
        labels.add("LOC");
        System.out.println(AnnotatedTextReader.parseFile(new BufferedReader(new StringReader(text)), labels, null, true, ""));
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Example 43
Project: DCMonitor-master  File: DateTimeConverter.java View source code
@Bean
FormattingConversionServiceFactoryBean conversionService() {
    FormattingConversionServiceFactoryBean bean = new FormattingConversionServiceFactoryBean();
    Set<FormatterRegistrar> set = new HashSet<FormatterRegistrar>();
    JodaTimeFormatterRegistrar registrar = new JodaTimeFormatterRegistrar();
    registrar.setUseIsoFormat(true);
    set.add(registrar);
    bean.setFormatterRegistrars(set);
    return bean;
}
Example 44
Project: ddth-kafka-master  File: QndTopicInfo.java View source code
public static void main(String[] args) throws Exception {
    try (KafkaClient kafkaClient = new KafkaClient("localhost:9092")) {
        kafkaClient.init();
        Set<String> topics = kafkaClient.getTopics();
        System.out.println("Topics: " + topics);
        System.out.println(kafkaClient.getPartitionInfo("demo"));
        System.out.println(kafkaClient.getPartitionInfo("demo1"));
        System.out.println(kafkaClient.getPartitionInfo("demo2"));
        System.out.println(kafkaClient.getPartitionInfo("kotontai"));
        System.out.println(kafkaClient.getPartitionInfo("kotontai2"));
    }
}
Example 45
Project: deepnighttwo-master  File: MergeGLs.java View source code
/**
	 * @param args
	 */
public static void main(String[] args) {
    String[] cn = new String[] { "0", "14", "15", "20", "21", "23", "60", "63", "65", "74", "75", "79", "107", "121", "147", "193", "194", "197", "199", "200", "201", "229", "241", "263", "309", "325", "349", "370", "400" };
    String[] l = new String[] { "0", "14", "15", "20", "21", "22", "23", "27", "44", "50", "53", "60", "63", "65", "74", "75", "79", "86", "107", "111", "114", "121", "123", "125", "129", "136", "147", "153", "158", "160", "171", "180", "193", "194", "195", "196", "197", "198", "199", "200", "201", "219", "226", "228", "229", "234", "236", "241", "246", "251", "256", "258", "259", "260", "261", "262", "263", "264", "265", "266", "267", "279", "293", "297", "298", "304", "307", "309", "311", "313", "316", "318", "325", "327", "328", "334", "336", "340", "349", "350", "351", "353", "354", "355", "356", "360", "362", "364", "366", "367", "370", "392", "394", "395", "396", "397", "400", "402", "405", "406", "407", "408", "409", "410", "411" };
    Set<Integer> ls = new HashSet<Integer>();
    for (String s : l) {
        Integer v = Integer.valueOf(s);
        ls.add(v);
    }
    Set<Integer> cnn = new HashSet<Integer>();
    for (String s : cn) {
        Integer v = Integer.valueOf(s);
        cnn.add(v);
    }
    System.out.println(ls.containsAll(cnn));
}
Example 46
Project: dltk.tcl-master  File: PackageUtils.java View source code
public static String packagesToKey(Set<String> packages) {
    Set<String> sorted = new TreeSet<String>();
    sorted.addAll(packages);
    StringBuffer buffer = new StringBuffer();
    for (Iterator<String> iterator = sorted.iterator(); iterator.hasNext(); ) {
        String object = iterator.next();
        buffer.append("_").append(object);
    }
    return buffer.toString().replaceAll(":", "_");
}
Example 47
Project: doutoradoCodigo-master  File: TesteDataBase.java View source code
public static void main(String[] args) {
    DataBase base = new DataBase("projectValter");
    Set<Table> tables = new TreeSet<Table>();
    base.setDataBaseTables(tables);
    Table table1 = new Table("CLIENTE");
    Table table2 = new Table("CLIENTE");
    base.getDataBaseTables().add(table1);
    base.getDataBaseTables().add(table2);
    System.out.println(base.getDataBaseTables().size());
}
Example 48
Project: DroidForce-master  File: EInformationFlowModel.java View source code
public static Set<EInformationFlowModel> from(String str) {
    if (str == null)
        return null;
    Set<EInformationFlowModel> result = new HashSet<>();
    for (String s : str.split(Settings.getInstance().getSeparator1())) {
        switch(s.trim().toLowerCase()) {
            case "scope":
                result.add(SCOPE);
                break;
            case "quantities":
                result.add(QUANTITIES);
                break;
            case "structure":
                result.add(STRUCTURE);
                break;
        }
    }
    return result;
}
Example 49
Project: dwr-master  File: ScannerListener.java View source code
public void contextInitialized(ServletContextEvent arg0) {
    try {
        ClasspathScanner scanner = new ClasspathScanner("org.hibernate.annotations.common.reflection.*");
        System.out.println("Found the following classes");
        Set<String> classes = scanner.getClasses();
        System.out.println(classes);
        System.out.println("Scan correct: " + (classes.size() == 12));
    } catch (IOException ex) {
        ex.printStackTrace();
    }
}
Example 50
Project: e-fx-clipse-master  File: FXGraphOutputConfigurationProvider.java View source code
@Override
public Set<OutputConfiguration> getOutputConfigurations() {
    OutputConfiguration defaultOutput = new OutputConfiguration(IFileSystemAccess.DEFAULT_OUTPUT);
    defaultOutput.setDescription("Output folder for generated Java files");
    defaultOutput.setOutputDirectory("src");
    defaultOutput.setOverrideExistingResources(true);
    defaultOutput.setCreateOutputDirectory(true);
    defaultOutput.setCanClearOutputDirectory(false);
    defaultOutput.setCleanUpDerivedResources(false);
    defaultOutput.setSetDerivedProperty(false);
    return newHashSet(defaultOutput);
}
Example 51
Project: EasyMPermission-master  File: ValLub.java View source code
public void hardLub() {
    java.util.List<String> list = new java.util.ArrayList<String>();
    java.util.Set<String> set = new java.util.HashSet<String>();
    lombok.val thisShouldBeCollection = (System.currentTimeMillis() > 0) ? list : set;
    thisShouldBeCollection.add("");
    String foo = thisShouldBeCollection.iterator().next();
}
Example 52
Project: effective-java-examples-master  File: SetList.java View source code
public static void main(String[] args) {
    Set<Integer> set = new TreeSet<Integer>();
    List<Integer> list = new ArrayList<Integer>();
    for (int i = -3; i < 3; i++) {
        set.add(i);
        list.add(i);
    }
    for (int i = 0; i < 3; i++) {
        set.remove(i);
        list.remove(i);
    }
    System.out.println(set + " " + list);
}
Example 53
Project: errai-cdi-master  File: CDIServiceLocator.java View source code
public ErraiService locateService() {
    BeanManager beanManager = Util.lookupBeanManager();
    Set<Bean<?>> beans = beanManager.getBeans(ErraiService.class);
    Bean<?> bean = beanManager.resolve(beans);
    CreationalContext<?> context = beanManager.createCreationalContext(bean);
    return (ErraiService) beanManager.getReference(bean, ErraiService.class, context);
}
Example 54
Project: exhibition369_android-master  File: ListUtil.java View source code
/**
     * 数组去除��元素
     */
public static List<String> removeDuplicateWithOrder(List<String> list) {
    Set<String> set = new HashSet<String>();
    List<String> newList = new ArrayList<String>();
    for (Iterator<String> iter = list.iterator(); iter.hasNext(); ) {
        String element = iter.next();
        if (set.add(element))
            newList.add(element);
    }
    list.clear();
    return newList;
}
Example 55
Project: Facade-master  File: TestSourceFile.java View source code
@Test
public void dependencies() {
    final Set<ClassName> dependencies = SourceFile.fromClasspath("test-classes/ValidCoffee.java").dependencies();
    Assert.assertTrue(dependencies != null);
    Assert.assertTrue(dependencies.size() == 4);
    // I should not be able to change the state
    try {
        dependencies.add(new ClassName("a.name.that.should.Fail"));
    } catch (UnsupportedOperationException e) {
        return;
    }
    // awww
    Assert.fail();
}
Example 56
Project: fast-serialization-master  File: Git67.java View source code
@Test
public void testUnshared() {
    Set<Long> obj = new LinkedHashSet<>();
    obj.add(11373L);
    FSTConfiguration conf = FSTConfiguration.createDefaultConfiguration();
    conf.setShareReferences(false);
    conf.registerSerializer(LinkedHashSet.class, new FSTCollectionSerializer(), true);
    byte[] bytes = conf.asByteArray(obj);
    Object o = conf.asObject(bytes);
}
Example 57
Project: fitnesse-rc-master  File: ConstantEnumUtil.java View source code
public static <T> Set<T> getEnumsWhichConstantNameStartsWith(Class<T> enumClass, String prefix) {
    HashSet<T> types = new HashSet<T>();
    for (Field field : enumClass.getFields()) {
        if (Modifier.isStatic(field.getModifiers()) && field.getType().equals(enumClass) && field.getName().startsWith(prefix)) {
            try {
                types.add((T) field.get(null));
            } catch (IllegalAccessException e) {
                e.printStackTrace();
            }
        }
    }
    return types;
}
Example 58
Project: go-lang-idea-plugin-master  File: GoColorsAndFontsPageTest.java View source code
public void testDemoText() {
    GoColorsAndFontsPage testee = new GoColorsAndFontsPage();
    String demoText = testee.getDemoText();
    Set<String> knownElements = testee.getAdditionalHighlightingTagToDescriptorMap().keySet();
    Matcher m = Pattern.compile("</?(\\w+)>").matcher(demoText);
    while (m.find()) {
        String name = m.group(1);
        if (!knownElements.contains(name)) {
            Assert.fail("Unknown element \"" + m.group() + "\".");
        }
    }
}
Example 59
Project: goodnews-master  File: TagIdListStringAdapter.java View source code
public Set<ElementId> read(String string) {
    final Set<ElementId> tagIds = new HashSet<ElementId>();
    if (string != null && string.length() > 0) {
        final String[] tagNames = string.split(",");
        for (String tagName : tagNames) {
            tagIds.add(new ElementId(tagName.substring(1, tagName.length() - 1)));
        }
    }
    return tagIds;
}
Example 60
Project: hartley-master  File: SubscriberInspector.java View source code
/**
     * Report the subscription methods declared on the subscriber.
     */
public Set<Method> subscriptionsOn(Object subscriber) {
    SubscriptionMethodFilter filter = new SubscriptionMethodFilter();
    Class<?> subscriberClass = subscriber.getClass();
    List<Method> methods = Arrays.asList(subscriberClass.getMethods());
    Set<Method> subscriptions = new HashSet<Method>();
    for (Method method : methods) {
        if (filter.accepts(method)) {
            subscriptions.add(method);
        }
    }
    return subscriptions;
}
Example 61
Project: hazelcast-code-samples-master  File: SqlQueryMember.java View source code
public static void main(String[] args) {
    HazelcastInstance hz = Hazelcast.newHazelcastInstance();
    IMap<String, Customer> map = hz.getMap("map");
    map.put("1", new Customer("peter", true, 36));
    map.put("2", new Customer("john", false, 40));
    map.put("3", new Customer("roger", true, 20));
    Set<Customer> employees = (Set<Customer>) map.values(new SqlPredicate("active AND age < 30"));
    System.out.println("Employees: " + employees);
    Hazelcast.shutdownAll();
}
Example 62
Project: hibernate-validator-master  File: FailFastTest.java View source code
@Test
public void failFast() {
    //tag::include[]
    Validator validator = Validation.byProvider(HibernateValidator.class).configure().failFast(true).buildValidatorFactory().getValidator();
    Car car = new Car(null, false);
    Set<ConstraintViolation<Car>> constraintViolations = validator.validate(car);
    assertEquals(1, constraintViolations.size());
//end::include[]
}
Example 63
Project: ISDM-master  File: ClearAgentsFunction.java View source code
@Override
public void execute() {
    Scenario s = editor.getScenario();
    Set<Integer> empty = new HashSet<Integer>();
    s.setFireBrigades(empty);
    s.setFireStations(empty);
    s.setPoliceForces(empty);
    s.setPoliceOffices(empty);
    s.setAmbulanceTeams(empty);
    s.setAmbulanceCentres(empty);
    editor.setChanged();
    editor.updateOverlays();
}
Example 64
Project: ishacrmserver-master  File: ProgramTypePropTest.java View source code
@Test
public void getPracticeIdsTest() {
    ProgramTypeProp programTypeProp = new ProgramTypeProp();
    assertEquals(0, programTypeProp.getPracticeIds().size());
    PracticeProp practiceProp1 = new PracticeProp();
    practiceProp1.practiceId = 1;
    PracticeProp practiceProp2 = new PracticeProp();
    practiceProp2.practiceId = 2;
    programTypeProp.practiceProps.add(practiceProp1);
    programTypeProp.practiceProps.add(practiceProp2);
    Set<Long> practiceIds = programTypeProp.getPracticeIds();
    assertEquals(2, practiceIds.size());
    assertTrue(practiceIds.contains((long) 1));
    assertTrue(practiceIds.contains((long) 2));
}
Example 65
Project: jahia-spam-filtering-master  File: SpamFilteringApplication.java View source code
@Override
public Set<Class<?>> getClasses() {
    Set<Class<?>> classes = new HashSet<>();
    classes.add(SpamFilteringResource.class);
    classes.add(MultiPartFeature.class);
    classes.add(SpamFilteringAuthorizationFilter.class);
    classes.add(JacksonJaxbJsonProvider.class);
    // classes.add(LoggingFilter.class);
    return classes;
}
Example 66
Project: jdbm-master  File: SerializationHeaderTest.java View source code
public void testUnique() throws IllegalAccessException {
    Class c = SerializationHeader.class;
    Set<Integer> s = new TreeSet<Integer>();
    for (Field f : c.getDeclaredFields()) {
        f.setAccessible(true);
        int value = f.getInt(null);
        assertTrue("Value already used: " + value, !s.contains(value));
        s.add(value);
    }
    assertTrue(!s.isEmpty());
}
Example 67
Project: JDBM3-master  File: SerializationHeaderTest.java View source code
public void testUnique() throws IllegalAccessException {
    Class c = SerializationHeader.class;
    Set<Integer> s = new TreeSet<Integer>();
    for (Field f : c.getDeclaredFields()) {
        f.setAccessible(true);
        int value = f.getInt(null);
        assertTrue("Value already used: " + value, !s.contains(value));
        s.add(value);
    }
    assertTrue(!s.isEmpty());
}
Example 68
Project: jfixture-master  File: SetBuilder.java View source code
@Override
public Object create(Object request, SpecimenContext context) {
    if (!(request instanceof SpecimenType)) {
        return new NoSpecimen();
    }
    SpecimenType specimenType = (SpecimenType) request;
    Class requestClass = specimenType.getRawType();
    if (!Set.class.isAssignableFrom(requestClass)) {
        return new NoSpecimen();
    }
    if (!requestClass.isInterface()) {
        return new NoSpecimen();
    }
    return new HashSet();
}
Example 69
Project: jframe-master  File: ClientRequestHandler.java View source code
@SuppressWarnings("rawtypes")
public String getXmlBody() {
    StringBuilder sb = new StringBuilder();
    Set es = super.getAllParameters().entrySet();
    Iterator it = es.iterator();
    while (it.hasNext()) {
        Map.Entry entry = (Map.Entry) it.next();
        String k = (String) entry.getKey();
        String v = (String) entry.getValue();
        if (!"appkey".equals(k)) {
            sb.append("<" + k + ">" + v + "<" + k + ">" + "\r\n");
        }
    }
    return sb.toString();
}
Example 70
Project: joern-master  File: CDG.java View source code
public static CDG newInstance(DominatorTree<CFGNode> dominatorTree) {
    CDG cdg = new CDG();
    cdg.dominatorTree = dominatorTree;
    for (CFGNode vertex : dominatorTree.getVertices()) {
        Set<CFGNode> frontier = dominatorTree.dominanceFrontier(vertex);
        if (frontier != null) {
            cdg.addVertex(vertex);
            for (CFGNode f : frontier) {
                cdg.addVertex(f);
                cdg.addEdge(new CDGEdge(f, vertex));
            }
        }
    }
    return cdg;
}
Example 71
Project: jpa-cloner-master  File: Multi.java View source code
@Override
public Set<?> explore(Collection<?> entities, EntityExplorer entityExplorer) {
    Set<Object> explored = new HashSet<Object>();
    Set<?> next = new HashSet<Object>(entities);
    do {
        next = child.explore(next, entityExplorer);
        // remove already explored entities (optimization & prevention of cycles)
        next.removeAll(explored);
        explored.addAll(next);
    } while (!next.isEmpty());
    return explored;
}
Example 72
Project: JPS-master  File: JavaFileCollector.java View source code
public static void collectRecursively(File file, List<File> result, Set<File> excluded) {
    if (file.isDirectory()) {
        File current = file;
        while (current != null) {
            if (excluded.contains(current))
                return;
            current = current.getParentFile();
        }
        final File[] children = file.listFiles();
        if (children != null) {
            for (File child : children) {
                collectRecursively(child, result, excluded);
            }
        }
        return;
    }
    if (file.getName().endsWith(".java")) {
        result.add(file);
    }
}
Example 73
Project: json-schema-validator-demo-master  File: App.java View source code
@Override
public Set<Class<?>> getClasses() {
    final ImmutableSet.Builder<Class<?>> builder = ImmutableSet.builder();
    builder.add(SyntaxProcessing.class);
    builder.add(Index.class);
    builder.add(JJSchemaProcessing.class);
    builder.add(Schema2PojoProcessing.class);
    builder.add(AvroProcessing.class);
    builder.add(JsonPatch.class);
    return builder.build();
}
Example 74
Project: jsondoc-master  File: Spring4JSONDocScanner.java View source code
@Override
public Set<Class<?>> jsondocControllers() {
    Set<Class<?>> jsondocControllers = reflections.getTypesAnnotatedWith(Controller.class, true);
    jsondocControllers.addAll(reflections.getTypesAnnotatedWith(RestController.class, true));
    try {
        Class.forName("org.springframework.data.rest.webmvc.RepositoryRestController");
        jsondocControllers.addAll(reflections.getTypesAnnotatedWith(RepositoryRestController.class, true));
    } catch (ClassNotFoundException e) {
        log.debug(e.getMessage() + ".class not found");
    }
    return jsondocControllers;
}
Example 75
Project: kibana-master  File: MemberURLTokenGeneratorTest.java View source code
@Test
public void testGenerateURLTokens() {
    String folder = rootDir + "followee-folder/";
    String filePath = folder + MemberURLTokenGenerator.URLTOKEN_FILENAME;
    MemberURLTokenGenerator generator = new MemberURLTokenGenerator(folder, filePath);
    int tokenCount = 20;
    Set<String> tokens = generator.generateURLTokens();
    File file = new File(filePath);
    Assert.assertTrue(file.exists());
    Assert.assertEquals(tokenCount, tokens.size());
}
Example 76
Project: knorxx-master  File: ExtJsDetector.java View source code
@Override
protected LibraryUrls detectInternal(Set<String> javaClassNames) {
    LibraryUrls result = new LibraryUrls();
    for (String javaClassName : javaClassNames) {
        if (javaClassName.contains(Ext.class.getPackage().getName())) {
            result.getJavaScriptUrls().add("webjars/extjs/4.2.1.883/ext-debug.js");
            result.getCssUrls().add("webjars/extjs/4.2.1.883/resources/css/ext-all.css");
            break;
        }
    }
    return result;
}
Example 77
Project: language-tools-bg-master  File: ParonymService.java View source code
public Set<String> findParonyms(String input) {
    Set<String> paronyms = Sets.newHashSet();
    int maxDistance = input.length() / 3;
    for (String word : Checker.formsDictionary.keySet()) {
        if (!word.startsWith(input) && StringUtils.getLevenshteinDistance(input, word, maxDistance) != -1) {
            paronyms.add(word);
        }
    }
    return paronyms;
}
Example 78
Project: lettuce-master  File: MultiConnectionTest.java View source code
@Test
public void twoConnections() throws Exception {
    RedisAsyncConnection<String, String> connection1 = client.connectAsync();
    RedisAsyncConnection<String, String> connection2 = client.connectAsync();
    connection1.sadd("key", "member1", "member2").get();
    Future<Set<String>> members = connection2.smembers("key");
    assertThat(members.get()).hasSize(2);
    connection1.close();
    connection2.close();
}
Example 79
Project: light-admin-master  File: LineItemRenderer.java View source code
@Override
public String apply(final TestOrder parentTestEntity) {
    Set<String> lineItemsDescriptions = newLinkedHashSet();
    for (TestLineItem lineItems : parentTestEntity.getLineItems()) {
        lineItemsDescriptions.add("LineItem Id: " + lineItems.getId() + "; Product Name: " + lineItems.getProduct().getName());
    }
    return StringUtils.collectionToDelimitedString(lineItemsDescriptions, "<br/>");
}
Example 80
Project: lombok-intellij-plugin-master  File: ValLub.java View source code
public void hardLub() {
    java.util.List<String> list = new java.util.ArrayList<String>();
    java.util.Set<String> set = new java.util.HashSet<String>();
    lombok.val thisShouldBeCollection = (System.currentTimeMillis() > 0) ? list : set;
    thisShouldBeCollection.add("");
    String foo = thisShouldBeCollection.iterator().next();
}
Example 81
Project: lombok-master  File: ValLub.java View source code
public void hardLub() {
    java.util.List<String> list = new java.util.ArrayList<String>();
    java.util.Set<String> set = new java.util.HashSet<String>();
    lombok.val thisShouldBeCollection = (System.currentTimeMillis() > 0) ? list : set;
    thisShouldBeCollection.add("");
    String foo = thisShouldBeCollection.iterator().next();
}
Example 82
Project: mecha-master  File: MechanoidOutputConfigurationProvider.java View source code
@Override
public Set<OutputConfiguration> getOutputConfigurations() {
    Set<OutputConfiguration> outputConfigurations = super.getOutputConfigurations();
    OutputConfiguration defaultOutput = new OutputConfiguration(DEFAULT_STUB_OUTPUT);
    defaultOutput.setDescription("Stub Folder");
    defaultOutput.setOutputDirectory("./src");
    defaultOutput.setOverrideExistingResources(false);
    defaultOutput.setCreateOutputDirectory(false);
    defaultOutput.setCleanUpDerivedResources(false);
    defaultOutput.setSetDerivedProperty(false);
    defaultOutput.setCanClearOutputDirectory(false);
    outputConfigurations.add(defaultOutput);
    return outputConfigurations;
}
Example 83
Project: mechanoid-master  File: MechanoidOutputConfigurationProvider.java View source code
@Override
public Set<OutputConfiguration> getOutputConfigurations() {
    Set<OutputConfiguration> outputConfigurations = super.getOutputConfigurations();
    OutputConfiguration defaultOutput = new OutputConfiguration(DEFAULT_STUB_OUTPUT);
    defaultOutput.setDescription("Stub Folder");
    defaultOutput.setOutputDirectory("./src");
    defaultOutput.setOverrideExistingResources(false);
    defaultOutput.setCreateOutputDirectory(false);
    defaultOutput.setCleanUpDerivedResources(false);
    defaultOutput.setSetDerivedProperty(false);
    defaultOutput.setCanClearOutputDirectory(false);
    outputConfigurations.add(defaultOutput);
    return outputConfigurations;
}
Example 84
Project: mickeydb-master  File: MickeyOutputConfigurationProvider.java View source code
@Override
public Set<OutputConfiguration> getOutputConfigurations() {
    Set<OutputConfiguration> outputConfigurations = super.getOutputConfigurations();
    OutputConfiguration defaultOutput = new OutputConfiguration(DEFAULT_STUB_OUTPUT);
    defaultOutput.setDescription("Stub Folder");
    defaultOutput.setOutputDirectory("./src");
    defaultOutput.setOverrideExistingResources(false);
    defaultOutput.setCreateOutputDirectory(false);
    defaultOutput.setCleanUpDerivedResources(false);
    defaultOutput.setSetDerivedProperty(false);
    defaultOutput.setCanClearOutputDirectory(false);
    outputConfigurations.add(defaultOutput);
    return outputConfigurations;
}
Example 85
Project: mockneat-master  File: ComplexStructure.java View source code
public static void main(String[] args) {
    MockNeat m = MockNeat.threadLocal();
    Map<String, List<Map<Set<Integer>, List<Integer>>>> result = m.ints().list(// List<Integer>
    2).mapKeys(// Map<Set<Integer>, List<Integer>>
    2, m.ints().set(3)::val).list(// List<Map<Set<Integer>, List<Integer>>>
    LinkedList.class, 2).mapKeys(// Map<String, List<Map<Set<Integer>, List<Integer>>>>
    4, m.strings()::val).val();
}
Example 86
Project: mongodb-ide-master  File: CollectionsCategory.java View source code
@Override
protected void loadCollections() throws Exception {
    DB db = ((Database) getParent()).getDB();
    Set<String> names = MongoShellCommandManager.getInstance().showCollections(getServer(), db);
    for (String name : names) {
        Collection collection = new Collection(name);
        collections.add(collection);
        super.addNode(collection);
    }
}
Example 87
Project: ne-framework-master  File: ActionInvoke.java View source code
/**
	 * 根� 请求 url,获�控制模型
	 * 
	 * @param webUrl
	 * @return
	 */
public static ControlModel getControllModel(String webUrl) {
    ControlModel cm = null;
    // �索普通url
    cm = CoreQueue.controlMap.get(webUrl);
    // �索rest
    if (cm == null) {
        Set<String> restUrls = CoreQueue.restControlMap.keySet();
        for (String restUrl : restUrls) {
            if (webUrl.matches(restUrl)) {
                cm = CoreQueue.restControlMap.get(restUrl);
                break;
            }
        }
    }
    return cm;
}
Example 88
Project: ngrinder-master  File: ControllerPropertiesKeyMapperTest.java View source code
@Test
public void testMapperCreation() {
    PropertiesKeyMapper propertiesKeyMapper = PropertiesKeyMapper.create("controller-properties.map");
    Set<String> allKeys = propertiesKeyMapper.getAllKeys();
    List<String> all = newArrayList();
    all.addAll(allKeys);
    Collections.sort(all);
    for (String each : all) {
        System.out.println("public static final String PROP_" + each.toUpperCase().replace(".", "_") + " = \"" + each + "\";");
    }
}
Example 89
Project: ninja-ebean-master  File: ReflectionsHelper.java View source code
public static Set<String> findAllClassesInPackage(String packageName) {
    try {
        ClassPath cp = ClassPath.from(ReflectionsHelper.class.getClassLoader());
        ImmutableSet<ClassPath.ClassInfo> classes = cp.getTopLevelClasses(packageName);
        Set<String> classNames = new LinkedHashSet<>();
        for (ClassPath.ClassInfo ci : classes) {
            classNames.add(ci.getName());
        }
        return classNames;
    } catch (IOException e) {
        throw new RuntimeException(e.getMessage(), e);
    }
}
Example 90
Project: oddjob-master  File: VanillaServerHandlerFactoryTest.java View source code
public void testOpInfoForClass() {
    VanillaServerHandlerFactory<LogPollable> test = new VanillaServerHandlerFactory<LogPollable>(LogPollable.class);
    MBeanOperationInfo[] results = test.getMBeanOperationInfo();
    assertEquals(4, results.length);
    Set<String> set = new HashSet<String>();
    for (MBeanOperationInfo result : results) {
        set.add(result.getName());
    }
    assertTrue(set.contains("url"));
}
Example 91
Project: opensoc-streaming-master  File: RangeChecker.java View source code
static boolean checkRange(Set<String> CIDR_networks, String ip) {
    for (String network : CIDR_networks) {
        System.out.println("Looking at range: " + network + " and ip " + ip);
        SubnetUtils utils = new SubnetUtils(network);
        if (utils.getInfo().isInRange(ip)) {
            System.out.println(ip + " in range " + network);
            return true;
        }
    }
    //no matches
    return false;
}
Example 92
Project: overture-master  File: VdmAnalysis.java View source code
protected boolean proceed(INode node) {
    if (node == topNode) {
        return true;
    }
    INode parent = node.parent();
    Set<INode> visited = new HashSet<INode>();
    while (parent != null && !visited.contains(parent) && this.topNode != parent) {
        visited.add(parent);
        parent = parent.parent();
    }
    return this.topNode == parent;
}
Example 93
Project: ovirt-engine-master  File: AuditLogTypeTest.java View source code
@Test
public void testAuditLogTypeValueUniqueness() {
    BitSet bitset = new BitSet(bitsetSize);
    Set<Integer> nonUniqueValues = new TreeSet<>();
    for (AuditLogType alt : AuditLogType.values()) {
        if (bitset.get(alt.getValue())) {
            nonUniqueValues.add(alt.getValue());
        } else {
            bitset.set(alt.getValue());
        }
    }
    assertTrue("AuditLogType contains the following non unique values: " + nonUniqueValues, nonUniqueValues.isEmpty());
}
Example 94
Project: PerWorldInventory-master  File: PlayerPermissionTest.java View source code
@Test
public void shouldHaveUniqueNodes() {
    // given
    Set<String> nodes = new HashSet<>();
    // when/then
    for (PlayerPermission permission : PlayerPermission.values()) {
        if (nodes.contains(permission.getNode())) {
            fail("More than one enum value defines the node '" + permission.getNode() + "'");
        }
        nodes.add(permission.getNode());
    }
}
Example 95
Project: pocketknife-master  File: MethodBinding.java View source code
protected String getReturnVarName(String returnVarNameRoot) {
    Set<String> fieldNames = new LinkedHashSet<String>();
    for (FieldBinding fieldBinding : getFields()) {
        fieldNames.add(fieldBinding.getName());
    }
    String returnVarName = returnVarNameRoot;
    int count = 0;
    while (fieldNames.contains(returnVarName)) {
        returnVarName = returnVarNameRoot + ++count;
    }
    return returnVarName;
}
Example 96
Project: ps-framework-master  File: EncodingHelper.java View source code
public static Set<Class<?>> getInterfaces(Class<?> type) {
    Set<Class<?>> interfaces = new HashSet<Class<?>>();
    // check super class
    Class<?> sclass = type.getSuperclass();
    if (sclass != null) {
        interfaces.addAll(getInterfaces(sclass));
    }
    // and this class
    for (Class<?> interf : type.getInterfaces()) {
        if (Modifier.isPublic(interf.getModifiers())) {
            interfaces.add(interf);
            interfaces.addAll(getInterfaces(interf));
        }
    }
    return interfaces;
}
Example 97
Project: pyramus-master  File: PyramusService.java View source code
protected void validateEntity(Object entity) {
    SystemDAO systemDAO = DAOFactory.getInstance().getSystemDAO();
    Set<ConstraintViolation<Object>> constraintViolations = systemDAO.validateEntity(entity);
    if (!constraintViolations.isEmpty()) {
        String message = "";
        for (ConstraintViolation<Object> constraintViolation : constraintViolations) {
            message += constraintViolation.getMessage() + '\n';
        }
        throw new PersistenceException(message);
    }
}
Example 98
Project: QMAClone-master  File: JudgeTato.java View source code
@Override
public boolean judge(PacketProblem problem, String playerAnswer) {
    if (Strings.isNullOrEmpty(playerAnswer)) {
        return false;
    }
    Set<String> selected = ImmutableSet.copyOf(playerAnswer.split(Constant.DELIMITER_GENERAL));
    Set<String> answerSet = ImmutableSet.copyOf(problem.getShuffledAnswerList());
    return selected.equals(answerSet);
}
Example 99
Project: qrone-master  File: AbstractURIFileSystem.java View source code
@Override
public List<String> list(String path) {
    List<String> list = list();
    Set<String> set = new HashSet<String>();
    for (String uri : list) {
        if (uri.startsWith(path)) {
            String u = uri.substring(path.length());
            if (u.contains("/")) {
                set.add(u.substring(0, u.indexOf('/')));
            } else {
                set.add(u);
            }
        }
    }
    return new ArrayList<String>(set);
}
Example 100
Project: ReActions-master  File: WorldsPlayers.java View source code
@Override
public Set<Player> selectPlayers(String worldNames) {
    Set<Player> players = new HashSet<>();
    if (!worldNames.isEmpty()) {
        String[] arrWorlds = worldNames.split(",\\s*");
        for (String worldName : arrWorlds) {
            World world = Bukkit.getWorld(worldName);
            if (world == null)
                continue;
            players.addAll(world.getPlayers());
        }
    }
    return players;
}
Example 101
Project: Resteasy-master  File: IsHttpMethod.java View source code
public static Set<String> getHttpMethods(Method method) {
    HashSet<String> methods = new HashSet<String>();
    for (Annotation annotation : method.getAnnotations()) {
        HttpMethod http = annotation.annotationType().getAnnotation(HttpMethod.class);
        if (http != null)
            methods.add(http.value());
    }
    if (methods.size() == 0)
        return null;
    return methods;
}