id stringlengths 7 14 | text stringlengths 1 37.2k |
|---|---|
27811092_45 | @Override
public void cancel(String reserveNo) throws BusinessException {
Reserve reserve = findOneWithTourInfo(reserveNo);
String transfer = reserve.getTransfer();
if (Reserve.TRANSFERED.equals(transfer)) {
ResultMessages message = ResultMessages.error().add(
MessageId.E_TR_0001);
... |
27824737_1 | public static double min(double[][] matrix) {
return Stream.of(matrix)
.mapToDouble(MatrixUtils::min)
.min().getAsDouble();
} |
27840419_29 | public void delete(T model){
SingleRecordConfiguration configuration = setupDeleteConfiguration(new SingleRecordConfiguration(), model);
final DeleteCallback deleteCallback = DeleteCallback.createFromConfiguration(configuration, eventProcessor, httpReport, model);
configuration.performAsynchronousNetworkCal... |
27842515_20 | public static String getPackageName(String baseUrl)
throws URISyntaxException {
if (baseUrl == null) {
return null;
}
URI uri = new URI(baseUrl);
String domain = uri.getHost();
if (domain == null) {
return null;
}
String[] parts = domain.split("\\.");
StringBuffer buf = new StringBuffer()... |
27873784_5 | public DtoAndEntityWrapper merge(MediaType contentType, HttpInputMessage inputMessage, RepositoryInvoker invoker, Serializable id,
String dtoParam) {
DtoInformation dtoInfo = getDtoInformation(dtoParam);
Object dto = convertToDto(contentType, inputMessage, dtoInfo.getDtoType());
Object existingObj... |
27879839_9 | public Unit<Length> getLinearUnit(final boolean vertical) {
final double factor = getLinearUnitToMetre(vertical);
int i = Arrays.binarySearch(LINEAR_FACTORS, factor);
if (i < 0) {
i = ~i;
if (i == LINEAR_FACTORS.length || !(abs(factor - LINEAR_FACTORS[i]) <= EPS)) {
if (i == 0 ||... |
27883327_28 | public static List<URI> parseListeners(
List<String> listenersConfig,
int deprecatedPort,
List<String> supportedSchemes,
String defaultScheme
) {
return ApplicationServer.parseListeners(
listenersConfig, deprecatedPort, supportedSchemes, defaultScheme);
} |
27958753_0 | public List<Document> extractThenFormatThenStore(long jobId, Map<String, Instance<?>> cachedSelectors, Blob blob, DataExtractor extractor) {
List<Document> documents = extractThenFormat(cachedSelectors, blob, extractor);
// Store the result
if (documents != null) {
DocumentStores.get(jobId, extractor.getName()).... |
27984624_8 | @Override
public String get(String resource, Object args) {
Template template = getTemplate(resource);
return processTemplate(args, template);
} |
27984970_0 | public MissingContextException(String message) {
super(message);
} |
27988806_2 | public static Type[] getGenericsTypesByClass(Class clazz, Type type) {
Class targetClass = clazz;
while (targetClass != null) {
for (Type in : targetClass.getGenericInterfaces()) {
if (in instanceof ParameterizedType &&
type.equals(((ParameterizedType) in).getRawType())) ... |
27989980_3 | @WebMethod
public float mul(float a, float b) {
return a * b;
} |
28064538_0 | @Override
public Query generateInsertLoad()
{
Query result = new Query();
//create key part
long keyNum = _loadInsertKeyGen.nextInt();
result.setKey(createKeyString(keyNum));
//create value part
int valueSize = _valueGen.nextInt();
byte[] val = new byte[valueSize];
_ranGen.nextBytes(val);
result.set... |
28071993_7 | @CheckResult @NonNull
public Preference<Float> getFloat(@NonNull String key) {
return getFloat(key, DEFAULT_FLOAT);
} |
28074878_6 | public void collect(URL statistics) {
queue.offer(statistics);
if (logger.isInfoEnabled()) {
logger.info("collect statistics: " + statistics);
}
} |
28075895_4 | public static boolean hasElements(Collection<?> collection){
return collection != null && !collection.isEmpty();
} |
28086563_0 | ; |
28129477_0 | public Node getOrCreateNode(Manager manager, String key, GraphDatabaseService db)
{
// Federates requests to a graph node data management object
return manager.getOrCreateNode(key, db);
} |
28138406_32 | @Override
public Object invoke(MethodInvocation invocation) throws Throwable {
findAnnotation(invocation).ifPresent(rpAnnotation -> {
checkPermissions(invocation.getMethod(), rpAnnotation.value(), rpAnnotation.logical());
});
return invocation.proceed();
} |
28138459_13 | @Override
public <D, I> I resolveId(D dto, Class<I> aggregateIdClass) {
ParameterHolder<D> parameterHolder = getIdParameterHolder(dto, aggregateIdClass);
return createIdentifier(aggregateIdClass, parameterHolder.uniqueElement(dto),
parameterHolder.parameters(dto));
} |
28146647_4 | public static double getProb(int x, double p) {
return Math.pow(2, getLog2Prob(x, p));
} |
28174434_1 | @Override
public ProtocolMonitor<T> createMonitor(String name) {
return new MultiProtocolMonitor<T>(name, this);
} |
28176479_21 | public String getLabel() {
return (String) parameterMap.get(FIELD_LABEL);
} |
28190686_4 | @RequestMapping(value = "/rest/domains/{id}",
method = RequestMethod.DELETE,
produces = MediaType.APPLICATION_JSON_VALUE)
@Timed
public void delete(@PathVariable String id) {
log.debug("REST request to delete Domain : {}", id);
domainRepository.delete(id);
} |
28194950_2 | @Override
public Transport<T> create() throws AgentConfigurationException
{
if (StringUtils.isNotBlank(this.internalHandler.getToken()))
{
HECTransportConfig config = new HECTransportConfig.Builder(this.internalHandler).build();
LOGGER.debug("Creating the a HECTransport with the settings: " + co... |
28275464_0 | @Override
public Value evaluate(final State state) throws SetlException {
ArrayDeque<Value> values = new ArrayDeque<>(numberOfOperators);
ArrayDeque<Value> valuesForReplay = new ArrayDeque<>(numberOfOperators);
for (int i = 0; i < numberOfOperators; i++) {
AOperator operator = operators.get(i);
... |
28275474_19 | public final String formatCommon(final String pphoneNumber) {
return this.formatCommon(this.parsePhoneNumber(pphoneNumber));
} |
28305374_290 | public Map<String, String> customizeVM(HttpInputs httpInputs, VmInputs vmInputs, GuestInputs guestInputs, boolean isWin)
throws Exception {
ConnectionResources connectionResources = new ConnectionResources(httpInputs, vmInputs);
try {
ManagedObjectReference vmMor = new MorObjectHandler()
... |
28312494_8 | @SuppressWarnings("unchecked")
public <T> T create(Class<T> service) {
if (service == null) {
throw new NullPointerException("service param may not be null");
}
if (!service.isInterface()) {
throw new IllegalArgumentException("Only interface type is supported");
}
NetworkHandler handler = NetworkHandl... |
28325219_1 | @Transactional(propagation = Propagation.REQUIRED)
public void save(ClientToken ct) {
ctd.save(ct);
} |
28344352_1 | public RecordField createSchemaFormFromSchema(String schemaString) throws IOException {
ObjectMapper mapper = new ObjectMapper();
JsonNode node = mapper.readTree(schemaString);
Schema.Parser parser = new Schema.Parser();
Set<Fqn> fqns = null;
if (hasCtl) {
JsonNode dependenciesNode = node.ge... |
28358565_2 | @Override
public ProcessDefinition parse(InputStream in) throws ParserException {
if (in == null) {
throw new NullPointerException("Input cannot be null");
}
try {
SAXParserFactory spf = SAXParserFactory.newInstance();
SAXParser p = spf.newSAXParser();
Handler h = new Handl... |
28407415_15 | protected boolean checkNamespaceAware() {
try {
Class.forName("com.tridion.util.NamespacePrefixWrapper", false, this.getClass().getClassLoader());
LOG.info("This tridion version is namespace aware (Tridion version is 8.5+)");
return true;
} catch (ClassNotFoundException e) {
LOG.... |
28450866_6 | public int getSwipedThreshold() {
return swipedThreshold;
} |
28464672_8 | public String toJson(Map<?, ?> map) {
StringWriter stringWriter = new StringWriter();
try {
toJson(map, stringWriter);
} catch (IOException e) {
throw new AssertionError(e); // No I/O writing to a Buffer.
}
return stringWriter.toString();
} |
28546353_6 | LinkedHashSet<String> stringToSet(final String str) {
final LinkedHashSet<String> set;
if (str == null || str.trim().isEmpty()) {
set = null;
} else {
set = new LinkedHashSet<>();
String[] split = str.split(",");
for (String s : split) {
String trimmed = s.trim();... |
28546707_3 | public int orderStartAtA() {
if ("a".equals(name)) {
if("#".equals(sign)){
return 1;
}
else if("b".equals(sign)){
return 12;
}
else
return 0;
}
else if ("b".equals(name)) {
if("#".equals(sign)){
return 3;
... |
28556746_29 | public static <V> TypeSerializer<V> forCodec(final Codec<V> codec) {
return new CodecSerializer<>(requireNonNull(codec, "codec"));
} |
28560583_2 | public void merge(Bloom1Filter that) {
this.bitSet.putAll(that.bitSet);
} |
28565575_3 | public static File toFile(Uri uri) {
if (uri != null && isFile(uri)) {
return new File(uri.getPath());
}
return null;
} |
28589967_4 | public static Builder h2() {
return Builder.h2();
} |
28598239_31 | @Nonnull
public static String getRepository(URI uri) {
checkScheme(uri);
String path = uri.getPath();
if(path.length() > 1 && path.endsWith("/") && !path.endsWith(":/"))
path = path.substring(0, path.length() - 1);
return path;
} |
28665076_0 | public static Builder newBuilder() {
return new Builder();
} |
28691699_230 | @NotNull
@SuppressWarnings("unchecked")
public Stream<T> stream() {
if (!isPresent()) return Stream.empty();
return Stream.of(value);
} |
28714528_15 | @Override
public String formatMoney(String amount, String currencyCode)
{
if (amount == null || amount.isEmpty())
{
return "";
}
try
{
float value = Float.valueOf(amount);
if (value == 0)
{
return "-";
}
Currency currency = Currency.getInst... |
28738447_272 | @Override
public TupleFilter transform(TupleFilter tupleFilter) {
if (tupleFilter == null || !(tupleFilter instanceof IOptimizeableTupleFilter))
return tupleFilter;
else
return ((IOptimizeableTupleFilter) tupleFilter).acceptOptimizeTransformer(this);
} |
28745639_3 | private void doStep() {
Long currentTime = SimulatedTime.INST.getRequestingTime();
byte currentBinaryState = getBinaryState();
if (logger.isTraceEnabled())
logger.info("Do Step : previous["+previousBinaryState+"] current["+currentBinaryState+"] @ "+currentTime);
if (single_step_sequence.containsKey(previousBinary... |
28758096_8 | public static <T> T access(Configuration configuration, Environment environment, Class<T> clazz)
{
return getAccessor(configuration, environment).access(clazz);
} |
28762536_0 | @Override
public void register(URL url) throws Exception {
zookeeperClient.create(url);
registerServices.add(url);
} |
28772513_2 | public static <T> T getFirstOrNull(List<T> list) {
if (list == null || list.isEmpty()) {
return null;
}
return list.get(0);
} |
28776576_22 | public Integer getNumNodeManagers() {
return numNodeManagers;
} |
28776939_96 | @Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
DeviceInfo rhs = (DeviceInfo) o;
return new EqualsBuilder()
.append(standardVersion, rhs.standardVersion)
.append(... |
28790580_0 | @POST
@Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
public Response create(Book book) {
if (bookDao.create(book).isPresent()) {
return Response.status(NO_CONTENT).build();
}
return Response.status(BAD_REQUEST)
.entity(format(BOOK_EXISTS_MSG, book.getIsbn()))
.type(MediaType.T... |
28821307_2 | @Override
public void onButtonPressed(Button button, long timestamp) {
} |
28822832_6 | static boolean isRelevantConfiguration(final String entryName, final String parentName, ExtendedSlingSettingsService slingSettings) {
if (!entryName.endsWith(".yaml") && !entryName.equals("config") /* name 'config' without .yaml allowed for backwards compatibility */) {
return false;
}
// extract r... |
28836678_0 | protected boolean isConnected() {
return mGbDevice.isConnected();
} |
28858344_28 | public static String convertStringToHexString(String data) {
return conventBytesToHexString(data.getBytes());
} |
28874374_2 | public static String getDeviceID() {
Context context = Appaloosa.getApplicationContext();
if(deviceHasPhoneCapabilities(context)) {
return getImei();
} else {
return getAndroidId(context);
}
} |
28892813_1 | public static int parseElixir(BufferedImage image) throws BotBadBaseException {
return parseElixirFromBinary(imageToBinary(image));
} |
28900548_16 | @SuppressFBWarnings("OBL_UNSATISFIED_OBLIGATION_EXCEPTION_EDGE")
public static void copy(File src, File dest) throws IOException {
if (dest.delete()) {
LOGGER.debug("Removed " + dest.getPath() + " during copying");
}
InputStream input = null;
FileOutputStream output = null;
try {
in... |
28901545_0 | public static String transform(Date sourceDate, DateFormat format,
TimeZone sourceTimeZone, TimeZone targetTimeZone) {
Long targetTime = sourceDate.getTime() - sourceTimeZone.getRawOffset() + targetTimeZone.getRawOffset();
return DateUtils.getTime(new Date(targetTime), format);
} |
28923365_4 | @Override
public String decrypt(final String encryptedText) {
if (encryptedText == null || encryptedText.isEmpty()) {
return EMPTY_STRING;
} else {
final EncryptedToken token = EncryptedToken.parse(encryptedText);
final DecryptRequest decryptRequest = new DecryptRequest()
... |
28962447_9 | @Override
public Person toObject(Map<String, Object> properties) {
final Person object = new Person();
object.name = (String) properties.get("name");
if (object.name == null && !properties.containsKey("name")) {
throw new IllegalStateException("The property \"name\" is not set.");
}
try {
object.age =... |
28963937_2 | @SuppressWarnings("unchecked")
public <V> FramedGraphTraversal<V> V(Class<V> clazz) {
return new FramedGraphTraversal(traversal.V(), this).labels(clazz, P.within(registry.labels(clazz)));
} |
28969897_4 | public String toString() {
String serializedMessage = null;
try {
Gson gson = GsonParserBuilder.getInstance();
serializedMessage = gson.toJson(this);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return serializedMessage;
} |
28970369_10 | public MessageResponse sendMessage(final Message message) throws UnauthorizedException, GeneralException {
return messageBirdService.sendPayLoad(MESSAGESPATH, message, MessageResponse.class);
} |
28972188_9 | @Override
protected void doApply(final ApiRequest request, final IPolicyContext context,
final KeycloakOauthConfigBean config, final IPolicyChain<ApiRequest> chain) {
final String rawToken = getRawAuthToken(request);
final Holder<Boolean> successStatus = new Holder<>(true);
if (rawToken == null) {... |
28979951_107 | public synchronized <T extends DataObject> boolean putSynchronous(
final InstanceIdentifier<T> path, final T data, final LogicalDatastoreType logicalDatastoreType) {
LOG.debug("Put synchronous {}", path);
try {
put(path, data, logicalDatastoreType).get();
} catch (final InterruptedException ... |
28991592_45 | public int size() {
return this.entries.size();
} |
28992330_18 | @Override
public String escape(String s) {
int slen = s.length();
for (int index = 0; index < slen; index++) {
char c = s.charAt(index);
if (c >= safeOctets.length || !safeOctets[c]) {
return escapeSlow(s, index);
}
}
return s;
} |
29008657_5 | public String serializeStatistics(Statistics statistics) {
JsonObjectBuilder stats = Json.createObjectBuilder();
stats.add("pipelineName", statistics.getPipelineName());
final String handlerName = statistics.getRejectedExecutionHandlerName();
if (handlerName != null) {
stats.add("rejectedExecuti... |
29027682_0 | @Scheduled(fixedRateString="${vault.token.renew.rate:60000}") // <-- Default to renew token every 60 seconds
public void refreshVaultToken() {
try {
logger.info("Renewing Vault token " + obscuredToken + " for " + renewTTL + " milliseconds.");
rest.postForObject(refreshUri, request, String.class);
} catch (Except... |
29034817_62 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Tx tx = (Tx) o;
if (hash != null ? !hash.equals(tx.hash) : tx.hash != null) return false;
return state != null ? state.equals(tx.state) : tx.state == null;
} |
29056247_1 | public static Map<String, List<Pair<Integer>>> getTVGaps(Future<H2PersistenceManager> dao) throws Exception {
String allShowsQuery = "mediatype='tv' order by title, season, episode";
Collection<MediaFile> files = dao.get().getMediaFileDAO().query(allShowsQuery);
return getTVGaps(files);
} |
29060759_6 | @Override
protected synchronized Processor chooseProcessor(List<Processor> processors, Exchange exchange) {
Processor answer = null;
Processor defaultSelection = super.chooseProcessor(processors, exchange);
DeterministicCollectorStrategy deterministicCollectorStrategy = config.getDeterministicCollectorStra... |
29064349_8 | @Override
public void setWindowTitle(final String windowTitle)
{
stage.setTitle(windowTitle);
} |
29089479_3 | @Override
public void init(ServletConfig config) throws ServletException {
super.init(config);
MonetaEnvironment.setConfiguration(new MonetaConfiguration());
if (config == null) return;
String IgnoredContextPathNodesStr = config.getInitParameter(CONFIG_IGNORED_CONTEXT_PATH_NODES);
if ( !StringUtils.isEmpty(Ig... |
29128975_17 | @NonNull
@CheckReturnValue
public static Single<File> getFile(@NonNull final ParseFile file) {
return RxTask.single(() -> file.getFileInBackground());
} |
29140204_6 | @Override
public BuildFinishedStatus runProcess() {
FTPClient clientToDisconnect = null;
try {
final URL targetUrl = new URL(myTarget);
final String host = targetUrl.getHost();
final int port = targetUrl.getPort();
final String encodedPath = targetUrl.getPath();
final String path;
if (enco... |
29161545_3 | public TypeMirror getOperatorKind(Source leftSide, Source rightSide){
return getOperatorKind(leftSide, rightSide, null);
} |
29201308_0 | public void close() throws IOException {
// force nothing more to be read from the in-memory data, let the garbage collected free up its memory,
// but avoid NPEs by setting inMemoryData to a small zero-byte array.
inMemoryData = new byte[0];
inMemoryDataPointer = 0;
streamData.close();
// if w... |
29228340_0 | public static String getCommand(String string){
int index = string.indexOf("invocabot");
// If "invocabot" is not in string.
if (index == -1) return null;
// If "invocabot" is last word in string.
String words[] = string.split(" ");
if (words[words.length - 1].equals("invocabot"))
return "";
// If string... |
29235999_0 | public Swagger findProfileSpec(final String profileName) {
if (profileName == null) {
return null;
}
synchronized (mProfileSpecs) {
return mProfileSpecs.get(profileName.toLowerCase());
}
} |
29241103_0 | public static boolean isHostArte(String host) {
return host.equals("www.arte.tv");
} |
29248824_25 | public DataRdbms getData(final Object object) {
if (object instanceof Timestamp) {
final DateFormat df = new SimpleDateFormat(TIMESTAMP_PATTERN);
final String dateString = df.format(object);
return new GenericDataRdbms("to_timestamp('", dateString, "', 'mm/dd/yyyy hh24:mi:ss.ff3')");
}
if (object instanceof D... |
29251742_4 | public static String buildUrlWithQueryParams(@NonNull Logger logger, @NonNull String baseUrl,
@NonNull Map<String, String> queryParams) {
final Uri.Builder uriBuilder = Uri.parse(baseUrl).buildUpon();
for (Map.Entry<String, String> entry : queryParams.entrySet()) {
... |
29281445_29 | static public boolean isContainerRunning(
String name) {
final String output = new LocalExec(Contexts.currentContext())
.command("docker")
.args("ps")
.runCaptureOutput()
.asString()
.trim();
String[] lines = output.split("\n");
// header line
... |
29349352_0 | public void process(CtElement element) {
if (element instanceof CtType || element instanceof CtField || element instanceof CtExecutable) {
Set<ModifierKind> modifiers = ((CtModifiable) element).getModifiers();
if (modifiers.contains(PUBLIC) || modifiers.contains(PROTECTED)) {
String docComment = element.getDocC... |
29349453_21 | public String getNimbusHost() {
return (String)this.config.get(NIMBUS_HOST);
} |
29350019_17 | @Override
public ByteArrayInputStream getImage(Integer scalar, ImagePlotShape shape, ImageEncoding imageEncoding,
Double sparsity, Model model) throws JsonProcessingException, ApiException {
validateRequiredModels(model);
return getImage(scalar, shape, imageEncoding, sparsity, model.toJson());
} |
29351988_0 | public static Integer add(Integer a, Integer b){
return a + b;
} |
29397245_126 | public static String process(final String input) {
try {
return new KmarkProcessor().process(new StringReader(input));
} catch (IOException ignore) {
//never happen, it's string reader
return null;
}
} |
29432931_27 | public boolean hasForcedChoice() {
return forcedChoice != null;
} |
29476598_13 | public boolean writeNonDefaultDataObject(Object object, String fileName) {
try {
ISerializer serializer = null;
try {
serializer = serializerQueue.take();
} catch (InterruptedException e1) {
Thread.interrupted();
}
if (null == serializer) {
log.error("Serializer instance could not be obtained.");
... |
29481791_16 | public static Map<URI, Object> instantiate(final Iterable<? extends Statement> model,
final URI... ids) {
final Map<Resource, URI> types = Maps.newLinkedHashMap();
final Multimap<Resource, Statement> stmt = ArrayListMultimap.create();
for (final Statement statement : model) {
final Resource... |
29500340_0 | public Observable<List<FeedItem>> feed(String username) {
return user.findId(username).toObservable()
.flatMap(userid -> {
if (StringUtils.hasText(userid)) {
return Observable.from(repo.findByUserid(userid));
} else {
return Observable.just(singletonFeed("Unknown user: " + username));
}
})
... |
29523538_11 | @Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
logger.debug("getting log level");
synchronized (mutex) {
try {
String currentLevel = LogManager.getRootLogger().getLevel().toString();
response... |
29557376_87 | @Override
public LazyString plus(Character value) {
return fromLazySeq(string.plus(value));
} |
29582902_1 | static String qualifiedTransformerName(String className) {
String pkg = TransformerFactory.class.getPackage().getName();
String suffix = Transformer.class.getSimpleName();
StringBuilder sb = new StringBuilder();
sb.append(pkg);
sb.append('.');
sb.append(className);
if (!className.endsWith(suffix)) {
s... |
29603580_64 | public void setupJBehaveEmbedder(final JBehaveTestCase testCase) {
embedder.embedderControls().doVerboseFailures(true).doGenerateViewAfterStories(false).useThreads(1);
embedder.useEmbedderMonitor(new NullEmbedderMonitor());
Configuration configuration = configurationFactory.create(testCase);
InstanceSte... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.