_id
stringlengths
2
7
title
stringlengths
3
140
partition
stringclasses
3 values
text
stringlengths
73
34.1k
language
stringclasses
1 value
meta_information
dict
q26900
SteeringAcceleration.mulAdd
train
public SteeringAcceleration<T> mulAdd (SteeringAcceleration<T> steering, float scalar) { linear.mulAdd(steering.linear, scalar); angular += steering.angular * scalar; return this; }
java
{ "resource": "" }
q26901
MessageDispatcher.addListener
train
public void addListener (Telegraph listener, int msg) { Array<Telegraph> listeners = msgListeners.get(msg); if (listeners == null) { // Associate an empty unordered array with the message code listeners = new Array<Telegraph>(false, 16); msgListeners.put(msg, listeners); } listeners.add(listener); /...
java
{ "resource": "" }
q26902
SteeringBehavior.calculateSteering
train
public SteeringAcceleration<T> calculateSteering (SteeringAcceleration<T> steering) { return isEnabled() ? calculateRealSteering(steering) : steering.setZero(); }
java
{ "resource": "" }
q26903
Formation.updateSlotAssignments
train
public void updateSlotAssignments () { // Apply the strategy to update slot assignments slotAssignmentStrategy.updateSlotAssignments(slotAssignments); // Set the newly calculated number of slots pattern.setNumberOfSlots(slotAssignmentStrategy.calculateNumberOfSlots(slotAssignments)); // Update the drift off...
java
{ "resource": "" }
q26904
Formation.changePattern
train
public boolean changePattern (FormationPattern<T> pattern) { // Find out how many slots we have occupied int occupiedSlots = slotAssignments.size; // Check if the pattern supports one more slot if (pattern.supportsSlots(occupiedSlots)) { setPattern(pattern); // Update the slot assignments and return suc...
java
{ "resource": "" }
q26905
Formation.addMember
train
public boolean addMember (FormationMember<T> member) { // Find out how many slots we have occupied int occupiedSlots = slotAssignments.size; // Check if the pattern supports one more slot if (pattern.supportsSlots(occupiedSlots + 1)) { // Add a new slot assignment slotAssignments.add(new SlotAssignment<T...
java
{ "resource": "" }
q26906
Formation.removeMember
train
public void removeMember (FormationMember<T> member) { // Find the member's slot int slot = findMemberSlot(member); // Make sure we've found a valid result if (slot >= 0) { // Remove the slot // slotAssignments.removeIndex(slot); slotAssignmentStrategy.removeSlotAssignment(slotAssignments, slot); ...
java
{ "resource": "" }
q26907
Formation.updateSlots
train
public void updateSlots () { // Find the anchor point Location<T> anchor = getAnchorPoint(); positionOffset.set(anchor.getPosition()); float orientationOffset = anchor.getOrientation(); if (motionModerator != null) { positionOffset.sub(driftOffset.getPosition()); orientationOffset -= driftOffset.getOri...
java
{ "resource": "" }
q26908
BehaviorTreeReader.containsFloatingPointCharacters
train
private static boolean containsFloatingPointCharacters (String value) { for (int i = 0, n = value.length(); i < n; i++) { switch (value.charAt(i)) { case '.': case 'E': case 'e': return true; } } return false; }
java
{ "resource": "" }
q26909
DefaultStateMachine.handleMessage
train
@Override public boolean handleMessage (Telegram telegram) { // First see if the current state is valid and that it can handle the message if (currentState != null && currentState.onMessage(owner, telegram)) { return true; } // If not, and if a global state has been implemented, send // the message to t...
java
{ "resource": "" }
q26910
CircularBuffer.store
train
public boolean store (T item) { if (size == items.length) { if (!resizable) return false; // Resize this queue resize(Math.max(8, (int)(items.length * 1.75f))); } size++; items[tail++] = item; if (tail == items.length) tail = 0; return true; }
java
{ "resource": "" }
q26911
CircularBuffer.clear
train
public void clear () { final T[] items = this.items; if (tail > head) { int i = head, n = tail; do { items[i++] = null; } while (i < n); } else if (size > 0) { // NOTE: when head == tail the buffer can be empty or full for (int i = head, n = items.length; i < n; i++) items[i] = null; for (i...
java
{ "resource": "" }
q26912
CircularBuffer.resize
train
protected void resize (int newCapacity) { @SuppressWarnings("unchecked") T[] newItems = (T[])ArrayReflection.newInstance(items.getClass().getComponentType(), newCapacity); if (tail > head) { System.arraycopy(items, head, newItems, 0, size); } else if (size > 0) { // NOTE: when head == tail the buffer can be ...
java
{ "resource": "" }
q26913
BehaviorTree.addChildToTask
train
@Override protected int addChildToTask (Task<E> child) { if (this.rootTask != null) throw new IllegalStateException("A behavior tree cannot have more than one root task"); this.rootTask = child; return 0; }
java
{ "resource": "" }
q26914
FormationMotionModerator.calculateDriftOffset
train
public Location<T> calculateDriftOffset (Location<T> centerOfMass, Array<SlotAssignment<T>> slotAssignments, FormationPattern<T> pattern) { // Clear the center of mass centerOfMass.getPosition().setZero(); float centerOfMassOrientation = 0; // Make sure tempLocation is instantiated if (tempLocation == nul...
java
{ "resource": "" }
q26915
CliCommandLineConsumer.consumeCommandLineInput
train
static CliReceivedCommand consumeCommandLineInput(ParseResult providedCommand, @SuppressWarnings("SameParameterValue") Iterable<CliDeclaredOptionSpec> declaredOptions) { assumeTrue(providedCommand.hasSubcommand(), "Command was empty, expected one of: " + Arrays.toString(CliCommandType.values())); ...
java
{ "resource": "" }
q26916
MiscUtil.encodeText
train
@Nullable public static String encodeText(@Nullable final String name) { if (name == null) { return null; } try { return MimeUtility.encodeText(name); } catch (final UnsupportedEncodingException e) { throw new IllegalArgumentException(e.getMessage(), e); } }
java
{ "resource": "" }
q26917
MimeMessageParser.parseMimeMessage
train
public static ParsedMimeMessageComponents parseMimeMessage(@Nonnull final MimeMessage mimeMessage) { final ParsedMimeMessageComponents parsedComponents = new ParsedMimeMessageComponents(); parsedComponents.messageId = parseMessageId(mimeMessage); parsedComponents.subject = parseSubject(mimeMessage); parsedCompo...
java
{ "resource": "" }
q26918
MimeMessageParser.isMimeType
train
@SuppressWarnings("WeakerAccess") public static boolean isMimeType(@Nonnull final MimePart part, @Nonnull final String mimeType) { // Do not use part.isMimeType(String) as it is broken for MimeBodyPart // and does not really check the actual content type. try { final ContentType contentType = new ContentType...
java
{ "resource": "" }
q26919
MimeMessageParser.createDataSource
train
@Nonnull private static DataSource createDataSource(@Nonnull final MimePart part) { final DataHandler dataHandler = retrieveDataHandler(part); final DataSource dataSource = dataHandler.getDataSource(); final String contentType = parseBaseMimeType(dataSource.getContentType()); final byte[] content = readContent...
java
{ "resource": "" }
q26920
ConfigLoader.loadProperties
train
public static Map<Property, Object> loadProperties(final String filename, final boolean addProperties) { final InputStream input = ConfigLoader.class.getClassLoader().getResourceAsStream(filename); if (input != null) { return loadProperties(input, addProperties); } LOGGER.debug("Property file not found on cl...
java
{ "resource": "" }
q26921
ConfigLoader.loadProperties
train
public static Map<Property, Object> loadProperties(final Properties properties, final boolean addProperties) { if (!addProperties) { RESOLVED_PROPERTIES.clear(); } RESOLVED_PROPERTIES.putAll(readProperties(properties)); return unmodifiableMap(RESOLVED_PROPERTIES); }
java
{ "resource": "" }
q26922
MimeMessageHelper.determineResourceName
train
static String determineResourceName(final AttachmentResource attachmentResource, final boolean includeExtension) { final String datasourceName = attachmentResource.getDataSource().getName(); String resourceName; if (!valueNullOrEmpty(attachmentResource.getName())) { resourceName = attachmentResource.getName(...
java
{ "resource": "" }
q26923
NamedDataSource.getEncoding
train
@Override @Nullable public String getEncoding() { return (this.dataSource instanceof EncodingAware) ? ((EncodingAware) this.dataSource).getEncoding() : null; }
java
{ "resource": "" }
q26924
AsyncOperationHelper.executeAsync
train
static AsyncResponse executeAsync(final @Nonnull String processName, final @Nonnull Runnable operation) { return executeAsync(newSingleThreadExecutor(), processName, operation, true); }
java
{ "resource": "" }
q26925
AsyncOperationHelper.executeAsync
train
static AsyncResponse executeAsync(final @Nonnull ExecutorService executorService, final @Nonnull String processName, final @Nonnull Runnable operation) { return executeAsync(executorService, processName, operation, false); }
java
{ "resource": "" }
q26926
MailSenderImpl.checkShutDownRunningProcesses
train
private synchronized void checkShutDownRunningProcesses() { smtpRequestsPhaser.arriveAndDeregister(); LOGGER.trace("SMTP request threads left: {}", smtpRequestsPhaser.getUnarrivedParties()); // if this thread is the last one finishing if (smtpRequestsPhaser.getUnarrivedParties() == 0) { ...
java
{ "resource": "" }
q26927
RequestHelper.isNewSession
train
public boolean isNewSession() { Session session = handlerInput.getRequestEnvelope().getSession(); if (session == null) { throw new IllegalArgumentException("The provided request doesn't contain a session"); } return session.getNew(); }
java
{ "resource": "" }
q26928
CustomSkill.invoke
train
protected ResponseEnvelope invoke(UnmarshalledRequest<RequestEnvelope> unmarshalledRequest, Object context) { RequestEnvelope requestEnvelope = unmarshalledRequest.getUnmarshalledRequest(); JsonNode requestEnvelopeJson = unmarshalledRequest.getRequestJson(); if (skillId != null && !requestEnvel...
java
{ "resource": "" }
q26929
SkillRequestSignatureVerifier.retrieveAndVerifyCertificateChain
train
private X509Certificate retrieveAndVerifyCertificateChain( final String signingCertificateChainUrl) throws CertificateException { try (InputStream in = proxy != null ? getAndVerifySigningCertificateChainUrl(signingCertificateChainUrl).openConnection(proxy).getInputStream() ...
java
{ "resource": "" }
q26930
Predicates.requestType
train
public static <T extends Request> Predicate<HandlerInput> requestType(Class<T> requestType) { return i -> requestType.isInstance(i.getRequestEnvelope().getRequest()); }
java
{ "resource": "" }
q26931
LocaleTemplateEnumerator.next
train
@Override public String next() { if (hasNext()) { if (enumerationSize == NULL_LOCALE_ENUMERATION_SIZE) { cursor++; return templateName; } final String language = matcher.group(1); final String country = matcher.group(2); ...
java
{ "resource": "" }
q26932
AttributesManager.setSessionAttributes
train
public void setSessionAttributes(Map<String, Object> sessionAttributes) { if (requestEnvelope.getSession() == null) { throw new IllegalStateException("Attempting to set session attributes for out of session request"); } this.sessionAttributes = sessionAttributes; }
java
{ "resource": "" }
q26933
PartitionKeyGenerators.userId
train
public static Function<RequestEnvelope, String> userId() { return r -> Optional.ofNullable(r).map(RequestEnvelope::getContext) .map(Context::getSystem) .map(SystemState::getUser) .map(User::getUserId) .orElseThrow(() -> new PersistenceException("Co...
java
{ "resource": "" }
q26934
PartitionKeyGenerators.deviceId
train
public static Function<RequestEnvelope, String> deviceId() { return r -> Optional.ofNullable(r).map(RequestEnvelope::getContext) .map(Context::getSystem) .map(SystemState::getDevice) .map(Device::getDeviceId) .orElseThrow(() -> new PersistenceExcep...
java
{ "resource": "" }
q26935
DefaultPluginFactory.create
train
@Override public Plugin create(final PluginWrapper pluginWrapper) { String pluginClassName = pluginWrapper.getDescriptor().getPluginClass(); log.debug("Create instance for plugin '{}'", pluginClassName); Class<?> pluginClass; try { pluginClass = pluginWrapper.getPluginCl...
java
{ "resource": "" }
q26936
DirectedGraph.addVertex
train
public void addVertex(V vertex) { if (containsVertex(vertex)) { return; } neighbors.put(vertex, new ArrayList<V>()); }
java
{ "resource": "" }
q26937
DirectedGraph.addEdge
train
public void addEdge(V from, V to) { addVertex(from); addVertex(to); neighbors.get(from).add(to); }
java
{ "resource": "" }
q26938
DirectedGraph.removeEdge
train
public void removeEdge(V from, V to) { if (!containsVertex(from)) { throw new IllegalArgumentException("Nonexistent vertex " + from); } if (!containsVertex(to)) { throw new IllegalArgumentException("Nonexistent vertex " + to); } neighbors.get(from).remov...
java
{ "resource": "" }
q26939
AbstractPluginManager.getPlugins
train
@Override public List<PluginWrapper> getPlugins(PluginState pluginState) { List<PluginWrapper> plugins = new ArrayList<>(); for (PluginWrapper plugin : getPlugins()) { if (pluginState.equals(plugin.getPluginState())) { plugins.add(plugin); } } ...
java
{ "resource": "" }
q26940
AbstractPluginManager.loadPlugins
train
@Override public void loadPlugins() { log.debug("Lookup plugins in '{}'", pluginsRoot); // check for plugins root if (Files.notExists(pluginsRoot) || !Files.isDirectory(pluginsRoot)) { log.warn("No '{}' root", pluginsRoot); return; } // get all plugin...
java
{ "resource": "" }
q26941
AbstractPluginManager.startPlugins
train
@Override public void startPlugins() { for (PluginWrapper pluginWrapper : resolvedPlugins) { PluginState pluginState = pluginWrapper.getPluginState(); if ((PluginState.DISABLED != pluginState) && (PluginState.STARTED != pluginState)) { try { log.in...
java
{ "resource": "" }
q26942
AbstractPluginManager.startPlugin
train
@Override public PluginState startPlugin(String pluginId) { checkPluginId(pluginId); PluginWrapper pluginWrapper = getPlugin(pluginId); PluginDescriptor pluginDescriptor = pluginWrapper.getDescriptor(); PluginState pluginState = pluginWrapper.getPluginState(); if (PluginStat...
java
{ "resource": "" }
q26943
AbstractPluginManager.stopPlugins
train
@Override public void stopPlugins() { // stop started plugins in reverse order Collections.reverse(startedPlugins); Iterator<PluginWrapper> itr = startedPlugins.iterator(); while (itr.hasNext()) { PluginWrapper pluginWrapper = itr.next(); PluginState pluginSta...
java
{ "resource": "" }
q26944
AbstractPluginManager.idForPath
train
protected String idForPath(Path pluginPath) { for (PluginWrapper plugin : plugins.values()) { if (plugin.getPluginPath().equals(pluginPath)) { return plugin.getPluginId(); } } return null; }
java
{ "resource": "" }
q26945
AbstractPluginManager.validatePluginDescriptor
train
protected void validatePluginDescriptor(PluginDescriptor descriptor) throws PluginException { if (StringUtils.isNullOrEmpty(descriptor.getPluginId())) { throw new PluginException("Field 'id' cannot be empty"); } if (descriptor.getVersion() == null) { throw new PluginExce...
java
{ "resource": "" }
q26946
FileUtils.findWithEnding
train
public static Path findWithEnding(Path basePath, String... endings) { for (String ending : endings) { Path newPath = basePath.resolveSibling(basePath.getFileName() + ending); if (Files.exists(newPath)) { return newPath; } } return null; }
java
{ "resource": "" }
q26947
FileUtils.isZipFile
train
public static boolean isZipFile(Path path) { return Files.isRegularFile(path) && path.toString().toLowerCase().endsWith(".zip"); }
java
{ "resource": "" }
q26948
FileUtils.isJarFile
train
public static boolean isJarFile(Path path) { return Files.isRegularFile(path) && path.toString().toLowerCase().endsWith(".jar"); }
java
{ "resource": "" }
q26949
DefaultPluginManager.loadPluginFromPath
train
@Override protected PluginWrapper loadPluginFromPath(Path pluginPath) throws PluginException { // First unzip any ZIP files try { pluginPath = FileUtils.expandIfZip(pluginPath); } catch (Exception e) { log.warn("Failed to unzip " + pluginPath, e); return n...
java
{ "resource": "" }
q26950
SSLContextSpi.engineGetSupportedSSLParameters
train
protected SSLParameters engineGetSupportedSSLParameters() { SSLSocket socket = getDefaultSocket(); SSLParameters params = new SSLParameters(); params.setCipherSuites(socket.getSupportedCipherSuites()); params.setProtocols(socket.getSupportedProtocols()); return params; }
java
{ "resource": "" }
q26951
DateTimeTextProvider.createEntry
train
private static <A, B> Entry<A, B> createEntry(A text, B field) { return new SimpleImmutableEntry<>(text, field); }
java
{ "resource": "" }
q26952
CertificateVersion.construct
train
private void construct(DerValue derVal) throws IOException { if (derVal.isConstructed() && derVal.isContextSpecific()) { derVal = derVal.data.getDerValue(); version = derVal.getInteger(); if (derVal.data.available() != 0) { throw new IOException("X.509 version...
java
{ "resource": "" }
q26953
CertificateVersion.encode
train
public void encode(OutputStream out) throws IOException { // Nothing for default if (version == V1) { return; } DerOutputStream tmp = new DerOutputStream(); tmp.putInteger(version); DerOutputStream seq = new DerOutputStream(); seq.write(DerValue.creat...
java
{ "resource": "" }
q26954
AttributesImpl.getIndex
train
public int getIndex (String uri, String localName) { int max = length * 5; for (int i = 0; i < max; i += 5) { if (data[i].equals(uri) && data[i+1].equals(localName)) { return i / 5; } } return -1; }
java
{ "resource": "" }
q26955
AttributesImpl.getType
train
public String getType (String uri, String localName) { int max = length * 5; for (int i = 0; i < max; i += 5) { if (data[i].equals(uri) && data[i+1].equals(localName)) { return data[i+3]; } } return null; }
java
{ "resource": "" }
q26956
AttributesImpl.clear
train
public void clear () { if (data != null) { for (int i = 0; i < (length * 5); i++) data [i] = null; } length = 0; }
java
{ "resource": "" }
q26957
AttributesImpl.setAttributes
train
public void setAttributes (Attributes atts) { clear(); length = atts.getLength(); if (length > 0) { data = new String[length*5]; for (int i = 0; i < length; i++) { data[i*5] = atts.getURI(i); data[i*5+1] = atts.getLocalName(i); ...
java
{ "resource": "" }
q26958
AttributesImpl.addAttribute
train
public void addAttribute (String uri, String localName, String qName, String type, String value) { ensureCapacity(length+1); data[length*5] = uri; data[length*5+1] = localName; data[length*5+2] = qName; data[length*5+3] = type; data[length*5+4] = value; length++; }
java
{ "resource": "" }
q26959
AttributesImpl.setAttribute
train
public void setAttribute (int index, String uri, String localName, String qName, String type, String value) { if (index >= 0 && index < length) { data[index*5] = uri; data[index*5+1] = localName; data[index*5+2] = qName; data[index*5+3] = type; data[inde...
java
{ "resource": "" }
q26960
AttributesImpl.setURI
train
public void setURI (int index, String uri) { if (index >= 0 && index < length) { data[index*5] = uri; } else { badIndex(index); } }
java
{ "resource": "" }
q26961
AttributesImpl.setLocalName
train
public void setLocalName (int index, String localName) { if (index >= 0 && index < length) { data[index*5+1] = localName; } else { badIndex(index); } }
java
{ "resource": "" }
q26962
AttributesImpl.setQName
train
public void setQName (int index, String qName) { if (index >= 0 && index < length) { data[index*5+2] = qName; } else { badIndex(index); } }
java
{ "resource": "" }
q26963
AttributesImpl.setType
train
public void setType (int index, String type) { if (index >= 0 && index < length) { data[index*5+3] = type; } else { badIndex(index); } }
java
{ "resource": "" }
q26964
AttributesImpl.setValue
train
public void setValue (int index, String value) { if (index >= 0 && index < length) { data[index*5+4] = value; } else { badIndex(index); } }
java
{ "resource": "" }
q26965
AttributesImpl.ensureCapacity
train
private void ensureCapacity (int n) { if (n <= 0) { return; } int max; if (data == null || data.length == 0) { max = 25; } else if (data.length >= n * 5) { return; } else { max = data.length; } ...
java
{ "resource": "" }
q26966
UCharacterNameReader.read
train
protected void read(UCharacterName data) throws IOException { // reading index m_tokenstringindex_ = m_byteBuffer_.getInt(); m_groupindex_ = m_byteBuffer_.getInt(); m_groupstringindex_ = m_byteBuffer_.getInt(); m_algnamesindex_ = m_byteBuffer_.getInt(); // r...
java
{ "resource": "" }
q26967
UCharacterNameReader.readAlg
train
private UCharacterName.AlgorithmName readAlg() throws IOException { UCharacterName.AlgorithmName result = new UCharacterName.AlgorithmName(); int rangestart = m_byteBuffer_.getInt(); int rangeend = m_byteBuffer_.getInt(); byte type = m_by...
java
{ "resource": "" }
q26968
TypeGenerator.getMethodSignature
train
protected String getMethodSignature(MethodDeclaration m) { StringBuilder sb = new StringBuilder(); ExecutableElement element = m.getExecutableElement(); char prefix = Modifier.isStatic(m.getModifiers()) ? '+' : '-'; String returnType = nameTable.getObjCType(element.getReturnType()); String selector ...
java
{ "resource": "" }
q26969
Cache.newSoftMemoryCache
train
public static <K,V> Cache<K,V> newSoftMemoryCache(int size) { return new MemoryCache<>(true, size); }
java
{ "resource": "" }
q26970
Cache.newHardMemoryCache
train
public static <K,V> Cache<K,V> newHardMemoryCache(int size) { return new MemoryCache<>(false, size); }
java
{ "resource": "" }
q26971
Cache.newNullCache
train
@SuppressWarnings("unchecked") public static <K,V> Cache<K,V> newNullCache() { return (Cache<K,V>) NullCache.INSTANCE; }
java
{ "resource": "" }
q26972
MemoryCache.emptyQueue
train
private void emptyQueue() { if (queue == null) { return; } int startSize = cacheMap.size(); while (true) { @SuppressWarnings("unchecked") CacheEntry<K,V> entry = (CacheEntry<K,V>)queue.poll(); if (entry == null) { break; ...
java
{ "resource": "" }
q26973
MemoryCache.expungeExpiredEntries
train
private void expungeExpiredEntries() { emptyQueue(); if (lifetime == 0) { return; } int cnt = 0; long time = System.currentTimeMillis(); for (Iterator<CacheEntry<K,V>> t = cacheMap.values().iterator(); t.hasNext(); ) { CacheEntry<K,...
java
{ "resource": "" }
q26974
MemoryCache.accept
train
public synchronized void accept(CacheVisitor<K,V> visitor) { expungeExpiredEntries(); Map<K,V> cached = getCachedEntries(); visitor.visit(cached); }
java
{ "resource": "" }
q26975
UCharacterIterator.currentCodePoint
train
public int currentCodePoint() { int ch = current(); if (UTF16.isLeadSurrogate((char) ch)) { // advance the index to get the // next code point next(); // due to post increment semantics // current() after next() actually // returns ...
java
{ "resource": "" }
q26976
CharTrie.getSurrogateOffset
train
@Override protected final int getSurrogateOffset(char lead, char trail) { if (m_dataManipulate_ == null) { throw new NullPointerException( "The field DataManipulate in this Trie is null"); } // get fold position for the next trail surrogate ...
java
{ "resource": "" }
q26977
CheckedOutputStream.write
train
public void write(byte[] b, int off, int len) throws IOException { out.write(b, off, len); cksum.update(b, off, len); }
java
{ "resource": "" }
q26978
PollArrayWrapper.addEntry
train
void addEntry(SelChImpl sc) { putDescriptor(totalChannels, IOUtil.fdVal(sc.getFD())); putEventOps(totalChannels, 0); putReventOps(totalChannels, 0); totalChannels++; }
java
{ "resource": "" }
q26979
PollArrayWrapper.replaceEntry
train
static void replaceEntry(PollArrayWrapper source, int sindex, PollArrayWrapper target, int tindex) { target.putDescriptor(tindex, source.getDescriptor(sindex)); target.putEventOps(tindex, source.getEventOps(sindex)); target.putReventOps(tindex, source.getReventOps(sindex));...
java
{ "resource": "" }
q26980
SimpleFilteredSentenceBreakIterator.breakExceptionAt
train
private final boolean breakExceptionAt(int n) { // Note: the C++ version of this function is SimpleFilteredSentenceBreakIterator::breakExceptionAt() int bestPosn = -1; int bestValue = -1; // loops while 'n' points to an exception text.setIndex(n); backwardsTrie.reset();...
java
{ "resource": "" }
q26981
Log.setWtfHandler
train
public static TerribleFailureHandler setWtfHandler(TerribleFailureHandler handler) { if (handler == null) { throw new NullPointerException("handler == null"); } TerribleFailureHandler oldHandler = sWtfHandler; sWtfHandler = handler; return oldHandler; }
java
{ "resource": "" }
q26982
KeyGenerator.init
train
public final void init(AlgorithmParameterSpec params, SecureRandom random) throws InvalidAlgorithmParameterException { if (serviceIterator == null) { spi.engineInit(params, random); return; } Exception failure = null; KeyGeneratorSpi mySpi = spi; ...
java
{ "resource": "" }
q26983
KeyGenerator.init
train
public final void init(int keysize, SecureRandom random) { if (serviceIterator == null) { spi.engineInit(keysize, random); return; } RuntimeException failure = null; KeyGeneratorSpi mySpi = spi; do { try { mySpi.engineInit(keysi...
java
{ "resource": "" }
q26984
NamespaceSupport.reset
train
public void reset () { contexts = new Context[32]; namespaceDeclUris = false; contextPos = 0; contexts[contextPos] = currentContext = new Context(); currentContext.declarePrefix("xml", XMLNS); }
java
{ "resource": "" }
q26985
NamespaceSupport.pushContext
train
public void pushContext () { int max = contexts.length; contexts [contextPos].declsOK = false; contextPos++; // Extend the array if necessary if (contextPos >= max) { Context newContexts[] = new Context[max*2]; System.arraycopy(contexts, 0, newContexts, 0, max); ...
java
{ "resource": "" }
q26986
NamespaceSupport.getPrefixes
train
public Enumeration getPrefixes(String uri) { ArrayList<String> prefixes = new ArrayList<String>(); Enumeration allPrefixes = getPrefixes(); while (allPrefixes.hasMoreElements()) { String prefix = (String) allPrefixes.nextElement(); if (uri.equals(getURI(prefix))) { ...
java
{ "resource": "" }
q26987
MeasureUnit.getAvailable
train
public synchronized static Set<MeasureUnit> getAvailable(String type) { populateCache(); Map<String, MeasureUnit> units = cache.get(type); // Train users not to modify returned set from the start giving us more // flexibility for implementation. return units == null ? Collections...
java
{ "resource": "" }
q26988
MeasureUnit.getAvailable
train
public synchronized static Set<MeasureUnit> getAvailable() { Set<MeasureUnit> result = new HashSet<MeasureUnit>(); for (String type : new HashSet<String>(MeasureUnit.getAvailableTypes())) { for (MeasureUnit unit : MeasureUnit.getAvailable(type)) { result.add(unit); ...
java
{ "resource": "" }
q26989
MeasureUnit.resolveUnitPerUnit
train
@Deprecated public static MeasureUnit resolveUnitPerUnit(MeasureUnit unit, MeasureUnit perUnit) { return unitPerUnitToSingleUnit.get(Pair.of(unit, perUnit)); }
java
{ "resource": "" }
q26990
MatchOps.makeRef
train
public static <T> TerminalOp<T, Boolean> makeRef(Predicate<? super T> predicate, MatchKind matchKind) { Objects.requireNonNull(predicate); Objects.requireNonNull(matchKind); class MatchSink extends BooleanTerminalSink<T> { MatchSink() { super(matchKind); ...
java
{ "resource": "" }
q26991
StrictMath.floorOrCeil
train
private static double floorOrCeil(double a, double negativeBoundary, double positiveBoundary, double sign) { int exponent = Math.getExponent(a); if (exponent < 0) { /* ...
java
{ "resource": "" }
q26992
TemplateList.dumpAssociationTables
train
void dumpAssociationTables() { Enumeration associations = m_patternTable.elements(); while (associations.hasMoreElements()) { TemplateSubPatternAssociation head = (TemplateSubPatternAssociation) associations.nextElement(); while (null != head) { System.out.print("(" + ...
java
{ "resource": "" }
q26993
TemplateList.compose
train
public void compose(StylesheetRoot sroot) { if (DEBUG) { System.out.println("Before wildcard insert..."); dumpAssociationTables(); } if (null != m_wildCardPatterns) { Enumeration associations = m_patternTable.elements(); while (associations.hasMoreElements()) { ...
java
{ "resource": "" }
q26994
TemplateList.insertAssociationIntoList
train
private TemplateSubPatternAssociation insertAssociationIntoList(TemplateSubPatternAssociation head, TemplateSubPatternAssociation item, boolean isWildCardInsert) { // Sort first by import level (higher level is at fro...
java
{ "resource": "" }
q26995
TemplateList.insertPatternInTable
train
private void insertPatternInTable(StepPattern pattern, ElemTemplate template) { String target = pattern.getTargetString(); if (null != target) { String pstring = template.getMatch().getPatternString(); TemplateSubPatternAssociation association = new TemplateSubPatternAssociation(temp...
java
{ "resource": "" }
q26996
TemplateList.getPriorityOrScore
train
private double getPriorityOrScore(TemplateSubPatternAssociation matchPat) { double priority = matchPat.getTemplate().getPriority(); if (priority == XPath.MATCH_SCORE_NONE) { Expression ex = matchPat.getStepPattern(); if (ex instanceof NodeTest) { return ((NodeTest) ex).getDefa...
java
{ "resource": "" }
q26997
TemplateList.getHead
train
public TemplateSubPatternAssociation getHead(XPathContext xctxt, int targetNode, DTM dtm) { short targetNodeType = dtm.getNodeType(targetNode); TemplateSubPatternAssociation head; switch (targetNodeType) { case DTM.ELEMENT_NODE : case DTM.ATTRIB...
java
{ "resource": "" }
q26998
TemplateList.getTemplateFast
train
public ElemTemplate getTemplateFast(XPathContext xctxt, int targetNode, int expTypeID, QName mode, int maxImportLevel, boolean quietConflictWarnings, ...
java
{ "resource": "" }
q26999
TemplateList.getTemplate
train
public ElemTemplate getTemplate(XPathContext xctxt, int targetNode, QName mode, boolean quietConflictWarnings, DTM dtm) throws TransformerException { TemplateSubPatternAssoc...
java
{ "resource": "" }