/*
Returns a CompactSet-compatible object with the given classifier. Note that
extra elements could be returned -- hence "super set". It is the
responsibility of the caller to weed these out
501211
public Object[] getSuperSetWithClassifier(C key) {
        if (key == null) {
            return getAllElements();
        } else {
            int index = (key.hashCode() & 0x7FFFFFFF) % elements.length;
    
            return CompactSet.getElements(elements[index]);
        }
    }
218014
boolean symtabExtends(SymbolTable other)
    {
        // Throws ClassCastException if other isn't a local symtab
        LocalSymbolTable subset = (LocalSymbolTable) other;

        // Gather snapshots of each LST's data, so we don't

        // Superset must have same/more known symbols than subset.
        if (getMaxId() < subset.getMaxId()) return false;

        // TODO amzn/ion-java/issues/18 Currently, we check imports by their refs. which
        //      might be overly strict; imports which are not the same ref.
        //      but have the same semantic states fails the extension check.
        if (! myImportsList.equalImports(subset.myImportsList))
            return false;

        int subLocalSymbolCount = subset.mySymbolsCount;

        // Superset extends subset if subset doesn't have any declared symbols.
        if (subLocalSymbolCount == 0) return true;

        // Superset must have same/more declared (local) symbols than subset.
        if (mySymbolsCount < subLocalSymbolCount) return false;

        String[] subsetSymbols = subset.mySymbolNames;

        // Before we go through the expensive iteration from the front,
        // check the last (largest) declared symbol in subset beforehand
        if (! safeEquals(mySymbolNames[subLocalSymbolCount- 1],
                                  subsetSymbols[subLocalSymbolCount- 1]))
        {
            return false;
        }

        // Now, we iterate from the first declared symbol, note that the
        // iteration below is O(n)!
        for (int i = 0; i < subLocalSymbolCount - 1; i++)
        {
            if (! safeEquals(mySymbolNames[i], subsetSymbols[i]))
                return false;
        }

        return true;
    }
863128
private Segment compactGroup(List<Segment> segments, List<OffsetPredicate> predicates) {
    // Get the first segment which contains the first index being compacted. The compact segment will be written
    // as a newer version of the earliest segment being rewritten.
    Segment firstSegment = segments.iterator().next();

    // Create a compacted segment with a newer version to which to rewrite the segment entries.
    Segment compactSegment = manager.createSegment(SegmentDescriptor.builder()
      .withId(firstSegment.descriptor().id())
      .withVersion(firstSegment.descriptor().version() + 1)
      .withIndex(firstSegment.descriptor().index())
      .withMaxSegmentSize(Math.max(segments.stream().mapToLong(s -> s.descriptor().maxSegmentSize()).max().getAsLong(), manager.storage().maxSegmentSize()))
      .withMaxEntries(Math.max(segments.stream().mapToInt(s -> s.descriptor().maxEntries()).max().getAsInt(), manager.storage().maxEntriesPerSegment()))
      .build());

    compactGroup(segments, predicates, compactSegment);

    // Replace the rewritten segments with the updated segment.
    manager.replaceSegments(segments, compactSegment);

    return compactSegment;
  }
559356
private LinearClassifier<L, L> fitSigmoid(SVMLightClassifier<L, F> classifier, GeneralDataset<L, F> dataset) {
    RVFDataset<L, L> plattDataset = new RVFDataset<L, L>();
    for (int i = 0; i < dataset.size(); i++) {
      RVFDatum<L, F> d = dataset.getRVFDatum(i);
      Counter<L> scores = classifier.scoresOf((Datum<L,F>)d);
      scores.incrementCount(null);
      plattDataset.add(new RVFDatum<L, L>(scores, d.label()));
    }
    LinearClassifierFactory<L, L> factory = new LinearClassifierFactory<L, L>();
    factory.setPrior(new LogPrior(LogPrior.LogPriorType.NULL));
    return factory.trainClassifier(plattDataset);
  }
467637
function(cls,superClass) {
    var super_;
    while (lib.type.isFunction(cls.super_)) {
      if (cls.super_ === superClass) {
        super_ = cls.super_;
        break;
      }
      cls = cls.super_;
    }
    return super_;
  }
1366610
@Override
    public DTDSubset combineWithExternalSubset(InputProblemReporter rep, DTDSubset extSubset)
        throws XMLStreamException
    {
        /* First let's see if we can just reuse GE Map used by int or ext
         * subset; (if only one has contents), or if not, combine them.
         */
        HashMap<String,EntityDecl> ge1 = getGeneralEntityMap();
        HashMap<String,EntityDecl> ge2 = extSubset.getGeneralEntityMap();
        if (ge1 == null || ge1.isEmpty()) {
            ge1 = ge2;
        } else {
            if (ge2 != null && !ge2.isEmpty()) {
                /* Internal subset Objects are never shared or reused (and by
                 * extension, neither are objects they contain), so we can just
                 * modify GE map if necessary
                 */
                combineMaps(ge1, ge2);
            }
        }

        // Ok, then, let's combine notations similarly
        HashMap<String,NotationDeclaration> n1 = getNotationMap();
        HashMap<String,NotationDeclaration> n2 = extSubset.getNotationMap();
        if (n1 == null || n1.isEmpty()) {
            n1 = n2;
        } else {
            if (n2 != null && !n2.isEmpty()) {
                /* First; let's make sure there are no colliding notation
                 * definitions: it's an error to try to redefine notations.
                 */
                checkNotations(n1, n2);

                /* Internal subset Objects are never shared or reused (and by
                 * extension, neither are objects they contain), so we can just
                 * modify notation map if necessary
                 */
                combineMaps(n1, n2);
            }
        }


        // And finally elements, rather similarly:
        HashMap<PrefixedName,DTDElement> e1 = getElementMap();
        HashMap<PrefixedName,DTDElement> e2 = extSubset.getElementMap();
        if (e1 == null || e1.isEmpty()) {
            e1 = e2;
        } else {
            if (e2 != null && !e2.isEmpty()) {
                /* Internal subset Objects are never shared or reused (and by
                 * extension, neither are objects they contain), so we can just
                 * modify element map if necessary
                 */
                combineElements(rep, e1, e2);
            }
        }

        /* Combos are not cachable, and because of that, there's no point
         * in storing any PE info either.
         */
        return constructInstance(false, ge1, null, null, null, n1, e1,
                                 mFullyValidating);
    }
