id
stringlengths
7
14
text
stringlengths
1
106k
960760_9
@Override public void bringToFront(final DrawingObject dob) { if (threadSafe) { synchronized (lock) { insertionOrder.put(dob, ++insertionOrderLargest); } } else { insertionOrder.put(dob, ++insertionOrderLargest); } }
990281_0
public static SimpleGlobPattern compile(String patternString) { SimpleGlobPattern pattern = EmptyGlobPattern.INSTANCE; int endIndexInclusive = patternString.length() - 1; while ( endIndexInclusive >= 0 ) { int lastWildcardIndex = patternString.lastIndexOf( WILDCARD_MANY, endIndexInclusive ); if ( lastWildcardInd...
990281_1
public boolean matches(String candidate) { return matches( candidate, 0 ); }
990281_2
;
990281_3
public Optional<String> toLiteral() { return Optional.empty(); }
990281_4
@Override public boolean cancel(boolean mayInterruptIfRunning) { /* * Calling future.cancel() may trigger an exception in the operation that may * end up setting 'this' as completed exceptionally because of the failure... * Thus we mark 'this' as cancelled *first*, so that any exception in the operation * from...
990281_5
public <E2 extends Exception> Closer<E2> split() { return new Closer<>( state ); }
990281_6
public <E2 extends Exception> Closer<E2> split() { return new Closer<>( state ); }
990281_7
public SuppressingCloser push(AutoCloseable closeable) { return push( AutoCloseable::close, closeable ); }
990281_8
public SuppressingCloser push(AutoCloseable closeable) { return push( AutoCloseable::close, closeable ); }
990281_9
public SuppressingCloser push(AutoCloseable closeable) { return push( AutoCloseable::close, closeable ); }
991965_0
public <T> QueryBuilder<T> newQueryBuilder( final Class<T> resultType ) { NotQueryableException.throwIfNotQueryable( resultType ); final ServiceReference<EntityFinder> serviceReference; try { serviceReference = finder.findService( EntityFinder.class ); return new QueryBuilderImpl<T>( ser...
991965_1
public <T> QueryBuilder<T> newQueryBuilder( final Class<T> resultType ) { NotQueryableException.throwIfNotQueryable( resultType ); final ServiceReference<EntityFinder> serviceReference; try { serviceReference = finder.findService( EntityFinder.class ); return new QueryBuilderImpl<T>( ser...
991965_2
public <T> QueryBuilder<T> newQueryBuilder( final Class<T> resultType ) { NotQueryableException.throwIfNotQueryable( resultType ); final ServiceReference<EntityFinder> serviceReference; try { serviceReference = finder.findService( EntityFinder.class ); return new QueryBuilderImpl<T>( ser...
991965_3
public <T> QueryBuilder<T> newQueryBuilder( final Class<T> resultType ) { NotQueryableException.throwIfNotQueryable( resultType ); final ServiceReference<EntityFinder> serviceReference; try { serviceReference = finder.findService( EntityFinder.class ); return new QueryBuilderImpl<T>( ser...
991965_4
public <T> QueryBuilder<T> newQueryBuilder( final Class<T> resultType ) { NotQueryableException.throwIfNotQueryable( resultType ); final ServiceReference<EntityFinder> serviceReference; try { serviceReference = finder.findService( EntityFinder.class ); return new QueryBuilderImpl<T>( ser...
991965_5
public <T> QueryBuilder<T> newQueryBuilder( final Class<T> resultType ) { NotQueryableException.throwIfNotQueryable( resultType ); final ServiceReference<EntityFinder> serviceReference; try { serviceReference = finder.findService( EntityFinder.class ); return new QueryBuilderImpl<T>( ser...
991965_6
public <T> QueryBuilder<T> newQueryBuilder( final Class<T> resultType ) { NotQueryableException.throwIfNotQueryable( resultType ); final ServiceReference<EntityFinder> serviceReference; try { serviceReference = finder.findService( EntityFinder.class ); return new QueryBuilderImpl<T>( ser...
991965_7
@Override public <T> Iterator<T> iterator( Class<T> resultType, Specification<Composite> whereClause, Iterable<OrderBy> orderBySegments, Integer firstResult, Integer maxResults, Map<String, Object> variables ) { return list(resultType, whereClause, orderBySegments, firstResult, maxResults, variables).iterator(); }
991965_8
public List<K> resolveOrder() throws BindingException { if( resolved == null ) { buildUsageGraph(); resolved = new LinkedList<K>(); for( K item : data ) { int pos = resolved.size(); for( K entry : resolved ) { if( transi...
991965_9
public boolean transitiveUse( K source, K other ) throws BindingException { if( transitive == null ) { buildUsageGraph(); } return transitive.containsKey( source ) && transitive.get( source ).contains( other ); }
992007_0
public Object invoke( Object proxy, Method method, Object[] args ) throws Throwable { try { // Get Ruby object for declaring class of the method Class declaringClass = method.getDeclaringClass(); IRubyObject rubyObject = rubyObjects.get( declaringClass ); // If not yet created, c...
992007_1
public Object invoke( Object proxy, Method method, Object[] args ) throws Throwable { final FunctionResource groovySource = getFunctionResource( method ); if( groovySource != null ) { if( groovySource.script ) { return invokeAsObject( method, args, groovySource.url ); } ...
992007_2
public Object invoke( Object proxy, Method method, Object[] args ) throws Throwable { Context cx = Context.enter(); try { Scriptable proxyScope = Context.toObject( proxy, instanceScope ); proxyScope.setPrototype( instanceScope ); proxyScope.put( "compositeBuilderFactory", proxyScope,...
992007_3
public Object invoke( Object proxy, Method method, Object[] args ) throws Throwable { Interpreter runtime; synchronized( BeanShellMixin.class ) { runtime = runtimes.get( module ); } if( runtime == null ) { runtime = new Interpreter(); BshClassManager.createClassManage...
992007_4
public EventRouter route( Specification<DomainEventValue> specification, Receiver<DomainEventValue, T> receiver ) { routeEvent.put( specification, receiver ); return this; }
992007_5
public static Iterable<DomainEventValue> events( Iterable<UnitOfWorkDomainEventsValue> transactions ) { return Iterables.flattenIterables( Iterables.map( new Function<UnitOfWorkDomainEventsValue, Iterable<DomainEventValue>>() { @Override public Iterable<DomainEventValue> map( UnitOfWorkDomainEve...
992007_6
public EntityTypeSerializer() { // TODO A ton more types need to be added here dataTypes.put( String.class.getName(), XMLSchema.STRING ); dataTypes.put( Integer.class.getName(), XMLSchema.INT ); dataTypes.put( Boolean.class.getName(), XMLSchema.BOOLEAN ); dataTypes.put( Byte.class.getName(), XMLSche...
992007_7
public static <S, T extends S> ParameterizedType findParameterizedType( Class<T> type, Class<S> searchType ) { return ParameterizedTypes.findParameterizedType( (Type) type, searchType ); }
992007_8
public static <S, T extends S> Type[] findTypeVariables( Class<T> type, Class<S> searchType ) { return ParameterizedTypes.findParameterizedType( type, searchType ).getActualTypeArguments(); }
992012_0
public final void initialize( String schemaUrl, String dataUrl, String dbUrl, Properties connectionProperties ) throws SQLException, IOException { Connection connection1 = getSqlConnection( dbUrl, connectionProperties ); runScript( schemaUrl, connection1 ); Connection connection2 = getSqlConnection( dbU...
992012_1
public String convertIdentifier( final QualifiedName qualifiedIdentifier ) { final String name = qualifiedIdentifier.name(); if( name.equalsIgnoreCase( "identity" ) ) { return "ID"; } return name.toUpperCase(); }
992012_2
public Object getValueFromData( final Map<String, Object> rawData, final QualifiedName qualifiedName ) { String convertedIdentifier = convertIdentifier( qualifiedName ); if( rawData.containsKey( convertedIdentifier ) ) { return rawData.remove( convertedIdentifier ); } return null; }
992012_3
public Object getValueFromData( final Map<String, Object> rawData, final QualifiedName qualifiedName ) { String convertedIdentifier = convertIdentifier( qualifiedName ); if( rawData.containsKey( convertedIdentifier ) ) { return rawData.remove( convertedIdentifier ); } return null; }
992012_4
public Map<String, Object> convertKeys( Map<QualifiedName, Object> rawData ) { Map<String, Object> result = new HashMap<String, Object>( rawData.size() ); for( Map.Entry<QualifiedName, Object> entry : rawData.entrySet() ) { final String convertedIdentifier = convertIdentifier( entry.getKey() ); ...
992012_5
public Map<String, Object> convertKeys( Map<QualifiedName, Object> rawData ) { Map<String, Object> result = new HashMap<String, Object>( rawData.size() ); for( Map.Entry<QualifiedName, Object> entry : rawData.entrySet() ) { final String convertedIdentifier = convertIdentifier( entry.getKey() ); ...
992012_6
public Map<String, Object> convertKeys( Map<QualifiedName, Object> rawData ) { Map<String, Object> result = new HashMap<String, Object>( rawData.size() ); for( Map.Entry<QualifiedName, Object> entry : rawData.entrySet() ) { final String convertedIdentifier = convertIdentifier( entry.getKey() ); ...
992971_0
public Collection<Throwable> getCauseElements() { return Collections.unmodifiableCollection(this.causes); }
993994_0
public LoadedXml load(final String url, final int timeout) { try { final InputStream stream = loadAsStream(url, timeout); final DocumentBuilder builder = DOCUMENT_BUILDER_FACTORY.newDocumentBuilder(); final Document document = builder.parse(stream); return new LoadedXml(document); ...
993994_1
public LoadedXml load(final String url, final int timeout) { try { final InputStream stream = loadAsStream(url, timeout); final DocumentBuilder builder = DOCUMENT_BUILDER_FACTORY.newDocumentBuilder(); final Document document = builder.parse(stream); return new LoadedXml(document); ...
993994_2
public void process(final HttpServletRequest req, final HttpServletResponse res, final String realPath) throws UnsupportedEncodingException, ServletException { req.setCharacterEncoding(encoding); res.setCharacterEncoding(encoding); log.info("Start process user request...
993994_3
public void process(final HttpServletRequest req, final HttpServletResponse res, final String realPath) throws UnsupportedEncodingException, ServletException { req.setCharacterEncoding(encoding); res.setCharacterEncoding(encoding); log.info("Start process user request...
993994_4
public void process(final HttpServletRequest req, final HttpServletResponse res, final String realPath) throws UnsupportedEncodingException, ServletException { req.setCharacterEncoding(encoding); res.setCharacterEncoding(encoding); log.info("Start process user request...
993994_5
public long addUser(final String login, final String fio, final String passwd, final String passwdAdd) throws UserCreationException { final UserInfo user = getUser(login); if (user != null) { throw new UserCreationException(UserCreationException.Type.ALREADY_EXISTS); } try { jdbcTemplate...
993994_6
public UserInfo getUser(final long userId) { final List<UserInfo> users = jdbcTemplate.query( "select * from auth_user where user_id = ?", USER_INFO_MAPPER, userId); if (users.isEmpty()) { return null; } return users.get(0); }
993994_7
public boolean checkUser(final long userId, final String passwd) { return 0 < jdbcTemplate.queryForInt( "select count(*) from auth_user where user_id = ? and passwd_hash = ?", userId, passwd ); }
994088_0
@Override public void setCacheDir(File dir) { // comment below as inmemory configuration does not require dir to be exists // this is relevant when deploy app on readonly file system like heroku and gae if (!dir.isDirectory() && !dir.mkdir()) throw new IllegalArgumentException("not a dir"); ...
1001284_0
@Override protected boolean okToAdd(Object key, Object value) { return key != null && value != null; }
1001284_1
@Override protected boolean okToAdd(Object key, Object value) { return key != null && value != null; }
1001284_2
@Override protected boolean okToAdd(Object key, Object value) { return key != null && value != null; }
1001284_3
@Override protected boolean okToAdd(Object key, Object value) { return key != null && value != null; }
1001284_4
public static CodePoints forCharset(Charset c) { if (ENCODABLES.containsKey(c)) return ENCODABLES.get(c); CodePoints points = load(c); ENCODABLES.put(c, points); return points; }
1001284_5
public int at(int index) { if (index < 0) throw new IndexOutOfBoundsException("illegal negative index: " + index); int min = 0; int max = ranges.size() - 1; while (min <= max) { int midpoint = min + ((max - min) / 2); CodePointRange current = ranges.get(midpoint); if (ind...
1001284_6
public int at(int index) { if (index < 0) throw new IndexOutOfBoundsException("illegal negative index: " + index); int min = 0; int max = ranges.size() - 1; while (min <= max) { int midpoint = min + ((max - min) / 2); CodePointRange current = ranges.get(midpoint); if (ind...
1001284_7
public int size() { if (ranges.isEmpty()) return 0; CodePointRange last = ranges.get(ranges.size() - 1); return last.previousCount + last.size(); }
1001284_8
@Override public Void generate(SourceOfRandomness random, GenerationStatus status) { return null; }
1001284_9
public static <T, U> T makeLambda( Class<T> lambdaType, Generator<U> returnValueGenerator, GenerationStatus status) { if (singleAbstractMethodOf(lambdaType) == null) { throw new IllegalArgumentException( lambdaType + " is not a functional interface type"); } return lambdaType...
1006123_0
public Wavelet fetchWavelet(WaveId waveId, WaveletId waveletId) throws ClientWaveException { return fetchWavelet(waveId, waveletId, null); }
1007836_0
public int parse() { String expression = " if(" + _input + "){" + "returnValue = VALUEA;" + "}" + " else { returnValue = VALUEB; }"; expression = expression.replaceAll("0", " false " ); expression = expression.replaceAll("1", " true " ); expression = expression.replaceAl...
1007836_1
public int parse() { String expression = " if(" + _input + "){" + "returnValue = VALUEA;" + "}" + " else { returnValue = VALUEB; }"; expression = expression.replaceAll("0", " false " ); expression = expression.replaceAll("1", " true " ); expression = expression.replaceAl...
1007836_2
public int parse() { String expression = " if(" + _input + "){" + "returnValue = VALUEA;" + "}" + " else { returnValue = VALUEB; }"; expression = expression.replaceAll("0", " false " ); expression = expression.replaceAll("1", " true " ); expression = expression.replaceAl...
1007836_3
public int parse() { String expression = " if(" + _input + "){" + "returnValue = VALUEA;" + "}" + " else { returnValue = VALUEB; }"; expression = expression.replaceAll("0", " false " ); expression = expression.replaceAll("1", " true " ); expression = expression.replaceAl...
1007836_4
public int parse() { String expression = " if(" + _input + "){" + "returnValue = VALUEA;" + "}" + " else { returnValue = VALUEB; }"; expression = expression.replaceAll("0", " false " ); expression = expression.replaceAll("1", " true " ); expression = expression.replaceAl...
1007836_5
public int parse() { String expression = " if(" + _input + "){" + "returnValue = VALUEA;" + "}" + " else { returnValue = VALUEB; }"; expression = expression.replaceAll("0", " false " ); expression = expression.replaceAll("1", " true " ); expression = expression.replaceAl...
1007836_6
public int parse() { String expression = " if(" + _input + "){" + "returnValue = VALUEA;" + "}" + " else { returnValue = VALUEB; }"; expression = expression.replaceAll("0", " false " ); expression = expression.replaceAll("1", " true " ); expression = expression.replaceAl...
1007836_7
public int parse() { String expression = " if(" + _input + "){" + "returnValue = VALUEA;" + "}" + " else { returnValue = VALUEB; }"; expression = expression.replaceAll("0", " false " ); expression = expression.replaceAll("1", " true " ); expression = expression.replaceAl...
1007836_8
public int process() { _input = _input.replaceAll(" ", ""); _input = _input.replaceAll("!1", "0"); _input = _input.replaceAll("!0", "1"); Matcher m = p.matcher(_input); if(m.find()) { _input = _input.substring(1,_input.length()-1); } Matcher m1 = p1....
1007836_9
public int process() { _input = _input.replaceAll(" ", ""); _input = _input.replaceAll("!1", "0"); _input = _input.replaceAll("!0", "1"); Matcher m = p.matcher(_input); if(m.find()) { _input = _input.substring(1,_input.length()-1); } Matcher m1 = p1....
1014623_0
@Override public String phoneticRhymePart(final String word) { String withoutPunctuation = removeTwitterChars(removeTrailingPunctuation(word)); // If it is a number, just translate its phonetic part if (WordUtils.isNumber(withoutPunctuation)) { withoutPunctuation = SpanishNumber.getBaseSound(wit...
1014623_1
public static String capitalize(final String str) { if (str == null) { return null; } switch (str.length()) { case 0: return str; case 1: return str.toUpperCase(); default: return str.substring(0, 1).toUpperCase() + str.substring(1)...
1014623_2
public static String getLastWord(final String sentence) { String word = ""; if (sentence != null) { List<String> words = Arrays.asList(sentence.split(" ")); if (words.size() > 0) { word = words.get(words.size() - 1); } } return word; }
1014623_3
public static boolean isNumber(String word) { if (word == null) { return false; } String wordToParse = new String(word); if (wordToParse.startsWith("-")) { wordToParse = wordToParse.replaceFirst("-", ""); } if (wordToParse.length() == 0) { return false; } ...
1014623_4
static String getConfigValue(final String propertyName) { return getConfiguration().getProperty(propertyName); }
1014623_5
static String getRequiredConfigValue(final String propertyName) { String value = getConfiguration().getProperty(propertyName); if (value == null) { throw new ConfigurationException("Te requested property [" + propertyName + "] was not set."); } return value; }
1014623_6
static String getRequiredConfigValue(final String propertyName) { String value = getConfiguration().getProperty(propertyName); if (value == null) { throw new ConfigurationException("Te requested property [" + propertyName + "] was not set."); } return value; }
1014623_7
public Set<String> findAll() throws IOException { Set<String> rhymes = new HashSet<String>(); connect(); try { String lastId = getLastId(sentencens); if (lastId != null) { Integer n = Integer.parseInt(getLastId(sentencens)); for (int i = 1; i <= n; i++) ...
1014623_8
public String getRhyme(final String sentence) throws IOException { String lastWord = WordUtils.getLastWord(sentence); String rhymepart = wordParser.phoneticRhymePart(lastWord); StressType type = wordParser.stressType(lastWord); LOGGER.debug("Finding rhymes for {}", sentence); Set<String> rhymes = Se...
1014623_9
public void delete(final String sentence) throws IOException { String word = WordUtils.getLastWord(sentence); if (word.isEmpty()) { return; } String rhyme = normalizeString(wordParser.phoneticRhymePart(word)); StressType type = wordParser.stressType(word); connect(); try { ...
1017889_0
public boolean containsAncestor(Path path) { for (Path p : this) { if (p.isAncestorOf(path)) { return true; } } return false; }
1017889_1
public boolean containsParent(Path path) { for (Path p : this) { if (p.isParentOf(path)) { return true; } } return false; }
1017889_2
public void removeDescendants(Path path) { Iterator<Path> i = iterator(); while (i.hasNext()) { Path p = i.next(); if (p.isDescendantOf(path)) { i.remove(); } } }
1017889_3
public boolean removeWithDescendants(Path path) { boolean ret = remove(path); removeDescendants(path); return ret; }
1017889_4
public Path append(Path relative) { if (relative == null) { throw new IllegalArgumentException("Argument 'relative' cannot be null"); } if (relative.isAbsolute()) { throw new IllegalArgumentException("Cannot append an absolute path"); } StringBuilder appended = new StringBuilder(path...
1017889_5
@Override public String toString() { return path; }
1017889_6
public String getName() { if (path.equals(SEPARATOR)) { return path; } else { int last = path.lastIndexOf(SEPARATOR); return path.substring(last + 1); } }
1017889_7
public boolean isAbsolute() { return path.startsWith("/"); }
1017889_8
public boolean isCanonical() { int offset = 0; // whether a text segment (not "..") has been found boolean text = false; // until empty paths are supported if (path.equals(".")) { return true; } if (!isRoot() && path.endsWith("/")) { return false; } while (offset < pa...
1017889_9
public boolean isChildOf(Path other) { return isDescendantOf(other) && size() == other.size() + 1; }
1020601_0
@Override public Object get(Map<String, Object> source, String memberName) { return source.get(memberName); }
1020601_1
public Boolean convert(MappingContext<Object, Boolean> context) { Object source = context.getSource(); if (source == null) return null; String stringValue = source.toString().toLowerCase(); if (stringValue.length() == 0) return null; for (int i = 0; i < TRUE_STRINGS.length; i++) if (TRUE_STRINGS[i...
1020601_2
public Number convert(MappingContext<Object, Number> context) { Object source = context.getSource(); if (source == null) return null; Class<?> destinationType = Primitives.wrapperFor(context.getDestinationType()); if (source instanceof Number) return numberFor((Number) source, destinationType); if (so...
1020601_3
public Number convert(MappingContext<Object, Number> context) { Object source = context.getSource(); if (source == null) return null; Class<?> destinationType = Primitives.wrapperFor(context.getDestinationType()); if (source instanceof Number) return numberFor((Number) source, destinationType); if (so...
1020601_4
public Number convert(MappingContext<Object, Number> context) { Object source = context.getSource(); if (source == null) return null; Class<?> destinationType = Primitives.wrapperFor(context.getDestinationType()); if (source instanceof Number) return numberFor((Number) source, destinationType); if (so...
1020601_5
public Number convert(MappingContext<Object, Number> context) { Object source = context.getSource(); if (source == null) return null; Class<?> destinationType = Primitives.wrapperFor(context.getDestinationType()); if (source instanceof Number) return numberFor((Number) source, destinationType); if (so...
1020601_6
public Number convert(MappingContext<Object, Number> context) { Object source = context.getSource(); if (source == null) return null; Class<?> destinationType = Primitives.wrapperFor(context.getDestinationType()); if (source instanceof Number) return numberFor((Number) source, destinationType); if (so...
1020601_7
public Number convert(MappingContext<Object, Number> context) { Object source = context.getSource(); if (source == null) return null; Class<?> destinationType = Primitives.wrapperFor(context.getDestinationType()); if (source instanceof Number) return numberFor((Number) source, destinationType); if (so...
1020601_8
public Number convert(MappingContext<Object, Number> context) { Object source = context.getSource(); if (source == null) return null; Class<?> destinationType = Primitives.wrapperFor(context.getDestinationType()); if (source instanceof Number) return numberFor((Number) source, destinationType); if (so...
1020601_9
public Number convert(MappingContext<Object, Number> context) { Object source = context.getSource(); if (source == null) return null; Class<?> destinationType = Primitives.wrapperFor(context.getDestinationType()); if (source instanceof Number) return numberFor((Number) source, destinationType); if (so...
1024699_0
public static void checkUrlIsValid(String url) throws IllegalArgumentException { logger.debug("Url is : {}",url); boolean urlIsValid; Pattern p = Pattern.compile(URL_PATTERN); Matcher m = p.matcher(url); if (!m.matches()) { // not an url ? maybe an ip address p = Pattern.compile(IP_ADDRESS_PATTERN); m = p.ma...
1024699_1
public static void checkUrlIsValid(String url) throws IllegalArgumentException { logger.debug("Url is : {}",url); boolean urlIsValid; Pattern p = Pattern.compile(URL_PATTERN); Matcher m = p.matcher(url); if (!m.matches()) { // not an url ? maybe an ip address p = Pattern.compile(IP_ADDRESS_PATTERN); m = p.ma...