method
stringlengths
13
441k
clean_method
stringlengths
7
313k
doc
stringlengths
17
17.3k
comment
stringlengths
3
1.42k
method_name
stringlengths
1
273
extra
dict
imports
sequence
imports_info
stringlengths
19
34.8k
cluster_imports_info
stringlengths
15
3.66k
libraries
sequence
libraries_info
stringlengths
6
661
id
int64
0
2.92M
private FlushNewPageResult flushNewPage(DataPage page, DataPage spareDataPage) { if (page.immutable) { LOGGER.log(Level.SEVERE, "Attempt to flush an immutable page {0} as it was mutable", page.pageId); throw new IllegalStateException("page " + page.pageId + " is not a new page!"); } page.pageLock.readLock().lock(); try { if (!page.writable) { LOGGER.log(Level.INFO, "Mutable page {0} already flushed in a concurrent thread", page.pageId); return FlushNewPageResult.ALREADY_FLUSHED; } } finally { page.pageLock.readLock().unlock(); } final Lock lock = page.pageLock.writeLock(); lock.lock(); try { if (!page.writable) { LOGGER.log(Level.INFO, "Mutable page {0} already flushed in a concurrent thread", page.pageId); return FlushNewPageResult.ALREADY_FLUSHED; } boolean drop = page.isEmpty(); if (!drop) { pageSet.pageCreated(page.pageId, page); } DataPage remove = newPages.remove(page.pageId); if (remove == null) { LOGGER.log(Level.SEVERE, "Detected concurrent flush of page {0}, writable: {1}", new Object[]{page.pageId, page.writable}); throw new IllegalStateException("page " + page.pageId + " is not a new page!"); } page.writable = false; if (drop) { LOGGER.log(Level.INFO, "Deleted empty mutable page {0} instead of flushing it", page.pageId); return FlushNewPageResult.EMPTY_FLUSH; } } finally { lock.unlock(); } // Try to steal records from another temporary page if (spareDataPage != null) { final long usedMemory = page.getUsedMemory(); final long buildingPageMemory = spareDataPage.getUsedMemory(); boolean add = true; final Iterator<Record> records = spareDataPage.getRecordsForFlush().iterator(); while (add && records.hasNext()) { Record record = records.next().nonShared(); add = page.put(record); if (add) { boolean moved = keyToPage.put(record.key, page.pageId, spareDataPage.pageId); if (!moved) { LOGGER.log(Level.SEVERE, "Detected a dirty page as spare data page while flushing new page. Flushing new page {0}. Spare data page {1}", new Object[]{page, spareDataPage}); throw new IllegalStateException( "Expected a clean page for stealing records, got a dirty record " + record.key + ". Flushing new page " + page.pageId + ". Spare data page " + spareDataPage.pageId); } records.remove(); } } long spareUsedMemory = page.getUsedMemory() - usedMemory; spareDataPage.setUsedMemory(buildingPageMemory - spareUsedMemory); } LOGGER.log(Level.FINER, "flushNewPage table {0}, pageId={1} with {2} records, {3} logical page size", new Object[]{table.name, page.pageId, page.size(), page.getUsedMemory()}); dataStorageManager.writePage(tableSpaceUUID, table.uuid, page.pageId, page.getRecordsForFlush()); return FlushNewPageResult.FLUSHED; }
FlushNewPageResult function(DataPage page, DataPage spareDataPage) { if (page.immutable) { LOGGER.log(Level.SEVERE, STR, page.pageId); throw new IllegalStateException(STR + page.pageId + STR); } page.pageLock.readLock().lock(); try { if (!page.writable) { LOGGER.log(Level.INFO, STR, page.pageId); return FlushNewPageResult.ALREADY_FLUSHED; } } finally { page.pageLock.readLock().unlock(); } final Lock lock = page.pageLock.writeLock(); lock.lock(); try { if (!page.writable) { LOGGER.log(Level.INFO, STR, page.pageId); return FlushNewPageResult.ALREADY_FLUSHED; } boolean drop = page.isEmpty(); if (!drop) { pageSet.pageCreated(page.pageId, page); } DataPage remove = newPages.remove(page.pageId); if (remove == null) { LOGGER.log(Level.SEVERE, STR, new Object[]{page.pageId, page.writable}); throw new IllegalStateException(STR + page.pageId + STR); } page.writable = false; if (drop) { LOGGER.log(Level.INFO, STR, page.pageId); return FlushNewPageResult.EMPTY_FLUSH; } } finally { lock.unlock(); } if (spareDataPage != null) { final long usedMemory = page.getUsedMemory(); final long buildingPageMemory = spareDataPage.getUsedMemory(); boolean add = true; final Iterator<Record> records = spareDataPage.getRecordsForFlush().iterator(); while (add && records.hasNext()) { Record record = records.next().nonShared(); add = page.put(record); if (add) { boolean moved = keyToPage.put(record.key, page.pageId, spareDataPage.pageId); if (!moved) { LOGGER.log(Level.SEVERE, STR, new Object[]{page, spareDataPage}); throw new IllegalStateException( STR + record.key + STR + page.pageId + STR + spareDataPage.pageId); } records.remove(); } } long spareUsedMemory = page.getUsedMemory() - usedMemory; spareDataPage.setUsedMemory(buildingPageMemory - spareUsedMemory); } LOGGER.log(Level.FINER, STR, new Object[]{table.name, page.pageId, page.size(), page.getUsedMemory()}); dataStorageManager.writePage(tableSpaceUUID, table.uuid, page.pageId, page.getRecordsForFlush()); return FlushNewPageResult.FLUSHED; }
/** * Remove the page from {@link #newPages}, set it as "unloaded" and write it to disk * <p> * Add as much spare data as possible to fillup the page. If added must change key to page pointers * too for spare data * </p> * * @param page new page to flush * @param spareDataPage old spare data to fit in the new page if possible * @return {@code false} if no flush has been done because the page isn't writable anymore, * {@code true} otherwise */
Remove the page from <code>#newPages</code>, set it as "unloaded" and write it to disk Add as much spare data as possible to fillup the page. If added must change key to page pointers too for spare data
flushNewPage
{ "repo_name": "diennea/herddb", "path": "herddb-core/src/main/java/herddb/core/TableManager.java", "license": "apache-2.0", "size": 189507 }
[ "java.util.Iterator", "java.util.concurrent.locks.Lock", "java.util.logging.Level" ]
import java.util.Iterator; import java.util.concurrent.locks.Lock; import java.util.logging.Level;
import java.util.*; import java.util.concurrent.locks.*; import java.util.logging.*;
[ "java.util" ]
java.util;
2,546,472
void onStart(Closeable closeable);
void onStart(Closeable closeable);
/** * Called when the async processing starts. The passed {@link Closeable} can be used to close/interrupt the * processing */
Called when the async processing starts. The passed <code>Closeable</code> can be used to close/interrupt the processing
onStart
{ "repo_name": "sabre1041/docker-java", "path": "src/main/java/com/github/dockerjava/api/async/ResultCallback.java", "license": "apache-2.0", "size": 643 }
[ "java.io.Closeable" ]
import java.io.Closeable;
import java.io.*;
[ "java.io" ]
java.io;
808,681
List<String> answer = new ArrayList<String>(); for(int i = 0; i < array.length; i ++){ answer.add(array[i]); } return answer; }
List<String> answer = new ArrayList<String>(); for(int i = 0; i < array.length; i ++){ answer.add(array[i]); } return answer; }
/** * Convert an array of Strings to a List of Strings * @param array * @return a list of Strings */
Convert an array of Strings to a List of Strings
convertStringArrayToList
{ "repo_name": "dchouzer/OOGASalad", "path": "src/util/SaladUtil.java", "license": "mit", "size": 4283 }
[ "java.util.ArrayList", "java.util.List" ]
import java.util.ArrayList; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,840,784
@Override public boolean incrementToken() throws IOException { //collect all the terms into the words collection while (input.incrementToken()) { final String word = new String(termAtt.buffer(), 0, termAtt.length()); words.add(word); } //if we have a previousTerm - write it out as its own token concatenated // with the current word (if one is available). if (previousWord != null && words.size() > 0) { final String word = words.getFirst(); clearAttributes(); termAtt.append(previousWord).append(word); previousWord = null; return true; } //if we have words, write it out as a single token if (words.size() > 0) { final String word = words.removeFirst(); clearAttributes(); termAtt.append(word); previousWord = word; return true; } return false; }
boolean function() throws IOException { while (input.incrementToken()) { final String word = new String(termAtt.buffer(), 0, termAtt.length()); words.add(word); } if (previousWord != null && words.size() > 0) { final String word = words.getFirst(); clearAttributes(); termAtt.append(previousWord).append(word); previousWord = null; return true; } if (words.size() > 0) { final String word = words.removeFirst(); clearAttributes(); termAtt.append(word); previousWord = word; return true; } return false; }
/** * Increments the underlying TokenStream and sets CharTermAttributes to construct an expanded set of tokens by * concatenating tokens with the previous token. * * @return whether or not we have hit the end of the TokenStream * @throws IOException is thrown when an IOException occurs */
Increments the underlying TokenStream and sets CharTermAttributes to construct an expanded set of tokens by concatenating tokens with the previous token
incrementToken
{ "repo_name": "simon-eastwood/DependencyCheckCM", "path": "dependency-check-core/src/main/java/org/owasp/dependencycheck/data/lucene/TokenPairConcatenatingFilter.java", "license": "apache-2.0", "size": 3917 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,780,983
public List<Event> serialize(Node data) { YamlSilentEmitter emitter = new YamlSilentEmitter(); Serializer serializer = new Serializer(this.serialization, emitter, this.resolver, this.dumperOptions, null); try { serializer.open(); serializer.serialize(data); serializer.close(); } catch (IOException e) { throw new YAMLException(e); } return emitter.getEvents(); }
List<Event> function(Node data) { YamlSilentEmitter emitter = new YamlSilentEmitter(); Serializer serializer = new Serializer(this.serialization, emitter, this.resolver, this.dumperOptions, null); try { serializer.open(); serializer.serialize(data); serializer.close(); } catch (IOException e) { throw new YAMLException(e); } return emitter.getEvents(); }
/** * Serialize the representation tree into Events. * * @param data * representation tree * * @return Event list * * @see <a href="http://yaml.org/spec/1.1/#id859333">Processing Overview</a> */
Serialize the representation tree into Events
serialize
{ "repo_name": "GotoFinal/diorite-configs-java8", "path": "src/main/java/org/diorite/config/serialization/snakeyaml/Yaml.java", "license": "mit", "size": 33096 }
[ "java.io.IOException", "java.util.List", "org.diorite.config.serialization.snakeyaml.emitter.Serializer", "org.yaml.snakeyaml.error.YAMLException", "org.yaml.snakeyaml.events.Event", "org.yaml.snakeyaml.nodes.Node" ]
import java.io.IOException; import java.util.List; import org.diorite.config.serialization.snakeyaml.emitter.Serializer; import org.yaml.snakeyaml.error.YAMLException; import org.yaml.snakeyaml.events.Event; import org.yaml.snakeyaml.nodes.Node;
import java.io.*; import java.util.*; import org.diorite.config.serialization.snakeyaml.emitter.*; import org.yaml.snakeyaml.error.*; import org.yaml.snakeyaml.events.*; import org.yaml.snakeyaml.nodes.*;
[ "java.io", "java.util", "org.diorite.config", "org.yaml.snakeyaml" ]
java.io; java.util; org.diorite.config; org.yaml.snakeyaml;
1,599,237
return centers.stream() .map(center -> center.getName() + " temperature is " + center.getTemperature(location)) .collect(Collectors.toList()); } /** * Using parallel stream to query temperatures * the param and return result is same as {@code queryTemperature(String location)}
return centers.stream() .map(center -> center.getName() + STR + center.getTemperature(location)) .collect(Collectors.toList()); } /** * Using parallel stream to query temperatures * the param and return result is same as {@code queryTemperature(String location)}
/** * Query temperatures for location {@code location} from all weather centers sequentially. * @param location Specific location to be queried. * @return String list represent temperatures from all weather centers. */
Query temperatures for location location from all weather centers sequentially
queryTemperature
{ "repo_name": "kennylbj/concurrent-java", "path": "src/main/java/completableFuture/Forecaster.java", "license": "mit", "size": 5047 }
[ "java.util.stream.Collectors" ]
import java.util.stream.Collectors;
import java.util.stream.*;
[ "java.util" ]
java.util;
1,397,122
@Test public void testHashcode() { StandardBarPainter p1 = new StandardBarPainter(); StandardBarPainter p2 = new StandardBarPainter(); assertEquals(p1, p2); int h1 = p1.hashCode(); int h2 = p2.hashCode(); assertEquals(h1, h2); }
void function() { StandardBarPainter p1 = new StandardBarPainter(); StandardBarPainter p2 = new StandardBarPainter(); assertEquals(p1, p2); int h1 = p1.hashCode(); int h2 = p2.hashCode(); assertEquals(h1, h2); }
/** * Two objects that are equal are required to return the same hashCode. */
Two objects that are equal are required to return the same hashCode
testHashcode
{ "repo_name": "oskopek/jfreechart-fse", "path": "src/test/java/org/jfree/chart/renderer/category/StandardBarPainterTest.java", "license": "lgpl-2.1", "size": 3879 }
[ "org.junit.Assert" ]
import org.junit.Assert;
import org.junit.*;
[ "org.junit" ]
org.junit;
240,139
public void setTapListener(GestureDetector.SimpleOnGestureListener tapListener) { mTapListenerWrapper.setListener(tapListener); }
void function(GestureDetector.SimpleOnGestureListener tapListener) { mTapListenerWrapper.setListener(tapListener); }
/** * Sets the tap listener. */
Sets the tap listener
setTapListener
{ "repo_name": "s1rius/fresco", "path": "samples/zoomable/src/main/java/com/facebook/samples/zoomable/ZoomableDraweeView.java", "license": "mit", "size": 15089 }
[ "android.view.GestureDetector" ]
import android.view.GestureDetector;
import android.view.*;
[ "android.view" ]
android.view;
2,486,085
public void setSize(Dimension dimension) { dim = dimension; }
void function(Dimension dimension) { dim = dimension; }
/** * Sets the size of the video. * * @param dimension the dimensions of the new video */
Sets the size of the video
setSize
{ "repo_name": "dobrown/tracker-mvn", "path": "src/main/java/org/opensourcephysics/media/core/ScratchVideoRecorder.java", "license": "gpl-3.0", "size": 18911 }
[ "java.awt.Dimension" ]
import java.awt.Dimension;
import java.awt.*;
[ "java.awt" ]
java.awt;
1,889,900
protected ContentEncoder createContentEncoder( final long len, final WritableByteChannel channel, final SessionOutputBuffer buffer, final HttpTransportMetricsImpl metrics) { if (len == ContentLengthStrategy.CHUNKED) { return new ChunkEncoder(channel, buffer, metrics, this.fragmentSizeHint); } else if (len == ContentLengthStrategy.IDENTITY) { return new IdentityEncoder(channel, buffer, metrics, this.fragmentSizeHint); } else { return new LengthDelimitedEncoder(channel, buffer, metrics, len, this.fragmentSizeHint); } }
ContentEncoder function( final long len, final WritableByteChannel channel, final SessionOutputBuffer buffer, final HttpTransportMetricsImpl metrics) { if (len == ContentLengthStrategy.CHUNKED) { return new ChunkEncoder(channel, buffer, metrics, this.fragmentSizeHint); } else if (len == ContentLengthStrategy.IDENTITY) { return new IdentityEncoder(channel, buffer, metrics, this.fragmentSizeHint); } else { return new LengthDelimitedEncoder(channel, buffer, metrics, len, this.fragmentSizeHint); } }
/** * Factory method for {@link ContentEncoder} instances. * * @param len content length, if known, {@link ContentLengthStrategy#CHUNKED} or * {@link ContentLengthStrategy#IDENTITY}, if unknown. * @param channel the session channel. * @param buffer the session buffer. * @param metrics transport metrics. * * @return content encoder. * * @since 4.1 */
Factory method for <code>ContentEncoder</code> instances
createContentEncoder
{ "repo_name": "viapp/httpasyncclient-android", "path": "src/main/java/org/apache/http/impl/nio/NHttpConnectionBase.java", "license": "apache-2.0", "size": 21049 }
[ "java.nio.channels.WritableByteChannel", "org.apache.http.entity.ContentLengthStrategy", "org.apache.http.impl.io.HttpTransportMetricsImpl", "org.apache.http.impl.nio.codecs.ChunkEncoder", "org.apache.http.impl.nio.codecs.IdentityEncoder", "org.apache.http.impl.nio.codecs.LengthDelimitedEncoder", "org.apache.http.nio.ContentEncoder", "org.apache.http.nio.reactor.SessionOutputBuffer" ]
import java.nio.channels.WritableByteChannel; import org.apache.http.entity.ContentLengthStrategy; import org.apache.http.impl.io.HttpTransportMetricsImpl; import org.apache.http.impl.nio.codecs.ChunkEncoder; import org.apache.http.impl.nio.codecs.IdentityEncoder; import org.apache.http.impl.nio.codecs.LengthDelimitedEncoder; import org.apache.http.nio.ContentEncoder; import org.apache.http.nio.reactor.SessionOutputBuffer;
import java.nio.channels.*; import org.apache.http.entity.*; import org.apache.http.impl.io.*; import org.apache.http.impl.nio.codecs.*; import org.apache.http.nio.*; import org.apache.http.nio.reactor.*;
[ "java.nio", "org.apache.http" ]
java.nio; org.apache.http;
2,483,935
private void storeBlock(SagaItem sagaItem) { ArrayList<Block> storage = findLowestEmpty(); // Loaded: if(getSagaChunk().isLoaded()) while(sagaItem.getAmount() >= 1.0 && storage.size() > 0){ // Remove block: int index = Saga.RANDOM.nextInt(storage.size()); Block block = storage.get(index); block.setTypeIdAndData(sagaItem.getType().getId(), sagaItem.getData().byteValue(), false); sagaItem.modifyAmount(-1); storage.remove(index); // Refresh possible storage: if(storage.size() == 0) storage = findLowestEmpty(); } // Buffer: for (int i = 0; i < buffer.size(); i++) { if(buffer.get(i).checkRepresents(sagaItem)){ buffer.get(i).modifyAmount(sagaItem.getAmount()); sagaItem.setAmount(0.0); break; } if(i == buffer.size() - 1) buffer.add(new SagaItem(buffer.get(i))); } }
void function(SagaItem sagaItem) { ArrayList<Block> storage = findLowestEmpty(); if(getSagaChunk().isLoaded()) while(sagaItem.getAmount() >= 1.0 && storage.size() > 0){ int index = Saga.RANDOM.nextInt(storage.size()); Block block = storage.get(index); block.setTypeIdAndData(sagaItem.getType().getId(), sagaItem.getData().byteValue(), false); sagaItem.modifyAmount(-1); storage.remove(index); if(storage.size() == 0) storage = findLowestEmpty(); } for (int i = 0; i < buffer.size(); i++) { if(buffer.get(i).checkRepresents(sagaItem)){ buffer.get(i).modifyAmount(sagaItem.getAmount()); sagaItem.setAmount(0.0); break; } if(i == buffer.size() - 1) buffer.add(new SagaItem(buffer.get(i))); } }
/** * Stores blocks. * * @param items saga block to store */
Stores blocks
storeBlock
{ "repo_name": "andfRa/Saga", "path": "src/org/saga/buildings/Warehouse.java", "license": "gpl-3.0", "size": 13549 }
[ "java.util.ArrayList", "org.bukkit.block.Block", "org.saga.Saga", "org.saga.buildings.production.SagaItem" ]
import java.util.ArrayList; import org.bukkit.block.Block; import org.saga.Saga; import org.saga.buildings.production.SagaItem;
import java.util.*; import org.bukkit.block.*; import org.saga.*; import org.saga.buildings.production.*;
[ "java.util", "org.bukkit.block", "org.saga", "org.saga.buildings" ]
java.util; org.bukkit.block; org.saga; org.saga.buildings;
2,096,928
public XMLString substring(int beginIndex) { int len = m_length - beginIndex; if (len <= 0) return XString.EMPTYSTRING; else { int start = m_start + beginIndex; return new XStringForFSB(fsb(), start, len); } }
XMLString function(int beginIndex) { int len = m_length - beginIndex; if (len <= 0) return XString.EMPTYSTRING; else { int start = m_start + beginIndex; return new XStringForFSB(fsb(), start, len); } }
/** * Returns a new string that is a substring of this string. The * substring begins with the character at the specified index and * extends to the end of this string. <p> * Examples: * <blockquote><pre> * "unhappy".substring(2) returns "happy" * "Harbison".substring(3) returns "bison" * "emptiness".substring(9) returns "" (an empty string) * </pre></blockquote> * * @param beginIndex the beginning index, inclusive. * @return the specified substring. * @exception IndexOutOfBoundsException if * <code>beginIndex</code> is negative or larger than the * length of this <code>String</code> object. */
Returns a new string that is a substring of this string. The substring begins with the character at the specified index and extends to the end of this string. Examples: <code> "unhappy".substring(2) returns "happy" "Harbison".substring(3) returns "bison" "emptiness".substring(9) returns "" (an empty string) </code>
substring
{ "repo_name": "kcsl/immutability-benchmark", "path": "benchmark-applications/reiminfer-oopsla-2012/source/Xalan/src/org/apache/xpath/objects/XStringForFSB.java", "license": "mit", "size": 29255 }
[ "org.apache.xml.utils.XMLString" ]
import org.apache.xml.utils.XMLString;
import org.apache.xml.utils.*;
[ "org.apache.xml" ]
org.apache.xml;
1,325,049
interface WithSku { @Beta(SinceVersion.V1_4_0) Update withBasicSku();
interface WithSku { @Beta(SinceVersion.V1_4_0) Update withBasicSku();
/** * Updates the current container registry to a 'managed' registry with a 'Basic' SKU type. * @return the next stage of the definition */
Updates the current container registry to a 'managed' registry with a 'Basic' SKU type
withBasicSku
{ "repo_name": "martinsawicki/azure-sdk-for-java", "path": "azure-mgmt-containerregistry/src/main/java/com/microsoft/azure/management/containerregistry/Registry.java", "license": "mit", "size": 12663 }
[ "com.microsoft.azure.management.apigeneration.Beta" ]
import com.microsoft.azure.management.apigeneration.Beta;
import com.microsoft.azure.management.apigeneration.*;
[ "com.microsoft.azure" ]
com.microsoft.azure;
2,270,214
VarPatternBuilder mapped = var(); if(instance.isEntity()){ mapped = map(instance.asEntity()); } else if(instance.isResource()){ mapped = map(instance.asResource()); } else if(instance.isRelation()){ mapped = map(instance.asRelation()); } else if(instance.isRule()){ mapped = map(instance.asRule()); } return mapped.pattern(); } /** * Map a {@link Entity} to a {@link VarPattern}
VarPatternBuilder mapped = var(); if(instance.isEntity()){ mapped = map(instance.asEntity()); } else if(instance.isResource()){ mapped = map(instance.asResource()); } else if(instance.isRelation()){ mapped = map(instance.asRelation()); } else if(instance.isRule()){ mapped = map(instance.asRule()); } return mapped.pattern(); } /** * Map a {@link Entity} to a {@link VarPattern}
/** * Map an Instance to the equivalent Graql representation * @param instance instance to be mapped * @return Graql representation of given instance */
Map an Instance to the equivalent Graql representation
map
{ "repo_name": "alexandraorth/grakn", "path": "grakn-migration/export/src/main/java/ai/grakn/migration/export/InstanceMapper.java", "license": "gpl-3.0", "size": 5895 }
[ "ai.grakn.concept.Entity", "ai.grakn.graql.Graql", "ai.grakn.graql.VarPattern", "ai.grakn.graql.VarPatternBuilder", "java.util.Map" ]
import ai.grakn.concept.Entity; import ai.grakn.graql.Graql; import ai.grakn.graql.VarPattern; import ai.grakn.graql.VarPatternBuilder; import java.util.Map;
import ai.grakn.concept.*; import ai.grakn.graql.*; import java.util.*;
[ "ai.grakn.concept", "ai.grakn.graql", "java.util" ]
ai.grakn.concept; ai.grakn.graql; java.util;
2,903,680
public static String replace( String string, String repl, String with ) { if ( string != null && repl != null && with != null ) { return string.replaceAll( Pattern.quote( repl ), Matcher.quoteReplacement( with ) ); } else { return null; } }
static String function( String string, String repl, String with ) { if ( string != null && repl != null && with != null ) { return string.replaceAll( Pattern.quote( repl ), Matcher.quoteReplacement( with ) ); } else { return null; } }
/** * Replace values in a String with another. * * 33% Faster using replaceAll this way than original method * * @param string * The original String. * @param repl * The text to replace * @param with * The new text bit * @return The resulting string with the text pieces replaced. */
Replace values in a String with another. 33% Faster using replaceAll this way than original method
replace
{ "repo_name": "mkambol/pentaho-kettle", "path": "core/src/main/java/org/pentaho/di/core/Const.java", "license": "apache-2.0", "size": 121415 }
[ "java.util.regex.Matcher", "java.util.regex.Pattern" ]
import java.util.regex.Matcher; import java.util.regex.Pattern;
import java.util.regex.*;
[ "java.util" ]
java.util;
2,908,867
public static <T> int combineListHash( Iterator<? extends T> hashObjectIterator, Hasher<T> hasher) { int hash = 0; while (hashObjectIterator.hasNext()) { hash += hasher.hash(hashObjectIterator.next()); hash += (hash << 10); hash ^= (hash >> 6); } hash += (hash << 3); hash ^= (hash >> 11); hash += (hash << 15); return hash; }
static <T> int function( Iterator<? extends T> hashObjectIterator, Hasher<T> hasher) { int hash = 0; while (hashObjectIterator.hasNext()) { hash += hasher.hash(hashObjectIterator.next()); hash += (hash << 10); hash ^= (hash >> 6); } hash += (hash << 3); hash ^= (hash >> 11); hash += (hash << 15); return hash; }
/** * Combine the hash codes of a collection of objects into one in a way that * depends on their order. * * The current implementation is based on the Jenkins One-at-a-Time hash, * see http://www.burtleburtle.net/bob/hash/doobs.html and also * http://en.wikipedia.org/wiki/Jenkins_hash_function. * * @param hashObjectIterator * @param hasher * @return the combined hash code */
Combine the hash codes of a collection of objects into one in a way that depends on their order. The current implementation is based on the Jenkins One-at-a-Time hash, see HREF and also HREF
combineListHash
{ "repo_name": "liveontologies/elk-reasoner", "path": "elk-util-parent/elk-util-hashing/src/main/java/org/semanticweb/elk/util/hashing/HashGenerator.java", "license": "apache-2.0", "size": 9356 }
[ "java.util.Iterator" ]
import java.util.Iterator;
import java.util.*;
[ "java.util" ]
java.util;
1,658,321
@Test public void testOrganizedOperandsSingleCondnEvalMultipleLessThanInEqualities_AND() { LogWriter logger = CacheUtils.getCache().getLogger(); try { CompiledComparison cv[] = null; ExecutionContext context = new QueryExecutionContext(null, CacheUtils.getCache()); this.bindIteratorsAndCreateIndex(context); // Case 1 : a < 7 and a <=4 and a < 5 and a <=4 cv = new CompiledComparison[4]; cv[0] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(7)), OQLLexerTokenTypes.TOK_LT); cv[1] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(4)), OQLLexerTokenTypes.TOK_LE); cv[2] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(5)), OQLLexerTokenTypes.TOK_LT); cv[3] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(4)), OQLLexerTokenTypes.TOK_LE); OrganizedOperands oo = this .oganizedOperandsSingleRangeJunctionCreation(OQLLexerTokenTypes.LITERAL_and, cv, context); assertTrue("Filter Openad of OrganizedOperand is not of type RangeJunction", oo.filterOperand instanceof RangeJunction); RangeJunction rj = (RangeJunction) oo.filterOperand; OrganizedOperands oo1 = rj.organizeOperands(context); assertTrue(oo1.filterOperand == cv[1] || oo1.filterOperand == cv[3]); // Case2: a<=8 and a < 12 and a <=10 and a<=8 cv[0] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(8)), OQLLexerTokenTypes.TOK_LE); cv[1] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(12)), OQLLexerTokenTypes.TOK_LT); cv[2] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(10)), OQLLexerTokenTypes.TOK_LT); cv[3] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(8)), OQLLexerTokenTypes.TOK_LT); oo = this.oganizedOperandsSingleRangeJunctionCreation(OQLLexerTokenTypes.LITERAL_and, cv, context); assertTrue("Filter Openad of OrganizedOperand is not of type RangeJunction", oo.filterOperand instanceof RangeJunction); rj = (RangeJunction) oo.filterOperand; oo1 = rj.organizeOperands(context); assertTrue(oo1.filterOperand == cv[0] || oo1.filterOperand == cv[3]); cv = new CompiledComparison[5]; // Case 3 : 3 >= a and a <=4 and a < 5 and a <= 3 and a != 1 cv[0] = new CompiledComparison(new CompiledLiteral(new Integer(3)), new CompiledPath(new CompiledID("p"), "ID"), OQLLexerTokenTypes.TOK_GE); cv[1] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(4)), OQLLexerTokenTypes.TOK_LE); cv[2] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(5)), OQLLexerTokenTypes.TOK_LT); cv[3] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(3)), OQLLexerTokenTypes.TOK_LE); cv[4] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(1)), OQLLexerTokenTypes.TOK_NE); oo = this.oganizedOperandsSingleRangeJunctionCreation(OQLLexerTokenTypes.LITERAL_and, cv, context); rj = (RangeJunction) oo.filterOperand; oo1 = rj.organizeOperands(context); assertTrue(RangeJunction.isInstanceOfSingleCondnEvaluator(oo1.filterOperand)); assertTrue(RangeJunction .getSingleCondnEvaluatorOperator(oo1.filterOperand) == OQLLexerTokenTypes.TOK_LE); assertTrue( RangeJunction.getSingleCondnEvaluatorKey(oo1.filterOperand).equals(new Integer(3))); assertTrue(RangeJunction.getIndex(oo1.filterOperand).getName().equals("idIndex")); assertTrue(RangeJunction.getKeysToBeRemoved(oo1.filterOperand).size() == 1 && RangeJunction .getKeysToBeRemoved(oo1.filterOperand).iterator().next().equals(new Integer(1))); // Case 4 : 3 > a and a <=2 cv = new CompiledComparison[2]; cv[0] = new CompiledComparison(new CompiledLiteral(new Integer(3)), new CompiledPath(new CompiledID("p"), "ID"), OQLLexerTokenTypes.TOK_GT); cv[1] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(2)), OQLLexerTokenTypes.TOK_LE); oo = this.oganizedOperandsSingleRangeJunctionCreation(OQLLexerTokenTypes.LITERAL_and, cv, context); rj = (RangeJunction) oo.filterOperand; oo1 = rj.organizeOperands(context); assertTrue(oo1.filterOperand == cv[1]); // Case 5 : a < 7 and a <=7 cv = new CompiledComparison[2]; cv[0] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(7)), OQLLexerTokenTypes.TOK_LT); cv[1] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(7)), OQLLexerTokenTypes.TOK_LE); oo = this.oganizedOperandsSingleRangeJunctionCreation(OQLLexerTokenTypes.LITERAL_and, cv, context); rj = (RangeJunction) oo.filterOperand; oo1 = rj.organizeOperands(context); assertTrue(oo1.filterOperand == cv[0]); // Case 6 : a <= 7 and a <7 cv = new CompiledComparison[2]; cv[0] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(7)), OQLLexerTokenTypes.TOK_LE); cv[1] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(7)), OQLLexerTokenTypes.TOK_LT); oo = this.oganizedOperandsSingleRangeJunctionCreation(OQLLexerTokenTypes.LITERAL_and, cv, context); rj = (RangeJunction) oo.filterOperand; oo1 = rj.organizeOperands(context); assertTrue(oo1.filterOperand == cv[1]); // Case 7 : a <= 8 and a <9 cv = new CompiledComparison[2]; cv[0] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(8)), OQLLexerTokenTypes.TOK_LE); cv[1] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(9)), OQLLexerTokenTypes.TOK_LT); oo = this.oganizedOperandsSingleRangeJunctionCreation(OQLLexerTokenTypes.LITERAL_and, cv, context); rj = (RangeJunction) oo.filterOperand; oo1 = rj.organizeOperands(context); assertTrue(oo1.filterOperand == cv[0]); // Case 8 : a <=8 and a <=10 cv = new CompiledComparison[2]; cv[0] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(8)), OQLLexerTokenTypes.TOK_LE); cv[1] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(10)), OQLLexerTokenTypes.TOK_LE); oo = this.oganizedOperandsSingleRangeJunctionCreation(OQLLexerTokenTypes.LITERAL_and, cv, context); rj = (RangeJunction) oo.filterOperand; oo1 = rj.organizeOperands(context); assertTrue(oo1.filterOperand == cv[0]); // Case 9 : a <=6 and a <= 5 cv = new CompiledComparison[2]; cv[0] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(6)), OQLLexerTokenTypes.TOK_LE); cv[1] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(5)), OQLLexerTokenTypes.TOK_LE); oo = this.oganizedOperandsSingleRangeJunctionCreation(OQLLexerTokenTypes.LITERAL_and, cv, context); rj = (RangeJunction) oo.filterOperand; oo1 = rj.organizeOperands(context); assertTrue(oo1.filterOperand == cv[1]); // Case 10 : 7 > a and a <=7 and a != 2 cv = new CompiledComparison[3]; cv[0] = new CompiledComparison(new CompiledLiteral(new Integer(7)), new CompiledPath(new CompiledID("p"), "ID"), OQLLexerTokenTypes.TOK_GT); cv[1] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(7)), OQLLexerTokenTypes.TOK_LE); cv[2] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(2)), OQLLexerTokenTypes.TOK_NE); oo = this.oganizedOperandsSingleRangeJunctionCreation(OQLLexerTokenTypes.LITERAL_and, cv, context); rj = (RangeJunction) oo.filterOperand; oo1 = rj.organizeOperands(context); assertTrue( RangeJunction.getSingleCondnEvaluatorKey(oo1.filterOperand).equals(new Integer(7))); assertTrue(RangeJunction .getSingleCondnEvaluatorOperator(oo1.filterOperand) == OQLLexerTokenTypes.TOK_LT); assertTrue(RangeJunction.getKeysToBeRemoved(oo1.filterOperand).iterator().next() .equals(new Integer(2))); // Case 11 : a < 7 and a <=7 and a != 1 cv = new CompiledComparison[3]; cv[0] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(7)), OQLLexerTokenTypes.TOK_LT); cv[1] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(7)), OQLLexerTokenTypes.TOK_LE); cv[2] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(1)), OQLLexerTokenTypes.TOK_NE); oo = this.oganizedOperandsSingleRangeJunctionCreation(OQLLexerTokenTypes.LITERAL_and, cv, context); rj = (RangeJunction) oo.filterOperand; oo1 = rj.organizeOperands(context); assertTrue( RangeJunction.getSingleCondnEvaluatorKey(oo1.filterOperand).equals(new Integer(7))); assertTrue(RangeJunction .getSingleCondnEvaluatorOperator(oo1.filterOperand) == OQLLexerTokenTypes.TOK_LT); assertTrue(RangeJunction.getKeysToBeRemoved(oo1.filterOperand).iterator().next() .equals(new Integer(1))); // Case 12 : a <= 7 and a <7 and a != 1 cv = new CompiledComparison[3]; cv[0] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(7)), OQLLexerTokenTypes.TOK_LE); cv[1] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(7)), OQLLexerTokenTypes.TOK_LT); cv[2] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(1)), OQLLexerTokenTypes.TOK_NE); oo = this.oganizedOperandsSingleRangeJunctionCreation(OQLLexerTokenTypes.LITERAL_and, cv, context); rj = (RangeJunction) oo.filterOperand; oo1 = rj.organizeOperands(context); assertTrue( RangeJunction.getSingleCondnEvaluatorKey(oo1.filterOperand).equals(new Integer(7))); assertTrue(RangeJunction .getSingleCondnEvaluatorOperator(oo1.filterOperand) == OQLLexerTokenTypes.TOK_LT); assertTrue(RangeJunction.getKeysToBeRemoved(oo1.filterOperand).iterator().next() .equals(new Integer(1))); // Case 13 : a <= 8 and a <9 and a !=1 cv = new CompiledComparison[3]; cv[0] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(8)), OQLLexerTokenTypes.TOK_LE); cv[1] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(9)), OQLLexerTokenTypes.TOK_LT); cv[2] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(1)), OQLLexerTokenTypes.TOK_NE); oo = this.oganizedOperandsSingleRangeJunctionCreation(OQLLexerTokenTypes.LITERAL_and, cv, context); rj = (RangeJunction) oo.filterOperand; oo1 = rj.organizeOperands(context); assertTrue( RangeJunction.getSingleCondnEvaluatorKey(oo1.filterOperand).equals(new Integer(8))); assertTrue(RangeJunction .getSingleCondnEvaluatorOperator(oo1.filterOperand) == OQLLexerTokenTypes.TOK_LE); assertTrue(RangeJunction.getKeysToBeRemoved(oo1.filterOperand).iterator().next() .equals(new Integer(1))); // Case 14 : a <=8 and a <=9 and a !=1 cv = new CompiledComparison[3]; cv[0] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(8)), OQLLexerTokenTypes.TOK_LE); cv[1] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(9)), OQLLexerTokenTypes.TOK_LE); cv[2] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(1)), OQLLexerTokenTypes.TOK_NE); oo = this.oganizedOperandsSingleRangeJunctionCreation(OQLLexerTokenTypes.LITERAL_and, cv, context); rj = (RangeJunction) oo.filterOperand; oo1 = rj.organizeOperands(context); assertTrue( RangeJunction.getSingleCondnEvaluatorKey(oo1.filterOperand).equals(new Integer(8))); assertTrue(RangeJunction .getSingleCondnEvaluatorOperator(oo1.filterOperand) == OQLLexerTokenTypes.TOK_LE); assertTrue(RangeJunction.getKeysToBeRemoved(oo1.filterOperand).iterator().next() .equals(new Integer(1))); // Case 15 : a <=7 and a <=6 and a != 1 cv = new CompiledComparison[3]; cv[0] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(7)), OQLLexerTokenTypes.TOK_LE); cv[1] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(6)), OQLLexerTokenTypes.TOK_LE); cv[2] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(1)), OQLLexerTokenTypes.TOK_NE); oo = this.oganizedOperandsSingleRangeJunctionCreation(OQLLexerTokenTypes.LITERAL_and, cv, context); rj = (RangeJunction) oo.filterOperand; oo1 = rj.organizeOperands(context); assertTrue( RangeJunction.getSingleCondnEvaluatorKey(oo1.filterOperand).equals(new Integer(6))); assertTrue(RangeJunction .getSingleCondnEvaluatorOperator(oo1.filterOperand) == OQLLexerTokenTypes.TOK_LE); assertTrue(RangeJunction.getKeysToBeRemoved(oo1.filterOperand).iterator().next() .equals(new Integer(1))); // Case 15 : a <=7 and a <= 6and a != 6 cv = new CompiledComparison[3]; cv[0] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(7)), OQLLexerTokenTypes.TOK_LE); cv[1] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(6)), OQLLexerTokenTypes.TOK_LE); cv[2] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(6)), OQLLexerTokenTypes.TOK_NE); oo = this.oganizedOperandsSingleRangeJunctionCreation(OQLLexerTokenTypes.LITERAL_and, cv, context); rj = (RangeJunction) oo.filterOperand; oo1 = rj.organizeOperands(context); assertTrue( RangeJunction.getSingleCondnEvaluatorKey(oo1.filterOperand).equals(new Integer(6))); assertTrue(RangeJunction .getSingleCondnEvaluatorOperator(oo1.filterOperand) == OQLLexerTokenTypes.TOK_LE); assertTrue(RangeJunction.getKeysToBeRemoved((oo1.filterOperand)).iterator().next() .equals(new Integer(6))); // Case 16 : a <=7 and a <=6 and a != 7 cv = new CompiledComparison[3]; cv[0] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(7)), OQLLexerTokenTypes.TOK_LE); cv[1] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(6)), OQLLexerTokenTypes.TOK_LE); cv[2] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(7)), OQLLexerTokenTypes.TOK_NE); oo = this.oganizedOperandsSingleRangeJunctionCreation(OQLLexerTokenTypes.LITERAL_and, cv, context); rj = (RangeJunction) oo.filterOperand; oo1 = rj.organizeOperands(context); assertTrue(oo1.filterOperand == cv[1]); // Case 17 : a <=7 and a <=6 and a != 7 and a!=10 and a != 8 cv = new CompiledComparison[5]; cv[0] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(7)), OQLLexerTokenTypes.TOK_LE); cv[1] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(6)), OQLLexerTokenTypes.TOK_LE); cv[2] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(7)), OQLLexerTokenTypes.TOK_NE); cv[3] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(10)), OQLLexerTokenTypes.TOK_NE); cv[4] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(8)), OQLLexerTokenTypes.TOK_NE); oo = this.oganizedOperandsSingleRangeJunctionCreation(OQLLexerTokenTypes.LITERAL_and, cv, context); rj = (RangeJunction) oo.filterOperand; oo1 = rj.organizeOperands(context); assertTrue(oo1.filterOperand == cv[1]); // Case 18 : a <=7 and a <=6 and a != 7 and a!=8 and a !=9 and a != 2 and // a != 6 cv = new CompiledComparison[7]; cv[0] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(7)), OQLLexerTokenTypes.TOK_LE); cv[1] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(6)), OQLLexerTokenTypes.TOK_LE); cv[2] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(7)), OQLLexerTokenTypes.TOK_NE); cv[3] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(8)), OQLLexerTokenTypes.TOK_NE); cv[4] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(9)), OQLLexerTokenTypes.TOK_NE); cv[5] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(2)), OQLLexerTokenTypes.TOK_NE); cv[6] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(6)), OQLLexerTokenTypes.TOK_NE); oo = this.oganizedOperandsSingleRangeJunctionCreation(OQLLexerTokenTypes.LITERAL_and, cv, context); rj = (RangeJunction) oo.filterOperand; oo1 = rj.organizeOperands(context); assertTrue( RangeJunction.getSingleCondnEvaluatorKey(oo1.filterOperand).equals(new Integer(6))); assertTrue(RangeJunction .getSingleCondnEvaluatorOperator(oo1.filterOperand) == OQLLexerTokenTypes.TOK_LE); Iterator itr = RangeJunction.getKeysToBeRemoved((oo1.filterOperand)).iterator(); Object temp; assertTrue((temp = itr.next()).equals(new Integer(2)) || temp.equals(new Integer(6))); assertTrue((temp = itr.next()).equals(new Integer(2)) || temp.equals(new Integer(6))); assertFalse(itr.hasNext()); // ////////////////////////////////////////////////////////////// } catch (Exception e) { logger.error(e); fail(e.toString()); } }
void function() { LogWriter logger = CacheUtils.getCache().getLogger(); try { CompiledComparison cv[] = null; ExecutionContext context = new QueryExecutionContext(null, CacheUtils.getCache()); this.bindIteratorsAndCreateIndex(context); cv = new CompiledComparison[4]; cv[0] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(7)), OQLLexerTokenTypes.TOK_LT); cv[1] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(4)), OQLLexerTokenTypes.TOK_LE); cv[2] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(5)), OQLLexerTokenTypes.TOK_LT); cv[3] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(4)), OQLLexerTokenTypes.TOK_LE); OrganizedOperands oo = this .oganizedOperandsSingleRangeJunctionCreation(OQLLexerTokenTypes.LITERAL_and, cv, context); assertTrue(STR, oo.filterOperand instanceof RangeJunction); RangeJunction rj = (RangeJunction) oo.filterOperand; OrganizedOperands oo1 = rj.organizeOperands(context); assertTrue(oo1.filterOperand == cv[1] oo1.filterOperand == cv[3]); cv[0] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(8)), OQLLexerTokenTypes.TOK_LE); cv[1] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(12)), OQLLexerTokenTypes.TOK_LT); cv[2] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(10)), OQLLexerTokenTypes.TOK_LT); cv[3] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(8)), OQLLexerTokenTypes.TOK_LT); oo = this.oganizedOperandsSingleRangeJunctionCreation(OQLLexerTokenTypes.LITERAL_and, cv, context); assertTrue(STR, oo.filterOperand instanceof RangeJunction); rj = (RangeJunction) oo.filterOperand; oo1 = rj.organizeOperands(context); assertTrue(oo1.filterOperand == cv[0] oo1.filterOperand == cv[3]); cv = new CompiledComparison[5]; cv[0] = new CompiledComparison(new CompiledLiteral(new Integer(3)), new CompiledPath(new CompiledID("p"), "ID"), OQLLexerTokenTypes.TOK_GE); cv[1] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(4)), OQLLexerTokenTypes.TOK_LE); cv[2] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(5)), OQLLexerTokenTypes.TOK_LT); cv[3] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(3)), OQLLexerTokenTypes.TOK_LE); cv[4] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(1)), OQLLexerTokenTypes.TOK_NE); oo = this.oganizedOperandsSingleRangeJunctionCreation(OQLLexerTokenTypes.LITERAL_and, cv, context); rj = (RangeJunction) oo.filterOperand; oo1 = rj.organizeOperands(context); assertTrue(RangeJunction.isInstanceOfSingleCondnEvaluator(oo1.filterOperand)); assertTrue(RangeJunction .getSingleCondnEvaluatorOperator(oo1.filterOperand) == OQLLexerTokenTypes.TOK_LE); assertTrue( RangeJunction.getSingleCondnEvaluatorKey(oo1.filterOperand).equals(new Integer(3))); assertTrue(RangeJunction.getIndex(oo1.filterOperand).getName().equals(STR)); assertTrue(RangeJunction.getKeysToBeRemoved(oo1.filterOperand).size() == 1 && RangeJunction .getKeysToBeRemoved(oo1.filterOperand).iterator().next().equals(new Integer(1))); cv = new CompiledComparison[2]; cv[0] = new CompiledComparison(new CompiledLiteral(new Integer(3)), new CompiledPath(new CompiledID("p"), "ID"), OQLLexerTokenTypes.TOK_GT); cv[1] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(2)), OQLLexerTokenTypes.TOK_LE); oo = this.oganizedOperandsSingleRangeJunctionCreation(OQLLexerTokenTypes.LITERAL_and, cv, context); rj = (RangeJunction) oo.filterOperand; oo1 = rj.organizeOperands(context); assertTrue(oo1.filterOperand == cv[1]); cv = new CompiledComparison[2]; cv[0] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(7)), OQLLexerTokenTypes.TOK_LT); cv[1] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(7)), OQLLexerTokenTypes.TOK_LE); oo = this.oganizedOperandsSingleRangeJunctionCreation(OQLLexerTokenTypes.LITERAL_and, cv, context); rj = (RangeJunction) oo.filterOperand; oo1 = rj.organizeOperands(context); assertTrue(oo1.filterOperand == cv[0]); cv = new CompiledComparison[2]; cv[0] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(7)), OQLLexerTokenTypes.TOK_LE); cv[1] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(7)), OQLLexerTokenTypes.TOK_LT); oo = this.oganizedOperandsSingleRangeJunctionCreation(OQLLexerTokenTypes.LITERAL_and, cv, context); rj = (RangeJunction) oo.filterOperand; oo1 = rj.organizeOperands(context); assertTrue(oo1.filterOperand == cv[1]); cv = new CompiledComparison[2]; cv[0] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(8)), OQLLexerTokenTypes.TOK_LE); cv[1] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(9)), OQLLexerTokenTypes.TOK_LT); oo = this.oganizedOperandsSingleRangeJunctionCreation(OQLLexerTokenTypes.LITERAL_and, cv, context); rj = (RangeJunction) oo.filterOperand; oo1 = rj.organizeOperands(context); assertTrue(oo1.filterOperand == cv[0]); cv = new CompiledComparison[2]; cv[0] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(8)), OQLLexerTokenTypes.TOK_LE); cv[1] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(10)), OQLLexerTokenTypes.TOK_LE); oo = this.oganizedOperandsSingleRangeJunctionCreation(OQLLexerTokenTypes.LITERAL_and, cv, context); rj = (RangeJunction) oo.filterOperand; oo1 = rj.organizeOperands(context); assertTrue(oo1.filterOperand == cv[0]); cv = new CompiledComparison[2]; cv[0] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(6)), OQLLexerTokenTypes.TOK_LE); cv[1] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(5)), OQLLexerTokenTypes.TOK_LE); oo = this.oganizedOperandsSingleRangeJunctionCreation(OQLLexerTokenTypes.LITERAL_and, cv, context); rj = (RangeJunction) oo.filterOperand; oo1 = rj.organizeOperands(context); assertTrue(oo1.filterOperand == cv[1]); cv = new CompiledComparison[3]; cv[0] = new CompiledComparison(new CompiledLiteral(new Integer(7)), new CompiledPath(new CompiledID("p"), "ID"), OQLLexerTokenTypes.TOK_GT); cv[1] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(7)), OQLLexerTokenTypes.TOK_LE); cv[2] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(2)), OQLLexerTokenTypes.TOK_NE); oo = this.oganizedOperandsSingleRangeJunctionCreation(OQLLexerTokenTypes.LITERAL_and, cv, context); rj = (RangeJunction) oo.filterOperand; oo1 = rj.organizeOperands(context); assertTrue( RangeJunction.getSingleCondnEvaluatorKey(oo1.filterOperand).equals(new Integer(7))); assertTrue(RangeJunction .getSingleCondnEvaluatorOperator(oo1.filterOperand) == OQLLexerTokenTypes.TOK_LT); assertTrue(RangeJunction.getKeysToBeRemoved(oo1.filterOperand).iterator().next() .equals(new Integer(2))); cv = new CompiledComparison[3]; cv[0] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(7)), OQLLexerTokenTypes.TOK_LT); cv[1] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(7)), OQLLexerTokenTypes.TOK_LE); cv[2] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(1)), OQLLexerTokenTypes.TOK_NE); oo = this.oganizedOperandsSingleRangeJunctionCreation(OQLLexerTokenTypes.LITERAL_and, cv, context); rj = (RangeJunction) oo.filterOperand; oo1 = rj.organizeOperands(context); assertTrue( RangeJunction.getSingleCondnEvaluatorKey(oo1.filterOperand).equals(new Integer(7))); assertTrue(RangeJunction .getSingleCondnEvaluatorOperator(oo1.filterOperand) == OQLLexerTokenTypes.TOK_LT); assertTrue(RangeJunction.getKeysToBeRemoved(oo1.filterOperand).iterator().next() .equals(new Integer(1))); cv = new CompiledComparison[3]; cv[0] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(7)), OQLLexerTokenTypes.TOK_LE); cv[1] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(7)), OQLLexerTokenTypes.TOK_LT); cv[2] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(1)), OQLLexerTokenTypes.TOK_NE); oo = this.oganizedOperandsSingleRangeJunctionCreation(OQLLexerTokenTypes.LITERAL_and, cv, context); rj = (RangeJunction) oo.filterOperand; oo1 = rj.organizeOperands(context); assertTrue( RangeJunction.getSingleCondnEvaluatorKey(oo1.filterOperand).equals(new Integer(7))); assertTrue(RangeJunction .getSingleCondnEvaluatorOperator(oo1.filterOperand) == OQLLexerTokenTypes.TOK_LT); assertTrue(RangeJunction.getKeysToBeRemoved(oo1.filterOperand).iterator().next() .equals(new Integer(1))); cv = new CompiledComparison[3]; cv[0] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(8)), OQLLexerTokenTypes.TOK_LE); cv[1] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(9)), OQLLexerTokenTypes.TOK_LT); cv[2] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(1)), OQLLexerTokenTypes.TOK_NE); oo = this.oganizedOperandsSingleRangeJunctionCreation(OQLLexerTokenTypes.LITERAL_and, cv, context); rj = (RangeJunction) oo.filterOperand; oo1 = rj.organizeOperands(context); assertTrue( RangeJunction.getSingleCondnEvaluatorKey(oo1.filterOperand).equals(new Integer(8))); assertTrue(RangeJunction .getSingleCondnEvaluatorOperator(oo1.filterOperand) == OQLLexerTokenTypes.TOK_LE); assertTrue(RangeJunction.getKeysToBeRemoved(oo1.filterOperand).iterator().next() .equals(new Integer(1))); cv = new CompiledComparison[3]; cv[0] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(8)), OQLLexerTokenTypes.TOK_LE); cv[1] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(9)), OQLLexerTokenTypes.TOK_LE); cv[2] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(1)), OQLLexerTokenTypes.TOK_NE); oo = this.oganizedOperandsSingleRangeJunctionCreation(OQLLexerTokenTypes.LITERAL_and, cv, context); rj = (RangeJunction) oo.filterOperand; oo1 = rj.organizeOperands(context); assertTrue( RangeJunction.getSingleCondnEvaluatorKey(oo1.filterOperand).equals(new Integer(8))); assertTrue(RangeJunction .getSingleCondnEvaluatorOperator(oo1.filterOperand) == OQLLexerTokenTypes.TOK_LE); assertTrue(RangeJunction.getKeysToBeRemoved(oo1.filterOperand).iterator().next() .equals(new Integer(1))); cv = new CompiledComparison[3]; cv[0] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(7)), OQLLexerTokenTypes.TOK_LE); cv[1] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(6)), OQLLexerTokenTypes.TOK_LE); cv[2] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(1)), OQLLexerTokenTypes.TOK_NE); oo = this.oganizedOperandsSingleRangeJunctionCreation(OQLLexerTokenTypes.LITERAL_and, cv, context); rj = (RangeJunction) oo.filterOperand; oo1 = rj.organizeOperands(context); assertTrue( RangeJunction.getSingleCondnEvaluatorKey(oo1.filterOperand).equals(new Integer(6))); assertTrue(RangeJunction .getSingleCondnEvaluatorOperator(oo1.filterOperand) == OQLLexerTokenTypes.TOK_LE); assertTrue(RangeJunction.getKeysToBeRemoved(oo1.filterOperand).iterator().next() .equals(new Integer(1))); cv = new CompiledComparison[3]; cv[0] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(7)), OQLLexerTokenTypes.TOK_LE); cv[1] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(6)), OQLLexerTokenTypes.TOK_LE); cv[2] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(6)), OQLLexerTokenTypes.TOK_NE); oo = this.oganizedOperandsSingleRangeJunctionCreation(OQLLexerTokenTypes.LITERAL_and, cv, context); rj = (RangeJunction) oo.filterOperand; oo1 = rj.organizeOperands(context); assertTrue( RangeJunction.getSingleCondnEvaluatorKey(oo1.filterOperand).equals(new Integer(6))); assertTrue(RangeJunction .getSingleCondnEvaluatorOperator(oo1.filterOperand) == OQLLexerTokenTypes.TOK_LE); assertTrue(RangeJunction.getKeysToBeRemoved((oo1.filterOperand)).iterator().next() .equals(new Integer(6))); cv = new CompiledComparison[3]; cv[0] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(7)), OQLLexerTokenTypes.TOK_LE); cv[1] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(6)), OQLLexerTokenTypes.TOK_LE); cv[2] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(7)), OQLLexerTokenTypes.TOK_NE); oo = this.oganizedOperandsSingleRangeJunctionCreation(OQLLexerTokenTypes.LITERAL_and, cv, context); rj = (RangeJunction) oo.filterOperand; oo1 = rj.organizeOperands(context); assertTrue(oo1.filterOperand == cv[1]); cv = new CompiledComparison[5]; cv[0] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(7)), OQLLexerTokenTypes.TOK_LE); cv[1] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(6)), OQLLexerTokenTypes.TOK_LE); cv[2] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(7)), OQLLexerTokenTypes.TOK_NE); cv[3] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(10)), OQLLexerTokenTypes.TOK_NE); cv[4] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(8)), OQLLexerTokenTypes.TOK_NE); oo = this.oganizedOperandsSingleRangeJunctionCreation(OQLLexerTokenTypes.LITERAL_and, cv, context); rj = (RangeJunction) oo.filterOperand; oo1 = rj.organizeOperands(context); assertTrue(oo1.filterOperand == cv[1]); cv = new CompiledComparison[7]; cv[0] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(7)), OQLLexerTokenTypes.TOK_LE); cv[1] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(6)), OQLLexerTokenTypes.TOK_LE); cv[2] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(7)), OQLLexerTokenTypes.TOK_NE); cv[3] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(8)), OQLLexerTokenTypes.TOK_NE); cv[4] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(9)), OQLLexerTokenTypes.TOK_NE); cv[5] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(2)), OQLLexerTokenTypes.TOK_NE); cv[6] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"), new CompiledLiteral(new Integer(6)), OQLLexerTokenTypes.TOK_NE); oo = this.oganizedOperandsSingleRangeJunctionCreation(OQLLexerTokenTypes.LITERAL_and, cv, context); rj = (RangeJunction) oo.filterOperand; oo1 = rj.organizeOperands(context); assertTrue( RangeJunction.getSingleCondnEvaluatorKey(oo1.filterOperand).equals(new Integer(6))); assertTrue(RangeJunction .getSingleCondnEvaluatorOperator(oo1.filterOperand) == OQLLexerTokenTypes.TOK_LE); Iterator itr = RangeJunction.getKeysToBeRemoved((oo1.filterOperand)).iterator(); Object temp; assertTrue((temp = itr.next()).equals(new Integer(2)) temp.equals(new Integer(6))); assertTrue((temp = itr.next()).equals(new Integer(2)) temp.equals(new Integer(6))); assertFalse(itr.hasNext()); } catch (Exception e) { logger.error(e); fail(e.toString()); } }
/** * Tests the functionality of organizedOperands function of a RangeJunction for various * combinations of LESS THAN and Not equal conditions etc which results in a SingleCondnEvaluator * or CompiledComparison for a AND junction. It checks the correctness of the operator & the * evaluated key * */
Tests the functionality of organizedOperands function of a RangeJunction for various combinations of LESS THAN and Not equal conditions etc which results in a SingleCondnEvaluator or CompiledComparison for a AND junction. It checks the correctness of the operator & the evaluated key
testOrganizedOperandsSingleCondnEvalMultipleLessThanInEqualities_AND
{ "repo_name": "smgoller/geode", "path": "geode-core/src/integrationTest/java/org/apache/geode/cache/query/internal/CompiledJunctionInternalsJUnitTest.java", "license": "apache-2.0", "size": 163306 }
[ "java.util.Iterator", "org.apache.geode.LogWriter", "org.apache.geode.cache.query.CacheUtils", "org.apache.geode.cache.query.internal.parse.OQLLexerTokenTypes", "org.junit.Assert" ]
import java.util.Iterator; import org.apache.geode.LogWriter; import org.apache.geode.cache.query.CacheUtils; import org.apache.geode.cache.query.internal.parse.OQLLexerTokenTypes; import org.junit.Assert;
import java.util.*; import org.apache.geode.*; import org.apache.geode.cache.query.*; import org.apache.geode.cache.query.internal.parse.*; import org.junit.*;
[ "java.util", "org.apache.geode", "org.junit" ]
java.util; org.apache.geode; org.junit;
1,010,327
public static java.util.Set extractCentralBatchPrintSet(ims.domain.ILightweightDomainFactory domainFactory, ims.ocrr.vo.ResultsToBePrintedVoCollection voCollection) { return extractCentralBatchPrintSet(domainFactory, voCollection, null, new HashMap()); }
static java.util.Set function(ims.domain.ILightweightDomainFactory domainFactory, ims.ocrr.vo.ResultsToBePrintedVoCollection voCollection) { return extractCentralBatchPrintSet(domainFactory, voCollection, null, new HashMap()); }
/** * Create the ims.ocrr.orderingresults.domain.objects.CentralBatchPrint set from the value object collection. * @param domainFactory - used to create existing (persistent) domain objects. * @param voCollection - the collection of value objects */
Create the ims.ocrr.orderingresults.domain.objects.CentralBatchPrint set from the value object collection
extractCentralBatchPrintSet
{ "repo_name": "IMS-MAXIMS/openMAXIMS", "path": "Source Library/openmaxims_workspace/ValueObjects/src/ims/ocrr/vo/domain/ResultsToBePrintedVoAssembler.java", "license": "agpl-3.0", "size": 18183 }
[ "java.util.HashMap" ]
import java.util.HashMap;
import java.util.*;
[ "java.util" ]
java.util;
177,889
public static void endSection() { if (ExoPlayerLibraryInfo.TRACE_ENABLED && Util.SDK_INT >= 18) { endSectionV18(); } }
static void function() { if (ExoPlayerLibraryInfo.TRACE_ENABLED && Util.SDK_INT >= 18) { endSectionV18(); } }
/** * Writes a trace message to indicate that a given section of code has ended. * * @see android.os.Trace#endSection() */
Writes a trace message to indicate that a given section of code has ended
endSection
{ "repo_name": "gitanuj/ExoPlayer", "path": "library/src/main/java/com/google/android/exoplayer/util/TraceUtil.java", "license": "apache-2.0", "size": 1693 }
[ "com.google.android.exoplayer.ExoPlayerLibraryInfo" ]
import com.google.android.exoplayer.ExoPlayerLibraryInfo;
import com.google.android.exoplayer.*;
[ "com.google.android" ]
com.google.android;
1,768,812
public void setLastUpdateTimeKey(String key) { if (TextUtils.isEmpty(key)) { return; } mLastUpdateTimeKey = key; }
void function(String key) { if (TextUtils.isEmpty(key)) { return; } mLastUpdateTimeKey = key; }
/** * Specify the last update time by this key string * * @param key */
Specify the last update time by this key string
setLastUpdateTimeKey
{ "repo_name": "captainbupt/android-Ultra-Pull-To-Refresh-With-Load-More", "path": "ptr-lib/src/main/java/in/srain/cube/views/ptr/PtrClassicDefaultHeader.java", "license": "mit", "size": 10512 }
[ "android.text.TextUtils" ]
import android.text.TextUtils;
import android.text.*;
[ "android.text" ]
android.text;
1,646,171
public void getData() { if ( input.getFileName() != null ) { wFilename.setText( input.getFileName() ); } wServletOutput.setSelection( input.isServletOutput() ); setFlagsServletOption(); wDoNotOpenNewFileInit.setSelection( input.isDoNotOpenNewFileInit() ); wCreateParentFolder.setSelection( input.isCreateParentFolder() ); wExtension.setText( Const.NVL( input.getExtension(), "" ) ); wSeparator.setText( Const.NVL( input.getSeparator(), "" ) ); wEnclosure.setText( Const.NVL( input.getEnclosure(), "" ) ); if ( input.getFileFormat() != null ) { wFormat.select( 0 ); // default if not found: CR+LF for ( int i = 0; i < TextFileOutputMeta.formatMapperLineTerminator.length; i++ ) { if ( input.getFileFormat().equalsIgnoreCase( TextFileOutputMeta.formatMapperLineTerminator[i] ) ) { wFormat.select( i ); } } } if ( input.getFileCompression() != null ) { wCompression.setText( input.getFileCompression() ); } if ( input.getEncoding() != null ) { wEncoding.setText( input.getEncoding() ); } if ( input.getEndedLine() != null ) { wEndedLine.setText( input.getEndedLine() ); } wFileNameInField.setSelection( input.isFileNameInField() ); if ( input.getFileNameField() != null ) { wFileNameField.setText( input.getFileNameField() ); } wSplitEvery.setText( Const.NVL( input.getSplitEveryRows(), "" ) ); wEnclForced.setSelection( input.isEnclosureForced() ); wDisableEnclosureFix.setSelection( input.isEnclosureFixDisabled() ); wHeader.setSelection( input.isHeaderEnabled() ); wFooter.setSelection( input.isFooterEnabled() ); wAddDate.setSelection( input.isDateInFilename() ); wAddTime.setSelection( input.isTimeInFilename() ); wDateTimeFormat.setText( Const.NVL( input.getDateTimeFormat(), "" ) ); wSpecifyFormat.setSelection( input.isSpecifyingFormat() ); wAppend.setSelection( input.isFileAppended() ); wAddStepnr.setSelection( input.isStepNrInFilename() ); wAddPartnr.setSelection( input.isPartNrInFilename() ); wPad.setSelection( input.isPadded() ); wFastDump.setSelection( input.isFastDump() ); wAddToResult.setSelection( input.isAddToResultFiles() ); logDebug( "getting fields info..." ); for ( int i = 0; i < input.getOutputFields().length; i++ ) { TextFileField field = input.getOutputFields()[i]; TableItem item = wFields.table.getItem( i ); if ( field.getName() != null ) { item.setText( 1, field.getName() ); } item.setText( 2, field.getTypeDesc() ); if ( field.getFormat() != null ) { item.setText( 3, field.getFormat() ); } if ( field.getLength() >= 0 ) { item.setText( 4, "" + field.getLength() ); } if ( field.getPrecision() >= 0 ) { item.setText( 5, "" + field.getPrecision() ); } if ( field.getCurrencySymbol() != null ) { item.setText( 6, field.getCurrencySymbol() ); } if ( field.getDecimalSymbol() != null ) { item.setText( 7, field.getDecimalSymbol() ); } if ( field.getGroupingSymbol() != null ) { item.setText( 8, field.getGroupingSymbol() ); } String trim = field.getTrimTypeDesc(); if ( trim != null ) { item.setText( 9, trim ); } if ( field.getNullString() != null ) { item.setText( 10, field.getNullString() ); } } wFields.optWidth( true ); wStepname.selectAll(); wStepname.setFocus(); }
void function() { if ( input.getFileName() != null ) { wFilename.setText( input.getFileName() ); } wServletOutput.setSelection( input.isServletOutput() ); setFlagsServletOption(); wDoNotOpenNewFileInit.setSelection( input.isDoNotOpenNewFileInit() ); wCreateParentFolder.setSelection( input.isCreateParentFolder() ); wExtension.setText( Const.NVL( input.getExtension(), STRSTRSTRSTRSTRgetting fields info...STRSTR" + field.getPrecision() ); } if ( field.getCurrencySymbol() != null ) { item.setText( 6, field.getCurrencySymbol() ); } if ( field.getDecimalSymbol() != null ) { item.setText( 7, field.getDecimalSymbol() ); } if ( field.getGroupingSymbol() != null ) { item.setText( 8, field.getGroupingSymbol() ); } String trim = field.getTrimTypeDesc(); if ( trim != null ) { item.setText( 9, trim ); } if ( field.getNullString() != null ) { item.setText( 10, field.getNullString() ); } } wFields.optWidth( true ); wStepname.selectAll(); wStepname.setFocus(); }
/** * Copy information from the meta-data input to the dialog fields. */
Copy information from the meta-data input to the dialog fields
getData
{ "repo_name": "tkafalas/pentaho-kettle", "path": "ui/src/main/java/org/pentaho/di/ui/trans/steps/textfileoutput/TextFileOutputDialog.java", "license": "apache-2.0", "size": 67446 }
[ "org.pentaho.di.core.Const" ]
import org.pentaho.di.core.Const;
import org.pentaho.di.core.*;
[ "org.pentaho.di" ]
org.pentaho.di;
1,733,457
public static void createClientCache(String host, Integer port, String name) throws Exception { ClientInterestNotifyDUnitTest test = new ClientInterestNotifyDUnitTest(); Cache cacheClient = test.createCache(createProperties1()); AttributesFactory factory = new AttributesFactory(); factory.setScope(Scope.LOCAL); factory.setConcurrencyChecksEnabled(false); createPool2(host, factory, port); factory.setCacheListener(test.new EventListener(name + REGION_NAME1)); RegionAttributes attrs = factory.create(); cacheClient.createRegion(REGION_NAME1, attrs); factory = new AttributesFactory(); factory.setScope(Scope.LOCAL); factory.setConcurrencyChecksEnabled(false); createPool2(host, factory, port); factory.setCacheListener(test.new EventListener(name + REGION_NAME2)); attrs = factory.create(); cacheClient.createRegion(REGION_NAME2, attrs); factory = new AttributesFactory(); factory.setScope(Scope.LOCAL); factory.setConcurrencyChecksEnabled(false); createPool2(host, factory, port); factory.setCacheListener(test.new EventListener(name + REGION_NAME3)); attrs = factory.create(); cacheClient.createRegion(REGION_NAME3, attrs); }
static void function(String host, Integer port, String name) throws Exception { ClientInterestNotifyDUnitTest test = new ClientInterestNotifyDUnitTest(); Cache cacheClient = test.createCache(createProperties1()); AttributesFactory factory = new AttributesFactory(); factory.setScope(Scope.LOCAL); factory.setConcurrencyChecksEnabled(false); createPool2(host, factory, port); factory.setCacheListener(test.new EventListener(name + REGION_NAME1)); RegionAttributes attrs = factory.create(); cacheClient.createRegion(REGION_NAME1, attrs); factory = new AttributesFactory(); factory.setScope(Scope.LOCAL); factory.setConcurrencyChecksEnabled(false); createPool2(host, factory, port); factory.setCacheListener(test.new EventListener(name + REGION_NAME2)); attrs = factory.create(); cacheClient.createRegion(REGION_NAME2, attrs); factory = new AttributesFactory(); factory.setScope(Scope.LOCAL); factory.setConcurrencyChecksEnabled(false); createPool2(host, factory, port); factory.setCacheListener(test.new EventListener(name + REGION_NAME3)); attrs = factory.create(); cacheClient.createRegion(REGION_NAME3, attrs); }
/** * create client with 3 regions each with a unique listener * */
create client with 3 regions each with a unique listener
createClientCache
{ "repo_name": "deepakddixit/incubator-geode", "path": "geode-core/src/distributedTest/java/org/apache/geode/internal/cache/tier/sockets/ClientInterestNotifyDUnitTest.java", "license": "apache-2.0", "size": 21329 }
[ "org.apache.geode.cache.AttributesFactory", "org.apache.geode.cache.Cache", "org.apache.geode.cache.RegionAttributes", "org.apache.geode.cache.Scope" ]
import org.apache.geode.cache.AttributesFactory; import org.apache.geode.cache.Cache; import org.apache.geode.cache.RegionAttributes; import org.apache.geode.cache.Scope;
import org.apache.geode.cache.*;
[ "org.apache.geode" ]
org.apache.geode;
1,313,729
public boolean deployPolicy(String content, String fileName) throws AxisFault { File file = new File(APIConstants.POLICY_FILE_FOLDER); //WSO2Carbon_Home/repository/deployment/server // /throttle-config //if directory doesn't exist, make onee if (!file.exists()) { file.mkdir(); } File writeFile = new File(APIConstants.POLICY_FILE_LOCATION + fileName + APIConstants.XML_EXTENSION); //file // folder+/ FileOutputStream fos = null; try { fos = new FileOutputStream(writeFile); //if file doesn't exit make one if (!writeFile.exists()) { writeFile.createNewFile(); } byte[] contentInBytes = content.getBytes(); fos.write(contentInBytes); fos.flush(); return true; } catch (IOException e) { log.error("Error occurred writing to " + fileName + ":", e); } finally { try { if (fos != null) { fos.close(); } } catch (IOException e) { log.error("Error occurred closing file output stream", e); } } return false; }
boolean function(String content, String fileName) throws AxisFault { File file = new File(APIConstants.POLICY_FILE_FOLDER); if (!file.exists()) { file.mkdir(); } File writeFile = new File(APIConstants.POLICY_FILE_LOCATION + fileName + APIConstants.XML_EXTENSION); FileOutputStream fos = null; try { fos = new FileOutputStream(writeFile); if (!writeFile.exists()) { writeFile.createNewFile(); } byte[] contentInBytes = content.getBytes(); fos.write(contentInBytes); fos.flush(); return true; } catch (IOException e) { log.error(STR + fileName + ":", e); } finally { try { if (fos != null) { fos.close(); } } catch (IOException e) { log.error(STR, e); } } return false; }
/** * policy is writtent in to files * * @param content content to be written * @param fileName name of the file * @throws AxisFault */
policy is writtent in to files
deployPolicy
{ "repo_name": "harsha89/carbon-apimgt", "path": "components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/service/APIGatewayAdmin.java", "license": "apache-2.0", "size": 41004 }
[ "java.io.File", "java.io.FileOutputStream", "java.io.IOException", "org.apache.axis2.AxisFault", "org.wso2.carbon.apimgt.impl.APIConstants" ]
import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import org.apache.axis2.AxisFault; import org.wso2.carbon.apimgt.impl.APIConstants;
import java.io.*; import org.apache.axis2.*; import org.wso2.carbon.apimgt.impl.*;
[ "java.io", "org.apache.axis2", "org.wso2.carbon" ]
java.io; org.apache.axis2; org.wso2.carbon;
2,783,422
public String fieldsToString() { String result = ""; for (String key : fields.keySet()) { result += key + "=\"" + fields.get(key) + "\" "; } // remove the trailing whitespace return result.substring(0, result.length() - 1); } } private class MBeanConfig extends Config { public MBeanConfig() { this.name = "mbean"; } } private class MBeanAttributeConfig extends Config { public MBeanAttributeConfig() { this.name = "attribute"; } } private class MBeanCompositeConfig extends Config { public MBeanCompositeConfig() { this.name = "composite"; } } private static class ConfigWriter { private final PrintStream out; private final List<Config> configs; private static final String NL = System.getProperty("line.separator"); private static final String XML_DECL = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>"; private static final String XML_DOCTYPE = "<!DOCTYPE jmxetric-config [" + NL + " <!ELEMENT jmxetric-config (sample|ganglia|jvm)*>" + NL + " <!ELEMENT sample (mbean)*>" + NL + " <!ATTLIST sample delay CDATA #REQUIRED>" + NL + " <!ATTLIST sample initialdelay CDATA \"0\">" + NL + " <!ATTLIST sample dmax CDATA \"0\" >" + NL + " <!ELEMENT mbean (attribute)*>" + NL + " <!ATTLIST mbean name CDATA #REQUIRED>" + NL + " <!ATTLIST mbean pname CDATA #REQUIRED>" + NL + " <!ATTLIST mbean dmax CDATA \"0\" >" + " <!ELEMENT attribute (composite*)>" + NL + " <!ATTLIST attribute name CDATA #REQUIRED>" + NL + " <!ATTLIST attribute type CDATA \"\" >" + NL + " <!ATTLIST attribute units CDATA \"\" >" + NL + " <!ATTLIST attribute pname CDATA \"\" >" + NL + " <!ATTLIST attribute slope CDATA \"both\" >" + NL + " <!ATTLIST attribute dmax CDATA \"0\" >" + NL + " <!ELEMENT composite EMPTY>" + NL + " <!ATTLIST composite name CDATA #REQUIRED>" + NL + " <!ATTLIST composite type CDATA \"\" >" + NL + " <!ATTLIST composite units CDATA \"\" >" + NL + " <!ATTLIST composite pname CDATA \"\" >" + NL + " <!ATTLIST composite slope CDATA \"both\" >" + NL + " <!ATTLIST composite dmax CDATA \"0\" >" + NL + " <!ELEMENT ganglia EMPTY>" + NL + " <!ATTLIST ganglia hostname CDATA #REQUIRED>" + NL + " <!ATTLIST ganglia port CDATA #REQUIRED>" + NL + " <!ATTLIST ganglia mode CDATA #REQUIRED>" + NL + " <!ATTLIST ganglia wireformat31x CDATA #REQUIRED>" + NL + " <!ELEMENT jvm EMPTY>" + NL + " <!ATTLIST jvm process CDATA \"\">" + NL + "]>"; public ConfigWriter(PrintStream outputStream, List<Config> config) { this.out = outputStream; this.configs = config; }
String function() { String result = STR=\STR\" "; } return result.substring(0, result.length() - 1); } } private class MBeanConfig extends Config { public MBeanConfig() { this.name = "mbean"; } } private class MBeanAttributeConfig extends Config { public MBeanAttributeConfig() { this.name = STR; } } private class MBeanCompositeConfig extends Config { public MBeanCompositeConfig() { this.name = STR; } } private static class ConfigWriter { private final PrintStream out; private final List<Config> configs; private static final String NL = System.getProperty(STR); private static final String XML_DECL = STR1.0\STRISO-8859-1\STR; private static final String XML_DOCTYPE = STR + NL + STR + NL + STR + NL + STR + NL + STR0\">" + NL + STR0\STR + NL + STR + NL + STR + NL + STR + NL + STR0\STR + STR + NL + STR + NL + STR\STR + NL + STR\STR + NL + STR\STR + NL + STRboth\STR + NL + STR0\STR + NL + STR + NL + STR + NL + STR\STR + NL + STR\STR + NL + STR\STR + NL + STRboth\STR + NL + STR0\STR + NL + STR + NL + STR + NL + STR + NL + STR + NL + STR + NL + STR + NL + STR\">" + NL + "]>"; public ConfigWriter(PrintStream outputStream, List<Config> config) { this.out = outputStream; this.configs = config; }
/** * Printable representation of all the fields of this Config * * @return A String with all the fields in this format <key>="<value>" */
Printable representation of all the fields of this Config
fieldsToString
{ "repo_name": "ganglia/jmxetric", "path": "src/main/java/info/ganglia/jmxetric/MBeanScanner.java", "license": "mit", "size": 14590 }
[ "java.io.PrintStream", "java.util.List" ]
import java.io.PrintStream; import java.util.List;
import java.io.*; import java.util.*;
[ "java.io", "java.util" ]
java.io; java.util;
557,812
private DataRegionConfiguration createTxLogRegion(DataStorageConfiguration dscfg) { DataRegionConfiguration cfg = new DataRegionConfiguration(); cfg.setName(TX_LOG_CACHE_NAME); cfg.setInitialSize(dscfg.getSystemRegionInitialSize()); cfg.setMaxSize(dscfg.getSystemRegionMaxSize()); cfg.setPersistenceEnabled(CU.isPersistenceEnabled(dscfg)); cfg.setLazyMemoryAllocation(false); return cfg; }
DataRegionConfiguration function(DataStorageConfiguration dscfg) { DataRegionConfiguration cfg = new DataRegionConfiguration(); cfg.setName(TX_LOG_CACHE_NAME); cfg.setInitialSize(dscfg.getSystemRegionInitialSize()); cfg.setMaxSize(dscfg.getSystemRegionMaxSize()); cfg.setPersistenceEnabled(CU.isPersistenceEnabled(dscfg)); cfg.setLazyMemoryAllocation(false); return cfg; }
/** * TODO IGNITE-7966 * * @return Data region configuration. */
TODO IGNITE-7966
createTxLogRegion
{ "repo_name": "daradurvs/ignite", "path": "modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/MvccProcessorImpl.java", "license": "apache-2.0", "size": 86079 }
[ "org.apache.ignite.configuration.DataRegionConfiguration", "org.apache.ignite.configuration.DataStorageConfiguration", "org.apache.ignite.internal.util.typedef.internal.CU" ]
import org.apache.ignite.configuration.DataRegionConfiguration; import org.apache.ignite.configuration.DataStorageConfiguration; import org.apache.ignite.internal.util.typedef.internal.CU;
import org.apache.ignite.configuration.*; import org.apache.ignite.internal.util.typedef.internal.*;
[ "org.apache.ignite" ]
org.apache.ignite;
2,287,732
public Builder add(LocalDateTime timestamp, Duration duration){ long tsLong; int durInt; switch(unit){ case MINUTES: tsLong = timestamp.toEpochSecond(ZoneOffset.UTC)/60; durInt = duration == null ? (timestamps.size() == 0 ? 0 : -1) : (int) duration.toMinutes(); break; case SECONDS: tsLong = timestamp.toEpochSecond(ZoneOffset.UTC); durInt = duration == null ? (timestamps.size() == 0 ? 0 : -1) : (int)(duration.toMillis() / 1000); break; case MILLIS: tsLong = timestamp.toInstant(ZoneOffset.UTC).toEpochMilli(); durInt = duration == null ? (timestamps.size() == 0 ? 0 : -1) : (int) duration.toMillis(); break; default: throw new IllegalArgumentException("Unit not supported: " + unit); } return add(tsLong, durInt); }
Builder function(LocalDateTime timestamp, Duration duration){ long tsLong; int durInt; switch(unit){ case MINUTES: tsLong = timestamp.toEpochSecond(ZoneOffset.UTC)/60; durInt = duration == null ? (timestamps.size() == 0 ? 0 : -1) : (int) duration.toMinutes(); break; case SECONDS: tsLong = timestamp.toEpochSecond(ZoneOffset.UTC); durInt = duration == null ? (timestamps.size() == 0 ? 0 : -1) : (int)(duration.toMillis() / 1000); break; case MILLIS: tsLong = timestamp.toInstant(ZoneOffset.UTC).toEpochMilli(); durInt = duration == null ? (timestamps.size() == 0 ? 0 : -1) : (int) duration.toMillis(); break; default: throw new IllegalArgumentException(STR + unit); } return add(tsLong, durInt); }
/** * Add a data point * @param timestamp the timestamp of the data point * @param duration the duration, can be null if the duration is the same as previous one or if this is the first data point and the duration is zero * @return the builder itself */
Add a data point
add
{ "repo_name": "james-hu/jabb-core-java8", "path": "src/main/java/net/sf/jabb/cjtsd/CJTSD.java", "license": "apache-2.0", "size": 12074 }
[ "java.time.Duration", "java.time.LocalDateTime", "java.time.ZoneOffset" ]
import java.time.Duration; import java.time.LocalDateTime; import java.time.ZoneOffset;
import java.time.*;
[ "java.time" ]
java.time;
2,625,408
public void setAmazonDDBClient(AmazonDynamoDB amazonDDBClient) { this.amazonDDBClient = amazonDDBClient; }
void function(AmazonDynamoDB amazonDDBClient) { this.amazonDDBClient = amazonDDBClient; }
/** * To use the AmazonDynamoDB as the client */
To use the AmazonDynamoDB as the client
setAmazonDDBClient
{ "repo_name": "isavin/camel", "path": "components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DdbConfiguration.java", "license": "apache-2.0", "size": 5344 }
[ "com.amazonaws.services.dynamodbv2.AmazonDynamoDB" ]
import com.amazonaws.services.dynamodbv2.AmazonDynamoDB;
import com.amazonaws.services.dynamodbv2.*;
[ "com.amazonaws.services" ]
com.amazonaws.services;
927,190
Map<T, U> map = new LinkedHashMap<>(); for (Map.Entry<T, U> entry : entries) { map.put(entry.getKey(), entry.getValue()); } return unmodifiableMap(map); }
Map<T, U> map = new LinkedHashMap<>(); for (Map.Entry<T, U> entry : entries) { map.put(entry.getKey(), entry.getValue()); } return unmodifiableMap(map); }
/** * Create new, non modifiable, map from given entries. * * @param entries Map entries. * @param <T> Type of keys in map. * @param <U> Type of values in map. * @return The map. */
Create new, non modifiable, map from given entries
newMap
{ "repo_name": "mjeanroy/node-maven-plugin", "path": "src/test/java/com/github/mjeanroy/maven/plugins/node/tests/CollectionTestUtils.java", "license": "mit", "size": 2695 }
[ "java.util.Collections", "java.util.LinkedHashMap", "java.util.Map" ]
import java.util.Collections; import java.util.LinkedHashMap; import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
187,914
@Authorized( { PrivilegeConstants.VIEW_RELATIONSHIPS }) public List<Relationship> getRelationships(Person fromPerson, Person toPerson, RelationshipType relType, Date startEffectiveDate, Date endEffectiveDate) throws APIException;
@Authorized( { PrivilegeConstants.VIEW_RELATIONSHIPS }) List<Relationship> function(Person fromPerson, Person toPerson, RelationshipType relType, Date startEffectiveDate, Date endEffectiveDate) throws APIException;
/** * Get relationships stored in the database that were active during the specified date range * * @param fromPerson (optional) Person to in the person_id column * @param toPerson (optional) Person in the relative_id column * @param relType (optional) The RelationshipType to match * @param startEffectiveDate (optional) The date during which the relationship was effective * (lower bound) * @param endEffectiveDate (optional) The date during which the relationship was effective * (upper bound) * @return relationships matching the given parameters * @throws APIException * @should fetch relationships matching the given from person * @should fetch relationships matching the given to person * @should fetch relationships matching the given rel type * @should return empty list when no relationship matching given parameters exist * @should fetch relationships that were active during the specified date range */
Get relationships stored in the database that were active during the specified date range
getRelationships
{ "repo_name": "Bhamni/openmrs-core", "path": "api/src/main/java/org/openmrs/api/PersonService.java", "license": "mpl-2.0", "size": 41991 }
[ "java.util.Date", "java.util.List", "org.openmrs.Person", "org.openmrs.Relationship", "org.openmrs.RelationshipType", "org.openmrs.annotation.Authorized", "org.openmrs.util.PrivilegeConstants" ]
import java.util.Date; import java.util.List; import org.openmrs.Person; import org.openmrs.Relationship; import org.openmrs.RelationshipType; import org.openmrs.annotation.Authorized; import org.openmrs.util.PrivilegeConstants;
import java.util.*; import org.openmrs.*; import org.openmrs.annotation.*; import org.openmrs.util.*;
[ "java.util", "org.openmrs", "org.openmrs.annotation", "org.openmrs.util" ]
java.util; org.openmrs; org.openmrs.annotation; org.openmrs.util;
1,998,973
private String getIccStateReason(State state) { switch (state) { case PIN_REQUIRED: return IccCardConstants.INTENT_VALUE_LOCKED_ON_PIN; case PUK_REQUIRED: return IccCardConstants.INTENT_VALUE_LOCKED_ON_PUK; case NETWORK_LOCKED: return IccCardConstants.INTENT_VALUE_LOCKED_NETWORK; case PERM_DISABLED: return IccCardConstants.INTENT_VALUE_ABSENT_ON_PERM_DISABLED; default: return null; } }
String function(State state) { switch (state) { case PIN_REQUIRED: return IccCardConstants.INTENT_VALUE_LOCKED_ON_PIN; case PUK_REQUIRED: return IccCardConstants.INTENT_VALUE_LOCKED_ON_PUK; case NETWORK_LOCKED: return IccCardConstants.INTENT_VALUE_LOCKED_NETWORK; case PERM_DISABLED: return IccCardConstants.INTENT_VALUE_ABSENT_ON_PERM_DISABLED; default: return null; } }
/** * Locked state have a reason (PIN, PUK, NETWORK, PERM_DISABLED) * @return reason */
Locked state have a reason (PIN, PUK, NETWORK, PERM_DISABLED)
getIccStateReason
{ "repo_name": "indashnet/InDashNet.Open.UN2000", "path": "android/frameworks/opt/telephony/src/java/com/android/internal/telephony/uicc/IccCardProxy.java", "license": "apache-2.0", "size": 28266 }
[ "com.android.internal.telephony.IccCardConstants" ]
import com.android.internal.telephony.IccCardConstants;
import com.android.internal.telephony.*;
[ "com.android.internal" ]
com.android.internal;
781,974
@Override public void onSensorChanged(SensorEvent event) { HromatkaLog.getInstance().enter(TAG); Log.v(TAG, "accel x,y,z = " + event.values[0] + ", " + event.values[1] + ", " + event.values[2]); notifyListenersDataReceived(event.timestamp, event.values); HromatkaLog.getInstance().exit(TAG); }
void function(SensorEvent event) { HromatkaLog.getInstance().enter(TAG); Log.v(TAG, STR + event.values[0] + STR + event.values[1] + STR + event.values[2]); notifyListenersDataReceived(event.timestamp, event.values); HromatkaLog.getInstance().exit(TAG); }
/** * This class's listener for new sensor data from the internal Android accelerometer * implementation. Required via the SensorEventListener implementation. * * @param event SensorEvent data from Android */
This class's listener for new sensor data from the internal Android accelerometer implementation. Required via the SensorEventListener implementation
onSensorChanged
{ "repo_name": "drakenclimber/inclinometer", "path": "tomsinclinometer/src/main/java/com/tomhromatka/service/sensors/SensorAccelerometer.java", "license": "apache-2.0", "size": 4258 }
[ "android.hardware.SensorEvent", "android.util.Log", "com.tomhromatka.service.HromatkaLog" ]
import android.hardware.SensorEvent; import android.util.Log; import com.tomhromatka.service.HromatkaLog;
import android.hardware.*; import android.util.*; import com.tomhromatka.service.*;
[ "android.hardware", "android.util", "com.tomhromatka.service" ]
android.hardware; android.util; com.tomhromatka.service;
1,837,646
@Override @XmlTransient public JSONObject toJsonObject() { JSONObject returnVal = super.toJsonObject(); returnVal.put(JSONMapping.ENABLE_RENDER_EMPTY_TABLE, this.isEnableRenderEmptyTable()); returnVal.put(JSONMapping.ENABLE_BULK_EDIT, this.isEnableBulkEdit()); returnVal.put(JSONMapping.ATTACHMENT_THUMBNAIL_SIZE, this.getAttachmentThumbnailSize()); returnVal.put(JSONMapping.ATTACHMENT_PREVIEW_SIZE, this.getAttachmentPreviewSize()); returnVal.put(JSONMapping.ATTACHMENT_COLUMN_MAX_IMAGE_COUNT, this.getAttachmentColumnMaxImageCount()); returnVal.put(JSONMapping.GROUP_ORDER, this.getGroupOrder()); returnVal.put(JSONMapping.SHOW_BUTTON_BULK_UPDATE, this.isShowButtonBulkUpdate()); returnVal.put(JSONMapping.SHOW_BUTTON_EXPORT, this.isShowButtonExport()); returnVal.put(JSONMapping.SHOW_BUTTON_SEND_ON, this.isShowButtonSendOn()); returnVal.put(JSONMapping.SHOW_BUTTON_DELETE, this.isShowButtonDelete()); returnVal.put(JSONMapping.SHOW_BUTTON_LOCK, this.isShowButtonLock()); returnVal.put(JSONMapping.SHOW_BUTTON_ADD_TO_PI, this.isShowButtonAddToPI()); if (this.getJobViewGroupId() != null) { returnVal.put(JSONMapping.JOB_VIEW_GROUP_ID, this.getJobViewGroupId()); } if (this.getJobViewGroupName() != null) { returnVal.put(JSONMapping.JOB_VIEW_GROUP_NAME, this.getJobViewGroupName()); } if (this.getJobViewGroupIcon() != null) { returnVal.put(JSONMapping.JOB_VIEW_GROUP_ICON, this.getJobViewGroupIcon()); } if (this.getTableGenerateMode() != null) { returnVal.put(JSONMapping.TABLE_GENERATE_MODE, this.getTableGenerateMode()); } if (this.getAttachmentColumnLabel() != null) { returnVal.put(JSONMapping.ATTACHMENT_COLUMN_LABEL, this.getAttachmentColumnLabel()); } if (this.getAttachmentColumnLayout() != null) { returnVal.put(JSONMapping.ATTACHMENT_COLUMN_LAYOUT, this.getAttachmentColumnLayout()); } if (this.getTableMaxCountPerPage() != null) { returnVal.put(JSONMapping.TABLE_MAX_COUNT_PER_PAGE, this.getTableMaxCountPerPage()); } if (this.getWebKitViewSubs() != null && !this.getWebKitViewSubs().isEmpty()) { JSONArray jsonArray = new JSONArray(); for (WebKitViewSub toAdd : this.getWebKitViewSubs()) { jsonArray.put(toAdd.toJsonObject()); } returnVal.put(JSONMapping.WEB_KIT_VIEW_SUBS, jsonArray); } returnVal.put(JSONMapping.OPEN_WORK_ITEM_IN_MAIN_LAYOUT, this.isOpenWorkItemInMainLayout()); return returnVal; }
JSONObject function() { JSONObject returnVal = super.toJsonObject(); returnVal.put(JSONMapping.ENABLE_RENDER_EMPTY_TABLE, this.isEnableRenderEmptyTable()); returnVal.put(JSONMapping.ENABLE_BULK_EDIT, this.isEnableBulkEdit()); returnVal.put(JSONMapping.ATTACHMENT_THUMBNAIL_SIZE, this.getAttachmentThumbnailSize()); returnVal.put(JSONMapping.ATTACHMENT_PREVIEW_SIZE, this.getAttachmentPreviewSize()); returnVal.put(JSONMapping.ATTACHMENT_COLUMN_MAX_IMAGE_COUNT, this.getAttachmentColumnMaxImageCount()); returnVal.put(JSONMapping.GROUP_ORDER, this.getGroupOrder()); returnVal.put(JSONMapping.SHOW_BUTTON_BULK_UPDATE, this.isShowButtonBulkUpdate()); returnVal.put(JSONMapping.SHOW_BUTTON_EXPORT, this.isShowButtonExport()); returnVal.put(JSONMapping.SHOW_BUTTON_SEND_ON, this.isShowButtonSendOn()); returnVal.put(JSONMapping.SHOW_BUTTON_DELETE, this.isShowButtonDelete()); returnVal.put(JSONMapping.SHOW_BUTTON_LOCK, this.isShowButtonLock()); returnVal.put(JSONMapping.SHOW_BUTTON_ADD_TO_PI, this.isShowButtonAddToPI()); if (this.getJobViewGroupId() != null) { returnVal.put(JSONMapping.JOB_VIEW_GROUP_ID, this.getJobViewGroupId()); } if (this.getJobViewGroupName() != null) { returnVal.put(JSONMapping.JOB_VIEW_GROUP_NAME, this.getJobViewGroupName()); } if (this.getJobViewGroupIcon() != null) { returnVal.put(JSONMapping.JOB_VIEW_GROUP_ICON, this.getJobViewGroupIcon()); } if (this.getTableGenerateMode() != null) { returnVal.put(JSONMapping.TABLE_GENERATE_MODE, this.getTableGenerateMode()); } if (this.getAttachmentColumnLabel() != null) { returnVal.put(JSONMapping.ATTACHMENT_COLUMN_LABEL, this.getAttachmentColumnLabel()); } if (this.getAttachmentColumnLayout() != null) { returnVal.put(JSONMapping.ATTACHMENT_COLUMN_LAYOUT, this.getAttachmentColumnLayout()); } if (this.getTableMaxCountPerPage() != null) { returnVal.put(JSONMapping.TABLE_MAX_COUNT_PER_PAGE, this.getTableMaxCountPerPage()); } if (this.getWebKitViewSubs() != null && !this.getWebKitViewSubs().isEmpty()) { JSONArray jsonArray = new JSONArray(); for (WebKitViewSub toAdd : this.getWebKitViewSubs()) { jsonArray.put(toAdd.toJsonObject()); } returnVal.put(JSONMapping.WEB_KIT_VIEW_SUBS, jsonArray); } returnVal.put(JSONMapping.OPEN_WORK_ITEM_IN_MAIN_LAYOUT, this.isOpenWorkItemInMainLayout()); return returnVal; }
/** * Returns the local JSON object. * Only set through constructor. * * @return The local set {@code JSONObject} object. */
Returns the local JSON object. Only set through constructor
toJsonObject
{ "repo_name": "Koekiebox-PTY-LTD/Fluid", "path": "fluid-api/src/main/java/com/fluidbpm/program/api/vo/webkit/viewgroup/WebKitViewGroup.java", "license": "gpl-3.0", "size": 15594 }
[ "org.json.JSONArray", "org.json.JSONObject" ]
import org.json.JSONArray; import org.json.JSONObject;
import org.json.*;
[ "org.json" ]
org.json;
1,944,571
public Component addFill(Component component) { return this.add(component, CONSTRAINT_FILL); }
Component function(Component component) { return this.add(component, CONSTRAINT_FILL); }
/** * Adding an element, setting the layout such that the element gets additional vertical space if available. * @param component The component to add. * @return The added component. */
Adding an element, setting the layout such that the element gets additional vertical space if available
addFill
{ "repo_name": "langmo/youscope", "path": "core/api/src/main/java/org/youscope/uielements/DynamicPanel.java", "license": "gpl-2.0", "size": 7089 }
[ "java.awt.Component" ]
import java.awt.Component;
import java.awt.*;
[ "java.awt" ]
java.awt;
514,107
@Override public void setOwner(Path p, String username, String groupname) throws IOException { FileUtil.setOwner(pathToFile(p), username, groupname); }
void function(Path p, String username, String groupname) throws IOException { FileUtil.setOwner(pathToFile(p), username, groupname); }
/** * Use the command chown to set owner. */
Use the command chown to set owner
setOwner
{ "repo_name": "tomatoKiller/Hadoop_Source_Learn", "path": "hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/RawLocalFileSystem.java", "license": "apache-2.0", "size": 20264 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
4,852
private int getReadPosition(SAMRecord record, Variant variant) { int readPosition = -1; for(AlignmentBlock alignmentBlock : record.getAlignmentBlocks()) { if(alignmentBlock.getReferenceStart() <= variant.getStart() + 1 && variant.getStart() + 1 <= alignmentBlock.getReferenceStart() + alignmentBlock.getLength()) { readPosition = variant.getStart() + 1 - alignmentBlock.getReferenceStart() + alignmentBlock.getReadStart() - 1; break; } } return readPosition; }
int function(SAMRecord record, Variant variant) { int readPosition = -1; for(AlignmentBlock alignmentBlock : record.getAlignmentBlocks()) { if(alignmentBlock.getReferenceStart() <= variant.getStart() + 1 && variant.getStart() + 1 <= alignmentBlock.getReferenceStart() + alignmentBlock.getLength()) { readPosition = variant.getStart() + 1 - alignmentBlock.getReferenceStart() + alignmentBlock.getReadStart() - 1; break; } } return readPosition; }
/** * Get ReadPosition of variant in read * @param record * @param variant * @return */
Get ReadPosition of variant in read
getReadPosition
{ "repo_name": "dieterich-lab/JACUSA", "path": "tools/AddVariants/src/addvariants/AddVariants.java", "license": "gpl-3.0", "size": 6505 }
[ "net.sf.samtools.AlignmentBlock", "net.sf.samtools.SAMRecord" ]
import net.sf.samtools.AlignmentBlock; import net.sf.samtools.SAMRecord;
import net.sf.samtools.*;
[ "net.sf.samtools" ]
net.sf.samtools;
771,195
boolean play(Device device, String path);
boolean play(Device device, String path);
/** * Play the video with the video path. * * @param device * The device be controlled. * @param path * The path of the video. * @return If is success to play the video. */
Play the video with the video path
play
{ "repo_name": "lxxgreat/VideoPlayer", "path": "app/src/main/java/com/shane/android/videoplayer/interf/IController.java", "license": "mit", "size": 3180 }
[ "org.cybergarage.upnp.Device" ]
import org.cybergarage.upnp.Device;
import org.cybergarage.upnp.*;
[ "org.cybergarage.upnp" ]
org.cybergarage.upnp;
1,939,416
@Variability(id = AnnotationConstants.MONITOR_MEMORY_USAGE) @Override public void memoryFreed(long tag, long size) { // TODO remove size if (isRecording) { long tid = SystemMonitoring.getCurrentThreadId(); RecordingStack stack = Lock.THREAD_STACKS.get(tid); if (null != stack) { long account = stack.top(-1); if (account >= 0) { // no change of account here SystemMonitoring.MEMORY_DATA_GATHERER. recordUnallocationByTag(tag); stack.top(account); } } } // TODO cleanup }
@Variability(id = AnnotationConstants.MONITOR_MEMORY_USAGE) void function(long tag, long size) { if (isRecording) { long tid = SystemMonitoring.getCurrentThreadId(); RecordingStack stack = Lock.THREAD_STACKS.get(tid); if (null != stack) { long account = stack.top(-1); if (account >= 0) { SystemMonitoring.MEMORY_DATA_GATHERER. recordUnallocationByTag(tag); stack.top(account); } } } }
/** * Notifies the recorder about an object freed from memory. Please note * that dependent on the concrete instrumentation not all memory frees * might be detected, e.g. those of immediate system classes (e.g. * <code>Object</code> cannot be instrumented, garbage collector not called * when JVM is running, etc.). [Java call, native call] * * @param tag the identification of the object to be freed, e.g. its memory * address * @param size the size of the freed object (ignored) * * @since 1.00 */
Notifies the recorder about an object freed from memory. Please note that dependent on the concrete instrumentation not all memory frees might be detected, e.g. those of immediate system classes (e.g. <code>Object</code> cannot be instrumented, garbage collector not called when JVM is running, etc.). [Java call, native call]
memoryFreed
{ "repo_name": "SSEHUB/spassMeter", "path": "Instrumentation.ex/src/de/uni_hildesheim/sse/monitoring/runtime/recording/Recorder.java", "license": "apache-2.0", "size": 53045 }
[ "de.uni_hildesheim.sse.codeEraser.annotations.Variability", "de.uni_hildesheim.sse.monitoring.runtime.AnnotationConstants" ]
import de.uni_hildesheim.sse.codeEraser.annotations.Variability; import de.uni_hildesheim.sse.monitoring.runtime.AnnotationConstants;
import de.uni_hildesheim.sse.*; import de.uni_hildesheim.sse.monitoring.runtime.*;
[ "de.uni_hildesheim.sse" ]
de.uni_hildesheim.sse;
2,028,742
public BusinessActivitiesNonProfitOrganizationsClient nonProfitOrganizations() { return (BusinessActivitiesNonProfitOrganizationsClient) getClient("nonprofitorganizations"); }
BusinessActivitiesNonProfitOrganizationsClient function() { return (BusinessActivitiesNonProfitOrganizationsClient) getClient(STR); }
/** * <p>Retrieve the client for interacting with business activities non-profit * organizations data.</p> * * @return a client for business activities non-profit organizations data */
Retrieve the client for interacting with business activities non-profit organizations data
nonProfitOrganizations
{ "repo_name": "dannil/scb-java-client", "path": "src/main/java/com/github/dannil/scbjavaclient/client/businessactivities/BusinessActivitiesClient.java", "license": "apache-2.0", "size": 7622 }
[ "com.github.dannil.scbjavaclient.client.businessactivities.nonprofitorganizations.BusinessActivitiesNonProfitOrganizationsClient" ]
import com.github.dannil.scbjavaclient.client.businessactivities.nonprofitorganizations.BusinessActivitiesNonProfitOrganizationsClient;
import com.github.dannil.scbjavaclient.client.businessactivities.nonprofitorganizations.*;
[ "com.github.dannil" ]
com.github.dannil;
920,589
public void testLocal() { GridCacheAdapter<String, String> cache = grid.internalCache(); GridCacheTestEntryEx entry = new GridCacheTestEntryEx(cache.context(), "1"); GridCacheVersion ver3 = version(3); GridCacheVersion ver4 = version(4); GridCacheVersion ver5 = version(5); entry.addLocal(3, ver3, 0, true, true); Collection<GridCacheMvccCandidate> cands = entry.localCandidates(); assert cands.size() == 1; assert cands.iterator().next().version().equals(ver3); entry.addLocal(5, ver5, 0, true, true); cands = entry.localCandidates(); assert cands.size() == 2; info(cands); // Check order. checkOrder(cands, ver3, ver5); assert entry.anyOwner() == null; entry.readyLocal(ver3); checkLocalOwner(entry.anyOwner(), ver3, false); // Reentry. entry.addLocal(3, ver4, 0, true, true); checkLocalOwner(entry.anyOwner(), ver4, true); assert entry.localCandidates().size() == 2; assert entry.localCandidates(true).size() == 3; // Check order. checkOrder(entry.localCandidates(true), ver4, ver3, ver5); entry.removeLock(ver4); assert entry.localCandidates(true).size() == 2; entry.readyLocal(ver5); checkLocalOwner(entry.anyOwner(), ver3, false); // Check order. checkOrder(entry.localCandidates(true), ver3, ver5); entry.removeLock(ver3); assert entry.localCandidates(true).size() == 1; checkLocalOwner(entry.anyOwner(), ver5, false); assert !entry.lockedByAny(ver5); entry.removeLock(ver5); assert !entry.lockedByAny(); assert entry.anyOwner() == null; assert entry.localCandidates(true).isEmpty(); }
void function() { GridCacheAdapter<String, String> cache = grid.internalCache(); GridCacheTestEntryEx entry = new GridCacheTestEntryEx(cache.context(), "1"); GridCacheVersion ver3 = version(3); GridCacheVersion ver4 = version(4); GridCacheVersion ver5 = version(5); entry.addLocal(3, ver3, 0, true, true); Collection<GridCacheMvccCandidate> cands = entry.localCandidates(); assert cands.size() == 1; assert cands.iterator().next().version().equals(ver3); entry.addLocal(5, ver5, 0, true, true); cands = entry.localCandidates(); assert cands.size() == 2; info(cands); checkOrder(cands, ver3, ver5); assert entry.anyOwner() == null; entry.readyLocal(ver3); checkLocalOwner(entry.anyOwner(), ver3, false); entry.addLocal(3, ver4, 0, true, true); checkLocalOwner(entry.anyOwner(), ver4, true); assert entry.localCandidates().size() == 2; assert entry.localCandidates(true).size() == 3; checkOrder(entry.localCandidates(true), ver4, ver3, ver5); entry.removeLock(ver4); assert entry.localCandidates(true).size() == 2; entry.readyLocal(ver5); checkLocalOwner(entry.anyOwner(), ver3, false); checkOrder(entry.localCandidates(true), ver3, ver5); entry.removeLock(ver3); assert entry.localCandidates(true).size() == 1; checkLocalOwner(entry.anyOwner(), ver5, false); assert !entry.lockedByAny(ver5); entry.removeLock(ver5); assert !entry.lockedByAny(); assert entry.anyOwner() == null; assert entry.localCandidates(true).isEmpty(); }
/** * Tests remote candidates. */
Tests remote candidates
testLocal
{ "repo_name": "adeelmahmood/ignite", "path": "modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMvccSelfTest.java", "license": "apache-2.0", "size": 61239 }
[ "java.util.Collection", "org.apache.ignite.internal.processors.cache.version.GridCacheVersion" ]
import java.util.Collection; import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
import java.util.*; import org.apache.ignite.internal.processors.cache.version.*;
[ "java.util", "org.apache.ignite" ]
java.util; org.apache.ignite;
1,600,050
AffineTransform getTransform();
AffineTransform getTransform();
/** * Returns the transform of this node or null if any. */
Returns the transform of this node or null if any
getTransform
{ "repo_name": "sflyphotobooks/crp-batik", "path": "sources/org/apache/batik/gvt/GraphicsNode.java", "license": "apache-2.0", "size": 13618 }
[ "java.awt.geom.AffineTransform" ]
import java.awt.geom.AffineTransform;
import java.awt.geom.*;
[ "java.awt" ]
java.awt;
25,212
public void close() throws IOException { synchronized(closeLock) { if (isClosed()) return; if (created) impl.close(); closed = true; } } /** * Returns the unique {@link java.nio.channels.ServerSocketChannel} object * associated with this socket, if any. * * <p> A server socket will have a channel if, and only if, the channel * itself was created via the {@link * java.nio.channels.ServerSocketChannel#open ServerSocketChannel.open}
void function() throws IOException { synchronized(closeLock) { if (isClosed()) return; if (created) impl.close(); closed = true; } } /** * Returns the unique {@link java.nio.channels.ServerSocketChannel} object * associated with this socket, if any. * * <p> A server socket will have a channel if, and only if, the channel * itself was created via the { * java.nio.channels.ServerSocketChannel#open ServerSocketChannel.open}
/** * Closes this socket. * * Any thread currently blocked in {@link #accept()} will throw * a {@link SocketException}. * * <p> If this socket has an associated channel then the channel is closed * as well. * * @exception IOException if an I/O error occurs when closing the socket. * @revised 1.4 * @spec JSR-51 */
Closes this socket. Any thread currently blocked in <code>#accept()</code> will throw a <code>SocketException</code>. If this socket has an associated channel then the channel is closed as well
close
{ "repo_name": "Taichi-SHINDO/jdk9-jdk", "path": "src/java.base/share/classes/java/net/ServerSocket.java", "license": "gpl-2.0", "size": 39778 }
[ "java.io.IOException", "java.nio.channels.ServerSocketChannel" ]
import java.io.IOException; import java.nio.channels.ServerSocketChannel;
import java.io.*; import java.nio.channels.*;
[ "java.io", "java.nio" ]
java.io; java.nio;
1,969,334
public int compare(Movie movie1, Movie movie2, boolean ascending) { return ascending ? (movie1.getRating() - movie2.getRating()) : (movie2.getRating() - movie1.getRating()); }
int function(Movie movie1, Movie movie2, boolean ascending) { return ascending ? (movie1.getRating() - movie2.getRating()) : (movie2.getRating() - movie1.getRating()); }
/** * Compare the rating of two movies. * * @param movie1 * @param movie2 * @param ascending * @return */
Compare the rating of two movies
compare
{ "repo_name": "YAMJ/yamj-v2", "path": "yamj/src/main/java/com/moviejukebox/model/comparator/MovieRatingComparator.java", "license": "gpl-3.0", "size": 1874 }
[ "com.moviejukebox.model.Movie" ]
import com.moviejukebox.model.Movie;
import com.moviejukebox.model.*;
[ "com.moviejukebox.model" ]
com.moviejukebox.model;
1,829,502
public boolean containsOffset(long off) { return off <= getLastIndexOffset(); } } private static class IndexTable implements Iterable<IndexTableEntry>, Writable { private List<IndexTableEntry> tableEntries; public IndexTable() { tableEntries = new ArrayList<IndexTableEntry>(); } public IndexTable(DataInput in) throws IOException { readFields(in); }
boolean function(long off) { return off <= getLastIndexOffset(); } } private static class IndexTable implements Iterable<IndexTableEntry>, Writable { private List<IndexTableEntry> tableEntries; public IndexTable() { tableEntries = new ArrayList<IndexTableEntry>(); } public IndexTable(DataInput in) throws IOException { readFields(in); }
/** * Inform whether the user's requested offset corresponds * to a record that starts in this IndexSegment. If this * returns true, the requested offset may actually be in * a previous IndexSegment. * @param off the offset of the start of a record to test. * @return true if the user's requested offset is in this * or a previous IndexSegment. */
Inform whether the user's requested offset corresponds to a record that starts in this IndexSegment. If this returns true, the requested offset may actually be in a previous IndexSegment
containsOffset
{ "repo_name": "hirohanin/sqoop-1.1.0hadoop21", "path": "src/java/com/cloudera/sqoop/io/LobFile.java", "license": "apache-2.0", "size": 60820 }
[ "java.io.DataInput", "java.io.IOException", "java.util.ArrayList", "java.util.List", "org.apache.hadoop.io.Writable" ]
import java.io.DataInput; import java.io.IOException; import java.util.ArrayList; import java.util.List; import org.apache.hadoop.io.Writable;
import java.io.*; import java.util.*; import org.apache.hadoop.io.*;
[ "java.io", "java.util", "org.apache.hadoop" ]
java.io; java.util; org.apache.hadoop;
2,633,922
@JsonCreator public static DataNodeService fromJson( @JsonProperty("tier") String tier, @JsonProperty("maxSize") long maxSize, @JsonProperty("type") @Deprecated @Nullable ServerType type, @JsonProperty(SERVER_TYPE_PROP_KEY) @Nullable ServerType serverType, @JsonProperty("priority") int priority ) { if (type == null && serverType == null) { throw new IAE("ServerType is missing"); } final ServerType theServerType = serverType == null ? type : serverType; return new DataNodeService(tier, maxSize, theServerType, priority); } public DataNodeService( String tier, long maxSize, ServerType serverType, int priority ) { this(tier, maxSize, serverType, priority, true); } public DataNodeService( String tier, long maxSize, ServerType serverType, int priority, boolean isDiscoverable ) { this.tier = tier; this.maxSize = maxSize; this.serverType = serverType; this.priority = priority; this.isDiscoverable = isDiscoverable; }
static DataNodeService function( @JsonProperty("tier") String tier, @JsonProperty(STR) long maxSize, @JsonProperty("type") @Deprecated @Nullable ServerType type, @JsonProperty(SERVER_TYPE_PROP_KEY) @Nullable ServerType serverType, @JsonProperty(STR) int priority ) { if (type == null && serverType == null) { throw new IAE(STR); } final ServerType theServerType = serverType == null ? type : serverType; return new DataNodeService(tier, maxSize, theServerType, priority); } public DataNodeService( String tier, long maxSize, ServerType serverType, int priority ) { this(tier, maxSize, serverType, priority, true); } public DataNodeService( String tier, long maxSize, ServerType serverType, int priority, boolean isDiscoverable ) { this.tier = tier; this.maxSize = maxSize; this.serverType = serverType; this.priority = priority; this.isDiscoverable = isDiscoverable; }
/** * This JSON creator requires for the "type" subtype key of {@link DruidService} to appear before * the "type" property of this class in the serialized JSON. Deserialization can fail otherwise. * See the Javadoc of this class for more details. */
This JSON creator requires for the "type" subtype key of <code>DruidService</code> to appear before the "type" property of this class in the serialized JSON. Deserialization can fail otherwise. See the Javadoc of this class for more details
fromJson
{ "repo_name": "monetate/druid", "path": "server/src/main/java/org/apache/druid/discovery/DataNodeService.java", "license": "apache-2.0", "size": 5828 }
[ "com.fasterxml.jackson.annotation.JsonProperty", "javax.annotation.Nullable", "org.apache.druid.server.coordination.ServerType" ]
import com.fasterxml.jackson.annotation.JsonProperty; import javax.annotation.Nullable; import org.apache.druid.server.coordination.ServerType;
import com.fasterxml.jackson.annotation.*; import javax.annotation.*; import org.apache.druid.server.coordination.*;
[ "com.fasterxml.jackson", "javax.annotation", "org.apache.druid" ]
com.fasterxml.jackson; javax.annotation; org.apache.druid;
1,612,532
protected void drawVAxis(Graphics g) { Graphics lg; int i; int j; int x0,y0,x1,y1; int direction; int offset = 0; double minor_step; double minor; Color c; FontMetrics fm; Color gc = g.getColor(); Font gf = g.getFont(); double vmin = minimum*1.001; double vmax = maximum*1.001; double scale = (amax.y - amin.y)/(maximum - minimum); double val; // System.out.println("Drawing Vertical Axis!"); if( axiscolor != null) g.setColor(axiscolor); g.drawLine(amin.x,amin.y,amax.x,amax.y); if(position == RIGHT ) direction = -1; else direction = 1; minor_step = label_step/(minor_tic_count+1); val = label_start; for(i=0; i<label_count; i++) { if( val >= vmin && val <= vmax ) { x0 = amin.x; y0 = amax.y - (int)( ( val - minimum ) * scale); if( Math.abs(label_value[i]) <= 0.0001 && drawzero ) { c = g.getColor(); if(zerocolor != null) g.setColor(zerocolor); g.drawLine(x0,y0,x0+data_window.width*direction,y0); g.setColor(c); } else if( drawgrid ) { c = g.getColor(); if(gridcolor != null) g.setColor(gridcolor); g.drawLine(x0,y0,x0+data_window.width*direction,y0); g.setColor(c); } x1 = x0 + major_tic_size*direction; y1 = y0; g.drawLine(x0,y0,x1,y1); } minor = val + minor_step; for(j=0; j<minor_tic_count; j++) { if( minor >= vmin && minor <= vmax ) { x0 = amin.x; y0 = amax.y - (int)( ( minor - minimum ) * scale); if( drawgrid ) { c = g.getColor(); if(gridcolor != null) g.setColor(gridcolor); g.drawLine(x0,y0,x0+ data_window.width*direction,y0); g.setColor(c); } x1 = x0 + minor_tic_size*direction; y1 = y0; g.drawLine(x0,y0,x1,y1); } minor += minor_step; } val += label_step; } val = label_start; for(i=0; i<label_count; i++) { if( val >= vmin && val <= vmax ) { x0 = amin.x + offset; y0 = amax.y - (int)(( val - minimum ) * scale) + label.getAscent(g)/2; if(position == RIGHT ) { label.setText(" "+label_string[i]); label.draw(g,x0,y0,TextLine.LEFT); } else { label.setText(label_string[i]+" "); label.draw(g,x0,y0,TextLine.RIGHT); } } val += label_step; } if( !exponent.isNull() ) { y0 = amin.y; if(position == RIGHT ) { x0 = amin.x + max_label_width + exponent.charWidth(g,' '); exponent.draw(g,x0,y0,TextLine.LEFT); } else { x0 = amin.x - max_label_width - exponent.charWidth(g,' '); exponent.draw(g,x0,y0,TextLine.RIGHT); } } if( !title.isNull() ) { y0 = amin.y + (amax.y-amin.y)/2; if( title.getRotation() == 0 || title.getRotation() == 180 ) { if(position == RIGHT ) { x0 = amin.x + max_label_width + title.charWidth(g,' '); title.draw(g,x0,y0,TextLine.LEFT); } else { x0 = amin.x - max_label_width - title.charWidth(g,' '); title.draw(g,x0,y0,TextLine.RIGHT); } } else { title.setJustification(TextLine.CENTER); if(position == RIGHT ) { x0 = amin.x + max_label_width - title.getLeftEdge(g)+ + title.charWidth(g,' '); } else { x0 = amin.x - max_label_width - title.getRightEdge(g) - title.charWidth(g,' '); } title.draw(g,x0,y0); } } }
void function(Graphics g) { Graphics lg; int i; int j; int x0,y0,x1,y1; int direction; int offset = 0; double minor_step; double minor; Color c; FontMetrics fm; Color gc = g.getColor(); Font gf = g.getFont(); double vmin = minimum*1.001; double vmax = maximum*1.001; double scale = (amax.y - amin.y)/(maximum - minimum); double val; if( axiscolor != null) g.setColor(axiscolor); g.drawLine(amin.x,amin.y,amax.x,amax.y); if(position == RIGHT ) direction = -1; else direction = 1; minor_step = label_step/(minor_tic_count+1); val = label_start; for(i=0; i<label_count; i++) { if( val >= vmin && val <= vmax ) { x0 = amin.x; y0 = amax.y - (int)( ( val - minimum ) * scale); if( Math.abs(label_value[i]) <= 0.0001 && drawzero ) { c = g.getColor(); if(zerocolor != null) g.setColor(zerocolor); g.drawLine(x0,y0,x0+data_window.width*direction,y0); g.setColor(c); } else if( drawgrid ) { c = g.getColor(); if(gridcolor != null) g.setColor(gridcolor); g.drawLine(x0,y0,x0+data_window.width*direction,y0); g.setColor(c); } x1 = x0 + major_tic_size*direction; y1 = y0; g.drawLine(x0,y0,x1,y1); } minor = val + minor_step; for(j=0; j<minor_tic_count; j++) { if( minor >= vmin && minor <= vmax ) { x0 = amin.x; y0 = amax.y - (int)( ( minor - minimum ) * scale); if( drawgrid ) { c = g.getColor(); if(gridcolor != null) g.setColor(gridcolor); g.drawLine(x0,y0,x0+ data_window.width*direction,y0); g.setColor(c); } x1 = x0 + minor_tic_size*direction; y1 = y0; g.drawLine(x0,y0,x1,y1); } minor += minor_step; } val += label_step; } val = label_start; for(i=0; i<label_count; i++) { if( val >= vmin && val <= vmax ) { x0 = amin.x + offset; y0 = amax.y - (int)(( val - minimum ) * scale) + label.getAscent(g)/2; if(position == RIGHT ) { label.setText(" "+label_string[i]); label.draw(g,x0,y0,TextLine.LEFT); } else { label.setText(label_string[i]+" "); label.draw(g,x0,y0,TextLine.RIGHT); } } val += label_step; } if( !exponent.isNull() ) { y0 = amin.y; if(position == RIGHT ) { x0 = amin.x + max_label_width + exponent.charWidth(g,' '); exponent.draw(g,x0,y0,TextLine.LEFT); } else { x0 = amin.x - max_label_width - exponent.charWidth(g,' '); exponent.draw(g,x0,y0,TextLine.RIGHT); } } if( !title.isNull() ) { y0 = amin.y + (amax.y-amin.y)/2; if( title.getRotation() == 0 title.getRotation() == 180 ) { if(position == RIGHT ) { x0 = amin.x + max_label_width + title.charWidth(g,' '); title.draw(g,x0,y0,TextLine.LEFT); } else { x0 = amin.x - max_label_width - title.charWidth(g,' '); title.draw(g,x0,y0,TextLine.RIGHT); } } else { title.setJustification(TextLine.CENTER); if(position == RIGHT ) { x0 = amin.x + max_label_width - title.getLeftEdge(g)+ + title.charWidth(g,' '); } else { x0 = amin.x - max_label_width - title.getRightEdge(g) - title.charWidth(g,' '); } title.draw(g,x0,y0); } } }
/** * Draw a Vertical Axis. * @param g Graphics context. */
Draw a Vertical Axis
drawVAxis
{ "repo_name": "chuckre/DigitalPopulations", "path": "PopulationRealizer/Graph2D/src/graph/Axis.java", "license": "apache-2.0", "size": 33849 }
[ "java.awt.Color", "java.awt.Font", "java.awt.FontMetrics", "java.awt.Graphics" ]
import java.awt.Color; import java.awt.Font; import java.awt.FontMetrics; import java.awt.Graphics;
import java.awt.*;
[ "java.awt" ]
java.awt;
1,233,886
public static boolean canEntitleServer(Server server, Entitlement ent) { return canEntitleServer(server.getId(), ent); }
static boolean function(Server server, Entitlement ent) { return canEntitleServer(server.getId(), ent); }
/** * Tests whether or not a given server can be entitled with a specific entitlement * @param server The server in question * @param ent The entitlement to test * @return Returns true or false depending on whether or not the server can be * entitled to the passed in entitlement. */
Tests whether or not a given server can be entitled with a specific entitlement
canEntitleServer
{ "repo_name": "mcalmer/spacewalk", "path": "java/code/src/com/redhat/rhn/manager/system/SystemManager.java", "license": "gpl-2.0", "size": 134651 }
[ "com.redhat.rhn.domain.entitlement.Entitlement", "com.redhat.rhn.domain.server.Server" ]
import com.redhat.rhn.domain.entitlement.Entitlement; import com.redhat.rhn.domain.server.Server;
import com.redhat.rhn.domain.entitlement.*; import com.redhat.rhn.domain.server.*;
[ "com.redhat.rhn" ]
com.redhat.rhn;
1,043,654
private void assertCurrentIdentityColumnValueBetween(long minValue, long maxValue) { executeUpdate("delete from test_table1", dataSource); executeUpdate("insert into test_table1(col2) values('test')", dataSource); long currentValue = getItemAsLong("select col1 from test_table1 where col2 = 'test'", dataSource); assertTrue("Current sequence value is not between " + minValue + " and " + maxValue, (currentValue >= minValue && currentValue <= maxValue)); }
void function(long minValue, long maxValue) { executeUpdate(STR, dataSource); executeUpdate(STR, dataSource); long currentValue = getItemAsLong(STR, dataSource); assertTrue(STR + minValue + STR + maxValue, (currentValue >= minValue && currentValue <= maxValue)); }
/** * Asserts that the current value for the identity column test_table.col1 is between the given values. * * @param minValue The minimum value (included) * @param maxValue The maximum value (included) */
Asserts that the current value for the identity column test_table.col1 is between the given values
assertCurrentIdentityColumnValueBetween
{ "repo_name": "arteam/unitils", "path": "unitils-test/src/test/java/org/unitils/dbmaintainer/structure/SequenceUpdaterTest.java", "license": "apache-2.0", "size": 14680 }
[ "org.junit.Assert", "org.unitils.database.SQLUnitils" ]
import org.junit.Assert; import org.unitils.database.SQLUnitils;
import org.junit.*; import org.unitils.database.*;
[ "org.junit", "org.unitils.database" ]
org.junit; org.unitils.database;
462,068
@Test public void placeInitialTokens() { // Setup. final TridEnvironment environment = new TridEnvironment(); final Agent agentWhite = new DefaultAgent("white", "white", ChessTeam.WHITE); final Agent agentBlack = new DefaultAgent("black", "black", ChessTeam.BLACK); final List<Agent> agents = new ArrayList<Agent>(); agents.add(agentWhite); agents.add(agentBlack); // Run. environment.placeInitialTokens(agents); // Verify. verifyToken(environment, TridPosition.a1A, ChessTeam.WHITE, TokenType.ROOK); verifyToken(environment, TridPosition.b1A, ChessTeam.WHITE, TokenType.KNIGHT); verifyToken(environment, TridPosition.e1A, ChessTeam.WHITE, TokenType.KNIGHT); verifyToken(environment, TridPosition.f1A, ChessTeam.WHITE, TokenType.ROOK); verifyToken(environment, TridPosition.a2A, ChessTeam.WHITE, TokenType.PAWN); verifyToken(environment, TridPosition.b2A, ChessTeam.WHITE, TokenType.PAWN); verifyToken(environment, TridPosition.e2A, ChessTeam.WHITE, TokenType.PAWN); verifyToken(environment, TridPosition.f2A, ChessTeam.WHITE, TokenType.PAWN); verifyToken(environment, TridPosition.b2B, ChessTeam.WHITE, TokenType.BISHOP); verifyToken(environment, TridPosition.c2B, ChessTeam.WHITE, TokenType.QUEEN); verifyToken(environment, TridPosition.d2B, ChessTeam.WHITE, TokenType.KING); verifyToken(environment, TridPosition.e2B, ChessTeam.WHITE, TokenType.BISHOP); verifyToken(environment, TridPosition.b3B, ChessTeam.WHITE, TokenType.PAWN); verifyToken(environment, TridPosition.c3B, ChessTeam.WHITE, TokenType.PAWN); verifyToken(environment, TridPosition.d3B, ChessTeam.WHITE, TokenType.PAWN); verifyToken(environment, TridPosition.e3B, ChessTeam.WHITE, TokenType.PAWN); verifyToken(environment, TridPosition.b4F, ChessTeam.BLACK, TokenType.PAWN); verifyToken(environment, TridPosition.c4F, ChessTeam.BLACK, TokenType.PAWN); verifyToken(environment, TridPosition.d4F, ChessTeam.BLACK, TokenType.PAWN); verifyToken(environment, TridPosition.e4F, ChessTeam.BLACK, TokenType.PAWN); verifyToken(environment, TridPosition.b5F, ChessTeam.BLACK, TokenType.BISHOP); verifyToken(environment, TridPosition.c5F, ChessTeam.BLACK, TokenType.QUEEN); verifyToken(environment, TridPosition.d5F, ChessTeam.BLACK, TokenType.KING); verifyToken(environment, TridPosition.e5F, ChessTeam.BLACK, TokenType.BISHOP); verifyToken(environment, TridPosition.a5G, ChessTeam.BLACK, TokenType.PAWN); verifyToken(environment, TridPosition.b5G, ChessTeam.BLACK, TokenType.PAWN); verifyToken(environment, TridPosition.e5G, ChessTeam.BLACK, TokenType.PAWN); verifyToken(environment, TridPosition.f5G, ChessTeam.BLACK, TokenType.PAWN); verifyToken(environment, TridPosition.a6G, ChessTeam.BLACK, TokenType.ROOK); verifyToken(environment, TridPosition.b6G, ChessTeam.BLACK, TokenType.KNIGHT); verifyToken(environment, TridPosition.e6G, ChessTeam.BLACK, TokenType.KNIGHT); verifyToken(environment, TridPosition.f6G, ChessTeam.BLACK, TokenType.ROOK); }
void function() { final TridEnvironment environment = new TridEnvironment(); final Agent agentWhite = new DefaultAgent("white", "white", ChessTeam.WHITE); final Agent agentBlack = new DefaultAgent("black", "black", ChessTeam.BLACK); final List<Agent> agents = new ArrayList<Agent>(); agents.add(agentWhite); agents.add(agentBlack); environment.placeInitialTokens(agents); verifyToken(environment, TridPosition.a1A, ChessTeam.WHITE, TokenType.ROOK); verifyToken(environment, TridPosition.b1A, ChessTeam.WHITE, TokenType.KNIGHT); verifyToken(environment, TridPosition.e1A, ChessTeam.WHITE, TokenType.KNIGHT); verifyToken(environment, TridPosition.f1A, ChessTeam.WHITE, TokenType.ROOK); verifyToken(environment, TridPosition.a2A, ChessTeam.WHITE, TokenType.PAWN); verifyToken(environment, TridPosition.b2A, ChessTeam.WHITE, TokenType.PAWN); verifyToken(environment, TridPosition.e2A, ChessTeam.WHITE, TokenType.PAWN); verifyToken(environment, TridPosition.f2A, ChessTeam.WHITE, TokenType.PAWN); verifyToken(environment, TridPosition.b2B, ChessTeam.WHITE, TokenType.BISHOP); verifyToken(environment, TridPosition.c2B, ChessTeam.WHITE, TokenType.QUEEN); verifyToken(environment, TridPosition.d2B, ChessTeam.WHITE, TokenType.KING); verifyToken(environment, TridPosition.e2B, ChessTeam.WHITE, TokenType.BISHOP); verifyToken(environment, TridPosition.b3B, ChessTeam.WHITE, TokenType.PAWN); verifyToken(environment, TridPosition.c3B, ChessTeam.WHITE, TokenType.PAWN); verifyToken(environment, TridPosition.d3B, ChessTeam.WHITE, TokenType.PAWN); verifyToken(environment, TridPosition.e3B, ChessTeam.WHITE, TokenType.PAWN); verifyToken(environment, TridPosition.b4F, ChessTeam.BLACK, TokenType.PAWN); verifyToken(environment, TridPosition.c4F, ChessTeam.BLACK, TokenType.PAWN); verifyToken(environment, TridPosition.d4F, ChessTeam.BLACK, TokenType.PAWN); verifyToken(environment, TridPosition.e4F, ChessTeam.BLACK, TokenType.PAWN); verifyToken(environment, TridPosition.b5F, ChessTeam.BLACK, TokenType.BISHOP); verifyToken(environment, TridPosition.c5F, ChessTeam.BLACK, TokenType.QUEEN); verifyToken(environment, TridPosition.d5F, ChessTeam.BLACK, TokenType.KING); verifyToken(environment, TridPosition.e5F, ChessTeam.BLACK, TokenType.BISHOP); verifyToken(environment, TridPosition.a5G, ChessTeam.BLACK, TokenType.PAWN); verifyToken(environment, TridPosition.b5G, ChessTeam.BLACK, TokenType.PAWN); verifyToken(environment, TridPosition.e5G, ChessTeam.BLACK, TokenType.PAWN); verifyToken(environment, TridPosition.f5G, ChessTeam.BLACK, TokenType.PAWN); verifyToken(environment, TridPosition.a6G, ChessTeam.BLACK, TokenType.ROOK); verifyToken(environment, TridPosition.b6G, ChessTeam.BLACK, TokenType.KNIGHT); verifyToken(environment, TridPosition.e6G, ChessTeam.BLACK, TokenType.KNIGHT); verifyToken(environment, TridPosition.f6G, ChessTeam.BLACK, TokenType.ROOK); }
/** * Test the <code>placeInitialTokens()</code> method. */
Test the <code>placeInitialTokens()</code> method
placeInitialTokens
{ "repo_name": "jmthompson2015/vizzini", "path": "chess/src/test/java/org/vizzini/chess/tridimensional/TridEnvironmentTest.java", "license": "mit", "size": 6097 }
[ "java.util.ArrayList", "java.util.List", "org.vizzini.chess.ChessTeam", "org.vizzini.chess.TokenType", "org.vizzini.core.game.Agent", "org.vizzini.core.game.DefaultAgent" ]
import java.util.ArrayList; import java.util.List; import org.vizzini.chess.ChessTeam; import org.vizzini.chess.TokenType; import org.vizzini.core.game.Agent; import org.vizzini.core.game.DefaultAgent;
import java.util.*; import org.vizzini.chess.*; import org.vizzini.core.game.*;
[ "java.util", "org.vizzini.chess", "org.vizzini.core" ]
java.util; org.vizzini.chess; org.vizzini.core;
1,013,240
boolean applyMaskOnGroupRead(Node n) { NodeProperty np = n.findProperty(VOS.PROPERTY_URI_GROUPMASK); if (np == null || np.getPropertyValue() == null) { return true; } String mask = np.getPropertyValue(); // format is rwx, each of which can also be - if (mask.length() != 3) { LOG.debug("invalid mask format: " + mask); return true; } if (mask.charAt(0) == 'r') { LOG.debug("mask allows read: " + mask); return true; } LOG.debug("mask disallows read: " + mask); return false; }
boolean applyMaskOnGroupRead(Node n) { NodeProperty np = n.findProperty(VOS.PROPERTY_URI_GROUPMASK); if (np == null np.getPropertyValue() == null) { return true; } String mask = np.getPropertyValue(); if (mask.length() != 3) { LOG.debug(STR + mask); return true; } if (mask.charAt(0) == 'r') { LOG.debug(STR + mask); return true; } LOG.debug(STR + mask); return false; }
/** * Return false if mask blocks read */
Return false if mask blocks read
applyMaskOnGroupRead
{ "repo_name": "opencadc/vos", "path": "cadc-vos-server/src/main/java/ca/nrc/cadc/vos/server/auth/VOSpaceAuthorizer.java", "license": "agpl-3.0", "size": 27172 }
[ "ca.nrc.cadc.vos.Node", "ca.nrc.cadc.vos.NodeProperty" ]
import ca.nrc.cadc.vos.Node; import ca.nrc.cadc.vos.NodeProperty;
import ca.nrc.cadc.vos.*;
[ "ca.nrc.cadc" ]
ca.nrc.cadc;
895,539
@RequestMapping(value = AnnotationLinks.CHILDREN, method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) @ResponseBody public PagedResources<AnnotationResource> children(@AuthenticationPrincipal UserAccountDetails principal, @PathVariable Long id, @RequestParam(name = "showRedacted", required = false) boolean showRedacted, Pageable pageable) throws NotFoundException { final UserAccount requester = principal.getUserAccount(); final Annotation annotation = annotationService.findById(requester, id); if (annotation == null) { throw new AnnotationNotFoundException(id); } final Page<Annotation> page = annotationService.findByParent(requester, annotation, showRedacted, pageable); final PagedResources<AnnotationResource> pagedResources = pageAssembler.toResource(page, assembler, request); return pagedResources; }
@RequestMapping(value = AnnotationLinks.CHILDREN, method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) PagedResources<AnnotationResource> function(@AuthenticationPrincipal UserAccountDetails principal, @PathVariable Long id, @RequestParam(name = STR, required = false) boolean showRedacted, Pageable pageable) throws NotFoundException { final UserAccount requester = principal.getUserAccount(); final Annotation annotation = annotationService.findById(requester, id); if (annotation == null) { throw new AnnotationNotFoundException(id); } final Page<Annotation> page = annotationService.findByParent(requester, annotation, showRedacted, pageable); final PagedResources<AnnotationResource> pagedResources = pageAssembler.toResource(page, assembler, request); return pagedResources; }
/** * Get child annotations by parent * * @param principal authenticated user * @param id parent annotation id * @return page of annotations */
Get child annotations by parent
children
{ "repo_name": "bd2kccd/ccd-annotations", "path": "src/main/java/edu/pitt/dbmi/ccd/anno/annotation/AnnotationController.java", "license": "lgpl-2.1", "size": 27123 }
[ "edu.pitt.dbmi.ccd.anno.error.AnnotationNotFoundException", "edu.pitt.dbmi.ccd.anno.error.NotFoundException", "edu.pitt.dbmi.ccd.db.entity.Annotation", "edu.pitt.dbmi.ccd.db.entity.UserAccount", "edu.pitt.dbmi.ccd.security.userDetails.UserAccountDetails", "org.springframework.data.domain.Page", "org.springframework.data.domain.Pageable", "org.springframework.hateoas.PagedResources", "org.springframework.http.HttpStatus", "org.springframework.security.core.annotation.AuthenticationPrincipal", "org.springframework.web.bind.annotation.PathVariable", "org.springframework.web.bind.annotation.RequestMapping", "org.springframework.web.bind.annotation.RequestMethod", "org.springframework.web.bind.annotation.RequestParam", "org.springframework.web.bind.annotation.ResponseStatus" ]
import edu.pitt.dbmi.ccd.anno.error.AnnotationNotFoundException; import edu.pitt.dbmi.ccd.anno.error.NotFoundException; import edu.pitt.dbmi.ccd.db.entity.Annotation; import edu.pitt.dbmi.ccd.db.entity.UserAccount; import edu.pitt.dbmi.ccd.security.userDetails.UserAccountDetails; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.hateoas.PagedResources; import org.springframework.http.HttpStatus; import org.springframework.security.core.annotation.AuthenticationPrincipal; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseStatus;
import edu.pitt.dbmi.ccd.anno.error.*; import edu.pitt.dbmi.ccd.db.entity.*; import edu.pitt.dbmi.ccd.security.*; import org.springframework.data.domain.*; import org.springframework.hateoas.*; import org.springframework.http.*; import org.springframework.security.core.annotation.*; import org.springframework.web.bind.annotation.*;
[ "edu.pitt.dbmi", "org.springframework.data", "org.springframework.hateoas", "org.springframework.http", "org.springframework.security", "org.springframework.web" ]
edu.pitt.dbmi; org.springframework.data; org.springframework.hateoas; org.springframework.http; org.springframework.security; org.springframework.web;
1,611,302
protected OptionsParser createOptionsParser(BlazeCommand command) throws OptionsParsingException { Command annotation = command.getClass().getAnnotation(Command.class); List<Class<? extends OptionsBase>> allOptions = Lists.newArrayList(); allOptions.addAll(BlazeCommandUtils.getOptions( command.getClass(), getRuntime().getBlazeModules(), getRuntime().getRuleClassProvider())); OptionsParser parser = OptionsParser.newOptionsParser(allOptions); parser.setAllowResidue(annotation.allowResidue()); return parser; }
OptionsParser function(BlazeCommand command) throws OptionsParsingException { Command annotation = command.getClass().getAnnotation(Command.class); List<Class<? extends OptionsBase>> allOptions = Lists.newArrayList(); allOptions.addAll(BlazeCommandUtils.getOptions( command.getClass(), getRuntime().getBlazeModules(), getRuntime().getRuleClassProvider())); OptionsParser parser = OptionsParser.newOptionsParser(allOptions); parser.setAllowResidue(annotation.allowResidue()); return parser; }
/** * Creates an option parser using the common options classes and the * command-specific options classes. * * <p>An overriding method should first call this method and can then * override default values directly or by calling {@link * #parseOptionsForCommand} for command-specific options. * * @throws OptionsParsingException */
Creates an option parser using the common options classes and the command-specific options classes. An overriding method should first call this method and can then override default values directly or by calling <code>#parseOptionsForCommand</code> for command-specific options
createOptionsParser
{ "repo_name": "whuwxl/bazel", "path": "src/main/java/com/google/devtools/build/lib/runtime/BlazeCommandDispatcher.java", "license": "apache-2.0", "size": 29358 }
[ "com.google.common.collect.Lists", "com.google.devtools.common.options.OptionsBase", "com.google.devtools.common.options.OptionsParser", "com.google.devtools.common.options.OptionsParsingException", "java.util.List" ]
import com.google.common.collect.Lists; import com.google.devtools.common.options.OptionsBase; import com.google.devtools.common.options.OptionsParser; import com.google.devtools.common.options.OptionsParsingException; import java.util.List;
import com.google.common.collect.*; import com.google.devtools.common.options.*; import java.util.*;
[ "com.google.common", "com.google.devtools", "java.util" ]
com.google.common; com.google.devtools; java.util;
2,808,349
private boolean isAssociationExist(Connection connection, String handle) { PreparedStatement prepStmt = null; ResultSet results = null; boolean result = false; try { prepStmt = connection.prepareStatement(OpenIDSQLQueries.CHECK_ASSOCIATION_ENTRY_EXIST); prepStmt.setString(1, handle); results = prepStmt.executeQuery(); if (results.next()) { result = true; log.debug("Association " + handle + " found"); } } catch (SQLException e) { log.error("Failed to load the association " + handle + ". Error while accessing the database. ", e); } finally { IdentityDatabaseUtil.closeResultSet(results); IdentityDatabaseUtil.closeStatement(prepStmt); } log.debug("Association " + handle + " not found"); return result; }
boolean function(Connection connection, String handle) { PreparedStatement prepStmt = null; ResultSet results = null; boolean result = false; try { prepStmt = connection.prepareStatement(OpenIDSQLQueries.CHECK_ASSOCIATION_ENTRY_EXIST); prepStmt.setString(1, handle); results = prepStmt.executeQuery(); if (results.next()) { result = true; log.debug(STR + handle + STR); } } catch (SQLException e) { log.error(STR + handle + STR, e); } finally { IdentityDatabaseUtil.closeResultSet(results); IdentityDatabaseUtil.closeStatement(prepStmt); } log.debug(STR + handle + STR); return result; }
/** * Check if the entry exist in the database * * @param connection * @return boolean * @throws SQLException */
Check if the entry exist in the database
isAssociationExist
{ "repo_name": "pulasthi7/carbon-identity", "path": "components/openid/org.wso2.carbon.identity.provider/src/main/java/org/wso2/carbon/identity/provider/openid/dao/OpenIDAssociationDAO.java", "license": "apache-2.0", "size": 10112 }
[ "java.sql.Connection", "java.sql.PreparedStatement", "java.sql.ResultSet", "java.sql.SQLException", "org.wso2.carbon.identity.core.util.IdentityDatabaseUtil" ]
import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import org.wso2.carbon.identity.core.util.IdentityDatabaseUtil;
import java.sql.*; import org.wso2.carbon.identity.core.util.*;
[ "java.sql", "org.wso2.carbon" ]
java.sql; org.wso2.carbon;
1,789,417
void visitFileTreeSnapshot(Collection<FileSnapshot> descendants);
void visitFileTreeSnapshot(Collection<FileSnapshot> descendants);
/** * Visits the descendants of a {@link org.gradle.api.file.FileTree} or a {@link org.gradle.api.internal.file.collections.DirectoryFileTree}. */
Visits the descendants of a <code>org.gradle.api.file.FileTree</code> or a <code>org.gradle.api.internal.file.collections.DirectoryFileTree</code>
visitFileTreeSnapshot
{ "repo_name": "gstevey/gradle", "path": "subprojects/core/src/main/java/org/gradle/api/internal/changedetection/state/FileSnapshotVisitor.java", "license": "apache-2.0", "size": 1704 }
[ "java.util.Collection" ]
import java.util.Collection;
import java.util.*;
[ "java.util" ]
java.util;
2,767,177
public void testCompareExceptionWeigth() { float q = (float) 0.9; int r = 10; //int sp = 5; a = ExpVector.EVRAND(r, 10, q); b = ExpVector.EVRAND(r, 10, q); int x = 0; try { t = new TermOrder((long[][]) null); x = t.getDescendComparator().compare(a, b); fail("IllegalArgumentException " + x); } catch (IllegalArgumentException e) { //return; } catch (NullPointerException e) { //return; } }
void function() { float q = (float) 0.9; int r = 10; a = ExpVector.EVRAND(r, 10, q); b = ExpVector.EVRAND(r, 10, q); int x = 0; try { t = new TermOrder((long[][]) null); x = t.getDescendComparator().compare(a, b); fail(STR + x); } catch (IllegalArgumentException e) { } catch (NullPointerException e) { } }
/** * Test compare exception weight. * */
Test compare exception weight
testCompareExceptionWeigth
{ "repo_name": "breandan/java-algebra-system", "path": "trc/edu/jas/poly/TermOrderTest.java", "license": "gpl-2.0", "size": 18793 }
[ "edu.jas.poly.TermOrder" ]
import edu.jas.poly.TermOrder;
import edu.jas.poly.*;
[ "edu.jas.poly" ]
edu.jas.poly;
2,778,138
@Override public final AbstractEngine skeleton( final Collection<Directory> withBase, final ResultWriterFactory writerFactory, final Configuration configuration) throws Exception { reporter(writerFactory).generateTemplate(withBase); return this; }
final AbstractEngine function( final Collection<Directory> withBase, final ResultWriterFactory writerFactory, final Configuration configuration) throws Exception { reporter(writerFactory).generateTemplate(withBase); return this; }
/** * Generates a template, and writes result using given factory. * @param withBase not null * @param writerFactory not null * @param configuration not null * @return this engine, not null * @throws Exception when generation fails * @see AbstractEngine#skeleton(Collection, ResultWriterFactory, Configuration) */
Generates a template, and writes result using given factory
skeleton
{ "repo_name": "apache/creadur-whisker", "path": "apache-whisker-velocity/src/main/java/org/apache/creadur/whisker/out/velocity/VelocityEngine.java", "license": "apache-2.0", "size": 4646 }
[ "java.util.Collection", "org.apache.creadur.whisker.app.AbstractEngine", "org.apache.creadur.whisker.app.Configuration", "org.apache.creadur.whisker.app.ResultWriterFactory", "org.apache.creadur.whisker.scan.Directory" ]
import java.util.Collection; import org.apache.creadur.whisker.app.AbstractEngine; import org.apache.creadur.whisker.app.Configuration; import org.apache.creadur.whisker.app.ResultWriterFactory; import org.apache.creadur.whisker.scan.Directory;
import java.util.*; import org.apache.creadur.whisker.app.*; import org.apache.creadur.whisker.scan.*;
[ "java.util", "org.apache.creadur" ]
java.util; org.apache.creadur;
780,096
public List<Pair<BaseSong<BaseArtist, BaseAlbum>, KdTreePoint<Integer>>> getClosestSongsToPosition2( float[] position, int number) throws DataUnavailableException { try { Vector<KdTreePoint<Integer>> points = preloadedDataManager.getData().getSongsCloseToPosition(position, number); return dbDataPortal.getSongListForIds2(points); } catch (KeySizeException e) { return new ArrayList<Pair<BaseSong<BaseArtist, BaseAlbum>, KdTreePoint<Integer>>>(); } }
List<Pair<BaseSong<BaseArtist, BaseAlbum>, KdTreePoint<Integer>>> function( float[] position, int number) throws DataUnavailableException { try { Vector<KdTreePoint<Integer>> points = preloadedDataManager.getData().getSongsCloseToPosition(position, number); return dbDataPortal.getSongListForIds2(points); } catch (KeySizeException e) { return new ArrayList<Pair<BaseSong<BaseArtist, BaseAlbum>, KdTreePoint<Integer>>>(); } }
/** * Gets a list of {@link BaseSong} which are closest to a given position * * @param position * The position (array of {@link Float}) of which the returned {@link BaseSong} should be closest to * @param number * Minimum number for the advanced kd tree algorithm * @return A list of Pairs of {@link BaseSong} and their positions which are closest to the given position */
Gets a list of <code>BaseSong</code> which are closest to a given position
getClosestSongsToPosition2
{ "repo_name": "kuhnmi/jukefox", "path": "JukefoxModel/src/ch/ethz/dcg/jukefox/model/providers/SongProvider.java", "license": "gpl-3.0", "size": 17101 }
[ "ch.ethz.dcg.jukefox.commons.DataUnavailableException", "ch.ethz.dcg.jukefox.commons.utils.Pair", "ch.ethz.dcg.jukefox.commons.utils.kdtree.KdTreePoint", "ch.ethz.dcg.jukefox.model.collection.BaseAlbum", "ch.ethz.dcg.jukefox.model.collection.BaseArtist", "ch.ethz.dcg.jukefox.model.collection.BaseSong", "edu.wlu.cs.levy.CG", "java.util.ArrayList", "java.util.List", "java.util.Vector" ]
import ch.ethz.dcg.jukefox.commons.DataUnavailableException; import ch.ethz.dcg.jukefox.commons.utils.Pair; import ch.ethz.dcg.jukefox.commons.utils.kdtree.KdTreePoint; import ch.ethz.dcg.jukefox.model.collection.BaseAlbum; import ch.ethz.dcg.jukefox.model.collection.BaseArtist; import ch.ethz.dcg.jukefox.model.collection.BaseSong; import edu.wlu.cs.levy.CG; import java.util.ArrayList; import java.util.List; import java.util.Vector;
import ch.ethz.dcg.jukefox.commons.*; import ch.ethz.dcg.jukefox.commons.utils.*; import ch.ethz.dcg.jukefox.commons.utils.kdtree.*; import ch.ethz.dcg.jukefox.model.collection.*; import edu.wlu.cs.levy.*; import java.util.*;
[ "ch.ethz.dcg", "edu.wlu.cs", "java.util" ]
ch.ethz.dcg; edu.wlu.cs; java.util;
2,757,076
public synchronized CIMClass getClass(CIMObjectPath pClassPath) throws CIMException { return getClass(pClassPath, true, true, false, null); }
synchronized CIMClass function(CIMObjectPath pClassPath) throws CIMException { return getClass(pClassPath, true, true, false, null); }
/** * Gets a copy of a CIM class from the target CIM server. * * <p> * This method produces the same results as * <code>getClass(pClassPath, true, true, false, null)</code> * </p> * * @param pClassPath * CIM class path to the CIM class to be returned. Must be an * intra-server or intra-namespace object path within the target * CIM server. In the latter case, the default namespace name is * added to this parameter before being used. The CIM class must * exist. * @return A <code>CIMClass</code> object. * @throws CIMException * with one of these CIM status codes: * <dl style="margin-left: 80px;"> * <dt>{@link CIMException#CIM_ERR_ACCESS_DENIED CIM_ERR_ACCESS_DENIED}</dt> * <dt>{@link CIMException#CIM_ERR_INVALID_NAMESPACE CIM_ERR_INVALID_NAMESPACE}</dt> * <dt>{@link CIMException#CIM_ERR_INVALID_PARAMETER CIM_ERR_INVALID_PARAMETER}</dt> * <dt>{@link CIMException#CIM_ERR_NOT_FOUND CIM_ERR_NOT_FOUND}</dt> * <dt>{@link CIMException#CIM_ERR_FAILED CIM_ERR_FAILED}</dt> * </dl> * @see #getClass(CIMObjectPath, boolean, boolean, boolean, String[]) */
Gets a copy of a CIM class from the target CIM server. This method produces the same results as <code>getClass(pClassPath, true, true, false, null)</code>
getClass
{ "repo_name": "acleasby/sblim-cim-client", "path": "cim-client-java/src/main/java/org/sblim/wbem/client/CIMClient.java", "license": "epl-1.0", "size": 203192 }
[ "org.sblim.wbem.cim.CIMClass", "org.sblim.wbem.cim.CIMException", "org.sblim.wbem.cim.CIMObjectPath" ]
import org.sblim.wbem.cim.CIMClass; import org.sblim.wbem.cim.CIMException; import org.sblim.wbem.cim.CIMObjectPath;
import org.sblim.wbem.cim.*;
[ "org.sblim.wbem" ]
org.sblim.wbem;
268,024
@Named("health_monitor:update") @PUT @Path("/health_monitors/{id}") @SelectJson("health_monitor") @Fallback(NullOnNotFoundOr404.class) @Nullable HealthMonitor updateHealthMonitor(@PathParam("id") String id, @WrapWith("health_monitor") HealthMonitor.UpdateHealthMonitor healthMonitor);
@Named(STR) @Path(STR) @SelectJson(STR) @Fallback(NullOnNotFoundOr404.class) HealthMonitor updateHealthMonitor(@PathParam("id") String id, @WrapWith(STR) HealthMonitor.UpdateHealthMonitor healthMonitor);
/** * Update a HealthMonitor. * * @param id the id of the HealthMonitor to update. * @param healthMonitor the HealthMonitor's attributes to update. * @return a reference of the updated HealthMonitor. */
Update a HealthMonitor
updateHealthMonitor
{ "repo_name": "asankasanjaya/stratos", "path": "dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/extensions/lbaas/v1/LBaaSApi.java", "license": "apache-2.0", "size": 14416 }
[ "javax.inject.Named", "javax.ws.rs.Path", "javax.ws.rs.PathParam", "org.jclouds.Fallbacks", "org.jclouds.openstack.neutron.v2.domain.lbaas.v1.HealthMonitor", "org.jclouds.rest.annotations.Fallback", "org.jclouds.rest.annotations.SelectJson", "org.jclouds.rest.annotations.WrapWith" ]
import javax.inject.Named; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import org.jclouds.Fallbacks; import org.jclouds.openstack.neutron.v2.domain.lbaas.v1.HealthMonitor; import org.jclouds.rest.annotations.Fallback; import org.jclouds.rest.annotations.SelectJson; import org.jclouds.rest.annotations.WrapWith;
import javax.inject.*; import javax.ws.rs.*; import org.jclouds.*; import org.jclouds.openstack.neutron.v2.domain.lbaas.v1.*; import org.jclouds.rest.annotations.*;
[ "javax.inject", "javax.ws", "org.jclouds", "org.jclouds.openstack", "org.jclouds.rest" ]
javax.inject; javax.ws; org.jclouds; org.jclouds.openstack; org.jclouds.rest;
2,603,916
public Property get(final String category, final String key, final String[] defaultValues, final String comment) { return get(category, key, defaultValues, comment, false, -1, (Pattern) null); }
Property function(final String category, final String key, final String[] defaultValues, final String comment) { return get(category, key, defaultValues, comment, false, -1, (Pattern) null); }
/** * Gets a string array Property with a comment using the default settings. * * @param category the config category * @param key the Property key value * @param defaultValues an array containing the default values * @param comment a String comment * @return a string array Property with validationPattern = null, isListLengthFixed = false, maxListLength = -1 */
Gets a string array Property with a comment using the default settings
get
{ "repo_name": "OreCruncher/Restructured", "path": "src/main/java/org/blockartistry/mod/Restructured/util/JarConfiguration.java", "license": "mit", "size": 61536 }
[ "java.util.regex.Pattern", "net.minecraftforge.common.config.Property" ]
import java.util.regex.Pattern; import net.minecraftforge.common.config.Property;
import java.util.regex.*; import net.minecraftforge.common.config.*;
[ "java.util", "net.minecraftforge.common" ]
java.util; net.minecraftforge.common;
254,443
public void randomIndexTemplate() throws IOException { // TODO move settings for random directory etc here into the index based randomized settings. if (cluster().size() > 0) { Settings.Builder randomSettingsBuilder = setRandomIndexSettings(random(), Settings.builder()); if (isInternalCluster()) { // this is only used by mock plugins and if the cluster is not internal we just can't set it randomSettingsBuilder.put(INDEX_TEST_SEED_SETTING.getKey(), random().nextLong()); } randomSettingsBuilder.put(SETTING_NUMBER_OF_SHARDS, numberOfShards()) .put(SETTING_NUMBER_OF_REPLICAS, numberOfReplicas()); // if the test class is annotated with SuppressCodecs("*"), it means don't use lucene's codec randomization // otherwise, use it, it has assertions and so on that can find bugs. SuppressCodecs annotation = getClass().getAnnotation(SuppressCodecs.class); if (annotation != null && annotation.value().length == 1 && "*".equals(annotation.value()[0])) { randomSettingsBuilder.put("index.codec", randomFrom(CodecService.DEFAULT_CODEC, CodecService.BEST_COMPRESSION_CODEC)); } else { randomSettingsBuilder.put("index.codec", CodecService.LUCENE_DEFAULT_CODEC); } XContentBuilder mappings = null; if (frequently() && randomDynamicTemplates()) { mappings = XContentFactory.jsonBuilder().startObject().startObject("_default_"); if (randomBoolean()) { mappings.startObject(TimestampFieldMapper.NAME) .field("enabled", randomBoolean()); mappings.endObject(); } mappings.endObject().endObject(); } for (String setting : randomSettingsBuilder.internalMap().keySet()) { assertThat("non index. prefix setting set on index template, its a node setting...", setting, startsWith("index.")); } // always default delayed allocation to 0 to make sure we have tests are not delayed randomSettingsBuilder.put(UnassignedInfo.INDEX_DELAYED_NODE_LEFT_TIMEOUT_SETTING.getKey(), 0); if (randomBoolean()) { randomSettingsBuilder.put(IndexModule.INDEX_QUERY_CACHE_TYPE_SETTING.getKey(), randomBoolean() ? IndexModule.INDEX_QUERY_CACHE : IndexModule.NONE_QUERY_CACHE); } if (randomBoolean()) { randomSettingsBuilder.put(IndexModule.INDEX_QUERY_CACHE_EVERYTHING_SETTING.getKey(), randomBoolean()); } PutIndexTemplateRequestBuilder putTemplate = client().admin().indices() .preparePutTemplate("random_index_template") .setTemplate("*") .setOrder(0) .setSettings(randomSettingsBuilder); if (mappings != null) { logger.info("test using _default_ mappings: [{}]", mappings.bytes().toUtf8()); putTemplate.addMapping("_default_", mappings); } assertAcked(putTemplate.execute().actionGet()); } }
void function() throws IOException { if (cluster().size() > 0) { Settings.Builder randomSettingsBuilder = setRandomIndexSettings(random(), Settings.builder()); if (isInternalCluster()) { randomSettingsBuilder.put(INDEX_TEST_SEED_SETTING.getKey(), random().nextLong()); } randomSettingsBuilder.put(SETTING_NUMBER_OF_SHARDS, numberOfShards()) .put(SETTING_NUMBER_OF_REPLICAS, numberOfReplicas()); SuppressCodecs annotation = getClass().getAnnotation(SuppressCodecs.class); if (annotation != null && annotation.value().length == 1 && "*".equals(annotation.value()[0])) { randomSettingsBuilder.put(STR, randomFrom(CodecService.DEFAULT_CODEC, CodecService.BEST_COMPRESSION_CODEC)); } else { randomSettingsBuilder.put(STR, CodecService.LUCENE_DEFAULT_CODEC); } XContentBuilder mappings = null; if (frequently() && randomDynamicTemplates()) { mappings = XContentFactory.jsonBuilder().startObject().startObject(STR); if (randomBoolean()) { mappings.startObject(TimestampFieldMapper.NAME) .field(STR, randomBoolean()); mappings.endObject(); } mappings.endObject().endObject(); } for (String setting : randomSettingsBuilder.internalMap().keySet()) { assertThat(STR, setting, startsWith(STR)); } randomSettingsBuilder.put(UnassignedInfo.INDEX_DELAYED_NODE_LEFT_TIMEOUT_SETTING.getKey(), 0); if (randomBoolean()) { randomSettingsBuilder.put(IndexModule.INDEX_QUERY_CACHE_TYPE_SETTING.getKey(), randomBoolean() ? IndexModule.INDEX_QUERY_CACHE : IndexModule.NONE_QUERY_CACHE); } if (randomBoolean()) { randomSettingsBuilder.put(IndexModule.INDEX_QUERY_CACHE_EVERYTHING_SETTING.getKey(), randomBoolean()); } PutIndexTemplateRequestBuilder putTemplate = client().admin().indices() .preparePutTemplate(STR) .setTemplate("*") .setOrder(0) .setSettings(randomSettingsBuilder); if (mappings != null) { logger.info(STR, mappings.bytes().toUtf8()); putTemplate.addMapping(STR, mappings); } assertAcked(putTemplate.execute().actionGet()); } }
/** * Creates a randomized index template. This template is used to pass in randomized settings on a * per index basis. Allows to enable/disable the randomization for number of shards and replicas */
Creates a randomized index template. This template is used to pass in randomized settings on a per index basis. Allows to enable/disable the randomization for number of shards and replicas
randomIndexTemplate
{ "repo_name": "xuzha/elasticsearch", "path": "test/framework/src/main/java/org/elasticsearch/test/ESIntegTestCase.java", "license": "apache-2.0", "size": 97056 }
[ "java.io.IOException", "org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateRequestBuilder", "org.elasticsearch.cluster.routing.UnassignedInfo", "org.elasticsearch.common.settings.Settings", "org.elasticsearch.common.xcontent.XContentBuilder", "org.elasticsearch.common.xcontent.XContentFactory", "org.elasticsearch.index.IndexModule", "org.elasticsearch.index.codec.CodecService", "org.elasticsearch.index.mapper.internal.TimestampFieldMapper", "org.elasticsearch.test.hamcrest.ElasticsearchAssertions", "org.hamcrest.Matchers" ]
import java.io.IOException; import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateRequestBuilder; import org.elasticsearch.cluster.routing.UnassignedInfo; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.index.IndexModule; import org.elasticsearch.index.codec.CodecService; import org.elasticsearch.index.mapper.internal.TimestampFieldMapper; import org.elasticsearch.test.hamcrest.ElasticsearchAssertions; import org.hamcrest.Matchers;
import java.io.*; import org.elasticsearch.action.admin.indices.template.put.*; import org.elasticsearch.cluster.routing.*; import org.elasticsearch.common.settings.*; import org.elasticsearch.common.xcontent.*; import org.elasticsearch.index.*; import org.elasticsearch.index.codec.*; import org.elasticsearch.index.mapper.internal.*; import org.elasticsearch.test.hamcrest.*; import org.hamcrest.*;
[ "java.io", "org.elasticsearch.action", "org.elasticsearch.cluster", "org.elasticsearch.common", "org.elasticsearch.index", "org.elasticsearch.test", "org.hamcrest" ]
java.io; org.elasticsearch.action; org.elasticsearch.cluster; org.elasticsearch.common; org.elasticsearch.index; org.elasticsearch.test; org.hamcrest;
1,479,734
Future<Object> asyncRequest();
Future<Object> asyncRequest();
/** * Sends asynchronously to the given endpoint (InOut). * * @return a handle to be used to get the response in the future */
Sends asynchronously to the given endpoint (InOut)
asyncRequest
{ "repo_name": "davidkarlsen/camel", "path": "core/camel-api/src/main/java/org/apache/camel/FluentProducerTemplate.java", "license": "apache-2.0", "size": 9750 }
[ "java.util.concurrent.Future" ]
import java.util.concurrent.Future;
import java.util.concurrent.*;
[ "java.util" ]
java.util;
653,192
public void setA_Ins_Value (BigDecimal A_Ins_Value) { set_Value (COLUMNNAME_A_Ins_Value, A_Ins_Value); }
void function (BigDecimal A_Ins_Value) { set_Value (COLUMNNAME_A_Ins_Value, A_Ins_Value); }
/** Set Insured Value. @param A_Ins_Value Insured Value */
Set Insured Value
setA_Ins_Value
{ "repo_name": "arthurmelo88/palmetalADP", "path": "adempiere_360/base/src/org/compiere/model/X_A_Asset_Info_Ins.java", "license": "gpl-2.0", "size": 6558 }
[ "java.math.BigDecimal" ]
import java.math.BigDecimal;
import java.math.*;
[ "java.math" ]
java.math;
483,840
static int indexOfImpl(List<?> list, @Nullable Object element) { if (list instanceof RandomAccess) { return indexOfRandomAccess(list, element); } else { ListIterator<?> listIterator = list.listIterator(); while (listIterator.hasNext()) { if (Objects.equal(element, listIterator.next())) { return listIterator.previousIndex(); } } return -1; } }
static int indexOfImpl(List<?> list, @Nullable Object element) { if (list instanceof RandomAccess) { return indexOfRandomAccess(list, element); } else { ListIterator<?> listIterator = list.listIterator(); while (listIterator.hasNext()) { if (Objects.equal(element, listIterator.next())) { return listIterator.previousIndex(); } } return -1; } }
/** * An implementation of {@link List#indexOf(Object)}. */
An implementation of <code>List#indexOf(Object)</code>
indexOfImpl
{ "repo_name": "sunbeansoft/guava", "path": "guava/src/com/google/common/collect/Lists.java", "license": "apache-2.0", "size": 39987 }
[ "com.google.common.base.Objects", "java.util.List", "java.util.ListIterator", "java.util.RandomAccess", "javax.annotation.Nullable" ]
import com.google.common.base.Objects; import java.util.List; import java.util.ListIterator; import java.util.RandomAccess; import javax.annotation.Nullable;
import com.google.common.base.*; import java.util.*; import javax.annotation.*;
[ "com.google.common", "java.util", "javax.annotation" ]
com.google.common; java.util; javax.annotation;
2,841,595
void delete(TaskDto task);
void delete(TaskDto task);
/** * Delete the provided task. * * @param task the provided task. */
Delete the provided task
delete
{ "repo_name": "exoplatform/task", "path": "services/src/main/java/org/exoplatform/task/storage/TaskStorage.java", "license": "lgpl-3.0", "size": 4265 }
[ "org.exoplatform.task.dto.TaskDto" ]
import org.exoplatform.task.dto.TaskDto;
import org.exoplatform.task.dto.*;
[ "org.exoplatform.task" ]
org.exoplatform.task;
2,856,715
public void moveLeft() { move(player, Direction.WEST); }
void function() { move(player, Direction.WEST); }
/** * Moves the player one square to the west if possible. */
Moves the player one square to the west if possible
moveLeft
{ "repo_name": "wouterz/SKT", "path": "src/main/java/nl/tudelft/jpacman/game/SinglePlayerGame.java", "license": "apache-2.0", "size": 1485 }
[ "nl.tudelft.jpacman.board.Direction" ]
import nl.tudelft.jpacman.board.Direction;
import nl.tudelft.jpacman.board.*;
[ "nl.tudelft.jpacman" ]
nl.tudelft.jpacman;
1,862,793
@Override public void createVolume(OmVolumeArgs args) throws IOException { Preconditions.checkNotNull(args); metadataManager.getLock().acquireUserLock(args.getOwnerName()); metadataManager.getLock().acquireVolumeLock(args.getVolume()); try { byte[] dbVolumeKey = metadataManager.getVolumeKey(args.getVolume()); byte[] volumeInfo = metadataManager.getVolumeTable().get(dbVolumeKey); // Check of the volume already exists if (volumeInfo != null) { LOG.debug("volume:{} already exists", args.getVolume()); throw new OMException(ResultCodes.FAILED_VOLUME_ALREADY_EXISTS); } try(WriteBatch batch = new WriteBatch()) { // Write the vol info List<HddsProtos.KeyValue> metadataList = new ArrayList<>(); for (Map.Entry<String, String> entry : args.getKeyValueMap().entrySet()) { metadataList.add(HddsProtos.KeyValue.newBuilder() .setKey(entry.getKey()).setValue(entry.getValue()).build()); } List<OzoneAclInfo> aclList = args.getAclMap().ozoneAclGetProtobuf(); VolumeInfo newVolumeInfo = VolumeInfo.newBuilder() .setAdminName(args.getAdminName()) .setOwnerName(args.getOwnerName()) .setVolume(args.getVolume()) .setQuotaInBytes(args.getQuotaInBytes()) .addAllMetadata(metadataList) .addAllVolumeAcls(aclList) .setCreationTime(Time.now()) .build(); batch.put(metadataManager.getVolumeTable().getHandle(), dbVolumeKey, newVolumeInfo.toByteArray()); // Add volume to user list addVolumeToOwnerList(args.getVolume(), args.getOwnerName(), batch); metadataManager.getStore().write(batch); } LOG.debug("created volume:{} user:{}", args.getVolume(), args.getOwnerName()); } catch (RocksDBException | IOException ex) { if (!(ex instanceof OMException)) { LOG.error("Volume creation failed for user:{} volume:{}", args.getOwnerName(), args.getVolume(), ex); } if(ex instanceof RocksDBException) { throw RocksDBStore.toIOException("Volume creation failed.", (RocksDBException) ex); } else { throw (IOException) ex; } } finally { metadataManager.getLock().releaseVolumeLock(args.getVolume()); metadataManager.getLock().releaseUserLock(args.getOwnerName()); } }
void function(OmVolumeArgs args) throws IOException { Preconditions.checkNotNull(args); metadataManager.getLock().acquireUserLock(args.getOwnerName()); metadataManager.getLock().acquireVolumeLock(args.getVolume()); try { byte[] dbVolumeKey = metadataManager.getVolumeKey(args.getVolume()); byte[] volumeInfo = metadataManager.getVolumeTable().get(dbVolumeKey); if (volumeInfo != null) { LOG.debug(STR, args.getVolume()); throw new OMException(ResultCodes.FAILED_VOLUME_ALREADY_EXISTS); } try(WriteBatch batch = new WriteBatch()) { List<HddsProtos.KeyValue> metadataList = new ArrayList<>(); for (Map.Entry<String, String> entry : args.getKeyValueMap().entrySet()) { metadataList.add(HddsProtos.KeyValue.newBuilder() .setKey(entry.getKey()).setValue(entry.getValue()).build()); } List<OzoneAclInfo> aclList = args.getAclMap().ozoneAclGetProtobuf(); VolumeInfo newVolumeInfo = VolumeInfo.newBuilder() .setAdminName(args.getAdminName()) .setOwnerName(args.getOwnerName()) .setVolume(args.getVolume()) .setQuotaInBytes(args.getQuotaInBytes()) .addAllMetadata(metadataList) .addAllVolumeAcls(aclList) .setCreationTime(Time.now()) .build(); batch.put(metadataManager.getVolumeTable().getHandle(), dbVolumeKey, newVolumeInfo.toByteArray()); addVolumeToOwnerList(args.getVolume(), args.getOwnerName(), batch); metadataManager.getStore().write(batch); } LOG.debug(STR, args.getVolume(), args.getOwnerName()); } catch (RocksDBException IOException ex) { if (!(ex instanceof OMException)) { LOG.error(STR, args.getOwnerName(), args.getVolume(), ex); } if(ex instanceof RocksDBException) { throw RocksDBStore.toIOException(STR, (RocksDBException) ex); } else { throw (IOException) ex; } } finally { metadataManager.getLock().releaseVolumeLock(args.getVolume()); metadataManager.getLock().releaseUserLock(args.getOwnerName()); } }
/** * Creates a volume. * @param args - OmVolumeArgs. */
Creates a volume
createVolume
{ "repo_name": "littlezhou/hadoop", "path": "hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/VolumeManagerImpl.java", "license": "apache-2.0", "size": 16218 }
[ "com.google.common.base.Preconditions", "java.io.IOException", "java.util.ArrayList", "java.util.List", "java.util.Map", "org.apache.hadoop.hdds.protocol.proto.HddsProtos", "org.apache.hadoop.ozone.om.exceptions.OMException", "org.apache.hadoop.ozone.om.helpers.OmVolumeArgs", "org.apache.hadoop.util.Time", "org.apache.hadoop.utils.RocksDBStore", "org.rocksdb.RocksDBException", "org.rocksdb.WriteBatch" ]
import com.google.common.base.Preconditions; import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.Map; import org.apache.hadoop.hdds.protocol.proto.HddsProtos; import org.apache.hadoop.ozone.om.exceptions.OMException; import org.apache.hadoop.ozone.om.helpers.OmVolumeArgs; import org.apache.hadoop.util.Time; import org.apache.hadoop.utils.RocksDBStore; import org.rocksdb.RocksDBException; import org.rocksdb.WriteBatch;
import com.google.common.base.*; import java.io.*; import java.util.*; import org.apache.hadoop.hdds.protocol.proto.*; import org.apache.hadoop.ozone.om.exceptions.*; import org.apache.hadoop.ozone.om.helpers.*; import org.apache.hadoop.util.*; import org.apache.hadoop.utils.*; import org.rocksdb.*;
[ "com.google.common", "java.io", "java.util", "org.apache.hadoop", "org.rocksdb" ]
com.google.common; java.io; java.util; org.apache.hadoop; org.rocksdb;
1,818,435
@Override protected Comparator<RequestMappingInfo> getMappingComparator(final ServerWebExchange exchange) { return (info1, info2) -> info1.compareTo(info2, exchange); }
Comparator<RequestMappingInfo> function(final ServerWebExchange exchange) { return (info1, info2) -> info1.compareTo(info2, exchange); }
/** * Provide a Comparator to sort RequestMappingInfos matched to a request. */
Provide a Comparator to sort RequestMappingInfos matched to a request
getMappingComparator
{ "repo_name": "boggad/jdk9-sample", "path": "sample-catalog/spring-jdk9/src/spring.web.reactive/org/springframework/web/reactive/result/method/RequestMappingInfoHandlerMapping.java", "license": "mit", "size": 14844 }
[ "java.util.Comparator", "org.springframework.web.server.ServerWebExchange" ]
import java.util.Comparator; import org.springframework.web.server.ServerWebExchange;
import java.util.*; import org.springframework.web.server.*;
[ "java.util", "org.springframework.web" ]
java.util; org.springframework.web;
231,811
EAttribute getModel_ForthAsList();
EAttribute getModel_ForthAsList();
/** * Returns the meta object for the attribute list '{@link org.eclipse.xtext.parser.unorderedGroups.unorderedGroupsTestLanguage.Model#getForthAsList <em>Forth As List</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute list '<em>Forth As List</em>'. * @see org.eclipse.xtext.parser.unorderedGroups.unorderedGroupsTestLanguage.Model#getForthAsList() * @see #getModel() * @generated */
Returns the meta object for the attribute list '<code>org.eclipse.xtext.parser.unorderedGroups.unorderedGroupsTestLanguage.Model#getForthAsList Forth As List</code>'.
getModel_ForthAsList
{ "repo_name": "miklossy/xtext-core", "path": "org.eclipse.xtext.tests/src-gen/org/eclipse/xtext/parser/unorderedGroups/unorderedGroupsTestLanguage/UnorderedGroupsTestLanguagePackage.java", "license": "epl-1.0", "size": 25772 }
[ "org.eclipse.emf.ecore.EAttribute" ]
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
2,523,125
@Test public void testParameters() throws Exception { UnivariateFunction f = new SinFunction(); try { // bad interval new SimpsonIntegrator().integrate(1000, f, 1, -1); Assert.fail("Expecting NumberIsTooLargeException - bad interval"); } catch (NumberIsTooLargeException ex) { // expected } try { // bad iteration limits new SimpsonIntegrator(5, 4); Assert.fail("Expecting NumberIsTooSmallException - bad iteration limits"); } catch (NumberIsTooSmallException ex) { // expected } try { // bad iteration limits new SimpsonIntegrator(10, 99); Assert.fail("Expecting NumberIsTooLargeException - bad iteration limits"); } catch (NumberIsTooLargeException ex) { // expected } }
void function() throws Exception { UnivariateFunction f = new SinFunction(); try { new SimpsonIntegrator().integrate(1000, f, 1, -1); Assert.fail(STR); } catch (NumberIsTooLargeException ex) { } try { new SimpsonIntegrator(5, 4); Assert.fail(STR); } catch (NumberIsTooSmallException ex) { } try { new SimpsonIntegrator(10, 99); Assert.fail(STR); } catch (NumberIsTooLargeException ex) { } }
/** * Test of parameters for the integrator. */
Test of parameters for the integrator
testParameters
{ "repo_name": "martingwhite/astor", "path": "examples/math_32/src/test/java/org/apache/commons/math3/analysis/integration/SimpsonIntegratorTest.java", "license": "gpl-2.0", "size": 4937 }
[ "org.apache.commons.math3.analysis.SinFunction", "org.apache.commons.math3.analysis.UnivariateFunction", "org.apache.commons.math3.exception.NumberIsTooLargeException", "org.apache.commons.math3.exception.NumberIsTooSmallException", "org.junit.Assert" ]
import org.apache.commons.math3.analysis.SinFunction; import org.apache.commons.math3.analysis.UnivariateFunction; import org.apache.commons.math3.exception.NumberIsTooLargeException; import org.apache.commons.math3.exception.NumberIsTooSmallException; import org.junit.Assert;
import org.apache.commons.math3.analysis.*; import org.apache.commons.math3.exception.*; import org.junit.*;
[ "org.apache.commons", "org.junit" ]
org.apache.commons; org.junit;
2,213,662
CompletableFuture<LogMetadataForWriter> getLog(URI uri, String streamName, boolean ownAllocator, boolean createIfNotExists);
CompletableFuture<LogMetadataForWriter> getLog(URI uri, String streamName, boolean ownAllocator, boolean createIfNotExists);
/** * Create the metadata of a log. * * @param uri the location to store the metadata of the log * @param streamName the name of the log stream * @param ownAllocator whether to use its own allocator or external allocator * @param createIfNotExists flag to create the stream if it doesn't exist * @return the metadata of the log */
Create the metadata of a log
getLog
{ "repo_name": "ivankelly/bookkeeper", "path": "stream/distributedlog/core/src/main/java/org/apache/distributedlog/metadata/LogStreamMetadataStore.java", "license": "apache-2.0", "size": 4658 }
[ "java.util.concurrent.CompletableFuture" ]
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.*;
[ "java.util" ]
java.util;
1,843,422
void setRemoteType( RemoteType p );
void setRemoteType( RemoteType p );
/** * Sets the remoteType attribute of the IRemoteCacheAttributes object * <p> * @param p The new remoteType value */
Sets the remoteType attribute of the IRemoteCacheAttributes object
setRemoteType
{ "repo_name": "tikue/jcs2-snapshot", "path": "src/java/org/apache/commons/jcs/auxiliary/remote/behavior/ICommonRemoteCacheAttributes.java", "license": "apache-2.0", "size": 5150 }
[ "org.apache.commons.jcs.auxiliary.remote.server.behavior.RemoteType" ]
import org.apache.commons.jcs.auxiliary.remote.server.behavior.RemoteType;
import org.apache.commons.jcs.auxiliary.remote.server.behavior.*;
[ "org.apache.commons" ]
org.apache.commons;
2,119,317
public static ByteBuffer serializeServiceData(Token<JobTokenIdentifier> jobToken) throws IOException { //TODO these bytes should be versioned DataOutputBuffer jobToken_dob = new DataOutputBuffer(); jobToken.write(jobToken_dob); return ByteBuffer.wrap(jobToken_dob.getData(), 0, jobToken_dob.getLength()); }
static ByteBuffer function(Token<JobTokenIdentifier> jobToken) throws IOException { DataOutputBuffer jobToken_dob = new DataOutputBuffer(); jobToken.write(jobToken_dob); return ByteBuffer.wrap(jobToken_dob.getData(), 0, jobToken_dob.getLength()); }
/** * A helper function to serialize the JobTokenIdentifier to be sent to the * ShuffleHandler as ServiceData. * @param jobToken the job token to be used for authentication of * shuffle data requests. * @return the serialized version of the jobToken. */
A helper function to serialize the JobTokenIdentifier to be sent to the ShuffleHandler as ServiceData
serializeServiceData
{ "repo_name": "moreus/hadoop", "path": "hadoop-0.23.10/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-shuffle/src/main/java/org/apache/hadoop/mapred/ShuffleHandler.java", "license": "apache-2.0", "size": 22677 }
[ "java.io.IOException", "java.nio.ByteBuffer", "org.apache.hadoop.io.DataOutputBuffer", "org.apache.hadoop.mapreduce.security.token.JobTokenIdentifier", "org.apache.hadoop.security.token.Token" ]
import java.io.IOException; import java.nio.ByteBuffer; import org.apache.hadoop.io.DataOutputBuffer; import org.apache.hadoop.mapreduce.security.token.JobTokenIdentifier; import org.apache.hadoop.security.token.Token;
import java.io.*; import java.nio.*; import org.apache.hadoop.io.*; import org.apache.hadoop.mapreduce.security.token.*; import org.apache.hadoop.security.token.*;
[ "java.io", "java.nio", "org.apache.hadoop" ]
java.io; java.nio; org.apache.hadoop;
680,682
public void eliminarTerreno( int x, int y ) { try { finca.eliminarTerreno( x, y ); panelTerrenos.refrescar( ); } catch( TerrenoNoExisteException e ) { JOptionPane.showMessageDialog( this, e.getMessage( ), "Error", JOptionPane.ERROR_MESSAGE ); } }
void function( int x, int y ) { try { finca.eliminarTerreno( x, y ); panelTerrenos.refrescar( ); } catch( TerrenoNoExisteException e ) { JOptionPane.showMessageDialog( this, e.getMessage( ), "Error", JOptionPane.ERROR_MESSAGE ); } }
/** * Indica que hay que eliminar productos en la finca * @param x La celda x de la finca. x >= 0 * @param y La celda y de la finca. y >= 0 */
Indica que hay que eliminar productos en la finca
eliminarTerreno
{ "repo_name": "vargax/ejemplos", "path": "java/apo/n10_cupiFinca/source/uniandes/cupi2/cupiFinca/interfaz/InterfazCupiFinca.java", "license": "gpl-2.0", "size": 12426 }
[ "javax.swing.JOptionPane" ]
import javax.swing.JOptionPane;
import javax.swing.*;
[ "javax.swing" ]
javax.swing;
2,390,417
@SuppressWarnings("unused") public List<String> deleteFolder(Exchange exchange) throws Exception { validateRequiredHeader(exchange, CamelCMISConstants.CMIS_OBJECT_ID); Message message = exchange.getIn(); String objectId = message.getHeader(CamelCMISConstants.CMIS_OBJECT_ID, String.class); Folder folder = (Folder) getSessionFacade().getObjectById(objectId); return folder.deleteTree(true, UnfileObject.DELETE, true); }
@SuppressWarnings(STR) List<String> function(Exchange exchange) throws Exception { validateRequiredHeader(exchange, CamelCMISConstants.CMIS_OBJECT_ID); Message message = exchange.getIn(); String objectId = message.getHeader(CamelCMISConstants.CMIS_OBJECT_ID, String.class); Folder folder = (Folder) getSessionFacade().getObjectById(objectId); return folder.deleteTree(true, UnfileObject.DELETE, true); }
/** * This method is called via reflection. * It is not safe to delete it or rename it! * Method's name are defined and retrieved from {@link CamelCMISActions}. */
This method is called via reflection. It is not safe to delete it or rename it! Method's name are defined and retrieved from <code>CamelCMISActions</code>
deleteFolder
{ "repo_name": "objectiser/camel", "path": "components/camel-cmis/src/main/java/org/apache/camel/component/cmis/CMISProducer.java", "license": "apache-2.0", "size": 19465 }
[ "java.util.List", "org.apache.camel.Exchange", "org.apache.camel.Message", "org.apache.chemistry.opencmis.client.api.Folder", "org.apache.chemistry.opencmis.commons.enums.UnfileObject" ]
import java.util.List; import org.apache.camel.Exchange; import org.apache.camel.Message; import org.apache.chemistry.opencmis.client.api.Folder; import org.apache.chemistry.opencmis.commons.enums.UnfileObject;
import java.util.*; import org.apache.camel.*; import org.apache.chemistry.opencmis.client.api.*; import org.apache.chemistry.opencmis.commons.enums.*;
[ "java.util", "org.apache.camel", "org.apache.chemistry" ]
java.util; org.apache.camel; org.apache.chemistry;
2,273,403
@ServiceMethod(returns = ReturnType.SINGLE) private Mono<AppInner> updateAsync(String resourceGroupName, String resourceName, AppPatch appPatch) { return beginUpdateAsync(resourceGroupName, resourceName, appPatch) .last() .flatMap(this.client::getLroFinalResultOrError); }
@ServiceMethod(returns = ReturnType.SINGLE) Mono<AppInner> function(String resourceGroupName, String resourceName, AppPatch appPatch) { return beginUpdateAsync(resourceGroupName, resourceName, appPatch) .last() .flatMap(this.client::getLroFinalResultOrError); }
/** * Update the metadata of an IoT Central application. * * @param resourceGroupName The name of the resource group that contains the IoT Central application. * @param resourceName The ARM resource name of the IoT Central application. * @param appPatch The IoT Central application metadata and security metadata. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the IoT Central application. */
Update the metadata of an IoT Central application
updateAsync
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/implementation/AppsClientImpl.java", "license": "mit", "size": 103959 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.resourcemanager.iotcentral.fluent.models.AppInner", "com.azure.resourcemanager.iotcentral.models.AppPatch" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.resourcemanager.iotcentral.fluent.models.AppInner; import com.azure.resourcemanager.iotcentral.models.AppPatch;
import com.azure.core.annotation.*; import com.azure.resourcemanager.iotcentral.fluent.models.*; import com.azure.resourcemanager.iotcentral.models.*;
[ "com.azure.core", "com.azure.resourcemanager" ]
com.azure.core; com.azure.resourcemanager;
385,737
public int addIpRange(User loggedInUser, String ksLabel, String min, String max) { KickstartData ksdata = lookupKsData(ksLabel, loggedInUser.getOrg()); KickstartIpCommand com = new KickstartIpCommand(ksdata.getId(), loggedInUser); IpAddress minIp = new IpAddress(min); IpAddress maxIp = new IpAddress(max); if (!com.validateIpRange(minIp.getOctets(), maxIp.getOctets())) { ValidatorError error = new ValidatorError("kickstart.iprange_validate.failure"); throw new ValidationException(error.getMessage()); } if (!com.addIpRange(minIp.getOctets(), maxIp.getOctets())) { throw new IpRangeConflictException(min + " - " + max); } com.store(); return 1; }
int function(User loggedInUser, String ksLabel, String min, String max) { KickstartData ksdata = lookupKsData(ksLabel, loggedInUser.getOrg()); KickstartIpCommand com = new KickstartIpCommand(ksdata.getId(), loggedInUser); IpAddress minIp = new IpAddress(min); IpAddress maxIp = new IpAddress(max); if (!com.validateIpRange(minIp.getOctets(), maxIp.getOctets())) { ValidatorError error = new ValidatorError(STR); throw new ValidationException(error.getMessage()); } if (!com.addIpRange(minIp.getOctets(), maxIp.getOctets())) { throw new IpRangeConflictException(min + STR + max); } com.store(); return 1; }
/** * Add an ip range to a kickstart. * @param loggedInUser The current user * @param ksLabel the kickstart label * @param min the min ip address of the range * @param max the max ip address of the range * @return 1 on success * * @xmlrpc.doc Add an ip range to a kickstart profile. * @xmlrpc.param #session_key() * @xmlrpc.param #param_desc("string", "label", "The label of the * kickstart") * @xmlrpc.param #param_desc("string", "min", "The ip address making up the * minimum of the range (i.e. 192.168.0.1)") * @xmlrpc.param #param_desc("string", "max", "The ip address making up the * maximum of the range (i.e. 192.168.0.254)") * @xmlrpc.returntype #return_int_success() * */
Add an ip range to a kickstart
addIpRange
{ "repo_name": "xkollar/spacewalk", "path": "java/code/src/com/redhat/rhn/frontend/xmlrpc/kickstart/profile/ProfileHandler.java", "license": "gpl-2.0", "size": 65686 }
[ "com.redhat.rhn.common.validator.ValidatorError", "com.redhat.rhn.domain.kickstart.KickstartData", "com.redhat.rhn.domain.user.User", "com.redhat.rhn.frontend.xmlrpc.IpRangeConflictException", "com.redhat.rhn.frontend.xmlrpc.ValidationException", "com.redhat.rhn.manager.kickstart.IpAddress", "com.redhat.rhn.manager.kickstart.KickstartIpCommand" ]
import com.redhat.rhn.common.validator.ValidatorError; import com.redhat.rhn.domain.kickstart.KickstartData; import com.redhat.rhn.domain.user.User; import com.redhat.rhn.frontend.xmlrpc.IpRangeConflictException; import com.redhat.rhn.frontend.xmlrpc.ValidationException; import com.redhat.rhn.manager.kickstart.IpAddress; import com.redhat.rhn.manager.kickstart.KickstartIpCommand;
import com.redhat.rhn.common.validator.*; import com.redhat.rhn.domain.kickstart.*; import com.redhat.rhn.domain.user.*; import com.redhat.rhn.frontend.xmlrpc.*; import com.redhat.rhn.manager.kickstart.*;
[ "com.redhat.rhn" ]
com.redhat.rhn;
2,355,780
void floatValueChanged(short unit, float value) throws DOMException;
void floatValueChanged(short unit, float value) throws DOMException;
/** * Called when the float value has changed. */
Called when the float value has changed
floatValueChanged
{ "repo_name": "apache/batik", "path": "batik-css/src/main/java/org/apache/batik/css/dom/CSSOMValue.java", "license": "apache-2.0", "size": 46315 }
[ "org.w3c.dom.DOMException" ]
import org.w3c.dom.DOMException;
import org.w3c.dom.*;
[ "org.w3c.dom" ]
org.w3c.dom;
1,823,857
public static WebApplicationContext getRequiredWebApplicationContext(FacesContext fc) throws IllegalStateException { WebApplicationContext wac = getWebApplicationContext(fc); if (wac == null) { throw new IllegalStateException("No WebApplicationContext found: no ContextLoaderListener registered?"); } return wac; }
static WebApplicationContext function(FacesContext fc) throws IllegalStateException { WebApplicationContext wac = getWebApplicationContext(fc); if (wac == null) { throw new IllegalStateException(STR); } return wac; }
/** * Find the root WebApplicationContext for this web app, which is * typically loaded via ContextLoaderListener or ContextLoaderServlet. * <p>Will rethrow an exception that happened on root context startup, * to differentiate between a failed context startup and no context at all. * @param fc the FacesContext to find the web application context for * @return the root WebApplicationContext for this web app * @throws IllegalStateException if the root WebApplicationContext could not be found * @see org.springframework.web.context.WebApplicationContext#ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE */
Find the root WebApplicationContext for this web app, which is typically loaded via ContextLoaderListener or ContextLoaderServlet. Will rethrow an exception that happened on root context startup, to differentiate between a failed context startup and no context at all
getRequiredWebApplicationContext
{ "repo_name": "deathspeeder/class-guard", "path": "spring-framework-3.2.x/spring-web/src/main/java/org/springframework/web/jsf/FacesContextUtils.java", "license": "gpl-2.0", "size": 5028 }
[ "javax.faces.context.FacesContext", "org.springframework.web.context.WebApplicationContext" ]
import javax.faces.context.FacesContext; import org.springframework.web.context.WebApplicationContext;
import javax.faces.context.*; import org.springframework.web.context.*;
[ "javax.faces", "org.springframework.web" ]
javax.faces; org.springframework.web;
78,826
public static <T> void forwardAsync( CompletableFuture<T> source, CompletableFuture<T> target, Executor executor) { source.whenCompleteAsync(forwardTo(target), executor); }
static <T> void function( CompletableFuture<T> source, CompletableFuture<T> target, Executor executor) { source.whenCompleteAsync(forwardTo(target), executor); }
/** * Forwards the value from the source future to the target future using the provided executor. * * @param source future to forward the value from * @param target future to forward the value to * @param executor executor to forward the source value to the target future * @param <T> type of the value */
Forwards the value from the source future to the target future using the provided executor
forwardAsync
{ "repo_name": "kl0u/flink", "path": "flink-runtime/src/main/java/org/apache/flink/runtime/concurrent/FutureUtils.java", "license": "apache-2.0", "size": 57033 }
[ "java.util.concurrent.CompletableFuture", "java.util.concurrent.Executor" ]
import java.util.concurrent.CompletableFuture; import java.util.concurrent.Executor;
import java.util.concurrent.*;
[ "java.util" ]
java.util;
2,400,280
protected final Session getSession() { return getSession(this.template.isAllowCreate()); }
final Session function() { return getSession(this.template.isAllowCreate()); }
/** * Get a JCR Session, either from the current transaction or a new one. The * latter is only allowed if the "allowCreate" setting of this bean's * JcrTemplate is true. * * @return the JCR Session * @throws DataAccessResourceFailureException * if the Session couldn't be created * @throws IllegalStateException * if no thread-bound Session found and allowCreate false * @see org.springframework.extensions.jcr.SessionFactoryUtils#getSession */
Get a JCR Session, either from the current transaction or a new one. The latter is only allowed if the "allowCreate" setting of this bean's JcrTemplate is true
getSession
{ "repo_name": "esofthead/mycollab", "path": "mycollab-jackrabbit/src/main/java/org/springframework/extensions/jcr/support/JcrDaoSupport.java", "license": "agpl-3.0", "size": 4965 }
[ "javax.jcr.Session" ]
import javax.jcr.Session;
import javax.jcr.*;
[ "javax.jcr" ]
javax.jcr;
961,256
String subscribe(String source, String subtype, @Nullable Bundle data) throws IOException;
String subscribe(String source, String subtype, @Nullable Bundle data) throws IOException;
/** * Subscribes to a source to start receiving messages from it. * <p> * This method may perform blocking I/O and should not be called on the main thread. * * @param source The source of the notifications to subscribe to. * @param subtype The sub-source of the notifications. * @param data Additional information. * @return The registration id. * @throws IOException if the request fails. */
Subscribes to a source to start receiving messages from it. This method may perform blocking I/O and should not be called on the main thread
subscribe
{ "repo_name": "js0701/chromium-crosswalk", "path": "components/gcm_driver/android/java/src/org/chromium/components/gcm_driver/GoogleCloudMessagingSubscriber.java", "license": "bsd-3-clause", "size": 1468 }
[ "android.os.Bundle", "java.io.IOException", "javax.annotation.Nullable" ]
import android.os.Bundle; import java.io.IOException; import javax.annotation.Nullable;
import android.os.*; import java.io.*; import javax.annotation.*;
[ "android.os", "java.io", "javax.annotation" ]
android.os; java.io; javax.annotation;
1,204,221
public TestToolRepository getRepository() { return repository; }
TestToolRepository function() { return repository; }
/** * Returns the test tool repository. * @return the repository * @since 0.2.3 */
Returns the test tool repository
getRepository
{ "repo_name": "cocoatomo/asakusafw", "path": "testing-project/asakusa-test-driver/src/main/java/com/asakusafw/testdriver/TestDriverContext.java", "license": "apache-2.0", "size": 33349 }
[ "com.asakusafw.testdriver.core.TestToolRepository" ]
import com.asakusafw.testdriver.core.TestToolRepository;
import com.asakusafw.testdriver.core.*;
[ "com.asakusafw.testdriver" ]
com.asakusafw.testdriver;
1,757,712
private int recursion(SequentialPattern prefix, List<PseudoSequenceBIDE> contexte) throws IOException { // find frequent items of size 1 in the current projected database. Set<PairBIDE> pairs = findAllFrequentPairs(prefix, contexte); // we will keep tract of the maximum support of patterns // that can be found with this prefix, to check // for forward extension when this method returns. int maxSupport = 0; // For each pair found (a pair is an item with a boolean indicating if it // appears in an itemset that is cut (a postfix) or not, and the sequence IDs // where it appears in the projected database). for(PairBIDE pair : pairs){ // if the item is frequent. if(pair.getCount() >= minsuppAbsolute){ // create the new postfix by appending this item to the prefix SequentialPattern newPrefix; // if the item is part of a postfix if(pair.isPostfix()){ // we append it to the last itemset of the prefix newPrefix = appendItemToPrefixOfSequence(prefix, pair.getItem()); // is =<is, (deltaT,i)> }else{ // else, we append it as a new itemset to the sequence newPrefix = appendItemToSequence(prefix, pair.getItem()); } // build the projected database with this item // long start = System.currentTimeMillis(); List<PseudoSequenceBIDE> projectedContext = buildProjectedDatabase(pair.getItem(), contexte, pair.isPostfix(), pair.getSequenceIDs()); // debugProjectDBTime += System.currentTimeMillis() - start; // create new prefix newPrefix.setSequenceIDs(pair.getSequenceIDs()); // variable to keep track of the maximum support of extension // with this item and this prefix if(projectedContext.size() >= minsuppAbsolute) { int maxSupportOfSuccessors = 0; // if(!checkBackScanPruning(newPrefix, pair.getSequenceIDs())) { maxSupportOfSuccessors = recursion(newPrefix, projectedContext); // r�cursion // } // check the forward extension for the prefix // if no forward extension if(minsuppAbsolute > maxSupportOfSuccessors){ // if there is no backward extension if(!checkBackwardExtension(newPrefix, pair.getSequenceIDs())){ // save the pattern savePattern(newPrefix); } } }else { if(!checkBackwardExtension(newPrefix, pair.getSequenceIDs())){ // save the pattern savePattern(newPrefix); } } // record the largest support of patterns found starting // with this prefix until now if(newPrefix.getAbsoluteSupport() > maxSupport){ maxSupport = newPrefix.getAbsoluteSupport(); } } } return maxSupport; // return the maximum support generated by extension of the prefix }
int function(SequentialPattern prefix, List<PseudoSequenceBIDE> contexte) throws IOException { Set<PairBIDE> pairs = findAllFrequentPairs(prefix, contexte); int maxSupport = 0; for(PairBIDE pair : pairs){ if(pair.getCount() >= minsuppAbsolute){ SequentialPattern newPrefix; if(pair.isPostfix()){ newPrefix = appendItemToPrefixOfSequence(prefix, pair.getItem()); }else{ newPrefix = appendItemToSequence(prefix, pair.getItem()); } List<PseudoSequenceBIDE> projectedContext = buildProjectedDatabase(pair.getItem(), contexte, pair.isPostfix(), pair.getSequenceIDs()); newPrefix.setSequenceIDs(pair.getSequenceIDs()); if(projectedContext.size() >= minsuppAbsolute) { int maxSupportOfSuccessors = 0; maxSupportOfSuccessors = recursion(newPrefix, projectedContext); if(minsuppAbsolute > maxSupportOfSuccessors){ if(!checkBackwardExtension(newPrefix, pair.getSequenceIDs())){ savePattern(newPrefix); } } }else { if(!checkBackwardExtension(newPrefix, pair.getSequenceIDs())){ savePattern(newPrefix); } } if(newPrefix.getAbsoluteSupport() > maxSupport){ maxSupport = newPrefix.getAbsoluteSupport(); } } } return maxSupport; }
/** * Method to recursively grow a given sequential pattern. * @param prefix the current sequential pattern that we want to try to grow * @param database the current projected sequence database * @throws IOException exception if there is an error writing to the output file */
Method to recursively grow a given sequential pattern
recursion
{ "repo_name": "shockline/PDFAnalysis", "path": "src/maxsp/MaxSP.java", "license": "gpl-3.0", "size": 27846 }
[ "java.io.IOException", "java.util.List", "java.util.Set" ]
import java.io.IOException; import java.util.List; import java.util.Set;
import java.io.*; import java.util.*;
[ "java.io", "java.util" ]
java.io; java.util;
2,042,429
protected void invalidatePackages(boolean alsoConfigs) throws InterruptedException { skyframeExecutor.invalidateFilesUnderPathForTesting(reporter, ModifiedFileSet.EVERYTHING_MODIFIED, rootDirectory); if (alsoConfigs) { try { // Also invalidate all configurations. This is important for dynamic configurations: by // invalidating all files we invalidate CROSSTOOL, which invalidates CppConfiguration (and // a few other fragments). So we need to invalidate the // {@link SkyframeBuildView#hostConfigurationCache} as well. Otherwise we end up // with old CppConfiguration instances. Even though they're logically equal to the new ones, // CppConfiguration has no .equals() method and some production code expects equality. useConfiguration(configurationArgs.toArray(new String[0])); } catch (Exception e) { // There are enough dependers on this method that don't handle Exception that just passing // through the Exception would result in a huge refactoring. As it stands this shouldn't // fail anyway because this method only gets called after a successful useConfiguration() // call anyway. throw new RuntimeException(e); } } }
void function(boolean alsoConfigs) throws InterruptedException { skyframeExecutor.invalidateFilesUnderPathForTesting(reporter, ModifiedFileSet.EVERYTHING_MODIFIED, rootDirectory); if (alsoConfigs) { try { useConfiguration(configurationArgs.toArray(new String[0])); } catch (Exception e) { throw new RuntimeException(e); } } }
/** * Invalidates all existing packages. Optionally invalidates configurations too. * * <p>Tests should invalidate both unless they have specific reason not to. * * @throws InterruptedException */
Invalidates all existing packages. Optionally invalidates configurations too. Tests should invalidate both unless they have specific reason not to
invalidatePackages
{ "repo_name": "mrdomino/bazel", "path": "src/test/java/com/google/devtools/build/lib/analysis/util/BuildViewTestCase.java", "license": "apache-2.0", "size": 77290 }
[ "com.google.devtools.build.lib.vfs.ModifiedFileSet" ]
import com.google.devtools.build.lib.vfs.ModifiedFileSet;
import com.google.devtools.build.lib.vfs.*;
[ "com.google.devtools" ]
com.google.devtools;
2,373,932
static boolean useLaunchStoryboard(RuleContext ruleContext) { if (!ruleContext.attributes().has("launch_storyboard", LABEL)) { return false; } Artifact launchStoryboard = ruleContext.getPrerequisiteArtifact("launch_storyboard", Mode.TARGET); DottedVersion flagMinimumOs = objcConfiguration(ruleContext).getMinimumOs(); return launchStoryboard != null && flagMinimumOs.compareTo(MIN_LAUNCH_STORYBOARD_OS_VERSION) >= 0; }
static boolean useLaunchStoryboard(RuleContext ruleContext) { if (!ruleContext.attributes().has(STR, LABEL)) { return false; } Artifact launchStoryboard = ruleContext.getPrerequisiteArtifact(STR, Mode.TARGET); DottedVersion flagMinimumOs = objcConfiguration(ruleContext).getMinimumOs(); return launchStoryboard != null && flagMinimumOs.compareTo(MIN_LAUNCH_STORYBOARD_OS_VERSION) >= 0; }
/** * Returns {@code true} if the given rule context has a launch storyboard set and its * configuration (--ios_minimum_os) supports launch storyboards. */
Returns true if the given rule context has a launch storyboard set and its configuration (--ios_minimum_os) supports launch storyboards
useLaunchStoryboard
{ "repo_name": "kamalmarhubi/bazel", "path": "src/main/java/com/google/devtools/build/lib/rules/objc/ObjcRuleClasses.java", "license": "apache-2.0", "size": 51028 }
[ "com.google.devtools.build.lib.actions.Artifact", "com.google.devtools.build.lib.analysis.RuleConfiguredTarget", "com.google.devtools.build.lib.analysis.RuleContext", "com.google.devtools.build.lib.rules.apple.DottedVersion" ]
import com.google.devtools.build.lib.actions.Artifact; import com.google.devtools.build.lib.analysis.RuleConfiguredTarget; import com.google.devtools.build.lib.analysis.RuleContext; import com.google.devtools.build.lib.rules.apple.DottedVersion;
import com.google.devtools.build.lib.actions.*; import com.google.devtools.build.lib.analysis.*; import com.google.devtools.build.lib.rules.apple.*;
[ "com.google.devtools" ]
com.google.devtools;
1,979,686
@EventHandler(value = "dblclick", target = "@tree") private void onDoubleClick$tree(Event event) { BaseComponent target = event.getTarget(); if (target instanceof Treenode) { event.stopPropagation(); editNodeStart((Treenode) target); } }
@EventHandler(value = STR, target = "@tree") private void onDoubleClick$tree(Event event) { BaseComponent target = event.getTarget(); if (target instanceof Treenode) { event.stopPropagation(); editNodeStart((Treenode) target); } }
/** * Double-clicking a tree node allows in place editing. * * @param event The double click event. */
Double-clicking a tree node allows in place editing
onDoubleClick$tree
{ "repo_name": "carewebframework/carewebframework-core", "path": "org.carewebframework.shell/src/main/java/org/carewebframework/shell/designer/PropertyEditorCustomTree.java", "license": "apache-2.0", "size": 24616 }
[ "org.fujion.annotation.EventHandler", "org.fujion.component.BaseComponent", "org.fujion.component.Treenode", "org.fujion.event.Event" ]
import org.fujion.annotation.EventHandler; import org.fujion.component.BaseComponent; import org.fujion.component.Treenode; import org.fujion.event.Event;
import org.fujion.annotation.*; import org.fujion.component.*; import org.fujion.event.*;
[ "org.fujion.annotation", "org.fujion.component", "org.fujion.event" ]
org.fujion.annotation; org.fujion.component; org.fujion.event;
268,557
void recordProcessInstanceStart(ExecutionEntity processInstance, FlowElement startElement);
void recordProcessInstanceStart(ExecutionEntity processInstance, FlowElement startElement);
/** * Record a process-instance started and record start-event if activity history is enabled. */
Record a process-instance started and record start-event if activity history is enabled
recordProcessInstanceStart
{ "repo_name": "roberthafner/flowable-engine", "path": "modules/flowable-engine/src/main/java/org/activiti/engine/impl/history/HistoryManager.java", "license": "apache-2.0", "size": 8227 }
[ "org.activiti.bpmn.model.FlowElement", "org.activiti.engine.impl.persistence.entity.ExecutionEntity" ]
import org.activiti.bpmn.model.FlowElement; import org.activiti.engine.impl.persistence.entity.ExecutionEntity;
import org.activiti.bpmn.model.*; import org.activiti.engine.impl.persistence.entity.*;
[ "org.activiti.bpmn", "org.activiti.engine" ]
org.activiti.bpmn; org.activiti.engine;
1,038,585
private int countMobCells(final Table table) throws IOException { Scan scan = new Scan(); // Do not retrieve the mob data when scanning scan.setAttribute(MobConstants.MOB_SCAN_RAW, Bytes.toBytes(Boolean.TRUE)); ResultScanner results = table.getScanner(scan); int count = 0; for (Result res : results) { count += res.size(); } results.close(); return count; }
int function(final Table table) throws IOException { Scan scan = new Scan(); scan.setAttribute(MobConstants.MOB_SCAN_RAW, Bytes.toBytes(Boolean.TRUE)); ResultScanner results = table.getScanner(scan); int count = 0; for (Result res : results) { count += res.size(); } results.close(); return count; }
/** * Gets the number of cells in the given table. * @param table to get the scanner * @return the number of cells */
Gets the number of cells in the given table
countMobCells
{ "repo_name": "HubSpot/hbase", "path": "hbase-server/src/test/java/org/apache/hadoop/hbase/mob/compactions/TestMobCompactor.java", "license": "apache-2.0", "size": 49830 }
[ "java.io.IOException", "org.apache.hadoop.hbase.client.Result", "org.apache.hadoop.hbase.client.ResultScanner", "org.apache.hadoop.hbase.client.Scan", "org.apache.hadoop.hbase.client.Table", "org.apache.hadoop.hbase.mob.MobConstants", "org.apache.hadoop.hbase.util.Bytes" ]
import java.io.IOException; import org.apache.hadoop.hbase.client.Result; import org.apache.hadoop.hbase.client.ResultScanner; import org.apache.hadoop.hbase.client.Scan; import org.apache.hadoop.hbase.client.Table; import org.apache.hadoop.hbase.mob.MobConstants; import org.apache.hadoop.hbase.util.Bytes;
import java.io.*; import org.apache.hadoop.hbase.client.*; import org.apache.hadoop.hbase.mob.*; import org.apache.hadoop.hbase.util.*;
[ "java.io", "org.apache.hadoop" ]
java.io; org.apache.hadoop;
51,511
public void testMaxCapacities() throws IOException { this.setUp(4,1,1); taskTrackerManager.addQueues(new String[] {"default"}); ArrayList<FakeQueueInfo> queues = new ArrayList<FakeQueueInfo>(); queues.add(new FakeQueueInfo("default", 25.0f, false, 1)); resConf.setFakeQueues(queues); resConf.setMaxCapacity("default", 50.0f); scheduler.setResourceManagerConf(resConf); scheduler.setAssignMultipleTasks(true); scheduler.start(); //submit the Job FakeJobInProgress fjob1 = submitJobAndInit(JobStatus.PREP, 4, 4, "default", "user"); //default queue has min capacity of 1 and max capacity of 2 //first call of assign task should give task from default queue. //default uses 1 map and 1 reduce slots are used checkMultipleAssignment( "tt1", "attempt_test_0001_m_000001_0 on tt1", "attempt_test_0001_r_000001_0 on tt1"); //second call of assign task //default uses 2 map and 2 reduce slots checkMultipleAssignment( "tt2", "attempt_test_0001_m_000002_0 on tt2", "attempt_test_0001_r_000002_0 on tt2"); //Now we have reached the max capacity limit for default , //no further tasks would be assigned to this queue. checkMultipleAssignment( "tt3", null, null); }
void function() throws IOException { this.setUp(4,1,1); taskTrackerManager.addQueues(new String[] {STR}); ArrayList<FakeQueueInfo> queues = new ArrayList<FakeQueueInfo>(); queues.add(new FakeQueueInfo(STR, 25.0f, false, 1)); resConf.setFakeQueues(queues); resConf.setMaxCapacity(STR, 50.0f); scheduler.setResourceManagerConf(resConf); scheduler.setAssignMultipleTasks(true); scheduler.start(); FakeJobInProgress fjob1 = submitJobAndInit(JobStatus.PREP, 4, 4, STR, "user"); checkMultipleAssignment( "tt1", STR, STR); checkMultipleAssignment( "tt2", STR, STR); checkMultipleAssignment( "tt3", null, null); }
/** * Test the max Capacity for map and reduce * @throws IOException */
Test the max Capacity for map and reduce
testMaxCapacities
{ "repo_name": "leonhong/hadoop-common", "path": "src/contrib/capacity-scheduler/src/test/org/apache/hadoop/mapred/TestCapacityScheduler.java", "license": "apache-2.0", "size": 126711 }
[ "java.io.IOException", "java.util.ArrayList" ]
import java.io.IOException; import java.util.ArrayList;
import java.io.*; import java.util.*;
[ "java.io", "java.util" ]
java.io; java.util;
394,944
public void activate(final BundleContext bundleContext, final Map<String, Object> configuration) throws ConfigurationException { if (configuration != null) { updateConfiguration(configuration); } }
void function(final BundleContext bundleContext, final Map<String, Object> configuration) throws ConfigurationException { if (configuration != null) { updateConfiguration(configuration); } }
/** * Called by the SCR to activate the component with its configuration read * from CAS * * @param bundleContext * BundleContext of the Bundle that defines this component * @param configuration * Configuration properties for this component obtained from the * ConfigAdmin service * @throws ConfigurationException */
Called by the SCR to activate the component with its configuration read from CAS
activate
{ "repo_name": "computergeek1507/openhab", "path": "bundles/binding/org.openhab.binding.horizon/src/main/java/org/openhab/binding/horizon/internal/HorizonBinding.java", "license": "epl-1.0", "size": 6197 }
[ "java.util.Map", "javax.naming.ConfigurationException", "org.osgi.framework.BundleContext" ]
import java.util.Map; import javax.naming.ConfigurationException; import org.osgi.framework.BundleContext;
import java.util.*; import javax.naming.*; import org.osgi.framework.*;
[ "java.util", "javax.naming", "org.osgi.framework" ]
java.util; javax.naming; org.osgi.framework;
1,714,330
public void closeSession() { this.session.commit(); this.session.close(); } /** * This method creates the sqlSessionFactory of myBatis. It integrates all the * SQL mappers * @return a {@link SqlSessionFactory}
void function() { this.session.commit(); this.session.close(); } /** * This method creates the sqlSessionFactory of myBatis. It integrates all the * SQL mappers * @return a {@link SqlSessionFactory}
/** * Close session manually, to be done, if a JdbcTransactionFactory is used. * Perhaps it is better to separate the commit and the closing mechanism ... */
Close session manually, to be done, if a JdbcTransactionFactory is used. Perhaps it is better to separate the commit and the closing mechanism ..
closeSession
{ "repo_name": "eberhardmayer/taskana", "path": "lib/taskana-core/src/main/java/org/taskana/impl/TaskanaEngineImpl.java", "license": "apache-2.0", "size": 5199 }
[ "org.apache.ibatis.session.SqlSessionFactory" ]
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.*;
[ "org.apache.ibatis" ]
org.apache.ibatis;
2,055,083
private boolean readHyphenatedWord() { ArrayList<Character> saved = new ArrayList<Character>(); // check for page numbers char token; if ( readArabicPage()||readRomanPage() ) { // remove page number char last = undo.get(undo.size()-1); //debug // for ( int i=0;i<undo.size()-1;i++ ) // { // char tok = undo.get(i); // System.out.print(tok); // } // end debug undo.clear(); saved.add('-'); token = last; } else token = nextChar(); while ( token=='\n'||token=='\r' ) { saved.add(token); token = nextChar(); } saved.add(token); while ( undo.size()>0 ) saved.add(undo.remove(0)); while (saved.size()>0 ) push( saved.remove(0) ); // token is definitely not a newline return Character.isLetter(token); }
boolean function() { ArrayList<Character> saved = new ArrayList<Character>(); char token; if ( readArabicPage() readRomanPage() ) { char last = undo.get(undo.size()-1); undo.clear(); saved.add('-'); token = last; } else token = nextChar(); while ( token=='\n' token=='\r' ) { saved.add(token); token = nextChar(); } saved.add(token); while ( undo.size()>0 ) saved.add(undo.remove(0)); while (saved.size()>0 ) push( saved.remove(0) ); return Character.isLetter(token); }
/** * Read a hyphenated word - do no harm * @return true if it was hyphenated at line-end */
Read a hyphenated word - do no harm
readHyphenatedWord
{ "repo_name": "Ecdosis/NMergeNew", "path": "src/edu/luc/nmerge/mvd/navigator/TextNavigator.java", "license": "gpl-2.0", "size": 17023 }
[ "java.util.ArrayList" ]
import java.util.ArrayList;
import java.util.*;
[ "java.util" ]
java.util;
2,052,233
@Test public void findBaseGeometry() { HashSet<GeometryType> set = new HashSet<GeometryType>(); set.add( LINEAR_RING ); Assert.assertEquals( LINEAR_RING, determineMinimalBaseGeometry( set ) ); set.add( RING ); Assert.assertEquals( RING, determineMinimalBaseGeometry( set ) ); set.add( COMPOSITE_CURVE ); set.add( LINE_STRING ); Assert.assertEquals( CURVE, determineMinimalBaseGeometry( set ) ); set.add( COMPOSITE_SOLID ); set.add( POINT ); Assert.assertEquals( PRIMITIVE, determineMinimalBaseGeometry( set ) ); set.add( MULTI_CURVE ); Assert.assertEquals( GEOMETRY, determineMinimalBaseGeometry( set ) ); }
void function() { HashSet<GeometryType> set = new HashSet<GeometryType>(); set.add( LINEAR_RING ); Assert.assertEquals( LINEAR_RING, determineMinimalBaseGeometry( set ) ); set.add( RING ); Assert.assertEquals( RING, determineMinimalBaseGeometry( set ) ); set.add( COMPOSITE_CURVE ); set.add( LINE_STRING ); Assert.assertEquals( CURVE, determineMinimalBaseGeometry( set ) ); set.add( COMPOSITE_SOLID ); set.add( POINT ); Assert.assertEquals( PRIMITIVE, determineMinimalBaseGeometry( set ) ); set.add( MULTI_CURVE ); Assert.assertEquals( GEOMETRY, determineMinimalBaseGeometry( set ) ); }
/** * Find the base of different geometry types */
Find the base of different geometry types
findBaseGeometry
{ "repo_name": "deegree/deegree3", "path": "deegree-core/deegree-core-base/src/test/java/org/deegree/gml/schema/GeometryTypeTest.java", "license": "lgpl-2.1", "size": 7385 }
[ "java.util.HashSet", "org.deegree.feature.types.property.GeometryPropertyType", "org.junit.Assert" ]
import java.util.HashSet; import org.deegree.feature.types.property.GeometryPropertyType; import org.junit.Assert;
import java.util.*; import org.deegree.feature.types.property.*; import org.junit.*;
[ "java.util", "org.deegree.feature", "org.junit" ]
java.util; org.deegree.feature; org.junit;
2,883,334
public static DetailAST parseWithComments(FileContents contents) throws RecognitionException, TokenStreamException { return appendHiddenCommentNodes(parse(contents)); }
static DetailAST function(FileContents contents) throws RecognitionException, TokenStreamException { return appendHiddenCommentNodes(parse(contents)); }
/** * Parses Java source file. Result AST contains comment nodes. * @param contents source file content * @return DetailAST tree * @throws RecognitionException if parser failed * @throws TokenStreamException if lexer failed */
Parses Java source file. Result AST contains comment nodes
parseWithComments
{ "repo_name": "AkshitaKukreja30/checkstyle", "path": "src/main/java/com/puppycrawl/tools/checkstyle/TreeWalker.java", "license": "lgpl-2.1", "size": 26308 }
[ "com.puppycrawl.tools.checkstyle.api.DetailAST", "com.puppycrawl.tools.checkstyle.api.FileContents" ]
import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.api.FileContents;
import com.puppycrawl.tools.checkstyle.api.*;
[ "com.puppycrawl.tools" ]
com.puppycrawl.tools;
2,076,403
public void setNoEmailPlease(Integer v) { if (!ObjectUtils.equals(this.noEmailPlease, v)) { this.noEmailPlease = v; setModified(true); } }
void function(Integer v) { if (!ObjectUtils.equals(this.noEmailPlease, v)) { this.noEmailPlease = v; setModified(true); } }
/** * Set the value of NoEmailPlease * * @param v new value */
Set the value of NoEmailPlease
setNoEmailPlease
{ "repo_name": "trackplus/Genji", "path": "src/main/java/com/aurel/track/persist/BaseTPerson.java", "license": "gpl-3.0", "size": 1013508 }
[ "org.apache.commons.lang.ObjectUtils" ]
import org.apache.commons.lang.ObjectUtils;
import org.apache.commons.lang.*;
[ "org.apache.commons" ]
org.apache.commons;
1,206,740
private void buildBubble() { built = true; this.realAlignment = this.calculateAlignment(this.realAlignment); setLayout(new BorderLayout()); setFocusable(false); setFocusableWindowState(false); setUndecorated(true); if (isPerPixelTranslucencySupported) { setBackground(COLOR_TRANSPARENT); } else { setBackground(Color.WHITE); } initRegularListener(); GridBagLayout gbl = new GridBagLayout(); bubble = new JPanel(gbl) { private static final long serialVersionUID = 1L;
void function() { built = true; this.realAlignment = this.calculateAlignment(this.realAlignment); setLayout(new BorderLayout()); setFocusable(false); setFocusableWindowState(false); setUndecorated(true); if (isPerPixelTranslucencySupported) { setBackground(COLOR_TRANSPARENT); } else { setBackground(Color.WHITE); } initRegularListener(); GridBagLayout gbl = new GridBagLayout(); bubble = new JPanel(gbl) { private static final long serialVersionUID = 1L;
/** * builds the Bubble for the first time */
builds the Bubble for the first time
buildBubble
{ "repo_name": "transwarpio/rapidminer", "path": "rapidMiner/rapidminer-studio-core/src/main/java/com/rapidminer/gui/tools/bubble/BubbleWindow.java", "license": "gpl-3.0", "size": 71660 }
[ "java.awt.BorderLayout", "java.awt.Color", "java.awt.GridBagLayout", "javax.swing.JPanel" ]
import java.awt.BorderLayout; import java.awt.Color; import java.awt.GridBagLayout; import javax.swing.JPanel;
import java.awt.*; import javax.swing.*;
[ "java.awt", "javax.swing" ]
java.awt; javax.swing;
1,341,718
Runfiles runfiles = Runfiles.create(); String documentationFilePath = runfiles.rlocation("io_bazel/site/en/docs/user-manual.md"); final File documentationFile = new File(documentationFilePath); DocumentationTestUtil.validateUserManual( Bazel.BAZEL_MODULES, BazelRuleClassProvider.create(), Files.asCharSource(documentationFile, UTF_8).read(), ImmutableSet.of()); }
Runfiles runfiles = Runfiles.create(); String documentationFilePath = runfiles.rlocation(STR); final File documentationFile = new File(documentationFilePath); DocumentationTestUtil.validateUserManual( Bazel.BAZEL_MODULES, BazelRuleClassProvider.create(), Files.asCharSource(documentationFile, UTF_8).read(), ImmutableSet.of()); }
/** * Checks that the user-manual is in sync with the {@link * com.google.devtools.build.lib.analysis.config.BuildConfigurationValue}. */
Checks that the user-manual is in sync with the <code>com.google.devtools.build.lib.analysis.config.BuildConfigurationValue</code>
testBazelUserManual
{ "repo_name": "bazelbuild/bazel", "path": "src/test/java/com/google/devtools/build/lib/packages/BazelDocumentationTest.java", "license": "apache-2.0", "size": 1829 }
[ "com.google.common.collect.ImmutableSet", "com.google.common.io.Files", "com.google.devtools.build.lib.bazel.Bazel", "com.google.devtools.build.lib.bazel.rules.BazelRuleClassProvider", "com.google.devtools.build.runfiles.Runfiles", "java.io.File" ]
import com.google.common.collect.ImmutableSet; import com.google.common.io.Files; import com.google.devtools.build.lib.bazel.Bazel; import com.google.devtools.build.lib.bazel.rules.BazelRuleClassProvider; import com.google.devtools.build.runfiles.Runfiles; import java.io.File;
import com.google.common.collect.*; import com.google.common.io.*; import com.google.devtools.build.lib.bazel.*; import com.google.devtools.build.lib.bazel.rules.*; import com.google.devtools.build.runfiles.*; import java.io.*;
[ "com.google.common", "com.google.devtools", "java.io" ]
com.google.common; com.google.devtools; java.io;
84,412
for (int p : parents) if (forbidden.contains(p)) return Double.NaN; // if (parents.length == 0) return localScore(i); // else if (parents.length == 1) return localScore(i, parents[0]); double residualVariance = getCovariances().getValue(i, i); int n = getSampleSize(); int p = parents.length; TetradMatrix covxx = getSelection1(getCovariances(), parents); try { TetradMatrix covxxInv = covxx.inverse(); TetradVector covxy = getSelection2(getCovariances(), parents, i); TetradVector b = covxxInv.times(covxy); residualVariance -= covxy.dotProduct(b); if (residualVariance <= 0) { if (isVerbose()) { out.println("Nonpositive residual varianceY: resVar / varianceY = " + (residualVariance / getCovariances().getValue(i, i))); } return Double.NaN; } double c = getPenaltyDiscount(); return score(residualVariance, n, logn, p, c); } catch (Exception e) { boolean removedOne = true; while (removedOne) { List<Integer> _parents = new ArrayList<>(); for (int y = 0; y < parents.length; y++) _parents.add(parents[y]); _parents.removeAll(forbidden); parents = new int[_parents.size()]; for (int y = 0; y < _parents.size(); y++) parents[y] = _parents.get(y); removedOne = printMinimalLinearlyDependentSet(parents, getCovariances()); } return Double.NaN; } }
for (int p : parents) if (forbidden.contains(p)) return Double.NaN; double residualVariance = getCovariances().getValue(i, i); int n = getSampleSize(); int p = parents.length; TetradMatrix covxx = getSelection1(getCovariances(), parents); try { TetradMatrix covxxInv = covxx.inverse(); TetradVector covxy = getSelection2(getCovariances(), parents, i); TetradVector b = covxxInv.times(covxy); residualVariance -= covxy.dotProduct(b); if (residualVariance <= 0) { if (isVerbose()) { out.println(STR + (residualVariance / getCovariances().getValue(i, i))); } return Double.NaN; } double c = getPenaltyDiscount(); return score(residualVariance, n, logn, p, c); } catch (Exception e) { boolean removedOne = true; while (removedOne) { List<Integer> _parents = new ArrayList<>(); for (int y = 0; y < parents.length; y++) _parents.add(parents[y]); _parents.removeAll(forbidden); parents = new int[_parents.size()]; for (int y = 0; y < _parents.size(); y++) parents[y] = _parents.get(y); removedOne = printMinimalLinearlyDependentSet(parents, getCovariances()); } return Double.NaN; } }
/** * Calculates the sample likelihood and BIC score for i given its parents in a simple SEM model */
Calculates the sample likelihood and BIC score for i given its parents in a simple SEM model
localScore
{ "repo_name": "ajsedgewick/tetrad", "path": "tetrad-lib/src/main/java/edu/cmu/tetrad/search/SemBicScore.java", "license": "gpl-2.0", "size": 10999 }
[ "edu.cmu.tetrad.util.TetradMatrix", "edu.cmu.tetrad.util.TetradVector", "java.util.ArrayList", "java.util.List" ]
import edu.cmu.tetrad.util.TetradMatrix; import edu.cmu.tetrad.util.TetradVector; import java.util.ArrayList; import java.util.List;
import edu.cmu.tetrad.util.*; import java.util.*;
[ "edu.cmu.tetrad", "java.util" ]
edu.cmu.tetrad; java.util;
141,998
private String readString() throws IOException { StringBuffer sb = new StringBuffer(); int delim = lastChar; int l = lineNo; int c = colNo; readChar(); while ((-1 != lastChar) && (delim != lastChar)) { StringBuffer digitBuffer; if (lastChar != '\\') { sb.append((char) lastChar); readChar(); continue; } readChar(); switch (lastChar) { case 'b': readChar(); sb.append('\b'); continue; case 'f': readChar(); sb.append('\f'); continue; case 'n': readChar(); sb.append('\n'); continue; case 'r': readChar(); sb.append('\r'); continue; case 't': readChar(); sb.append('\t'); continue; case '\'': readChar(); sb.append('\''); continue; case '"': readChar(); sb.append('"'); continue; case '\\': readChar(); sb.append('\\'); continue; case '/': readChar(); sb.append('/'); continue; // hex constant // unicode constant case 'x': case 'u': digitBuffer = new StringBuffer(); int toRead = 2; if (lastChar == 'u') toRead = 4; for (int i = 0; i < toRead; i++) { readChar(); if (!isHexDigit(lastChar)) throw new IOException("non-hex digit " + onLineCol()); digitBuffer.append((char) lastChar); } readChar(); try { int digitValue = Integer.parseInt(digitBuffer.toString(), 16); sb.append((char) digitValue); } catch (NumberFormatException e) { throw new IOException("non-hex digit " + onLineCol()); } break; // octal constant default: if (!isOctalDigit(lastChar)) throw new IOException("non-hex digit " + onLineCol()); digitBuffer = new StringBuffer(); digitBuffer.append((char) lastChar); for (int i = 0; i < 2; i++) { readChar(); if (!isOctalDigit(lastChar)) break; digitBuffer.append((char) lastChar); } try { int digitValue = Integer.parseInt(digitBuffer.toString(), 8); sb.append((char) digitValue); } catch (NumberFormatException e) { throw new IOException("non-hex digit " + onLineCol()); } } } if (-1 == lastChar) { throw new IOException("String not terminated " + onLineCol(l, c)); } readChar(); return sb.toString(); }
String function() throws IOException { StringBuffer sb = new StringBuffer(); int delim = lastChar; int l = lineNo; int c = colNo; readChar(); while ((-1 != lastChar) && (delim != lastChar)) { StringBuffer digitBuffer; if (lastChar != '\\') { sb.append((char) lastChar); readChar(); continue; } readChar(); switch (lastChar) { case 'b': readChar(); sb.append('\b'); continue; case 'f': readChar(); sb.append('\f'); continue; case 'n': readChar(); sb.append('\n'); continue; case 'r': readChar(); sb.append('\r'); continue; case 't': readChar(); sb.append('\t'); continue; case '\'': readChar(); sb.append('\''); continue; case 'STR'); continue; case '\\': readChar(); sb.append('\\'); continue; case '/': readChar(); sb.append('/'); continue; case 'x': case 'u': digitBuffer = new StringBuffer(); int toRead = 2; if (lastChar == 'u') toRead = 4; for (int i = 0; i < toRead; i++) { readChar(); if (!isHexDigit(lastChar)) throw new IOException(STR + onLineCol()); digitBuffer.append((char) lastChar); } readChar(); try { int digitValue = Integer.parseInt(digitBuffer.toString(), 16); sb.append((char) digitValue); } catch (NumberFormatException e) { throw new IOException(STR + onLineCol()); } break; default: if (!isOctalDigit(lastChar)) throw new IOException(STR + onLineCol()); digitBuffer = new StringBuffer(); digitBuffer.append((char) lastChar); for (int i = 0; i < 2; i++) { readChar(); if (!isOctalDigit(lastChar)) break; digitBuffer.append((char) lastChar); } try { int digitValue = Integer.parseInt(digitBuffer.toString(), 8); sb.append((char) digitValue); } catch (NumberFormatException e) { throw new IOException(STR + onLineCol()); } } } if (-1 == lastChar) { throw new IOException(STR + onLineCol(l, c)); } readChar(); return sb.toString(); }
/** * Method to read a string from the JSON string, converting escapes accordingly. * * @return The parsed JSON string with all escapes properly converyed. * * @throws IOException Thrown on unterminated strings, invalid characters, bad escapes, and so on. Basically, invalid JSON. */
Method to read a string from the JSON string, converting escapes accordingly
readString
{ "repo_name": "OpenLiberty/open-liberty", "path": "dev/com.ibm.json4j/src/com/ibm/json/java/internal/Tokenizer.java", "license": "epl-1.0", "size": 13676 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
531,127
return title = Lists.createWhenNull(title); }
return title = Lists.createWhenNull(title); }
/** * Returns the DublinCore module titles. * <p> * * @return a list of Strings representing the DublinCore module title, an empty list if none. * */
Returns the DublinCore module titles.
getTitles
{ "repo_name": "bibliolabs/rome", "path": "rome/src/main/java/com/rometools/rome/feed/module/DCModuleImpl.java", "license": "apache-2.0", "size": 26632 }
[ "com.rometools.utils.Lists" ]
import com.rometools.utils.Lists;
import com.rometools.utils.*;
[ "com.rometools.utils" ]
com.rometools.utils;
280,062