_id
stringlengths
2
7
title
stringlengths
3
140
partition
stringclasses
3 values
text
stringlengths
73
34.1k
language
stringclasses
1 value
meta_information
dict
q176900
ResponseHeadersConfigurer.addNoCacheHeaders
test
private static void addNoCacheHeaders(final Map<String, String> map) { map.put(HttpHeader.PRAGMA.toString(), "no-cache"); map.put(HttpHeader.CACHE_CONTROL.toString(), "no-cache"); map.put(HttpHeader.EXPIRES.toString(), "0"); }
java
{ "resource": "" }
q176901
WroUtil.getPathInfoFromLocation
test
public static String getPathInfoFromLocation(final HttpServletRequest request, final String location) { if (StringUtils.isEmpty(location)) { throw new IllegalArgumentException("Location cannot be empty string!"); } final String contextPath = request.getContextPath(); if (contextPath != null) ...
java
{ "resource": "" }
q176902
WroUtil.getServletPathFromLocation
test
public static String getServletPathFromLocation(final HttpServletRequest request, final String location) { return location.replace(getPathInfoFromLocation(request, location), StringUtils.EMPTY); }
java
{ "resource": "" }
q176903
WroUtil.matchesUrl
test
public static boolean matchesUrl(final HttpServletRequest request, final String path) { final Pattern pattern = Pattern.compile(".*" + path + "[/]?", Pattern.CASE_INSENSITIVE); if (request.getRequestURI() != null) { final Matcher m = pattern.matcher(request.getRequestURI()); return m.matches(); ...
java
{ "resource": "" }
q176904
WroUtil.loadRegexpWithKey
test
public static String loadRegexpWithKey(final String key) { InputStream stream = null; try { stream = WroUtil.class.getResourceAsStream("regexp.properties"); final Properties props = new RegexpProperties().load(stream); return props.getProperty(key); } catch (final IOException e) { ...
java
{ "resource": "" }
q176905
WroUtil.safeCopy
test
public static void safeCopy(final Reader reader, final Writer writer) throws IOException { try { IOUtils.copy(reader, writer); } finally { IOUtils.closeQuietly(reader); IOUtils.closeQuietly(writer); } }
java
{ "resource": "" }
q176906
WroUtil.createTempFile
test
public static File createTempFile(final String extension) { try { final String fileName = String.format("wro4j-%s.%s", UUID.randomUUID().toString(), extension); final File file = new File(createTempDirectory(), fileName); file.createNewFile(); return file; } catch (final IOExceptio...
java
{ "resource": "" }
q176907
WroUtil.cleanImageUrl
test
public static final String cleanImageUrl(final String imageUrl) { notNull(imageUrl); return imageUrl.replace('\'', ' ').replace('\"', ' ').trim(); }
java
{ "resource": "" }
q176908
ServletContextAttributeHelper.setAttribute
test
final void setAttribute(final Attribute attribute, final Object object) { Validate.notNull(attribute); LOG.debug("setting attribute: {} with value: {}", attribute, object); Validate.isTrue(attribute.isValid(object), object + " is not of valid subType for attribute: " + attribute); servletContext.setAttr...
java
{ "resource": "" }
q176909
DataUriGenerator.generateDataURI
test
public String generateDataURI(final InputStream inputStream, final String fileName) throws IOException { final StringWriter writer = new StringWriter(); final byte[] bytes = IOUtils.toByteArray(inputStream); inputStream.close(); final String mimeType = getMimeType(fileName); // actually write...
java
{ "resource": "" }
q176910
DataUriGenerator.generateDataURI
test
private void generateDataURI(final byte[] bytes, final Writer out, final String mimeType) throws IOException { // create the output final StringBuffer buffer = new StringBuffer(); buffer.append(DATA_URI_PREFIX); // add MIME type buffer.append(mimeType); // output base64-encoding ...
java
{ "resource": "" }
q176911
Context.set
test
public static void set(final Context context, final WroConfiguration config) { notNull(context); notNull(config); context.setConfig(config); final String correlationId = generateCorrelationId(); CORRELATION_ID.set(correlationId); CONTEXT_MAP.put(correlationId, context); }
java
{ "resource": "" }
q176912
Context.unset
test
public static void unset() { final String correlationId = CORRELATION_ID.get(); if (correlationId != null) { CONTEXT_MAP.remove(correlationId); } CORRELATION_ID.remove(); }
java
{ "resource": "" }
q176913
ResourceWatcher.check
test
public void check(final CacheKey cacheKey, final Callback callback) { notNull(cacheKey); LOG.debug("started"); final StopWatch watch = new StopWatch(); watch.start("detect changes"); try { final Group group = new WroModelInspector(modelFactory.create()).getGroupByName(cacheKey.getGroupName());...
java
{ "resource": "" }
q176914
ResourceWatcher.onException
test
protected void onException(final Exception e) { // not using ERROR log intentionally, since this error is not that important LOG.info("Could not check for resource changes because: {}", e.getMessage()); LOG.debug("[FAIL] detecting resource change ", e); }
java
{ "resource": "" }
q176915
ResourceWatcher.checkResourceChange
test
private void checkResourceChange(final Resource resource, final Group group, final Callback callback, final AtomicBoolean isChanged) throws Exception { if (isChanged(resource, group.getName())) { isChanged.compareAndSet(false, true); callback.onResourceChanged(resource); lifecycleCallb...
java
{ "resource": "" }
q176916
ResourceChangeInfo.updateHashForGroup
test
public void updateHashForGroup(final String hash, final String groupName) { notNull(groupName); this.currentHash = hash; if (isChangedHash()) { LOG.debug("Group {} has changed", groupName); //remove all persisted groups. Starting over.. groups.clear(); } }
java
{ "resource": "" }
q176917
Group.hasResourcesOfType
test
public final boolean hasResourcesOfType(final ResourceType resourceType) { notNull(resourceType, "ResourceType cannot be null!"); for (final Resource resource : resources) { if (resourceType.equals(resource.getType())) { return true; } } return false; }
java
{ "resource": "" }
q176918
NodeTypeScriptProcessor.createProcess
test
private Process createProcess(final File sourceFile, final File destFile) throws IOException { notNull(sourceFile); final String[] commandLine = getCommandLine(sourceFile.getPath(), destFile.getPath()); LOG.debug("CommandLine arguments: {}", Arrays.asList(commandLine)); final Process process = new...
java
{ "resource": "" }
q176919
Base64.encodeObject
test
public static String encodeObject(final java.io.Serializable serializableObject) throws java.io.IOException { return encodeObject(serializableObject, NO_OPTIONS); }
java
{ "resource": "" }
q176920
XmlModelFactory.processGroups
test
private void processGroups(final Document document) { // handle imports final NodeList groupNodeList = document.getElementsByTagName(TAG_GROUP); for (int i = 0; i < groupNodeList.getLength(); i++) { final Element groupElement = (Element) groupNodeList.item(i); final String name = groupEleme...
java
{ "resource": "" }
q176921
XmlModelFactory.parseGroup
test
private Collection<Resource> parseGroup(final Element element) { final String name = element.getAttribute(ATTR_GROUP_NAME); final String isAbstractAsString = element.getAttribute(ATTR_GROUP_ABSTRACT); final boolean isAbstractGroup = StringUtils.isNotEmpty(isAbstractAsString) && Boolean.valueOf(isAbstract...
java
{ "resource": "" }
q176922
XmlModelFactory.createGroup
test
protected Group createGroup(final Element element) { final String name = element.getAttribute(ATTR_GROUP_NAME); final Group group = new Group(name); final List<Resource> resources = new ArrayList<Resource>(); final NodeList resourceNodeList = element.getChildNodes(); for (int i = 0; i < resourc...
java
{ "resource": "" }
q176923
XmlModelFactory.parseResource
test
private void parseResource(final Element resourceElement, final Collection<Resource> resources) { final String tagName = resourceElement.getTagName(); final String uri = resourceElement.getTextContent(); if (TAG_GROUP_REF.equals(tagName)) { // uri in this case is the group name resources.ad...
java
{ "resource": "" }
q176924
XmlModelFactory.getResourcesForGroup
test
private Collection<Resource> getResourcesForGroup(final String groupName) { final WroModelInspector modelInspector = new WroModelInspector(model); final Group foundGroup = modelInspector.getGroupByName(groupName); if (foundGroup == null) { final Element groupElement = allGroupElements.get(groupNam...
java
{ "resource": "" }
q176925
ElkTimer.log
test
public void log(Logger logger, LogLevel priority) { if (LoggerWrap.isEnabledFor(logger, priority)) { String timerLabel; if (threadId != 0) { timerLabel = name + " (thread " + threadId + ")"; } else if (threadCount > 1) { timerLabel = name + " (over " + threadCount + " threads)"; } else { timer...
java
{ "resource": "" }
q176926
ElkTimer.stopNamedTimer
test
public static long stopNamedTimer(String timerName, int todoFlags, long threadId) { ElkTimer key = new ElkTimer(timerName, todoFlags, threadId); if (registeredTimers.containsKey(key)) { return registeredTimers.get(key).stop(); } else { return -1; } }
java
{ "resource": "" }
q176927
ElkTimer.getNamedTimer
test
public static ElkTimer getNamedTimer(String timerName, int todoFlags) { return getNamedTimer(timerName, todoFlags, Thread.currentThread() .getId()); }
java
{ "resource": "" }
q176928
ElkTimer.getNamedTimer
test
public static ElkTimer getNamedTimer(String timerName, int todoFlags, long threadId) { ElkTimer key = new ElkTimer(timerName, todoFlags, threadId); ElkTimer previous = registeredTimers.putIfAbsent(key, key); if (previous != null) { return previous; } // else return key; }
java
{ "resource": "" }
q176929
ClassExpressionSaturationFactory.printStatistics
test
public void printStatistics() { ruleApplicationFactory_.getSaturationStatistics().print(LOGGER_); if (LOGGER_.isDebugEnabled()) { if (aggregatedStats_.jobsSubmittedNo > 0) LOGGER_.debug( "Saturation Jobs Submitted=Done+Processed: {}={}+{}", aggregatedStats_.jobsSubmittedNo, aggregatedStats_...
java
{ "resource": "" }
q176930
ClassExpressionSaturationFactory.wakeUpWorkers
test
private void wakeUpWorkers() { if (!workersWaiting_) { return; } stopWorkersLock_.lock(); try { workersWaiting_ = false; thereAreContextsToProcess_.signalAll(); } finally { stopWorkersLock_.unlock(); } }
java
{ "resource": "" }
q176931
ClassExpressionSaturationFactory.updateProcessedCounters
test
private void updateProcessedCounters(int snapshotFinishedWorkers) { if (isInterrupted()) { wakeUpWorkers(); return; } if (countStartedWorkers_.get() > snapshotFinishedWorkers) { /* * We are not the last worker processing the saturation state, so * the current jobs and contexts may not be processe...
java
{ "resource": "" }
q176932
ClassExpressionSaturationFactory.updateFinishedCounters
test
private void updateFinishedCounters(ThisStatistics localStatistics) throws InterruptedException { int snapshotJobsProcessed = countJobsProcessedLower_.get(); /* * ensure that all contexts for processed jobs are marked as saturated */ for (;;) { int snapshotCountContextsSaturatedLower = countContextsSa...
java
{ "resource": "" }
q176933
ClassExpressionSaturationFactory.updateIfSmaller
test
private static boolean updateIfSmaller(AtomicInteger counter, int value) { for (;;) { int snapshotCoutner = counter.get(); if (snapshotCoutner >= value) return false; if (counter.compareAndSet(snapshotCoutner, value)) return true; } }
java
{ "resource": "" }
q176934
DummyRuleVisitor.defaultVisit
test
protected <P> O defaultVisit(Rule<P> rule, P premise, ContextPremises premises, ClassInferenceProducer producer) { if (LOGGER_.isTraceEnabled()) { LOGGER_.trace("ignore {} by {} in {}", premise, rule, premises); } return null; }
java
{ "resource": "" }
q176935
ObjectPropertyTaxonomyComputationFactory.instertIntoTaxonomy
test
private void instertIntoTaxonomy(final IndexedObjectProperty property) { /* * @formatter:off * * Transitive reduction and taxonomy computation * if sub-properties of a sub-property contain this property, * they are equivalent * if a property is a strict sub-property of another strict sub-prop...
java
{ "resource": "" }
q176936
AbstractReasonerState.ensureLoading
test
public synchronized void ensureLoading() throws ElkException { if (!isLoadingFinished()) { if (isIncrementalMode()) { if (!stageManager.incrementalAdditionStage.isCompleted()) { complete(stageManager.incrementalAdditionStage); } } else { if (!stageManager.contextInitializationStage.isCompleted...
java
{ "resource": "" }
q176937
AbstractReasonerState.restoreSaturation
test
private void restoreSaturation() throws ElkException { ensureLoading(); final boolean changed; if (isIncrementalMode()) { changed = !stageManager.incrementalTaxonomyCleaningStage .isCompleted(); complete(stageManager.incrementalTaxonomyCleaningStage); } else { changed = !stageManager.contextIni...
java
{ "resource": "" }
q176938
AbstractReasonerState.isInconsistent
test
public synchronized boolean isInconsistent() throws ElkException { restoreConsistencyCheck(); if (!consistencyCheckingState.isInconsistent()) { incompleteness_.log(incompleteness_ .getIncompletenessMonitorForClassification()); } return consistencyCheckingState.isInconsistent(); }
java
{ "resource": "" }
q176939
AbstractReasonerState.restoreTaxonomy
test
protected Taxonomy<ElkClass> restoreTaxonomy() throws ElkInconsistentOntologyException, ElkException { ruleAndConclusionStats.reset(); // also restores saturation and cleans the taxonomy if necessary restoreConsistencyCheck(); if (consistencyCheckingState.isInconsistent()) { throw new ElkInconsistentOnt...
java
{ "resource": "" }
q176940
AbstractReasonerState.restoreInstanceTaxonomy
test
protected InstanceTaxonomy<ElkClass, ElkNamedIndividual> restoreInstanceTaxonomy() throws ElkInconsistentOntologyException, ElkException { ruleAndConclusionStats.reset(); // also restores saturation and cleans the taxonomy if necessary restoreConsistencyCheck(); if (consistencyCheckingState.isInconsistent(...
java
{ "resource": "" }
q176941
ConsistencyCheckingState.getEvidence
test
public Proof<? extends EntailmentInference> getEvidence( final boolean atMostOne) { return new Proof<EntailmentInference>() { @SuppressWarnings("unchecked") @Override public Collection<OntologyInconsistencyEntailmentInference> getInferences( final Object conclusion) { if (!OntologyInconsistenc...
java
{ "resource": "" }
q176942
AbstractReasonerStage.preExecute
test
@Override public boolean preExecute() { if (isInitialized_) return false; LOGGER_.trace("{}: initialized", this); this.workerNo = reasoner.getNumberOfWorkers(); return isInitialized_ = true; }
java
{ "resource": "" }
q176943
AbstractReasonerStage.invalidateRecursive
test
public void invalidateRecursive() { Queue<AbstractReasonerStage> toInvalidate_ = new LinkedList<AbstractReasonerStage>(); toInvalidate_.add(this); AbstractReasonerStage next; while ((next = toInvalidate_.poll()) != null) { if (next.invalidate()) { for (AbstractReasonerStage postStage : next.postStages_) ...
java
{ "resource": "" }
q176944
InstanceTaxonomyState.getToAdd
test
Collection<IndexedIndividual> getToAdd() { if (taxonomy_ == null) { // No individual can be pruned. return toAdd_; } // else final int size = pruneToAdd(); /* * since getting the size of the queue is a linear operation, use the * computed size */ return Operations.getCollection(toAdd_, size);...
java
{ "resource": "" }
q176945
InstanceTaxonomyState.getToRemove
test
Collection<IndexedIndividual> getToRemove() { if (taxonomy_ == null) {// TODO: Never set taxonomy_ to null !!! // no individuals are in taxonomy toRemove_.clear(); return Collections.emptyList(); } // else final int size = pruneToRemove(); /* * since getting the size of the queue is a linear opera...
java
{ "resource": "" }
q176946
ElkReasoner.unsupportedOwlApiMethod
test
private static UnsupportedOperationException unsupportedOwlApiMethod( String method) { String message = "OWL API reasoner method is not implemented: " + method + "."; /* * TODO: The method String can be used to create more specific message * types, but with the current large amount of unsupported metho...
java
{ "resource": "" }
q176947
LinearProbing.remove
test
static <E> void remove(E[] d, int pos) { for (;;) { int next = getMovedPosition(d, pos); E moved = d[pos] = d[next]; if (moved == null) return; // else pos = next; } }
java
{ "resource": "" }
q176948
LinearProbing.remove
test
static <K, V> void remove(K[] k, V[] v, int pos) { for (;;) { int next = getMovedPosition(k, pos); K moved = k[pos] = k[next]; v[pos] = v[next]; if (moved == null) return; // else pos = next; } }
java
{ "resource": "" }
q176949
LinearProbing.getMovedPosition
test
static <E> int getMovedPosition(E[] d, int del) { int j = del; for (;;) { if (++j == d.length) j = 0; // invariant: interval ]del, j] contains only non-null elements // whose index is in ]del, j] E test = d[j]; if (test == null) return j; int k = getIndex(test, d.length); // check if k ...
java
{ "resource": "" }
q176950
LinearProbing.contains
test
static <E> boolean contains(E[] d, Object o) { int pos = getPosition(d, o); if (d[pos] == null) return false; // else return true; }
java
{ "resource": "" }
q176951
LinearProbing.add
test
static <E> boolean add(E[] d, E e) { int pos = getPosition(d, e); if (d[pos] == null) { d[pos] = e; return true; } // else the element is already there return false; }
java
{ "resource": "" }
q176952
CachedIndexedComplexClassExpressionImpl.checkOccurrenceNumbers
test
public final void checkOccurrenceNumbers() { if (LOGGER_.isTraceEnabled()) LOGGER_.trace(toString() + " occurences: " + printOccurrenceNumbers()); if (positiveOccurrenceNo < 0 || negativeOccurrenceNo < 0) throw new ElkUnexpectedIndexingException(toString() + " has a negative occurrence: " + printOcc...
java
{ "resource": "" }
q176953
ClassConclusionTimer.add
test
public synchronized void add(ClassConclusionTimer timer) { this.timeComposedSubsumers += timer.timeComposedSubsumers; this.timeDecomposedSubsumers += timer.timeDecomposedSubsumers; this.timeBackwardLinks += timer.timeBackwardLinks; this.timeForwardLinks += timer.timeForwardLinks; this.timeContradictions += ti...
java
{ "resource": "" }
q176954
RuleApplicationTimer.add
test
public synchronized void add(RuleApplicationTimer timer) { timeOwlThingContextInitRule += timer.timeOwlThingContextInitRule; timeRootContextInitializationRule += timer.timeRootContextInitializationRule; timeDisjointSubsumerFromMemberRule += timer.timeDisjointSubsumerFromMemberRule; timeContradictionFromNegation...
java
{ "resource": "" }
q176955
ArrayHashMap.putKeyValue
test
private static <K, V> V putKeyValue(K[] keys, V[] values, K key, V value) { int pos = LinearProbing.getPosition(keys, key); if (keys[pos] == null) { keys[pos] = key; values[pos] = value; return null; } // else V oldValue = values[pos]; values[pos] = value; return oldValue; }
java
{ "resource": "" }
q176956
ArrayHashMap.removeEntry
test
private static <K, V> V removeEntry(K[] keys, V[] values, Object key) { int pos = LinearProbing.getPosition(keys, key); if (keys[pos] == null) return null; // else V result = values[pos]; LinearProbing.remove(keys, values, pos); return result; }
java
{ "resource": "" }
q176957
ArrayHashMap.enlarge
test
private void enlarge() { int oldCapacity = keys.length; if (oldCapacity == LinearProbing.MAXIMUM_CAPACITY) throw new IllegalArgumentException( "Map cannot grow beyond capacity: " + LinearProbing.MAXIMUM_CAPACITY); K oldKeys[] = keys; V oldValues[] = values; int newCapacity = oldCapacity << 1; ...
java
{ "resource": "" }
q176958
ArrayHashMap.shrink
test
private void shrink() { int oldCapacity = keys.length; if (oldCapacity <= LinearProbing.DEFAULT_INITIAL_CAPACITY) return; K oldKeys[] = keys; V oldValues[] = values; int newCapacity = oldCapacity >> 1; @SuppressWarnings("unchecked") K newKeys[] = (K[]) new Object[newCapacity]; @SuppressWarnings("unch...
java
{ "resource": "" }
q176959
ConfigurationFactory.saveConfiguration
test
public void saveConfiguration(File configOnDisk, BaseConfiguration config) throws ConfigurationException, IOException { /* * Unfortunately, we can't directly write the config on disk because the * parameters in it may be just a subset of those on disk. So we load it * first (alternatively one may use a si...
java
{ "resource": "" }
q176960
OreTaxonomyPrinter.printDeclarations
test
protected static void printDeclarations(Taxonomy<ElkClass> classTaxonomy, ElkObject.Factory objectFactory, Appendable writer) throws IOException { List<ElkClass> classes = new ArrayList<ElkClass>(classTaxonomy .getNodes().size() * 2); for (TaxonomyNode<ElkClass> classNode : classTaxonomy.getNodes()) { ...
java
{ "resource": "" }
q176961
TaxonomyNodeUtils.getAllInstanceNodes
test
public static <T extends ElkEntity, I extends ElkEntity, TN extends GenericTypeNode<T, I, TN, IN>, IN extends GenericInstanceNode<T, I, TN, IN>> Set<? extends IN> getAllInstanceNodes(final GenericTypeNode<T, I, TN, IN> node) { return TaxonomyNodeUtils.collectFromAllReachable( node.getDirectSubNodes(), node...
java
{ "resource": "" }
q176962
EntryCollection.clear
test
@Override public void clear() { modCount++; E[] tab = buckets; for (int i = 0; i < tab.length; i++) tab[i] = null; size = 0; }
java
{ "resource": "" }
q176963
HashGenerator.combineMultisetHash
test
public static int combineMultisetHash(boolean finalize, int... hashes) { int hash = 0; for (int h : hashes) { hash = hash + h; } if (finalize) { hash = combineListHash(hash); } return hash; }
java
{ "resource": "" }
q176964
HashGenerator.combineListHash
test
public static int combineListHash(int... hashes) { int hash = 0; for (int h : hashes) { hash += h; hash += (hash << 10); hash ^= (hash >> 6); } hash += (hash << 3); hash ^= (hash >> 11); hash += (hash << 15); return hash; }
java
{ "resource": "" }
q176965
IOUtils.copy
test
public static int copy(InputStream input, OutputStream output) throws IOException { byte[] buffer = new byte[BUFFER_SIZE]; BufferedInputStream in = new BufferedInputStream(input, BUFFER_SIZE); BufferedOutputStream out = new BufferedOutputStream(output, BUFFER_SIZE); int count = 0, n = 0; try { while (...
java
{ "resource": "" }
q176966
IncompletenessManager.getReasonerIncompletenessMonitor
test
public IncompletenessMonitor getReasonerIncompletenessMonitor( final IncompletenessMonitor... additionalMonitors) { final List<IncompletenessMonitor> monitors = new ArrayList<IncompletenessMonitor>( additionalMonitors.length + 1); monitors.add(getIncompletenessDueToStatedAxiomsMonitor()); monitors.addAll(A...
java
{ "resource": "" }
q176967
TaxonomyPrinter.processTaxomomy
test
protected static <T extends ElkEntity> void processTaxomomy( final Taxonomy<T> taxonomy, final Appendable writer) throws IOException { final ElkObject.Factory factory = new ElkObjectEntityRecyclingFactory(); // Declarations. final List<T> members = new ArrayList<T>( taxonomy.getNodes().size() * 2);...
java
{ "resource": "" }
q176968
ConcurrentComputationWithInputs.submit
test
public synchronized boolean submit(I input) throws InterruptedException { if (termination || isInterrupted()) return false; buffer_.put(input); return true; }
java
{ "resource": "" }
q176969
OwlFunctionalStylePrinter.append
test
public static void append(Appendable appender, ElkObject elkObject) throws IOException { append(appender, elkObject, false); }
java
{ "resource": "" }
q176970
ClassExpressionQueryState.markNotComputed
test
private QueryState markNotComputed( final IndexedClassExpression queryClass) { final QueryState state = indexed_.get(queryClass); if (state == null || !state.isComputed) { return null; } state.isComputed = false; if (state.node != null) { removeAllRelated(queryClass, state.node); state.node = null...
java
{ "resource": "" }
q176971
IndividualNode.addDirectTypeNode
test
@Override public synchronized void addDirectTypeNode(final UTN typeNode) { LOGGER_.trace("{}: new direct type-node {}", this, typeNode); directTypeNodes_.add(typeNode); }
java
{ "resource": "" }
q176972
AbstractMatch.checkChainMatch
test
protected static void checkChainMatch( final ElkSubObjectPropertyExpression fullChain, final int startPos) { // verifies that start position exists in full chain fullChain.accept(new ElkSubObjectPropertyExpressionVisitor<Void>() { void fail() { throw new IllegalArgumentException(fullChain + ", " + sta...
java
{ "resource": "" }
q176973
Operations.filter
test
public static <T> Set<T> filter(final Set<? extends T> input, final Condition<? super T> condition, final int size) { return new Set<T>() { @Override public int size() { return size; } @Override public boolean isEmpty() { return size == 0; } @Override @SuppressWarnings("unchecked...
java
{ "resource": "" }
q176974
Operations.map
test
public static <I, O> Set<O> map(final Set<? extends I> input, final FunctorEx<I, O> functor) { return new AbstractSet<O>() { @Override public Iterator<O> iterator() { return new MapIterator<I, O>(input.iterator(), functor); } @Override public boolean contains(Object o) { I element = functo...
java
{ "resource": "" }
q176975
ArraySlicedSet.add
test
public boolean add(int s, E e) { if (e == null) throw new NullPointerException(); int mask = (1 << s); int oldMask = addMask(logs, data, masks, e, mask); int newMask = oldMask | mask; if (newMask == oldMask) return false; else if (oldMask == 0 && ++occupied == LinearProbing.getUpperSize(data.lengt...
java
{ "resource": "" }
q176976
ArraySlicedSet.remove
test
public boolean remove(int s, Object o) { if (o == null) throw new NullPointerException(); int mask = 1 << s; int oldMask = removeMask(logs, data, masks, o, mask); int newMask = oldMask & ~mask; if (newMask == oldMask) return false; // else if (newMask == 0 && --occupied == LinearProbing.getLower...
java
{ "resource": "" }
q176977
ClassConclusionCounter.add
test
public synchronized void add(ClassConclusionCounter counter) { this.countSubClassInclusionDecomposed += counter.countSubClassInclusionDecomposed; this.countSubClassInclusionComposed += counter.countSubClassInclusionComposed; this.countBackwardLink += counter.countBackwardLink; this.countForwardLink += counter.c...
java
{ "resource": "" }
q176978
Statistics.logMemoryUsage
test
public static void logMemoryUsage(Logger logger, LogLevel priority) { if (LoggerWrap.isEnabledFor(logger, priority)) { // Getting the runtime reference from system Runtime runtime = Runtime.getRuntime(); LoggerWrap.log(logger, priority, "Memory (MB) Used/Total/Max: " + (runtime.totalMemory() - runti...
java
{ "resource": "" }
q176979
Reasoner.setConfigurationOptions
test
public synchronized void setConfigurationOptions( ReasonerConfiguration config) { this.workerNo_ = config.getParameterAsInt( ReasonerConfiguration.NUM_OF_WORKING_THREADS); setAllowIncrementalMode(config.getParameterAsBoolean( ReasonerConfiguration.INCREMENTAL_MODE_ALLOWED)); }
java
{ "resource": "" }
q176980
Reasoner.shutdown
test
public synchronized boolean shutdown(long timeout, TimeUnit unit) throws InterruptedException { boolean success = true; if (success) { LOGGER_.info("ELK reasoner has shut down"); } else { LOGGER_.error("ELK reasoner failed to shut down!"); } return success; }
java
{ "resource": "" }
q176981
StatisticsPrinter.printHeader
test
public void printHeader() { printSeparator(); addPadding(' ', headerParams_); logger_.debug(String.format(headerFormat_, headerParams_)); printSeparator(); }
java
{ "resource": "" }
q176982
StatisticsPrinter.print
test
public void print(Object... values) { addPadding('.', values); logger_.debug(String.format(valuesFormat_, values)); }
java
{ "resource": "" }
q176983
StatisticsPrinter.getString
test
static String getString(char c, int n) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < n; i++) { sb.append(c); } return sb.toString(); }
java
{ "resource": "" }
q176984
RuleCounter.add
test
public synchronized void add(RuleCounter counter) { countOwlThingContextInitRule += counter.countOwlThingContextInitRule; countRootContextInitializationRule += counter.countRootContextInitializationRule; countDisjointSubsumerFromMemberRule += counter.countDisjointSubsumerFromMemberRule; countContradictionFromNe...
java
{ "resource": "" }
q176985
XhtmlResourceMessageConverter.writeResource
test
private void writeResource(XhtmlWriter writer, Object object) { if (object == null) { return; } try { if (object instanceof Resource) { Resource<?> resource = (Resource<?>) object; writer.beginListItem(); writeResource(writ...
java
{ "resource": "" }
q176986
SpringActionDescriptor.getActionInputParameter
test
@Override public ActionInputParameter getActionInputParameter(String name) { ActionInputParameter ret = requestParams.get(name); if (ret == null) { ret = pathVariables.get(name); } if (ret == null) { for (ActionInputParameter annotatedParameter : getInputParam...
java
{ "resource": "" }
q176987
SpringActionDescriptor.getPropertyDescriptorForPropertyPath
test
PropertyDescriptor getPropertyDescriptorForPropertyPath(String propertyPath, Class<?> propertyType) { int pos = PropertyAccessorUtils.getFirstNestedPropertySeparatorIndex(propertyPath); // Handle nested properties recursively. if (pos > -1) { String nestedProperty = propertyPath.subs...
java
{ "resource": "" }
q176988
SpringActionDescriptor.getRequiredParameters
test
@Override public Map<String, ActionInputParameter> getRequiredParameters() { Map<String, ActionInputParameter> ret = new HashMap<String, ActionInputParameter>(); for (Map.Entry<String, ActionInputParameter> entry : requestParams.entrySet()) { ActionInputParameter annotatedParameter = ent...
java
{ "resource": "" }
q176989
DataType.isSingleValueType
test
public static boolean isSingleValueType(Class<?> clazz) { boolean ret; if (isNumber(clazz) || isBoolean(clazz) || isString(clazz) || isEnum(clazz) || isDate(clazz) || isCalendar(clazz) || isCurrency(clazz) ...
java
{ "resource": "" }
q176990
Affordance.addRel
test
public void addRel(String rel) { Assert.hasLength(rel); linkParams.add(REL.paramName, rel); }
java
{ "resource": "" }
q176991
Affordance.setType
test
public void setType(String mediaType) { if (mediaType != null) linkParams.set(TYPE.paramName, mediaType); else linkParams.remove(TYPE.paramName); }
java
{ "resource": "" }
q176992
Affordance.addHreflang
test
public void addHreflang(String hreflang) { Assert.hasLength(hreflang); linkParams.add(HREFLANG.paramName, hreflang); }
java
{ "resource": "" }
q176993
Affordance.addRev
test
public void addRev(String rev) { Assert.hasLength(rev); linkParams.add(REV.paramName, rev); }
java
{ "resource": "" }
q176994
Affordance.addLinkParam
test
public void addLinkParam(String paramName, String... values) { Assert.notEmpty(values); for (String value : values) { Assert.hasLength(value); linkParams.add(paramName, value); } }
java
{ "resource": "" }
q176995
Affordance.expand
test
@Override public Affordance expand(Map<String, ? extends Object> arguments) { UriTemplate template = new UriTemplate(partialUriTemplate.asComponents() .toString()); String expanded = template.expand(arguments) .toASCIIString(); return new Affordance(expanded, ...
java
{ "resource": "" }
q176996
Affordance.getRels
test
@JsonIgnore public List<String> getRels() { final List<String> rels = linkParams.get(REL.paramName); return rels == null ? Collections.<String>emptyList() : Collections.unmodifiableList(rels); }
java
{ "resource": "" }
q176997
Affordance.getRevs
test
@JsonIgnore public List<String> getRevs() { final List<String> revs = linkParams.get(REV.paramName); return revs == null ? Collections.<String>emptyList() : Collections.unmodifiableList(revs); }
java
{ "resource": "" }
q176998
Affordance.hasUnsatisfiedRequiredVariables
test
@JsonIgnore public boolean hasUnsatisfiedRequiredVariables() { for (ActionDescriptor actionDescriptor : actionDescriptors) { Map<String, ActionInputParameter> requiredParameters = actionDescriptor.getRequiredParameters(); for (ActionInputParameter annotatedParame...
java
{ "resource": "" }
q176999
SpringActionInputParameter.getValueFormatted
test
public String getValueFormatted() { String ret; if (value == null) { ret = null; } else { ret = (String) conversionService.convert(value, typeDescriptor, TypeDescriptor.valueOf(String.class)); } return ret; }
java
{ "resource": "" }