317505
function compact (array) {
  array = array || [];
  return array.filter(function(el) {
    return el === 0 || Boolean(el).valueOf();
  });
}
52477
function objectSubset (obj, names) {
  let result = {}
  for (let i = 0; i < names.length; i++) {
    if (obj[names[i]] !== undefined) {
      result[names[i]] = obj[names[i]]
    }
  }
  return result
}
794374
protected Set<Class<? extends S>> findInstanceAbleScript(Set<Class<? extends S>> scriptClazzs)
			throws InstantiationException, IllegalAccessException {
		Set<Class<? extends S>> result=new HashSet<>();
		for (Class<? extends S> scriptClazz : scriptClazzs) 
		{
			if(isInstanceAble(scriptClazz))
			{
				result.add(scriptClazz);
			}
		}
		return result;
	}
881944
def classifiers(self):
        
        objects = javabridge.get_env().get_object_array_elements(
            javabridge.call(self.jobject, "getClassifiers", "()[Lweka/classifiers/Classifier;"))
        result = []
        for obj in objects:
            result.append(Classifier(jobject=obj))
        return result
881626
def _get_class(self, superclass, namespace=None,
                   local_only=False, include_qualifiers=True,
                   include_classorigin=True):
        
        return self.GetClass(superclass,
                             namespace=namespace,
                             local_only=local_only,
                             include_qualifiers=include_qualifiers,
                             include_classorigin=include_classorigin)
