id
stringlengths
7
14
text
stringlengths
1
37.2k
34569996_29
public void compactRange(byte[] startKey, byte[] limitKey) { checkDatabaseOpen(); if (Native.POINTER_SIZE == 8) { long startKeyLength = startKey != null ? startKey.length : 0; long limitKeyLength = limitKey != null ? limitKey.length : 0; LevelDBNative.leveldb_compact_range(levelDB, star...
34579789_4
public List<MethodSpec> generateCodeWithRetryStaleIfRequired() { MethodSpec methodSpec = generateCode(false); if (!canAppendStaleHeader()) { return singletonList(methodSpec); } return asList(methodSpec, generateCode(true)); }
34582928_61
public static String getAbsoluteUrl(String url) { String absoluteUrl = url; if (!TextUtils.isEmpty(absoluteUrl) && !absoluteUrl.startsWith("http")) { absoluteUrl = StringUtils.appendOptional(BuildConfig.WS_ENDPOINT, absoluteUrl); } return absoluteUrl; }
34623357_10
public boolean isEmpty() { return surface == null && surfaceGroup == null && !allRounder && !none; }
34633211_2
public static Object invoke(final JJJVMClass caller, final JJJVMObject instance, final JJJVMMethod methodToInvoke, final Object[] args, final Object[] stack, final Object[] vars) throws Throwable { final int methodFlags = methodToInvoke.getFlags(); if ((methodFlags & ACC_NATIVE) != 0) { throw new IllegalArgumen...
34661048_3
public boolean getFeature(String name) throws SAXNotRecognizedException, SAXNotSupportedException { throw new SAXNotSupportedException("Not yet implemented"); }
34667720_0
public static Map<String, Mapper> loadRegistry(Model model) { List<Resource> rs = model.listResourcesWithProperty(RDF.type, LSQ.WebAccessLogFormat).toList(); Map<String, Mapper> result = rs.stream() .filter(r -> r.hasProperty(LSQ.pattern)) .collect(Collectors.toMap( r -> r.getLo...
34685629_7
public VerigreenNeeded isVerigreenNeeded( final String parentBranchName, final String branchNameToVerify, final String commitId, final String committer) { String reason = ""; boolean ans; boolean shouldRejectCommit = true; ans= (VerigreenMap.get("_protectedBranches")).matches("(^|(.*,))"+parentBranchName+...
34685800_68
public String format(String raw) throws Exception { //The 'kind' can be set to CodeFormatter.K_UNKNOWN, since it is anyway ignored by the internal formatter TextEdit edit = codeFormatter.format(CodeFormatter.K_UNKNOWN, raw, 0, raw.length(), 0, SpotlessEclipseFramework.LINE_DELIMITER); if (edit == null) { throw new...
34687793_26
@Override public void check(Schema nextSchema) throws AbstractValidationException { // 1. make sure the input is valid new SchemaValidation().check(nextSchema); // 2. find the corresponding tables to validate the change if necessary List<Table> tablesInCurrentSchema = currentSchema.getTableList(); List<Table> t...
34756186_0
@Override protected String doForward(final LogRecord record) { final JSONLoggingRecord jlr = new JSONLoggingRecord(); jlr.event = "exposure"; jlr.timestamp = ISO.format(new Date()); jlr.namespace = record.namespace.getName(); jlr.salt = record.namespace.nsConf.salt; final Experiment exp = MoreOb...
34793185_127
public void setExistingValue(Object value, TerminationConfigOption terminationConfigOption) { TerminationManager operation = terminationManagerMap.get(terminationConfigOption); if (operation != null) { operation.setExistingValue(value); } }
34809191_909
@PostMapping(path = "/{endpoint}/{method}", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) public ResponseEntity<String> serveEndpoint( @PathVariable("endpoint") String endpointName, @PathVariable("method") String methodName, @RequestBody(required = false) ObjectNode body, Htt...
34813674_8
public static int type(int Side1, int Side2, int Side3) { int tri_out; // tri_out is output from the routine: // Triang = 1 if triangle is scalene // Triang = 2 if triangle is isosceles // Triang = 3 if triangle is equilateral // Triang = 4 if not a triangle // After a quick conf...
34819120_17
protected static void serializerWrite( MethodNodeGenerator methodNodeGenerator, Type type) { String owner = _SERIALIZER_TYPE.getInternalName(); if (type.getSort() <= Type.DOUBLE) { String name = TextFormatter.format( type.getClassName(), TextFormatter.G); methodNodeGenerator.invokeVirtual( owner, "write...
34824538_140
public ServiceCall<ImageDetailsList> addImages(AddImagesOptions addImagesOptions) { com.ibm.cloud.sdk.core.util.Validator.notNull( addImagesOptions, "addImagesOptions cannot be null"); com.ibm.cloud.sdk.core.util.Validator.isTrue( (addImagesOptions.imagesFile() != null) || (addImagesOptions.im...
34839383_1797
public InternalCache create() throws TimeoutException, CacheWriterException, GatewayException, RegionExistsException { synchronized (InternalCacheBuilder.class) { InternalDistributedSystem internalDistributedSystem = findInternalDistributedSystem() .orElseGet(this::createInternalDistributedSystem); ...
34881325_6
public static void stopService(Object aService) { for (Class<?> myInterface : aService.getClass().getInterfaces()) { Service serviceAnnotation = myInterface.getAnnotation(Service.class); if (serviceAnnotation != null) { try { Method stopMethod = Se...
34911426_0
@ResponseBody @RequestMapping(value = "/getNameByParam", method = RequestMethod.GET) public String getNameByParam(@RequestParam("name") String name) { return "SpringMVCDemo.getNameByParam:" + name; }
34915443_3
List<JPackage> getHierarchyPackages(List<JavaPackage> packages) { Map<String, JPackage> pkgMap = new HashMap<String, JPackage>(); for (JavaPackage pkg : packages) { addPackage(pkgMap, new JPackage(pkg)); } // merge packages without classes boolean repeat; do { repeat = false; for (JPackage pkg : pkgMap.valu...
34915498_11
@Override public <T> Map<String, Collection<T>> collapse(Map<String, Collection<T>> input) { Map<PathName, Collection<T>> inputMap = new HashMap<PathName, Collection<T>>(input.size()); for (Map.Entry<String, Collection<T>> hostname : input.entrySet()) { // Discard 'none' entirely if other key exist...
34928899_12
@Override public void note(LogLocation location, String message) { if (location == null) { throw new NullPointerException("location"); } if (message == null) { throw new NullPointerException("message"); } if (options.verbose() && location.toMessager()) { messager.printMessage(Kind.NOTE, message); } if ...
34951729_3
public long calculateNewDuration(ViscosityInterpolator viscosity, long timesAnimationViewed, long currentDuration) { if (currentDuration == 0) { Log.e("duration was zero"); return 0; } if (timesAnimationViewed == 0) { Log.v("first time viewing so no duration change"); return ...
34964793_1
@SuppressWarnings("ConstantConditions") public static <T> T create(@NonNull Class<T> itemClass, @Nullable Object... constructorParams) { if (itemClass == null) { throw new IllegalArgumentException("Unknown model class " + itemClass); } try { if (constructorParams == null || constructorParams...
34966186_14
public static Builder builder() { return new Builder(); }
34971364_6
public ImmutableList<Logger> getLoggers() { if (loggers == null) { final Map<String, String> loggerEntries = filterKeys(log4jProperties, startsWith("log4j.logger.")); loggers = FluentIterable.from(loggerEntries.entrySet()) .transform(loggerFunction(log4jProperties, g...
34997568_22
public static <T, U> Matcher<T> hasFeatureValue(Function<T, U> featureFunction, U featureValue) { return hasFeature(featureFunction, equalTo(featureValue)); }
35024150_72
@Override public GitHubBranchCause check(@Nonnull GitHubBranchDecisionContext context) throws IOException { GHBranch remoteBranch = context.getRemoteBranch(); GitHubBranch localBranch = context.getLocalBranch(); TaskListener listener = context.getListener(); GitHubBranchCause cause = null; if (nonN...
35031753_0
protected String extractFileContent(final String filename) throws IOException { final StringBuilder sb = new StringBuilder(); String temp = ""; final BufferedReader bufferedReader = new BufferedReader( new FileReader(filename)); try { while (temp != null) { temp = bufferedReader.readLine(); if (temp !=...
35107906_2
public void redmineReportEntries(@Observes After event) { final Method testMethod = event.getTestMethod(); final TestClass testClass = event.getTestClass(); final String redmineServerURL = redmineGovernorConfigurationInstance.get().getServer(); final Redmine redmineValue = getRedmineValue(testMethod, ...
35126129_18
public static boolean checkIfLimitReached(long currentValue, long minValue, long maxValue, long incrementBy, long cacheSize) throws SQLException { long nextValue = 0; boolean increasingSeq = incrementBy > 0 ? true : false; // advance currentValue while checking for overflow try { lon...
35132359_23
@Transactional(propagation = Propagation.REQUIRED) @Override public List<IResource> transaction(List<IResource> theResources) { ourLog.info("Beginning transaction with {} resources", theResources.size()); long start = System.currentTimeMillis(); Set<IdDt> allIds = new HashSet<IdDt>(); for (int i = 0; i < theResou...
35148114_22
public LexicalResource getLexicalResource() { return lexicalResource; }
35152638_32
public TypeSpec interfaceSpec(ResourceObject resource, OntGenerationConfig config) throws RepositoryException { return TypeSpec.interfaceBuilder(className(resource, config)).build(); }
35174991_12
public static boolean isLocaleFile(String url) { return url != null && url.startsWith(LOCALE_FILE_SCHEME); }
35185022_110
public static void main(String[] argv) throws Exception { // TODO: JCommander has an issue with boolean arity. Rewrite allow_vcd_target. List<String> newArgv = new LinkedList<String>(Arrays.asList(argv)); ListIterator<String> i = newArgv.listIterator(); while (i.hasNext()) { String arg = i.nex...
35185761_9
void load(int position, boolean useCircularTransformation) { if (isDownloading(position)) { return; } NoxItem noxItem = noxItems.get(position); if ((noxItem.hasUrl() && !isBitmapReady(position)) || noxItem.hasResourceId() && !isDrawableReady(position)) { loading[position] = true; loadNoxItem(p...
35204049_41
@VisibleForTesting void enhanceBuilderWithSecurityParameters(HAConfiguration.ZookeeperProperties zookeeperProperties, CuratorFrameworkFactory.Builder builder) { ACLProvider aclProvider = getAclProvider(zookeeperProperties); AuthInfo authInfo = null; if (zookeeperP...
35204051_5
public void loadAllAnnouncement(int pageNumber) { checkViewAttached(); compositeDisposable.add(mDataManager.getAllAnnouncement( getAnnouncementQueryOptions(pageNumber)) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) .subscribeWith(new Dis...
35206972_254
public GeoShapeMapper(String field, String column, Boolean validated, Integer maxLevels, List<GeoTransformation> transformations) { super(field, column, false, validated, null, String.class, TEXT_TYPES); this.column = colum...
35211795_48
@Override public void schedule(final Action action) { if (actionTimerTasks.containsKey(action)) { Logger.v("Already contains action, aborting schedule"); return; } TimerTask taskToExecute = new TimerTask() { @Override public void run() { action.perform(); ...
35224085_8
@Override public String embed(Book book, String content) { book = Objects.requireNonNull(book); content = Objects.requireNonNull(content); Document document = htmlParser.parseInput(content, ""); Elements images = document.getElementsByTag("img"); for (Element img : images) { String imgSrcA...
35228936_18
public static String queryOR(final String... conditions) { return Arrays.stream(conditions) .filter(s -> null != s && !s.isEmpty()) .collect(Collectors.collectingAndThen( Collectors.toList(), l -> l.isEmpty() ? null ...
35240600_15
public static Map<String, Method> setters(Class<? extends AnnotatedFileAttributeView> type) { return find(type, Extractor.SETTER); }
35242391_26
@Override public String getLoginUrl() { return SpotifyHelper.AUTHORIZE_URL; }
35256352_0
public BigInteger getId() { return id; }
35263104_171
public boolean pledgeGoalAchieved() { return this.status == ProjectStatus.FULLY_PLEDGED; }
35282952_14
public void setFieldHint(int hint) { setFieldHint(getContext().getString(hint)); }
35297180_1412
public void clear() { view.clearNotifications(); createEntity.clear(); groupUsersAssignment.clear(); group = null; }
35303409_0
public ObservableList<String> getNotes() { return FXCollections.unmodifiableObservableList(notes); }
35358657_14
@Override public void deleteRecursively(File file) throws IOException { deleteRecursively(file.toPath()); }
35370551_26
public static <T> Iterable<T> createReverseIterable(List<T> list) { // When the list is empty we can use the "forward" iterable (i.e. the // list itself) also as the reverseIterable as it will do nothing. if (list.size() == 0) { return list; } return new ReverseIterable<T>(list); }
35380608_2
static Field get(String s) { Matcher matcher = PATTERN.matcher(s); if (!matcher.matches()) throw new IllegalArgumentException(); int tag = Integer.parseInt(matcher.group("tag")); String value = matcher.group("value"); return new Field(tag, value); }
35402802_2
}
35448780_79
public void formatSource(CharSource input, CharSink output) throws FormatterException, IOException { // TODO(cushon): proper support for streaming input/output. Input may // not be feasible (parsing) but output should be easier. output.write(formatSource(input.read())); }
35467512_14
public static String getDate() { DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd_HH-mm-ss"); Date date = new Date(); return dateFormat.format(date); }
35482585_91
Value toSesameValue(Assertion assertion, cz.cvut.kbss.ontodriver.model.Value<?> val) throws SesameDriverException { switch (assertion.getType()) { case DATA_PROPERTY: return SesameUtils.createDataPropertyLiteral(val.getValue(), language(assertion), vf); case CLASS: case OBJECT_PR...
35511757_73
public List<NGramModel> find(String aGram) { return find(aGram.split(" ")); }
35515269_8
protected String resolveUsername(Object principal) { if (principal instanceof String) return (String) principal; if (principal instanceof UserDetails) return ((UserDetails)principal).getUsername(); throw new AuthenticationCredentialsNotFoundException("Can't find username on: " + principal...
35532096_199
public String toJson() { return CatalogGsonHelper.toJson(this, FunctionDesc.class); }
35550196_35
public CasMergeOperationResult mergeSpanAnnotation(SourceDocument aDocument, String aUsername, AnnotationLayer aAnnotationLayer, CAS aTargetCas, AnnotationFS aSourceFs, boolean aAllowStacking) throws AnnotationException { if (existsSameAt(aTargetCas, aSourceFs)) { throw new AlreadyMerged...
35558163_2
public List<City> getCities(Double latitude, Double longitude, Integer count) { try { OpenWeatherWrapper openWeatherWrapper = openWeatherAPI.getWeatherItems(latitude, longitude, count); return openWeatherResponseMapper.mapResponse(openWeatherWrapper); } catch (Exception exception) { retu...
35592079_0
@Asynchronous @TransactionAttribute(TransactionAttributeType.NEVER) public void carregaIndicadores(DadosCargaIndicador carga) { String nomeGrupoIndicador = carga.getGrupoIndicador(); String nomeIndicador = carga.getIndicador(); String focoIndicador = carga.getFocoIndicador(); Area area = areaService.buscaPorNome(ca...
35592576_45
@Override public final Object unmarshal(final DeserializerRegistry registry, final SerializedDataType dataType, final EnhancedMimeType mimeType, final Object data) { if (data == null) { return null; } if (!(data instanceof JsonObject)) { throw new IllegalArgumentException("Can only ...
35604995_0
public <T> With<T> given(Observable<T> observable) { RxMock mock = Observable.from(mocks).filter(provides(observable)).toBlocking().first(); final With<T> with = new With<>(mock, observable); pendingResources.add(with); with.registerIdleTransitionCallback( new ResourceCallback() { ...
35617147_0
@Override public String run(Task aConfiguration) throws ExecutionException, LifeCycleException { if (!(aConfiguration instanceof UimaTask)) { throw new ExecutionException("This engine can only execute [" + UimaTask.class.getName() + "]"); } configuration = (UimaTask) aConfiguration; ctx = contextFactory.cr...
35632860_1
void readHeader(InputStream is) throws IOException { int headerRead = 0; while (headerRead < HEADER_SIZE) { final int bytesRead = is.read(header, headerRead, HEADER_SIZE - headerRead); if (bytesRead < 0) { throw new EOFException("Failed to read header."); } headerRead += bytesRead; }...
35640235_1
public Observable<SearchResult> searchUsers(final String query) { return Observable.concat(cachedResults(query), networkResults(query)).first(); }
35662043_58
public void start() { maxRateProvider.start(); }
35675774_45
public static String unique(String string) { return string.intern(); }
35680131_188
static PredicateLeaf.Type toType(Fields fields) { Type type = fields.getType(0); if (type.equals(Double.class)) { return PredicateLeaf.Type.FLOAT; } else if (type.equals(Long.class)) { return PredicateLeaf.Type.LONG; } else if (type.equals(Integer.class)) { return PredicateLeaf.Type.LONG; } ...
35686068_24
public boolean canConvert(final Class type) { return type.isAssignableFrom(this.type); }
35702140_29
public void setNextHandler(WebSocketHandler handler) { this.nextHandler = handler; handler.setListener(new WebSocketHandlerListener() { @Override public void connectionOpened(WebSocketChannel channel, String protocol) { /* We have to wait until the balancer responds for kaazing...
35720847_0
public static String printTimeDelay(final long timeInMilliseconds) { final Duration duration = new Duration(timeInMilliseconds); final Period period = duration.toPeriod().normalizedStandard(PeriodType.time()); return TIME_FORMATTER.print(period); }
35725078_25
static public long requireStrictlyPostive(long l) throws IllegalArgumentException { return requireStrictlyPostive(l, "long value must be strictly positive"); }
35728528_2
public final Atom evaluate(final String expression) { return evaluate(Expression.parse(expression)); }
35757620_109
public String printReceipt(Receipt receipt) { StringBuilder result = new StringBuilder(); for (ReceiptItem item : receipt.getItems()) { String receiptItem = presentReceiptItem(item); result.append(receiptItem); } for (Discount discount : receipt.getDiscounts()) { String discountP...
35772318_4
@Override public double findDiscount(Member member) { double discount = 0.0; MembershipLevel ml = membershipLevelManager.findByMemberId(member.getId()); if (ml != null) { switch (ml.getType()) { case SILVER: discount = 0.05; break; case GOLD: discount = 0.10; break; case PLATINUM: disc...
35775200_12
static String[] getWeekdayNames(Locale locale, int day, boolean useThreeLetterAbbreviation){ DateFormatSymbols dateFormatSymbols = new DateFormatSymbols(locale); String[] dayNames = dateFormatSymbols.getShortWeekdays(); if (dayNames == null) { throw new IllegalStateException("Unable to determine wee...
35814909_26
@NonNull @VisibleForTesting @UiThread ExecutorService getFileExecutorService(@NonNull final ImmutableValue<IThreadType> threadTypeImmutableValue) { Log.v(TAG, "getFileExecutorService()"); if (fileExecutorService == null) { Log.d(TAG, "Creating default file read executor service"); setFileExecut...
35816813_0
public Portfolio getPortfolio(String accountId) { /* * Retrieve all orders for accounts id and build portfolio. - for each * order create holding. - for each holding find current price. */ logger.debug("Getting portfolio for accountId: " + accountId); List<Order> orders = repository.findByAccountId(accountId);...
35827335_1
public List<KomoranResult> analyze(List<String> sentences, int thread) { List<KomoranResult> komoranResultList = new ArrayList<>(); try { List<Future<KomoranResult>> komoranResultFutureList = new ArrayList<>(); ThreadPoolExecutor executor = (ThreadPoolExecutor) Executors.newFixedThreadPool(thr...
35841129_7
@Deprecated // We are getting rid of this, right? public static String testServiceEndpointUrl(final String serviceEndpoint) { return normalizeEndpoint(serviceEndpoint); }
35868722_13
public static Rule buildRule(String text, Map<String, Set<String>> meta, double confidence, double support) { return buildRule(text, meta, confidence, support, 0); }
35880827_3
@Override public synchronized void put(String key, Entry entry) { pruneIfNeeded(entry.data.length); File file = getFileForKey(key); try { FileOutputStream fos = new FileOutputStream(file); CacheHeader e = new CacheHeader(key, entry); boolean success = e.writeHeader(fos); if (...
35882684_4
@Override public int getSpanSize(int position) { boolean isHeaderOrFooter = adapter.isHeaderPosition(position) || adapter.isFooterPosition(position); return isHeaderOrFooter ? layoutManager.getSpanCount() : 1; }
35888585_0
@Override public boolean authorize(GooglePluginSettings pluginSettings, User user) { String username = user.getUsername(); if (isNotBlank(pluginSettings.getAllowedDomains())) { String allowedDomains = pluginSettings.getAllowedDomains(); String[] domains = allowedDomains.split(","); for ...
35890978_8
public static Footprint measure(Object rootObject) { return measure(rootObject, Predicates.alwaysTrue()); }
35897457_27
@Override public void writeTo(Iterable<Node[]> t, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException { // inspired by Linked Data-Fu XMLStreamWriter xmlwriter; try...
35917780_17
@Override public void init() { Timer.Context context = initTimer.time(); try { delegate.init(); } finally { context.stop(); } }
35952836_21
public CompilerExecutor newExecutor() { return new CompilerExecutor(this); }
35973998_8
@UiThread public void notifyParentRangeChanged(int parentPositionStart, int itemCount) { int flatParentPositionStart = getFlatParentPosition(parentPositionStart); int flatParentPosition = flatParentPositionStart; int sizeChanged = 0; int changed; P parent; for (int j = 0; j < itemCount; j++) { ...
36014107_0
public static String getProjectBaseDir() { String uri; try { RepoAgent ra = Engine.getRepoAgent(); uri = ra.getAbsoluteURIFromProjectRelativeURI(""); } catch (NoClassDefFoundError e) { if (projectBaseDir == null) { System.err.println("The project base directory must be set."); } return projectBaseDir; ...
36020033_54
public void run (Parameters p, PrintStream output) throws Exception { String annotationTypeString = null; String[] annotationTypes = null; String index = null; //- Support print to file if (p.isString ("outputFile")) { boolean append = p.get ("appendFile", false); PrintStream out = new PrintStream (...
36039997_0
@Override public void removeAttribute(String name) { super.removeAttribute(name); if (!saveOnChange()) { this.dirty = true; if (log.isTraceEnabled()) { log.trace("Marking session as dirty. Attr [" + name + "] was removed"); } } else { log.debug("Saved session onch...
36044977_7
public boolean containsOrAdd(@NotNull X element) { HashCode code = HASH_FUNC.hashBytes(asBytes.apply(element)); Object prev = array.getAndSet(code.asInt() & sizeMask, element); total++; if ((prev == null || !element.equals(prev))) { hit++; return false; } return true; }
36057427_3
public <T extends BasicMessage> BasicMessageWithExtraData<T> deserialize(String nameAndJson) { String[] nameAndJsonArray = fromHawkularFormat(nameAndJson); String name = nameAndJsonArray[0]; String json = nameAndJsonArray[1]; // The name is the actual name of the POJO that is used to deserialize the JS...
36068726_0
@RequestMapping(value = "/hello/{name}", method = RequestMethod.GET) public HelloResponse sayHi(@PathVariable String name) throws ExecutionException, InterruptedException { Future<HelloResponse> future = commandDispatcher.dispatch(new HelloCommand(name)); return future.get(); }
36073969_3
public static void writeCoordinator(Schedule schedule, SchedulableJobManager manager, OutputStream output) throws IOException { XmlStreamWriter streamWriter = WriterFactory.newXmlWriter(output); PrettyPrintXMLWriter writer = new PrettyPrintXM...
36094718_1
static String[] getLocale(String name) { String suffix = ""; int dot = name.indexOf( "."); if (dot > -1) { //remove file extension suffix = name.substring( dot ); name = name.substring( 0, dot); } String locale = null; int count = 1; //iterate from back of the string, max 3 t...