id
stringlengths
7
14
text
stringlengths
1
106k
1886360_3
public static int sqrt(int x) { if (x < 0) throw new IllegalArgumentException("Square root of negative number"); int y = 0; for (int i = 1 << 15; i != 0; i >>>= 1) { y |= i; if (y > 46340 || y * y > x) y ^= i; } return y; }
1886360_4
public static int sqrt(int x) { if (x < 0) throw new IllegalArgumentException("Square root of negative number"); int y = 0; for (int i = 1 << 15; i != 0; i >>>= 1) { y |= i; if (y > 46340 || y * y > x) y ^= i; } return y; }
1886360_5
public static int sqrt(int x) { if (x < 0) throw new IllegalArgumentException("Square root of negative number"); int y = 0; for (int i = 1 << 15; i != 0; i >>>= 1) { y |= i; if (y > 46340 || y * y > x) y ^= i; } return y; }
1886360_6
public static int sqrt(int x) { if (x < 0) throw new IllegalArgumentException("Square root of negative number"); int y = 0; for (int i = 1 << 15; i != 0; i >>>= 1) { y |= i; if (y > 46340 || y * y > x) y ^= i; } return y; }
1886360_7
public static int sqrt(int x) { if (x < 0) throw new IllegalArgumentException("Square root of negative number"); int y = 0; for (int i = 1 << 15; i != 0; i >>>= 1) { y |= i; if (y > 46340 || y * y > x) y ^= i; } return y; }
1886360_8
public static int sqrt(int x) { if (x < 0) throw new IllegalArgumentException("Square root of negative number"); int y = 0; for (int i = 1 << 15; i != 0; i >>>= 1) { y |= i; if (y > 46340 || y * y > x) y ^= i; } return y; }
1886360_9
public static int sqrt(int x) { if (x < 0) throw new IllegalArgumentException("Square root of negative number"); int y = 0; for (int i = 1 << 15; i != 0; i >>>= 1) { y |= i; if (y > 46340 || y * y > x) y ^= i; } return y; }
1889681_0
@Override @Nullable public String call() throws Exception { String header = findHeader(original); String usedText = (header == null) ? original : original.substring(header.length()); boolean foundOocMarkers = false; if (usedText.startsWith("((") && usedText.endsWith("))")) { foundOocMarkers = tr...
1889681_1
@Override @Nullable public String call() throws Exception { String header = findHeader(original); String usedText = (header == null) ? original : original.substring(header.length()); boolean foundOocMarkers = false; if (usedText.startsWith("((") && usedText.endsWith("))")) { foundOocMarkers = tr...
1889681_2
@Override @Nullable public String call() throws Exception { String header = findHeader(original); String usedText = (header == null) ? original : original.substring(header.length()); boolean foundOocMarkers = false; if (usedText.startsWith("((") && usedText.endsWith("))")) { foundOocMarkers = tr...
1889681_3
@Override @Nullable public String call() throws Exception { String header = findHeader(original); String usedText = (header == null) ? original : original.substring(header.length()); boolean foundOocMarkers = false; if (usedText.startsWith("((") && usedText.endsWith("))")) { foundOocMarkers = tr...
1889681_4
@Nullable @Override public String getTranslation(@Nonnull String original, @Nonnull TranslationDirection direction) { StringBuilder queryBuilder = new StringBuilder(); queryBuilder.append(serviceUrl).append('?'); try { queryBuilder.append("q=").append(URLEncoder.encode(original, "UTF-8")); q...
1889681_5
@Nullable @Override public String getTranslation(@Nonnull String original, @Nonnull TranslationDirection direction) { StringBuilder queryBuilder = new StringBuilder(); queryBuilder.append(serviceUrl).append('?'); try { queryBuilder.append("q=").append(URLEncoder.encode(original, "UTF-8")); q...
1889681_6
@Nullable @Override public String getTranslation(@Nonnull String original, @Nonnull TranslationDirection direction) { if (!isProviderWorking()) { return null; } StringBuilder queryBuilder = new StringBuilder(); queryBuilder.append(serviceUrl).append('?'); try { queryBuilder.append("t...
1889681_7
@Nullable @Override public String getTranslation(@Nonnull String original, @Nonnull TranslationDirection direction) { if (!isProviderWorking()) { return null; } StringBuilder queryBuilder = new StringBuilder(); queryBuilder.append(serviceUrl).append('?'); try { queryBuilder.append("t...
1889681_8
public void writeTo(@Nonnull Writer writer) throws IOException { BufferedWriter bw = new BufferedWriter(writer); if (commentIntro != null) { bw.write(commentIntro); bw.write('\n'); } int textWidth = lineWidth; if (commentLineStart != null) { textWidth -= commentLineStart.leng...
1889681_9
public boolean isLicenseText(@Nonnull CharSequence text) { String[] textParts = LINE_BREAK_PATTERN.split(text); if (textParts.length == 0) { return false; } if ((commentIntro != null) && !textParts[0].equals(commentIntro)) { return false; } if ((commentOutro != null) && !textPart...
1894664_0
public void updateStatus(Yammer yammer, String message) { yammer.messageOperations().postUpdate(message); }
1894664_1
public void setConnectionValues(Yammer yammer, ConnectionValues values) { YammerProfile profile = yammer.userOperations().getUserProfile(); String providerUserId = String.valueOf(profile.getId()); values.setProviderUserId(providerUserId); values.setDisplayName(profile.getFullName()); values.setProfi...
1894664_2
public boolean test(Yammer yammer) { try { yammer.userOperations().getUserProfile(); return true; } catch (RestClientException e) { return false; } }
1894664_3
public boolean test(Yammer yammer) { try { yammer.userOperations().getUserProfile(); return true; } catch (RestClientException e) { return false; } }
1894664_4
public Topic getTopic(long id) { return restTemplate.getForObject(buildUri("topics/"+String.valueOf(id)+".json"), Topic.class); }
1894664_5
public YammerThread getThread(long id) { return restTemplate.getForObject(buildUri("threads/"+id+".json"), YammerThread.class); }
1894664_6
public Group getGroup(long groupId) { return restTemplate.getForObject(buildUri("groups/"+String.valueOf(groupId)+".json"), Group.class); }
1894664_7
public List<Group> getGroups(int page, Character letter, String sortBy, boolean reverse) { MultiValueMap<String, String> params = new LinkedMultiValueMap<String, String>(); params.set("page", String.valueOf(page)); if(sortBy!=null){ params.set("sort_by", sortBy); } params.set("reverse", String.valueOf(reverse));...
1894664_8
public List<Group> getGroups(int page, Character letter, String sortBy, boolean reverse) { MultiValueMap<String, String> params = new LinkedMultiValueMap<String, String>(); params.set("page", String.valueOf(page)); if(sortBy!=null){ params.set("sort_by", sortBy); } params.set("reverse", String.valueOf(reverse));...
1894664_9
public void createGroup(String name, boolean isPrivate) { LinkedMultiValueMap<String, String> params = new LinkedMultiValueMap<String, String>(); params.set("name",name); params.set("private", String.valueOf(isPrivate)); restTemplate.postForEntity(buildUri("groups"), params, String.class); }
1905463_0
public Iterator<ExpressionInfo> iterator() { return new ExpressionInfoIterator( JsfElMatcher.forText(sourceText)); }
1905463_1
Class<?> determineFinalTypeOfCurrentExpressionAnd(final Object property, final Class<?> originalType) { //final boolean undefinedType = Object.class == originalType || originalType == null; Class<?> override = getTypeOverride(property); Class<?> type; if (override != null) { type = overr...
1905463_2
public Object getValue(Object target, Object property) throws GenericElEvaluationException, PropertyNotFoundException { return this.getValue(target, property, getTypeOfCollectionOrBean(target, property)); }
1905463_3
public Object getValue(Object target, Object property) throws GenericElEvaluationException, PropertyNotFoundException { return this.getValue(target, property, getTypeOfCollectionOrBean(target, property)); }
1905463_4
public Object getValue(Object target, Object property) throws GenericElEvaluationException, PropertyNotFoundException { return this.getValue(target, property, getTypeOfCollectionOrBean(target, property)); }
1905463_5
public Object getValue(Object target, Object property) throws GenericElEvaluationException, PropertyNotFoundException { return this.getValue(target, property, getTypeOfCollectionOrBean(target, property)); }
1905463_6
public Object getValue(Object target, Object property) throws GenericElEvaluationException, PropertyNotFoundException { return this.getValue(target, property, getTypeOfCollectionOrBean(target, property)); }
1905463_7
@Override public boolean hasErrors() { return errors; }
1905463_8
public void add(MultipleValidationResults multipleResults) { addAll(multipleResults.results); }
1905463_9
public void add(MultipleValidationResults multipleResults) { addAll(multipleResults.results); }
1913648_0
public Map<String,Integer> getMods () { return new HashMap<String,Integer>(_mods); }
1913648_1
public Map<String,Integer> getMods () { return new HashMap<String,Integer>(_mods); }
1913648_2
public Map<String,Integer> getMods () { return new HashMap<String,Integer>(_mods); }
1913648_3
protected <K,V> RMap<K,V> map (final String prefix, final Codec<K> keyCodec, final Codec<V> valCodec, final Resolver<? super V> resolver) { class StorageMap extends AbstractMap<K,V> { @Override public int size () { return _keys.size(); } @Override p...
1913648_4
public <E> RSet<E> setFor (String key, Function<String,E> toFunc, Function<E,String> fromFunc) { return setFor(key, toFunc, fromFunc, new HashSet<E>()); }
1913648_5
@Override public Iterator<E> iterator () { return new Iterator<E>() { @Override public boolean hasNext() { return _pos < _size; } @Override public E next () { return get(_pos++); } @Override public void remove () { Bag.this.removeAt(--_pos)...
1913648_6
public Entity add (Component comp) { checkDisposed("Cannot add components to disposed entity."); comp.add(this); queueChange(); return this; }
1913648_7
public static Styles none () { return _noneSingleton; }
1913648_8
public static Styles make (Style.Binding<?>... bindings) { return none().add(Style.Mode.DEFAULT, bindings); }
1913648_9
public <V> Styles clear (Style.Mode mode, Style<V> style) { int index = Arrays.binarySearch(_bindings, new Binding<V>(style)); if (index < 0) return this; @SuppressWarnings("unchecked") Binding<V> binding = (Binding<V>)_bindings[index]; Binding<?>[] nbindings = new Binding<?>[_bindings.length]; Syst...
1925457_0
@Override public boolean isAvailable() { return isValid( preferenceHelper.getSmtpServer(), preferenceHelper.getSmtpPort(), preferenceHelper.getSmtpUsername(), preferenceHelper.getSmtpPassword(), preferenceHelper.getAutoEmailTargets()); }
1925457_1
@Override public boolean isAvailable() { return isValid( preferenceHelper.getSmtpServer(), preferenceHelper.getSmtpPort(), preferenceHelper.getSmtpUsername(), preferenceHelper.getSmtpPassword(), preferenceHelper.getAutoEmailTargets()); }
1925457_2
@Override public boolean isAvailable() { return isValid( preferenceHelper.getSmtpServer(), preferenceHelper.getSmtpPort(), preferenceHelper.getSmtpUsername(), preferenceHelper.getSmtpPassword(), preferenceHelper.getAutoEmailTargets()); }
1925457_3
@Override public boolean isAvailable() { return !Strings.isNullOrEmpty(preferenceHelper.getOpenGTSServer()) && !Strings.isNullOrEmpty(preferenceHelper.getOpenGTSServerPort()) && Strings.toInt(preferenceHelper.getOpenGTSServerPort(), 0) != 0 && !Strings.isNullOrEmpty(preferenceHel...
1925457_4
@Override public boolean isAvailable() { return !Strings.isNullOrEmpty(preferenceHelper.getOpenGTSServer()) && !Strings.isNullOrEmpty(preferenceHelper.getOpenGTSServerPort()) && Strings.toInt(preferenceHelper.getOpenGTSServerPort(), 0) != 0 && !Strings.isNullOrEmpty(preferenceHel...
1925457_5
public static String gprmcEncode(SerializableLocation loc) { DecimalFormatSymbols dfs = new DecimalFormatSymbols(Locale.US); DecimalFormat f = new DecimalFormat("0.000000", dfs); String gprmc = String.format("%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,,", "$GPRMC", getNmeaGprmcTime(new Date(loc.g...
1925457_6
public static String gprmcEncode(SerializableLocation loc) { DecimalFormatSymbols dfs = new DecimalFormatSymbols(Locale.US); DecimalFormat f = new DecimalFormat("0.000000", dfs); String gprmc = String.format("%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,,", "$GPRMC", getNmeaGprmcTime(new Date(loc.g...
1925457_7
public static String gprmcEncode(SerializableLocation loc) { DecimalFormatSymbols dfs = new DecimalFormatSymbols(Locale.US); DecimalFormat f = new DecimalFormat("0.000000", dfs); String gprmc = String.format("%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,,", "$GPRMC", getNmeaGprmcTime(new Date(loc.g...
1925457_8
public static String gprmcEncode(SerializableLocation loc) { DecimalFormatSymbols dfs = new DecimalFormatSymbols(Locale.US); DecimalFormat f = new DecimalFormat("0.000000", dfs); String gprmc = String.format("%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,,", "$GPRMC", getNmeaGprmcTime(new Date(loc.g...
1925457_9
public static String getUrl(String id, String accountName, SerializableLocation loc, String communication, String path, String server, int port, int batteryLevel) { List<AbstractMap.SimpleEntry<String,String>> qparams = new ArrayList<>(); qparams.add(new AbstractMap.SimpleEntry<>("id", id)); qparams.add(new...
1931685_0
public List<RouteConfiguration> parse() throws IOException { List<RouteConfiguration> configs = new ArrayList<RouteConfiguration>(); String line = null; while ((line = readLine( true )) != null) { RouteConfiguration config = null; Matcher matcher = ROUTE_PATTERN.matcher( line ); if (...
1931685_1
public StompletActivator match(String destination) { Matcher routeMatcher = this.regexp.matcher( destination ); if (routeMatcher.matches()) { Map<String, String> matches = new HashMap<String, String>(); for (int i = 0; i < this.segmentNames.length; ++i) { matches.put( segmentNames[i]...
1931685_2
public StompletActivator match(String destination) { Matcher routeMatcher = this.regexp.matcher( destination ); if (routeMatcher.matches()) { Map<String, String> matches = new HashMap<String, String>(); for (int i = 0; i < this.segmentNames.length; ++i) { matches.put( segmentNames[i]...
1931685_3
public StompletActivator match(String destination) { Matcher routeMatcher = this.regexp.matcher( destination ); if (routeMatcher.matches()) { Map<String, String> matches = new HashMap<String, String>(); for (int i = 0; i < this.segmentNames.length; ++i) { matches.put( segmentNames[i]...
1933490_0
@RequestMapping("/hello") public String hello() { final NestedException nested = new NestedException("nested"); throw new CustomException("outer", nested); }
1933490_1
@RequestMapping(value = "/admin/users", method = RequestMethod.POST, produces = "application/json;charset=UTF-8") @ResponseBody public Callable<String> listuser() { return new Callable<String>() { @Override public String call() throws Exception { List<Member> users = memberManager.findBy...
1933490_2
@RequestMapping("/user/myinfo") public Callable<String> myinfo(final HttpServletRequest request, final Principal principal) { return new Callable<String>() { @Override public String call() throws Exception { request.setAttribute("member", memberManager.findByPrimaryKey(getPrincipalId(pri...
1933490_3
@RequestMapping("/admin/user/{account}") public Callable<String> userinfo(final @PathVariable Member account, final HttpServletRequest request) { return new Callable<String>() { @Override public String call() throws Exception { if (account != null) { request.setAttribute(...
1933490_4
public String getName() { return name; }
1933490_5
public Map<String, Integer> countMoons(Iterable<World> worlds) { Map<String, Integer> moons = new HashMap<String, Integer>(); for (World world : worlds) { moons.put(world.getName(), world.getMoons()); } return moons; }
1933490_6
public void doSomething(@NotNull @Valid final MyBean bean) { System.out.println("do something"); }
1933490_7
public void doSomething(@NotNull @Valid final MyBean bean) { System.out.println("do something"); }
1933490_8
@Async public void doSomethingAsync(@NotNull @Valid final MyBean bean) { System.out.println("do something async"); }
1933490_9
@Async public void doSomethingAsync(@NotNull @Valid final MyBean bean) { System.out.println("do something async"); }
1944249_0
@Override @Nonnull public PreparedExpression process(@Nonnull String s) throws ParseException { return processWithDepth(s, 0, new ArrayList<IConstant>(), engine); }
1944249_1
@Override @Nonnull public PreparedExpression process(@Nonnull String s) throws ParseException { return processWithDepth(s, 0, new ArrayList<IConstant>(), engine); }
1944249_2
@Override @Nonnull public PreparedExpression process(@Nonnull String s) throws ParseException { return processWithDepth(s, 0, new ArrayList<IConstant>(), engine); }
1944249_3
@Override @Nonnull public PreparedExpression process(@Nonnull String s) throws ParseException { return processWithDepth(s, 0, new ArrayList<IConstant>(), engine); }
1944249_4
@Nonnull public List<HistoryState> getRecent() { return getRecent(true); }
1944249_5
@Nonnull public List<HistoryState> getRecent() { return getRecent(true); }
1944249_6
@Nullable static List<HistoryState> convertOldHistory(@NonNull String xml) throws Exception { final OldHistory history = OldHistory.fromXml(xml); if (history == null) { // strange, history seems to be broken. Avoid clearing the preference return null; } final List<HistoryState> states = ...
1944249_7
public void init(@NonNull Executor initThread) { Check.isMainThread(); bus.register(this); initThread.execute(new Runnable() { @Override public void run() { initAsync(); } }); }
1944249_8
public void init(@NonNull Executor initThread) { Check.isMainThread(); bus.register(this); initThread.execute(new Runnable() { @Override public void run() { initAsync(); } }); }
1944249_9
@Nonnull @Override public String process(@Nonnull Generic numeric) { return numeric.toString().replace("*", ""); }
1946637_0
@Override public void proceed() { if (pos < handlers.size()) { AnnotationHandler<Annotation> handler = handlers.get(pos++); Annotation annotation = element.getAnnotation(handler.handles()); Assert.notNull(annotation, "Could not find annotation [" + handler.handles().getName() + "] on: " + element);...
1946637_1
@Override public void proceed() { if (pos < handlers.size()) { AnnotationHandler<Annotation> handler = handlers.get(pos++); Annotation annotation = element.getAnnotation(handler.handles()); Assert.notNull(annotation, "Could not find annotation [" + handler.handles().getName() + "] on: " + element);...
1946637_2
@Override public void proceed() { if (pos < handlers.size()) { AnnotationHandler<Annotation> handler = handlers.get(pos++); Annotation annotation = element.getAnnotation(handler.handles()); Assert.notNull(annotation, "Could not find annotation [" + handler.handles().getName() + "] on: " + element);...
1946637_3
@SuppressWarnings("unused") public boolean accept(InputStream classFileStream) throws IOException { // open a DataInputStream DataInputStream in = new DataInputStream(classFileStream); // read magic and abort if it doesn't match int magic = in.readInt(); if (magic != CLASS_FILE_MAGIC) { if (log....
1946637_4
@SuppressWarnings("unused") public boolean accept(InputStream classFileStream) throws IOException { // open a DataInputStream DataInputStream in = new DataInputStream(classFileStream); // read magic and abort if it doesn't match int magic = in.readInt(); if (magic != CLASS_FILE_MAGIC) { if (log....
1946637_5
@SuppressWarnings("unused") public boolean accept(InputStream classFileStream) throws IOException { // open a DataInputStream DataInputStream in = new DataInputStream(classFileStream); // read magic and abort if it doesn't match int magic = in.readInt(); if (magic != CLASS_FILE_MAGIC) { if (log....
1946637_6
@SuppressWarnings("unused") public boolean accept(InputStream classFileStream) throws IOException { // open a DataInputStream DataInputStream in = new DataInputStream(classFileStream); // read magic and abort if it doesn't match int magic = in.readInt(); if (magic != CLASS_FILE_MAGIC) { if (log....
1946637_7
@SuppressWarnings("unused") public boolean accept(InputStream classFileStream) throws IOException { // open a DataInputStream DataInputStream in = new DataInputStream(classFileStream); // read magic and abort if it doesn't match int magic = in.readInt(); if (magic != CLASS_FILE_MAGIC) { if (log....
1946637_8
@SuppressWarnings("unused") public boolean accept(InputStream classFileStream) throws IOException { // open a DataInputStream DataInputStream in = new DataInputStream(classFileStream); // read magic and abort if it doesn't match int magic = in.readInt(); if (magic != CLASS_FILE_MAGIC) { if (log....
1946637_9
public boolean isAllowedPackage(String packageName) { // No packages in set? Accept all packages. if (packageSet.isEmpty()) { return true; } // check all valid packages for (String validPackage : packageSet) { // accept if package is a sub-package of a valid package if (packageNam...
1951088_0
public Photoset getInfo(String photosetId) throws FlickrException, IOException, JSONException { List<Parameter> parameters = new ArrayList<Parameter>(); parameters.add(new Parameter("method", METHOD_GET_INFO)); boolean signed = OAuthUtils.hasSigned(); if (signed) { parameters.add(new Parameter( OAuthInterfa...
1951088_1
public Photoset getInfo(String photosetId) throws FlickrException, IOException, JSONException { List<Parameter> parameters = new ArrayList<Parameter>(); parameters.add(new Parameter("method", METHOD_GET_INFO)); boolean signed = OAuthUtils.hasSigned(); if (signed) { parameters.add(new Parameter( OAuthInterfa...
1951088_2
public Photosets getList(String userId) throws IOException, FlickrException, JSONException { return getList(userId,-1,-1); }
1951088_3
public Photosets getList(String userId) throws IOException, FlickrException, JSONException { return getList(userId,-1,-1); }
1951088_4
public Photoset getPhotos(String photosetId, Set<String> extras, int privacyFilter, int perPage, int page) throws IOException, FlickrException, JSONException { PhotoList photos = new PhotoList(); List<Parameter> parameters = new ArrayList<Parameter>(); parameters.add(new Parameter("method", METHOD_GET_PHOTOS)); ...
1951088_5
public Photoset getPhotos(String photosetId, Set<String> extras, int privacyFilter, int perPage, int page) throws IOException, FlickrException, JSONException { PhotoList photos = new PhotoList(); List<Parameter> parameters = new ArrayList<Parameter>(); parameters.add(new Parameter("method", METHOD_GET_PHOTOS)); ...
1952675_0
public static StandardServiceAgent newInstance(Settings settings) { UDPConnector.Factory udpFactory = Factories.newInstance(settings, UDP_CONNECTOR_FACTORY_KEY); TCPConnector.Factory tcpFactory = Factories.newInstance(settings, TCP_CONNECTOR_FACTORY_KEY); UDPConnectorServer.Factory udpServerFactory = Factor...
1952675_1
public static StandardServiceAgent newInstance(Settings settings) { UDPConnector.Factory udpFactory = Factories.newInstance(settings, UDP_CONNECTOR_FACTORY_KEY); TCPConnector.Factory tcpFactory = Factories.newInstance(settings, TCP_CONNECTOR_FACTORY_KEY); UDPConnectorServer.Factory udpServerFactory = Factor...
1952675_2
public static StandardServiceAgent newInstance(Settings settings) { UDPConnector.Factory udpFactory = Factories.newInstance(settings, UDP_CONNECTOR_FACTORY_KEY); TCPConnector.Factory tcpFactory = Factories.newInstance(settings, TCP_CONNECTOR_FACTORY_KEY); UDPConnectorServer.Factory udpServerFactory = Factor...