162426
public function getCompactors()
    {
        $compactors = array();

        if (isset($this->raw->compactors)) {
            foreach ((array) $this->raw->compactors as $class) {
                if (false === class_exists($class)) {
                    throw new InvalidArgumentException(
                        sprintf(
                            'The compactor class "%s" does not exist.',
                            $class
                        )
                    );
                }

                $compactor = new $class();

                if (false === ($compactor instanceof CompactorInterface)) {
                    throw new InvalidArgumentException(
                        sprintf(
                            'The class "%s" is not a compactor class.',
                            $class
                        )
                    );
                }

                if ($compactor instanceof Php) {
                    if (!empty($this->raw->annotations)) {
                        $tokenizer = new Tokenizer();

                        if (isset($this->raw->annotations->ignore)) {
                            $tokenizer->ignore(
                                (array) $this->raw->annotations->ignore
                            );
                        }

                        $compactor->setTokenizer($tokenizer);
                    }
                }

                $compactors[] = $compactor;
            }
        }

        return $compactors;
    }
330558
@Pure
	public static Map<ShapeElementType, MapElementGroup> classifiesElements(Collection<? extends MapElement> elements) {
		return classifiesElements(elements.iterator());
	}
1020219
function arrayContainsArray(superset, subset, some) {
  if (Array.isArray(superset) !== true) { throw new Error(`[ethjs-util] method arrayContainsArray requires input 'superset' to be an array got type '${typeof superset}'`); }
  if (Array.isArray(subset) !== true) { throw new Error(`[ethjs-util] method arrayContainsArray requires input 'subset' to be an array got type '${typeof subset}'`); }

  return subset[Boolean(some) && 'some' || 'every']((value) => (superset.indexOf(value) >= 0));
}
453461
public Set<ClassDescriptor> getSubtypes(ClassDescriptor classDescriptor) throws ClassNotFoundException {
        Set<ClassDescriptor> result = subtypeSetMap.get(classDescriptor);
        if (result == null) {
            result = computeKnownSubtypes(classDescriptor);
            subtypeSetMap.put(classDescriptor, result);
        }
        return result;
    }
253757
function _gpfClassSuperCreate (superMember) {
    var superMethod;
    if (typeof superMember === "function") {
        superMethod = superMember;
    } else {
        superMethod = _gpfClassNoSuper;
    }
    return _gpfClassSuperCreateWithSameSignature(superMethod);
}
1011140
private Set<String> getJarMemberSet(String absolutePathToJar) {
		/*
		 * Note:
		 * Our implementation returns a HashSet. initialCapacity and loadFactor are carefully tweaked for speed and RAM optimization purposes.
		 * 
		 * Benchmark:
		 * The HashSet implementation is about 10% slower to build (only happens once) than the ArrayList.
		 * The HashSet with shiftBits = 1 was about 33 times(!) faster than the ArrayList for retrievals.
		 */
		try {
			int shiftBits = 1;  //  (fast, but big)  0 <= shiftBits <= 5, say  (slower & compact)
			JarFile jar = new JarFile(absolutePathToJar);
			
			/*
			 * Find the first power of 2 >= JarSize (as calculated in HashSet constructor)
			 */
			int jarSizePower2 = Integer.highestOneBit(jar.size());
			if (jarSizePower2 != jar.size()) jarSizePower2 <<= 1;
			if (jarSizePower2 == 0) jarSizePower2 = 1;
			
			Set<String> jarMembers = new HashSet<String>(jarSizePower2 >> shiftBits,  1 << shiftBits);
			try {
				Enumeration<JarEntry> entries = jar.entries();
				while (entries.hasMoreElements()) {
					JarEntry jarEntry = entries.nextElement();
					if (jarEntry.isDirectory()) continue;
					jarMembers.add(jarEntry.getName());
				}
			} catch (Exception ignore) {
				// ignored; if the jar can't be read, treating it as if the jar contains no classes is just what we want.
			} finally {
				jar.close();
			}
			return jarMembers;
		}
		catch (Exception newJarFileException) {
			return Collections.emptySet();
		}
	}