signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class DefaultTextBundleRegistry { /** * Load java properties bundle with iso - 8859-1 * @ param bundleName * @ param locale * @ return None or bundle corresponding bindleName . locale . properties */ protected Option < TextBundle > loadJavaBundle ( String bundleName , Locale locale ) { } }
Properties properties = new Properties ( ) ; String resource = toJavaResourceName ( bundleName , locale ) ; try { InputStream is = ClassLoaders . getResourceAsStream ( resource , getClass ( ) ) ; if ( null == is ) return Option . none ( ) ; properties . load ( is ) ; is . close ( ) ; } catch ( IOException e ) { return ...
import java . util . ArrayList ; import java . util . Arrays ; import java . util . List ; class ModifyTuple { /** * This function modifies a tuple ( represented as a List ) by inserting a value into a list at a specific index . * Example : * modifyTuple ( Arrays . asList ( " HELLO " , 5 , new ArrayList < > ( ) , t...
List < Object > newList = new ArrayList < > ( inputList ) ; List < Integer > sublist = new ArrayList < > ( ( List < Integer > ) newList . get ( index ) ) ; sublist . add ( value ) ; newList . set ( index , sublist ) ; return newList ;
public class EntityGroupImpl { /** * Adds the < code > IGroupMember < / code > key to the appropriate member key cache by copying the * cache , adding to the copy , and then replacing the original with the copy . At this point , * < code > gm < / code > does not yet have < code > this < / code > in its containing g...
final EntityIdentifier cacheKey = getUnderlyingEntityIdentifier ( ) ; Element element = childrenCache . get ( cacheKey ) ; @ SuppressWarnings ( "unchecked" ) final Set < IGroupMember > set = element != null ? ( Set < IGroupMember > ) element . getObjectValue ( ) : buildChildrenSet ( ) ; final Set < IGroupMember > child...
public class PrintablePage { /** * Default configuration for Month view in the preview Pane . * @ return */ protected MonthView createMonthView ( ) { } }
MonthView newMonthView = new MonthView ( ) ; newMonthView . setShowToday ( false ) ; newMonthView . setShowCurrentWeek ( false ) ; newMonthView . weekFieldsProperty ( ) . bind ( weekFieldsProperty ( ) ) ; newMonthView . showFullDayEntriesProperty ( ) . bind ( showAllDayEntriesProperty ( ) ) ; newMonthView . showTimedEn...
public class LoggingUtils { /** * Prepends short session details ( result of getId ) for the session in square brackets to the message . * @ param message the message to be logged * @ param session an instance of IoSessionEx * @ return example : " [ wsn # 34 127.0.0.0.1:41234 ] this is the log message " */ public...
return format ( "[%s] %s" , getId ( session ) , message ) ;
public class CommercePriceListUtil { /** * Returns the commerce price list where uuid = & # 63 ; and groupId = & # 63 ; or returns < code > null < / code > if it could not be found , optionally using the finder cache . * @ param uuid the uuid * @ param groupId the group ID * @ param retrieveFromCache whether to r...
return getPersistence ( ) . fetchByUUID_G ( uuid , groupId , retrieveFromCache ) ;
public class Ifc2x3tc1PackageImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public EClass getIfcFeatureElementAddition ( ) { } }
if ( ifcFeatureElementAdditionEClass == null ) { ifcFeatureElementAdditionEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc2x3tc1Package . eNS_URI ) . getEClassifiers ( ) . get ( 232 ) ; } return ifcFeatureElementAdditionEClass ;
public class Rss2Parser { /** * Handles a node from the tag node and assigns it to the correct article value . * @ param tag The tag which to handle . * @ param article Article object to assign the node value to . * @ return True if a proper tag was given or handled . False if improper tag was given or * if an ...
try { if ( xmlParser . next ( ) != XmlPullParser . TEXT ) return false ; if ( tag . equalsIgnoreCase ( "link" ) ) article . setSource ( Uri . parse ( xmlParser . getText ( ) ) ) ; else if ( tag . equalsIgnoreCase ( "title" ) ) article . setTitle ( xmlParser . getText ( ) ) ; else if ( tag . equalsIgnoreCase ( "descript...
public class Searcher { /** * Searches the pattern starting from the given element . * @ param ele element to start from * @ param pattern pattern to search * @ return matching results */ public static List < Match > search ( BioPAXElement ele , Pattern pattern ) { } }
assert pattern . getStartingClass ( ) . isAssignableFrom ( ele . getModelInterface ( ) ) ; Match m = new Match ( pattern . size ( ) ) ; m . set ( ele , 0 ) ; return search ( m , pattern ) ;
public class BackupResourceStorageConfigsInner { /** * Updates vault storage model type . * @ param vaultName The name of the recovery services vault . * @ param resourceGroupName The name of the resource group where the recovery services vault is present . * @ param parameters Vault storage config request * @ ...
return ServiceFuture . fromResponse ( updateWithServiceResponseAsync ( vaultName , resourceGroupName , parameters ) , serviceCallback ) ;
public class ANXAdapters { /** * Adapts a ANX Wallet to a XChange Balance * @ param anxWallet * @ return */ public static Balance adaptBalance ( ANXWallet anxWallet ) { } }
if ( anxWallet == null ) { // use the presence of a currency String to indicate existing wallet at ANX return null ; // an account maybe doesn ' t contain a ANXWallet } else { return new Balance ( Currency . getInstance ( anxWallet . getBalance ( ) . getCurrency ( ) ) , anxWallet . getBalance ( ) . getValue ( ) , anxWa...
public class ParameterizedTypeName { /** * Returns a new { @ link ParameterizedTypeName } instance for the specified { @ code name } as nested * inside this class , with the specified { @ code typeArguments } . */ public ParameterizedTypeName nestedClass ( String name , List < TypeName > typeArguments ) { } }
checkNotNull ( name , "name == null" ) ; return new ParameterizedTypeName ( this , rawType . nestedClass ( name ) , typeArguments , new ArrayList < > ( ) ) ;
public class LogManager { /** * Sets the level of a logger * @ param logger The name of the logger to set the level for . * @ param level The level to set the logger at */ public void setLevel ( String logger , Level level ) { } }
Logger log = getLogger ( logger ) ; log . setLevel ( level ) ; for ( String loggerName : getLoggerNames ( ) ) { if ( loggerName . startsWith ( logger ) && ! loggerName . equals ( logger ) ) { getLogger ( loggerName ) . setLevel ( level ) ; } }
public class Format { /** * formats map using ' : ' as key - value separator instead of default ' = ' */ public static < V > String formatPairs ( Map < String , V > entries ) { } }
Iterator < Entry < String , V > > iterator = entries . entrySet ( ) . iterator ( ) ; switch ( entries . size ( ) ) { case 0 : return "{}" ; case 1 : { return String . format ( "{%s}" , keyValueString ( iterator . next ( ) ) ) ; } default : { StringBuilder builder = new StringBuilder ( ) ; builder . append ( "{" ) ; bui...
public class Type { /** * Creates a new instance of { @ code Package } when the given name is not empty other wise it returns * { @ link Package # UNDEFINED } . * @ param packageName * package name * @ return instance of { @ code Package } and never null */ @ Nonnull private static Package createPackage ( @ Non...
Check . notNull ( packageName , "packageName" ) ; return packageName . isEmpty ( ) ? Package . UNDEFINED : new Package ( packageName ) ;
public class InteractableLookupMap { /** * Avoid code duplication in above two methods */ private Interactable findNextLeftOrRight ( Interactable interactable , boolean isRight ) { } }
int directionTerm = isRight ? 1 : - 1 ; TerminalPosition startPosition = interactable . getCursorLocation ( ) ; if ( startPosition == null ) { // If the currently active interactable component is not showing the cursor , use the top - left position // instead if we ' re going left , or the top - right position if we ' ...
public class XPathFactoryFinder { /** * < p > Creates a new { @ link XPathFactory } object for the specified * schema language . < / p > * @ param uri * Identifies the underlying object model . * @ return < code > null < / code > if the callee fails to create one . * @ throws NullPointerException * If the p...
if ( uri == null ) { throw new NullPointerException ( "uri == null" ) ; } XPathFactory f = _newFactory ( uri ) ; if ( debug ) { if ( f != null ) { debugPrintln ( "factory '" + f . getClass ( ) . getName ( ) + "' was found for " + uri ) ; } else { debugPrintln ( "unable to find a factory for " + uri ) ; } } return f ;
public class PersistenceBrokerThreadMapping { /** * Return the current open { @ link org . apache . ojb . broker . PersistenceBroker } * instance for the given { @ link org . apache . ojb . broker . PBKey } , if any . * @ param key * @ return null if no open { @ link org . apache . ojb . broker . PersistenceBroke...
HashMap map = ( HashMap ) currentBrokerMap . get ( ) ; WeakHashMap set ; PersistenceBrokerInternal broker = null ; if ( map == null ) { return null ; } set = ( WeakHashMap ) map . get ( key ) ; if ( set == null ) { return null ; } // seek for an open broker , preferably in transaction for ( Iterator it = set . keySet (...
public class DatamappingHelper { /** * Translate annotations ( only when { @ link Datamappingstype # isUseannotations ( ) } is true ) and xml configuration into * { @ link DataMapping } for use in a { @ link DatamappingProcessor } , uses instance cache . XML config will override * Annotations on classes . * @ par...
if ( ! dataMappings . containsKey ( dataClass . getName ( ) + id ) ) { boolean useAnnotations = datamappingstype == null || datamappingstype . isUseannotations ( ) ; Datamappingtype jaxbMapping = ( datamappingstype != null ) ? findDataMapping ( dataClass , id , datamappingstype ) : null ; DataMapping dm = new DataMappi...
public class ExportNamesCacheKeyGenerator { /** * / * ( non - Javadoc ) * @ see com . ibm . jaggr . core . cachekeygenerator . AbstractCacheKeyGenerator # generateKey ( javax . servlet . http . HttpServletRequest ) */ @ Override public String generateKey ( HttpServletRequest request ) { } }
boolean exportNames = TypeUtil . asBoolean ( request . getAttribute ( IHttpTransport . EXPORTMODULENAMES_REQATTRNAME ) ) ; return eyecatcher + ":" + ( exportNames ? "1" : "0" ) ; // $ NON - NLS - 1 $ / / $ NON - NLS - 2 $ / / $ NON - NLS - 3 $
public class GenericDraweeHierarchy { /** * Sets the actual image focus point . */ public void setActualImageFocusPoint ( PointF focusPoint ) { } }
Preconditions . checkNotNull ( focusPoint ) ; getScaleTypeDrawableAtIndex ( ACTUAL_IMAGE_INDEX ) . setFocusPoint ( focusPoint ) ;
public class DescribeImagesResult { /** * A list of < a > ImageDetail < / a > objects that contain data about the image . * @ param imageDetails * A list of < a > ImageDetail < / a > objects that contain data about the image . */ public void setImageDetails ( java . util . Collection < ImageDetail > imageDetails ) ...
if ( imageDetails == null ) { this . imageDetails = null ; return ; } this . imageDetails = new java . util . ArrayList < ImageDetail > ( imageDetails ) ;
public class KeyManagerImpl { /** * { @ inheritDoc } */ @ Override public String getGeocodingKey ( ) { } }
if ( geocodingKey != null ) { return geocodingKey ; } try ( FileInputStream fileStream = new FileInputStream ( fileName ) ; InputStreamReader iStreamReader = new InputStreamReader ( fileStream , "UTF-8" ) ; BufferedReader br = new BufferedReader ( iStreamReader ) ; ) { final StringBuilder sb = new StringBuilder ( ) ; f...
public class ProxySettingsManager { /** * Find all proxy settings matching the provided parameters . * @ param sProtocol * Destination server protocol . * @ param sHostName * Destination host name * @ param nPort * Destination port * @ return A non - < code > null < / code > set with all matching proxy se...
final ICommonsOrderedSet < IProxySettings > ret = new CommonsLinkedHashSet < > ( ) ; for ( final IProxySettingsProvider aProvider : getAllProviders ( ) ) ret . addAll ( aProvider . getAllProxySettings ( sProtocol , sHostName , nPort ) ) ; return ret ;
public class TextUtilities { /** * Locates the end of the word at the specified position . * @ param line The text * @ param pos The position * @ param noWordSep Characters that are non - alphanumeric , but * should be treated as word characters anyway * @ param joinNonWordChars Treat consecutive non - alphan...
return findWordEnd ( line , pos , noWordSep , joinNonWordChars , false ) ;
public class AttributeTypeImpl { /** * This method is overridden so that we can check that the regex of the new super type ( if it has a regex ) * can be applied to all the existing instances . */ @ Override public AttributeType < D > sup ( AttributeType < D > superType ) { } }
( ( AttributeTypeImpl < D > ) superType ) . sups ( ) . forEach ( st -> checkInstancesMatchRegex ( st . regex ( ) ) ) ; return super . sup ( superType ) ;
public class AmazonComprehendClient { /** * Starts an asynchronous dominant language detection job for a collection of documents . Use the operation to track * the status of a job . * @ param startDominantLanguageDetectionJobRequest * @ return Result of the StartDominantLanguageDetectionJob operation returned by ...
request = beforeClientExecution ( request ) ; return executeStartDominantLanguageDetectionJob ( request ) ;
public class LocalFileBinary { /** * ( non - Javadoc ) * @ see * org . fcrepo . kernel . modeshape . FedoraBinaryImpl # setContent ( java . io . InputStream , java . lang . String , * java . util . Collection , java . lang . String , org . fcrepo . kernel . api . services . policy . StoragePolicyDecisionPoint ) *...
throw new UnsupportedOperationException ( "Cannot call setContent() on local file, call setExternalContent() instead" ) ;
public class WbEditingAction { /** * Executes the API action " wbremoveclaims " for the given parameters . * @ param statementIds * the statement ids to delete * @ param bot * if true , edits will be flagged as " bot edits " provided that * the logged in user is in the bot group ; for regular users , the * ...
Validate . notNull ( statementIds , "statementIds parameter cannot be null when deleting statements" ) ; Validate . notEmpty ( statementIds , "statement ids to delete must be non-empty when deleting statements" ) ; Validate . isTrue ( statementIds . size ( ) <= 50 , "At most 50 statements can be deleted at once" ) ; Ma...
public class DictionaryFeatureVectorGenerator { /** * Creates a { @ code DictionaryFeatureVectorGenerator } which contains * all of the features generated from { @ code data } that occur more * than { @ code occurrenceThreshold } times . * @ param data * @ param generator * @ param occurrenceThreshold * @ r...
CountAccumulator < U > featureOccurrenceCounts = FeatureGenerators . getFeatureCounts ( generator , data ) ; IndexedList < U > features = new IndexedList < U > ( ) ; features . addAll ( featureOccurrenceCounts . getKeysAboveCountThreshold ( occurrenceThreshold ) ) ; return new DictionaryFeatureVectorGenerator < T , U >...
public class CmsVfsSitemapService { /** * Reeds the site root entry . < p > * @ param rootPath the root path of the sitemap root * @ param targetPath the target path to open * @ return the site root entry * @ throws CmsSecurityException in case of insufficient permissions * @ throws CmsException if something ...
String sitePath = "/" ; if ( ( rootPath != null ) ) { sitePath = getCmsObject ( ) . getRequestContext ( ) . removeSiteRoot ( rootPath ) ; } CmsJspNavElement navElement = getNavBuilder ( ) . getNavigationForResource ( sitePath , CmsResourceFilter . ONLY_VISIBLE_NO_DELETED ) ; CmsClientSitemapEntry result = toClientEntry...
public class BoundedWriteBehindQueue { /** * Increments or decrements node - wide { @ link WriteBehindQueue } capacity according to the given value . * Throws { @ link ReachedMaxSizeException } when node - wide maximum capacity which is stated by the variable * { @ link # maxCapacity } is exceeded . * @ param cap...
int maxCapacity = this . maxCapacity ; AtomicInteger writeBehindQueueItemCounter = this . writeBehindQueueItemCounter ; int currentCapacity = writeBehindQueueItemCounter . get ( ) ; int newCapacity = currentCapacity + capacity ; if ( newCapacity < 0 ) { return ; } if ( maxCapacity < newCapacity ) { throwException ( cur...
public class PropertiesAdapter { /** * Returns { @ literal null } for a { @ literal " null " } { @ link String } value or simply returns the { @ link String } value . * The { @ link String } value is safely trimmed before evaluation . * @ param value { @ link String } value to evaluate . * @ return a { @ literal ...
return ( "null" . equalsIgnoreCase ( String . valueOf ( value ) . trim ( ) ) ? null : value ) ;
public class ResourcesInner { /** * Validates whether resources can be moved from one resource group to another resource group . * This operation checks whether the specified resources can be moved to the target . The resources to move must be in the same source resource group . The target resource group may be in a ...
beginValidateMoveResourcesWithServiceResponseAsync ( sourceResourceGroupName , parameters ) . toBlocking ( ) . single ( ) . body ( ) ;
public class PluginDeserializer { /** * Gson invokes this call - back method during deserialization when it encounters a field of the specified type . * @ param element The Json data being deserialized * @ param type The type of the Object to deserialize to * @ param context The JSON deserialization context * @...
JsonObject obj = element . getAsJsonObject ( ) ; JsonElement plugin = obj . get ( "plugin" ) ; if ( plugin != null && plugin . isJsonObject ( ) ) return gson . fromJson ( plugin , Plugin . class ) ; return gson . fromJson ( element , Plugin . class ) ;
public class DomainPropertySource { /** * Initializes the property service . * @ return True if initialized . */ private boolean initPropertyService ( ) { } }
if ( propertyService == null && appContext . containsBean ( "propertyService" ) ) { propertyService = appContext . getBean ( "propertyService" , IPropertyService . class ) ; } return propertyService != null ;
public class Config { /** * Loads default entries that were not provided by a file or command line * This should be called in the constructor */ protected void setDefaults ( ) { } }
// map . put ( " tsd . network . port " , " " ) ; / / does not have a default , required // map . put ( " tsd . http . cachedir " , " " ) ; / / does not have a default , required // map . put ( " tsd . http . staticroot " , " " ) ; / / does not have a default , required default_map . put ( "tsd.mode" , "rw" ) ; default...
public class Ifc2x3tc1PackageImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public EClass getIfcDayInMonthNumber ( ) { } }
if ( ifcDayInMonthNumberEClass == null ) { ifcDayInMonthNumberEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc2x3tc1Package . eNS_URI ) . getEClassifiers ( ) . get ( 663 ) ; } return ifcDayInMonthNumberEClass ;
public class Utils { /** * Get time zone of time zone id * @ param id timezone id * @ return timezone */ private static DateTimeZone getTimeZone ( String id ) { } }
DateTimeZone zone ; try { zone = DateTimeZone . forID ( id ) ; } catch ( IllegalArgumentException e ) { throw new IllegalArgumentException ( "TimeZone " + id + " not recognized" ) ; } return zone ;
public class Point { /** * Create a random point , uniformly distributed over the surface of the Earth . * @ param randomGenerator Random generator used to create a point . * @ return Random point with uniform distribution over the sphere . */ @ Nonnull public static Point fromUniformlyDistributedRandomPoints ( @ N...
checkNonnull ( "randomGenerator" , randomGenerator ) ; // Calculate uniformly distributed 3D point on sphere ( radius = 1.0 ) : // http : / / mathproofs . blogspot . co . il / 2005/04 / uniform - random - distribution - on - sphere . html final double unitRand1 = randomGenerator . nextDouble ( ) ; final double unitRand...
public class AbstractTypeComputer { /** * / * @ NotNull */ protected LightweightTypeReference getTypeForName ( Class < ? > clazz , ITypeComputationState state ) { } }
JvmType type = findDeclaredType ( clazz , state ) ; ITypeReferenceOwner owner = state . getReferenceOwner ( ) ; if ( type == null ) { return owner . newUnknownTypeReference ( clazz . getName ( ) ) ; } return owner . toLightweightTypeReference ( type ) ;
public class MappingCache { /** * Return a new or cached mapper * @ param clazz * class for the mapper * @ return mapper */ public < T > Mapping < T > getMapping ( Class < T > clazz , boolean includeParentFields ) { } }
return getMapping ( clazz , new DefaultAnnotationSet ( ) , includeParentFields ) ;
public class AbstractMessageParser { /** * This method serializes the whole BHS to its byte representation . * @ param dst The destination < code > ByteBuffer < / code > to write to . * @ param offset The start offset in < code > dst < / code > . * @ throws InternetSCSIException If any violation of the iSCSI - St...
dst . position ( offset ) ; dst . putInt ( offset , dst . getInt ( ) | serializeBytes1to3 ( ) ) ; dst . position ( offset + BasicHeaderSegment . BYTES_8_11 ) ; dst . putInt ( serializeBytes8to11 ( ) ) ; dst . putInt ( serializeBytes12to15 ( ) ) ; dst . position ( offset + BasicHeaderSegment . BYTES_20_23 ) ; dst . putI...
public class RestfulHandler { /** * 将request body的byte字节数组复制到内存中 * @ param httpServletRequest * @ return * @ throws IOException */ private byte [ ] copyBytesFromRequest ( HttpServletRequest httpServletRequest ) throws IOException { } }
InputStream inputStream = httpServletRequest . getInputStream ( ) ; ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream ( ) ; byte [ ] buffer = new byte [ 1024 ] ; int offset = - 1 ; while ( ( offset = inputStream . read ( buffer , 0 , 1024 ) ) > 0 ) { byteArrayOutputStream . write ( buffer , 0 , of...
public class mps_network_config { /** * < pre > * Performs generic data validation for the operation to be performed * < / pre > */ protected void validate ( String operationType ) throws Exception { } }
super . validate ( operationType ) ; MPSIPAddress ip_address_validator = new MPSIPAddress ( ) ; ip_address_validator . setConstraintIsReq ( MPSConstants . MODIFY_CONSTRAINT , true ) ; ip_address_validator . validate ( operationType , ip_address , "\"ip_address\"" ) ; MPSIPAddress netmask_validator = new MPSIPAddress ( ...
public class Util { /** * Make a given { @ link XPath } object " xalan - extension aware " , if Xalan is on * the classpath . */ @ SuppressWarnings ( "deprecation" ) static final void xalanExtensionAware ( XPath xpath ) { } }
// Load xalan extensions thread - safely for all of jOOX if ( ! xalanExtensionLoaded ) { synchronized ( Util . class ) { if ( ! xalanExtensionLoaded ) { xalanExtensionLoaded = true ; try { xalanNamespaceContext = ( NamespaceContext ) Class . forName ( "org.apache.xalan.extensions.ExtensionNamespaceContext" ) . newInsta...
public class Complex { /** * Initializes all subconstraints . * @ return always { @ code null } */ @ Override public String initValues ( final FieldCase ca ) { } }
if ( ca != null ) { /* * If a FieldCase is given all fields will be generated anew , independent of the case * combination . */ for ( Constraint c : constraints ) { c . resetValues ( ) ; } } for ( Constraint c : constraints ) { c . initValues ( ca ) ; } return null ;
public class GenderRatioProcessor { /** * Counts a single page of the specified gender . If this is the first page * of that gender on this site , a suitable key is added to the list of the * site ' s genders . * @ param gender * the gender to count * @ param siteRecord * the site record to count it for */ ...
Integer curValue = siteRecord . genderCounts . get ( gender ) ; if ( curValue == null ) { siteRecord . genderCounts . put ( gender , 1 ) ; } else { siteRecord . genderCounts . put ( gender , curValue + 1 ) ; }
public class SessionManager { /** * Remove a session * @ param session session instance */ public void destorySession ( Session session ) { } }
session . attributes ( ) . clear ( ) ; sessionMap . remove ( session . id ( ) ) ; Event event = new Event ( ) ; event . attribute ( "session" , session ) ; eventManager . fireEvent ( EventType . SESSION_DESTROY , event ) ;
public class IntArrayUtils { /** * Inverses the values of the given array with their indexes . * For example , the result for [ 2 , 0 , 1 ] is [ 1 , 2 , 0 ] because * a [ 0 ] : 2 = > a [ 2 ] : 0 * a [ 1 ] : 0 = > a [ 0 ] : 1 * a [ 2 ] : 1 = > a [ 1 ] : 2 */ public static void inverse ( int [ ] a ) { } }
for ( int i = 0 ; i < a . length ; i ++ ) { if ( a [ i ] >= 0 ) { inverseLoop ( a , i ) ; } } for ( int i = 0 ; i < a . length ; i ++ ) { a [ i ] = ~ a [ i ] ; }
public class ServiceDiscoveryTransportFactory { /** * Find and validate the discoveryId given in a connection string */ private UUID getDiscoveryId ( final Map < String , String > params ) throws IOException { } }
final String discoveryId = params . get ( "discoveryId" ) ; if ( discoveryId == null ) { throw new IOException ( "srvc transport did not get a discoveryId parameter. Refusing to create." ) ; } return UUID . fromString ( discoveryId ) ;
public class SearchableInterceptor { /** * Installs a < code > Searchable < / code > into the given text component . * @ param < T > * the type of the text component . * @ param textComponent * the target text component . * @ return the text component . */ private < T extends JTextComponent > T installSearcha...
SearchableUtils . installSearchable ( textComponent ) ; return textComponent ;
public class URLCanonicalizer { /** * Tells whether or not the given port is the default for the given scheme . * < strong > Note : < / strong > Only HTTP and HTTPS schemes are taken into account . * @ param scheme the scheme * @ param port the port * @ return { @ code true } if given the port is the default po...
return HTTP_SCHEME . equalsIgnoreCase ( scheme ) && port == HTTP_DEFAULT_PORT || HTTPS_SCHEME . equalsIgnoreCase ( scheme ) && port == HTTPS_DEFAULT_PORT ;
public class Expression { /** * Check the document field ' s type * and object * @ param lhs The field to check * @ param rhs The type * @ return Expression : lhs $ type rhs */ public static Expression type ( String lhs , Type rhs ) { } }
return new Expression ( lhs , "$type" , rhs . toString ( ) ) ;
public class MarkedElement { /** * Markup a rendering element with the specified classes . * @ param elem rendering element * @ param classes classes * @ return the marked element */ public static MarkedElement markup ( IRenderingElement elem , String ... classes ) { } }
assert elem != null ; MarkedElement tagElem = new MarkedElement ( elem ) ; for ( String cls : classes ) tagElem . aggClass ( cls ) ; return tagElem ;
public class RpcWrapper { /** * Make the wrapped call and unmarshall the returned Xdr to a response , * getting the IP key from the request . If an RPC Exception is being thrown , * and retries remain , then log the exception and retry . * @ param request * The request to send . * @ param responseHandler * ...
for ( int i = 0 ; i < _maximumRetries ; ++ i ) { try { callRpcChecked ( request , responseHandler ) ; return ; } catch ( RpcException e ) { handleRpcException ( e , i ) ; } }
public class SeekableByteChannelPrefetcher { /** * Start a background read of the buffer after this one ( if there isn ' t one already ) . */ public ByteBuffer fetch ( long position ) throws InterruptedException , ExecutionException { } }
long blockIndex = position / bufSize ; boolean goingBack = false ; for ( WorkUnit w : full ) { if ( w . blockIndex == blockIndex ) { ensureFetching ( blockIndex + 1 ) ; nbHit ++ ; return w . buf ; } else if ( w . blockIndex > blockIndex ) { goingBack = true ; } } if ( goingBack ) { // user is asking for a block with a ...
public class ContinuousDistribution { /** * Computes the log of the Probability Density Function . Note , that then the * probability is zero , { @ link Double # NEGATIVE _ INFINITY } would be the true * value . Instead , this method will always return the negative of * { @ link Double # MAX _ VALUE } . This is t...
double pdf = pdf ( x ) ; if ( pdf <= 0 ) return - Double . MAX_VALUE ; return Math . log ( pdf ) ;
public class SoftDictionary { /** * Insert a prepared string into the dictionary . * < p > Id is a special tag used to handle ' leave one out ' * lookups . If you do a lookup on a string with a non - null * id , you get the closest matches that do not have the same * id . */ public void put ( String id , String...
MyWrapper wrapper = asMyWrapper ( toInsert ) ; Token [ ] tokens = wrapper . getTokens ( ) ; for ( int i = 0 ; i < tokens . length ; i ++ ) { ArrayList stringsWithToken = ( ArrayList ) index . get ( tokens [ i ] ) ; if ( stringsWithToken == null ) index . put ( tokens [ i ] , ( stringsWithToken = new ArrayList ( ) ) ) ;...
public class AbstractSegment3F { /** * Tests if the axis - aligned box is intersecting a segment . * @ param sx1 x coordinate of the first point of the segment . * @ param sy1 y coordinate of the first point of the segment . * @ param sz1 z coordinate of the first point of the segment . * @ param sx2 x coordina...
assert ( minx <= maxx ) ; assert ( miny <= maxy ) ; assert ( minz <= maxz ) ; double dx = ( sx2 - sx1 ) * .5 ; double dy = ( sy2 - sy1 ) * .5 ; double dz = ( sz2 - sz1 ) * .5 ; double ex = ( maxx - minx ) * .5 ; double ey = ( maxy - miny ) * .5 ; double ez = ( maxz - minz ) * .5 ; double cx = sx1 + dx - ( minx + maxx )...
public class JsonBasedPropertiesProvider { /** * Convert given Json document to a multi - level map . */ @ SuppressWarnings ( "unchecked" ) private Map < String , Object > convertToMap ( Object jsonDocument ) { } }
Map < String , Object > jsonMap = new LinkedHashMap < > ( ) ; // Document is a text block if ( ! ( jsonDocument instanceof JSONObject ) ) { jsonMap . put ( "content" , jsonDocument ) ; return jsonMap ; } JSONObject obj = ( JSONObject ) jsonDocument ; for ( String key : obj . keySet ( ) ) { Object value = obj . get ( ke...
public class MerkleTree { /** * For testing purposes . * Gets the smallest range containing the token . */ public TreeRange get ( Token t ) { } }
return getHelper ( root , fullRange . left , fullRange . right , ( byte ) 0 , t ) ;
public class EMailField { /** * Get the HTML mailto Hyperlink . * @ return The hyperlink . */ public String getHyperlink ( ) { } }
String strMailTo = this . getString ( ) ; if ( strMailTo != null ) if ( strMailTo . length ( ) > 0 ) strMailTo = BaseApplication . MAIL_TO + ":" + strMailTo ; return strMailTo ;
public class PickerUtilities { /** * localTimeToString , This will return the supplied time as a string . If the time is null , this * will return the value of emptyTimeString . * Time values will be output in one of the following ISO - 8601 formats : " HH : mm " , " HH : mm : ss " , * " HH : mm : ss . SSS " , " ...
return ( time == null ) ? emptyTimeString : time . toString ( ) ;
public class Client { /** * Delete an existing application from the current Doradus tenant , including all of * its tables and data . Because updates are idempotent , deleting an already - deleted * application is acceptable . Hence , if no error is thrown , the result is always true . * An exception is thrown if...
Utils . require ( ! m_restClient . isClosed ( ) , "Client has been closed" ) ; Utils . require ( appName != null && appName . length ( ) > 0 , "appName" ) ; try { // Send a DELETE request to " / _ applications / { application } / { key } " . StringBuilder uri = new StringBuilder ( Utils . isEmpty ( m_apiPrefix ) ? "" :...
public class MessageBatch { /** * write a TaskMessage into a stream * Each TaskMessage is encoded as : task . . . short ( 2 ) len . . . int ( 4 ) payload . . . byte [ ] * */ private void writeTaskMessage ( ChannelBufferOutputStream bout , TaskMessage message ) throws Exception { } }
int payload_len = 0 ; if ( message . message ( ) != null ) payload_len = message . message ( ) . length ; short type = message . get_type ( ) ; bout . writeShort ( type ) ; int task_id = message . task ( ) ; if ( task_id > Short . MAX_VALUE ) throw new RuntimeException ( "Task ID should not exceed " + Short . MAX_VALUE...
public class JmsRunnableFactory { /** * Creates a new { @ link TopicConsumer } . For every message received ( or when the timeout waiting for messages is hit ) , the callback * is invoked with the message received . */ public TopicConsumer createTopicListener ( final String topic , final ConsumerCallback < Message > ...
Preconditions . checkState ( connectionFactory != null , "connection factory was never injected!" ) ; return new TopicConsumer ( connectionFactory , jmsConfig , topic , messageCallback ) ;
public class KerasInitilizationUtils { /** * Get weight initialization from Keras layer configuration . * @ param layerConfig dictionary containing Keras layer configuration * @ param enforceTrainingConfig whether to enforce loading configuration for further training * @ return Pair of DL4J weight initialization ...
Map < String , Object > innerConfig = KerasLayerUtils . getInnerLayerConfigFromConfig ( layerConfig , conf ) ; if ( ! innerConfig . containsKey ( initField ) ) throw new InvalidKerasConfigurationException ( "Keras layer is missing " + initField + " field" ) ; String kerasInit ; Map < String , Object > initMap ; if ( ke...
public class Node { /** * Get an absolute URL from a URL attribute that may be relative ( i . e . an < code > & lt ; a href & gt ; < / code > or * < code > & lt ; img src & gt ; < / code > ) . * E . g . : < code > String absUrl = linkEl . absUrl ( " href " ) ; < / code > * If the attribute value is already absolu...
Validate . notEmpty ( attributeKey ) ; if ( ! hasAttr ( attributeKey ) ) { return "" ; // nothing to make absolute with } else { return StringUtil . resolve ( baseUri ( ) , attr ( attributeKey ) ) ; }
public class ServerMonitor { /** * Returns an integer that indicates location type of database server * linked to the running Doradus - server : { @ code LOCAL } if the Doradus - server * and database - server are hosted on the same machine , { @ code REMOTE } if * they are on the different machines , { @ code UN...
if ( databaseLink < 0 ) { ServerConfig c = ServerConfig . getInstance ( ) ; try { boolean [ ] local = new boolean [ 1 ] ; String dbhost = extractValidHostname ( c . dbhost , local ) ; databaseLink = local [ 0 ] ? LOCAL : REMOTE ; logger . info ( "Database hostname: " + dbhost + " (local=" + local [ 0 ] + ")." ) ; } cat...
public class CryptoPathMapper { /** * Verifies that no node exists for the given path . Otherwise a { @ link FileAlreadyExistsException } will be thrown . * @ param cleartextPath A path * @ throws FileAlreadyExistsException If the node exists * @ throws IOException If any I / O error occurs while attempting to re...
try { CiphertextFileType type = getCiphertextFileType ( cleartextPath ) ; throw new FileAlreadyExistsException ( cleartextPath . toString ( ) , null , "For this path there is already a " + type . name ( ) ) ; } catch ( NoSuchFileException e ) { // good ! }
public class Util { /** * Set the message data as a XML String . * @ return */ public static Document convertXMLToDOM ( String strXML ) { } }
DocumentBuilder db = Util . getDocumentBuilder ( ) ; // Parse the input file Document doc = null ; try { synchronized ( db ) { // db is not thread safe doc = db . parse ( new InputSource ( new StringReader ( strXML ) ) ) ; } } catch ( SAXException se ) { System . out . println ( se . getMessage ( ) ) ; return null ; } ...
public class LineageInfo { /** * Load all lineage info from a { @ link State } * @ return A map from branch to its lineage info . If there is no destination info , return an empty map */ static Map < String , Set < LineageEventBuilder > > load ( State state ) { } }
String name = state . getProp ( getKey ( NAME_KEY ) ) ; Descriptor source = Descriptor . fromJson ( state . getProp ( getKey ( LineageEventBuilder . SOURCE ) ) ) ; String branchedPrefix = getKey ( BRANCH , "" ) ; Map < String , Set < LineageEventBuilder > > events = Maps . newHashMap ( ) ; if ( source == null ) { retur...
public class CensoredDescriptives { /** * Calculates the Variance of Mean . * @ param survivalFunction * @ return */ public static double meanVariance ( AssociativeArray2D survivalFunction ) { } }
double meanVariance = 0 ; int m = 0 ; int n = 0 ; for ( Map . Entry < Object , AssociativeArray > entry : survivalFunction . entrySet ( ) ) { // Object ti = entry . getKey ( ) ; AssociativeArray row = entry . getValue ( ) ; Number mi = ( Number ) row . get ( "mi" ) ; n += mi . intValue ( ) ; if ( row . get ( "Sti" ) ==...
public class MultipartContent { /** * Sets the HTTP content parts of the HTTP multipart request , where each part is assumed to have * no HTTP headers and no encoding . * < p > Overriding is only supported for the purpose of calling the super implementation and * changing the return type , but nothing else . */ p...
this . parts = new ArrayList < Part > ( contentParts . size ( ) ) ; for ( HttpContent contentPart : contentParts ) { addPart ( new Part ( contentPart ) ) ; } return this ;
public class CPDefinitionOptionValueRelPersistenceImpl { /** * Returns the last cp definition option value rel in the ordered set where CPDefinitionOptionRelId = & # 63 ; . * @ param CPDefinitionOptionRelId the cp definition option rel ID * @ param orderByComparator the comparator to order the set by ( optionally <...
CPDefinitionOptionValueRel cpDefinitionOptionValueRel = fetchByCPDefinitionOptionRelId_Last ( CPDefinitionOptionRelId , orderByComparator ) ; if ( cpDefinitionOptionValueRel != null ) { return cpDefinitionOptionValueRel ; } StringBundler msg = new StringBundler ( 4 ) ; msg . append ( _NO_SUCH_ENTITY_WITH_KEY ) ; msg . ...
public class Ifc2x3tc1FactoryImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public IfcWallTypeEnum createIfcWallTypeEnumFromString ( EDataType eDataType , String initialValue ) { } }
IfcWallTypeEnum result = IfcWallTypeEnum . get ( initialValue ) ; if ( result == null ) throw new IllegalArgumentException ( "The value '" + initialValue + "' is not a valid enumerator of '" + eDataType . getName ( ) + "'" ) ; return result ;
public class WebStatFilter { /** * { @ inheritDoc } */ @ Override public void filter ( ContainerRequestContext requestContext , ContainerResponseContext responseContext ) throws IOException { } }
String requestURI = getRequestURI ( requestContext ) ; if ( isExclusion ( requestURI ) || WebRequestStat . current ( ) == null ) { return ; } long endNano = System . nanoTime ( ) ; WebRequestStat . current ( ) . setEndNano ( endNano ) ; long nanos = endNano - WebRequestStat . current ( ) . getStartNano ( ) ; Throwable ...
public class AbstractSessionQuery { /** * / * ( non - Javadoc ) * @ see net . timewalker . ffmq4 . network . packet . AbstractPacket # serializeTo ( net . timewalker . ffmq4 . utils . RawDataOutputStream ) */ @ Override protected void serializeTo ( RawDataBuffer out ) { } }
super . serializeTo ( out ) ; out . writeInt ( sessionId . asInt ( ) ) ;
public class MutableTimecodeDuration { /** * Returns a UnmodifiableTimecodeDuration instance for given TimecodeDuration storage string . Will return null in case the storage string represents a null TimecodeDuration * @ param timecode * @ return the TimecodeDuration * @ throws IllegalArgumentException */ public s...
MutableTimecodeDuration td = new MutableTimecodeDuration ( ) ; return ( MutableTimecodeDuration ) td . parse ( timecode ) ;
public class MediaType { /** * Get he extension by url . * @ param url url . * @ return extension name . */ public static String getUrlExtension ( String url ) { } }
String extension = MimeTypeMap . getFileExtensionFromUrl ( url ) ; return TextUtils . isEmpty ( extension ) ? "" : extension ;
public class JvmTypeReferenceImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public < Parameter , Result > Result accept ( ITypeReferenceVisitorWithParameter < Parameter , Result > visitor , Parameter parameter ) { } }
// TODO : implement this method // Ensure that you remove @ generated or mark it @ generated NOT throw new UnsupportedOperationException ( ) ;
public class QueryService { /** * Generic method , which based on a Root & lt ; ENTITY & gt ; returns an Expression which type is the same as the given ' value ' type . * @ param metaclassFunction function which returns the column which is used for filtering . * @ param value the actual value to filter for . * @ ...
return ( root , query , builder ) -> builder . equal ( metaclassFunction . apply ( root ) , value ) ;
public class MessageAdapterImpl { /** * { @ inheritDoc } */ public Messageadapter merge ( MergeableMetadata < ? > jmd ) throws Exception { } }
if ( jmd instanceof MessageAdapterImpl ) { MessageAdapterImpl input = ( MessageAdapterImpl ) jmd ; String newId = this . id == null ? input . id : this . id ; List < MessageListener > newMessagelistener = MergeUtil . mergeList ( this . messagelisteners , input . messagelisteners ) ; return new MessageAdapterImpl ( newM...
public class FactoryWaveletDaub { /** * DaubJ wavelets have the following properties : < br > * < ul > * < li > Conserve the signal ' s energy < / li > * < li > If the signal is approximately polynomial of degree J / 2-1 or less within the support then fluctuations are approximately zero . < / li > * < li > The...
if ( J != 4 ) { throw new IllegalArgumentException ( "Only 4 is currently supported" ) ; } WlCoef_F32 coef = new WlCoef_F32 ( ) ; coef . offsetScaling = 0 ; coef . offsetWavelet = 0 ; coef . scaling = new float [ 4 ] ; coef . wavelet = new float [ 4 ] ; double sqrt3 = Math . sqrt ( 3 ) ; double div = 4.0 * Math . sqrt ...
public class DirContextAdapter { /** * { @ inheritDoc } */ @ Override public DirContext createSubcontext ( Name name , Attributes attrs ) throws NamingException { } }
throw new UnsupportedOperationException ( NOT_IMPLEMENTED ) ;
public class CmsFileUtil { /** * Reads a file with the given name from the class loader and returns the file content . < p > * @ param filename the file to read * @ return the read file content * @ throws IOException in case of file access errors */ @ SuppressWarnings ( "resource" ) public static byte [ ] readFil...
// create input and output stream InputStream in = CmsFileUtil . class . getClassLoader ( ) . getResourceAsStream ( filename ) ; if ( in == null ) { throw new FileNotFoundException ( filename ) ; } return readFully ( in ) ;
public class YPipe { /** * item exists , false otherwise . */ @ Override public T unwrite ( ) { } }
if ( f == queue . backPos ( ) ) { return null ; } queue . unpush ( ) ; return queue . back ( ) ;
public class ValueStack { /** * popStringOrByteArray . * @ return a { @ link java . lang . Object } object . * @ throws java . text . ParseException if any . */ public Object popStringOrByteArray ( ) throws ParseException { } }
final Object popped = super . pop ( ) ; if ( popped instanceof String ) return popped ; /* * This is probably an unquoted single word literal . */ if ( popped instanceof TokVariable ) return ( ( TokVariable ) popped ) . getName ( ) ; if ( popped instanceof byte [ ] ) return popped ; throw new ParseException ( "Literal ...
public class ExtendedAggregateExtractProjectRule { /** * Compute which input fields are used by the aggregate . */ private ImmutableBitSet . Builder getInputFieldUsed ( Aggregate aggregate , RelNode input ) { } }
// 1 . group fields are always used final ImmutableBitSet . Builder inputFieldsUsed = aggregate . getGroupSet ( ) . rebuild ( ) ; // 2 . agg functions for ( AggregateCall aggCall : aggregate . getAggCallList ( ) ) { for ( int i : aggCall . getArgList ( ) ) { inputFieldsUsed . set ( i ) ; } if ( aggCall . filterArg >= 0...
public class Context { /** * Pop the current context from thread local , and restore parent context to thread local . */ public static void popContext ( ) { } }
Context context = LOCAL . get ( ) ; if ( context != null ) { Context parent = context . getParent ( ) ; if ( parent != null ) { LOCAL . set ( parent ) ; } else { LOCAL . remove ( ) ; } }
public class SQLiteConnectionPool { /** * Can ' t throw . */ private void logConnectionPoolBusyLocked ( long waitMillis , int connectionFlags ) { } }
final Thread thread = Thread . currentThread ( ) ; StringBuilder msg = new StringBuilder ( ) ; msg . append ( "The connection pool for database '" ) . append ( mConfiguration . label ) ; msg . append ( "' has been unable to grant a connection to thread " ) ; msg . append ( thread . getId ( ) ) . append ( " (" ) . appen...
public class Environment { /** * Retrieves the environment in which Jogger is working . * @ return a String object representing the environment . */ public static String get ( ) { } }
String env = System . getProperty ( "JOGGER_ENV" ) ; if ( env == null ) { env = System . getenv ( "JOGGER_ENV" ) ; } if ( env == null ) { return "dev" ; } return env ;
public class Catalog { /** * Reads the { @ code Catalog } entry from the given input stream . * The data is assumed to be in little endian byte order . * @ param pDataInput the input stream * @ return a new { @ code Catalog } * @ throws java . io . IOException if an I / O exception occurs during read */ public ...
CatalogHeader header = CatalogHeader . read ( pDataInput ) ; CatalogItem [ ] items = new CatalogItem [ header . getThumbnailCount ( ) ] ; for ( int i = 0 ; i < header . getThumbnailCount ( ) ; i ++ ) { CatalogItem item = CatalogItem . read ( pDataInput ) ; // System . out . println ( " item : " + item ) ; items [ item ...
public class FormalParameterSourceAppender { /** * Initialize the formal parameter . * @ param context the context of the formal parameter . * @ param name the name of the formal parameter . */ public void eInit ( XtendExecutable context , String name , IJvmTypeProvider typeContext ) { } }
this . builder . eInit ( context , name , typeContext ) ;
public class StreamingJsonBuilder { /** * Delegates to { @ link # call ( String , Iterable , Closure ) } */ public void call ( String name , Collection coll , @ DelegatesTo ( StreamingJsonDelegate . class ) Closure c ) throws IOException { } }
call ( name , ( Iterable ) coll , c ) ;
public class Buffers { /** * Reads length and then length bytes into the data buffer , which is grown if needed . * @ param ch The channel to read data from * @ return The data buffer ( position is 0 and limit is length ) , or null if not all data could be read . */ public ByteBuffer readLengthAndData ( SocketChann...
if ( bufs [ 0 ] . hasRemaining ( ) && ch . read ( bufs [ 0 ] ) < 0 ) throw new EOFException ( ) ; if ( bufs [ 0 ] . hasRemaining ( ) ) return null ; int len = bufs [ 0 ] . getInt ( 0 ) ; if ( bufs [ 1 ] == null || len > bufs [ 1 ] . capacity ( ) ) bufs [ 1 ] = ByteBuffer . allocate ( len ) ; bufs [ 1 ] . limit ( len ) ...
public class LombokPropertyDescriptor { /** * Determine if the current { @ link # getField ( ) field } defines a public accessor using * lombok annotations . * @ param env the { @ link MetadataGenerationEnvironment } * @ param getter { @ code true } to look for the read accessor , { @ code false } for the * wri...
String annotation = ( getter ? LOMBOK_GETTER_ANNOTATION : LOMBOK_SETTER_ANNOTATION ) ; AnnotationMirror lombokMethodAnnotationOnField = env . getAnnotation ( getField ( ) , annotation ) ; if ( lombokMethodAnnotationOnField != null ) { return isAccessLevelPublic ( env , lombokMethodAnnotationOnField ) ; } AnnotationMirr...
public class ST_Reverse { /** * Returns the geometry with vertex order reversed . * @ param geometry Geometry * @ return geometry with vertex order reversed */ public static Geometry reverse ( Geometry geometry ) { } }
if ( geometry == null ) { return null ; } if ( geometry instanceof MultiPoint ) { return reverseMultiPoint ( ( MultiPoint ) geometry ) ; } return geometry . reverse ( ) ;
public class FilePolicyIndex { /** * ( non - Javadoc ) * @ see org . fcrepo . server . security . xacml . pdp . data . PolicyIndex # addPolicy ( java . lang . String , * java . lang . String ) */ @ Override public String addPolicy ( String name , String document ) throws PolicyIndexException { } }
writeLock . lock ( ) ; try { logger . debug ( "Adding policy named: " + name ) ; return doAdd ( name , document ) ; } finally { writeLock . unlock ( ) ; }