signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class FloatList { /** * Adds a new floating box to the list * @ param box Floating block box to be added */ public void add ( BlockBox box ) { } }
box . setOwnerFloatList ( this ) ; floats . add ( box ) ; if ( box . getBounds ( ) . y + box . getBounds ( ) . height > getMaxY ( ) ) bottomBox = box ; if ( box . getBounds ( ) . y > getLastY ( ) ) lastBox = box ;
public class PropertiesUtil { /** * Loads and closes the given property input stream . If an error occurs , log to the status logger . * @ param in a property input stream . * @ param source a source object describing the source , like a resource string or a URL . * @ return a new Properties object */ static Properties loadClose ( final InputStream in , final Object source ) { } }
final Properties props = new Properties ( ) ; if ( null != in ) { try { props . load ( in ) ; } catch ( final IOException e ) { LowLevelLogUtil . logException ( "Unable to read " + source , e ) ; } finally { try { in . close ( ) ; } catch ( final IOException e ) { LowLevelLogUtil . logException ( "Unable to close " + source , e ) ; } } } return props ;
public class RangedCriteria { /** * { @ inheritDoc } */ @ Override public void usage ( final UsageBuilder str , final int indentLevel ) { } }
if ( min != null ) if ( max != null ) str . append ( "The value must be from " + min . toString ( ) + " to " + max . toString ( ) + " inclusive" ) ; else str . append ( "The value must be at least " + min . toString ( ) + "." ) ; else str . append ( "The value must be less than or equal to " + max . toString ( ) + "." ) ;
public class ResourceExtension { /** * use the resource manager */ public static void useResource ( String host , int port , String user , String password , Authentication authType ) throws ResourceNotFoundException , ForbiddenUserException , FailedRequestException { } }
// create the client DatabaseClient client = DatabaseClientFactory . newClient ( host , port , user , password , authType ) ; // create the resource extension client DictionaryManager dictionaryMgr = new DictionaryManager ( client ) ; // specify the identifier for the dictionary String uri = "/example/metasyn.xml" ; // create the dictionary String [ ] words = { "foo" , "bar" , "baz" , "qux" , "quux" , "wibble" , "wobble" , "wubble" } ; dictionaryMgr . createDictionary ( uri , words ) ; System . out . println ( "Created a dictionary on the server at " + uri ) ; // check the validity of the dictionary Document [ ] list = dictionaryMgr . checkDictionaries ( uri ) ; if ( list == null || list . length == 0 ) System . out . println ( "Could not check the validity of the dictionary at " + uri ) ; else System . out . println ( "Checked the validity of the dictionary at " + uri + ": " + ! "invalid" . equals ( list [ 0 ] . getDocumentElement ( ) . getNodeName ( ) ) ) ; dictionaryMgr . getMimetype ( uri ) ; // use a resource service to check the correctness of a word String word = "biz" ; if ( ! dictionaryMgr . isCorrect ( word , uri ) ) { System . out . println ( "Confirmed that '" + word + "' is not in the dictionary at " + uri ) ; // use a resource service to look up suggestions String [ ] suggestions = dictionaryMgr . suggest ( word , null , null , uri ) ; System . out . println ( "Nearest matches for '" + word + "' in the dictionary at " + uri ) ; for ( String suggestion : suggestions ) { System . out . println ( " " + suggestion ) ; } } // delete the dictionary dictionaryMgr . deleteDictionary ( uri ) ; // release the client client . release ( ) ;
public class DelegatedClientFactory { /** * Configure wordpress client . * @ param properties the properties */ protected void configureWordPressClient ( final Collection < BaseClient > properties ) { } }
val wp = pac4jProperties . getWordpress ( ) ; if ( StringUtils . isNotBlank ( wp . getId ( ) ) && StringUtils . isNotBlank ( wp . getSecret ( ) ) ) { val client = new WordPressClient ( wp . getId ( ) , wp . getSecret ( ) ) ; configureClient ( client , wp ) ; LOGGER . debug ( "Created client [{}] with identifier [{}]" , client . getName ( ) , client . getKey ( ) ) ; properties . add ( client ) ; }
public class JSPtoPRealization { /** * Method localQueuePointRemoved * @ param isDeleted * @ param isSystem * @ param isTemporary * @ param messagingEngineUuid * @ throws SIResourceException */ @ Override public void localQueuePointRemoved ( boolean isDeleted , boolean isSystem , boolean isTemporary , SIBUuid8 messagingEngineUuid ) throws SIResourceException { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "localQueuePointRemoved" , new Object [ ] { Boolean . valueOf ( isDeleted ) , Boolean . valueOf ( isSystem ) , Boolean . valueOf ( isTemporary ) , messagingEngineUuid , this } ) ; if ( _pToPLocalMsgsItemStream != null ) { // Remove the queuePoint from our queue points guess set , which we use to // guess where to send messages if WLM isnt working // and update TRM if necessary _localisationManager . localQueuePointRemoved ( messagingEngineUuid ) ; // Add the localisation into the set of those requiring clean - up _postMediatedItemStreamsRequiringCleanup . put ( messagingEngineUuid , _pToPLocalMsgsItemStream ) ; _pToPLocalMsgsItemStream . markAsToBeDeleted ( _baseDestinationHandler . getTransactionManager ( ) . createAutoCommitTransaction ( ) ) ; // Close any locally attached consumers - producers are ok as there are // other localisations of the destination available . if ( ! _localisationManager . hasLocal ( ) ) _remoteSupport . closeConsumers ( ) ; // Dereference the localisation from the destinationHandler so that // if the localisation is re - created in WCCM , a new instance of the // localisation can be added back into the destinationHandler . dereferenceLocalisation ( _pToPLocalMsgsItemStream ) ; // Get the background clean - up thread to reallocate the messages and // clean up the localisation if possible . _destinationManager . markDestinationAsCleanUpPending ( _baseDestinationHandler ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "localQueuePointRemoved" ) ;
public class RunContainer { /** * To recover rooms between begin ( exclusive ) and end ( inclusive ) */ private void recoverRoomsInRange ( int begin , int end ) { } }
if ( end + 1 < this . nbrruns ) { copyValuesLength ( this . valueslength , end + 1 , this . valueslength , begin + 1 , this . nbrruns - 1 - end ) ; } this . nbrruns -= end - begin ;
public class ApiConnection { /** * Issues a Web API query to confirm that the previous login attempt was * successful , and sets the internal state of the API connection accordingly * in this case . * @ deprecated because it will be migrated to { @ class PasswordApiConnection } . * @ param token * the login token string * @ param username * the name of the user that was logged in * @ param password * the password used to log in * @ throws IOException * @ throws LoginFailedException */ @ Deprecated void confirmLogin ( String token , String username , String password ) throws IOException , LoginFailedException , MediaWikiApiErrorException { } }
Map < String , String > params = new HashMap < > ( ) ; params . put ( ApiConnection . PARAM_ACTION , "login" ) ; params . put ( ApiConnection . PARAM_LOGIN_USERNAME , username ) ; params . put ( ApiConnection . PARAM_LOGIN_PASSWORD , password ) ; params . put ( ApiConnection . PARAM_LOGIN_TOKEN , token ) ; JsonNode root = sendJsonRequest ( "POST" , params ) ; String result = root . path ( "login" ) . path ( "result" ) . textValue ( ) ; if ( ApiConnection . LOGIN_RESULT_SUCCESS . equals ( result ) ) { this . loggedIn = true ; this . username = username ; this . password = password ; } else { String message = getLoginErrorMessage ( result ) ; logger . warn ( message ) ; if ( ApiConnection . LOGIN_WRONG_TOKEN . equals ( result ) ) { throw new NeedLoginTokenException ( message ) ; } else { throw new LoginFailedException ( message ) ; } }
public class DefaultEventStudio { /** * Removes the given listener listening on the given event , from the hidden station , hiding the station abstraction . * @ return true if the listener was found and removed * @ see EventStudio # remove ( Listener , String ) * @ see DefaultEventStudio # HIDDEN _ STATION */ public < T > boolean remove ( Class < T > eventClass , Listener < T > listener ) { } }
return remove ( eventClass , listener , HIDDEN_STATION ) ;
public class LiteralProcessor { /** * ~ Methoden - - - - - */ @ Override public int print ( ChronoDisplay formattable , Appendable buffer , AttributeQuery attributes , Set < ElementPosition > positions , // optional boolean quickPath ) throws IOException { } }
if ( this . attribute != null ) { char literal = attributes . get ( this . attribute , null ) . charValue ( ) ; buffer . append ( literal ) ; return 1 ; } else if ( this . multi == null ) { buffer . append ( this . single ) ; return 1 ; } else { buffer . append ( this . multi ) ; return this . multi . length ( ) ; }
public class Partitioner { /** * Get the global partition of the whole data set , which has the global low and high watermarks * @ param previousWatermark previous watermark for computing the low watermark of current run * @ return a Partition instance */ public Partition getGlobalPartition ( long previousWatermark ) { } }
ExtractType extractType = ExtractType . valueOf ( state . getProp ( ConfigurationKeys . SOURCE_QUERYBASED_EXTRACT_TYPE ) . toUpperCase ( ) ) ; WatermarkType watermarkType = WatermarkType . valueOf ( state . getProp ( ConfigurationKeys . SOURCE_QUERYBASED_WATERMARK_TYPE , ConfigurationKeys . DEFAULT_WATERMARK_TYPE ) . toUpperCase ( ) ) ; WatermarkPredicate watermark = new WatermarkPredicate ( null , watermarkType ) ; int deltaForNextWatermark = watermark . getDeltaNumForNextWatermark ( ) ; long lowWatermark = getLowWatermark ( extractType , watermarkType , previousWatermark , deltaForNextWatermark ) ; long highWatermark = getHighWatermark ( extractType , watermarkType ) ; return new Partition ( lowWatermark , highWatermark , true , hasUserSpecifiedHighWatermark ) ;
public class Annotations { /** * Process : @ Connector * @ param annotationRepository The annotation repository * @ param classLoader The class loader * @ param xmlResourceAdapterClass resource adpater class name as define in xml * @ param connectionDefinitions * @ param configProperties * @ param plainConfigProperties * @ param inboundResourceadapter * @ param adminObjs * @ return The updated metadata * @ exception Exception Thrown if an error occurs */ private Connector processConnector ( AnnotationRepository annotationRepository , ClassLoader classLoader , String xmlResourceAdapterClass , ArrayList < ConnectionDefinition > connectionDefinitions , ArrayList < ConfigProperty > configProperties , ArrayList < ConfigProperty > plainConfigProperties , InboundResourceAdapter inboundResourceadapter , ArrayList < AdminObject > adminObjs ) throws Exception { } }
Connector connector = null ; Collection < Annotation > values = annotationRepository . getAnnotation ( javax . resource . spi . Connector . class ) ; if ( values != null ) { if ( values . size ( ) == 1 ) { Annotation annotation = values . iterator ( ) . next ( ) ; String raClass = annotation . getClassName ( ) ; javax . resource . spi . Connector connectorAnnotation = ( javax . resource . spi . Connector ) annotation . getAnnotation ( ) ; if ( trace ) log . trace ( "Processing: " + connectorAnnotation + " for " + raClass ) ; connector = attachConnector ( raClass , classLoader , connectorAnnotation , connectionDefinitions , configProperties , plainConfigProperties , inboundResourceadapter , adminObjs ) ; } else if ( values . isEmpty ( ) ) { // JBJCA - 240 if ( xmlResourceAdapterClass == null || xmlResourceAdapterClass . equals ( "" ) ) { log . noConnector ( ) ; throw new ValidateException ( bundle . noConnectorDefined ( ) ) ; } } else { // JBJCA - 240 if ( xmlResourceAdapterClass == null || xmlResourceAdapterClass . equals ( "" ) ) { log . moreThanOneConnector ( ) ; throw new ValidateException ( bundle . moreThanOneConnectorDefined ( ) ) ; } } } else { connector = attachConnector ( xmlResourceAdapterClass , classLoader , null , connectionDefinitions , null , null , inboundResourceadapter , adminObjs ) ; } return connector ;
public class ServerBuilder { /** * Sets the server ' s icon . * @ param icon The icon of the server . * @ param fileType The type of the icon , e . g . " png " or " jpg " . * @ return The current instance in order to chain call methods . */ public ServerBuilder setIcon ( BufferedImage icon , String fileType ) { } }
delegate . setIcon ( icon , fileType ) ; return this ;
public class AmazonEC2Client { /** * Deletes the specified network interface . You must detach the network interface before you can delete it . * @ param deleteNetworkInterfaceRequest * Contains the parameters for DeleteNetworkInterface . * @ return Result of the DeleteNetworkInterface operation returned by the service . * @ sample AmazonEC2 . DeleteNetworkInterface * @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / ec2-2016-11-15 / DeleteNetworkInterface " target = " _ top " > AWS API * Documentation < / a > */ @ Override public DeleteNetworkInterfaceResult deleteNetworkInterface ( DeleteNetworkInterfaceRequest request ) { } }
request = beforeClientExecution ( request ) ; return executeDeleteNetworkInterface ( request ) ;
public class WorkManagerImpl { /** * { @ inheritDoc } */ public void scheduleWork ( Work work ) throws WorkException { } }
scheduleWork ( work , WorkManager . INDEFINITE , null , null ) ;
public class S { /** * The counter function of { @ link # isEqual ( String , String , int ) } * @ param s1 * @ param s2 * @ param modifier * @ return true if s1 not equals s2 */ public static boolean isNotEqual ( String s1 , String s2 , int modifier ) { } }
return ! isEqual ( s1 , s2 , modifier ) ;
public class HalParser { /** * Returns the JsonNode of the embedded items by link - relation type and resolves possibly curied rels . * @ param halRepresentation the HAL document including the ' curies ' links . * @ param jsonNode the JsonNode of the document * @ param rel the link - relation type of interest * @ return JsonNode * @ since 0.3.0 */ private Optional < JsonNode > findPossiblyCuriedEmbeddedNode ( final HalRepresentation halRepresentation , final JsonNode jsonNode , final String rel ) { } }
final JsonNode embedded = jsonNode . get ( "_embedded" ) ; if ( embedded != null ) { final Curies curies = halRepresentation . getCuries ( ) ; final JsonNode curiedNode = embedded . get ( curies . resolve ( rel ) ) ; if ( curiedNode == null ) { return Optional . ofNullable ( embedded . get ( curies . expand ( rel ) ) ) ; } else { return Optional . of ( curiedNode ) ; } } else { return Optional . empty ( ) ; }
public class SpiderParam { /** * Sets the whether the spider parses the SVN entries file for URIs ( not related to following the directions ) . * @ param parseSVNentries the new value for parseSVNentries */ public void setParseSVNEntries ( boolean parseSVNentries ) { } }
this . parseSVNentries = parseSVNentries ; getConfig ( ) . setProperty ( SPIDER_PARSE_SVN_ENTRIES , Boolean . toString ( parseSVNentries ) ) ;
public class WeldContainer { /** * A convenient method for { @ link CDI . current ( ) } . Returns current { @ link WeldContainer } instance * if there is exactly one instance running . Throws { @ link IllegalStateException } in any other case . * @ return Current { @ link WeldContainer } instance if and only if exactly one instance exists * @ throws { @ link IllegalStateException } if there is 0 or more than 1 instance running */ public static WeldContainer current ( ) { } }
List < String > ids = WeldContainer . getRunningContainerIds ( ) ; if ( ids . size ( ) == 1 ) { return WeldContainer . instance ( ids . get ( 0 ) ) ; } else { // if there is either no container or multiple containers we want to throw exception // in this case Weld cannot determine which container is " current " throw WeldSELogger . LOG . zeroOrMoreThanOneContainerRunning ( ) ; }
public class Encoding { /** * Writes the HTML equivalent of the given plain text to output . * For example , { @ code escapeHtmlOnto ( " 1 < 2 " , w ) } , * is equivalent to { @ code w . append ( " 1 & lt ; 2 " ) } but possibly with fewer * smaller appends . * Elides code - units that are not valid XML Characters . * @ see < a href = " http : / / www . w3 . org / TR / 2008 / REC - xml - 20081126 / # charsets " > XML Ch . 2.2 - Characters < / a > */ @ TCB private static void encodeHtmlOnto ( String plainText , Appendable output , @ Nullable String braceReplacement ) throws IOException { } }
int n = plainText . length ( ) ; int pos = 0 ; for ( int i = 0 ; i < n ; ++ i ) { char ch = plainText . charAt ( i ) ; if ( ch < REPLACEMENTS . length ) { // Handles all ASCII . String repl = REPLACEMENTS [ ch ] ; if ( ch == '{' && repl == null ) { if ( i + 1 == n || plainText . charAt ( i + 1 ) == '{' ) { repl = braceReplacement ; } } if ( repl != null ) { output . append ( plainText , pos , i ) . append ( repl ) ; pos = i + 1 ; } } else if ( ( 0x93A <= ch && ch <= 0xC4C ) && ( // Devanagari vowel ch <= 0x94F // Benagli vowels || 0x985 <= ch && ch <= 0x994 || 0x9BE <= ch && ch < 0x9CC // 0x9CC ( Bengali AU ) is ok || 0x9E0 <= ch && ch <= 0x9E3 // Telugu vowels || 0xC05 <= ch && ch <= 0xC14 || 0xC3E <= ch && ch != 0xC48 /* 0xC48 ( Telugu AI ) is ok */ ) ) { // https : / / manishearth . github . io / blog / 2018/02/15 / picking - apart - the - crashing - ios - string / // > So , ultimately , the full set of cases that cause the crash are : // > Any sequence < consonant1 , virama , consonant2 , ZWNJ , vowel > // > in Devanagari , Bengali , and Telugu , where : . . . // TODO : This is needed as of February 2018 , but hopefully not long after that . // We eliminate the ZWNJ which seems the minimally damaging thing to do to // Telugu rendering per the article above : // > a ZWNJ before a vowel doesn ’ t really do anything for most Indic scripts . if ( pos < i ) { if ( plainText . charAt ( i - 1 ) == 0x200C /* ZWNJ */ ) { output . append ( plainText , pos , i - 1 ) ; // Drop the ZWNJ on the floor . pos = i ; } } else if ( output instanceof StringBuilder ) { StringBuilder sb = ( StringBuilder ) output ; int len = sb . length ( ) ; if ( len != 0 ) { if ( sb . charAt ( len - 1 ) == 0x200C /* ZWNJ */ ) { sb . setLength ( len - 1 ) ; } } } } else if ( ( ( char ) 0xd800 ) <= ch ) { if ( ch <= ( ( char ) 0xdfff ) ) { char next ; if ( i + 1 < n && Character . isSurrogatePair ( ch , next = plainText . charAt ( i + 1 ) ) ) { // Emit supplemental codepoints as entity so that they cannot // be mis - encoded as UTF - 8 of surrogates instead of UTF - 8 proper // and get involved in UTF - 16 / UCS - 2 confusion . int codepoint = Character . toCodePoint ( ch , next ) ; output . append ( plainText , pos , i ) ; appendNumericEntity ( codepoint , output ) ; ++ i ; pos = i + 1 ; } else { output . append ( plainText , pos , i ) ; // Elide the orphaned surrogate . pos = i + 1 ; } } else if ( 0xfe60 <= ch ) { // Is a control character or possible full - width version of a // special character , a BOM , or one of the FE60 block that might // be elided or normalized to an HTML special character . // Running // cat NormalizationText . txt \ // | perl - pe ' s / ? # . * / / ' \ // | egrep ' ( ; 003C ( ; | $ ) | 003E | 0026 | 0022 | 0027 | 0060 ) ' // dumps a list of code - points that can normalize to HTML special // characters . output . append ( plainText , pos , i ) ; pos = i + 1 ; if ( ( ch & 0xfffe ) == 0xfffe ) { // Elide since not an the XML Character . } else { appendNumericEntity ( ch , output ) ; } } } else if ( ch == '\u1FEF' ) { // Normalizes to backtick . output . append ( plainText , pos , i ) . append ( "&#8175;" ) ; pos = i + 1 ; } } output . append ( plainText , pos , n ) ;
public class Scope { /** * 移除全局变量 * 全局作用域是指本次请求的整个 template */ public void removeGlobal ( Object key ) { } }
for ( Scope cur = this ; true ; cur = cur . parent ) { if ( cur . parent == null ) { cur . data . remove ( key ) ; return ; } }
public class SecondaryIndex { /** * This is the primary way to create a secondary index instance for a CF column . * It will validate the index _ options before initializing . * @ param baseCfs the source of data for the Index * @ param cdef the meta information about this column ( index _ type , index _ options , name , etc . . . ) * @ return The secondary index instance for this column * @ throws ConfigurationException */ public static SecondaryIndex createInstance ( ColumnFamilyStore baseCfs , ColumnDefinition cdef ) throws ConfigurationException { } }
SecondaryIndex index ; switch ( cdef . getIndexType ( ) ) { case KEYS : index = new KeysIndex ( ) ; break ; case COMPOSITES : index = CompositesIndex . create ( cdef ) ; break ; case CUSTOM : assert cdef . getIndexOptions ( ) != null ; String class_name = cdef . getIndexOptions ( ) . get ( CUSTOM_INDEX_OPTION_NAME ) ; assert class_name != null ; try { index = ( SecondaryIndex ) Class . forName ( class_name ) . newInstance ( ) ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; } break ; default : throw new RuntimeException ( "Unknown index type: " + cdef . getIndexName ( ) ) ; } index . addColumnDef ( cdef ) ; index . validateOptions ( ) ; index . setBaseCfs ( baseCfs ) ; return index ;
public class CmsDomUtil { /** * Returns the element position relative to its siblings . < p > * @ param e the element to get the position for * @ return the position , or < code > - 1 < / code > if not found */ public static int getPosition ( Element e ) { } }
NodeList < Node > childNodes = e . getParentElement ( ) . getChildNodes ( ) ; for ( int i = childNodes . getLength ( ) ; i >= 0 ; i -- ) { if ( childNodes . getItem ( i ) == e ) { return i ; } } return - 1 ;
public class CanonicalStore { /** * clean up stale entries */ void cleanUpStaleEntries ( ) { } }
for ( KeyedRef < K , V > ref = q . poll ( ) ; ref != null ; ref = q . poll ( ) ) { map . remove ( ref . getKey ( ) , ref ) ; // CONCURRENT remove ( ) operation }
public class BeanBuilder { /** * Checks whether there are any runtime refs inside the list and * converts it to a ManagedList if necessary * @ param value The object that represents the list * @ return Either a new list or a managed one */ private Object manageListIfNecessary ( List < Object > value ) { } }
boolean containsRuntimeRefs = false ; for ( ListIterator < Object > i = value . listIterator ( ) ; i . hasNext ( ) ; ) { Object e = i . next ( ) ; if ( e instanceof RuntimeBeanReference ) { containsRuntimeRefs = true ; } if ( e instanceof BeanConfiguration ) { BeanConfiguration c = ( BeanConfiguration ) e ; i . set ( c . getBeanDefinition ( ) ) ; containsRuntimeRefs = true ; } } if ( containsRuntimeRefs ) { List tmp = new ManagedList ( ) ; tmp . addAll ( value ) ; value = tmp ; } return value ;
public class UnitJudge { /** * check whether the specified unit is available . * tips : don ' t use exception catching to get the result , cause this is bad performance . */ public static boolean available ( String groupName , String unitName ) { } }
return LocalUnitsManager . getLocalUnit ( groupName , unitName ) != null || UnitDiscovery . singleton != null && UnitDiscovery . singleton . firstInstance ( Unit . fullName ( groupName , unitName ) ) != null ;
public class CrosstabBuilder { /** * { @ linkplain CrosstabBuilder # addColumn ( DJCrosstabColumn ) } * @ param title * @ param property * @ param className * @ param showTotal * @ return */ public CrosstabBuilder addColumn ( String title , String property , String className , boolean showTotal ) { } }
DJCrosstabColumn col = new CrosstabColumnBuilder ( ) . setProperty ( property , className ) . setShowTotals ( showTotal ) . setTitle ( title ) . build ( ) ; addColumn ( col ) ; return this ;
public class UIContextImpl { /** * Reserved for internal framework use . Retrieves a framework attribute . * @ param name the attribute name . * @ return the framework attribute with the given name . */ @ Override public Object getFwkAttribute ( final String name ) { } }
if ( attribMap == null ) { return null ; } return attribMap . get ( name ) ;
public class Selection { /** * Gets the main type . * @ param _ baseTypes the base types * @ return the main type * @ throws EFapsException on error */ private Type evalMainType ( final Collection < Type > _baseTypes ) throws EFapsException { } }
final Type ret ; if ( _baseTypes . size ( ) == 1 ) { ret = _baseTypes . iterator ( ) . next ( ) ; } else { final List < List < Type > > typeLists = new ArrayList < > ( ) ; for ( final Type type : _baseTypes ) { final List < Type > typesTmp = new ArrayList < > ( ) ; typeLists . add ( typesTmp ) ; Type tmpType = type ; while ( tmpType != null ) { typesTmp . add ( tmpType ) ; tmpType = tmpType . getParentType ( ) ; } } final Set < Type > common = new LinkedHashSet < > ( ) ; if ( ! typeLists . isEmpty ( ) ) { final Iterator < List < Type > > iterator = typeLists . iterator ( ) ; common . addAll ( iterator . next ( ) ) ; while ( iterator . hasNext ( ) ) { common . retainAll ( iterator . next ( ) ) ; } } if ( common . isEmpty ( ) ) { throw new EFapsException ( Selection . class , "noCommon" , _baseTypes ) ; } else { // first common type ret = common . iterator ( ) . next ( ) ; } } return ret ;
public class HashMapHierarchy { /** * Remove a record . * @ param obj Key */ private void removeRec ( O obj ) { } }
graph . remove ( obj ) ; for ( int i = 0 ; i < numelems ; ++ i ) { if ( obj == elems [ i ] ) { System . arraycopy ( elems , i + 1 , elems , i , -- numelems - i ) ; elems [ numelems ] = null ; return ; } }
public class FileServlet { /** * Returns the content type for the specified path . * @ param path the path to look up . * @ return the content type for the path . * @ throws FileNotFoundException if a file ( or welcome file ) does not exist at path . * @ throws IOException if any other problem prevents the lookup of the content type . */ public String contentTypeOf ( String path ) throws IOException { } }
File file = findFile ( path ) ; return lookupMimeType ( file . getName ( ) ) ;
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link Object } { @ code > } * @ param value * Java instance representing xml element ' s value . * @ return * the new instance of { @ link JAXBElement } { @ code < } { @ link Object } { @ code > } */ @ XmlElementDecl ( namespace = "http://www.opengis.net/citygml/transportation/1.0" , name = "_GenericApplicationPropertyOfTrack" ) public JAXBElement < Object > create_GenericApplicationPropertyOfTrack ( Object value ) { } }
return new JAXBElement < Object > ( __GenericApplicationPropertyOfTrack_QNAME , Object . class , null , value ) ;
public class JarWithFile { /** * Opens a stream to an entry in the jar . * @ param path relative path into the jar . */ public ZipStreamImpl openReadImpl ( PathImpl path ) throws IOException { } }
String pathName = path . getPath ( ) ; return openReadImpl ( pathName ) ;
public class WWindowInterceptor { /** * Temporarily replaces the environment while the UI prepares to render . * @ param request the request being responded to . */ @ Override public void preparePaint ( final Request request ) { } }
if ( windowId == null ) { super . preparePaint ( request ) ; } else { // Get the window component ComponentWithContext target = WebUtilities . getComponentById ( windowId , true ) ; if ( target == null ) { throw new SystemException ( "No window component for id " + windowId ) ; } UIContext uic = UIContextHolder . getCurrentPrimaryUIContext ( ) ; Environment originalEnvironment = uic . getEnvironment ( ) ; uic . setEnvironment ( new EnvironmentDelegate ( originalEnvironment , windowId , target ) ) ; UIContextHolder . pushContext ( target . getContext ( ) ) ; try { super . preparePaint ( request ) ; } finally { uic . setEnvironment ( originalEnvironment ) ; UIContextHolder . popContext ( ) ; } }
public class Points { /** * Returns the Euclidian distance between the specified two points , truncated to the nearest * integer . */ public static int distance ( int x1 , int y1 , int x2 , int y2 ) { } }
return ( int ) Math . sqrt ( distanceSq ( x1 , y1 , x2 , y2 ) ) ;
public class CMARichText { /** * Update the value of this text . * @ param value the new value of the text . * @ return this instance for chaining . */ @ NonNull public CMARichText setValue ( @ NonNull CharSequence value ) { } }
if ( value == null ) { throw new NullPointerException ( "value is null." ) ; } this . value = value ; return this ;
public class RecordFile { /** * Positions the current record as indicated by the specified record ID . * @ param rid * a record ID */ public void moveToRecordId ( RecordId rid ) { } }
moveTo ( rid . block ( ) . number ( ) ) ; rp . moveToId ( rid . id ( ) ) ;
public class ToStream { /** * Tell if this character can be written without escaping . */ protected boolean escapingNotNeeded ( char ch ) { } }
final boolean ret ; if ( ch < 127 ) { // This is the old / fast code here , but is this // correct for all encodings ? if ( ch >= CharInfo . S_SPACE || ( CharInfo . S_LINEFEED == ch || CharInfo . S_CARRIAGERETURN == ch || CharInfo . S_HORIZONAL_TAB == ch ) ) ret = true ; else ret = false ; } else { ret = m_encodingInfo . isInEncoding ( ch ) ; } return ret ;
public class XCalDocument { /** * Writes the xCal document to a file . * @ param file the file to write to ( UTF - 8 encoding will be used ) * @ param outputProperties properties to assign to the JAXP transformer ( see * { @ link Transformer # setOutputProperty } ) * @ throws IOException if there ' s a problem writing to the file * @ throws TransformerException if there ' s a problem writing the XML */ public void write ( File file , Map < String , String > outputProperties ) throws TransformerException , IOException { } }
Writer writer = new Utf8Writer ( file ) ; try { write ( writer , outputProperties ) ; } finally { writer . close ( ) ; }
public class BELStatementConverter { /** * { @ inheritDoc } */ @ Override public Statement convert ( BELStatement bs ) { } }
if ( bs == null ) { return null ; } String comment = bs . getComment ( ) ; String belSyntax = bs . getStatementSyntax ( ) ; Statement s = BELParser . parseStatement ( belSyntax ) ; repopulateNamespaces ( s ) ; s . setComment ( comment ) ; final BELAnnotationConverter bac = new BELAnnotationConverter ( adefs ) ; List < BELAnnotation > annotations = bs . getAnnotations ( ) ; List < Annotation > alist = null ; if ( hasItems ( annotations ) ) { alist = sizedArrayList ( annotations . size ( ) ) ; for ( BELAnnotation annotation : annotations ) { alist . addAll ( bac . convert ( annotation ) ) ; } } BELCitation bc = bs . getCitation ( ) ; BELEvidence be = bs . getEvidence ( ) ; AnnotationGroup ag = new AnnotationGroup ( ) ; boolean hasAnnotation = false ; if ( hasItems ( alist ) ) { ag . setAnnotations ( alist ) ; hasAnnotation = true ; } if ( bc != null ) { ag . setCitation ( bcc . convert ( bc ) ) ; hasAnnotation = true ; } if ( be != null ) { ag . setEvidence ( bec . convert ( be ) ) ; hasAnnotation = true ; } if ( hasAnnotation ) { s . setAnnotationGroup ( ag ) ; } return s ;
public class SS { /** * Returns a < a href = * " http : / / docs . aws . amazon . com / amazondynamodb / latest / developerguide / Expressions . SpecifyingConditions . html # ConditionExpressionReference . Comparators " * > comparator condition < / a > ( that evaluates to true if the value of the * current attribute is equal to the set of specified values ) for building condition * expression . */ public ComparatorCondition eq ( String ... values ) { } }
return new ComparatorCondition ( "=" , this , new LiteralOperand ( new LinkedHashSet < String > ( Arrays . asList ( values ) ) ) ) ;
public class RuntimeSchema { /** * Returns the schema wrapper . */ static < T > HasSchema < T > getSchemaWrapper ( Class < T > typeClass , IdStrategy strategy ) { } }
return strategy . getSchemaWrapper ( typeClass , true ) ;
public class Bean { /** * Creates data proxy of specified class for specified session . * @ param interfaceClass Class of the proxy interface . * @ param session Session instance for the proxy . * @ param < T > Type of the proxy interface . * @ throws Exception */ protected < T > T createProxy ( Class < T > interfaceClass , Session session ) throws Exception { } }
return configBean . getConfig ( ) . getStoredProcedureProxyFactory ( ) . getProxy ( interfaceClass , session ) ;
public class Network { /** * Convert megabits into a more ' human readable ' format ( from ' long ' to ' String ' ) * @ param megabits the amount in megabit ( mb ) * @ return a String containing a pretty formatted output */ private static String bitsToString ( long megabits ) { } }
int unit = 1000 ; if ( megabits < unit ) { return megabits + " mb" ; } int exp = ( int ) ( Math . log ( megabits ) / Math . log ( unit ) ) ; return new DecimalFormat ( "#.##" ) . format ( megabits / Math . pow ( unit , exp ) ) + "GTPE" . charAt ( exp - 1 ) + "b" ;
public class ObjectInputStream { /** * Returns the previously - read object corresponding to the given serialization handle . * @ throws InvalidObjectException * If there is no previously - read object with this handle */ private Object registeredObjectRead ( int handle ) throws InvalidObjectException { } }
Object res = objectsRead . get ( handle - ObjectStreamConstants . baseWireHandle ) ; if ( res == UNSHARED_OBJ ) { throw new InvalidObjectException ( "Cannot read back reference to unshared object" ) ; } return res ;
public class KernelPoints { /** * Returns a list of the raw vectors being used by the kernel points . * Altering this vectors will alter the same vectors used by these objects * and will cause inconsistent results . * @ return the list of raw basis vectors used by the Kernel points */ public List < Vec > getRawBasisVecs ( ) { } }
List < Vec > vecs = new ArrayList < Vec > ( getBasisSize ( ) ) ; vecs . addAll ( this . points . get ( 0 ) . vecs ) ; return vecs ;
public class FileSystemScanner { /** * / * - - - Private methods - - - */ private String [ ] createResolversIncludesPattern ( Collection < AbstractDependencyResolver > dependencyResolvers ) { } }
Collection < String > resultIncludes = new ArrayList < > ( ) ; // TODO - check if can be done with lambda for ( AbstractDependencyResolver dependencyResolver : dependencyResolvers ) { for ( String manifestFile : dependencyResolver . getManifestFiles ( ) ) { if ( ! manifestFile . isEmpty ( ) ) { resultIncludes . add ( Constants . PATTERN + manifestFile ) ; } } } String [ ] resultArray = new String [ resultIncludes . size ( ) ] ; resultIncludes . toArray ( resultArray ) ; return resultArray ;
public class ScanRequest { /** * One or more substitution tokens for attribute names in an expression . The following are some use cases for using * < code > ExpressionAttributeNames < / code > : * < ul > * < li > * To access an attribute whose name conflicts with a DynamoDB reserved word . * < / li > * < li > * To create a placeholder for repeating occurrences of an attribute name in an expression . * < / li > * < li > * To prevent special characters in an attribute name from being misinterpreted in an expression . * < / li > * < / ul > * Use the < b > # < / b > character in an expression to dereference an attribute name . For example , consider the following * attribute name : * < ul > * < li > * < code > Percentile < / code > * < / li > * < / ul > * The name of this attribute conflicts with a reserved word , so it cannot be used directly in an expression . ( For * the complete list of reserved words , see < a * href = " https : / / docs . aws . amazon . com / amazondynamodb / latest / developerguide / ReservedWords . html " > Reserved Words < / a > in * the < i > Amazon DynamoDB Developer Guide < / i > ) . To work around this , you could specify the following for * < code > ExpressionAttributeNames < / code > : * < ul > * < li > * < code > { " # P " : " Percentile " } < / code > * < / li > * < / ul > * You could then use this substitution in an expression , as in this example : * < ul > * < li > * < code > # P = : val < / code > * < / li > * < / ul > * < note > * Tokens that begin with the < b > : < / b > character are < i > expression attribute values < / i > , which are placeholders for * the actual value at runtime . * < / note > * For more information on expression attribute names , see < a href = * " https : / / docs . aws . amazon . com / amazondynamodb / latest / developerguide / Expressions . AccessingItemAttributes . html " * > Accessing Item Attributes < / a > in the < i > Amazon DynamoDB Developer Guide < / i > . * @ param expressionAttributeNames * One or more substitution tokens for attribute names in an expression . The following are some use cases for * using < code > ExpressionAttributeNames < / code > : < / p > * < ul > * < li > * To access an attribute whose name conflicts with a DynamoDB reserved word . * < / li > * < li > * To create a placeholder for repeating occurrences of an attribute name in an expression . * < / li > * < li > * To prevent special characters in an attribute name from being misinterpreted in an expression . * < / li > * < / ul > * Use the < b > # < / b > character in an expression to dereference an attribute name . For example , consider the * following attribute name : * < ul > * < li > * < code > Percentile < / code > * < / li > * < / ul > * The name of this attribute conflicts with a reserved word , so it cannot be used directly in an expression . * ( For the complete list of reserved words , see < a * href = " https : / / docs . aws . amazon . com / amazondynamodb / latest / developerguide / ReservedWords . html " > Reserved * Words < / a > in the < i > Amazon DynamoDB Developer Guide < / i > ) . To work around this , you could specify the * following for < code > ExpressionAttributeNames < / code > : * < ul > * < li > * < code > { " # P " : " Percentile " } < / code > * < / li > * < / ul > * You could then use this substitution in an expression , as in this example : * < ul > * < li > * < code > # P = : val < / code > * < / li > * < / ul > * < note > * Tokens that begin with the < b > : < / b > character are < i > expression attribute values < / i > , which are * placeholders for the actual value at runtime . * < / note > * For more information on expression attribute names , see < a href = * " https : / / docs . aws . amazon . com / amazondynamodb / latest / developerguide / Expressions . AccessingItemAttributes . html " * > Accessing Item Attributes < / a > in the < i > Amazon DynamoDB Developer Guide < / i > . * @ return Returns a reference to this object so that method calls can be chained together . */ public ScanRequest withExpressionAttributeNames ( java . util . Map < String , String > expressionAttributeNames ) { } }
setExpressionAttributeNames ( expressionAttributeNames ) ; return this ;
public class RecurlyClient { /** * Enter an offline payment for a manual invoice ( beta ) - Recurly Enterprise Feature * @ param invoiceId String Recurly Invoice ID * @ param payment The external payment */ public Transaction enterOfflinePayment ( final String invoiceId , final Transaction payment ) { } }
return doPOST ( Invoices . INVOICES_RESOURCE + "/" + invoiceId + "/transactions" , payment , Transaction . class ) ;
public class servicegroup { /** * Use this API to fetch filtered set of servicegroup resources . * filter string should be in JSON format . eg : " port : 80 , servicetype : HTTP " . */ public static servicegroup [ ] get_filtered ( nitro_service service , String filter ) throws Exception { } }
servicegroup obj = new servicegroup ( ) ; options option = new options ( ) ; option . set_filter ( filter ) ; servicegroup [ ] response = ( servicegroup [ ] ) obj . getfiltered ( service , option ) ; return response ;
public class CmsVfsBundleManager { /** * Logs an exception that occurred . < p > * @ param e the exception to log * @ param logToErrorChannel if true erros should be written to the error channel instead of the info channel */ protected void logError ( Exception e , boolean logToErrorChannel ) { } }
if ( logToErrorChannel ) { LOG . error ( e . getLocalizedMessage ( ) , e ) ; } else { LOG . info ( e . getLocalizedMessage ( ) , e ) ; } // if an error was logged make sure that the flag to schedule a reload is reset setReloadScheduled ( false ) ;
public class OptionsUtil { /** * Checks if the specified Options object needs the javascript file * " exporting . js " to work properly . This method can be called by GUI * components to determine whether the javascript file has to be included in * the page or not . * @ param options the { @ link Options } object to analyze * @ return true , if " exporting . js " is needed to render the options , false if * not */ public static boolean needsExportingJs ( final Options options ) { } }
// when no ExportingOptions are set , they are enabled by default , hence // return true when they are null return options . getExporting ( ) == null || ( options . getExporting ( ) . getEnabled ( ) != null && options . getExporting ( ) . getEnabled ( ) ) ;
public class SkipBadRecords { /** * Get the directory to which skipped records are written . By default it is * the sub directory of the output _ logs directory . * User can stop writing skipped records by setting the value null . * @ param conf the configuration . * @ return path skip output directory . Null is returned if this is not set * and output directory is also not set . */ public static Path getSkipOutputPath ( Configuration conf ) { } }
String name = conf . get ( OUT_PATH ) ; if ( name != null ) { if ( "none" . equals ( name ) ) { return null ; } return new Path ( name ) ; } Path outPath = FileOutputFormat . getOutputPath ( new JobConf ( conf ) ) ; return outPath == null ? null : new Path ( outPath , "_logs" + Path . SEPARATOR + "skip" ) ;
public class NativeHammerEvent { /** * Get relative x position on the page . * @ return x position in pixels */ public final int getRelativeX ( ) { } }
NativeEvent e = getNativeEvent ( ) ; Element target = getTarget ( ) ; return e . getClientX ( ) - target . getAbsoluteLeft ( ) + target . getScrollLeft ( ) + target . getOwnerDocument ( ) . getScrollLeft ( ) ;
public class SSLEngineFactory { /** * Creates a client mode { @ link SSLEngine } for the specified SSL options . * @ param sslOptions * an object encapsulating the SSL options to use when creating the * SSLEngine . * @ param host * the host that the SSL engine will be used to connect to . * @ param port * the port that the SSL engine will be used to connect to . * @ return An SSLEngine instance for the required SSL options . * @ throws SSLException * if the keystore , trust store , or client certificate cannot be * found . * @ throws NoSuchAlgorithmException * if a TLSv1.2 { @ link SSLContext } cannot be created . * @ throws KeyManagementException * if the initialization of the SSLContext fails . */ public SSLEngine createClientSSLEngine ( SSLOptions sslOptions , String host , int port ) throws SSLException , NoSuchAlgorithmException , KeyManagementException { } }
final String methodName = "createClientSSLEngine" ; logger . entry ( this , methodName , sslOptions , host , port ) ; KeyManagerFactory keyManagerFactory = null ; TrustManagerFactory trustManagerFactory = null ; // Setup the key and trust manager factories from the supplied options final File keyStoreFile = sslOptions . getKeyStoreFile ( ) ; if ( keyStoreFile != null ) { try { final java . security . KeyStore keyStore = KeyStoreUtils . loadKeyStore ( keyStoreFile , sslOptions . getKeyStoreFilePassphrase ( ) ) ; keyManagerFactory = KeyManagerFactory . getInstance ( KeyManagerFactory . getDefaultAlgorithm ( ) ) ; keyManagerFactory . init ( keyStore , sslOptions . getKeyStoreFilePassphrase ( ) . toCharArray ( ) ) ; trustManagerFactory = TrustManagerFactory . getInstance ( TrustManagerFactory . getDefaultAlgorithm ( ) ) ; trustManagerFactory . init ( keyStore ) ; } catch ( IOException | NoSuchAlgorithmException | CertificateException | KeyStoreException | UnrecoverableKeyException e ) { throw new SSLException ( "failed to load key store" , e ) ; } } else { // If a client certificate is available then setup a key manager factory for the client certificate and private key if ( sslOptions . getClientCertificateFile ( ) != null && sslOptions . getClientCertificateFile ( ) . exists ( ) ) { try { final KeyStore keyStore = KeyStore . getInstance ( "JKS" ) ; keyStore . load ( null , null ) ; final char [ ] clientKeyPasswordChars ; if ( sslOptions . getClientKeyFilePassphrase ( ) == null ) { // No password provided , so generate one ( not that secure , but does not need to be as never exposed externally ) clientKeyPasswordChars = Long . toHexString ( new SecureRandom ( ) . nextLong ( ) ) . toCharArray ( ) ; } else { clientKeyPasswordChars = sslOptions . getClientKeyFilePassphrase ( ) . toCharArray ( ) ; } // Get the client certificate chain final PemFile certChainPemFile = new PemFile ( sslOptions . getClientCertificateFile ( ) ) ; final List < Certificate > certChain = certChainPemFile . getCertificates ( ) ; // Add the private key , with the certificate chain , to the key store KeyStoreUtils . addPrivateKey ( keyStore , sslOptions . getClientKeyFile ( ) , clientKeyPasswordChars , certChain ) ; // Set up key manager factory to use our key store keyManagerFactory = KeyManagerFactory . getInstance ( KeyManagerFactory . getDefaultAlgorithm ( ) ) ; keyManagerFactory . init ( keyStore , clientKeyPasswordChars ) ; } catch ( Exception e ) { throw new SSLException ( "failed to load client certificate or private key" , e ) ; } } // If trust certificates ares available then setup a trust manager factory for them if ( sslOptions . getTrustCertificateFile ( ) != null && sslOptions . getTrustCertificateFile ( ) . exists ( ) ) { try { // First attempt to load the trust certificates assuming the file is a key store // TODO Not sure this is useful as a key store requires a password , which is not provided KeyStore trustStore = null ; try { trustStore = KeyStoreUtils . loadKeyStore ( sslOptions . getTrustCertificateFile ( ) , null ) ; } catch ( IOException | NoSuchAlgorithmException | CertificateException | KeyStoreException e ) { logger . data ( this , methodName , e . toString ( ) ) ; trustStore = null ; } // If the file was not a key store then assume a PEM format file if ( trustStore == null ) { trustStore = KeyStore . getInstance ( "JKS" ) ; trustStore . load ( null , null ) ; // Get the trust certificates final PemFile certsPemFile = new PemFile ( sslOptions . getTrustCertificateFile ( ) ) ; List < Certificate > certs = certsPemFile . getCertificates ( ) ; int index = 0 ; for ( Certificate cert : certs ) { trustStore . setCertificateEntry ( "cert" + ( ++ index ) , cert ) ; } } // Set up trust manager factory to use our trust store . trustManagerFactory = TrustManagerFactory . getInstance ( TrustManagerFactory . getDefaultAlgorithm ( ) ) ; trustManagerFactory . init ( trustStore ) ; } catch ( Exception e ) { throw new SSLException ( "failed to load trust certificates" , e ) ; } } } // Initialise the SSL context . If the trust manager is null then this falls back to loading default cacerts final SSLContext sslContext = SSLContext . getInstance ( "TLSv1.2" ) ; sslContext . init ( keyManagerFactory == null ? null : keyManagerFactory . getKeyManagers ( ) , trustManagerFactory == null ? null : trustManagerFactory . getTrustManagers ( ) , null ) ; // Setup the SSLEngine for client mode with the appropriate protocols and ciphers enabled final SSLEngine sslEngine = sslContext . createSSLEngine ( host , port ) ; sslEngine . setUseClientMode ( true ) ; final LinkedList < String > enabledProtocols = new LinkedList < String > ( ) { private static final long serialVersionUID = 7838479468739671083L ; { for ( String protocol : sslEngine . getSupportedProtocols ( ) ) { if ( ! disabledProtocolPattern . matcher ( protocol ) . matches ( ) ) { add ( protocol ) ; } } } } ; sslEngine . setEnabledProtocols ( enabledProtocols . toArray ( new String [ enabledProtocols . size ( ) ] ) ) ; logger . data ( this , methodName , "enabledProtocols" , Arrays . toString ( sslEngine . getEnabledProtocols ( ) ) ) ; final LinkedList < String > enabledCipherSuites = new LinkedList < String > ( ) { private static final long serialVersionUID = 7838479468739671083L ; { for ( String cipher : sslEngine . getSupportedCipherSuites ( ) ) { if ( ! disabledCipherPattern . matcher ( cipher ) . matches ( ) ) { add ( cipher ) ; } } } } ; sslEngine . setEnabledCipherSuites ( enabledCipherSuites . toArray ( new String [ enabledCipherSuites . size ( ) ] ) ) ; logger . data ( this , methodName , "enabledCipherSuites" , Arrays . toString ( sslEngine . getEnabledCipherSuites ( ) ) ) ; if ( sslOptions . getVerifyName ( ) ) { SSLParameters sslParams = sslEngine . getSSLParameters ( ) ; sslParams . setEndpointIdentificationAlgorithm ( "HTTPS" ) ; sslEngine . setSSLParameters ( sslParams ) ; } logger . exit ( this , methodName , sslEngine ) ; return sslEngine ;
public class AbstractJRebirthPreloader { /** * { @ inheritDoc } */ @ Override public void start ( final Stage stage ) throws Exception { } }
// Store the preloader stage to reuse it later this . preloaderStage = stage ; // Configure the stage stage . centerOnScreen ( ) ; stage . initStyle ( StageStyle . TRANSPARENT ) ; stage . setScene ( createPreloaderScene ( ) ) ; // Let ' s start the show stage . show ( ) ;
public class GeoJsonToAssembler { /** * Converts a multipolygon to its corresponding Transfer Object * @ param input the multipolygon * @ return the transfer object for the geometrycollection */ public GeometryCollectionTo toTransferObject ( GeometryCollection input ) { } }
GeometryCollectionTo result = new GeometryCollectionTo ( ) ; GeoJsonTo [ ] tos = new GeoJsonTo [ input . getNumGeometries ( ) ] ; for ( int i = 0 ; i < input . getNumGeometries ( ) ; i ++ ) { tos [ i ] = toTransferObject ( input . getGeometryN ( i ) ) ; tos [ i ] . setCrs ( null ) ; // Crs may not be repeated } result . setGeometries ( tos ) ; result . setCrs ( GeoJsonTo . createCrsTo ( "EPSG:" + input . getSRID ( ) ) ) ; return result ;
public class SelectSubPlanAssembler { /** * Generate all possible access paths for an inner node in a join . * The set of potential index expressions depends whether the inner node can be inlined * with the NLIJ or not . In the former case , inner and inner - outer join expressions can * be considered for the index access . In the latter , only inner join expressions qualifies . * @ param parentNode A parent node to the node to generate paths to . */ private void generateInnerAccessPaths ( BranchNode parentNode ) { } }
JoinNode innerChildNode = parentNode . getRightNode ( ) ; assert ( innerChildNode != null ) ; // In case of inner join WHERE and JOIN expressions can be merged if ( parentNode . getJoinType ( ) == JoinType . INNER ) { parentNode . m_joinInnerOuterList . addAll ( parentNode . m_whereInnerOuterList ) ; parentNode . m_whereInnerOuterList . clear ( ) ; parentNode . m_joinInnerList . addAll ( parentNode . m_whereInnerList ) ; parentNode . m_whereInnerList . clear ( ) ; } if ( innerChildNode instanceof BranchNode ) { generateOuterAccessPaths ( ( BranchNode ) innerChildNode ) ; generateInnerAccessPaths ( ( BranchNode ) innerChildNode ) ; // The inner node is a join node itself . Only naive access path is possible innerChildNode . m_accessPaths . add ( getRelevantNaivePath ( parentNode . m_joinInnerOuterList , parentNode . m_joinInnerList ) ) ; return ; } // The inner table can have multiple index access paths based on // inner and inner - outer join expressions plus the naive one . List < AbstractExpression > filterExprs = null ; List < AbstractExpression > postExprs = null ; // For the FULL join type , the inner join expressions must stay at the join node and // not go down to the inner node as filters ( as predicates for SeqScan nodes and / or // index expressions for Index Scan ) . The latter case ( IndexScan ) won ' t work for NLJ because // the inner join expression will effectively filter out inner tuple prior to the NLJ . if ( parentNode . getJoinType ( ) != JoinType . FULL ) { filterExprs = parentNode . m_joinInnerList ; } else { postExprs = parentNode . m_joinInnerList ; } StmtTableScan innerTable = innerChildNode . getTableScan ( ) ; assert ( innerTable != null ) ; innerChildNode . m_accessPaths . addAll ( getRelevantAccessPathsForTable ( innerTable , parentNode . m_joinInnerOuterList , filterExprs , postExprs ) ) ; // If there are inner expressions AND inner - outer expressions , it could be that there // are indexed access paths that use elements of both in the indexing expressions , // especially in the case of a compound index . // These access paths can not be considered for use with an NLJ because they rely on // inner - outer expressions . // If there is a possibility that NLIJ will not be an option due to the // " special case " processing that puts a send / receive plan between the join node // and its inner child node , other access paths need to be considered that use the // same indexes as those identified so far but in a simpler , less effective way // that does not rely on inner - outer expressions . // The following simplistic method of finding these access paths is to force // inner - outer expressions to be handled as NLJ - compatible post - filters and repeat // the search for access paths . // This will typically generate some duplicate access paths , including the naive // sequential scan path and any indexed paths that happened to use only the inner // expressions . // For now , we deal with this redundancy by dropping ( and re - generating ) all // access paths EXCPT those that reference the inner - outer expressions . // TODO : implementing access path hash and equality and possibly using a " Set " // would allow deduping as new access paths are added OR // the simplified access path search process could be based on // the existing indexed access paths - - for each access path that " hasInnerOuterIndexExpression " // try to generate and add a simpler access path using the same index , // this time with the inner - outer expressions used only as non - indexable post - filters . // Don ' t bother generating these redundant or inferior access paths unless there is // an inner - outer expression and a chance that NLIJ will be taken out of the running . boolean mayNeedInnerSendReceive = ( ! m_partitioning . wasSpecifiedAsSingle ( ) ) && ( m_partitioning . getCountOfPartitionedTables ( ) > 0 ) && ( parentNode . getJoinType ( ) != JoinType . INNER ) && ! innerTable . getIsReplicated ( ) ; // too expensive / complicated to test here ? ( parentNode . m _ leftNode has a replicated result ? ) & & if ( mayNeedInnerSendReceive && ! parentNode . m_joinInnerOuterList . isEmpty ( ) ) { List < AccessPath > innerOuterAccessPaths = new ArrayList < > ( ) ; for ( AccessPath innerAccessPath : innerChildNode . m_accessPaths ) { if ( ( innerAccessPath . index != null ) && hasInnerOuterIndexExpression ( innerChildNode . getTableAlias ( ) , innerAccessPath . indexExprs , innerAccessPath . initialExpr , innerAccessPath . endExprs ) ) { innerOuterAccessPaths . add ( innerAccessPath ) ; } } if ( parentNode . getJoinType ( ) != JoinType . FULL ) { filterExprs = parentNode . m_joinInnerList ; postExprs = parentNode . m_joinInnerOuterList ; } else { // For FULL join type the inner join expressions must be part of the post predicate // in order to stay at the join node and not be pushed down to the inner node filterExprs = null ; postExprs = new ArrayList < > ( parentNode . m_joinInnerList ) ; postExprs . addAll ( parentNode . m_joinInnerOuterList ) ; } Collection < AccessPath > nljAccessPaths = getRelevantAccessPathsForTable ( innerTable , null , filterExprs , postExprs ) ; innerChildNode . m_accessPaths . clear ( ) ; innerChildNode . m_accessPaths . addAll ( nljAccessPaths ) ; innerChildNode . m_accessPaths . addAll ( innerOuterAccessPaths ) ; } assert ( innerChildNode . m_accessPaths . size ( ) > 0 ) ;
public class DListImpl { /** * Determines whether there is an element of the collection that evaluates to true * for the predicate . * @ parampredicateAn OQL boolean query predicate . * @ returnTrue if there is an element of the collection that evaluates to true * for the predicate , otherwise false . * @ exceptionorg . odmg . QueryInvalidExceptionThe query predicate is invalid . */ public boolean existsElement ( String predicate ) throws org . odmg . QueryInvalidException { } }
DList results = ( DList ) this . query ( predicate ) ; if ( results == null || results . size ( ) == 0 ) return false ; else return true ;
public class USING { /** * < div color = ' red ' style = " font - size : 24px ; color : red " > < b > < i > < u > JCYPHER < / u > < / i > < / b > < / div > * < div color = ' red ' style = " font - size : 18px ; color : red " > < i > set the label to be used in the label scan < / i > < / div > * < div color = ' red ' style = " font - size : 18px ; color : red " > < i > e . g . < b > USING . LABEL _ SCAN ( " German " ) < / b > . . . < / i > < / div > * < br / > */ public static UsingScan LABEL_SCAN ( String labelName ) { } }
UsingScan ret = UFactory . onLabel ( labelName ) ; ASTNode an = APIObjectAccess . getAstNode ( ret ) ; an . setClauseType ( ClauseType . USING_SCAN ) ; return ret ;
public class PutFromLoadValidator { /** * This methods should be called only from tests ; it removes existing validator from the cache structures * in order to replace it with new one . * @ param cache */ public static PutFromLoadValidator removeFromCache ( AdvancedCache cache ) { } }
AsyncInterceptorChain chain = cache . getAsyncInterceptorChain ( ) ; BasicComponentRegistry cr = cache . getComponentRegistry ( ) . getComponent ( BasicComponentRegistry . class ) ; chain . removeInterceptor ( TxPutFromLoadInterceptor . class ) ; chain . removeInterceptor ( NonTxPutFromLoadInterceptor . class ) ; chain . getInterceptors ( ) . stream ( ) . filter ( BaseInvalidationInterceptor . class :: isInstance ) . findFirst ( ) . map ( AsyncInterceptor :: getClass ) . ifPresent ( invalidationClass -> { InvalidationInterceptor invalidationInterceptor = new InvalidationInterceptor ( ) ; cr . replaceComponent ( InvalidationInterceptor . class . getName ( ) , invalidationInterceptor , true ) ; cr . getComponent ( InvalidationInterceptor . class ) . running ( ) ; chain . replaceInterceptor ( invalidationInterceptor , invalidationClass ) ; } ) ; chain . getInterceptors ( ) . stream ( ) . filter ( LockingInterceptor . class :: isInstance ) . findFirst ( ) . map ( AsyncInterceptor :: getClass ) . ifPresent ( invalidationClass -> { NonTransactionalLockingInterceptor lockingInterceptor = new NonTransactionalLockingInterceptor ( ) ; cr . replaceComponent ( NonTransactionalLockingInterceptor . class . getName ( ) , lockingInterceptor , true ) ; cr . getComponent ( NonTransactionalLockingInterceptor . class ) . running ( ) ; chain . replaceInterceptor ( lockingInterceptor , LockingInterceptor . class ) ; } ) ; CacheCommandInitializer cci = cr . getComponent ( CacheCommandInitializer . class ) . running ( ) ; return cci . removePutFromLoadValidator ( cache . getName ( ) ) ;
public class ZookeeperBasedJobLock { /** * Release the lock . * @ throws IOException */ @ Override public void unlock ( ) throws JobLockException { } }
if ( this . lock . isAcquiredInThisProcess ( ) ) { try { this . lock . release ( ) ; } catch ( Exception e ) { throw new JobLockException ( "Failed to release lock " + this . lockPath , e ) ; } }
public class TypeHandlerUtils { /** * Transfers data from byte [ ] into sql . Clob * @ param clob sql . Clob which would be filled * @ param value array of bytes * @ return sql . Clob from array of bytes * @ throws SQLException */ public static Object convertClob ( Object clob , byte [ ] value ) throws SQLException { } }
ByteArrayInputStream input = new ByteArrayInputStream ( value ) ; // OutputStream output = clob . setAsciiStream ( 1 ) ; OutputStream output = null ; try { output = ( OutputStream ) MappingUtils . invokeFunction ( clob , "setAsciiStream" , new Class [ ] { long . class } , new Object [ ] { 1 } ) ; } catch ( MjdbcException ex ) { throw new MjdbcSQLException ( ex ) ; } try { copy ( input , output ) ; output . flush ( ) ; output . close ( ) ; } catch ( IOException ex ) { throw new MjdbcSQLException ( ex ) ; } return clob ;
public class PackageManagerUtils { /** * Checks if the device has a low latency audio feature . * @ param context the context . * @ return { @ code true } if the device has a low latency audio feature . */ @ TargetApi ( Build . VERSION_CODES . GINGERBREAD ) public static boolean hasLowLatencyAudioFeature ( Context context ) { } }
return hasLowLatencyAudioFeature ( context . getPackageManager ( ) ) ;
public class MetricsCacheManagerHttpServer { /** * manual test for local mode topology , for debug * How to run : * in the [ source root directory ] , run bazel test , * bazel run heron / metricscachemgr / src / java : metricscache - queryclient - unshaded - - \ * & lt ; host : port & gt ; & lt ; component _ name & gt ; & lt ; metrics _ name & gt ; * Example : * 1 . run the example topology , * ~ / bin / heron submit local ~ / . heron / examples / heron - api - examples . jar \ * org . apache . heron . examples . api . ExclamationTopology ExclamationTopology \ * - - deploy - deactivated - - verbose * 2 . in the [ source root directory ] , * bazel run heron / metricscachemgr / src / java : metricscache - queryclient - unshaded - - \ * 127.0.0.1:23345 exclaim1 \ * _ _ emit - count _ _ execute - count _ _ fail - count _ _ ack - count _ _ complete - latency _ _ execute - latency \ * _ _ process - latency _ _ jvm - uptime - secs _ _ jvm - process - cpu - load _ _ jvm - memory - used - mb \ * _ _ jvm - memory - mb - total _ _ jvm - gc - collection - time - ms _ _ server / _ _ time _ spent _ back _ pressure _ initiated \ * _ _ time _ spent _ back _ pressure _ by _ compid */ public static void main ( String [ ] args ) throws ExecutionException , InterruptedException , IOException { } }
if ( args . length < 3 ) { System . out . println ( "Usage: java MetricsQuery <host:port> <component_name> <metrics_name>" ) ; } // construct metric cache stat url String url = "http://" + args [ 0 ] + MetricsCacheManagerHttpServer . PATH_STATS ; System . out . println ( "endpoint: " + url + "; component: " + args [ 1 ] ) ; // construct query payload byte [ ] requestData = TopologyMaster . MetricRequest . newBuilder ( ) . setComponentName ( args [ 1 ] ) . setMinutely ( true ) . setInterval ( - 1 ) . addAllMetric ( Arrays . asList ( Arrays . copyOfRange ( args , 2 , args . length ) ) ) . build ( ) . toByteArray ( ) ; // http communication HttpURLConnection con = NetworkUtils . getHttpConnection ( url ) ; NetworkUtils . sendHttpPostRequest ( con , "X" , requestData ) ; byte [ ] responseData = NetworkUtils . readHttpResponse ( con ) ; // parse response data TopologyMaster . MetricResponse response = TopologyMaster . MetricResponse . parseFrom ( responseData ) ; System . out . println ( response . toString ( ) ) ;
public class Randoms { /** * Pick a random element from the specified iterable , or return * < code > ifEmpty < / code > if no element has a weight greater than < code > 0 < / code > . * < p > < b > Implementation note : < / b > a random number is generated for every entry with a * non - zero weight after the first such entry . * @ throws NullPointerException if values is null . * @ throws IllegalArgumentException if any weight is less than 0. */ public < T > T pick ( Iterable < ? extends T > values , T ifEmpty , Weigher < ? super T > weigher ) { } }
return pick ( values . iterator ( ) , ifEmpty , weigher ) ;
public class TechnologyTargeting { /** * Sets the browserTargeting value for this TechnologyTargeting . * @ param browserTargeting * The browsers being targeted by the { @ link LineItem } . */ public void setBrowserTargeting ( com . google . api . ads . admanager . axis . v201811 . BrowserTargeting browserTargeting ) { } }
this . browserTargeting = browserTargeting ;
public class CMutex { /** * Releases an array of mutex previously acquired * @ param mutex * the mutex array to release */ public static final void releaseMultiple ( CMutex mutex [ ] ) { } }
Arrays . sort ( mutex , new CMutexComparator ( ) ) ; for ( int i = mutex . length - 1 ; i >= 0 ; i -- ) { mutex [ i ] . release ( ) ; }
public class VirtualWANsInner { /** * Retrieves the details of a VirtualWAN . * @ param resourceGroupName The resource group name of the VirtualWan . * @ param virtualWANName The name of the VirtualWAN being retrieved . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ throws ErrorException thrown if the request is rejected by server * @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @ return the VirtualWANInner object if successful . */ public VirtualWANInner getByResourceGroup ( String resourceGroupName , String virtualWANName ) { } }
return getByResourceGroupWithServiceResponseAsync ( resourceGroupName , virtualWANName ) . toBlocking ( ) . single ( ) . body ( ) ;
public class AWSACMPCAClient { /** * Revokes a certificate that you issued by calling the < a > IssueCertificate < / a > operation . If you enable a * certificate revocation list ( CRL ) when you create or update your private CA , information about the revoked * certificates will be included in the CRL . ACM PCA writes the CRL to an S3 bucket that you specify . For more * information about revocation , see the < a > CrlConfiguration < / a > structure . ACM PCA also writes revocation * information to the audit report . For more information , see < a > CreateCertificateAuthorityAuditReport < / a > . * @ param revokeCertificateRequest * @ return Result of the RevokeCertificate operation returned by the service . * @ throws ConcurrentModificationException * A previous update to your private CA is still ongoing . * @ throws InvalidArnException * The requested Amazon Resource Name ( ARN ) does not refer to an existing resource . * @ throws InvalidStateException * The private CA is in a state during which a report or certificate cannot be generated . * @ throws LimitExceededException * An ACM PCA limit has been exceeded . See the exception message returned to determine the limit that was * exceeded . * @ throws ResourceNotFoundException * A resource such as a private CA , S3 bucket , certificate , or audit report cannot be found . * @ throws RequestAlreadyProcessedException * Your request has already been completed . * @ throws RequestInProgressException * Your request is already in progress . * @ throws RequestFailedException * The request has failed for an unspecified reason . * @ sample AWSACMPCA . RevokeCertificate * @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / acm - pca - 2017-08-22 / RevokeCertificate " target = " _ top " > AWS API * Documentation < / a > */ @ Override public RevokeCertificateResult revokeCertificate ( RevokeCertificateRequest request ) { } }
request = beforeClientExecution ( request ) ; return executeRevokeCertificate ( request ) ;
public class TupleGenerator { /** * Returns a set of 1 - tuples containing the bindings for the given variable that are applicable to the given test case . */ private Iterator < Tuple > getBindingsFor ( VarTupleSet tuples , VarDef var ) { } }
return IteratorUtils . chainedIterator ( tuples . getUnused ( var ) , IteratorUtils . chainedIterator ( tuples . getUsed ( var ) , tuples . getUsedOnce ( var ) ) ) ;
public class SocketListener { /** * { @ inheritDoc } */ @ Override public boolean listenToException ( final AbstractPerfidixMethodException exec ) { } }
try { return view . updateErrorInElement ( ( exec . getMethod ( ) . getDeclaringClass ( ) . getName ( ) + "." + exec . getMethod ( ) . getName ( ) ) , exec ) ; } catch ( final SocketViewException e ) { throw new IllegalStateException ( e ) ; }
public class GoogleCloudStorageImpl { /** * Performs copy operation using GCS Copy requests * @ see GoogleCloudStorage # copy ( String , List , String , List ) */ private void copyInternal ( BatchHelper batchHelper , final KeySetView < IOException , Boolean > innerExceptions , final String srcBucketName , final String srcObjectName , final String dstBucketName , final String dstObjectName ) throws IOException { } }
Storage . Objects . Copy copyObject = configureRequest ( gcs . objects ( ) . copy ( srcBucketName , srcObjectName , dstBucketName , dstObjectName , null ) , srcBucketName ) ; batchHelper . queue ( copyObject , new JsonBatchCallback < StorageObject > ( ) { @ Override public void onSuccess ( StorageObject copyResponse , HttpHeaders responseHeaders ) { String srcString = StorageResourceId . createReadableString ( srcBucketName , srcObjectName ) ; String dstString = StorageResourceId . createReadableString ( dstBucketName , dstObjectName ) ; logger . atFine ( ) . log ( "Successfully copied %s to %s" , srcString , dstString ) ; } @ Override public void onFailure ( GoogleJsonError e , HttpHeaders responseHeaders ) { onCopyFailure ( innerExceptions , e , srcBucketName , srcObjectName ) ; } } ) ;
public class BoxTrash { /** * Restores a trashed folder to a new location with a new name . * @ param folderID the ID of the trashed folder . * @ param newName an optional new name to give the folder . This can be null to use the folder ' s original name . * @ param newParentID an optional new parent ID for the folder . This can be null to use the folder ' s original * parent . * @ return info about the restored folder . */ public BoxFolder . Info restoreFolder ( String folderID , String newName , String newParentID ) { } }
JsonObject requestJSON = new JsonObject ( ) ; if ( newName != null ) { requestJSON . add ( "name" , newName ) ; } if ( newParentID != null ) { JsonObject parent = new JsonObject ( ) ; parent . add ( "id" , newParentID ) ; requestJSON . add ( "parent" , parent ) ; } URL url = RESTORE_FOLDER_URL_TEMPLATE . build ( this . api . getBaseURL ( ) , folderID ) ; BoxJSONRequest request = new BoxJSONRequest ( this . api , url , "POST" ) ; request . setBody ( requestJSON . toString ( ) ) ; BoxJSONResponse response = ( BoxJSONResponse ) request . send ( ) ; JsonObject responseJSON = JsonObject . readFrom ( response . getJSON ( ) ) ; BoxFolder restoredFolder = new BoxFolder ( this . api , responseJSON . get ( "id" ) . asString ( ) ) ; return restoredFolder . new Info ( responseJSON ) ;
public class PatternMatchingSupport { /** * Matches DOS - type wildcardexpressions rather than regular expressions . * The function adds one little but handy feature of regular expressions : * The ' | ' - character is regarded as a boolean OR that separates multiple expressions . * @ param val string value that may match the expression * @ param exp expression that may contain wild cards * @ return */ public static boolean valueMatchesWildcardExpression ( String val , String exp ) { } }
// replace [ \ ^ $ . | ? * + ( ) to make regexp do wildcard match String expCopy = StringSupport . replaceAll ( exp , new String [ ] { "[" , "\\" , "^" , "$" , "." , "?" , "*" , "+" , "(" , ")" } , new String [ ] { "\\[" , "\\\\" , "\\^" , "\\$" , "\\." , ".?" , ".*" , "\\+" , "\\(" , "\\)" } ) ; return ( valueMatchesRegularExpression ( val , expCopy ) ) ;
public class Image { /** * Returns for given parameter < i > _ id < / i > the instance of class * { @ link Image } . * @ param _ id id to search in the cache * @ return instance of class { @ link Image } * @ throws CacheReloadException on error * @ see # getCache */ public static Image get ( final long _id ) throws CacheReloadException { } }
return AbstractUserInterfaceObject . < Image > get ( _id , Image . class , CIAdminUserInterface . Image . getType ( ) ) ;
public class SecretsManager { /** * Ensure that the given secret has an AWSCURRENT value . This requires the permission * < code > secretsmanager : GetSecretValue < / code > * @ param secretId * the ARN of the secret . * @ throws ResourceNotFoundException if the secret doesn ' t exist or it has no AWSCURRENT stage */ public void assertCurrentStageExists ( final String secretId ) { } }
final GetSecretValueRequest getSecretValueRequest = new GetSecretValueRequest ( ) ; getSecretValueRequest . setSecretId ( secretId ) ; getSecretValueRequest . setVersionStage ( CURRENT . getAwsName ( ) ) ; getDelegate ( ) . getSecretValue ( getSecretValueRequest ) ;
public class UaaAuthorizationEndpoint { /** * We need explicit approval from the user . */ private ModelAndView getUserApprovalPageResponse ( Map < String , Object > model , AuthorizationRequest authorizationRequest , Authentication principal ) { } }
logger . debug ( "Loading user approval page: " + userApprovalPage ) ; model . putAll ( userApprovalHandler . getUserApprovalRequest ( authorizationRequest , principal ) ) ; return new ModelAndView ( userApprovalPage , model ) ;
public class JSONObject { /** * get string value . * @ param key key . * @ return value or default value . */ public String getString ( String key ) { } }
Object tmp = objectMap . get ( key ) ; return tmp == null ? null : tmp . toString ( ) ;
public class ComputationGraph { /** * Get the parameters for the ComputationGraph * @ param backwardOnly If true : backprop parameters only ( i . e . , no visible layer biases used in layerwise pretraining layers ) */ public INDArray params ( boolean backwardOnly ) { } }
if ( backwardOnly ) return flattenedParams ; List < INDArray > list = new ArrayList < > ( layers . length ) ; for ( int i = 0 ; i < topologicalOrder . length ; i ++ ) { if ( ! vertices [ topologicalOrder [ i ] ] . hasLayer ( ) ) continue ; Layer l = vertices [ topologicalOrder [ i ] ] . getLayer ( ) ; INDArray layerParams = l . params ( ) ; if ( layerParams != null ) list . add ( layerParams ) ; // may be null : subsampling etc layers } return Nd4j . toFlattened ( 'f' , list ) ;
public class CmsContentService { /** * Synchronizes the locale independent fields . < p > * @ param file the content file * @ param content the XML content * @ param skipPaths the paths to skip during locale synchronization * @ param entities the edited entities * @ param lastEdited the last edited locale * @ throws CmsXmlException if something goes wrong */ protected void synchronizeLocaleIndependentFields ( CmsFile file , CmsXmlContent content , Collection < String > skipPaths , Collection < CmsEntity > entities , Locale lastEdited ) throws CmsXmlException { } }
CmsEntity lastEditedEntity = null ; for ( CmsEntity entity : entities ) { if ( lastEdited . equals ( CmsLocaleManager . getLocale ( CmsContentDefinition . getLocaleFromId ( entity . getId ( ) ) ) ) ) { lastEditedEntity = entity ; } else { synchronizeLocaleIndependentForEntity ( file , content , skipPaths , entity ) ; } } if ( lastEditedEntity != null ) { // prepare the last edited last , to sync locale independent fields synchronizeLocaleIndependentForEntity ( file , content , skipPaths , lastEditedEntity ) ; }
public class EnvironmentImpl { /** * Tries to load meta tree located at specified rootAddress . * @ param rootAddress tree root address . * @ return tree instance or null if the address is not valid . */ @ Nullable BTree loadMetaTree ( final long rootAddress , final LogTip logTip ) { } }
if ( rootAddress < 0 || rootAddress >= logTip . highAddress ) return null ; return new BTree ( log , getBTreeBalancePolicy ( ) , rootAddress , false , META_TREE_ID ) { @ NotNull @ Override public DataIterator getDataIterator ( long address ) { return new DataIterator ( log , address ) ; } } ;
public class DescribeAlgorithmRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( DescribeAlgorithmRequest describeAlgorithmRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( describeAlgorithmRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( describeAlgorithmRequest . getAlgorithmName ( ) , ALGORITHMNAME_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class MethodTypeSignature { /** * / * ( non - Javadoc ) * @ see io . github . classgraph . ScanResultObject # setScanResult ( io . github . classgraph . ScanResult ) */ @ Override void setScanResult ( final ScanResult scanResult ) { } }
super . setScanResult ( scanResult ) ; if ( typeParameters != null ) { for ( final TypeParameter typeParameter : typeParameters ) { typeParameter . setScanResult ( scanResult ) ; } } if ( this . parameterTypeSignatures != null ) { for ( final TypeSignature typeParameter : parameterTypeSignatures ) { typeParameter . setScanResult ( scanResult ) ; } } if ( this . resultType != null ) { this . resultType . setScanResult ( scanResult ) ; } if ( throwsSignatures != null ) { for ( final ClassRefOrTypeVariableSignature throwsSignature : throwsSignatures ) { throwsSignature . setScanResult ( scanResult ) ; } }
public class CoinbaseAccountServiceRaw { /** * Authenticated resource that lets you ( as a merchant ) list all the subscriptions customers have * made with you . This call returns { @ code CoinbaseSubscription } objects where you are the * merchant . * @ param page Optional parameter to request a desired page of results . Will return page 1 if the * supplied page is null or less than 1. * @ param limit Optional parameter to limit the maximum number of results to return . Will return * up to 25 results by default if null or less than 1. * @ return * @ throws IOException * @ see < a * href = " https : / / coinbase . com / api / doc / 1.0 / subscribers / index . html " > coinbase . com / api / doc / 1.0 / subscribers / index . html < / a > */ public CoinbaseSubscriptions getCoinbaseSubscriptions ( Integer page , final Integer limit ) throws IOException { } }
final CoinbaseSubscriptions subscriptions = coinbase . getsSubscriptions ( page , limit , exchange . getExchangeSpecification ( ) . getApiKey ( ) , signatureCreator , exchange . getNonceFactory ( ) ) ; return subscriptions ;
public class BaseLexicon { /** * Normalize string . * @ param sequence the sequence * @ return the string */ protected String normalize ( CharSequence sequence ) { } }
if ( isCaseSensitive ( ) ) { return sequence . toString ( ) ; } return sequence . toString ( ) . toLowerCase ( ) ;
public class OpenTok { /** * Creates a new OpenTok session . * For example , when using the OpenTok . js library , use the session ID when calling the * < a href = " http : / / tokbox . com / opentok / libraries / client / js / reference / OT . html # initSession " > * OT . initSession ( ) < / a > method ( to initialize an OpenTok session ) . * OpenTok sessions do not expire . However , authentication tokens do expire ( see the * { @ link # generateToken ( String , TokenOptions ) } method ) . Also note that sessions cannot * explicitly be destroyed . * A session ID string can be up to 255 characters long . * Calling this method results in an { @ link com . opentok . exception . OpenTokException } in * the event of an error . Check the error message for details . * The following code creates a session that attempts to send streams directly between clients * ( falling back to use the OpenTok TURN server to relay streams if the clients cannot connect ) : * < pre > * import com . opentok . MediaMode ; * import com . opentok . OpenTok ; * import com . opentok . Session ; * import com . opentok . SessionProperties ; * class Test { * public static void main ( String argv [ ] ) throws OpenTokException { * int API _ KEY = 0 ; / / Replace with your OpenTok API key . * String API _ SECRET = " " ; / / Replace with your OpenTok API secret . * OpenTok sdk = new OpenTok ( API _ KEY , API _ SECRET ) ; * SessionProperties sp = new SessionProperties ( ) . Builder ( ) * . mediaMode ( MediaMode . RELAYED ) . build ( ) ; * Session session = sdk . createSession ( sp ) ; * System . out . println ( session . getSessionId ( ) ) ; * < / pre > * You can also create a session using the < a href = " http : / / www . tokbox . com / opentok / api / # session _ id _ production " > OpenTok * REST API < / a > or or by logging in to your * < a href = " https : / / tokbox . com / account " > TokBox account < / a > . * @ param properties This SessionProperties object defines options for the session . * These include the following : * < ul > * < li > Whether the session ' s streams will be transmitted directly between peers or * using the OpenTok Media Router . < / li > * < li > A location hint for the location of the OpenTok server to use for the session . < / li > * < / ul > * @ return A Session object representing the new session . Call the < code > getSessionId ( ) < / code > * method of the Session object to get the session ID , which uniquely identifies the * session . You will use this session ID in the client SDKs to identify the session . */ public Session createSession ( SessionProperties properties ) throws OpenTokException { } }
final SessionProperties _properties = properties != null ? properties : new SessionProperties . Builder ( ) . build ( ) ; final Map < String , Collection < String > > params = _properties . toMap ( ) ; final String response = this . client . createSession ( params ) ; try { CreatedSession [ ] sessions = createdSessionReader . readValue ( response ) ; // A bit ugly , but API response should include an array with one session if ( sessions . length != 1 ) { throw new OpenTokException ( String . format ( "Unexpected number of sessions created %d" , sessions . length ) ) ; } return new Session ( sessions [ 0 ] . getId ( ) , apiKey , apiSecret , _properties ) ; } catch ( IOException e ) { throw new OpenTokException ( "Cannot create session. Could not read the response: " + response ) ; }
public class PostContentRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( PostContentRequest postContentRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( postContentRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( postContentRequest . getBotName ( ) , BOTNAME_BINDING ) ; protocolMarshaller . marshall ( postContentRequest . getBotAlias ( ) , BOTALIAS_BINDING ) ; protocolMarshaller . marshall ( postContentRequest . getUserId ( ) , USERID_BINDING ) ; protocolMarshaller . marshall ( postContentRequest . getSessionAttributes ( ) , SESSIONATTRIBUTES_BINDING ) ; protocolMarshaller . marshall ( postContentRequest . getRequestAttributes ( ) , REQUESTATTRIBUTES_BINDING ) ; protocolMarshaller . marshall ( postContentRequest . getContentType ( ) , CONTENTTYPE_BINDING ) ; protocolMarshaller . marshall ( postContentRequest . getAccept ( ) , ACCEPT_BINDING ) ; protocolMarshaller . marshall ( postContentRequest . getInputStream ( ) , INPUTSTREAM_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class PDBFileParser { /** * Here we assign chains following the mmCIF data model : * one chain per polymer , one chain per non - polymer group and * several water chains . * Subsequently we assign entities for them : either from those read from * COMPOUND records or from those found heuristically through { @ link EntityFinder } */ private void assignChainsAndEntities ( ) { } }
List < List < Chain > > polyModels = new ArrayList < > ( ) ; List < List < Chain > > nonPolyModels = new ArrayList < > ( ) ; List < List < Chain > > waterModels = new ArrayList < > ( ) ; for ( List < Chain > model : allModels ) { List < Chain > polyChains = new ArrayList < > ( ) ; List < Chain > nonPolyChains = new ArrayList < > ( ) ; List < Chain > waterChains = new ArrayList < > ( ) ; polyModels . add ( polyChains ) ; nonPolyModels . add ( nonPolyChains ) ; waterModels . add ( waterChains ) ; for ( Chain c : model ) { // we only have entities for polymeric chains , all others are ignored for assigning entities if ( c . isWaterOnly ( ) ) { waterChains . add ( c ) ; } else if ( c . isPureNonPolymer ( ) ) { nonPolyChains . add ( c ) ; } else { polyChains . add ( c ) ; } } } List < List < Chain > > splitNonPolyModels = new ArrayList < > ( ) ; for ( int i = 0 ; i < nonPolyModels . size ( ) ; i ++ ) { List < Chain > nonPolyModel = nonPolyModels . get ( i ) ; List < Chain > waterModel = waterModels . get ( i ) ; List < Chain > splitNonPolys = new ArrayList < > ( ) ; splitNonPolyModels . add ( splitNonPolys ) ; for ( Chain nonPoly : nonPolyModel ) { List < List < Chain > > splits = splitNonPolyChain ( nonPoly ) ; splitNonPolys . addAll ( splits . get ( 0 ) ) ; waterModel . addAll ( splits . get ( 1 ) ) ; } } // now we have all chains as in mmcif , let ' s assign ids following the mmcif rules assignAsymIds ( polyModels , splitNonPolyModels , waterModels ) ; if ( ! entities . isEmpty ( ) ) { // if the file contained COMPOUND records then we can assign entities to the poly chains for ( EntityInfo comp : entities ) { List < String > chainIds = compoundMolIds2chainIds . get ( comp . getMolId ( ) ) ; if ( chainIds == null ) continue ; for ( String chainId : chainIds ) { List < List < Chain > > models = findChains ( chainId , polyModels ) ; for ( List < Chain > matchingChains : models ) { for ( Chain chain : matchingChains ) { comp . addChain ( chain ) ; chain . setEntityInfo ( comp ) ; } if ( matchingChains . isEmpty ( ) ) { // usually if this happens something is wrong with the PDB header // e . g . 2brd - there is no Chain A , although it is specified in the header // Some bona - fide cases exist , e . g . 2ja5 , chain N is described in SEQRES // but the authors didn ' t observe in the density so it ' s completely missing // from the ATOM lines logger . warn ( "Could not find polymeric chain {} to link to entity {}. The chain will be missing in the entity." , chainId , comp . getMolId ( ) ) ; } } } } } else { logger . info ( "Entity information (COMPOUND record) not found in file. Will assign entities heuristically" ) ; // if no entity information was present in file we then go and find the entities heuristically with EntityFinder entities = EntityFinder . findPolyEntities ( polyModels ) ; } // now we assign entities to the nonpoly and water chains EntityFinder . createPurelyNonPolyEntities ( splitNonPolyModels , waterModels , entities ) ; // in some rare cases purely non - polymer or purely water chain are present in pdb files // see https : / / github . com / biojava / biojava / pull / 394 // these case should be covered by the above // now that we have entities in chains we add the chains to the structure for ( int i = 0 ; i < allModels . size ( ) ; i ++ ) { List < Chain > model = new ArrayList < > ( ) ; model . addAll ( polyModels . get ( i ) ) ; model . addAll ( splitNonPolyModels . get ( i ) ) ; model . addAll ( waterModels . get ( i ) ) ; structure . addModel ( model ) ; }
public class CallSiteArray { /** * otherwise or if method doesn ' t exist we make call via POJO meta class */ private static CallSite createPojoSite ( CallSite callSite , Object receiver , Object [ ] args ) { } }
final Class klazz = receiver . getClass ( ) ; MetaClass metaClass = InvokerHelper . getMetaClass ( receiver ) ; if ( ! GroovyCategorySupport . hasCategoryInCurrentThread ( ) && metaClass instanceof MetaClassImpl ) { final MetaClassImpl mci = ( MetaClassImpl ) metaClass ; final ClassInfo info = mci . getTheCachedClass ( ) . classInfo ; if ( info . hasPerInstanceMetaClasses ( ) ) { return new PerInstancePojoMetaClassSite ( callSite , info ) ; } else { return mci . createPojoCallSite ( callSite , receiver , args ) ; } } ClassInfo info = ClassInfo . getClassInfo ( klazz ) ; if ( info . hasPerInstanceMetaClasses ( ) ) return new PerInstancePojoMetaClassSite ( callSite , info ) ; else return new PojoMetaClassSite ( callSite , metaClass ) ;
public class DescribeNotificationsForBudgetResult { /** * A list of notifications that are associated with a budget . * @ param notifications * A list of notifications that are associated with a budget . */ public void setNotifications ( java . util . Collection < Notification > notifications ) { } }
if ( notifications == null ) { this . notifications = null ; return ; } this . notifications = new java . util . ArrayList < Notification > ( notifications ) ;
public class Utils { /** * Compute the MD5 of the given string and return it as a Base64 - encoded value . The * string is first converted to bytes using UTF - 8 , and the MD5 is computed on that * value . The MD5 value is 16 bytes , but the Base64 - encoded string is 24 chars . * @ param strIn A Unicode string . * @ return Base64 - encoded value of the strings UTF - 8 encoded value . */ public static String md5Encode ( String strIn ) { } }
try { MessageDigest md5 = MessageDigest . getInstance ( "md5" ) ; byte [ ] bin = toBytes ( strIn ) ; byte [ ] bout = md5 . digest ( bin ) ; String strOut = javax . xml . bind . DatatypeConverter . printBase64Binary ( bout ) ; return strOut ; } catch ( Exception e ) { throw new RuntimeException ( e . getMessage ( ) , e ) ; }
public class Interval { /** * Cancel the current schedule , and ensure that any expirations that are queued up but have not * yet run do not run . */ public final void cancel ( ) { } }
IntervalTask task = _task ; if ( task != null ) { _task = null ; task . cancel ( ) ; }
public class SelectorUtils { /** * Replace the possible variable place holder . * @ param formatter current formatter * @ param str the string * @ param caller for exception handling * @ return the result */ static String replacePlaceHolder ( CssFormatter formatter , String str , LessObject caller ) { } }
int pos = str . startsWith ( "@{" ) ? 0 : str . indexOf ( "@" , 1 ) ; if ( pos >= 0 ) { formatter . addOutput ( ) ; SelectorUtils . appendToWithPlaceHolder ( formatter , str , pos , false , caller ) ; return formatter . releaseOutput ( ) ; } return str ;
public class SenBotReferenceService { /** * Find a { @ link By } locator by its reference name * @ param elementReference * @ return { @ link By } */ public By getElementLocatorForElementReference ( String elementReference ) { } }
Map < String , By > objectReferenceMap = getObjectReferenceMap ( By . class ) ; By elementLocator = objectReferenceMap . get ( elementReference ) ; if ( elementLocator == null ) { fail ( "No elementLocator is found for element name: '" + elementReference + "'. Available element references are: " + objectReferenceMap . keySet ( ) . toString ( ) ) ; } return elementLocator ;
public class BinaryTreeAddressableHeap { /** * Get the parent node of a given node . */ private Node getParent ( Node n ) { } }
if ( n . y_s == null ) { return null ; } Node c = n . y_s ; if ( c . o_c == n ) { return c ; } Node p1 = c . y_s ; if ( p1 != null && p1 . o_c == n ) { return p1 ; } return c ;
public class SnapshotContentItemVerifier { /** * ( non - Javadoc ) * @ see org . springframework . batch . item . ItemWriter # write ( java . util . List ) */ @ Override public void write ( List < ? extends SnapshotContentItem > items ) throws Exception { } }
for ( SnapshotContentItem item : items ) { Map < String , String > props = PropertiesSerializer . deserialize ( item . getMetadata ( ) ) ; String contentId = item . getContentId ( ) ; String checksum = props . get ( ContentStore . CONTENT_CHECKSUM ) ; // verify that manifest contains every item from the database except // SNAPSHOT _ PROPS _ FILENAME if ( ! contentId . equals ( Constants . SNAPSHOT_PROPS_FILENAME ) ) { if ( ! this . manifestSet . contains ( ManifestFileHelper . formatManifestSetString ( contentId , checksum ) ) ) { addError ( MessageFormat . format ( "Content item {0} with checksum {1} not found in manifest " + "for snapshot {2}" , contentId , checksum , this . snapshotName ) ) ; } } }
public class UnionFindUtil { /** * Make a new instance ( automatically choosing the best implementation ) . * @ param ids ID set * @ return Union find algorithm */ public static UnionFind make ( StaticDBIDs ids ) { } }
if ( ids instanceof DBIDRange ) { return new WeightedQuickUnionRangeDBIDs ( ( DBIDRange ) ids ) ; } return new WeightedQuickUnionStaticDBIDs ( ids ) ;
public class ConnectionTcp { /** * Initialize the socket for a new connection */ private void initSocket ( ) throws IOException { } }
_idleTimeout = _port . getKeepaliveTimeout ( ) ; _port . ssl ( _socket ) ; writeStream ( ) . init ( _socket . stream ( ) ) ; // ReadStream cannot use getWriteStream or auto - flush // because of duplex mode // ReadStream is = getReadStream ( ) ; _readStream . init ( _socket . stream ( ) ) ; if ( log . isLoggable ( Level . FINEST ) ) { log . finest ( dbgId ( ) + "starting connection " + this + ", total=" + _port . getConnectionCount ( ) ) ; }
public class SpnegoContext { /** * Initialize the GSSContext to provide SPNEGO feature . * @ param inputBuf * @ param offset * @ param len * @ return * @ throws GSSException */ byte [ ] initSecContext ( byte [ ] inputBuf , int offset , int len ) throws GSSException { } }
byte [ ] ret = null ; if ( len == 0 ) { byte [ ] mechToken = context . initSecContext ( inputBuf , offset , len ) ; int contextFlags = 0 ; if ( context . getCredDelegState ( ) ) { contextFlags |= NegTokenInit . DELEGATION ; } if ( context . getMutualAuthState ( ) ) { contextFlags |= NegTokenInit . MUTUAL_AUTHENTICATION ; } if ( context . getReplayDetState ( ) ) { contextFlags |= NegTokenInit . REPLAY_DETECTION ; } if ( context . getSequenceDetState ( ) ) { contextFlags |= NegTokenInit . SEQUENCE_CHECKING ; } if ( context . getAnonymityState ( ) ) { contextFlags |= NegTokenInit . ANONYMITY ; } if ( context . getConfState ( ) ) { contextFlags |= NegTokenInit . CONFIDENTIALITY ; } if ( context . getIntegState ( ) ) { contextFlags |= NegTokenInit . INTEGRITY ; } ret = new NegTokenInit ( new String [ ] { context . getMech ( ) . toString ( ) } , contextFlags , mechToken , null ) . toByteArray ( ) ; } else { SpnegoToken spToken = getToken ( inputBuf , offset , len ) ; byte [ ] mechToken = spToken . getMechanismToken ( ) ; mechToken = context . initSecContext ( mechToken , 0 , mechToken . length ) ; if ( mechToken != null ) { int result = NegTokenTarg . ACCEPT_INCOMPLETE ; if ( context . isEstablished ( ) ) { result = NegTokenTarg . ACCEPT_COMPLETED ; } ret = new NegTokenTarg ( result , context . getMech ( ) . toString ( ) , mechToken , null ) . toByteArray ( ) ; } } return ret ;