_id stringlengths 2 7 | title stringlengths 3 140 | partition stringclasses 3
values | text stringlengths 73 34.1k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q159800 | SysUtil.findAbiScore | train | public static int findAbiScore(String[] supportedAbis, String abi) {
for (int i = 0; i < supportedAbis.length; ++i) {
if (supportedAbis[i] != null && abi.equals(supportedAbis[i])) {
return i;
}
}
return -1;
} | java | {
"resource": ""
} |
q159801 | SysUtil.getSupportedAbis | train | public static String[] getSupportedAbis() {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
return new String[]{Build.CPU_ABI, Build.CPU_ABI2};
} else {
return LollipopSysdeps.getSupportedAbis();
}
} | java | {
"resource": ""
} |
q159802 | SysUtil.fallocateIfSupported | train | public static void fallocateIfSupported(FileDescriptor fd, long length) throws IOException {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
LollipopSysdeps.fallocateIfSupported(fd, length);
}
} | java | {
"resource": ""
} |
q159803 | SysUtil.dumbDeleteRecursive | train | public static void dumbDeleteRecursive(File file) throws IOException {
if (file.isDirectory()) {
File[] fileList = file.listFiles();
if (fileList == null) {
// If file is not a directory, listFiles() will return null
return;
}
for (File entry : fileList) {
dumbDeleteR... | java | {
"resource": ""
} |
q159804 | SysUtil.mkdirOrThrow | train | static void mkdirOrThrow(File dir) throws IOException {
if (!dir.mkdirs() && !dir.isDirectory()) {
throw new IOException("cannot mkdir: " + dir);
}
} | java | {
"resource": ""
} |
q159805 | SysUtil.copyBytes | train | static int copyBytes(RandomAccessFile os, InputStream is, int byteLimit, byte[] buffer)
throws IOException {
// Yes, this method is exactly the same as the above, just with a different type for `os'.
int bytesCopied = 0;
int nrRead;
while (bytesCopied < byteLimit &&
(nrRead = is.read(
... | java | {
"resource": ""
} |
q159806 | UnpackingSoSource.deleteUnmentionedFiles | train | private void deleteUnmentionedFiles(Dso[] dsos) throws IOException {
String[] existingFiles = soDirectory.list();
if (existingFiles == null) {
throw new IOException("unable to list directory " + soDirectory);
}
for (int i = 0; i < existingFiles.length; ++i) {
String fileName = existingFiles... | java | {
"resource": ""
} |
q159807 | UnpackingSoSource.prepare | train | @Override
protected void prepare(int flags) throws IOException {
SysUtil.mkdirOrThrow(soDirectory);
File lockFileName = new File(soDirectory, LOCK_FILE_NAME);
FileLocker lock = FileLocker.lock(lockFileName);
try {
Log.v(TAG, "locked dso store " + soDirectory);
if (refreshLocked(lock, flags... | java | {
"resource": ""
} |
q159808 | UnpackingSoSource.prepare | train | protected synchronized void prepare(String soName) throws IOException {
// Only one thread at a time can try to recover a corrupted lib from the same source
Object lock = getLibraryLock(soName);
synchronized (lock) {
// While recovering, do not allow loading the same lib from another thread
mCor... | java | {
"resource": ""
} |
q159809 | SpanDecorator.onSend | train | static <K, V> void onSend(ProducerRecord<K, V> record, Span span) {
setCommonTags(span);
Tags.MESSAGE_BUS_DESTINATION.set(span, record.topic());
if (record.partition() != null) {
span.setTag("partition", record.partition());
}
} | java | {
"resource": ""
} |
q159810 | SpanDecorator.onResponse | train | static <K, V> void onResponse(ConsumerRecord<K, V> record, Span span) {
setCommonTags(span);
span.setTag("partition", record.partition());
span.setTag("topic", record.topic());
span.setTag("offset", record.offset());
} | java | {
"resource": ""
} |
q159811 | TracingKafkaUtils.extract | train | static SpanContext extract(Headers headers, Tracer tracer) {
return tracer
.extract(Format.Builtin.TEXT_MAP, new HeadersMapExtractAdapter(headers, false));
} | java | {
"resource": ""
} |
q159812 | TracingKafkaUtils.extractSpanContext | train | public static SpanContext extractSpanContext(Headers headers, Tracer tracer) {
return tracer
.extract(Format.Builtin.TEXT_MAP, new HeadersMapExtractAdapter(headers, true));
} | java | {
"resource": ""
} |
q159813 | TracingKafkaUtils.inject | train | static void inject(SpanContext spanContext, Headers headers,
Tracer tracer) {
tracer.inject(spanContext, Format.Builtin.TEXT_MAP,
new HeadersMapInjectAdapter(headers, false));
} | java | {
"resource": ""
} |
q159814 | TracingKafkaUtils.injectSecond | train | static void injectSecond(SpanContext spanContext, Headers headers,
Tracer tracer) {
tracer.inject(spanContext, Format.Builtin.TEXT_MAP,
new HeadersMapInjectAdapter(headers, true));
} | java | {
"resource": ""
} |
q159815 | Parser.BlockQuote | train | public Rule BlockQuote() {
StringBuilderVar inner = new StringBuilderVar();
StringBuilderVar optional = new StringBuilderVar();
return NodeSequence(
OneOrMore(
CrossedOut(Sequence('>', Optional(' ')), inner), Line(inner),
ZeroOrMore... | java | {
"resource": ""
} |
q159816 | Parser.mayEnterEmphOrStrong | train | protected boolean mayEnterEmphOrStrong(String chars){
if( !isLegalEmphOrStrongStartPos() ){
return false;
}
Object parent = peek(2);
boolean isStrong = ( chars.length()==2 );
if( StrongEmphSuperNode.class.equals( parent.getClass() ) ){
if( (... | java | {
"resource": ""
} |
q159817 | Parser.isLegalEmphOrStrongClosePos | train | protected boolean isLegalEmphOrStrongClosePos(){
Object lastItem = peek();
if ( StrongEmphSuperNode.class.equals( lastItem.getClass() ) ){
List<Node> children = ((StrongEmphSuperNode) lastItem).getChildren();
if(children.size() < 1)
return true;
... | java | {
"resource": ""
} |
q159818 | Parser.ImageAlt | train | public Rule ImageAlt(){
return Sequence(
'[',
checkForParsingTimeout(),
push(new SuperNode()),
ZeroOrMore(TestNot(']'), NonAutoLinkInline(), addAsChild()),
']'
);
} | java | {
"resource": ""
} |
q159819 | Parser.TableCell | train | public Rule TableCell() {
return Sequence(
NodeSequence(
push(new TableCellNode()),
TestNot(Sp(), Optional(':'), Sp(), OneOrMore('-'), Sp(), Optional(':'), Sp(), FirstOf('|', Newline())),
Optional(Sp(), TestNot('|'), NotNewl... | java | {
"resource": ""
} |
q159820 | Parser.parseInternal | train | public RootNode parseInternal(StringBuilderVar block) {
char[] chars = block.getChars();
int[] ixMap = new int[chars.length + 1]; // map of cleaned indices to original indices
// strip out CROSSED_OUT characters and build index map
StringBuilder clean = new StringBuilder();
... | java | {
"resource": ""
} |
q159821 | PegDownProcessor.prepareSource | train | public char[] prepareSource(char[] source) {
char[] src = new char[source.length + 2];
System.arraycopy(source, 0, src, 0, source.length);
src[source.length] = '\n';
src[source.length + 1] = '\n';
return src;
} | java | {
"resource": ""
} |
q159822 | PegDownPlugins.builder | train | public static Builder builder(PegDownPlugins like) {
return builder().withInlinePluginRules(like.getInlinePluginRules()).withBlockPluginRules(like.getBlockPluginRules()).
withHtmlSerializer(like.serializerPlugins.toArray(new ToHtmlSerializerPlugin[0]));
} | java | {
"resource": ""
} |
q159823 | JarjarTask.getDestinationDir | train | public File getDestinationDir() {
File out = destinationDir;
if (out == null)
out = new File(getProject().getBuildDir(), "jarjar");
return out;
} | java | {
"resource": ""
} |
q159824 | JarjarTask.getDestinationName | train | public String getDestinationName() {
String out = destinationName;
if (out == null)
out = getName() + ".jar";
return out;
} | java | {
"resource": ""
} |
q159825 | RdmaCmProcessor.close | train | public synchronized void close() throws IOException, InterruptedException {
logger.info("shutting down cm processor");
if (closed.get()){
return;
}
closed.set(true);
thread.join();
logger.info("cm processor down");
cmChannel.destroyEventChannel();
logger.info("cm channel down");
} | java | {
"resource": ""
} |
q159826 | RdmaServerEndpoint.accept | train | public C accept() throws IOException {
try {
synchronized(this){
if (connState != CONN_STATE_READY_FOR_ACCEPT) {
throw new IOException("bind needs to be called before accept (1), current state =" + connState);
}
logger.info("starting accept");
if (requested.peek() == null){
wait();
}
... | java | {
"resource": ""
} |
q159827 | RdmaEndpoint.close | train | public synchronized void close() throws IOException, InterruptedException {
if (isClosed){
return;
}
logger.info("closing client endpoint");
if (connState == CONN_STATE_CONNECTED) {
idPriv.disconnect();
this.wait(1000);
}
if (connState >= CONN_STATE_RESOURCES_ALLOCATED) {
idPriv.destroyQP();
... | java | {
"resource": ""
} |
q159828 | RdmaEndpoint.postRecv | train | public SVCPostRecv postRecv(List<IbvRecvWR> recvList) throws IOException {
return qp.postRecv(recvList, null);
} | java | {
"resource": ""
} |
q159829 | RdmaEndpoint.postSend | train | public SVCPostSend postSend(List<IbvSendWR> sendList)
throws IOException {
return qp.postSend(sendList, null);
} | java | {
"resource": ""
} |
q159830 | UrlUtilities.getConnection | train | public static URLConnection getConnection(URL url, Map inCookies, boolean input, boolean output, boolean cache, boolean allowAllCerts) throws IOException
{
URLConnection c = url.openConnection();
c.setRequestProperty("Accept-Encoding", "gzip, deflate");
c.setAllowUserInteraction(false);
... | java | {
"resource": ""
} |
q159831 | ExceptionUtilities.safelyIgnoreException | train | public static void safelyIgnoreException(Throwable t)
{
if (t instanceof ThreadDeath)
{
throw (ThreadDeath) t;
}
if (t instanceof OutOfMemoryError)
{
throw (OutOfMemoryError) t;
}
} | java | {
"resource": ""
} |
q159832 | GraphComparator.compareSets | train | private static void compareSets(Delta delta, Collection deltas, LinkedList stack, ID idFetcher)
{
Set srcSet = (Set) delta.srcValue;
Set targetSet = (Set) delta.targetValue;
// Create ID to Object map for target Set
Map targetIdToValue = new HashMap();
for (Object targetValu... | java | {
"resource": ""
} |
q159833 | GraphComparator.compareMaps | train | private static void compareMaps(Delta delta, Collection deltas, LinkedList stack, ID idFetcher)
{
Map<Object, Object> srcMap = (Map<Object, Object>) delta.srcValue;
Map<Object, Object> targetMap = (Map<Object, Object>) delta.targetValue;
// Walk source Map keys and see if they exist in targ... | java | {
"resource": ""
} |
q159834 | GraphComparator.compareLists | train | private static void compareLists(Delta delta, Collection deltas, LinkedList stack, ID idFetcher)
{
List srcList = (List) delta.srcValue;
List targetList = (List) delta.targetValue;
int srcLen = srcList.size();
int targetLen = targetList.size();
if (srcLen != targetLen)
... | java | {
"resource": ""
} |
q159835 | EncryptionUtilities.createAesCipher | train | public static Cipher createAesCipher(Key key, int mode) throws Exception
{
// Use password key as seed for IV (must be 16 bytes)
MessageDigest d = getMD5Digest();
d.update(key.getEncoded());
byte[] iv = d.digest();
AlgorithmParameterSpec paramSpec = new IvParameterSpec(iv);
... | java | {
"resource": ""
} |
q159836 | EncryptionUtilities.encrypt | train | public static String encrypt(String key, String content)
{
try
{
return ByteUtilities.encode(createAesEncryptionCipher(key).doFinal(content.getBytes(StandardCharsets.UTF_8)));
}
catch (Exception e)
{
throw new IllegalStateException("Error occurred encr... | java | {
"resource": ""
} |
q159837 | EncryptionUtilities.decrypt | train | public static String decrypt(String key, String hexStr)
{
try
{
return new String(createAesDecryptionCipher(key).doFinal(ByteUtilities.decode(hexStr)));
}
catch (Exception e)
{
throw new IllegalStateException("Error occurred decrypting data", e);
... | java | {
"resource": ""
} |
q159838 | MapUtilities.get | train | public static <T> T get(Map map, String key, T def) {
Object val = map.get(key);
return val == null ? def : (T)val;
} | java | {
"resource": ""
} |
q159839 | StringUtilities.decode | train | public static byte[] decode(String s)
{
int len = s.length();
if (len % 2 != 0)
{
return null;
}
byte[] bytes = new byte[len / 2];
int pos = 0;
for (int i = 0; i < len; i += 2)
{
byte hi = (byte) Character.digit(s.charAt(i), 1... | java | {
"resource": ""
} |
q159840 | StringUtilities.damerauLevenshteinDistance | train | public static int damerauLevenshteinDistance(CharSequence source, CharSequence target)
{
if (source == null || "".equals(source))
{
return target == null || "".equals(target) ? 0 : target.length();
}
else if (target == null || "".equals(target))
{
retu... | java | {
"resource": ""
} |
q159841 | StringUtilities.hashCodeIgnoreCase | train | public static int hashCodeIgnoreCase(String s)
{
if (s == null)
{
return 0;
}
int hash = 0;
int len = s.length();
for (int i = 0; i < len; i++)
{
char c = Character.toLowerCase(s.charAt(i));
hash = 31 * hash + c;
}
... | java | {
"resource": ""
} |
q159842 | MathUtilities.maximum | train | public static BigDecimal maximum(BigDecimal... values)
{
int len = values.length;
if (len == 1)
{
if (values[0] == null)
{
throw new IllegalArgumentException("Cannot passed null BigDecimal entry to maximum()");
}
return values[0... | java | {
"resource": ""
} |
q159843 | DeepEquals.compareOrderedCollection | train | private static boolean compareOrderedCollection(Collection col1, Collection col2, Deque stack, Set visited)
{
// Same instance check already performed...
if (col1.size() != col2.size())
{
return false;
}
Iterator i1 = col1.iterator();
Iterator i2 = col2.... | java | {
"resource": ""
} |
q159844 | DeepEquals.compareSortedMap | train | private static boolean compareSortedMap(SortedMap map1, SortedMap map2, Deque stack, Set visited)
{
// Same instance check already performed...
if (map1.size() != map2.size())
{
return false;
}
Iterator i1 = map1.entrySet().iterator();
Iterator i2 = map2... | java | {
"resource": ""
} |
q159845 | DeepEquals.compareFloatingPointNumbers | train | private static boolean compareFloatingPointNumbers(Object a, Object b, double epsilon)
{
double a1 = a instanceof Double ? (Double) a : (Float) a;
double b1 = b instanceof Double ? (Double) b : (Float) b;
return nearlyEqual(a1, b1, epsilon);
} | java | {
"resource": ""
} |
q159846 | SystemUtilities.getExternalVariable | train | public static String getExternalVariable(String var)
{
String value = System.getProperty(var);
if (StringUtilities.isEmpty(value))
{
value = System.getenv(var);
}
return StringUtilities.isEmpty(value) ? null : value;
} | java | {
"resource": ""
} |
q159847 | Traverser.walk | train | public void walk(Object root, Class[] skip, Visitor visitor)
{
Deque stack = new LinkedList();
stack.add(root);
while (!stack.isEmpty())
{
Object current = stack.removeFirst();
if (current == null || _objVisited.containsKey(current))
{
... | java | {
"resource": ""
} |
q159848 | MetricsConfigurerAdapter.destroy | train | @Override
public void destroy() throws Exception {
if (this.reporters != null) {
for (Closeable reporter : this.reporters) {
try {
reporter.close();
}
catch (Exception ex) {
LOG.warn("Problem stopping reporter", ex);
}
}
}
} | java | {
"resource": ""
} |
q159849 | MetricsConfigurerAdapter.registerReporter | train | protected <R extends Closeable> R registerReporter(final R reporter) {
if (this.reporters == null) {
this.reporters = new HashSet<Closeable>();
}
this.reporters.add(reporter);
return reporter;
} | java | {
"resource": ""
} |
q159850 | PactDslRootValue.decimalType | train | public static PactDslRootValue decimalType() {
PactDslRootValue value = new PactDslRootValue();
value.generators.addGenerator(Category.BODY, "", new RandomDecimalGenerator(10));
value.setValue(100);
value.setMatcher(new NumberTypeMatcher(NumberTypeMatcher.NumberType.DECIMAL));
return value;
} | java | {
"resource": ""
} |
q159851 | BaseProviderRule.getPacts | train | protected Map<String, RequestResponsePact> getPacts(String fragment) {
if (pacts == null) {
pacts = new HashMap<>();
for (Method m: target.getClass().getMethods()) {
if (JUnitTestSupport.conformsToSignature(m) && methodMatchesFragment(m, fragment)) {
Pact pactAnno... | java | {
"resource": ""
} |
q159852 | PactDslRequestWithPath.matchHeader | train | public PactDslRequestWithPath matchHeader(String header, String regex) {
return matchHeader(header, regex, new Generex(regex).random());
} | java | {
"resource": ""
} |
q159853 | PactDslRequestWithPath.matchHeader | train | public PactDslRequestWithPath matchHeader(String header, String regex, String headerExample) {
requestMatchers.addCategory("header").setRule(header, new RegexMatcher(regex));
requestHeaders.put(header, Collections.singletonList(headerExample));
return this;
} | java | {
"resource": ""
} |
q159854 | PactDslRequestWithPath.matchQuery | train | public PactDslRequestWithPath matchQuery(String parameter, String regex) {
return matchQuery(parameter, regex, new Generex(regex).random());
} | java | {
"resource": ""
} |
q159855 | PactDslRequestWithPath.matchQuery | train | public PactDslRequestWithPath matchQuery(String parameter, String regex, List<String> example) {
requestMatchers.addCategory("query").addRule(parameter, new RegexMatcher(regex));
query.put(parameter, example);
return this;
} | java | {
"resource": ""
} |
q159856 | PactDslJsonRootValue.decimalType | train | public static PactDslJsonRootValue decimalType(BigDecimal number) {
PactDslJsonRootValue value = new PactDslJsonRootValue();
value.setValue(number);
value.setMatcher(new NumberTypeMatcher(NumberTypeMatcher.NumberType.DECIMAL));
return value;
} | java | {
"resource": ""
} |
q159857 | PactDslJsonRootValue.valueFromProviderState | train | public static PactDslJsonRootValue valueFromProviderState(String expression, Object example) {
PactDslJsonRootValue value = new PactDslJsonRootValue();
value.generators.addGenerator(Category.BODY, "", new ProviderStateGenerator(expression));
value.setValue(example);
return value;
} | java | {
"resource": ""
} |
q159858 | LambdaDslJsonArray.minArrayLike | train | public LambdaDslJsonArray minArrayLike(Integer size, Consumer<LambdaDslJsonBody> nestedObject) {
final PactDslJsonBody arrayLike = pactArray.minArrayLike(size);
final LambdaDslJsonBody dslBody = new LambdaDslJsonBody(arrayLike);
nestedObject.accept(dslBody);
arrayLike.closeArray();
... | java | {
"resource": ""
} |
q159859 | LambdaDslJsonArray.minMaxArrayLike | train | public LambdaDslJsonArray minMaxArrayLike(Integer minSize, Integer maxSize, Consumer<LambdaDslJsonBody> nestedObject) {
final PactDslJsonBody arrayLike = pactArray.minMaxArrayLike(minSize, maxSize);
final LambdaDslJsonBody dslBody = new LambdaDslJsonBody(arrayLike);
nestedObject.accept(dslBody);
arrayLi... | java | {
"resource": ""
} |
q159860 | LambdaDslObject.eachLike | train | public LambdaDslObject eachLike(String name, Consumer<LambdaDslObject> nestedObject) {
final PactDslJsonBody arrayLike = object.eachLike(name);
final LambdaDslObject dslObject = new LambdaDslObject(arrayLike);
nestedObject.accept(dslObject);
arrayLike.closeArray();
return this;
... | java | {
"resource": ""
} |
q159861 | LambdaDslObject.eachLike | train | public LambdaDslObject eachLike(String name, PactDslJsonRootValue value, int numberExamples) {
object.eachLike(name, value, numberExamples);
return this;
} | java | {
"resource": ""
} |
q159862 | LambdaDslObject.minArrayLike | train | public LambdaDslObject minArrayLike(String name, Integer size, Consumer<LambdaDslObject> nestedObject) {
final PactDslJsonBody minArrayLike = object.minArrayLike(name, size);
final LambdaDslObject dslObject = new LambdaDslObject(minArrayLike);
nestedObject.accept(dslObject);
minArrayLike... | java | {
"resource": ""
} |
q159863 | LambdaDslObject.minArrayLike | train | public LambdaDslObject minArrayLike(String name, Integer size, PactDslJsonRootValue value, int numberExamples) {
object.minArrayLike(name, size, value, numberExamples);
return this;
} | java | {
"resource": ""
} |
q159864 | LambdaDslObject.maxArrayLike | train | public LambdaDslObject maxArrayLike(String name, Integer size, Consumer<LambdaDslObject> nestedObject) {
final PactDslJsonBody maxArrayLike = object.maxArrayLike(name, size);
final LambdaDslObject dslObject = new LambdaDslObject(maxArrayLike);
nestedObject.accept(dslObject);
maxArrayLike... | java | {
"resource": ""
} |
q159865 | LambdaDslObject.minMaxArrayLike | train | public LambdaDslObject minMaxArrayLike(String name, Integer minSize, Integer maxSize, int numberExamples,
Consumer<LambdaDslObject> nestedObject) {
final PactDslJsonBody maxArrayLike = object.minMaxArrayLike(name, minSize, maxSize, numberExamples);
final LambdaDslObject dsl... | java | {
"resource": ""
} |
q159866 | LambdaDslObject.minMaxArrayLike | train | public LambdaDslObject minMaxArrayLike(String name, Integer minSize, Integer maxSize, PactDslJsonRootValue value,
int numberExamples) {
object.minMaxArrayLike(name, minSize, maxSize, value, numberExamples);
return this;
} | java | {
"resource": ""
} |
q159867 | PactDslWithState.given | train | public PactDslWithState given(String stateDesc, Map<String, Object> params) {
state.add(new ProviderState(stateDesc, params));
return this;
} | java | {
"resource": ""
} |
q159868 | PactDslWithProvider.uponReceiving | train | public PactDslRequestWithoutPath uponReceiving(String description) {
return new PactDslWithState(consumerPactBuilder, consumerPactBuilder.getConsumerName(), providerName,
defaultRequestValues, defaultResponseValues)
.uponReceiving(description);
} | java | {
"resource": ""
} |
q159869 | PactDslJsonArray.closeArray | train | public DslPart closeArray() {
if (parent != null) {
parent.putArray(this);
} else {
getMatchers().applyMatcherRootPrefix("$");
getGenerators().applyRootPrefix("$");
}
closed = true;
return parent;
} | java | {
"resource": ""
} |
q159870 | PactDslJsonArray.maxArrayLike | train | @Override
public PactDslJsonBody maxArrayLike(Integer size, int numberExamples) {
if (numberExamples > size) {
throw new IllegalArgumentException(String.format("Number of example %d is more than the maximum size of %d",
numberExamples, size));
}
matchers.addRule(rootPath + append... | java | {
"resource": ""
} |
q159871 | PactDslJsonArray.stringValue | train | public PactDslJsonArray stringValue(String value) {
if (value == null) {
body.put(JSONObject.NULL);
} else {
body.put(value);
}
return this;
} | java | {
"resource": ""
} |
q159872 | PactDslJsonArray.integerType | train | public PactDslJsonArray integerType(Long number) {
body.put(number);
matchers.addRule(rootPath + appendArrayIndex(0), new NumberTypeMatcher(NumberTypeMatcher.NumberType.INTEGER));
return this;
} | java | {
"resource": ""
} |
q159873 | PactDslJsonArray.decimalType | train | public PactDslJsonArray decimalType() {
generators.addGenerator(Category.BODY, rootPath + appendArrayIndex(1), new RandomDecimalGenerator(10));
return decimalType(new BigDecimal("100"));
} | java | {
"resource": ""
} |
q159874 | PactDslJsonArray.decimalType | train | public PactDslJsonArray decimalType(BigDecimal number) {
body.put(number);
matchers.addRule(rootPath + appendArrayIndex(0), new NumberTypeMatcher(NumberTypeMatcher.NumberType.DECIMAL));
return this;
} | java | {
"resource": ""
} |
q159875 | PactDslJsonArray.timestamp | train | public PactDslJsonArray timestamp() {
String pattern = DateFormatUtils.ISO_DATETIME_FORMAT.getPattern();
body.put(DateFormatUtils.ISO_DATETIME_FORMAT.format(new Date(DATE_2000)));
generators.addGenerator(Category.BODY, rootPath + appendArrayIndex(0), new DateTimeGenerator(pattern));
matchers.add... | java | {
"resource": ""
} |
q159876 | PactDslJsonArray.date | train | public PactDslJsonArray date() {
String pattern = DateFormatUtils.ISO_DATE_FORMAT.getPattern();
body.put(DateFormatUtils.ISO_DATE_FORMAT.format(new Date(DATE_2000)));
generators.addGenerator(Category.BODY, rootPath + appendArrayIndex(0), new DateGenerator(pattern));
matchers.addRule(rootPath + a... | java | {
"resource": ""
} |
q159877 | PactDslJsonArray.time | train | public PactDslJsonArray time() {
String pattern = DateFormatUtils.ISO_TIME_FORMAT.getPattern();
body.put(DateFormatUtils.ISO_TIME_FORMAT.format(new Date(DATE_2000)));
generators.addGenerator(Category.BODY, rootPath + appendArrayIndex(0), new TimeGenerator(pattern));
matchers.addRule(rootPath + a... | java | {
"resource": ""
} |
q159878 | PactDslJsonArray.template | train | public PactDslJsonArray template(DslPart template, int occurrences) {
for(int i = 0; i < occurrences; i++) {
template(template);
}
return this;
} | java | {
"resource": ""
} |
q159879 | PactDslJsonArray.arrayEachLike | train | public static PactDslJsonBody arrayEachLike(Integer numberExamples) {
PactDslJsonArray parent = new PactDslJsonArray("", "", null, true);
parent.setNumberExamples(numberExamples);
parent.matchers.addRule("", parent.matchMin(0));
return new PactDslJsonBody(".", "", parent);
} | java | {
"resource": ""
} |
q159880 | PactDslJsonArray.arrayEachLike | train | public static PactDslJsonArray arrayEachLike(Integer numberExamples, PactDslJsonRootValue value) {
PactDslJsonArray parent = new PactDslJsonArray("", "", null, true);
parent.setNumberExamples(numberExamples);
parent.matchers.addRule("", parent.matchMin(0));
parent.putObject(value);
return parent;
... | java | {
"resource": ""
} |
q159881 | PactDslJsonArray.arrayMinLike | train | public static PactDslJsonBody arrayMinLike(int minSize, int numberExamples) {
if (numberExamples < minSize) {
throw new IllegalArgumentException(String.format("Number of example %d is less than the minimum size of %d",
numberExamples, minSize));
}
PactDslJsonArray parent = new PactDslJsonArray... | java | {
"resource": ""
} |
q159882 | PactDslJsonArray.arrayMinLike | train | public static PactDslJsonArray arrayMinLike(int minSize, int numberExamples, PactDslJsonRootValue value) {
if (numberExamples < minSize) {
throw new IllegalArgumentException(String.format("Number of example %d is less than the minimum size of %d",
numberExamples, minSize));
}
PactDslJsonArray ... | java | {
"resource": ""
} |
q159883 | PactDslJsonArray.arrayMaxLike | train | public static PactDslJsonBody arrayMaxLike(int maxSize, int numberExamples) {
if (numberExamples > maxSize) {
throw new IllegalArgumentException(String.format("Number of example %d is more than the maximum size of %d",
numberExamples, maxSize));
}
PactDslJsonArray parent = new PactDslJsonArray... | java | {
"resource": ""
} |
q159884 | PactDslJsonArray.arrayMaxLike | train | public static PactDslJsonArray arrayMaxLike(int maxSize, int numberExamples, PactDslJsonRootValue value) {
if (numberExamples > maxSize) {
throw new IllegalArgumentException(String.format("Number of example %d is more than the maximum size of %d",
numberExamples, maxSize));
}
PactDslJsonArray ... | java | {
"resource": ""
} |
q159885 | PactDslJsonArray.arrayMinMaxLike | train | public static PactDslJsonBody arrayMinMaxLike(int minSize, int maxSize, int numberExamples) {
if (numberExamples < minSize) {
throw new IllegalArgumentException(String.format("Number of example %d is less than the minimum size of %d",
numberExamples, minSize));
} else if (numberExamples > maxSize)... | java | {
"resource": ""
} |
q159886 | PactDslJsonArray.eachLike | train | public PactDslJsonArray eachLike(PactDslJsonRootValue value, int numberExamples) {
if (numberExamples == 0) {
throw new IllegalArgumentException("Testing Zero examples is unsafe. Please make sure to provide at least one " +
"example in the Pact provider implementation. See https://github.com/DiUS/pact... | java | {
"resource": ""
} |
q159887 | PactDslJsonArray.minArrayLike | train | public PactDslJsonArray minArrayLike(Integer size, PactDslJsonRootValue value) {
return minArrayLike(size, value, size);
} | java | {
"resource": ""
} |
q159888 | PactDslJsonArray.maxArrayLike | train | public PactDslJsonArray maxArrayLike(Integer size, PactDslJsonRootValue value, int numberExamples) {
if (numberExamples > size) {
throw new IllegalArgumentException(String.format("Number of example %d is more than the maximum size of %d",
numberExamples, size));
}
matchers.addRule(rootPath + a... | java | {
"resource": ""
} |
q159889 | PactDslJsonArray.includesStr | train | public PactDslJsonArray includesStr(String value) {
body.put(value);
matchers.addRule(rootPath + appendArrayIndex(0), includesMatcher(value));
return this;
} | java | {
"resource": ""
} |
q159890 | PactDslJsonArray.equalsTo | train | public PactDslJsonArray equalsTo(Object value) {
body.put(value);
matchers.addRule(rootPath + appendArrayIndex(0), EqualsMatcher.INSTANCE);
return this;
} | java | {
"resource": ""
} |
q159891 | PactDslJsonArray.valueFromProviderState | train | public PactDslJsonArray valueFromProviderState(String expression, Object example) {
generators.addGenerator(Category.BODY, rootPath + appendArrayIndex(0), new ProviderStateGenerator(expression));
body.put(example);
return this;
} | java | {
"resource": ""
} |
q159892 | PactDslRequestWithoutPath.withFileUpload | train | public PactDslRequestWithoutPath withFileUpload(String partName, String fileName, String fileContentType, byte[] data)
throws IOException {
setupFileUpload(partName, fileName, fileContentType, data);
return this;
} | java | {
"resource": ""
} |
q159893 | PactDslRequestWithoutPath.headerFromProviderState | train | public PactDslRequestWithoutPath headerFromProviderState(String name, String expression, String example) {
requestGenerators.addGenerator(Category.HEADER, name, new ProviderStateGenerator(expression));
requestHeaders.put(name, Collections.singletonList(example));
return this;
} | java | {
"resource": ""
} |
q159894 | PactDslRequestWithoutPath.queryParameterFromProviderState | train | public PactDslRequestWithoutPath queryParameterFromProviderState(String name, String expression, String example) {
requestGenerators.addGenerator(Category.QUERY, name, new ProviderStateGenerator(expression));
query.put(name, Collections.singletonList(example));
return this;
} | java | {
"resource": ""
} |
q159895 | ConfigUtil.get | train | public static <T> Optional<T> get(Config config, Function<String, T> getter, String path) {
if (!config.hasPath(path)) {
return Optional.empty();
}
return Optional.of(getter.apply(path));
} | java | {
"resource": ""
} |
q159896 | Authenticator.authenticate | train | GoogleIdToken authenticate(String token) {
final GoogleIdToken googleIdToken;
try {
googleIdToken = verifyIdToken(token);
} catch (IOException e) {
logger.warn("Failed to verify token");
return null;
}
if (googleIdToken == null) {
logger.debug("Invalid id token: verifyIdToke... | java | {
"resource": ""
} |
q159897 | ShardedCounter.getCounterSnapshot | train | public CounterSnapshot getCounterSnapshot(String counterId) throws IOException {
final CounterSnapshot snapshot = inMemSnapshot.getIfPresent(counterId);
if (snapshot != null) {
stats.recordCounterCacheHit();
return snapshot;
}
stats.recordCounterCacheMiss();
return refreshCounterSnapshot... | java | {
"resource": ""
} |
q159898 | ShardedCounter.refreshCounterSnapshot | train | private CounterSnapshot refreshCounterSnapshot(String counterId) throws IOException {
final CounterSnapshot newSnapshot = counterSnapshotFactory.create(counterId);
inMemSnapshot.put(counterId, newSnapshot);
return newSnapshot;
} | java | {
"resource": ""
} |
q159899 | ShardedCounter.updateCounter | train | public void updateCounter(StorageTransaction transaction, String counterId, long delta) throws IOException {
CounterSnapshot snapshot = getCounterSnapshot(counterId);
// If delta is negative, try to update shards with excess usage first
if (delta < 0) {
Optional<Integer> shardIndex = snapshot.pickSha... | java | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.