id
stringlengths
7
14
text
stringlengths
1
37.2k
3430789_14
public Namespace child(List<String> values) { ImmutableList<String> child = ImmutableList.<String>builder().addAll(this.values).addAll(values).build(); return Namespace.of(child); }
3432124_28
@Override lic final int compareTo( final XTime<F> other) { LOGGER.trace("begin {}.compareTo({})", new Object[] { getClass().getSimpleName(), other }); final int rval; if (other == null) { throw new NullPointerException("cannot compare to a null"); } rval = new Compar...
3433581_0
public static void loadAll() { for (AvailableFonts f : AvailableFonts.values()) { load(f); } }
3438153_3
public SCIMConfig buildConfigFromInputStream(InputStream inStream) throws CharonException { try { StAXOMBuilder omBuilder = new StAXOMBuilder(inStream); OMElement rootElement = omBuilder.getDocumentElement(); if (inStream != null) { inStream.close(); } return buil...
3440013_1
public EpsilonNetwork(){ nodeSelector = new NodeSelector(); network = new Network(); / processedTriples = Collections.synchronizedList(new ArrayList<Triple>()); processedTriples = new ArrayList<Triple>(); gcTokens = new Hashtable <Triple, List<Token>> (); }
3443799_38
public void checkout(Cart cart, PaymentDetails paymentDetails, boolean notifyCustomer) { if (paymentDetails.paymentMethod == PaymentMethod.CreditCard) chargeCard(paymentDetails, cart); reserveInventory(cart); if (notifyCustomer) notifyCustomer(cart); }
3444675_9
protected String buildScopeString() { StringBuilder sb = new StringBuilder(); if (scope.contains(Scope.FLATTR )) sb.append(" flattr"); if (scope.contains(Scope.THING )) sb.append(" thing"); if (scope.contains(Scope.EMAIL )) sb.append(" email"); if (scope.contains(Scope.EXTENDEDREAD...
3447638_7
@Override public FieldMapping createFieldMapping(EntitySchemaFactory schemaFactory, Class<?> entityType, String csvFieldName, String objFieldName, Class<?> objFieldType, boolean required) { return new DateTimeFieldMapping(entityType, csvFieldName, objFieldName, required); }
3449807_27
public List<VertexClass> sort() // toplogical sort { while (numVerts > 0) // while vertices remain, { // get a vertex with no successors, or -1 int currentVertex = noSuccessors(); if (currentVertex == -1) // must be a cycle { throw new IllegalStateException("BuildType...
3452904_920
@Override public void audit(String principal, String category, String message, SoapEdgeContext properties) { AuditEvent event = new AuditEvent(category, message); if (properties == null) { getAuditor().audit(principal, event); } else { getAuditor().audit(principal, event, getContexts(prope...
3454599_2
public static List<String> split(String str, String separator) { if (str == null) { throw new IllegalArgumentException("cannot split null string"); } if (separator == null) { throw new IllegalArgumentException("separator cannot be null"); } if (separator.isEmpty()) { throw new IllegalArgumentExcep...
3456296_4
@Override public ValueResult resolve(MethodParameter methodParameter, List<String> wordsBuffer) { String prefix = prefixForMethod(methodParameter.getMethod()); List<String> words = wordsBuffer.stream().filter(w -> !w.isEmpty()).collect(Collectors.toList()); CacheKey cacheKey = new CacheKey(methodParameter.getMetho...
3460824_46
public static <T extends Enum<T>> Pattern createValidationPatternFromEnumType(Class<T> enumType) { String regEx = Stream.of(enumType.getEnumConstants()) .map(Enum::name) .collect(Collectors.joining("|", "(?i)", "")); //Enum constants may contain $ which needs to be escaped regEx = ...
3468420_206
@Override public void addObjectAt(RoadUser obj, Point pos) { if (obj instanceof MovingRoadUser) { checkArgument(!isOccupied(pos), "Cannot add an object on an occupied position: %s.", pos); blockingRegistry.addAt((MovingRoadUser) obj, pos); } super.addObjectAt(obj, pos); }
3471752_7
@NotNull public static String computeSha256Hash(@NotNull final byte[] bytes) throws NoSuchAlgorithmException { return computeHash(bytes, "SHA-256"); }
3472718_65
@Override ;
3477759_76
@RequestMapping(params = "resume", method = RequestMethod.GET) public String resumeGame(Model model) { timerService.resume(); return getAdminPage(model); }
3510405_18
public void setFullUrl(String fullUrl) { this.fullUrl = fullUrl; }
3513191_127
public ReportData getDetailedReportData(ReportCriteria reportCriteria) { return getReportData(reportCriteria); }
3513261_56
public String getProvisioningProfile() { return getSettings().getAllSettings().get(Settings.ManagedSetting.PROVISIONING_PROFILE.name()); }
3523632_78
public static int hashCode(Object... objects) { return Arrays.hashCode(objects); }
3526892_12
static public Double calculateLabelCost(String calcLabel, Map<String, Double> labelProbabilities, CostMatrix<String> costMatrix) { if (calcLabel == null) { return Double.NaN; } double sum = 0.; for (String label: costMatrix.getKnownValues()) { double cost = costMatrix.getCost(label, calcLabel); double prob ...
3536819_44
@Nullable @Override public Object getPropertyUnchecked(@NotNull String name) { try { return getProperty(name); } catch (Exception e) { return null; } }
3548254_1
public static String convertToWktString(Geoshape fieldValue) throws BackendException { if (fieldValue.getType() == Geoshape.Type.POINT) { Geoshape.Point point = fieldValue.getPoint(); return "POINT(" + point.getLongitude() + " " + point.getLatitude() + ")"; } else { throw new PermanentBa...
3551455_26
public static <T> Function<List<T>, T> firstOfList() { return list -> list.get(0); }
3555504_32
public byte[] getBuffer() { int length = getUnsignedInt(); if (pointer + length > data.length) { throw new IndexOutOfBoundsException("Not enough data"); } if (length == 0) { return new byte[0]; } if (length == -1) { return null; } byte[] ret = Helper.copyOfRange(...
3570915_4
public static int[] parseToHourAndMinutes(final String timeString) throws ParseException { String time = timeString; time = Strings.nullToEmpty(time).trim(); if (time.length() == 0) { throw new ParseException("String is empty", 1); } time = normalize(time); String[] splitt...
3580492_6
public void nextCycle() throws GameOfLifeException { // We initialize the next state as a x + 1, y + 1 of current state // We do this so next cells can be born around past state emptyMatrix(auxMatrix, MAX_X, MAX_Y); for(int i = 0; i < MAX_X; i++) { for(int j = 0; j < MAX_Y; j++) { if(matrix[i][j] == 1) { i...
3590026_7
public ServiceMethodHandler getServiceMethodHandler(String methodName, String version) { return serviceHandlerMap.get(ServiceMethodHandler.methodWithVersion(methodName, version)); }
3590271_2
public static PluginManager getInstance() { if (ourInstance == null) { ourInstance = new PluginManager(); } return ourInstance; }
3595727_12
public void postProcessGeneratedCode(@Nonnull final CodeGeneratorContext context) { postProcessGeneratedCode( context.getCompileUnit(), context.getCodePackage(), context.getGeneratedClass(), ...
3603171_2
CloseableHttpClient getHttpClient(final ProxyConfiguration proxyConfiguration, final HttpClientConfiguration httpClientConfiguration) throws SmartlingApiException { HttpClientBuilder httpClientBuilder = getHttpClientBuilder(); if (hasActiveProxyConfiguration(proxyConfiguration)) { HttpHost proxyHos...
3610576_0
@Override public int run(String[] args) throws Exception { if(args.length != 2) { System.out.println("Invalid number of arguments\n\n" + "Usage: IdentityJob <input_path> <output_path>\n\n"); return -1; } String input = args[0]; String output = args[1]; FileSystem.get(conf).delete(new Path(output), true); TupleMR...
3616673_8
@Override public List<C10NUnit> inspect(String... packagePrefixes) { List<C10NUnit> res = new ArrayList<>(); @SuppressWarnings("deprecation") C10NMsgFactory c10NMsgFactory = C10N.createMsgFactory(configuredC10NModule); Set<Class<?>> c10nInterfaces = c10NInterfaceSearch.find(C10NMessages.class, package...
3628180_31
public User getUserByUsername(String username) { User currentUser = authenticationService.getCurrentUser(); String domain = DomainUtil.getDomainFromLogin(currentUser.getLogin()); String login = DomainUtil.getLoginFromUsernameAndDomain(username, domain); return getUserByLogin(login); }
3644569_17
public Fields extractFields(Class<?> type) { if (type == null) { throw new NullPointerException("Cannot extract entity mapping, type is null!"); } final Entity entityAnnotation = type.getAnnotation(Entity.class); if (entityAnnotation == null) { throw new MappingException(type, "not annotated with @Entity, canno...
3645037_2
@Override public String retrieve(final String proxyGrantingTicketIou) { if (CommonUtils.isBlank(proxyGrantingTicketIou)) { return null; } final ProxyGrantingTicketHolder holder = this.cache.get(proxyGrantingTicketIou); if (holder == null) { logger.info("No Proxy Ticket found for [{}]."...
3649012_0
public Class<?> getClassDecorator(Class<? extends Annotation> clazzPositionalFieldAnnotation){ if (!isFFPojoAnnotationField(clazzPositionalFieldAnnotation)){ throw new FFPojoException(String.format("The class %s not seem a DelimitedField or PositionalField annotation.", clazzPositionalFieldAnnotation)); ...
3655926_5
static String extractPersistentId(URI objURI) { String URIstr = objURI.toString(); Matcher m = genericURIpattern1Pat.matcher(URIstr); if (m.matches()) { return m.group(1); } else { return null; } }
3657930_2715
public static boolean isNodeType(Tree tree, String typeName, Tree typeRoot) { String primaryName = TreeUtil.getName(tree, JCR_PRIMARYTYPE); if (typeName.equals(primaryName)) { return true; } else if (primaryName != null) { Tree type = typeRoot.getChild(primaryName); if (contains(getN...
3661343_12
public <KeyT> Map<KeyT, ValueT> groupUnique(Function<ValueT, KeyT> keyExtractor) { Map<KeyT, ValueT> groupedEntities = new HashMap<>(); for (ValueT value : collection) { final KeyT key = keyExtractor.apply(value); if (groupedEntities.get(key) != null) { throw new DuplicateElementExce...
3662576_1
public static VaadletsBuilder build(final com.mymita.vaadlets.core.Component aComponent) { final VaadletsBuilder builder = new VaadletsBuilder(); builder.create(aComponent); return builder; }
3664810_0
@RequestMapping(value = BASE_MAPPING + "/{id}", method = RequestMethod.GET) public ResponseEntity<EntityModel<?>> getItemResource(RootResourceInformation resourceInformation, @BackendId Serializable id, final PersistentEntityResourceAssembler assembler, @RequestHeader HttpHeaders headers) throws HttpRequestMethodNo...
3669065_21
static byte[] encodeLength(int len) { if (len < 0) { throw new IllegalArgumentException("length is negative"); } else if (len >= 16777216) { throw new IllegalArgumentException("length is too big: " + len); } byte[] res; if (len < 128) { res = new byte[1]; res[0] = (by...
3674743_1
@Override public int getDiscardedBucketsCount() { return outputStream.getDiscardedBucketCount(); }
3687614_23
public static EmbedVaadinComponent forComponent(Component component) { return new EmbedVaadinComponent(component); }
3690150_69
public String pageLink(String providerName, String pageName) { return pageLink(providerName, pageName, null); }
3691193_14
@Transactional public void setComponentState(String componentId, ComponentType type, boolean enabled) { log.debug("Setting Component State : componentId = " + componentId + " type = " + type + " enabled " + enabled); ComponentState componentState; synchronized (lockObject) { componentState = getCom...
3699746_62
@Override protected void doStop() throws Exception { ServiceHelper.stopService(processor); services.stopTracking(); super.doStop(); }
3706353_2
@Override public NutchDocument filter(NutchDocument doc, Parse parse, Text url, CrawlDatum datum, Inlinks inlinks) throws IndexingException { // Prepare data String realUrl = new String(url.getBytes()).substring(0, url.getLength()); Metadata metadata = parse.getData().getParseMeta(); if (omitIndexingFilterConfigu...
3710234_51
public List<RobotLine> lex() throws CoreException { try { System.out.println("Lexing " + filename); CountingLineReader contents = new CountingLineReader(filestream); String line; int lineNo = 0; int charPos = 0; while (null != (line = contents.readLine())) { ...
3713233_87
public ClassMeta extract(String sourceCodeString) { Assertion.on("sourceCodeString").mustNotBeNull(sourceCodeString); ClassMeta meta = new ClassMeta(); String modifiedSourceCodeString = TrimFilterUtil.doAllFilters(sourceCodeString); // ----------------- // package name Matcher matcherGrouping...
3713238_183
@Override public Symbol execute(RhsFunctionContext context, List<Symbol> arguments) throws RhsFunctionException { RhsFunctions.checkAllArgumentsAreNumeric(getName(), arguments); RhsFunctions.checkArgumentCount(this, arguments); final SymbolFactory syms = context.getSymbols(); Symbol arg = argu...
3722315_4
@Override public String getLocationUrl(Location location, PortletRequest request) { try { final String encodedLocation = URLEncoder.encode(location.getIdentifier(), "UTF-8"); return portalContext.concat("/s/location?id=").concat(encodedLocation); } catch (UnsupportedEncodingException e) { ...
3724388_103
public static ByteBuffer readByteBuffer(URL url) throws IOException { ByteBuffer byteBuffer = null; if (URLUtil.isForResourceWithExtension(url, "zip")) { //try opening the file as a zip file; if this fails, log a warning and read file directly into the buffer InputStream is = null; try { is = url.openStre...
3726486_7
public HashCalculationResult calculateSuperHash(File file) throws IOException { // Ignore files smaller than 0.5kb long fileSize = file.length(); if (fileSize <= FILE_MIN_SIZE_THRESHOLD) { logger.debug("Ignored file " + file.getName() + " (" + FileUtils.byteCountToDisplaySize(fileSize) + "): minimum...
3728202_22
protected void setResultOptions(AbstractEntry entry, Integer count, Integer startIndex, String sortBy) { entry.setFiltered(false); entry.setSorted(sortBy != null); if (sortBy != null) { entry.sortEntryCollection(sortBy); } entry.setUpdatedSince(false); int entrySize = entry.getEntrySize(); entry.setTo...
3728381_27
public byte[] encodeSingle(Record record) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); encodeSingle(record, baos); return baos.toByteArray(); }
3732883_60
@Override public NodePath getNodePath() { String name = getName(); ApiNode parent = context.getParentNode(); NodePath path = isRoot() ? NodePath.root() : NodePath.path(name); if (parent != null) { path = parent.getNodePath().append(path); } return path; }
3742298_2
public void collate(DiffCollatorConfiguration config, Comparand base, Comparand witness) throws IOException { // This amounts to a config for the diff/collation Comparison comparison = new Comparison(base, witness); // First find an filter out any transpositions and collate // the filtered result ...
3742443_2
@Override public Group.Element<Gq> getIdentityElement() { return element(BigInteger.ONE); }
3743376_249
void setLogo(Bitstream logo) { this.logo = logo; setModified(); }
3743505_14
public List<Entry> search(String path, String query, int fileLimit, boolean includeDeleted) throws DropboxException { assertAuthenticated(); if (fileLimit <= 0) { fileLimit = SEARCH_DEFAULT_LIMIT; } String target = "/search/" + session.getAccessType() + path; String[] params = { ...
3744706_7
public InputStream getResourceAsStream(String name) throws IOException { if (name.startsWith("classpath:")) return openClasspathResource(name); else if (name.startsWith("file:")) return openFileResource(name); else return openWarResource(name); }
3748867_0
@SuppressWarnings("unchecked") public G readGraph() throws GraphIOException { try { // Initialize if not already. init(); while (xmlEventReader.hasNext()) { XMLEvent event = xmlEventReader.nextEvent(); if (event.isStartElement()) { StartElement ele...
3750999_3
public XingProfile getUserProfile() { return getProfileById("me"); }
3756907_0
public BackoffSleeper(long minWait, long maxWait, double backoffMultiplier) { if (minWait <= 0) { throw new IllegalArgumentException("Minimum wait must be at least 1 ms"); } if (maxWait <= minWait) { throw new IllegalArgumentException("Maximum wait must be greater than minimum wait")...
3765814_1
public static <T> T getOtherAttribute(Map<QName, String> otherAttributes, String attributeName) { T otherAttribute = null; for (QName qname : otherAttributes.keySet()) { String value = otherAttributes.get(qname); String key = qname.getLocalPart(); LOG.debug("Attribute: " + key + " : " + ...
3772264_10
@Override public void report(SortedMap<String, Gauge> gauges, SortedMap<String, Counter> counters, SortedMap<String, Histogram> histograms, SortedMap<String, Meter> meters, SortedMap<String, Timer> timers) { final long timestamp = clock.get...
3781210_16
public UserCredentials createUser() { return createUser(null); }
3787360_8
public static String unescapeHeader(String string) { if (string == null) return string; string = string.replace("\\n", "\n"); string = string.replace("\\c", ":"); string = string.replace("\\\\", "\\"); return string; }
3798663_0
@Override public Object execute(Object[] parameters) { Object parameterObject = parametersParsing(parameters); if (StatementType.SELECT.equals(statementType)) { if (!queryMethod.isPageQuery() && !queryMethod.isCollectionQuery()) { return template.queryForObject(queryMethod.getNamedQueryName(), param...
3806452_12
public static String getCurrentJavaVirtualMachineSpecificationVersion() { return System.getProperty("java.vm.specification.version", "1.8"); }
3808230_16
@Override public boolean deleteDocumentFile(DatabaseDocument<T> d, String fileName) { return writer.deleteDocumentFile(d, fileName); }
3817774_2
@Override public Request request(String subject, long timeout, TimeUnit unit, MessageHandler... messageHandlers) { return request(subject, "", timeout, unit, messageHandlers); }
3833897_2
public <T extends AbstractDomainObject> T allocateObject(Class<T> objClass, Object oid) { if (objClass == null) { throw new RuntimeException("Cannot allocate object '" + oid + "'. Class not found"); } if (Modifier.isAbstract( objClass.getModifiers() )) { throw new RuntimeException("Cannot al...
3836962_11
static Double ToNumber(Object arg) { if (arg == null) { return 0.0d; } else if (Boolean.TRUE.equals(arg)) { return 1.0d; } else if (Boolean.FALSE.equals(arg)) { return 0.0d; } else if (arg instanceof String) { return ToNumber((String) arg); } else if (arg instanceof Number) { return ((Number) arg).do...
3842880_1
@Override public void run(IProgressMonitor monitor) { Date startTime = new Date(); // Prepare data matrix to combine IMatrix data = analysis.getData().get(); // Dimension to combine using the module map MatrixDimensionKey combineDimension = (analysis.isTransposeData() ? ROWS : COLUMNS); // D...
3847504_139
public SearchQuery withPathPrefix(String path) { clearExpectations(); if (path.endsWith("/")) path = path.substring(0, path.length() - 1); this.pathPrefix = path; if (pathPrefix == null) throw new IllegalArgumentException("Path prefix must not be null"); if (!pathPrefix.startsWith(WebUrl.separator)) ...
3854292_5
@GetMapping("/") public String index(Authentication authentication) { return authentication == null ? "index" : "redirect:/user.html"; }
3859251_23
@Override public synchronized Object remove(final Object key) { final Object def = preWrite(key); final Object man = super.remove(key); return man == null ? def : man; }
3869967_60
@Override public <S extends AppSession> S add(final S appSession) { Preconditions.checkNotNull(appSession, "Cannot add null AppSession"); Preconditions.checkNotNull(appSession.getId(), "Cannot add AppSession with null ID"); log.info("Insert AppSession {} for {} with User Agent: {} (dated: {})", appSession.getId()...
3885169_5
public boolean verifyPassword(String password) { return new BasicPasswordEncryptor().checkPassword(password, this.password); }
3894929_2
public HasXPath(String xPathExpression, Matcher<String> valueMatcher) { this(xPathExpression, NO_NAMESPACE_CONTEXT, valueMatcher); }
3900538_7
@Override public Decoded<List<String>> decode(Event type, String message) { if (type.equals(Event.MESSAGE)) { if (skipFirstMessage.getAndSet(false)) return empty; Decoded<List<String>> messages = new Decoded<List<String>>(new LinkedList<String>()); message = messagesBuffer.append(message)....
3910894_1
@Override public final Collection<Song> getAllSongs() throws IOException, URISyntaxException { final Collection<Song> chunkedCollection = new ArrayList<Song>(); // Map<String, String> fields = new HashMap<String, String>(); // fields.put("json", "{\"continuationToken\":\"" + continuationToken + ...
3913468_1
@Override public Map<String,String> getProperties() { Map<String,String> envVars = System.getenv(); if (!Collections.isEmpty(envVars)) { return new LinkedHashMap<String, String>(envVars); } return java.util.Collections.emptyMap(); }
3933009_4
@Override public boolean hasPermission(Identity userIdentity, Group group) { if (userACL.getSuperUser().equals(userIdentity.getUserId()) || userIdentity.getMemberships() .stream() .anyMatch(userMembership -> userMembership.getGroup().equals(userACL.getAdminGroups()))) {...
3934425_27
public static String getPathOnly(String fullPath) { if (fullPath == null || fullPath.isEmpty()) return fullPath; int index = fullPath.indexOf('?'); if (index == -1) { index = fullPath.indexOf('#'); return index == -1 ? fullPath : fullPath.substring(0, index); } return fullPath.substr...
3935296_8
@SuppressWarnings("unchecked") public static List<String> getUserPermission(String[] userGroupMembership) throws Exception { List<String> users = getFromCache(userGroupMembership); if (users != null) { return users; } users = new ArrayList<String>(); if (userGroupMembership == null || userGroupMembership...
3935748_24
public boolean hasPermission(Identity userIdentity, Group group) { Collection<MembershipEntry> userMemberships = userIdentity.getMemberships(); return userACL.getSuperUser().equals(userIdentity.getUserId()) || userMemberships.stream() .anyMatch(userMembership -> userMembership.getGroup...
3937364_5
public boolean mustSkipAccountSetup() { if (skipSetup == null) { SettingValue accountSetupNode = settingService.get(Context.GLOBAL, Scope.GLOBAL, ACCOUNT_SETUP_NODE); String propertySetupSkip = PropertyManager.getProperty(ACCOUNT_SETUP_SKIP_PROPERTY); if (propertySetupSkip == null) { LOG.debug("Pro...
3943003_2
public String filePathFromURL(URL url) { if (url == null) { throw new IllegalArgumentException("url is null"); } // Old solution does not deal well with "<" | ">" | "#" | "%" | // <"> "{" | "}" | "|" | "\" | "^" | "[" | "]" | "`" since they may occur // inside an URL but are prohibited for an URI. See ...
3946094_2
@Override public String sayHello() { Pojo pojo = new Pojo(); pojo.version(); return "Hello"; }
3951979_0
protected List<DataPoint> downsample(long duration, Aggregator aggregator, List<DataPoint> points) { List<DataPoint> result = Lists.newArrayList(); int offset = 0; long maxSampleTimestamp = 0; for (int i = 0; i < points.size(); i++) { DataPoint dataPoint = points.get(i); if (dataPoint.getTimestamp() >...
3978781_357
@NonNull public static <T> LiveData<T> fromPublisher(@NonNull Publisher<T> publisher) { return new PublisherLiveData<>(publisher); }
3988459_66
public boolean isHttpOnly() { return httpOnly == null ? false : httpOnly; }
3993813_9
public static FindResult findNextRecord(UUID delimiter, ByteBuffer source) { final byte hook = RECORD_DELIMITER_PREFIX[0]; if (source.hasRemaining()) { do { if (source.get() == hook) { int originalSourcePosition = source.position(); source.position(originalSo...
3996100_2
@Override public String key() { return "camel"; }
3999381_29
@Override public int findShortestWord(CharSequence chars, int start, int end, StringBuilder word) { for(int i = start; i < end; i++){ Iterator<String> it = commonPrefixSearch(chars.subSequence(i, end).toString()).iterator(); /* if(it.hasNext()){ if(word != null) word.append(it.next()); return i; } */ int...