id
stringlengths
7
14
text
stringlengths
1
37.2k
2213380_0
public double calculateRisk(double baselineSurvival) { return calculateRisk(baselineSurvival, linearPredictor()); }
2221963_20
public void h3() { delegate.h3(); }
2254694_7
public Converter<?> getConverter(Class<?> type, Annotation[] annotations) { for (ConverterFactory factory : factories) { Converter<?> converter = factory.createConverter(type, annotations); if (converter != null) { return converter; } } throw new NoConverterException(typ...
2259237_53
protected void populateServiceAlerts(Set<String> serviceAlertDescriptions, List<ServiceAlertBean> serviceAlertBeans) { populateServiceAlerts(serviceAlertDescriptions, serviceAlertBeans, true); }
2271327_0
public static LoadableDetachableModel loadedModel(final Object bean, final String loadMethod) { // assert that method exists ReflectUtils.getZeroArgMethod(bean.getClass(), loadMethod); return new LoadableDetachableModel() { @Override protected O...
2272670_4
@Factory public static Matcher<Object> isApproved() throws IOException { final StackTraceElement trace = StackUtils .getCallingTestMethodStackTraceElement(); final String methodName = trace.getMethodName(); final String className = getClassName(trace); final Class<?> clazz = getClassObject(t...
2287347_24
public List<AggregatedSegment> aggregateSegments(List<? extends ConnectableSegment> segments) { List<AggregatedSegment> aggregatedSegments = new ArrayList<AggregatedSegment>(); for (Iterator<? extends ConnectableSegment> it = segments.iterator(); it.hasNext();) { ConnectableSegment segment = it.next(); Aggregate...
2293442_5
public static String toOID(UUID uuid) { return toOID(uuid, OID_ROOT); }
2296450_8
static void populateDataIndexFromAnnotations(final AnnotationData data, final Class expectedAnnotationClass, final Method targetMethod) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException { if (!UPDATES.c...
2304277_106
public static String getMetadataInstance(final String metadataId) { if (isIdentifyingInstance(metadataId)) { return metadataId.substring(metadataId.indexOf(INSTANCE_DELIMITER) + 1); } return null; }
2306348_0
public String sayHello( String who ) { return "Hello " + who; }
2306900_3
@Override public List<String> getAddressesForApplication(String jid) { return delegateStore.getAddressesForApplication(jid); }
2311431_0
public final int orientation(Vertex a, Vertex b, Vertex c) { double result = Geometry.leftOfPlane(a.x, a.y, a.z, b.x, b.y, b.z, c.x, c.y, c.z, x, y, z); if (result > 0.0) { return 1; } else if (result < 0.0) { return -1; } return 0; }
2316136_86
public AggregationType getAggregateType() { return aggregateType; }
2316191_151
public SerializedResultSet doPreview( String connectionName, String query, String previewLimit ) throws DatasourceServiceException { if ( !hasDataAccessPermission() ) { logger.error( Messages.getErrorString( "DatasourceServiceImpl.ERROR_0001_PERMISSION_DENIED" ) ); //$NON-NLS-1$ throw new DatasourceServiceE...
2316200_293
public void closeChangePasswordDialog() { zkHelper.findComponent(CHANGE_PASSWORD_DIALOG).detach(); }
2316202_113
public Integer getNewPmCountFor(String username) { Element cacheElementForUser = userDataCache.get(username); if (cacheElementForUser == null) { return null; } return (Integer) cacheElementForUser.getValue(); }
2335594_25
public CheckStylePluginException wrap(@Nullable final String message, @NotNull final Throwable error) { final Throwable root = rootOrCheckStyleException(error); final String exMessage = ofNullable(message).orElseGet(root::getMessage); if (isParseException(root)) { return new CheckStylePluginParseEx...
2341027_0
@Override public int readTo(DecoderAdapter dest, String encoded, MessageParamField field ) { int decodedValue = IntegerEncoded.parseInt(encoded, radix); dest.putInt(field.dbFieldName, decodedValue); return 1; }
2349183_21
public static TaskId toTaskID(String tid) { Iterator<String> it = _split(tid).iterator(); return toTaskID(TASK, tid, it); }
2349728_0
public static Repository eventRepoToRepo(GitHubEvent.RepoIdentifier repo) { String[] ref = repo.repoWithUserName().split("/"); return InfoUtils.createRepoFromData(ref[0], ref[1]); }
2357859_654
@Override public void filter(DocumentIndexingPackage dip) throws IndexingException { log.debug("Performing set access status filter on {}", dip.getPid()); dip.getDocument().setStatus(determineAccessStatus(dip)); }
2364987_147
@Override public void orFallBackTo(Runnable defaultClosure) { defaultClosure.run(); }
2383782_393
public String parse(Element root) { return parseWithName(root, null); }
2389245_26
public static void renameCascadingParentLinks(final String oldName, final String newName) throws IOException { if (StringUtils.isBlank(newName) || StringUtils.isBlank(oldName)) { return; } for (Job job : Hudson.getInstance().getAllItems(Job.class)) { if (oldName.equals(job.getCascadingProjec...
2394379_79
@Override public boolean matches(Document document, Document query) { for (String key : query.keySet()) { Object queryValue = query.get(key); validateQueryValue(queryValue, key); if (!checkMatch(queryValue, key, document)) { return false; } } return true; }
2397476_0
public DateTime getValue() { return value; }
2403733_3
public PromoteKeyResult execute(long masterKeyId, byte[] cardAid, long[] subKeyIds) { OperationLog log = new OperationLog(); log.add(LogType.MSG_PR, 0); // Perform actual type change UncachedKeyRing promotedRing; { try { log.add(LogType.MSG_PR_FETCHING, 1, ...
2408915_45
public int getResourceId(Context context) { int resourceId = context.getResources().getIdentifier( resourceName, resourceType, hasResourcePackage() ? resourcePackage : context.getPackageName()); checkResource(resourceId); return resourceId; }
2416378_14
public boolean inherits(ASTType astType, ASTType inheritable) { if (astType == null) { return false; } if(inheritable == null || inheritable.equals(OBJECT_TYPE)){ return true; } if (astType.equals(inheritable)) { return true; } for (ASTType typeInterfaces : astType.ge...
2422006_24
public void shutdown() { keepRunning = false; thread.interrupt(); try { thread.join(); } catch (InterruptedException e) { logger.error("Error shutting down thread with hook", e); } }
2425139_0
@Name("insert") @Description("Insert Geoff subgraph into the database from a list of rule strings") @PluginTarget(GraphDatabaseService.class) public Representation insert( @Source GraphDatabaseService graphDB, @Description("Geoff subgraph to insert") @Parameter(name = "subgraph", optional = false) String[] subgraph,...
2432524_5
public static String prettyPrint( String xml ) { return prettyPrint( xml, INDENT_NUMBER ); }
2434719_21
public boolean contains(int charCode) { boolean found = false; for (int i = 0; !found && i < size(); i++) { CharacterRange range = get(i); if (range.characterSet != null) { // Version 1 CGT found = range.characterSet.contains(String.valueOf((char)charCode)); } els...
2438993_1
public String getContextPath() { return this.contextPath; }
2449032_110
Value not () { throw newOperandException ("not"); }
2466190_0
public static File getEncryptedFilename(File file) { String filename = file.getName(); return filename.endsWith(ENCRYPTED_FILENAME_SUFFIX) ? file : new File(file.getParent(), filename + ENCRYPTED_FILENAME_SUFFIX); }
2470704_0
protected float normalize(float score, int longestString){ return 1f - (score / longestString); }
2474070_1
public static Gson createGson(Context context) { if (gson == null) { GsonBuilder builder = new GsonBuilder(); if (context == null || Feature.get(context, R.bool.feature_load_old_experiences).isEnabled()) { builder.registerTypeAdapterFactory(new ExperienceTypeAdapterFactor()); } gson = builder.create(); ...
2477847_190
public MarkupLanguage getMarkupLanguage(final String languageName) throws IllegalArgumentException { checkArgument(!Strings.isNullOrEmpty(languageName), "Must provide a languageName"); //$NON-NLS-1$ Pattern classNamePattern = Pattern.compile("\\s*([^\\s#]+)?#?.*"); //$NON-NLS-1$ // first try Java services (jar-based...
2478263_260
@RequestMapping(value = "/findExternalUrlForStudy/{studyTitle}", method = RequestMethod.GET, produces = "application/json") @ResponseBody public String findExternalLinkForStudyWithTitle(HttpServletRequest request, @PathVariable("studyTitle") String taxonName) throws IOException { return ExternalIdUtil.getUrlFromExt...
2479886_26
@Override public String toString() { StringBuffer sb = new StringBuffer(); StringBuffer text = new StringBuffer(); byte c; int len = bb.limit(); int lengthRoundedUpToNextMultipleOf16 = (int) Math.ceil(len / 16.0) * 16; sb.append("apid: " + getAPID() + "\n"); sb.append("packetId: " + getPacke...
2485432_0
public byte[] getNetmaskAddress() { return netmaskAddress; }
2488113_3
@Override public LinkableInfo getLinkableInfo(String link) { LinkableInfo linkableInfo = linkableMapping.get(link); Validate.notNull(linkableInfo, "Invalid link: " + link); return linkableInfo; }
2488848_139
public boolean exists(@Nullable ID subject, @Nullable UID predicate, @Nullable NODE object, @Nullable UID context) { return findStatements(subject, predicate, object, context, false).hasNext(); }
2491679_4
@Override public boolean isValid(String pis, final ConstraintValidatorContext context) { boolean result = false; if ( pis == null || "".equals(pis) ) { result = true; } else { result = PISPASEP.isValido(pis); } return result; }
2497245_83
@Nonnull public static SizeValue percent(final int percentage) { return new SizeValue(percentage, SizeValueType.Percent); }
2499324_6
protected LinkType getLinkType(long linkTypeVal) { switch ((int)linkTypeVal) { case 0: return LinkType.NULL; case 1: return LinkType.EN10MB; case 101: return LinkType.RAW; case 108: return LinkType.LOOP; case 113: return LinkType.LINUX_SLL; } return null; }
2500369_7
@Override public void parseArguments(final ParsedArguments parsedArguments, final String... arguments) throws ArgumentValidationException { boolean finishedOptions = false; for (final String argument : arguments) { if(finishedOptions) { parsedArguments.addValue(argument); } ...
2501197_4
public <T> Set<ConstraintViolation<T>> validateProperty(T object, String propertyPath, Class<?>... groups) { Set<ConstraintViolation<T>> violations = new HashSet<ConstraintViolation<T>>(); try { int currentIndex = -1; String currentPropertyPath; do { currentIndex = propert...
2505794_638
@Override public boolean evaluate(final T instance) { return any(predicates, new UnaryPredicate<UnaryPredicate<? super T>>() { @Override public boolean evaluate(UnaryPredicate<? super T> predicate) { return predicate.evaluate(instance); } }); }
2510313_7
@Override public OngoingReadingWithoutWhere match(PatternElement... pattern) { return this.match(false, pattern); }
2516145_2
public String[] asArray(String value){ return value.split(","); }
2521501_29
public void confirm(String message, BooleanCallback callback) { confirm(null, message, callback); }
2524488_375
@Override public synchronized void fetchColumn(Text colFam, Text colQual) { checkArgument(colFam != null, "colFam is null"); checkArgument(colQual != null, "colQual is null"); Column c = new Column(TextUtil.getBytes(colFam), TextUtil.getBytes(colQual), null); fetchedColumns.add(c); }
2536041_2
public static void addJarDirToDistributedCache(Configuration conf, File jarDirectory) throws IOException { if (!jarDirectory.exists() || !jarDirectory.isDirectory()) { throw new IOException("Jar directory: " + jarDirectory.getCanonicalPath() + " does not " + "exist or is not a directory."); } for (F...
2544900_7
public double[] evaluateSchedule(Integer[] jobArray) { _schedule = null; return evaluateSchedule(jobArray, false); }
2548552_0
public void sort(int[] values) { // Check for empty or null array if (values ==null || values.length==0){ return; } this.numbers = values; number = values.length; quicksort(0, number - 1); }
2550825_37
public Map<String, String> getRouterConfigInformation(RouterConfig routerConfig) { Map<String, String> result = new HashMap<String, String>(); result.put("Router", routerConfig.getClass().getSimpleName()); String routerDispatcher = routerConfig.routerDispatcher(); result.put("Router Dispatcher", routerD...
2562371_4
protected void newRule(Class<?> ruleClass, NewRepository repository) { org.sonar.check.Rule ruleAnnotation = AnnotationUtils.getAnnotation(ruleClass, org.sonar.check.Rule.class); if (ruleAnnotation == null) { throw new IllegalArgumentException("No Rule annotation was found on " + ruleClass); } String ruleKey = r...
2562751_4
static byte[] convertBoolArrayToByteArray(boolean[] boolArr) { byte[] byteArr = new byte[(boolArr.length + 7) / 8]; for (int i = 0; i < byteArr.length; i++) { byteArr[i] = readByte(boolArr, 8 * i); } return byteArr; }
2572668_0
@Override public Set<User> searchUsers(UserSearchCriteria criteria) { final Set<User> users = this.listUsers(); final Set<User> filteredUsers = this.filterListInMemeory(users, criteria); logger.debug("filteredUsers({}): {}", criteria, filteredUsers); return filteredUsers; }
2573331_1
private List<String> getUniprotMappings(Model aUpModel) { QueryExecution ex = QueryExecutionFactory .create("SELECT ?x WHERE{?x <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://purl.uniprot.org/core/Protein>}", aUpModel); ResultSet rs = ex.execSelect(); List<String> returnMe = new ArrayList<String>(...
2576064_42
public static Map<String, List<CtxModelObject>> sortByObfuscability(List<CtxModelObject> ctxDataList) { if (null == ctxDataList || ctxDataList.size() <= 0) { // LOG.error("Can't sort null values"); return null; } String notObfuscableType = "NOT_OBFUCSABLE"; DataTypeUtils dataTypeUtils = new DataTypeUtils(); ...
2576181_14
public void addMethodListener(String regex, RegexMethodInterceptorListener<T> listener) { if(listener == null) { throw new IllegalArgumentException("listener cannot be null."); } Set<RegexMethodInterceptorListener<T>> set = listeners.get(regex); if(set == null) { set = new HashSet<Regex...
2580771_3
@Override protected void doGet( HttpServletRequest req, HttpServletResponse resp ) throws ServletException, IOException { // url format = /cache/key so get the key from path String path = req.getPathInfo(); String servletPath = req.getServletPath(); String key = retrieveKeyFromPath( path ); if ...
2588654_1
protected boolean updatePeakForChannel(Network network, Channel channel) { try { int storedCount = getCount(network, channel); int numberCurrentlyOnChannel = channel.getNicks().size(); if (storedCount < numberCurrentlyOnChannel) { peaks.put(channelIdentifier(network, channel), "...
2611961_0
public static String estimateAge(String birthdate) throws ParseException { Date date = RegistrationUtils.parseDate(birthdate); return PatientUtils.estimateAge(date); }
2613332_20
@SuppressWarnings("unchecked") @Override public DashBoardPage render(RenderTime timer) { basicRender(timer); // We don't know if the dashlets will appear so do the basic rendering try { getDashlet("my-sites").render(timer); getDashlet("my-documents").render(timer); getDashlet("ac...
2614085_60
@Override public boolean appliesTo(IPortletDefinition portlet) { final boolean portletMatch = portletName.equalsIgnoreCase(portlet.getPortletDescriptorKey().getPortletName()); final boolean webappMatch = webappName.equalsIgnoreCase(portlet.getPortletDescriptorKey().getWebAppName()); ...
2618757_4
public Map<String, Schema> getNamedMappings() { ensureInit(); return nameToSchemaMappings; }
2622727_0
public static HttpRequest get(final CharSequence url) throws HttpRequestException { return new HttpRequest(url, METHOD_GET); }
2622978_77
public final void onAfterTestMethod(@Observes(precedence = 45) AfterPersistenceTest event) { executeCacheEviction(event, TestExecutionPhase.AFTER); }
2624179_0
@Action void registerConnector( @Nonnull final Connector connector ) { if ( Replicant.shouldCheckInvariants() ) { invariant( () -> _connectors.stream() .noneMatch( e -> e.getConnector().getSchema().getId() == connector.getSchema().getId() ), () -> "Replicant-0015: Invoked registe...
2626654_7
public static String stripAndFillSessionData(final String url, final UrlDataImpl urldata) { final int pos = url.indexOf(';'); if (pos != -1) { final char[] data = url.toCharArray(); int sessionStart; if ((sessionStart = indexOf(data, jsessionLower, pos)) != -1 || (sessionStart = indexOf(data, jsessionUpper, pos...
2647335_4
public String forGroup(String groupName, ResourceHtmlTag tag) { return namePattern .replace("@groupName@", groupName) .replace("@extension@", tag.getExtension()); }
2651891_0
public String get() { if (stringList.isEmpty()) { return null; } else { String result = stringList.remove(0); return result; } }
2656737_4
public String createConsentCDA(Patient patient, PatientConsentPolicy policy, DocumentEntry documentEntry) { // Basic checks if (patient == null) throw new IllegalArgumentException("Patient cannot be null."); if (policy == null) throw new IllegalArgumentException("policy cannot be null."); if (documentEntry =...
2657795_0
@Override public MuleEvent process(MuleEvent event) throws MuleException, NullPointerException { checkNotNull(event, "event"); return getFlow(event.getMuleContext()).process(event); }
2666578_179
@Override public int hashCode() { int hash = 17; hash = hash * 31 + key.hashCode(); hash = hash * 31 + ( ( value != null ) ? value.hashCode() : 0 ); return hash; }
2666662_13
static CreationFactory createCreationFactory(final String baseURI, final Map<String, Object> pathParameterValues, final Method method) throws URISyntaxException { final Path classPathAnnotation = method.getDeclaringClass().getAnnotation(Path.class); final OslcCreationFactory creationFactoryAnnotation = method.get...
2675355_2
public Node deserializeObject(JsonReader reader) { Log.info("Deserializing JSON to Node."); JsonObject jsonObject = reader.readObject(); return deserializeObject(jsonObject); }
2675654_37
public static DependencyAtom getMinimumVersion(DependencyAtom left, DependencyAtom right) { String leftVersion = left.getPropertyValue(); String rightVersion = right.getPropertyValue(); if ((leftVersion == null) || (rightVersion == null) || leftVersion.equals(rightVersion)) { return null; } ...
2680621_5
public Widget getWidgetByFieldName(String fieldName) { for (Map.Entry<Widget, String> e : fieldNames.entrySet()) { if (e.getValue().equals(fieldName)) return e.getKey(); } return null; }
2681994_39
@Override public ClientDetailsEntity saveNewClient(ClientDetailsEntity client) { if (client.getId() != null) { // if it's not null, it's already been saved, this is an error throw new IllegalArgumentException("Tried to save a new client with an existing ID: " + client.getId()); } if (client.getRegisteredRedirectU...
2685841_1710
@Override public void writeJSON(Patient patient, JSONObject json) { writeJSON(patient, json, null); }
2689039_50
@Override public void writeToParcel(Parcel out, int flags) { super.writeToParcel(out, flags); out.writeValue(getValue()); }
2694049_1
SshServer getServer() { return server; }
2698192_2
public static String explain(final Throwable throwable) { checkNotNull(throwable); StringBuilder buff = new StringBuilder(); explain(buff, throwable); Throwable cause = throwable; while ((cause = cause.getCause()) != null) { buff.append(", caused by: "); explain(buff, cause); } return buff.toSt...
2708082_94
public void pushDecision(Decision decision) { int p = last.get(); decision.setPosition(p); if(decisions.size() == p){ decisions.add(decision); }else if(decisions.size() == p + 1) { decisions.set(p, decision); }else throw new SolverException("Cannot add decision to decision path"); }
2708789_0
@Override public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception { // why not using println? because it makes testing harder, *nix and // windows think different about new line as in \n vs \r\n System.out.print("Hello World!"); ...
2710254_2
public void loadSettings(String resourcePath, String defaultResourcePath, Object bean) { try { Map properties = loadSettings(resourcePath, defaultResourcePath); BeanUtils.populate(bean, properties); } catch (IllegalAccessException | InvocationTargetException | IOException e) { throw new ...
2719141_12
public boolean contentEquals( String src, String dest ) throws FileManipulatorException { FileObject srcFile = null; FileObject destFile = null; try { LOGGER.debug( "Comparing the content of {} and {}", src, dest ); srcFile = this.resolveFile( src ); destFile = this.resolveFi...
2737689_92
public final PJsonObject toJSON() { try { JSONObject json = new JSONObject(); for (String key: this.obj.keySet()) { Object opt = opt(key); if (opt instanceof PYamlObject) { opt = ((PYamlObject) opt).toJSON().getInternalObj(); } else if (opt instanc...
2740148_425
@Override public boolean areOutcomesCompatible(String[] outcomes) { Set<String> start = new HashSet<>(); Set<String> cont = new HashSet<>(); Set<String> last = new HashSet<>(); Set<String> unit = new HashSet<>(); for (int i = 0; i < outcomes.length; i++) { String outcome = outcomes[i]; if (outcome.en...
2740607_0
public String getDeploymentPath() { return deployDetails.getArtifactPath(); }
2742247_3
public String getCacheName(){ return this.cache.getName(); }
2747986_8
public MimeMessage createMessage(String from, String to, String cc, String subject, SOAPMessage soapMessage) throws ConnectionException { return createMessage(from, to, cc, subject, soapMessage, createSession()); }
2752522_464
public static Connection showDialog(String title) { return showDialog(title, null); }
2755429_1
public String innerText() { return sbuf.toString(); }