_id stringlengths 2 7 | title stringlengths 3 140 | partition stringclasses 3
values | text stringlengths 73 34.1k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q7900 | StringUtils.sortStringArray | train | public static String[] sortStringArray(String[] array) {
if (isEmpty(array)) {
return new String[0];
}
Arrays.sort(array);
return array;
} | java | {
"resource": ""
} |
q7901 | StringUtils.removeDuplicateStrings | train | public static String[] removeDuplicateStrings(String[] array) {
if (isEmpty(array)) {
return array;
}
Set<String> set = new TreeSet<String>();
Collections.addAll(set, array);
return toStringArray(set);
} | java | {
"resource": ""
} |
q7902 | StringUtils.commaDelimitedListToSet | train | public static Set<String> commaDelimitedListToSet(String str) {
Set<String> set = new TreeSet<String>();
String[] tokens = commaDelimitedListToStringArray(str);
Collections.addAll(set, tokens);
return set;
} | java | {
"resource": ""
} |
q7903 | StringUtils.toSafeFileName | train | public static String toSafeFileName(String name) {
int size = name.length();
StringBuilder builder = new StringBuilder(size * 2);
for (int i = 0; i < size; i++) {
char c = name.charAt(i);
boolean valid = c >= 'a' && c <= 'z';
valid = valid || (c >= 'A' && c <=... | java | {
"resource": ""
} |
q7904 | TrelloImpl.getBoardMemberActivity | train | @Override
@Deprecated
public List<CardWithActions> getBoardMemberActivity(String boardId, String memberId,
String actionFilter, Argument... args) {
if (actionFilter == null)
actionFilter = "all";
Argument[] argsAndFilter = Arrays.copyOf(args, args.length + 1);
arg... | java | {
"resource": ""
} |
q7905 | SigningDigest.sign | train | void sign(byte[] data, int offset, int length,
ServerMessageBlock request, ServerMessageBlock response) {
request.signSeq = signSequence;
if( response != null ) {
response.signSeq = signSequence + 1;
response.verifyFailed = false;
}
try {
... | java | {
"resource": ""
} |
q7906 | Config.setProperty | train | public static Object setProperty( String key, String value ) {
return prp.setProperty( key, value );
} | java | {
"resource": ""
} |
q7907 | NbtAddress.getAllByAddress | train | public static NbtAddress[] getAllByAddress( NbtAddress addr )
throws UnknownHostException {
try {
NbtAddress[] addrs = CLIENT.getNodeStatus( addr );
cacheAddressArray( addrs );
return addrs;
} catch( UnknownHostException... | java | {
"resource": ""
} |
q7908 | UniAddress.getHostName | train | public String getHostName() {
if( addr instanceof NbtAddress ) {
return ((NbtAddress)addr).getHostName();
}
return ((InetAddress)addr).getHostName();
} | java | {
"resource": ""
} |
q7909 | UniAddress.getHostAddress | train | public String getHostAddress() {
if( addr instanceof NbtAddress ) {
return ((NbtAddress)addr).getHostAddress();
}
return ((InetAddress)addr).getHostAddress();
} | java | {
"resource": ""
} |
q7910 | SmbFile.getUncPath | train | public String getUncPath() {
getUncPath0();
if( share == null ) {
return "\\\\" + url.getHost();
}
return "\\\\" + url.getHost() + canon.replace( '/', '\\' );
} | java | {
"resource": ""
} |
q7911 | SmbFile.createNewFile | train | public void createNewFile() throws SmbException {
if( getUncPath0().length() == 1 ) {
throw new SmbException( "Invalid operation for workgroups, servers, or shares" );
}
close( open0( O_RDWR | O_CREAT | O_EXCL, 0, ATTR_NORMAL, 0 ), 0L );
} | java | {
"resource": ""
} |
q7912 | JsonReport.getProjectName | train | private String getProjectName() {
String pName = Strings.emptyToNull(projectName);
if (pName == null) {
pName = Strings.emptyToNull(junit4.getProject().getName());
}
if (pName == null) {
pName = "(unnamed project)";
}
return pName;
} | java | {
"resource": ""
} |
q7913 | JsonReport.onSuiteResult | train | @Subscribe
@SuppressForbidden("legitimate printStackTrace().")
public void onSuiteResult(AggregatedSuiteResultEvent e) {
try {
if (jsonWriter == null)
return;
slaves.put(e.getSlave().id, e.getSlave());
e.serialize(jsonWriter, outputStreams);
} catch (Exception ex) {
ex.print... | java | {
"resource": ""
} |
q7914 | JsonReport.onQuit | train | @Subscribe
public void onQuit(AggregatedQuitEvent e) {
if (jsonWriter == null)
return;
try {
jsonWriter.endArray();
jsonWriter.name("slaves");
jsonWriter.beginObject();
for (Map.Entry<Integer, ForkedJvmInfo> entry : slaves.entrySet()) {
jsonWriter.name(Integer.toString(... | java | {
"resource": ""
} |
q7915 | JUnit4.setSeed | train | public void setSeed(String randomSeed) {
if (!Strings.isNullOrEmpty(getProject().getUserProperty(SYSPROP_RANDOM_SEED()))) {
String userProperty = getProject().getUserProperty(SYSPROP_RANDOM_SEED());
if (!userProperty.equals(randomSeed)) {
log("Ignoring seed attribute because it is overridden by ... | java | {
"resource": ""
} |
q7916 | JUnit4.setPrefix | train | public void setPrefix(String prefix) {
if (!Strings.isNullOrEmpty(getProject().getUserProperty(SYSPROP_PREFIX()))) {
log("Ignoring prefix attribute because it is overridden by user properties.", Project.MSG_WARN);
} else {
SysGlobals.initializeWith(prefix);
}
} | java | {
"resource": ""
} |
q7917 | JUnit4.addFileSet | train | public void addFileSet(FileSet fs) {
add(fs);
if (fs.getProject() == null) {
fs.setProject(getProject());
}
} | java | {
"resource": ""
} |
q7918 | JUnit4.addAssertions | train | public void addAssertions(Assertions asserts) {
if (getCommandline().getAssertions() != null) {
throw new BuildException("Only one assertion declaration is allowed");
}
getCommandline().setAssertions(asserts);
} | java | {
"resource": ""
} |
q7919 | JUnit4.validateArguments | train | private void validateArguments() throws BuildException {
Path tempDir = getTempDir();
if (tempDir == null) {
throw new BuildException("Temporary directory cannot be null.");
}
if (Files.exists(tempDir)) {
if (!Files.isDirectory(tempDir)) {
throw new BuildException("Temporary di... | java | {
"resource": ""
} |
q7920 | JUnit4.validateJUnit4 | train | private void validateJUnit4() throws BuildException {
try {
Class<?> clazz = Class.forName("org.junit.runner.Description");
if (!Serializable.class.isAssignableFrom(clazz)) {
throw new BuildException("At least JUnit version 4.10 is required on junit4's taskdef classpath.");
}
} catch (... | java | {
"resource": ""
} |
q7921 | JUnit4.resolveFiles | train | private org.apache.tools.ant.types.Path resolveFiles(org.apache.tools.ant.types.Path path) {
org.apache.tools.ant.types.Path cloned = new org.apache.tools.ant.types.Path(getProject());
for (String location : path.list()) {
cloned.createPathElement().setLocation(new File(location));
}
return cloned... | java | {
"resource": ""
} |
q7922 | JUnit4.determineForkedJvmCount | train | private int determineForkedJvmCount(TestsCollection testCollection) {
int cores = Runtime.getRuntime().availableProcessors();
int jvmCount;
if (this.parallelism.equals(PARALLELISM_AUTO)) {
if (cores >= 8) {
// Maximum parallel jvms is 4, conserve some memory and memory bandwidth.
jvmCo... | java | {
"resource": ""
} |
q7923 | JUnit4.escapeAndJoin | train | private String escapeAndJoin(String[] commandline) {
// TODO: we should try to escape special characters here, depending on the OS.
StringBuilder b = new StringBuilder();
Pattern specials = Pattern.compile("[\\ ]");
for (String arg : commandline) {
if (b.length() > 0) {
b.append(" ");
... | java | {
"resource": ""
} |
q7924 | JUnit4.forkProcess | train | @SuppressForbidden("legitimate sysstreams.")
private Execute forkProcess(ForkedJvmInfo slaveInfo, EventBus eventBus,
CommandlineJava commandline,
TailInputStream eventStream, OutputStream sysout, OutputStream syserr, RandomAccessFile streamsBuffer) {
try {
String tempDir = commandline.getSyste... | java | {
"resource": ""
} |
q7925 | JUnit4.getTempDir | train | private Path getTempDir() {
if (this.tempDir == null) {
if (this.dir != null) {
this.tempDir = dir;
} else {
this.tempDir = getProject().getBaseDir().toPath();
}
}
return tempDir;
} | java | {
"resource": ""
} |
q7926 | JUnit4.addSlaveClasspath | train | private org.apache.tools.ant.types.Path addSlaveClasspath() {
org.apache.tools.ant.types.Path path = new org.apache.tools.ant.types.Path(getProject());
String [] REQUIRED_SLAVE_CLASSES = {
SlaveMain.class.getName(),
Strings.class.getName(),
MethodGlobFilter.class.getName(),
TeeO... | java | {
"resource": ""
} |
q7927 | PickFromListTask.validate | train | private void validate() {
if (Strings.emptyToNull(random) == null) {
random = Strings.emptyToNull(getProject().getProperty(SYSPROP_RANDOM_SEED()));
}
if (random == null) {
throw new BuildException("Required attribute 'seed' must not be empty. Look at <junit4:pickseed>.");
}
lo... | java | {
"resource": ""
} |
q7928 | TopHints.add | train | public void add(ResourceCollection rc) {
if (rc instanceof FileSet) {
FileSet fs = (FileSet) rc;
fs.setProject(getProject());
}
resources.add(rc);
} | java | {
"resource": ""
} |
q7929 | SlaveMainSafe.verifyJUnit4Present | train | private static void verifyJUnit4Present() {
try {
Class<?> clazz = Class.forName("org.junit.runner.Description");
if (!Serializable.class.isAssignableFrom(clazz)) {
JvmExit.halt(SlaveMain.ERR_OLD_JUNIT);
}
} catch (ClassNotFoundException e) {
JvmExit.halt(SlaveMain.ERR_NO_JUNIT);... | java | {
"resource": ""
} |
q7930 | TextReport.setShowOutput | train | public void setShowOutput(String mode) {
try {
this.outputMode = OutputMode.valueOf(mode.toUpperCase(Locale.ROOT));
} catch (IllegalArgumentException e) {
throw new IllegalArgumentException("showOutput accepts any of: "
+ Arrays.toString(OutputMode.values()) + ", value is not valid: " + mo... | java | {
"resource": ""
} |
q7931 | TextReport.flushOutput | train | private void flushOutput() throws IOException {
outStream.flush();
outWriter.completeLine();
errStream.flush();
errWriter.completeLine();
} | java | {
"resource": ""
} |
q7932 | TextReport.emitSuiteStart | train | private void emitSuiteStart(Description description, long startTimestamp) throws IOException {
String suiteName = description.getDisplayName();
if (useSimpleNames) {
if (suiteName.lastIndexOf('.') >= 0) {
suiteName = suiteName.substring(suiteName.lastIndexOf('.') + 1);
}
}
logShort(s... | java | {
"resource": ""
} |
q7933 | TextReport.emitSuiteEnd | train | private void emitSuiteEnd(AggregatedSuiteResultEvent e, int suitesCompleted) throws IOException {
assert showSuiteSummary;
final StringBuilder b = new StringBuilder();
final int totalErrors = this.totalErrors.addAndGet(e.isSuccessful() ? 0 : 1);
b.append(String.format(Locale.ROOT, "%sCompleted [%d/%d%s... | java | {
"resource": ""
} |
q7934 | TextReport.emitStatusLine | train | private void emitStatusLine(AggregatedResultEvent result, TestStatus status, long timeMillis) throws IOException {
final StringBuilder line = new StringBuilder();
line.append(shortTimestamp(result.getStartTimestamp()));
line.append(Strings.padEnd(statusNames.get(status), 8, ' '));
line.append(formatDur... | java | {
"resource": ""
} |
q7935 | TextReport.logShort | train | private void logShort(CharSequence message, boolean trim) throws IOException {
int length = message.length();
if (trim) {
while (length > 0 && Character.isWhitespace(message.charAt(length - 1))) {
length--;
}
}
char [] chars = new char [length + 1];
for (int i = 0; i < length; i... | java | {
"resource": ""
} |
q7936 | AggregatedSuiteResultEvent.getIgnoredCount | train | public int getIgnoredCount() {
int count = 0;
for (AggregatedTestResultEvent t : getTests()) {
if (t.getStatus() == TestStatus.IGNORED ||
t.getStatus() == TestStatus.IGNORED_ASSUMPTION) {
count++;
}
}
return count;
} | java | {
"resource": ""
} |
q7937 | AntXmlReport.onQuit | train | @Subscribe
public void onQuit(AggregatedQuitEvent e) {
if (summaryFile != null) {
try {
Persister persister = new Persister();
persister.write(new MavenFailsafeSummaryModel(summaryListener.getResult()), summaryFile);
} catch (Exception x) {
junit4.log("Could not serialize summa... | java | {
"resource": ""
} |
q7938 | AntXmlReport.onSuiteResult | train | @Subscribe
public void onSuiteResult(AggregatedSuiteResultEvent e) {
// Calculate summaries.
summaryListener.suiteSummary(e);
Description suiteDescription = e.getDescription();
String displayName = suiteDescription.getDisplayName();
if (displayName.trim().isEmpty()) {
junit4.log("Could not ... | java | {
"resource": ""
} |
q7939 | AntXmlReport.buildModel | train | private TestSuiteModel buildModel(AggregatedSuiteResultEvent e) throws IOException {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss", Locale.ROOT);
TestSuiteModel suite = new TestSuiteModel();
suite.hostname = "nohost.nodomain";
suite.name = e.getDescription().getDisplayName();
s... | java | {
"resource": ""
} |
q7940 | AntXmlReport.applyFilters | train | private String applyFilters(String methodName) {
if (filters.isEmpty()) {
return methodName;
}
Reader in = new StringReader(methodName);
for (TokenFilter tf : filters) {
in = tf.chain(in);
}
try {
return CharStreams.toString(in);
} catch (IOException e) {
junit4.log... | java | {
"resource": ""
} |
q7941 | LocalSlaveStreamHandler.pumpEvents | train | void pumpEvents(InputStream eventStream) {
try {
Deserializer deserializer = new Deserializer(eventStream, refLoader);
IEvent event = null;
while ((event = deserializer.deserialize()) != null) {
switch (event.getType()) {
case APPEND_STDERR:
case APPEND_STDOUT:
... | java | {
"resource": ""
} |
q7942 | ExecutionTimesReport.onSuiteResult | train | @Subscribe
public void onSuiteResult(AggregatedSuiteResultEvent e) {
long millis = e.getExecutionTime();
String suiteName = e.getDescription().getDisplayName();
List<Long> values = hints.get(suiteName);
if (values == null) {
hints.put(suiteName, values = new ArrayList<>());
}
values... | java | {
"resource": ""
} |
q7943 | ExecutionTimesReport.onEnd | train | @Subscribe
public void onEnd(AggregatedQuitEvent e) {
try {
writeHints(hintsFile, hints);
} catch (IOException exception) {
outer.log("Could not write back the hints file.", exception, Project.MSG_ERR);
}
} | java | {
"resource": ""
} |
q7944 | ExecutionTimesReport.readHints | train | public static Map<String,List<Long>> readHints(File hints) throws IOException {
Map<String,List<Long>> result = new HashMap<>();
InputStream is = new FileInputStream(hints);
mergeHints(is, result);
return result;
} | java | {
"resource": ""
} |
q7945 | ExecutionTimesReport.mergeHints | train | public static void mergeHints(InputStream is, Map<String,List<Long>> hints) throws IOException {
final BufferedReader reader = new BufferedReader(
new InputStreamReader(is, Charsets.UTF_8));
String line;
while ((line = reader.readLine()) != null) {
line = line.trim();
if (line.isEmp... | java | {
"resource": ""
} |
q7946 | ExecutionTimesReport.writeHints | train | public static void writeHints(File file, Map<String,List<Long>> hints) throws IOException {
Closer closer = Closer.create();
try {
BufferedWriter w = closer.register(Files.newWriter(file, Charsets.UTF_8));
if (!(hints instanceof SortedMap)) {
hints = new TreeMap<String,List<Long>>(hints);
... | java | {
"resource": ""
} |
q7947 | SlaveMain.readArgsFile | train | private static String[] readArgsFile(String argsFile) throws IOException {
final ArrayList<String> lines = new ArrayList<String>();
final BufferedReader reader = new BufferedReader(
new InputStreamReader(
new FileInputStream(argsFile), "UTF-8"));
try {
String line;
while ((li... | java | {
"resource": ""
} |
q7948 | SlaveMain.redirectStreams | train | @SuppressForbidden("legitimate sysstreams.")
private static void redirectStreams(final Serializer serializer, final boolean flushFrequently) {
final PrintStream origSysOut = System.out;
final PrintStream origSysErr = System.err;
// Set warnings stream to System.err.
warnings = System.err;
AccessC... | java | {
"resource": ""
} |
q7949 | SlaveMain.warn | train | @SuppressForbidden("legitimate sysstreams.")
public static void warn(String message, Throwable t) {
PrintStream w = (warnings == null ? System.err : warnings);
try {
w.print("WARN: ");
w.print(message);
if (t != null) {
w.print(" -> ");
try {
t.printStackTrace(w);
... | java | {
"resource": ""
} |
q7950 | SlaveMain.instantiateRunListeners | train | private ArrayList<RunListener> instantiateRunListeners() throws Exception {
ArrayList<RunListener> instances = new ArrayList<>();
if (runListeners != null) {
for (String className : Arrays.asList(runListeners.split(","))) {
instances.add((RunListener) this.instantiate(className).newInstance());
... | java | {
"resource": ""
} |
q7951 | ExecutionTimeBalancer.assign | train | @Override
public List<Assignment> assign(Collection<String> suiteNames, int slaves, long seed) {
// Read hints first.
final Map<String,List<Long>> hints = ExecutionTimesReport.mergeHints(resources, suiteNames);
// Preprocess and sort costs. Take the median for each suite's measurements as the
// wei... | java | {
"resource": ""
} |
q7952 | PaginationToken.mergeTokenAndQueryParameters | train | static <K, V> PageMetadata<K, V> mergeTokenAndQueryParameters(String paginationToken, final
ViewQueryParameters<K, V> initialParameters) {
// Decode the base64 token into JSON
String json = new String(Base64.decodeBase64(paginationToken), Charset.forName("UTF-8"));
// Get a suitable Gson, ... | java | {
"resource": ""
} |
q7953 | PaginationToken.tokenize | train | static String tokenize(PageMetadata<?, ?> pageMetadata) {
try {
Gson g = getGsonWithKeyAdapter(pageMetadata.pageRequestParameters);
return new String(Base64.encodeBase64URLSafe(g.toJson(new PaginationToken
(pageMetadata)).getBytes("UTF-8")),
Charse... | java | {
"resource": ""
} |
q7954 | FindByIndexOptions.useIndex | train | public FindByIndexOptions useIndex(String designDocument, String indexName) {
assertNotNull(designDocument, "designDocument");
assertNotNull(indexName, "indexName");
JsonArray index = new JsonArray();
index.add(new JsonPrimitive(designDocument));
index.add(new JsonPrimitive(... | java | {
"resource": ""
} |
q7955 | InternalIndex.getPartialFilterSelector | train | @Override
public String getPartialFilterSelector() {
return (def.selector != null) ? def.selector.toString() : null;
} | java | {
"resource": ""
} |
q7956 | Replication.trigger | train | public com.cloudant.client.api.model.ReplicationResult trigger() {
ReplicationResult couchDbReplicationResult = replication.trigger();
com.cloudant.client.api.model.ReplicationResult replicationResult = new com.cloudant
.client.api.model.ReplicationResult(couchDbReplicationResult);
... | java | {
"resource": ""
} |
q7957 | Replication.queryParams | train | public Replication queryParams(Map<String, Object> queryParams) {
this.replication = replication.queryParams(queryParams);
return this;
} | java | {
"resource": ""
} |
q7958 | Replication.targetOauth | train | public Replication targetOauth(String consumerSecret,
String consumerKey, String tokenSecret, String token) {
this.replication = replication.targetOauth(consumerSecret, consumerKey,
tokenSecret, token);
return this;
} | java | {
"resource": ""
} |
q7959 | CloudantClient.getActiveTasks | train | public List<Task> getActiveTasks() {
InputStream response = null;
URI uri = new URIBase(getBaseUri()).path("_active_tasks").build();
try {
response = couchDbClient.get(uri);
return getResponseList(response, couchDbClient.getGson(), DeserializationTypes.TASKS);
} f... | java | {
"resource": ""
} |
q7960 | CloudantClient.getMembership | train | public Membership getMembership() {
URI uri = new URIBase(getBaseUri()).path("_membership").build();
Membership membership = couchDbClient.get(uri,
Membership.class);
return membership;
} | java | {
"resource": ""
} |
q7961 | Changes.getChanges | train | public ChangesResult getChanges() {
final URI uri = this.databaseHelper.changesUri("feed", "normal");
return client.get(uri, ChangesResult.class);
} | java | {
"resource": ""
} |
q7962 | Changes.parameter | train | public Changes parameter(String name, String value) {
this.databaseHelper.query(name, value);
return this;
} | java | {
"resource": ""
} |
q7963 | Changes.readNextRow | train | private boolean readNextRow() {
while (!stop) {
String row = getLineWrapped();
// end of stream - null indicates end of stream before we see last_seq which shouldn't
// be possible but we should handle it
if (row == null || row.startsWith("{\"last_seq\":")) {
... | java | {
"resource": ""
} |
q7964 | Database.getShards | train | public List<Shard> getShards() {
InputStream response = null;
try {
response = client.couchDbClient.get(new DatabaseURIHelper(db.getDBUri()).path("_shards")
.build());
return getResponseList(response, client.getGson(), DeserializationTypes.SHARDS);
} f... | java | {
"resource": ""
} |
q7965 | Database.getShard | train | public Shard getShard(String docId) {
assertNotEmpty(docId, "docId");
return client.couchDbClient.get(new DatabaseURIHelper(db.getDBUri()).path("_shards")
.path(docId).build(),
Shard.class);
} | java | {
"resource": ""
} |
q7966 | Database.findByIndex | train | @Deprecated
public <T> List<T> findByIndex(String selectorJson, Class<T> classOfT) {
return findByIndex(selectorJson, classOfT, new FindByIndexOptions());
} | java | {
"resource": ""
} |
q7967 | Database.query | train | public <T> QueryResult<T> query(String partitionKey, String query, final Class<T> classOfT) {
URI uri = new DatabaseURIHelper(db.getDBUri()).partition(partitionKey).path("_find").build();
return this.query(uri, query, classOfT);
} | java | {
"resource": ""
} |
q7968 | Database.listIndexes | train | public Indexes listIndexes() {
URI uri = new DatabaseURIHelper(db.getDBUri()).path("_index").build();
return client.couchDbClient.get(uri, Indexes.class);
} | java | {
"resource": ""
} |
q7969 | Database.deleteIndex | train | public void deleteIndex(String indexName, String designDocId, String type) {
assertNotEmpty(indexName, "indexName");
assertNotEmpty(designDocId, "designDocId");
assertNotNull(type, "type");
if (!designDocId.startsWith("_design")) {
designDocId = "_design/" + designDocId;
... | java | {
"resource": ""
} |
q7970 | Database.find | train | public <T> T find(Class<T> classType, String id) {
return db.find(classType, id);
} | java | {
"resource": ""
} |
q7971 | Database.info | train | public DbInfo info() {
return client.couchDbClient.get(new DatabaseURIHelper(db.getDBUri()).getDatabaseUri(),
DbInfo.class);
} | java | {
"resource": ""
} |
q7972 | Database.partitionInfo | train | public PartitionInfo partitionInfo(String partitionKey) {
if (partitionKey == null) {
throw new UnsupportedOperationException("Cannot get partition information for null partition key.");
}
URI uri = new DatabaseURIHelper(db.getDBUri()).partition(partitionKey).build();
return ... | java | {
"resource": ""
} |
q7973 | Expression.type | train | public static Expression type(String lhs, Type rhs) {
return new Expression(lhs, "$type", rhs.toString());
} | java | {
"resource": ""
} |
q7974 | PredicateExpression.nin | train | public static PredicateExpression nin(Object... rhs) {
PredicateExpression ex = new PredicateExpression("$nin", rhs);
if (rhs.length == 1) {
ex.single = true;
}
return ex;
} | java | {
"resource": ""
} |
q7975 | PredicateExpression.all | train | public static PredicateExpression all(Object... rhs) {
PredicateExpression ex = new PredicateExpression( "$all", rhs);
if (rhs.length == 1) {
ex.single = true;
}
return ex;
} | java | {
"resource": ""
} |
q7976 | Replication.trigger | train | public ReplicationResult trigger() {
assertNotEmpty(source, "Source");
assertNotEmpty(target, "Target");
InputStream response = null;
try {
JsonObject json = createJson();
if (log.isLoggable(Level.FINE)) {
log.fine(json.toString());
}
... | java | {
"resource": ""
} |
q7977 | Replication.targetOauth | train | public Replication targetOauth(String consumerSecret, String consumerKey, String tokenSecret,
String token) {
targetOauth = new JsonObject();
this.consumerSecret = consumerSecret;
this.consumerKey = consumerKey;
this.tokenSecret = tokenSecret;
t... | java | {
"resource": ""
} |
q7978 | CouchDbUtil.createPost | train | public static HttpConnection createPost(URI uri, String body, String contentType) {
HttpConnection connection = Http.POST(uri, "application/json");
if(body != null) {
setEntity(connection, body, contentType);
}
return connection;
} | java | {
"resource": ""
} |
q7979 | CouchDbUtil.setEntity | train | public static void setEntity(HttpConnection connnection, String body, String contentType) {
connnection.requestProperties.put("Content-type", contentType);
connnection.setRequestBody(body);
} | java | {
"resource": ""
} |
q7980 | HttpConnectionInterceptorContext.setState | train | public <T> void setState(HttpConnectionInterceptor interceptor, String stateName, T
stateObjectToStore) {
Map<String, Object> state = interceptorStates.get(interceptor);
if (state == null) {
interceptorStates.put(interceptor, (state = new ConcurrentHashMap<String, Object>()));
... | java | {
"resource": ""
} |
q7981 | HttpConnectionInterceptorContext.getState | train | public <T> T getState(HttpConnectionInterceptor interceptor, String stateName, Class<T>
stateType) {
Map<String, Object> state = interceptorStates.get(interceptor);
if (state != null) {
return stateType.cast(state.get(stateName));
} else {
return null;
... | java | {
"resource": ""
} |
q7982 | DesignDocumentManager.get | train | public DesignDocument get(String id) {
assertNotEmpty(id, "id");
return db.find(DesignDocument.class, ensureDesignPrefix(id));
} | java | {
"resource": ""
} |
q7983 | DesignDocumentManager.get | train | public DesignDocument get(String id, String rev) {
assertNotEmpty(id, "id");
assertNotEmpty(id, "rev");
return db.find(DesignDocument.class, ensureDesignPrefix(id), rev);
} | java | {
"resource": ""
} |
q7984 | DesignDocumentManager.remove | train | public Response remove(String id) {
assertNotEmpty(id, "id");
id = ensureDesignPrefix(id);
String revision = null;
// Get the revision ID from ETag, removing leading and trailing "
revision = client.executeRequest(Http.HEAD(new DatabaseURIHelper(db.getDBUri()
).docu... | java | {
"resource": ""
} |
q7985 | DesignDocumentManager.remove | train | public Response remove(String id, String rev) {
assertNotEmpty(id, "id");
assertNotEmpty(id, "rev");
return db.remove(ensureDesignPrefix(id), rev);
} | java | {
"resource": ""
} |
q7986 | DesignDocumentManager.remove | train | public Response remove(DesignDocument designDocument) {
assertNotEmpty(designDocument, "DesignDocument");
ensureDesignPrefixObject(designDocument);
return db.remove(designDocument);
} | java | {
"resource": ""
} |
q7987 | DesignDocumentManager.list | train | public List<DesignDocument> list() throws IOException {
return db.getAllDocsRequestBuilder()
.startKey("_design/")
.endKey("_design0")
.inclusiveEnd(false)
.includeDocs(true)
.build()
.getResponse().getDocsAs(... | java | {
"resource": ""
} |
q7988 | DesignDocumentManager.fromDirectory | train | public static List<DesignDocument> fromDirectory(File directory) throws FileNotFoundException {
List<DesignDocument> designDocuments = new ArrayList<DesignDocument>();
if (directory.isDirectory()) {
Collection<File> files = FileUtils.listFiles(directory, null, true);
for (Fil... | java | {
"resource": ""
} |
q7989 | DesignDocumentManager.fromFile | train | public static DesignDocument fromFile(File file) throws FileNotFoundException {
assertNotEmpty(file, "Design js file");
DesignDocument designDocument;
Gson gson = new Gson();
InputStreamReader reader = null;
try {
reader = new InputStreamReader(new FileInputStre... | java | {
"resource": ""
} |
q7990 | PageMetadata.forwardPaginationQueryParameters | train | static <K, V> ViewQueryParameters<K, V> forwardPaginationQueryParameters
(ViewQueryParameters<K, V> initialQueryParameters, K startkey, String startkey_docid) {
// Copy the initial query parameters
ViewQueryParameters<K, V> pageParameters = initialQueryParameters.copy();
// Now override wi... | java | {
"resource": ""
} |
q7991 | Http.connect | train | public static HttpConnection connect(String requestMethod,
URL url,
String contentType) {
return new HttpConnection(requestMethod, url, contentType);
} | java | {
"resource": ""
} |
q7992 | Builder.partialFilterSelector | train | public B partialFilterSelector(Selector selector) {
instance.def.selector = Helpers.getJsonObjectFromSelector(selector);
return returnThis();
} | java | {
"resource": ""
} |
q7993 | Builder.fields | train | protected B fields(List<F> fields) {
if (instance.def.fields == null) {
instance.def.fields = new ArrayList<F>(fields.size());
}
instance.def.fields.addAll(fields);
return returnThis();
} | java | {
"resource": ""
} |
q7994 | CouchDbClient.schedulerDoc | train | public SchedulerDocsResponse.Doc schedulerDoc(String docId) {
assertNotEmpty(docId, "docId");
return this.get(new DatabaseURIHelper(getBaseUri()).
path("_scheduler").path("docs").path("_replicator").path(docId).build(),
SchedulerDocsResponse.Doc.class);
} | java | {
"resource": ""
} |
q7995 | CouchDbClient.uuids | train | public List<String> uuids(long count) {
final URI uri = new URIBase(clientUri).path("_uuids").query("count", count).build();
final JsonObject json = get(uri, JsonObject.class);
return getGson().fromJson(json.get("uuids").toString(), DeserializationTypes.STRINGS);
} | java | {
"resource": ""
} |
q7996 | CouchDbClient.executeToResponse | train | public Response executeToResponse(HttpConnection connection) {
InputStream is = null;
try {
is = this.executeToInputStream(connection);
Response response = getResponse(is, Response.class, getGson());
response.setStatusCode(connection.getConnection().getResponseCode())... | java | {
"resource": ""
} |
q7997 | CouchDbClient.delete | train | Response delete(URI uri) {
HttpConnection connection = Http.DELETE(uri);
return executeToResponse(connection);
} | java | {
"resource": ""
} |
q7998 | CouchDbClient.get | train | public <T> T get(URI uri, Class<T> classType) {
HttpConnection connection = Http.GET(uri);
InputStream response = executeToInputStream(connection);
try {
return getResponse(response, classType, getGson());
} finally {
close(response);
}
} | java | {
"resource": ""
} |
q7999 | CouchDbClient.put | train | Response put(URI uri, InputStream instream, String contentType) {
HttpConnection connection = Http.PUT(uri, contentType);
connection.setRequestBody(instream);
return executeToResponse(connection);
} | java | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.