id
stringlengths
7
14
text
stringlengths
1
37.2k
24503341_1
@Override public int hashCode() { if ((this.first == null) && (this.second == null)) { return "".hashCode(); } return this.first == null ? this.second.hashCode() : this.first.hashCode() ^ this.second.hashCode(); }
24506674_59
public static int compare(int x, int y) { return (x < y) ? -1 : ((x == y) ? 0 : 1); }
24542374_0
public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry reg) throws BeansException { logger.debug("postProcessBeanDefinitionRegistry : enter"); try { // Reflect over StatefulJ // Reflections reflections = new Reflections((Object[])this.packages); // Load up all Endpoint Binders // Map<Str...
24556876_0
public MappingIterator<K, V> getMappingIterator() { return new MappingIterator<K, V>() { private Node pointer = root; @Override public V getValue() { if (!canExit()) { return null; } return pointer.getChild(endSymbol).value; } ...
24558581_1
@Override public Document[] processDocument(Document document) { VelocityContext velocityContext = new VelocityContext(document.asMap()); List<String> values = document.removeAll(templateField); for (String value : values) { StringWriter writer = new StringWriter(); engine.evaluate(velocityContext, write...
24580061_38
@Override public LayerParameter generateParameterGradient(final Matrix input, final Matrix error) { final Matrix weightGradient = matrixFactory.create(kernelHeight * kernelWidth * inputChannel, outputShape[0]); for (int n = 0; n < input.getColumns(); ++n) { final Matrix row = im2row(n, input); weightGradien...
24581892_1
@Override public void writeObject(Object object) throws IOException { if (object == null) { writeNull(); return; } Serializer serializer = findSerializerFactory().getObjectSerializer(object.getClass()); serializer.writeObject(object, this); }
24587006_11
@SuppressWarnings("unchecked") public Transition handleEvent(Transition last, E event) { final Object current = last.getState(); final Context context = last.getContext(); final String stateMachineId = context.stateMachineId(); Transition next; try { final HandleEvent<E> handleEvent = def...
24610319_1
public void refreshHapticData(View root) { if(proxyHolder.get() != null) { ISdl proxy = proxyHolder.get(); if (userHapticData == null) { List<HapticRect> hapticRects = new ArrayList<>(); findHapticRects(root, hapticRects); SendHapticData msg = new SendHapticData(...
24634425_374
public static String getProviderXML(Provider provider) { return toXML(Provider.class, provider); }
24635052_3
public boolean isSatisfied(Event event) { String fieldVal = null; // some information are in the decrypted event (like type) if (event.isEncrypted() && (null != event.getClearEvent())) { JsonObject eventJson = event.getClearEvent().toJsonObject(); fieldVal = extractField(eventJson, key); ...
24641218_11
public static Stream<String> getKnownTemplates() throws IOException { ClassLoader cl = Thread.currentThread().getContextClassLoader(); URL knownDirURL = cl.getResource(TEMPLATE_DIR); if( knownDirURL == null) { throw new IllegalStateException("Unable to find mustache templates. Error building jar?"); } URI knownD...
24650339_37
public static String getGroupId(PwsResult pwsResult) { // The PWS does not always give us a group id yet. if (pwsResult.getGroupId() == null || pwsResult.getGroupId().equals("")) { try { return new URI(pwsResult.getSiteUrl()).getHost() + pwsResult.getTitle(); } catch (URISyntaxException e) { ret...
24653868_21
public static AuthorizationsCollector parse(File file) throws ParseException { if (file == null) { LOG.warn("parsing NULL file, so fallback on default configuration!"); return AuthorizationsCollector.emptyImmutableCollector(); } if (!file.exists()) { LOG.warn( String....
24676715_0
public ItemsetTree(final Multiset<Integer> singletons) { items = singletons; }
24691184_68
public Observable<VoidResponse> disableAll() { return latest().map(this::disableAll) .flatMap(this::updateNotificationSettings); }
24713325_1
@Override public Optional<String> lookupOptional(String name) { return delegate.lookupOptional(name).map(this::replace); }
24748638_22
@Override public void run(C configuration, Environment environment) throws Exception { // configure primary data source factory configureDataSourceFactory( configuration, environment, primaryDataSourceName(), getDataSourceFactory(configuration)); // configur...
24758552_12
private OperationalTemplate build() { AdlUtils.fillArchetypeFields(result, template); result.setIsDifferential(false); expandTemplate(); return result; }
24765223_2
@Override public Response insert(RESTInputGroup userGroup) throws NotFoundRestEx, InternalErrorRestEx, ConflictRestEx { // check that no group with same name exists boolean exists; try { userGroupAdminService.get(userGroup.getName()); exists = true; } catch (NotFoundServiceEx ex) { ...
24771298_8
public StravaSegment getSegmentById(String id) { return restTemplate.getForObject(buildUri("/segments/" + id), StravaSegment.class); }
24787461_0
@Override public void write( IIOMetadata streamMetadata, IIOImage image, ImageWriteParam param ) throws IOException { if ( param == null ) { param = getDefaultWriteParam(); } WebPWriteParam writeParam = (WebPWriteParam) param; ImageOutputStream output = ( ImageOutputStream ) getOutput(); RenderedImage r...
24811435_3
@Override @SuppressWarnings("resource") public String toString() { Formatter fmt = new Formatter(); fmt.format("REQUEST{%s %s", method(), this.exchange.getRequestPath()); fmt.format(" ,Headers:[%s]", headers()); fmt.format(" ,Cookies:[%s]", cookies()); fmt.format(" ,Forms:[%s]}", forms()); return fmt.toString();...
24834448_0
@Override public int hashCode() { int result = localName != null ? localName.hashCode() : 0; result = 31 * result + (localDescription != null ? localDescription.hashCode() : 0); result = 31 * result + (localPricing != null ? localPricing.hashCode() : 0); return result; }
24855056_82
@GET @Path("/{topologyId}") @Produces(MediaType.APPLICATION_JSON) public Topology getTopology(@PathParam("topologyId") String topologyId) { String userId = (String) SecurityUtils.getSubject().getPrincipal(); return topologyService.getTopology(topologyId, userId); }
24886295_0
public JsonClient get(String url) { if(httpClient != null) { response = HttpExecuter.get(httpClient, url); return this; } else { throw new RuntimeException(getHttpClientIsNullError()); } }
24892974_1
public static long readLong(byte[] buffer) { return ((((long) buffer[7] & 0xffL)) | (((long) buffer[6] & 0xffL) << 8) | (((long) buffer[5] & 0xffL) << 16) | (((long) buffer[4] & 0xffL) << 24) | (((long) buffer[3] & 0xffL) << 32) | (((long) buffer[2] & 0xffL) << 40) | ...
24920193_0
public static Object plus(Object o1, Object o2) throws IllegalStateException { Class<?> c1 = o1.getClass(); Class<?> c2 = o2.getClass(); if (c1 == String.class || c2 == String.class) { return String.valueOf(o1).concat(String.valueOf(o2)); } if (Number.class.isAssignableFrom(c1) && Number.cla...
24961552_3
@Override public void delete(String user, String name, PersistentObject obj) throws InstantiationException { String collectionName = user + "_" + name; if (!KernelThread.currentKernelThread().isPrivileged()) { throw new SecurityException("delete db one - not authorized"); } MongoCollection mongo...
24968217_0
public void execute() throws MojoExecutionException, MojoFailureException { if (isSkip()) { getLog().info(project.getArtifactId() + " skipped compatible checking"); return; } doExecute(); }
24989037_0
public <T> T unmarshall( String s ) throws JAXBException { return jaxb.unmarshall( s ); }
25021196_0
static Map<String, String> getEncryptedMAP(String str) { Map<String, String> params = new HashMap<>(); params.put("appver=" + BuildConfig.VERSION_NAME + "&request", LightBase64.EncodeBase64(str) + "&timetoken=" + System.currentTimeMillis()); return params; }
25029544_7
public static Asn parse(String text) { try { String asnString = Validate.notNull(text, "AS Number must not be null").trim().toUpperCase(); if (asnString.startsWith("AS")) { asnString = asnString.substring(2); } long low; long high = 0L; int indexOfDot = as...
25040159_5
@Override public Method<T> get(Consumer<T> consumer) { return getMethod(consumer); }
25088312_9
protected int multiReplace(int start, int length, String newText, int startSearchAt, boolean snapNext) { assert (length + newText.length() > 0); //Assert this call has a point. It's protected, so bad usage should be found. //SnapNext must be true when 'start' == 0, because there are no previous tokens (Fixed 2...
25125959_2
public Entrada findById(int id) { Connection con = null; PreparedStatement ps = null; try { con = ds.getConnection(); ps = con.prepareStatement( "select * from entrada where id = ?"); ps.setInt(1, id); ResultSet rs = ps.executeQuery(); if (rs.next()) { Entrada e = new Entrada(); e.setId(rs.getInt...
25130368_0
public static NumericRange parse(String range) throws UaException { try { String[] ss = range.split(","); Bounds[] bounds = new Bounds[ss.length]; for (int i = 0; i < ss.length; i++) { String s = ss[i]; String[] bs = s.split(":"); if (bs.length == 1) { ...
25138352_715
public boolean atLeastOneMonitorStarted() { if (m_monitorsStarted.size() > 0) { return true; } return false; }
25151498_1
@Override public void endRecord() { flushValues(); getReceiver().endRecord(); }
25156526_2
@GET @Produces("image/*") public Response GET(@Context final UriInfo uriInfo, @HeaderParam(HttpHeaders.ACCEPT) @DefaultValue(MediaType.WILDCARD) final String type, @HeaderParam(LdpWebService.HTTP_HEADER_PREFER) PreferHeader preferHeader, @QueryParam("xywh") Re...
25205317_5
public static File create(String fileName) { String[] filePath = fileName.split(Pattern.quote(File.separator)); String name = filePath[filePath.length - 1]; return create(fileName.replace(name, ""), name); }
25206330_0
@Override public List<UserDTO> fetchAllUsers() { LOGGER.info("Fetching all users"); return users; }
25213631_2
public static String filter(String text) { if ( text == null ) { return text; } Document document = Jsoup.parse(text); document.outputSettings(new Document.OutputSettings().prettyPrint(false)); document.select("br").append("\\n"); document.select("p").prepend("\\n\\n"); String s = document.html().replaceAll(...
25239318_56
@Override public boolean apply(final WebElement element) { try { return ignoreCase ? StringUtils.containsIgnoreCase(element.getAttribute("innerHTML"), text) : element.getAttribute("innerHTML").contains(text); } catch (NullPointerException | WebDriverException e) { ...
25344951_7
public static String[] shift(String[] array) { return shift(array, 1); }
25345432_0
@SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(final Gson gson, final TypeToken<T> type) { final TypeAdapter<T> materialized; final AutoMatter annotation = type.getRawType().getAnnotation(AutoMatter.class); if (annotation != null) { // We are now the proud owners of an AutoMatter a...
25345877_2
@RequestMapping(value = "/api/user/uniqueemail", method = {RequestMethod.GET}, produces = ApplicationMediaType.APPLICATION_BEARCHOKE_V1_JSON_VALUE) public UniqueResult isEmailUnique(@RequestParam(value = "key", required = true) String email) { return new UniqueResult(userRepository.isEmailUnique(email)); }
25352070_40
@Path("/v2") @GET public List<Student> getStudentsV2() { List<Student> students = new ArrayList<Student>(); ClassRoom classRoom = new ClassRoom(); classRoom.setCid(1); classRoom.setClassname("三年二班"); for (int i = 1; i <= 100; i++) { Student student = new Student(i,"SCOTT"); student.setClassRoom(classRoom...
25397566_0
public void iterateRecursivelyThrough( final EList<Specification> specifications, final SpecificationCallback specificationCallback, final SpecObjectCallback specObjectCallback) { for (Specification specification : specifications) { this.iterateRecursivelyThrough(specification, specificationCallback, specO...
25405542_165
public static Map<DomainParts, String> splitDomain(String domain) { Map<DomainParts, String> domainParts = null; String[] dottedParts = domain.trim().toLowerCase(Locale.ENGLISH).split("\\."); if(dottedParts.length==2) { domainParts = new HashMap<>(); domainParts.put(DomainParts.SUB...
25453552_0
public TravelStrategy get(TravelId id) throws NullPointerException { TravelStrategy strategy = allModules.get(id); if (strategy == null) { throw new NullPointerException(); } return strategy; }
25461048_104
@Override public int addAuthor(Author author) { SqlSession sqlSession = null; try { sqlSession = MybatisUtil.getSqlSession(); AuthorMapper authorMapper = sqlSession.getMapper(AuthorMapper.class); int authorId = authorMapper.addAuthor(author); sqlSession.commit(); return a...
25461792_114
void deleteBoxObject(ButtonType confim, BoxPath path, BoxObject object) throws QblStorageException { if (confim != ButtonType.OK) { return; } transferManager.addUpload(new ManualUpload(DELETE, volume, null, path, object instanceof BoxFolder)); }
25507370_1330
@Override public READDIRPLUS3Response readdirplus(XDR xdr, RpcInfo info) { return readdirplus(xdr, getSecurityHandler(info), info.remoteAddress()); }
25546146_5
public String[] getExcludeDependencyFilterPatterns() { return excludeDependencyFilterPatterns; }
25569063_2
public static void verifyException(ThrowingCallable actor) { verifyException(actor, Exception.class); }
25573672_2
static RecordingInfo calculateRecordingInfo(int displayWidth, int displayHeight, int displayDensity, boolean isLandscapeDevice, int cameraWidth, int cameraHeight, int cameraFrameRate, int sizePercentage) { // Scale the display size before any maximum size calculations. displayWidth = displayWidth * sizePerc...
25573964_23
public void stopRecording(@Observes After afterTestMethod, TestResult testResult, CubeDroneConfiguration cubeDroneConfiguration, SeleniumContainers seleniumContainers) { try { if (this.vnc != null) { vnc.stop(); Path finalLocation = null; if (shouldRecordOnlyOnFailu...
25582637_44
public Credentials<UserPasswordToken> extractCredentials(final Request request) { final String basicAuthHeader = request.getHeader(BASIC_AUTHORIZATION_HEADER); if (StringUtils.isNotBlank(basicAuthHeader) && basicAuthHeader.startsWith(BASIC_PREFIX)) { return extractCredentials(basicAuthHeader); } else { re...
25598822_70
public Collection<Changeset> computeChangesetsToInsert(ExecutionContexts executionContexts, Collection<Changeset> declaredChangesets, Collection<Changeset> persistedChangesets) { return declaredChangesets....
25603410_10
public void serializeLogs(List<LogCatMessage> logCatMessages) { List<LogCatMessage> filterLogCatMessages = filterLogCatMessages(logCatMessages); logCatWriter.writeLogs(test, filterLogCatMessages); }
25619981_1
@Override public String getSupportedReferenceImplementation() { return "Jersey"; }
25623941_13
boolean isSatisfied() { return this.satisfied == req.getResourceCount(); }
25623942_4
@Override public void saveInternal(final CasEvent event) { SyncopeClient syncopeClient = waRestClient.getSyncopeClient(); if (syncopeClient == null) { LOG.debug("Syncope client is not yet ready to store audit record"); return; } LOG.info("Saving Cas events"); try { Map<Strin...
25650668_1
protected static byte getByte(BsonType bsonType) throws NettyBsonReaderException { switch (bsonType) { case DOUBLE: return 0x01; case STRING: return 0x02; case DOCUMENT: return 0x03; case ARRAY: return 0x04; case BINARY: return 0x05; case UNDEFINED: return 0...
25688387_3
private void report(MData mData) { int size = queue.size(); if (size >= MAX_RETRY_RETAIN) { int needRemoveSize = size - (MAX_RETRY_RETAIN - 1); for (int i = 0; i < needRemoveSize; i++) { queue.poll(); } } queue.add(mData); final List<Node> monitorNodes = appCon...
25706873_16
public static byte[] byteStringToArray(String str) { byte[] result = new byte[str.length()]; for (int i = 0; i < str.length(); i++) { char c = str.charAt(i); if (c > 0xFF) throw new IllegalArgumentException("Character value outside of byte range"); result[i] = (byte)c; } return result; }
25712818_3
public static Class<?> getGenericClassOfList(Class<?> type, Type listGenericClass) { if(type.isArray()) { return type.getComponentType(); } if (listGenericClass instanceof ParameterizedType) { for (Type typeArgument : ((ParameterizedType) listGenericClass).getActualTypeArguments()) { retu...
25722021_7
public static <T> ChoiceOfTwoLoadBalancer<T> create(final Comparator<T> func) { return new ChoiceOfTwoLoadBalancer<T>(func); }
25732604_117
public List<Integer> listFiles(String path, boolean recursive) throws InvalidPathException, FileDoesNotExistException { List<Integer> ret = new ArrayList<Integer>(); synchronized (mRoot) { Inode inode = getInode(path); if (inode == null) { throw new FileDoesNotExistException(path); } if (...
25740109_9
public boolean contains(Number value) { return value.doubleValue() >= minVal.doubleValue() && value.doubleValue() <= maxVal.doubleValue(); }
25823015_88
protected AsyncTaskExecutor getTaskExecutor() { return this.taskExecutor; }
25857692_1
public void insertWordCount(String tablename, String word, int count) { try (SqlSession sqlSession = sqlSessionFactory.openSession();) { WordCountDao wordCountDao = sqlSession.getMapper(WordCountDao.class); wordCountDao.insertWordCount(new InsertWordCount(tablename, word, count)); sqlSession.commit(); } }
25858016_0
@Override public void run() { parent.usage(); }
25873783_80
JoinTable(String sourceTable, String alias, String... columns) { checkArgument(!Strings.isNullOrEmpty(sourceTable), "You must specify a 'sourceTable'."); checkArgument(!Strings.isNullOrEmpty(alias), "You must specify a 'alias'."); this.sourceTables = Maps.newLinkedHashMap(); this.sourceColumns = Maps.newLinkedHash...
25889832_0
@Override public String format(LogRecord record) { Instant timestamp = Instant.ofEpochMilli(record.getMillis()); StringWriter out = new StringWriter(); // Write using a simple JsonWriter rather than the more sophisticated Gson as we generally // will not need to serialize complex objects that require i...
25891103_0
public static Path exportSubgraphToHDFS(GraphDatabaseService db) throws IOException, URISyntaxException { FileSystem fs = FileUtil.getHadoopFileSystem(); Path pt = new Path(ConfigurationLoader.getInstance().getHadoopHdfsUri() + EDGE_LIST_RELATIVE_FILE_PATH.replace("/{job_id}", "")); BufferedWriter br = new ...
25900801_1
public static DhcpV6Message handleMessage(InetAddress localAddress, DhcpV6Message dhcpMessage) { DhcpV6Message replyMessage = null; if (dhcpMessage instanceof DhcpV6RelayMessage) { if (dhcpMessage.getMessageType() == DhcpConstants.V6MESSAGE_TYPE_RELAY_FORW) { DhcpV6RelayMessage relayMessage = (Dhc...
25916153_0
public static int sendMail(String subject, String content, String mails, String cc) throws MessagingException { Properties props = new Properties(); props.put("mail.smtp.host", HOST); props.put("mail.smtp.starttls.enable", "true"); // props.put("mail.smtp.port", "25"); props.put("mail.smtp.auth", "true"); // p...
25962820_2
@NonNull public String getName() { if (name == null) { boolean first = true; StringBuilder sb = new StringBuilder(); for (ProductFlavor flavor : flavorList) { if (first) { sb.append(flavor.getName()); first = false; } else { ...
25968648_46
@Override public Point getGeometry() { return (Point) simpleFeature.getDefaultGeometry(); }
25979437_90
@Override public void delete(String sessionId) { this.sessions.remove(sessionId); }
26027834_1
@Override public EvictionRunEvent beginPageEvictions( int expectedEvictions ) { long evictionRunId = evictionRunCounter.incrementAndGet(); JfrEvictionRunEvent event = new JfrEvictionRunEvent( evictionEventStarter ); event.begin(); event.setExpectedEvictions( expectedEvictions ); event.setEvictionRu...
26036945_0
public static RoboRouter getInstance() { if(sInstance == null) { throw new IllegalStateException("RoboRouter not initialized, did you call RoboRouterBuilder in your Application class?"); } return sInstance; }
26057756_10
public static void deleteDir(Path dir, DeleteVisitor visitor) { try{ if(Files.exists(dir) && Files.isDirectory(dir)) { Files.walkFileTree(dir, visitor); } } catch (IOException e) { throw new RuntimeException(e); } }
26065781_2
;
26072381_3
Collection<String> getResourceFiles(final Iterable<? extends FileSet> fileSets, final boolean followLinks, final boolean allowDuplicates, final boolean allowFiles, final boolean allowDirs) throws MojoExecutionException { final Set<String> result = new LinkedHashSet<>(); for (final FileSet fileSet : Objects...
26088168_0
public LineIterator (String str) { this.str = str; this.strLength = str.length();; while (strLength > 0 && Character.isWhitespace(str.charAt(strLength - 1))) { --strLength; } }
26088996_0
public Node getContainerDefinitionAsXml() { Document containerDocument = DomManipulation.createDocumentFromContainerTemplate(); // we can get directly the properties since template only set one container element final NodeList properties = containerDocument.getElementsByTagName("property"); final Elem...
26090373_19
public static OTPAuthURIBuilder fromUriString(String uri) { Preconditions.checkNotNull(uri); Matcher m = OTP_AUTH_URI_PATTERN.matcher(uri); if (!m.matches()) { throw new IllegalArgumentException("[" + uri + "] is not a valid OTP Auth URI"); } final OTPType otpType = OTPType.from(m.group(2).t...
26094155_5
@Override public void run() { Log.debug("Message pooling starts ..."); // is there message for processing? Message msg = null; int lockFailureCount = 0; while (true) { try { msg = messagesPool.getNextMessage(); if (msg != null) { LogContextHelper.set...
26125896_0
@Override public Result processType(Type javaType, Context context) { if (Objects.equals(javaType, Object.class)) { return new Result(TsType.Any); } if (javaType instanceof Class) { final Class<?> javaClass = (Class<?>) javaType; if (isAssignableFrom(known.stringClasses, javaClass)) ...
26127972_0
public Bundler put(String key, boolean value) { delegate.putBoolean(key, value); return this; }
26136655_58
public boolean containsValue(final int value) { boolean found = false; if (value != missingValue) { @DoNotSub final int length = entries.length; @DoNotSub int remaining = size; for (@DoNotSub int valueIndex = 1; remaining > 0 && valueIndex < length; valueIndex += 2) { ...
26172294_0
public void generateArchetypes(String containerType, File baseDir, File outputDir, boolean clean, List<String> dirs) throws IOException { LOG.debug("Generating archetypes from {} to {}", baseDir.getCanonicalPath(), outputDir.getCanonicalPath()); File[] files = baseDir.listFiles(); if (files != null) { ...
26177368_34
public void updateLongBE(long value) { updateLongLE(Long.reverseBytes(value)); }
26193137_1
static public Assembly process(Path archiveFile) throws IOException { Path tempDir = Files.createTempDirectory("stork-deploy."); CloseablePath closeablePath = new CloseablePath(tempDir); return process(archiveFile, tempDir, Arrays.asList(closeablePath)); }
26238360_29
@Override public Boolean convert( String aValue ) throws SdiException { if ( !StringUtils.hasText( aValue ) ) { myLog.debug( "Given value is null" ); return null; } String value = aValue.trim().toLowerCase(); if ( trueValues.contains( value ) ) { return Boolean.TRUE; ...
26262349_108
@Override public int getID() { return this.id; }
26282952_7
public static <T> int singleIndexOf(Collection<T> items, Predicate<T> predicate) { int result = NOT_FOUND_INDEX; if (!isEmpty(items)) { int index = 0; for (T item : items) { if (predicate.apply(item)) { if (result == NOT_FOUND_INDEX) { result = in...