id stringlengths 7 14 | text stringlengths 1 37.2k |
|---|---|
32803313_24 | @Override
public WroModel create() {
final StopWatch stopWatch = new StopWatch("Create Wro Model from Groovy");
final Script script;
try {
stopWatch.start("parseStream");
script = new GroovyShell().parse(new InputStreamReader(new AutoCloseInputStream(getModelResourceAsStream())));
LOG.debug("Parsing g... |
32823958_24 | public List<Protos.Environment.Variable> getList() {
return envList;
} |
32834215_0 | @UiThread @Override public void attachView(V view) {
viewRef = new WeakReference<V>(view);
presenterDestroyed = false;
} |
32848140_150 | public UniverseQuery convertQuery(String text, UniverseClient client, String token)
throws UniverseException {
StringBuilder select = new StringBuilder();
StringBuilder universe = new StringBuilder();
StringBuilder buf = new StringBuilder();
StringBuilder resultObj = new StringBuilder();
StringBuilder whe... |
32870652_2 | private void processSample() {
lastProcessedSpectrum = pushedSamples;
FFTSignalProcessing.ProcessingResult result = signalProcessing.processSample(window,
aWeighting, true);
// Move result by 1 backward
if(windowResults.length > 1) {
System.arraycopy(windowResults, 1, windowResults, ... |
32895424_36 | public static void listGcsBuckets(String googleAccessKeyId, String googleAccessKeySecret) {
// String googleAccessKeyId = "your-google-access-key-id";
// String googleAccessKeySecret = "your-google-access-key-secret";
// Create a BasicAWSCredentials using Cloud Storage HMAC credentials.
BasicAWSCredentials go... |
32935706_259 | @Override
public void onValueChanged() {
int countUnread = 0;
boolean inProgress = false;
for (Notification notification : notifications) {
if (!notification.isRead()) {
countUnread++;
}
if (!inProgress) {
inProgress = !notification.isFinished();
}
... |
32935729_404 | @NotNull
public VirtualFile newInstance(@NotNull String href) {
return newInstance(href, NAME, PATH);
} |
32935745_241 | public Collection<PluginFQN> parsePlugins(Map<String, String> attributes)
throws InfrastructureException {
if (attributes == null) {
return emptyList();
}
String pluginsAttribute =
attributes.getOrDefault(Constants.WORKSPACE_TOOLING_PLUGINS_ATTRIBUTE, null);
String editorAttribute =
attribu... |
32954678_11 | public boolean isControlled() {
return CONTROLLED.equalsIgnoreCase(value);
} |
32957224_43 | public static void configure(final Definitions definitions) {
// Identify configured gateways
final Set<Gateway> reconfiguredGatewaySet = findConfiguredGateways(definitions);
// Find and remove absent sequence flows
prune(definitions, (Set) findAbsentSequenceFlows(reconfiguredGatewaySet));
// Rep... |
32972125_25 | @Override
public void close() {
framePool.close();
Arrays.fill(partitionArray, null);
} |
32975439_411 | public static void preserve(FileSystem targetFS, Path path,
CopyListingFileStatus srcFileStatus,
EnumSet<FileAttribute> attributes,
boolean preserveRawXattrs) throws IOException {
// If not preserving anything from FileStatus, don't ... |
32976823_59 | @Beta
@Nonnull
public Client createClient() {
Client client = ClientBuilder.newClient()
.register(new FollowRedirectsFilter(config.getMaxRedirectHops()))
.register(new HttpStatusHandler())
.register(new LoggingClientFilter(this.getClass(), LogLevel.TRACE));
client.property(Cl... |
33024207_3 | @Override
public int makeBooking( Cargo cargo, Voyage voyage )
{
int ok = next.makeBooking( cargo, voyage );
if( ok < 0 )
{
return ok;
}
Property<Integer> gen = generator.sequence();
ok = gen.get();
generator.sequence().set( ok + 1 );
return ok;
} |
33030494_0 | public boolean isEmpty() {
return head == tail;
} |
33046639_32 | public boolean containsEntity(Entity entity) {
Set<WordEntry> entries = WiktionaryUtils.entityToWords(wkt, entity);
if (entries.size() == 0) {
return false;
}
else {
return true;
}
} |
33052737_2 | public static Page allPages() {
return new Page(ALL_PAGES, ALL_PAGES);
} |
33053071_10 | @Override
public DBSession createSession() throws JasDBException {
if(StringUtils.stringNotEmpty(instance)) {
return new LocalDBSession(instance);
} else {
return new LocalDBSession();
}
} |
33053133_7 | @SuppressWarnings("rawtypes")
public void configureOutputKeyValue(Job job, Class<? extends Mapper> mapperClass,
MapperInfo map, boolean isMapOnly) {
MaraAnnotationUtil util = MaraAnnotationUtil.INSTANCE;
// Try and work it out from the generics
Type[] params = util.getGenericTypeParams(mapperClass, Mapper.class);... |
33075946_8 | @Override
public double getSimilarity(Entity e1, Entity e2)
rows SimilarityException, LexicalSemanticResourceException
// entity overrides the equals method with a usable variant
if (e1.equals(e2)) {
return 0.0;
}
double distance = getShortestPathLength(e1, e2);
if (convertToRelatednes... |
33082868_6 | @Override
public List<Recipient> findReadyToNotify(NotificationType type) {
switch (type) {
case BACKUP:
return repository.findReadyForBackup();
case REMIND:
return repository.findReadyForRemind();
default:
throw new IllegalArgumentException();
}
} |
33100783_0 | public void transform(@Nonnull ClassPath inputPath) throws IOException {
SCAN:
{
for (ClassPathArchive inputArchive : inputPath) {
LOG.debug("Scanning archive {}", inputArchive);
for (ClassPathResource inputResource : inputArchive) {
Transformable struct = newTra... |
33119850_1 | public boolean matches(@NotNull String filename) {
return names.contains(filename);
} |
33125888_3 | public static BigInteger[] random(BigInteger from, BigInteger to, Random rnd, int size, int bits) {
InputValidation.begin()
.when(from == null, "from is null")
.when(to == null, "to is null")
.when(from != null && to != null && from.compareTo(to) >= 0, "from not less than to")
.when(size < 0, "size less than z... |
33135232_0 | public static int getCollectionSize( String range, int collectionSize )
{
int min = Integer.parseInt( range.split( "-" )[0] );
int max = Integer.parseInt( range.split( "-" )[1] );
if ( min == 0 && max == 0 )
{
return 0;
}
if ( min > collectionSize )
{
min = collectionSize;
... |
33147632_256 | @Override
public void failure(TwitterException exception) {
logger.e(TweetUi.LOGTAG, exception.getMessage(), exception);
if (cb != null) {
cb.failure(exception);
}
} |
33194850_3 | public ApiVersion getApiVersion()
throws IOException, ServerIOException {
return cloudApi.getApiVersion();
} |
33245536_7 | public boolean buy(String vehicleId){
if(cv.cashAmount(43)){
return true;
}
throw new IllegalArgumentException("Poor customer exception");
} |
33263136_2 | @POST
@Consumes({MediaType.APPLICATION_JSON})
public Response doPost(
List<Map<String, Object>> events,
@QueryParam(_CLUSTER) final String cluster
) throws IOException
{
if (Strings.isNullOrEmpty(cluster)) {
return Response.status(Response.Status.BAD_REQUEST)
.entity(String.format("req... |
33272606_2 | @Override
public boolean equals(Object obj) {
if (obj == null)
return false;
if (obj == this)
return true;
if (obj.getClass() != this.getClass())
return false;
Graph b = (Graph) obj;
return nodeSet.equals(b.getAllNodes()) && getAllEdges().equals(b.getAllEdges()) ;
} |
33314734_92 | Map<String, StoredException> getStoredExceptions(){
if(exceptionPersister != null) {
return exceptionPersister.loadAll();
} else {
return null;
}
} |
33319794_8 | public static Span[] phrasesAsSpanList(String[] aSentence, String[] aTags,
String[] aPreds) {
validateArguments(aSentence.length, aTags.length, aPreds.length);
// initialize with the list maximum size
List<Span> phrases = new ArrayList<Span>(aSentence.length);
String startTag = "";
int startIndex = 0;
... |
33324205_6 | @Override
public Map<String, OntologyIdInfo> getInfos() {
return Collections.unmodifiableMap(infos);
} |
33360686_25 | public ReturnType extractReturnType(final Method annotatedMethod) {
EdmFunctionImport functionImport = annotatedMethod.getAnnotation(EdmFunctionImport.class);
ReturnType returnType = new ReturnType();
if (functionImport.returnType().isCollection()) {
returnType.setMultiplicity(EdmMultiplicity.MANY);
} else ... |
33368284_0 | @Override
public void infoCommand() {
Info info = dockerClient.infoCmd().exec();
System.out.print(info);
} |
33374862_1 | public String saySomething()
{
return "Hello World!";
} |
33383826_25 | @Override
public boolean isSharing(User user) {
final String userKey = userKey(user);
return user.getEntries().stream().anyMatch(e -> {
if (e instanceof Workflow) {
final Map<String, Role> map = resourceToUsersAndRolesMap.get(((Workflow)e).getWorkflowPath());
if (map != null && m... |
33385755_11 | public ID getChunkID() {
return chunkId;
} |
33397227_35 | @Override
public void beforeRMNodeEventHandled(RMNodeEvent event, RMContext context) {
switch (event.getType()) {
case STARTED:
// Since the RMNode was just started, it should not have a non-zero capacity
RMNode rmNode = context.getRMNodes().get(event.getNodeId());
if (isNonZeroCapacityNo... |
33401991_77 | @Override
public void populate(Card card) {
super.populate(card);
RestoMenuCard menuCard = card.checkCard(Card.Type.RESTO);
RestoMenu menu = menuCard.getRestoMenu();
RestoChoice choice = menuCard.getRestoChoice();
String text = itemView.getResources().getString(R.string.feed_resto_menu_title);
... |
33453737_3 | public static String getIframeAdminContentWrapperTemplate() throws IOException {
try (InputStream templateStream =
DocumentOutputUtil.class.getClassLoader().getResourceAsStream(IFRAME_CONTENT_WRAPPER_TEMPLATE_PATH)) {
return IOUtils.toString(templateStream, "UTF-8");
}
} |
33469584_10 | public void addRuleParserAt(IRuleParser parser, Class<? extends IRuleParser> atParser) {
int index = getIndexOfClass(ruleParsers, atParser);
if (index == -1) {
throw new ParserAddException("parser " + atParser.getSimpleName() + " has not been added");
}
ruleParsers.remove(index);
ruleParsers... |
33470543_1 | public static ObjectNode getChatMessages(ObjectNode queryStrNode) {
ObjectNode objectNode = factory.objectNode();
// check appKey format
if (!JerseyUtils.match("^(?!-)[0-9a-zA-Z\\-]+#[0-9a-zA-Z]+", APPKEY)) {
LOGGER.error("Bad format of Appkey: " + APPKEY);
objectNode.put("message", "Bad format of Appkey");
re... |
33492382_4 | public boolean matches(String filter) {
return filter != null && title.contains(filter);
} |
33500369_8 | public String getName() {
return name;
} |
33546582_114 | public IntentBuilder extra(String name, boolean value) {
validateNotBlank(name, "Name");
mIntent.putExtra(name, value);
return this;
} |
33547254_5 | @Override
public <T extends Exception> InternalResponse<Object> process(final T ex,
final InternalRequest<Object> req,
final InternalResponse<Object> resp) throws Exception{
Class<? extends Ex... |
33547660_1 | public static boolean isQname(String s) {
int len = s.length();
if (len == 0)
return false;
if (!isNameStartCharNs(s.charAt(0)))
return false;
for (int i = 1; i < len; i++) {
char c = s.charAt(i);
if (!isNameCharNs(c)) {
if (c == ':' && ++i < len && isNameStartCharNs(s.charAt(i))) {
... |
33559545_59 | @Override
public Duration computeDelay(final R result, final X failure, final ExecutionContext context) {
return functions.stream()
.map(function -> function.computeDelay(result, failure, context))
.filter(Objects::nonNull)
.findFirst()
.orElse(null);
} |
33567291_88 | @Override
public void initialize(UimaContext context) throws ResourceInitializationException {
super.initialize(context);
} |
33591418_10 | @Override
public void visitEnd() {
AbstractInsnNode next = instructions.getFirst();
boolean removeFrame = false;
int stackSize = 0;
while (next != null) {
AbstractInsnNode node = next;
next = next.getNext();
Object[] stack;
switch (node.getOpcode()) {
case -... |
33645738_0 | @Override
public Observable<Pair<String, Response<RhymesResponse>>> rhymes(final String word) {
return apiService.rhymes(word)
.map(new Func1<Response<RhymesResponse>, Pair<String, Response<RhymesResponse>>>() {
@Override
public Pair<String, Response<RhymesResponse>> call... |
33670015_1 | public Sentiment get(String key) {
final String value = properties.getProperty(key);
return value == null ? Sentiment.NEUTRAL : Sentiment.valueOf(value);
} |
33675294_8 | public UpdateFirmwareResponseDto updateFirmware(final DlmsConnectionHolder conn, final DlmsDevice device,
final String firmwareIdentification) throws OsgpException {
LOGGER.info("Updating firmware of device {} to firmware with identification {}", device,
firmwareIdentification);
return this... |
33766200_0 | @Override
public EvaluationResult evaluate(EvaluationContext evaluationContext) throws EvaluationException {
/*
* First check to see if we are valid. If not, return an error status immediately
*/
if (!this.validate()) {
return new EvaluationResult(new StdStatus(this.getStatusCode(), this.getSt... |
33769933_17 | public JkPathTree importTree(JkPathTree tree, CopyOption... copyOptions) {
createIfNotExist();
if (tree.exists()) {
tree.stream().filter(excludeRootFilter()).forEach(path -> {
Path target = this.getRoot().resolve(tree.getRoot().relativize(path).toString());
if (Files.isDirectory(... |
33776978_8 | public boolean find(int key) {
splay(key);
return root.key == key;
} |
33779066_0 | public static void main(String[] args) {
System.out.println("multiply(123,100): " + multiply(123,100));
} |
33782165_29 | protected long calculateNewDifficultyTargetInner(int previousHeight, final Block prev,
final Block nextBlock, final Block blockIntervalAgo) {
return this.calculateNewDifficultyTargetInner(previousHeight, prev.getTimeSeconds(),
prev.getDifficultyTarget(), blockIntervalAgo.getTimeSeconds(),
ne... |
33809621_10 | @Override
public void process(Exchange exchange) throws Exception {
Object body = exchange.getIn().getBody();
Neo4jOperation op = (Neo4jOperation)exchange.getIn().getHeader(Neo4jEndpoint.HEADER_OPERATION);
if (op == null) {
throw new Neo4jException("No operation specified for exchange " + exchange);... |
33813213_4 | @Override
public void apply(View view, View parent, String name, Context context, AttributeSet attributeSet) {
if (!clazz().isAssignableFrom(view.getClass())) {
return;
}
values = obtainAttributes(context, attributeSet);
if(values == null || values.length() == 0) return;
try {
for ... |
33816473_0 | public int getIssueCount() throws IOException {
Request request = new Request.Builder()
.url(url + "/issues.json")
.build();
Response response = client.newCall(request).execute();
JSONObject jsonObject = new JSONObject(response.body().string());
return jsonObject.getInt("total_c... |
33829862_43 | @Override
public String toString() {
if (StringUtils.isBlank(customName)) {
if (lowNumber == 0) {
return String.format("%s.%s", bigNumber, intermediateNumber);
}
return String.format("%s.%s.%s", bigNumber, intermediateNumber, lowNumber);
} else {
if (lowNumber == 0) {... |
33854851_43 | public String getPlaceholderForScore(int scoreValue, String surveyType, int surveyTypeScale) {
final Score score = new Score(scoreValue, surveyType, surveyTypeScale);
if(score.isDetractor() && getDetractorPlaceholder() != null) {
return getDetractorPlaceholder();
} else if(score.isPassive() && getP... |
33856324_2 | @Override
public String toString() {
StringBuilder str = new StringBuilder();
getGroupValueHandler(getClass()).appendToString(this, str);
return str.toString();
} |
33861662_2 | int neg(final int stuff) {
return -stuff;
} |
33926359_0 | public static boolean debounce(final String identifier, final Runnable r, final int millis) {
if(getInstance().runnables.containsKey(identifier)) {
// debounce
Log.d(TAG, String.format("Debouncing runnable with identifier \"%s\"", identifier));
Runnable old = getInstance().runnables.get(iden... |
33955440_0 | public static BoxBookmark createFromId(String bookmarkId) {
JsonObject object = new JsonObject();
object.add(FIELD_ID, bookmarkId);
object.add(FIELD_TYPE, TYPE);
return new BoxBookmark(object);
} |
33957901_11 | static long getNextNextStartTimeFor(long start, long end) {
DateTime now = DateTime.now();
Interval interval = SyncthingUtils.getIntervalForRange(now, start, end);
if (interval.isAfter(now)) {
//Interval hasnt started yet
return interval.getStartMillis();
} else {
//were either i... |
33978966_38 | public List<Thing> getList() {
return this.list;
} |
33989963_26 | private void highlight(SyntaxToken token, TypeOfText type) {
highlighting.highlight(token.line(), token.column(), token.endLine(), token.endColumn(), type);
} |
34034770_5 | @Override
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain)
throws IOException, ServletException {
HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest;
String jwt = resolveToken(httpServletRequest);
if (StringUtils.hasTe... |
34039690_3 | public static Calendar previous(Calendar self) {
Calendar result = (Calendar) self.clone();
result.add(Calendar.DATE, -1);
return result;
} |
34044469_0 | public void connect( String host, int port, String password, int timeoutSeconds ) throws InboundConnectionFailure
{
// If already connected, disconnect first
if ( canSend() )
{
close();
}
// Configure this client
ClientBootstrap bootstrap = new ClientBootstrap(
new NioClient... |
34044841_37 | @Transactional
public ComplaintType createComplaintType(ComplaintType complaintType) {
return complaintTypeRepository.save(complaintType);
} |
34112580_0 | @Override public List<Issue> getIssues() {
return Arrays.asList(
HelloWorldDetector.ISSUE,
IdPrefixDetector.ISSUE,
StringReferencesDetector.ISSUE,
ClassNamesDetector.ISSUE,
LayoutNamesDetector.ISSUE
);
} |
34138670_0 | @Override // IdGenerator
public synchronized long nextValue() {
if (offset == 0) {
newSegment();
}
if (++offset == SEGMENT_SIZE){
offset = 0;
}
return ++value;
} |
34202547_6 | public MapBuilder<K, V> put(final K key, final V value) {
this.internalMap.put(key, value);
return this;
} |
34206566_4 | @Override
public byte[] serialize(String topic, News data) {
try {
return mapper.writeValueAsBytes(data);
} catch (JsonProcessingException ex) {
throw new SerializationException("Could not transform Object to JSON: " + ex.getMessage(), ex);
}
} |
34212608_2 | public static <T extends Route> T build(Class<T> routeType, Consumer<String> consumer) {
PathImplementor implementor = RoutingImpl.getImplementorByClass(routeType);
if (implementor == null) {
throw new IllegalArgumentException("Invalid route type: " + routeType);
}
@SuppressWarnings("unchecked")... |
34216921_28 | Hero createPlayer(ShipConfig shipConfig, boolean shouldSpawnOnGalaxySpawnPosition, RespawnState respawnState, SolGame game, boolean isMouseControl, boolean isNewShip) {
Vector2 position = findPlayerSpawnPosition(shipConfig, shouldSpawnOnGalaxySpawnPosition, game);
game.getCam().setPos(position);
if (isMouse... |
34217961_0 | @Override
public void onSketchTouched(MotionEvent event) {
if (hasPaintListener()) {
paintListener.onPaintingStart();
}
inkPerformer.reset();
} |
34324443_0 | public static EntityManager getEntityManager() {
return ENTITY_MANAGER_FACTORY.createEntityManager();
} |
34336359_71 | @Override
public void init(ServiceDomain domain) {
if (_logger.isDebugEnabled()) {
_logger.debug("Initialization of CamelExchangeBus for domain " + domain.getName());
}
SimpleRegistry registry = _camelContext.getWritebleRegistry();
for (Processors processor : Processors.values()) {
regi... |
34339216_0 | public long getResult() {
synchronized (monitor) {
logger.finest(
Thread.currentThread().getName()
+ " enters "
+ this.getName()
+ " getResult(), monitor = " + monitor);
while (!isReady) {
try {
... |
34374370_4 | ; |
34382546_8 | public List<DataPoint> learn() {
List<DataPoint> result = new ArrayList<>(dataPoints.size());
EvictingQueue<Double> window = EvictingQueue.create(weights.length);
int endHalf = weights.length / 2;
// add zeros to the beginning
for (int i = 0; i < (weights.length - endHalf) - 1; i++) {
res... |
34383946_7 | @Override
public String toString() {
return "ReleaseDetails [id=" + this.id + ", version=" + this.version + ", buildDate=" + this.buildDate + "]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
} |
34387413_4 | public boolean isCrawable(URL url, int depth) {
if (url != null && !visitedUrls.contains(url) && isCrawlingAllowed(url) && depth < crawlerMaxDepth) {
visitedUrls.add(url);
if(url.getPath().endsWith("/")){
try {
visitedUrls.add(new URL(url.toString().substring(0, url.toStr... |
34409518_236 | String getJsFilename(String classname, String fwk) {
String path = classname.replaceAll("\\.", File.separator);
if (null != fwk) {
return File.separator + path + "." + fwk + Constants.JS;
}
return File.separator + path + Constants.JS;
} |
34411308_0 | public void serialize(Object object, OutputStream outputStream) throws IOException {
Marshaller marshaller = createMarshaller();
marshaller.start(Marshalling.createByteOutput(outputStream));
try {
marshaller.writeObject(object);
} finally {
marshaller.finish();
}
} |
34430212_3 | @Override
protected boolean doAuthentication(KnightCredential credential) throws AuthenticationException {
//不支持的凭据直接返回false.
if(!this.supports(credential)){
return false;
}
if(credential!=null && credential instanceof KnightEncryCredential){
KnightEncryCredential encryCredential = (Knig... |
34430581_0 | public static void loadDataFromResource(final RemoteRepositoryManager repo,
final String namespace, final String resource) throws Exception {
final InputStream is = SampleBlazegraphCustomFunctionRemote.class
.getResourceAsStream(resource);
if (is == null) {
throw new IOException("Could not locate resource: " +... |
34446334_72 | public static String decodeClientURI(String clientUri) {
return clientUri.startsWith(Constants.URI_CLIENT_PREFIX)
? clientUri.substring(Constants.URI_CLIENT_PREFIX.length()): clientUri;
} |
34456739_2 | public boolean save() {
return save(null);
} |
34482253_0 | public Set<String> getRooms() {
return new HashSet<String>(rooms.keySet());
} |
34520372_0 | public boolean preHandle(HttpServletRequest request, HttpServletResponse response,
Object handler) throws ServiceBrokerApiVersionException {
if (version != null && !anyVersionAllowed()) {
String apiVersion = request.getHeader(version.getBrokerApiVersionHeader());
if (!version.getApiVersion().equals(apiVersion)) ... |
34537449_0 | public String map(Observation observation) {
return observation.getId() + SEPARATOR + observation.getName() + SEPARATOR + observation.getTime();
DO: Add escaping logic if name contains double quotes or commas
} |
34568856_0 | public String safeFilename(String filename) {
// Remove bad characters from filenames
filename = filename.replaceAll("[*?/<>&!#$+\"'{}:@\\\\]",""); // Removes bad characters
filename = filename.replaceAll("\\s{2,}", " "); // Removes double spaces
return filename.trim(); // Returns the trimmed value
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.