signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class FormatFactory { /** * Creates new format descriptor
* @ param name the encoding
* @ param sampleRate sample rate value in Hertz
* @ param sampleSize sample size in bits
* @ param channels number of channels */
public static AudioFormat createAudioFormat ( EncodingName name , int sampleRate , int sampleSize , int channels ) { } } | AudioFormat fmt = createAudioFormat ( name ) ; fmt . setSampleRate ( sampleRate ) ; fmt . setSampleSize ( sampleSize ) ; fmt . setChannels ( channels ) ; return fmt ; |
public class RemoteMediationPoint { /** * / * ( non - Javadoc )
* @ see com . ibm . ws . sib . processor . runtime . SIMPRemoteQueuePointControllable # getPtoPOutboundTransmit ( java . lang . String , java . lang . String ) */
public SIMPPtoPOutboundTransmitControllable getPtoPOutboundTransmit ( ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "getPtoPOutboundTransmit" ) ; SIMPPtoPOutboundTransmitControllable control = null ; if ( xmitPointControl != null ) { control = xmitPointControl . getPtoPOutboundTransmit ( ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "getPtoPOutboundTransmit" , control ) ; return control ; |
public class UserApi { /** * Search users by Email or username .
* < pre > < code > GitLab Endpoint : GET / users ? search = : email _ or _ username < / code > < / pre >
* @ param emailOrUsername the email or username to search for
* @ return a Stream of User instances with the email or username like emailOrUsername
* @ throws GitLabApiException if any exception occurs */
public Stream < User > findUsersStream ( String emailOrUsername ) throws GitLabApiException { } } | return ( findUsers ( emailOrUsername , getDefaultPerPage ( ) ) . stream ( ) ) ; |
public class ConfigurationFactory { /** * Create the bb - processor using xml - configuration resource
* @ param resourceName name of resource file
* @ return bb - code processor
* @ throws TextProcessorFactoryException when can ' t find or read the resource or illegal config file */
public Configuration createFromResource ( String resourceName ) { } } | Exceptions . nullArgument ( "resourceName" , resourceName ) ; Configuration configuration ; try { InputStream stream = null ; try { stream = Utils . openResourceStream ( resourceName ) ; if ( stream != null ) { configuration = create ( stream ) ; } else { throw new TextProcessorFactoryException ( "Can't find or open resource \"" + resourceName + "\"." ) ; } } finally { if ( stream != null ) { stream . close ( ) ; } } } catch ( IOException e ) { throw new TextProcessorFactoryException ( e ) ; } return configuration ; |
public class ReactionSchemeManipulator { /** * Extract reactions from a IReactionSet which at least one product is existing
* as reactant given a IReaction
* @ param reaction The IReaction to analyze
* @ param reactionSet The IReactionSet to inspect
* @ return A IReactionSet containing the reactions */
private static IReactionSet extractPrecursorReaction ( IReaction reaction , IReactionSet reactionSet ) { } } | IReactionSet reactConSet = reaction . getBuilder ( ) . newInstance ( IReactionSet . class ) ; for ( IAtomContainer reactant : reaction . getReactants ( ) . atomContainers ( ) ) { for ( IReaction reactionInt : reactionSet . reactions ( ) ) { for ( IAtomContainer precursor : reactionInt . getProducts ( ) . atomContainers ( ) ) { if ( reactant . equals ( precursor ) ) { reactConSet . addReaction ( reactionInt ) ; } } } } return reactConSet ; |
public class AppTrackerImpl { /** * Store module names for the app */
private synchronized AppModuleName addAppModuleNames ( String appName , String moduleAndAppName ) { } } | HashSet < String > moduleNames = null ; String moduleName = moduleAndAppName . split ( "#" ) [ 1 ] ; if ( appModules . containsKey ( appName ) ) { moduleNames = ( HashSet < String > ) appModules . get ( appName ) ; moduleNames . add ( moduleName ) ; } else { moduleNames = new HashSet < String > ( ) ; moduleNames . add ( moduleName ) ; appModules . put ( appName , moduleNames ) ; } if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "addAppModuleNames(): modules added = " + appModules . toString ( ) + " for app: " + appName ) ; AppModuleName retVal = new AppModuleName ( ) ; retVal . appName = appName ; retVal . moduleName = moduleName ; return retVal ; |
public class MapWithProtoValuesSubject { /** * Limits the comparison of Protocol buffers to the defined { @ link FieldScope } .
* < p > This method is additive and has well - defined ordering semantics . If the invoking { @ link
* ProtoFluentAssertion } is already scoped to a { @ link FieldScope } { @ code X } , and this method is
* invoked with { @ link FieldScope } { @ code Y } , the resultant { @ link ProtoFluentAssertion } is
* constrained to the intersection of { @ link FieldScope } s { @ code X } and { @ code Y } .
* < p > By default , { @ link MapWithProtoValuesFluentAssertion } is constrained to { @ link
* FieldScopes # all ( ) } , that is , no fields are excluded from comparison . */
public MapWithProtoValuesFluentAssertion < M > withPartialScopeForValues ( FieldScope fieldScope ) { } } | return usingConfig ( config . withPartialScope ( checkNotNull ( fieldScope , "fieldScope" ) ) ) ; |
public class ProxiedFileSystemCache { /** * Gets a { @ link FileSystem } that can perform any operations allowed by the specified userNameToProxyAs .
* @ param userNameToProxyAs The name of the user the super user should proxy as
* @ param properties { @ link java . util . Properties } containing initialization properties .
* @ param fsURI The { @ link URI } for the { @ link FileSystem } that should be created .
* @ return a { @ link FileSystem } that can execute commands on behalf of the specified userNameToProxyAs
* @ throws IOException
* @ deprecated use { @ link # fromProperties } */
@ Deprecated public static FileSystem getProxiedFileSystem ( @ NonNull final String userNameToProxyAs , Properties properties , URI fsURI ) throws IOException { } } | return getProxiedFileSystem ( userNameToProxyAs , properties , fsURI , new Configuration ( ) ) ; |
public class CmsRelationFilter { /** * Returns an extended filter with defined in content type restriction . < p >
* @ return an extended filter with defined in content type restriction */
public CmsRelationFilter filterDefinedInContent ( ) { } } | CmsRelationFilter filter = ( CmsRelationFilter ) clone ( ) ; if ( filter . m_types . isEmpty ( ) ) { filter . m_types . addAll ( CmsRelationType . getAllDefinedInContent ( ) ) ; } else { filter . m_types = new HashSet < CmsRelationType > ( CmsRelationType . filterDefinedInContent ( filter . m_types ) ) ; } return filter ; |
public class EncryptedPutObjectRequest { /** * sets the materials description for the encryption materials to be used with the current PutObjectRequest .
* @ param materialsDescription the materialsDescription to set */
public void setMaterialsDescription ( Map < String , String > materialsDescription ) { } } | this . materialsDescription = materialsDescription == null ? null : Collections . unmodifiableMap ( new HashMap < String , String > ( materialsDescription ) ) ; |
public class ParameterNameExtractor { /** * Extracts names of a serializable lambda parameters
* @ param lambda Serializable lambda
* @ param lambdaParametersCount number of lambda parameters */
public static List < String > extractParameterNames ( Serializable lambda , int lambdaParametersCount ) { } } | SerializedLambda serializedLambda = serialized ( lambda ) ; Method lambdaMethod = lambdaMethod ( serializedLambda ) ; String [ ] paramNames = paramNameReader . getParamNames ( lambdaMethod ) ; return asList ( Arrays . copyOfRange ( paramNames , paramNames . length - lambdaParametersCount , paramNames . length ) ) ; |
public class RecurlyClient { /** * Updates the acquisition details for an account
* https : / / dev . recurly . com / docs / update - account - acquisition
* @ param accountCode The account ' s account code
* @ param acquisition The AccountAcquisition data
* @ return The created AccountAcquisition object */
public AccountAcquisition updateAccountAcquisition ( final String accountCode , final AccountAcquisition acquisition ) { } } | final String path = Account . ACCOUNT_RESOURCE + "/" + accountCode + AccountAcquisition . ACCOUNT_ACQUISITION_RESOURCE ; return doPUT ( path , acquisition , AccountAcquisition . class ) ; |
public class NodeSelectorMarkupHandler { /** * Text events */
@ Override public void handleText ( final char [ ] buffer , final int offset , final int len , final int line , final int col ) throws ParseException { } } | this . someSelectorsMatch = false ; for ( int i = 0 ; i < this . selectorsLen ; i ++ ) { this . selectorMatches [ i ] = this . selectorFilters [ i ] . matchText ( false , this . markupLevel , this . markupBlocks [ this . markupLevel ] ) ; if ( this . selectorMatches [ i ] ) { this . someSelectorsMatch = true ; } } if ( this . someSelectorsMatch ) { markCurrentSelection ( ) ; this . selectedHandler . handleText ( buffer , offset , len , line , col ) ; unmarkCurrentSelection ( ) ; return ; } unmarkCurrentSelection ( ) ; this . nonSelectedHandler . handleText ( buffer , offset , len , line , col ) ; |
public class Ifc4PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public EClass getIfcRelCoversBldgElements ( ) { } } | if ( ifcRelCoversBldgElementsEClass == null ) { ifcRelCoversBldgElementsEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc4Package . eNS_URI ) . getEClassifiers ( ) . get ( 543 ) ; } return ifcRelCoversBldgElementsEClass ; |
public class PrimitiveEvent { /** * Creates a new primitive event .
* @ param eventType the event type
* @ param value the event value
* @ return the primitive event */
public static PrimitiveEvent event ( EventType eventType , byte [ ] value ) { } } | return new PrimitiveEvent ( EventType . canonical ( eventType ) , value ) ; |
public class FinishingFidelityImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public boolean eIsSet ( int featureID ) { } } | switch ( featureID ) { case AfplibPackage . FINISHING_FIDELITY__STP_FIN_EX : return STP_FIN_EX_EDEFAULT == null ? stpFinEx != null : ! STP_FIN_EX_EDEFAULT . equals ( stpFinEx ) ; case AfplibPackage . FINISHING_FIDELITY__REP_FIN_EX : return REP_FIN_EX_EDEFAULT == null ? repFinEx != null : ! REP_FIN_EX_EDEFAULT . equals ( repFinEx ) ; } return super . eIsSet ( featureID ) ; |
public class FileNode { /** * Loads the children , caching the results in the children ivar . */
public Object [ ] getChildren ( ) { } } | if ( children != null ) { return children ; } if ( this . isTestcaseDir ( ) ) { try { ArrayList < TestDataNode > arrayDataNode = new ArrayList < > ( ) ; // load test case data
File tcDataFile = this . getPythonTestScript ( ) . getTestcaseData ( ) ; if ( tcDataFile == null ) { return new Object [ ] { } ; } CSVFile csvDataFile = new CSVFile ( tcDataFile ) ; List < LinkedHashMap < String , String > > data = csvDataFile . getCSVDataSet ( ) ; Iterator < LinkedHashMap < String , String > > it = data . iterator ( ) ; int rowIndex = 1 ; while ( it . hasNext ( ) ) { LinkedHashMap < String , String > dataRow = it . next ( ) ; if ( dataRow . containsKey ( "COMMENT" ) ) { String comment = dataRow . get ( "COMMENT" ) ; arrayDataNode . add ( new TestDataNode ( tcDataFile , comment , rowIndex ) ) ; } rowIndex ++ ; } children = arrayDataNode . toArray ( ) ; return children ; } catch ( IOException ex ) { // unable to read data file
} } else { ArrayList < FileNode > arrayFileNode = new ArrayList < > ( ) ; if ( f . isDirectory ( ) ) { File [ ] childFiles = FileUtilities . listSortedFiles ( f ) ; for ( File childFile : childFiles ) { FileNode fn = new FileNode ( childFile , childFile . getName ( ) , m_TestSuiteDir ) ; boolean nodeToAdd = fn . isTestcaseDir ( ) ; if ( ! fn . isTestcaseDir ( ) ) { // go recursilvely to its child and check if it must be added
nodeToAdd = checkIfDirectoryContainsTestScriptFile ( childFile ) ; } if ( nodeToAdd && ! childFile . isHidden ( ) ) { arrayFileNode . add ( fn ) ; } } } children = arrayFileNode . toArray ( ) ; } if ( children == null ) { return new Object [ ] { } ; } else { return children ; } |
public class RemoteIOSObject { /** * Uses reflection to instanciate a remote object implementing the correct interface .
* @ return the object . If the object is UIAElementNil , return null for a simple object , an empty
* list for a UIAElementArray . */
public static WebElement createObject ( RemoteWebDriver driver , Map < String , Object > ro ) { } } | String ref = ro . get ( "ELEMENT" ) . toString ( ) ; String type = ( String ) ro . get ( "type" ) ; if ( type != null ) { String remoteObjectName = "org.uiautomation.ios.client.uiamodels.impl.Remote" + type ; if ( "UIAElementNil" . equals ( type ) ) { return null ; } boolean isArray = false ; // uiObject . has ( " length " ) ;
Object [ ] args = null ; Class < ? > [ ] argsClass = null ; if ( isArray ) { // args = new Object [ ] { driver , ref , uiObject . getInt ( " length " ) } ;
// argsClass = new Class [ ] { RemoteIOSDriver . class , String . class ,
// Integer . class } ;
} else { args = new Object [ ] { driver , ref } ; argsClass = new Class [ ] { RemoteWebDriver . class , String . class } ; } try { Class < ? > clazz = Class . forName ( remoteObjectName ) ; Constructor < ? > c = clazz . getConstructor ( argsClass ) ; Object o = c . newInstance ( args ) ; RemoteWebElement element = ( RemoteWebElement ) o ; element . setFileDetector ( driver . getFileDetector ( ) ) ; element . setParent ( driver ) ; element . setId ( ref ) ; return ( RemoteIOSObject ) o ; } catch ( Exception e ) { throw new WebDriverException ( "error casting" , e ) ; } } else { RemoteWebElement element = new RemoteWebElement ( ) ; element . setFileDetector ( driver . getFileDetector ( ) ) ; element . setId ( ref ) ; element . setParent ( driver ) ; return element ; } |
public class Page { /** * add url to fetch
* @ param requestString requestString */
public void addTargetRequest ( String requestString ) { } } | if ( StringUtils . isBlank ( requestString ) || requestString . equals ( "#" ) ) { return ; } requestString = UrlUtils . canonicalizeUrl ( requestString , url . toString ( ) ) ; targetRequests . add ( new Request ( requestString ) ) ; |
public class BlockJUnit4ClassRunner { /** * Adds to { @ code errors } for each method annotated with { @ code @ Test } ,
* { @ code @ Before } , or { @ code @ After } that is not a public , void instance
* method with no arguments .
* @ deprecated */
@ Deprecated protected void validateInstanceMethods ( List < Throwable > errors ) { } } | validatePublicVoidNoArgMethods ( After . class , false , errors ) ; validatePublicVoidNoArgMethods ( Before . class , false , errors ) ; validateTestMethods ( errors ) ; if ( computeTestMethods ( ) . isEmpty ( ) ) { errors . add ( new Exception ( "No runnable methods" ) ) ; } |
public class DailyTimeIntervalTrigger { /** * Get a { @ link IScheduleBuilder } that is configured to produce a schedule
* identical to this trigger ' s schedule .
* @ see # getTriggerBuilder ( ) */
@ Override public IScheduleBuilder < IDailyTimeIntervalTrigger > getScheduleBuilder ( ) { } } | final DailyTimeIntervalScheduleBuilder cb = DailyTimeIntervalScheduleBuilder . dailyTimeIntervalSchedule ( ) . withInterval ( getRepeatInterval ( ) , getRepeatIntervalUnit ( ) ) . onDaysOfTheWeek ( getDaysOfWeek ( ) ) . startingDailyAt ( getStartTimeOfDay ( ) ) . endingDailyAt ( getEndTimeOfDay ( ) ) ; switch ( getMisfireInstruction ( ) ) { case MISFIRE_INSTRUCTION_DO_NOTHING : cb . withMisfireHandlingInstructionDoNothing ( ) ; break ; case MISFIRE_INSTRUCTION_FIRE_ONCE_NOW : cb . withMisfireHandlingInstructionFireAndProceed ( ) ; break ; } return cb ; |
public class ConstructorSup { /** * Create an instance with given args
* @ param args arguments to fill the parameter list
* @ return created instance */
public T newInstance ( Object ... args ) { } } | try { con . setAccessible ( true ) ; return con . newInstance ( args ) ; } catch ( Exception e ) { throw $ ( e ) ; } |
public class PersonDictionary { /** * 因为任何算法都无法解决100 % 的问题 , 总是有一些bad case , 这些bad case会以 “ 盖公章 A 1 ” 的形式加入词典中 < BR >
* 这个方法返回人名是否是bad case
* @ param name
* @ return */
static boolean isBadCase ( String name ) { } } | EnumItem < NR > nrEnumItem = dictionary . get ( name ) ; if ( nrEnumItem == null ) return false ; return nrEnumItem . containsLabel ( NR . A ) ; |
public class Ifc4PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public EEnum getIfcStackTerminalTypeEnum ( ) { } } | if ( ifcStackTerminalTypeEnumEEnum == null ) { ifcStackTerminalTypeEnumEEnum = ( EEnum ) EPackage . Registry . INSTANCE . getEPackage ( Ifc4Package . eNS_URI ) . getEClassifiers ( ) . get ( 1069 ) ; } return ifcStackTerminalTypeEnumEEnum ; |
public class ZoomablePane { /** * Replies the property that contains the logger .
* @ return the logger . */
public ObjectProperty < Logger > loggerProperty ( ) { } } | if ( this . logger == null ) { this . logger = new SimpleObjectProperty < Logger > ( this , LOGGER_PROPERTY , Logger . getLogger ( getClass ( ) . getName ( ) ) ) { @ Override protected void invalidated ( ) { final Logger log = get ( ) ; if ( log == null ) { set ( Logger . getLogger ( getClass ( ) . getName ( ) ) ) ; } } } ; } return this . logger ; |
public class Vector3i { /** * / * ( non - Javadoc )
* @ see org . joml . Vector3ic # mul ( org . joml . Vector3ic , org . joml . Vector3i ) */
public Vector3i mul ( Vector3ic v , Vector3i dest ) { } } | dest . x = x * v . x ( ) ; dest . y = y * v . y ( ) ; dest . z = z * v . z ( ) ; return dest ; |
public class Base64InputStream { /** * Calls { @ link # read ( ) } repeatedly until the end of stream is reached or
* < em > len < / em > bytes are read . Returns number of bytes read into array or - 1
* if end of stream is encountered .
* @ param aDest
* array to hold values
* @ param nOfs
* offset for array
* @ param nLen
* max number of bytes to read into array
* @ return bytes read into array or - 1 if end of stream is encountered .
* @ since 1.3 */
@ Override public int read ( @ Nonnull final byte [ ] aDest , @ Nonnegative final int nOfs , @ Nonnegative final int nLen ) throws IOException { } } | int nIndex = 0 ; for ( ; nIndex < nLen ; nIndex ++ ) { final int nByte = read ( ) ; if ( nByte >= 0 ) aDest [ nOfs + nIndex ] = ( byte ) nByte ; else if ( nIndex == 0 ) { // First byte is not Base64 - nothing read
return - 1 ; } else { // Out of ' for ' loop
break ; } } return nIndex ; |
public class SharedProcessor { /** * distribute the object among listeners .
* @ param obj specific obj
* @ param isSync is sync or not */
public void distribute ( ProcessorListener . Notification < ApiType > obj , boolean isSync ) { } } | lock . readLock ( ) . lock ( ) ; try { if ( isSync ) { for ( ProcessorListener < ApiType > listener : syncingListeners ) { listener . add ( obj ) ; } } else { for ( ProcessorListener < ApiType > listener : listeners ) { listener . add ( obj ) ; } } } finally { lock . readLock ( ) . unlock ( ) ; } |
public class Player { /** * 符計算をします
* 役なしの場合は0
* Situationが無い場合は一律で20 */
private int calcFu ( ) { } } | if ( normalYakuList . size ( ) == 0 ) { return 0 ; } if ( personalSituation == null || generalSituation == null ) { return 20 ; } // 特例の平和ツモと七対子の符
if ( normalYakuList . contains ( PINFU ) && normalYakuList . contains ( TSUMO ) ) { return 20 ; } if ( normalYakuList . contains ( CHITOITSU ) ) { return 25 ; } int tmpFu = 20 ; // 門前ロンなら + 10
tmpFu += calcFuByAgari ( ) ; // 各メンツの種類による加符
for ( Mentsu mentsu : comp . getAllMentsu ( ) ) { tmpFu += mentsu . getFu ( ) ; } tmpFu += calcFuByWait ( comp , hands . getLast ( ) ) ; tmpFu += calcFuByJanto ( ) ; return tmpFu ; |
import java . util . ArrayList ; import java . util . regex . Matcher ; import java . util . regex . Pattern ; class FindSubstrings { /** * This function is used to identify the occurrences and locations of a substring within a larger text string .
* @ param mainText The larger string that is being scanned for the occurrence of the substring .
* @ param substring The smaller string we are looking for in the mainText .
* @ return Returns a ArrayList containing the substring found , its starting and ending indices . */
public static ArrayList < Object > findSubstrings ( String mainText , String substring ) { } } | Pattern pattern = Pattern . compile ( substring ) ; Matcher matcher = pattern . matcher ( mainText ) ; ArrayList < Object > result = new ArrayList < > ( ) ; while ( matcher . find ( ) ) { result . add ( matcher . group ( ) ) ; result . add ( matcher . start ( ) ) ; result . add ( matcher . end ( ) ) ; } return result ; |
public class CmsSitemapEditorConfiguration { /** * Opens the sitemap editor for the current site . < p > */
void openSitemapEditor ( ) { } } | CmsObject cms = A_CmsUI . getCmsObject ( ) ; String siteRoot = cms . getRequestContext ( ) . getSiteRoot ( ) ; if ( CmsStringUtil . isNotEmptyOrWhitespaceOnly ( siteRoot ) ) { String path = getPath ( cms , A_CmsUI . get ( ) . getHttpSession ( ) ) ; if ( path != null ) { try { CmsAppWorkplaceUi ui = CmsAppWorkplaceUi . get ( ) ; if ( ui . beforeViewChange ( new ViewChangeEvent ( ui . getNavigator ( ) , ui . getCurrentView ( ) , null , APP_ID , null ) ) ) { CmsResource res = cms . readResource ( CmsADEManager . PATH_SITEMAP_EDITOR_JSP ) ; String link = OpenCms . getLinkManager ( ) . substituteLink ( cms , res ) ; A_CmsUI . get ( ) . getPage ( ) . setLocation ( link + "?path=" + path ) ; } return ; } catch ( CmsException e ) { LOG . debug ( "Unable to open sitemap editor." , e ) ; } } } Notification . show ( CmsVaadinUtils . getMessageText ( Messages . GUI_SITEMAP_NOT_AVAILABLE_0 ) , Type . WARNING_MESSAGE ) ; |
public class WritingRepositoryStrategy { /** * Speichert den übergebenen InputStream unter der angegebenen Id . Per
* Definition ist die Id der Hash des InputStreams . Falls unter der
* angegebenen Id also bereits ein Objekt anderer Länge gepeichert ist ,
* schlägt das Speichern fehl .
* @ param id
* Id des Objektes , unter der es abgelegt wird
* @ param inputStream
* des zu speichernden Objektes
* @ throws IOException */
public void storeStream ( String id , InputStream inputStream ) throws IOException { } } | storeStream ( id , inputStream , null ) ; |
public class AvroEvaluatorListSerializer { /** * Build AvroEvaluatorList object . */
@ Override public AvroEvaluatorList toAvro ( final Map < String , EvaluatorDescriptor > evaluatorMap , final int totalEvaluators , final String startTime ) { } } | final List < AvroEvaluatorEntry > evaluatorEntities = new ArrayList < > ( ) ; for ( final Map . Entry < String , EvaluatorDescriptor > entry : evaluatorMap . entrySet ( ) ) { final EvaluatorDescriptor descriptor = entry . getValue ( ) ; evaluatorEntities . add ( AvroEvaluatorEntry . newBuilder ( ) . setId ( entry . getKey ( ) ) . setName ( descriptor . getNodeDescriptor ( ) . getName ( ) ) . build ( ) ) ; } return AvroEvaluatorList . newBuilder ( ) . setEvaluators ( evaluatorEntities ) . setTotal ( totalEvaluators ) . setStartTime ( startTime != null ? startTime : new Date ( ) . toString ( ) ) . build ( ) ; |
public class AbstractWaterBoundarySurfaceType { /** * Gets the value of the genericApplicationPropertyOfWaterBoundarySurface property .
* This accessor method returns a reference to the live list ,
* not a snapshot . Therefore any modification you make to the
* returned list will be present inside the JAXB object .
* This is why there is not a < CODE > set < / CODE > method for the genericApplicationPropertyOfWaterBoundarySurface property .
* For example , to add a new item , do as follows :
* < pre >
* get _ GenericApplicationPropertyOfWaterBoundarySurface ( ) . add ( newItem ) ;
* < / pre >
* Objects of the following type ( s ) are allowed in the list
* { @ link JAXBElement } { @ code < } { @ link Object } { @ code > }
* { @ link JAXBElement } { @ code < } { @ link Object } { @ code > } */
public List < JAXBElement < Object > > get_GenericApplicationPropertyOfWaterBoundarySurface ( ) { } } | if ( _GenericApplicationPropertyOfWaterBoundarySurface == null ) { _GenericApplicationPropertyOfWaterBoundarySurface = new ArrayList < JAXBElement < Object > > ( ) ; } return this . _GenericApplicationPropertyOfWaterBoundarySurface ; |
public class AbstractApkFile { /** * trans binary xml file to text xml file .
* @ param path the xml file path in apk file
* @ return the text . null if file not exists
* @ throws IOException */
public String transBinaryXml ( String path ) throws IOException { } } | byte [ ] data = getFileData ( path ) ; if ( data == null ) { return null ; } parseResourceTable ( ) ; XmlTranslator xmlTranslator = new XmlTranslator ( ) ; transBinaryXml ( data , xmlTranslator ) ; return xmlTranslator . getXml ( ) ; |
public class JsonReader { /** * Consumes the next token from the JSON stream and asserts that it is a
* literal null .
* @ throws IllegalStateException if the next token is not null or if this
* reader is closed . */
public void nextNull ( ) throws IOException { } } | int p = peeked ; if ( p == PEEKED_NONE ) { p = doPeek ( ) ; } if ( p == PEEKED_NULL ) { peeked = PEEKED_NONE ; pathIndices [ stackSize - 1 ] ++ ; } else { throw new IllegalStateException ( "Expected null but was " + peek ( ) + " at line " + getLineNumber ( ) + " column " + getColumnNumber ( ) + " path " + getPath ( ) ) ; } |
public class InfluxDbWriter { /** * Each { @ link Result } is written as a { @ link Point } to InfluxDB
* The measurement for the { @ link Point } is to { @ link Result # getKeyAlias ( ) }
* < a href =
* " https : / / influxdb . com / docs / v0.9 / concepts / key _ concepts . html # retention - policy " >
* The retention policy < / a > for the measurement is set to " default " unless
* overridden in settings :
* The write consistency level defaults to " ALL " unless overridden in
* settings :
* < ul >
* < li > ALL = Write succeeds only if write reached all cluster members . < / li >
* < li > ANY = Write succeeds if write reached any cluster members . < / li >
* < li > ONE = Write succeeds if write reached at least one cluster members .
* < / li >
* < li > QUORUM = Write succeeds only if write reached a quorum of cluster
* members . < / li >
* < / ul >
* The time key for the { @ link Point } is set to { @ link Result # getEpoch ( ) }
* All { @ link Result # getValues ( ) } are written as fields to the { @ link Point }
* The following properties from { @ link Result } are written as tags to the
* { @ link Point } unless overriden in settings :
* < ul >
* < li > { @ link Result # getAttributeName ( ) } < / li >
* < li > { @ link Result # getClassName ( ) } < / li >
* < li > { @ link Result # getObjDomain ( ) } < / li >
* < li > { @ link Result # getTypeName ( ) } < / li >
* < / ul >
* { @ link Server # getHost ( ) } is set as a tag on every { @ link Point }
* { @ link Server # getPort ( ) } is written as a field , unless { @ link # reportJmxPortAsTag } is set to { @ code true } */
@ Override public void doWrite ( Server server , Query query , Iterable < Result > results ) throws Exception { } } | // Creates only if it doesn ' t already exist
if ( createDatabase ) influxDB . createDatabase ( database ) ; BatchPoints . Builder batchPointsBuilder = BatchPoints . database ( database ) . retentionPolicy ( retentionPolicy ) . tag ( TAG_HOSTNAME , server . getSource ( ) ) ; for ( Map . Entry < String , String > tag : tags . entrySet ( ) ) { batchPointsBuilder . tag ( tag . getKey ( ) , tag . getValue ( ) ) ; } BatchPoints batchPoints = batchPointsBuilder . consistency ( writeConsistency ) . build ( ) ; ImmutableList < String > typeNamesParam = null ; // if not typeNamesAsTag , we concat typeName in values .
if ( ! typeNamesAsTags ) { typeNamesParam = this . typeNames ; } for ( Result result : results ) { log . debug ( "Query result: {}" , result ) ; HashMap < String , Object > filteredValues = newHashMap ( ) ; Object value = result . getValue ( ) ; String key = KeyUtils . getPrefixedKeyString ( query , result , typeNamesParam ) ; if ( isValidNumber ( value ) || allowStringValues && value instanceof String ) { filteredValues . put ( key , value ) ; } // send the point if filteredValues isn ' t empty
if ( ! filteredValues . isEmpty ( ) ) { Map < String , String > resultTagsToApply = buildResultTagMap ( result ) ; if ( reportJmxPortAsTag ) { resultTagsToApply . put ( JMX_PORT_KEY , server . getPort ( ) ) ; } else { filteredValues . put ( JMX_PORT_KEY , Integer . parseInt ( server . getPort ( ) ) ) ; } Point point = Point . measurement ( result . getKeyAlias ( ) ) . time ( result . getEpoch ( ) , MILLISECONDS ) . tag ( resultTagsToApply ) . fields ( filteredValues ) . build ( ) ; log . debug ( "Point: {}" , point ) ; batchPoints . point ( point ) ; } } influxDB . write ( batchPoints ) ; |
public class PartitionedStepControllerImpl { /** * Call the analyzerProxy ( if one was supplied ) with the given partition data . */
private void processPartitionReplyMsg ( PartitionReplyMsg msg ) { } } | if ( analyzerProxy == null ) { return ; } switch ( msg . getMsgType ( ) ) { case PARTITION_COLLECTOR_DATA : Serializable collectorData = deserializeCollectorData ( msg . getCollectorData ( ) ) ; logger . finer ( "Analyze collector data: " + collectorData ) ; analyzerProxy . analyzeCollectorData ( collectorData ) ; break ; case PARTITION_FINAL_STATUS : logger . fine ( "Calling analyzeStatus(): " + msg ) ; analyzerProxy . analyzeStatus ( msg . getBatchStatus ( ) , msg . getExitStatus ( ) ) ; break ; } |
public class Fn { public static < T > Collection < T > distinct ( Collection < ? extends T > collection ) { } } | return new HashSet < T > ( collection ) ; |
public class BlockLocation { /** * < code > optional . alluxio . grpc . WorkerNetAddress workerAddress = 2 ; < / code > */
public alluxio . grpc . WorkerNetAddressOrBuilder getWorkerAddressOrBuilder ( ) { } } | return workerAddress_ == null ? alluxio . grpc . WorkerNetAddress . getDefaultInstance ( ) : workerAddress_ ; |
public class Invoker { /** * to invoke a getter Method of a Object
* @ param o Object to invoke method from
* @ param prop Name of the Method without get
* @ return return Value of the getter Method
* @ throws SecurityException
* @ throws NoSuchMethodException
* @ throws IllegalArgumentException
* @ throws IllegalAccessException
* @ throws InvocationTargetException */
public static Object callGetter ( Object o , String prop ) throws SecurityException , NoSuchMethodException , IllegalArgumentException , IllegalAccessException , InvocationTargetException { } } | prop = "get" + prop ; Class c = o . getClass ( ) ; Method m = getMethodParameterPairIgnoreCase ( c , prop , null ) . getMethod ( ) ; // Method m = getMethodIgnoreCase ( c , prop , null ) ;
if ( m . getReturnType ( ) . getName ( ) . equals ( "void" ) ) throw new NoSuchMethodException ( "invalid return Type, method [" + m . getName ( ) + "] can't have return type void" ) ; return m . invoke ( o , null ) ; |
public class RepositoryResourceImpl { /** * { @ inheritDoc } */
@ Override public AttachmentResource getLicense ( Locale loc ) throws RepositoryBackendException , RepositoryResourceException { } } | AttachmentSummary s = matchByLocale ( getAttachmentImpls ( ) , AttachmentType . LICENSE , loc ) ; AttachmentResource result = null ; if ( s instanceof AttachmentResource ) result = ( AttachmentResource ) s ; return result ; |
public class ParticleIO { /** * Load a set of configured emitters into a single system
* @ param ref
* The stream to read the XML from
* @ return A configured particle system
* @ throws IOException
* Indicates a failure to find , read or parse the XML file */
public static ParticleSystem loadConfiguredSystem ( InputStream ref ) throws IOException { } } | return loadConfiguredSystem ( ref , null , null , null ) ; |
public class ListEnabledProductsForImportRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( ListEnabledProductsForImportRequest listEnabledProductsForImportRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( listEnabledProductsForImportRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( listEnabledProductsForImportRequest . getNextToken ( ) , NEXTTOKEN_BINDING ) ; protocolMarshaller . marshall ( listEnabledProductsForImportRequest . getMaxResults ( ) , MAXRESULTS_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class JFXMasonryPane { /** * { @ inheritDoc } */
@ Override protected void layoutChildren ( ) { } } | performingLayout = true ; int col , row ; col = ( int ) Math . floor ( ( getWidth ( ) + getHSpacing ( ) - snappedLeftInset ( ) - snappedRightInset ( ) ) / ( getCellWidth ( ) + getHSpacing ( ) ) ) ; col = getLimitColumn ( ) != - 1 && col > getLimitColumn ( ) ? getLimitColumn ( ) : col ; if ( matrix != null && col == matrix [ 0 ] . length ) { performingLayout = false ; return ; } // ( int ) Math . floor ( this . getHeight ( ) / ( cellH + 2 * vSpacing ) ) ;
row = getLimitRow ( ) ; matrix = new int [ row ] [ col ] ; double minWidth = - 1 ; double minHeight = - 1 ; List < BoundingBox > newBoxes ; List < Region > managedChildren = getManagedChildren ( ) ; // filter Region nodes
for ( int i = 0 ; i < managedChildren . size ( ) ; i ++ ) { if ( ! ( managedChildren . get ( i ) instanceof Region ) ) { managedChildren . remove ( i ) ; i -- ; } } // get bounding boxes layout
newBoxes = layoutMode . get ( ) . fillGrid ( matrix , managedChildren , getCellWidth ( ) , getCellHeight ( ) , row , col , getHSpacing ( ) , getVSpacing ( ) ) ; if ( newBoxes == null ) { performingLayout = false ; return ; } HashMap < Node , BoundingBox > oldBoxes = boundingBoxes ; if ( dirtyBoxes ) { boundingBoxes = new HashMap < > ( ) ; } for ( int i = 0 ; i < managedChildren . size ( ) && i < newBoxes . size ( ) ; i ++ ) { final Region child = managedChildren . get ( i ) ; final BoundingBox boundingBox = newBoxes . get ( i ) ; if ( ! ( child instanceof GridPane ) ) { double blockX ; double blockY ; double blockWidth ; double blockHeight ; if ( boundingBox != null ) { blockX = boundingBox . getMinY ( ) * getCellWidth ( ) + boundingBox . getMinY ( ) * getHSpacing ( ) + snappedLeftInset ( ) ; blockY = boundingBox . getMinX ( ) * getCellHeight ( ) + boundingBox . getMinX ( ) * getVSpacing ( ) + snappedTopInset ( ) ; blockWidth = boundingBox . getWidth ( ) * getCellWidth ( ) + ( boundingBox . getWidth ( ) - 1 ) * getHSpacing ( ) ; blockHeight = boundingBox . getHeight ( ) * getCellHeight ( ) + ( boundingBox . getHeight ( ) - 1 ) * getVSpacing ( ) ; } else { blockX = child . getLayoutX ( ) ; blockY = child . getLayoutY ( ) ; blockWidth = - 1 ; blockHeight = - 1 ; } if ( animationMap == null ) { // init static children
child . setPrefSize ( blockWidth , blockHeight ) ; child . resizeRelocate ( blockX , blockY , blockWidth , blockHeight ) ; } else { BoundingBox oldBoundingBox = oldBoxes . get ( child ) ; if ( oldBoundingBox == null || ( ! oldBoundingBox . equals ( boundingBox ) && dirtyBoxes ) ) { // handle new children
child . setOpacity ( 0 ) ; child . setPrefSize ( blockWidth , blockHeight ) ; child . resizeRelocate ( blockX , blockY , blockWidth , blockHeight ) ; } if ( boundingBox != null ) { // handle children repositioning
if ( child . getWidth ( ) != blockWidth || child . getHeight ( ) != blockHeight ) { child . setOpacity ( 0 ) ; child . setPrefSize ( blockWidth , blockHeight ) ; child . resizeRelocate ( blockX , blockY , blockWidth , blockHeight ) ; } final KeyFrame keyFrame = new KeyFrame ( Duration . millis ( 2000 ) , new KeyValue ( child . opacityProperty ( ) , 1 , Interpolator . LINEAR ) , new KeyValue ( child . layoutXProperty ( ) , blockX , Interpolator . LINEAR ) , new KeyValue ( child . layoutYProperty ( ) , blockY , Interpolator . LINEAR ) ) ; animationMap . put ( child , new CachedTransition ( child , new Timeline ( keyFrame ) ) { { setCycleDuration ( Duration . seconds ( 0.320 ) ) ; setDelay ( Duration . seconds ( 0 ) ) ; setOnFinished ( ( finish ) -> { child . setLayoutX ( blockX ) ; child . setLayoutY ( blockY ) ; child . setOpacity ( 1 ) ; } ) ; } } ) ; } else { // handle children is being hidden ( cause it can ' t fit in the pane )
final KeyFrame keyFrame = new KeyFrame ( Duration . millis ( 2000 ) , new KeyValue ( child . opacityProperty ( ) , 0 , Interpolator . LINEAR ) , new KeyValue ( child . layoutXProperty ( ) , blockX , Interpolator . LINEAR ) , new KeyValue ( child . layoutYProperty ( ) , blockY , Interpolator . LINEAR ) ) ; animationMap . put ( child , new CachedTransition ( child , new Timeline ( keyFrame ) ) { { setCycleDuration ( Duration . seconds ( 0.320 ) ) ; setDelay ( Duration . seconds ( 0 ) ) ; setOnFinished ( ( finish ) -> { child . setLayoutX ( blockX ) ; child . setLayoutY ( blockY ) ; child . setOpacity ( 0 ) ; } ) ; } } ) ; |
public class LanguageProfileReader { /** * Reads a { @ link LanguageProfile } from an InputStream in UTF - 8. */
public LanguageProfile read ( InputStream inputStream ) throws IOException { } } | return OldLangProfileConverter . convert ( internalReader . read ( inputStream ) ) ; |
public class Widget { /** * Get a recursive count of the number of { @ link Widget } children of this
* { @ code Widget } .
* @ param includeHidden
* Pass { @ code false } to only count children whose
* { @ link # setVisibility ( Visibility ) visibility } is
* { @ link Visibility # VISIBLE } .
* @ return The count of child { @ code Widgets } . */
public int getChildCount ( boolean includeHidden ) { } } | int count = 0 ; for ( Widget child : getChildren ( ) ) { if ( includeHidden || child . mVisibility == Visibility . VISIBLE ) { ++ count ; count += child . getChildCount ( includeHidden ) ; } } return count ; |
public class IPAddressSeqRange { /** * Subtracts the given range from this range , to produce either zero , one , or two address ranges that contain the addresses in this range and not in the given range .
* If the result has length 2 , the two ranges are in increasing order .
* @ param other
* @ return */
public IPAddressSeqRange [ ] subtract ( IPAddressSeqRange other ) { } } | IPAddress otherLower = other . getLower ( ) ; IPAddress otherUpper = other . getUpper ( ) ; IPAddress lower = this . getLower ( ) ; IPAddress upper = this . getUpper ( ) ; if ( compareLowValues ( lower , otherLower ) < 0 ) { if ( compareLowValues ( upper , otherUpper ) > 0 ) { // l ol ou u
return createPair ( lower , otherLower . increment ( - 1 ) , otherUpper . increment ( 1 ) , upper ) ; } else { int comp = compareLowValues ( upper , otherLower ) ; if ( comp < 0 ) { // l u ol ou
return createSingle ( ) ; } else if ( comp == 0 ) { // l u = = ol ou
return createSingle ( lower , upper . increment ( - 1 ) ) ; } return createSingle ( lower , otherLower . increment ( - 1 ) ) ; // l ol u ou
} } else if ( compareLowValues ( otherUpper , upper ) >= 0 ) { // ol l u ou
return createEmpty ( ) ; } else { int comp = compareLowValues ( otherUpper , lower ) ; if ( comp < 0 ) { return createSingle ( ) ; // ol ou l u
} else if ( comp == 0 ) { return createSingle ( lower . increment ( 1 ) , upper ) ; // ol ou = = l u
} return createSingle ( otherUpper . increment ( 1 ) , upper ) ; // ol l ou u
} |
public class AnnotationMethodInterceptor { /** * Returns true if the specified object represents an annotation that is logically equivalent to this one .
* @ param object Object to inspect .
* @ return true if same annnotationType and all attributes are equal , else false . */
private boolean annotationEquals ( Object object ) { } } | if ( object == null || ! ( object instanceof Annotation ) || ! annotationType . equals ( ( ( Annotation ) object ) . annotationType ( ) ) ) { return false ; } for ( Map . Entry < String , Method > entry : attributes . entrySet ( ) ) { String methodName = entry . getKey ( ) ; Method method = entry . getValue ( ) ; Object otherValue ; try { otherValue = method . invoke ( object ) ; Object value = attributeData . get ( methodName ) ; if ( ! attributeEquals ( value , otherValue ) ) { return false ; } } catch ( Exception e ) { return false ; } } return true ; |
public class JdbcEndpointAdapterController { /** * Executes a given query and returns the mapped result
* @ param query The query to execute
* @ return The DataSet containing the query result
* @ throws JdbcServerException In case that the query was not successful */
@ Override public DataSet executeQuery ( String query ) throws JdbcServerException { } } | log . info ( "Received execute query request: " + query ) ; Message response = handleMessageAndCheckResponse ( JdbcMessage . execute ( query ) ) ; return dataSetCreator . createDataSet ( response , getMessageType ( response ) ) ; |
public class RecommendationsInner { /** * Disable all recommendations for an app .
* Disable all recommendations for an app .
* @ param resourceGroupName Name of the resource group to which the resource belongs .
* @ param siteName Name of the app .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ throws CloudException thrown if the request is rejected by server
* @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent */
public void disableAllForWebApp ( String resourceGroupName , String siteName ) { } } | disableAllForWebAppWithServiceResponseAsync ( resourceGroupName , siteName ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class AppServicePlansInner { /** * Creates or updates an App Service Plan .
* Creates or updates an App Service Plan .
* @ param resourceGroupName Name of the resource group to which the resource belongs .
* @ param name Name of the App Service plan .
* @ param appServicePlan Details of the App Service plan .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ throws CloudException thrown if the request is rejected by server
* @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @ return the AppServicePlanInner object if successful . */
public AppServicePlanInner createOrUpdate ( String resourceGroupName , String name , AppServicePlanInner appServicePlan ) { } } | return createOrUpdateWithServiceResponseAsync ( resourceGroupName , name , appServicePlan ) . toBlocking ( ) . last ( ) . body ( ) ; |
public class Val { /** * Converts the object to a map
* @ param < K > the type parameter
* @ param < V > the type parameter
* @ param keyClass The key class
* @ param valueClass The value class
* @ return the object as a map */
public < K , V > Map < K , V > asMap ( Class < K > keyClass , Class < V > valueClass ) { } } | return asMap ( HashMap . class , keyClass , valueClass ) ; |
public class ProxyFactory { /** * Returns a reference to a { @ link ProxyFactory } service provider implementation provided by Elements that delegates
* all proxy operations to any / all application configured { @ link ProxyFactory } service provider implementations .
* @ param < T > { @ link Class } type of the { @ link Object } to proxy .
* @ return a reference to the Elements - defined { @ link ProxyFactory } service provider implementation .
* @ see org . cp . elements . lang . reflect . ProxyFactory
* @ see org . cp . elements . lang . reflect . ProxyService */
protected static < T > ProxyFactory < T > newProxyFactory ( ) { } } | return new ProxyFactory < T > ( ) { @ Override public boolean canProxy ( Object target , Class [ ] proxyInterfaces ) { return ProxyService . < T > newProxyService ( ) . canProxy ( target , proxyInterfaces ) ; } @ Override @ SuppressWarnings ( "unchecked" ) public < R > R newProxy ( ClassLoader proxyClassLoader , T target , Class < ? > [ ] proxyInterfaces , Iterable < MethodInterceptor < T > > methodInterceptors ) { return ( R ) stream ( newProxyService ( ) ) . filter ( proxyFactory -> proxyFactory . canProxy ( getTarget ( ) , getProxyInterfaces ( ) ) ) . findFirst ( ) . flatMap ( proxyFactory -> Optional . of ( proxyFactory . < R > newProxy ( getProxyClassLoader ( ) , getTarget ( ) , getProxyInterfaces ( ) , getMethodInterceptors ( ) ) ) ) . orElse ( getTarget ( ) ) ; } } ; |
public class DescribePointSurf { /** * Compute SURF descriptor , but without laplacian sign
* @ param x Location of interest point .
* @ param y Location of interest point .
* @ param angle The angle the feature is pointing at in radians .
* @ param scale Scale of the interest point . Null is returned if the feature goes outside the image border .
* @ param ret storage for the feature . Must have 64 values . */
public void describe ( double x , double y , double angle , double scale , TupleDesc_F64 ret ) { } } | double c = Math . cos ( angle ) , s = Math . sin ( angle ) ; // By assuming that the entire feature is inside the image faster algorithms can be used
// the results are also of dubious value when interacting with the image border .
boolean isInBounds = SurfDescribeOps . isInside ( ii , x , y , radiusDescriptor , widthSample , scale , c , s ) ; // declare the feature if needed
if ( ret == null ) ret = new BrightFeature ( featureDOF ) ; else if ( ret . value . length != featureDOF ) throw new IllegalArgumentException ( "Provided feature must have " + featureDOF + " values" ) ; gradient . setImage ( ii ) ; gradient . setWidth ( widthSample * scale ) ; // use a safe method if its along the image border
SparseImageGradient gradient = isInBounds ? this . gradient : this . gradientSafe ; // extract descriptor
features ( x , y , c , s , scale , gradient , ret . value ) ; |
public class MultiLayerConfiguration { /** * Handle { @ link WeightInit } and { @ link Distribution } from legacy configs in Json format . Copied from handling of { @ link Activation }
* above .
* @ return True if all is well and layer iteration shall continue . False else - wise . */
private static boolean handleLegacyWeightInitFromJson ( String json , Layer l , ObjectMapper mapper , JsonNode confs , int layerCount ) { } } | if ( ( l instanceof BaseLayer ) && ( ( BaseLayer ) l ) . getWeightInitFn ( ) == null ) { try { JsonNode jsonNode = mapper . readTree ( json ) ; if ( confs == null ) { confs = jsonNode . get ( "confs" ) ; } if ( confs instanceof ArrayNode ) { ArrayNode layerConfs = ( ArrayNode ) confs ; JsonNode outputLayerNNCNode = layerConfs . get ( layerCount ) ; if ( outputLayerNNCNode == null ) return false ; // Should never happen . . .
JsonNode layerWrapperNode = outputLayerNNCNode . get ( "layer" ) ; if ( layerWrapperNode == null || layerWrapperNode . size ( ) != 1 ) { return true ; } JsonNode layerNode = layerWrapperNode . elements ( ) . next ( ) ; JsonNode weightInit = layerNode . get ( "weightInit" ) ; // Should only have 1 element : " dense " , " output " , etc
JsonNode distribution = layerNode . get ( "dist" ) ; Distribution dist = null ; if ( distribution != null ) { dist = mapper . treeToValue ( distribution , Distribution . class ) ; } if ( weightInit != null ) { final IWeightInit wi = WeightInit . valueOf ( weightInit . asText ( ) ) . getWeightInitFunction ( dist ) ; ( ( BaseLayer ) l ) . setWeightInitFn ( wi ) ; } } } catch ( IOException e ) { log . warn ( "Layer with null WeightInit detected: " + l . getLayerName ( ) + ", could not parse JSON" , e ) ; } } return true ; |
public class JSchema { /** * Resolve a case name to a case index
* @ param accessor the accessor of a JSVariant in the schema in whose scope the case
* name is to be resolved
* @ param name the case name to be resolved
* @ return the case index associated with the name or - 1 if either the accessor does not
* refer to a JSVariant in this schema or the name doesn ' t name one of its cases */
public int getCaseIndex ( int accessor , String name ) { } } | JMFFieldDef field = getFieldDef ( accessor ) ; if ( ! ( field instanceof JSVariant ) ) return - 1 ; JMFType target = findVariantChildByName ( ( JSVariant ) field , name ) ; if ( target != null ) return getEffectiveSiblingPosition ( target ) ; else return - 1 ; |
public class TECore { /** * Builds a DOM Document representing a classpath resource .
* @ param name
* The name of an XML resource .
* @ return A Document node , or { @ code null } if the resource cannot be parsed
* for any reason . */
public Document findXMLResource ( String name ) { } } | URL url = this . getClass ( ) . getResource ( name ) ; DocumentBuilderFactory docFactory = DocumentBuilderFactory . newInstance ( ) ; docFactory . setNamespaceAware ( true ) ; // Fortify Mod : Disable entity expansion to foil External Entity Injections
docFactory . setExpandEntityReferences ( false ) ; Document doc = null ; try { DocumentBuilder docBuilder = docFactory . newDocumentBuilder ( ) ; doc = docBuilder . parse ( url . toURI ( ) . toString ( ) ) ; } catch ( Exception e ) { LOGR . log ( Level . WARNING , "Failed to parse classpath resource " + name , e ) ; } return doc ; |
public class EncoderFeatureIndex { /** * 读取训练文件中的标注集
* @ param filename
* @ return */
private boolean openTagSet ( String filename ) { } } | int max_size = 0 ; InputStreamReader isr = null ; y_ . clear ( ) ; try { isr = new InputStreamReader ( IOUtil . newInputStream ( filename ) , "UTF-8" ) ; BufferedReader br = new BufferedReader ( isr ) ; String line ; while ( ( line = br . readLine ( ) ) != null ) { if ( line . length ( ) == 0 ) { continue ; } char firstChar = line . charAt ( 0 ) ; if ( firstChar == '\0' || firstChar == ' ' || firstChar == '\t' ) { continue ; } String [ ] cols = line . split ( "[\t ]" , - 1 ) ; if ( max_size == 0 ) { max_size = cols . length ; } if ( max_size != cols . length ) { String msg = "inconsistent column size: " + max_size + " " + cols . length + " " + filename ; throw new RuntimeException ( msg ) ; } xsize_ = cols . length - 1 ; if ( y_ . indexOf ( cols [ max_size - 1 ] ) == - 1 ) { y_ . add ( cols [ max_size - 1 ] ) ; } } Collections . sort ( y_ ) ; br . close ( ) ; } catch ( Exception e ) { if ( isr != null ) { try { isr . close ( ) ; } catch ( Exception e2 ) { } } e . printStackTrace ( ) ; System . err . println ( "Error reading " + filename ) ; return false ; } return true ; |
public class SocketChannelSelectionProcessorActor { private void close ( final SocketChannel channel , final SelectionKey key ) { } } | try { channel . close ( ) ; } catch ( Exception e ) { // already closed ; ignore
} try { key . cancel ( ) ; } catch ( Exception e ) { // already cancelled / closed ; ignore
} |
public class CmsSecurityManager { /** * Changes the " release " date of a resource . < p >
* @ param context the current request context
* @ param resource the resource to touch
* @ param dateReleased the new release date of the changed resource
* @ throws CmsException if something goes wrong
* @ throws CmsSecurityException if the user has insufficient permission for the given resource ( write access permission is required )
* @ see CmsObject # setDateReleased ( String , long , boolean )
* @ see org . opencms . file . types . I _ CmsResourceType # setDateReleased ( CmsObject , CmsSecurityManager , CmsResource , long , boolean ) */
public void setDateReleased ( CmsRequestContext context , CmsResource resource , long dateReleased ) throws CmsException , CmsSecurityException { } } | CmsDbContext dbc = m_dbContextFactory . getDbContext ( context ) ; try { checkOfflineProject ( dbc ) ; checkPermissions ( dbc , resource , CmsPermissionSet . ACCESS_WRITE , true , CmsResourceFilter . IGNORE_EXPIRATION ) ; m_driverManager . setDateReleased ( dbc , resource , dateReleased ) ; } catch ( Exception e ) { dbc . report ( null , Messages . get ( ) . container ( Messages . ERR_SET_DATE_RELEASED_2 , new Object [ ] { new Date ( dateReleased ) , context . getSitePath ( resource ) } ) , e ) ; } finally { dbc . clear ( ) ; } |
public class Ifc4PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public EEnum getIfcBenchmarkEnum ( ) { } } | if ( ifcBenchmarkEnumEEnum == null ) { ifcBenchmarkEnumEEnum = ( EEnum ) EPackage . Registry . INSTANCE . getEPackage ( Ifc4Package . eNS_URI ) . getEClassifiers ( ) . get ( 921 ) ; } return ifcBenchmarkEnumEEnum ; |
public class FileSystemView { /** * Gets the regular file at the given path , creating it if it doesn ' t exist and the given options
* specify that it should be created . */
public RegularFile getOrCreateRegularFile ( JimfsPath path , Set < OpenOption > options , FileAttribute < ? > ... attrs ) throws IOException { } } | checkNotNull ( path ) ; if ( ! options . contains ( CREATE_NEW ) ) { // assume file exists unless we ' re explicitly trying to create a new file
RegularFile file = lookUpRegularFile ( path , options ) ; if ( file != null ) { return file ; } } if ( options . contains ( CREATE ) || options . contains ( CREATE_NEW ) ) { return getOrCreateRegularFileWithWriteLock ( path , options , attrs ) ; } else { throw new NoSuchFileException ( path . toString ( ) ) ; } |
public class ReplicationDestinationConfig { /** * Sets the storage class for the replication destination . If not specified ,
* Amazon S3 uses the storage class of the source object to create object replica . */
public void setStorageClass ( StorageClass storageClass ) { } } | setStorageClass ( storageClass == null ? ( String ) null : storageClass . toString ( ) ) ; |
public class IfcSurfaceReinforcementAreaImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ SuppressWarnings ( "unchecked" ) @ Override public EList < Double > getSurfaceReinforcement2 ( ) { } } | return ( EList < Double > ) eGet ( Ifc4Package . Literals . IFC_SURFACE_REINFORCEMENT_AREA__SURFACE_REINFORCEMENT2 , true ) ; |
public class ClassUtils { /** * 返回给定对象的封装类型或自身类型 . < br >
* 如果给定对象是基本数据类型 , 则返回其封装类型 。 < br >
* 如果给定对象为 null 则返回 null . Returns given object wrapper class or self class . < br >
* if given object class is primitive class then return wrapper class . < br >
* if given object is null return null .
* @ param object 任意对象 。 any object .
* @ return 给定对象的封装类型 。 given object ' s wrapper class . */
public static Class < ? > getWrapperClass ( final Object object ) { } } | if ( object == null ) { return null ; } return getWrapperClass ( object . getClass ( ) ) ; |
public class ExtractionUtil { /** * Extracts the contents of an archive into the specified directory .
* @ param archive an archive file such as a WAR or EAR
* @ param destination a directory to extract the contents to
* @ param filter determines which files get extracted
* @ throws ExtractionException thrown if the archive is not found */
public static void extractFilesUsingFilter ( File archive , File destination , FilenameFilter filter ) throws ExtractionException { } } | if ( archive == null || destination == null ) { return ; } try ( FileInputStream fis = new FileInputStream ( archive ) ) { extractArchive ( new ZipArchiveInputStream ( new BufferedInputStream ( fis ) ) , destination , filter ) ; } catch ( FileNotFoundException ex ) { final String msg = String . format ( "Error extracting file `%s` with filter: %s" , archive . getAbsolutePath ( ) , ex . getMessage ( ) ) ; LOGGER . debug ( msg , ex ) ; throw new ExtractionException ( msg ) ; } catch ( IOException | ArchiveExtractionException ex ) { LOGGER . warn ( "Exception extracting archive '{}'." , archive . getAbsolutePath ( ) ) ; LOGGER . debug ( "" , ex ) ; throw new ExtractionException ( "Unable to extract from archive" , ex ) ; } |
public class JmxUtilities { /** * Attempt to connect to a remote < code > MBeanServer < / code > . Fails if no
* < code > MBeanServer < / code > connection can be established . */
public static MBeanServerConnection connectMBeanServer ( String server ) throws MBeanServerException { } } | String url = "service:jmx:rmi://localhost/jndi/rmi://" + server + "/jmxrmi" ; try { JMXServiceURL jmxUrl = new JMXServiceURL ( url ) ; JMXConnector jmxConnector = JMXConnectorFactory . connect ( jmxUrl ) ; return jmxConnector . getMBeanServerConnection ( ) ; } catch ( MalformedURLException e ) { throw new MBeanServerException ( "Problem with JMXServiceURL based on " + url + ": " + e . getMessage ( ) ) ; } catch ( IOException e ) { throw new MBeanServerException ( "Failed to connect to JMX server: " + server + ": " + e . getMessage ( ) ) ; } |
public class JmsFactoryFactoryImpl { /** * For use by the JCA resource adaptor . */
@ Override public ConnectionFactory createConnectionFactory ( JmsJcaConnectionFactory jcaConnectionFactory ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "createConnectionFactory" , jcaConnectionFactory ) ; ConnectionFactory cf = new JmsManagedConnectionFactoryImpl ( jcaConnectionFactory ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "createConnectionFactory" , cf ) ; return cf ; |
public class ToolbarLarge { /** * Obtains the color of the toolbar ' s background from a specific typed array .
* @ param theme
* The resource id of the theme , which should be applied on the toolbar , as an { @ link
* Integer } value */
private void obtainBackgroundColor ( final int theme ) { } } | TypedArray typedArray = getContext ( ) . getTheme ( ) . obtainStyledAttributes ( theme , new int [ ] { R . attr . colorPrimary } ) ; int colorPrimary = typedArray . getColor ( 0 , 0 ) ; typedArray . recycle ( ) ; if ( colorPrimary != 0 ) { backgroundView . setBackgroundColor ( colorPrimary ) ; } |
public class MethodInvokerRewriter { /** * method useful when debugging */
@ SuppressWarnings ( "unused" ) private static void checkNotTheSame ( byte [ ] bs , byte [ ] bytes ) { } } | if ( bs . length == bytes . length ) { System . out . println ( "same length!" ) ; boolean same = true ; for ( int i = 0 ; i < bs . length ; i ++ ) { if ( bs [ i ] != bytes [ i ] ) { same = false ; break ; } } if ( same ) { System . out . println ( "same data!!" ) ; } else { System . out . println ( "diff data" ) ; } } else { System . out . println ( "different" ) ; } |
public class AbstractOptionsForSelect { /** * Add the given async listener on the { @ link com . datastax . driver . core . Row } object .
* Example of usage :
* < pre class = " code " > < code class = " java " >
* . withRowAsyncListener ( row - > {
* / / Do something with the row object here
* < / code > < / pre >
* Remark : < strong > You can inspect and read values from the row object < / strong > */
public T withRowAsyncListener ( Function < Row , Row > rowAsyncListener ) { } } | getOptions ( ) . setRowAsyncListeners ( Optional . of ( asList ( rowAsyncListener ) ) ) ; return getThis ( ) ; |
public class BasicDDF { /** * Override to snapshot our List < ? > into a local variable for serialization */
@ Override public void beforeSerialization ( ) throws DDFException { } } | super . beforeSerialization ( ) ; mData = this . getList ( mUnitType ) ; mUnitTypeName = ( mUnitType != null ? mUnitType . getName ( ) : null ) ; |
public class WalkerState { /** * Seeks to the given day within the current month
* @ param dayOfMonth the day of the month to seek to , represented as an integer
* from 1 to 31 . Must be guaranteed to parse as an Integer . If this day is
* beyond the last day of the current month , the actual last day of the month
* will be used . */
public void seekToDayOfMonth ( String dayOfMonth ) { } } | int dayOfMonthInt = Integer . parseInt ( dayOfMonth ) ; assert ( dayOfMonthInt >= 1 && dayOfMonthInt <= 31 ) ; markDateInvocation ( ) ; dayOfMonthInt = Math . min ( dayOfMonthInt , _calendar . getActualMaximum ( Calendar . DAY_OF_MONTH ) ) ; _calendar . set ( Calendar . DAY_OF_MONTH , dayOfMonthInt ) ; |
public class SpecStringParser { /** * Method that recursively parses a dotNotation String based on an iterator .
* This method will call out to parseAtPathElement
* @ param pathStrings List to store parsed Strings that each represent a PathElement
* @ param iter the iterator to pull characters from
* @ param dotNotationRef the original dotNotation string used for error messages
* @ return evaluated List < String > from dot notation string spec */
public static List < String > parseDotNotation ( List < String > pathStrings , Iterator < Character > iter , String dotNotationRef ) { } } | if ( ! iter . hasNext ( ) ) { return pathStrings ; } // Leave the forward slashes , unless it precedes a " . "
// The way this works is always suppress the forward slashes , but add them back in if the next char is not a " . "
boolean prevIsEscape = false ; boolean currIsEscape = false ; StringBuilder sb = new StringBuilder ( ) ; char c ; while ( iter . hasNext ( ) ) { c = iter . next ( ) ; currIsEscape = false ; if ( c == '\\' && ! prevIsEscape ) { // current is Escape only if the char is escape , or
// it is an Escape and the prior char was , then don ' t consider this one an escape
currIsEscape = true ; } if ( prevIsEscape && c != '.' && c != '\\' ) { sb . append ( '\\' ) ; sb . append ( c ) ; } else if ( c == '@' ) { sb . append ( '@' ) ; sb . append ( parseAtPathElement ( iter , dotNotationRef ) ) ; // there was a " [ " seen but no " ] "
boolean isPartOfArray = sb . indexOf ( "[" ) != - 1 && sb . indexOf ( "]" ) == - 1 ; if ( ! isPartOfArray ) { pathStrings . add ( sb . toString ( ) ) ; sb = new StringBuilder ( ) ; } } else if ( c == '.' ) { if ( prevIsEscape ) { sb . append ( '.' ) ; } else { if ( sb . length ( ) != 0 ) { pathStrings . add ( sb . toString ( ) ) ; } return parseDotNotation ( pathStrings , iter , dotNotationRef ) ; } } else if ( ! currIsEscape ) { sb . append ( c ) ; } prevIsEscape = currIsEscape ; } if ( sb . length ( ) != 0 ) { pathStrings . add ( sb . toString ( ) ) ; } return pathStrings ; |
public class SarlDocumentationParser { /** * Do a post processing of the text .
* @ param text the text to post process .
* @ return the post - processed text . */
protected String postProcessing ( CharSequence text ) { } } | final String lineContinuation = getLineContinuation ( ) ; if ( lineContinuation != null ) { final Pattern pattern = Pattern . compile ( "\\s*\\\\[\\n\\r]+\\s*" , // $ NON - NLS - 1 $
Pattern . DOTALL ) ; final Matcher matcher = pattern . matcher ( text . toString ( ) . trim ( ) ) ; return matcher . replaceAll ( lineContinuation ) ; } return text . toString ( ) . trim ( ) ; |
public class Collectors { /** * Returns a { @ code Collector } that performs flat - mapping before accumulation .
* @ param < T > the type of the input elements
* @ param < U > the result type of flat - mapping function
* @ param < A > the accumulation type
* @ param < R > the result type of collector
* @ param mapper a function that performs flat - mapping to input elements
* @ param downstream the collector of flat - mapped elements
* @ return a { @ code Collector }
* @ since 1.1.3 */
@ NotNull public static < T , U , A , R > Collector < T , ? , R > flatMapping ( @ NotNull final Function < ? super T , ? extends Stream < ? extends U > > mapper , @ NotNull final Collector < ? super U , A , R > downstream ) { } } | final BiConsumer < A , ? super U > accumulator = downstream . accumulator ( ) ; return new CollectorsImpl < T , A , R > ( downstream . supplier ( ) , new BiConsumer < A , T > ( ) { @ Override public void accept ( final A a , T t ) { final Stream < ? extends U > stream = mapper . apply ( t ) ; if ( stream == null ) return ; stream . forEach ( new Consumer < U > ( ) { @ Override public void accept ( U u ) { accumulator . accept ( a , u ) ; } } ) ; } } , downstream . finisher ( ) ) ; |
public class ChmodParser { /** * Apply permission against specified file and determine what the
* new mode would be
* @ param file File against which to apply mode
* @ return File ' s new mode if applied . */
public short applyNewPermission ( FileStatus file ) { } } | FsPermission perms = file . getPermission ( ) ; int existing = perms . toShort ( ) ; boolean exeOk = file . isDir ( ) || ( existing & 0111 ) != 0 ; return ( short ) combineModes ( existing , exeOk ) ; |
public class DaggerService { /** * Caller is required to know the type of the component for this context . */
@ SuppressWarnings ( "unchecked" ) public static < T > T getDaggerComponent ( Context context ) { } } | // noinspection ResourceType
return ( T ) context . getSystemService ( SERVICE_NAME ) ; |
public class CFMLExpressionInterpreter { /** * private FunctionLibFunction getFLF ( String name ) { FunctionLibFunction flf = null ; for ( int i = 0 ; i
* < flds . length ; i + + ) { flf = flds [ i ] . getFunction ( name ) ; if ( flf ! = null ) break ; } return flf ; } */
protected Object interpretPart ( PageContext pc , ParserString cfml ) throws PageException { } } | this . cfml = cfml ; init ( pc ) ; cfml . removeSpace ( ) ; return assignOp ( ) . getValue ( pc ) ; |
public class engines { /** * Create a new { @ link Engine } for solving the { @ link Knapsack } problem . The
* engine is used for testing purpose .
* @ see Knapsack # of ( int , Random )
* @ param populationSize the population size of the created engine
* @ param random the random engine used for creating the { @ link Knapsack }
* problem instance
* @ return a new { @ link Knapsack } solving evolution { @ link Engine } */
public static Engine < BitGene , Double > knapsack ( final int populationSize , final Random random ) { } } | // Search space fo 2 ^ 250 ~ 10 ^ 75.
final Knapsack knapsack = Knapsack . of ( 250 , random ) ; // Configure and build the evolution engine .
return Engine . builder ( knapsack ) . populationSize ( populationSize ) . survivorsSelector ( new TournamentSelector < > ( 5 ) ) . offspringSelector ( new RouletteWheelSelector < > ( ) ) . alterers ( new Mutator < > ( 0.03 ) , new SinglePointCrossover < > ( 0.125 ) ) . build ( ) ; |
public class IndexSerializer { /** * Querying */
public List < Object > query ( final JointIndexQuery . Subquery query , final BackendTransaction tx ) { } } | IndexType index = query . getIndex ( ) ; if ( index . isCompositeIndex ( ) ) { MultiKeySliceQuery sq = query . getCompositeQuery ( ) ; List < EntryList > rs = sq . execute ( tx ) ; List < Object > results = new ArrayList < Object > ( rs . get ( 0 ) . size ( ) ) ; for ( EntryList r : rs ) { for ( java . util . Iterator < Entry > iterator = r . reuseIterator ( ) ; iterator . hasNext ( ) ; ) { Entry entry = iterator . next ( ) ; ReadBuffer entryValue = entry . asReadBuffer ( ) ; entryValue . movePositionTo ( entry . getValuePosition ( ) ) ; switch ( index . getElement ( ) ) { case VERTEX : results . add ( VariableLong . readPositive ( entryValue ) ) ; break ; default : results . add ( bytebuffer2RelationId ( entryValue ) ) ; } } } return results ; } else { List < String > r = tx . indexQuery ( ( ( MixedIndexType ) index ) . getBackingIndexName ( ) , query . getMixedQuery ( ) ) ; List < Object > result = new ArrayList < Object > ( r . size ( ) ) ; for ( String id : r ) result . add ( string2ElementId ( id ) ) ; return result ; } } public MultiKeySliceQuery getQuery ( final CompositeIndexType index , List < Object [ ] > values ) { List < KeySliceQuery > ksqs = new ArrayList < KeySliceQuery > ( values . size ( ) ) ; for ( Object [ ] value : values ) { ksqs . add ( new KeySliceQuery ( getIndexKey ( index , value ) , BufferUtil . zeroBuffer ( 1 ) , BufferUtil . oneBuffer ( 1 ) ) ) ; } return new MultiKeySliceQuery ( ksqs ) ; } public IndexQuery getQuery ( final MixedIndexType index , final Condition condition , final OrderList orders ) { Condition newCondition = ConditionUtil . literalTransformation ( condition , new Function < Condition < TitanElement > , Condition < TitanElement > > ( ) { @ Nullable @ Override public Condition < TitanElement > apply ( @ Nullable Condition < TitanElement > condition ) { Preconditions . checkArgument ( condition instanceof PredicateCondition ) ; PredicateCondition pc = ( PredicateCondition ) condition ; PropertyKey key = ( PropertyKey ) pc . getKey ( ) ; return new PredicateCondition < String , TitanElement > ( key2Field ( index , key ) , pc . getPredicate ( ) , pc . getValue ( ) ) ; } } ) ; ImmutableList < IndexQuery . OrderEntry > newOrders = IndexQuery . NO_ORDER ; if ( ! orders . isEmpty ( ) && GraphCentricQueryBuilder . indexCoversOrder ( index , orders ) ) { ImmutableList . Builder < IndexQuery . OrderEntry > lb = ImmutableList . builder ( ) ; for ( int i = 0 ; i < orders . size ( ) ; i ++ ) { lb . add ( new IndexQuery . OrderEntry ( key2Field ( index , orders . getKey ( i ) ) , orders . getOrder ( i ) , orders . getKey ( i ) . dataType ( ) ) ) ; } newOrders = lb . build ( ) ; } return new IndexQuery ( index . getStoreName ( ) , newCondition , newOrders ) ; } // public IndexQuery getQuery ( String index , final ElementCategory resultType , final Condition condition , final OrderList orders ) {
// if ( isStandardIndex ( index ) ) {
// Preconditions . checkArgument ( orders . isEmpty ( ) ) ;
// return new IndexQuery ( getStoreName ( resultType ) , condition , IndexQuery . NO _ ORDER ) ;
// } else {
// Condition newCondition = ConditionUtil . literalTransformation ( condition ,
// new Function < Condition < TitanElement > , Condition < TitanElement > > ( ) {
// @ Nullable
// @ Override
// public Condition < TitanElement > apply ( @ Nullable Condition < TitanElement > condition ) {
// Preconditions . checkArgument ( condition instanceof PredicateCondition ) ;
// PredicateCondition pc = ( PredicateCondition ) condition ;
// TitanKey key = ( TitanKey ) pc . getKey ( ) ;
// return new PredicateCondition < String , TitanElement > ( key2Field ( key ) , pc . getPredicate ( ) , pc . getValue ( ) ) ;
// ImmutableList < IndexQuery . OrderEntry > newOrders = IndexQuery . NO _ ORDER ;
// if ( ! orders . isEmpty ( ) ) {
// ImmutableList . Builder < IndexQuery . OrderEntry > lb = ImmutableList . builder ( ) ;
// for ( int i = 0 ; i < orders . size ( ) ; i + + ) {
// lb . add ( new IndexQuery . OrderEntry ( key2Field ( orders . getKey ( i ) ) , orders . getOrder ( i ) , orders . getKey ( i ) . getDataType ( ) ) ) ;
// newOrders = lb . build ( ) ;
// return new IndexQuery ( getStoreName ( resultType ) , newCondition , newOrders ) ;
public Iterable < RawQuery . Result > executeQuery ( IndexQueryBuilder query , final ElementCategory resultType , final BackendTransaction backendTx , final StandardTitanTx transaction ) { MixedIndexType index = getMixedIndex ( query . getIndex ( ) , transaction ) ; Preconditions . checkArgument ( index . getElement ( ) == resultType , "Index is not configured for the desired result type: %s" , resultType ) ; String backingIndexName = index . getBackingIndexName ( ) ; IndexProvider indexInformation = ( IndexProvider ) mixedIndexes . get ( backingIndexName ) ; StringBuffer qB = new StringBuffer ( query . getQuery ( ) ) ; final String prefix = query . getPrefix ( ) ; Preconditions . checkNotNull ( prefix ) ; // Convert query string by replacing
int replacements = 0 ; int pos = 0 ; while ( pos < qB . length ( ) ) { pos = qB . indexOf ( prefix , pos ) ; if ( pos < 0 ) break ; int startPos = pos ; pos += prefix . length ( ) ; StringBuilder keyBuilder = new StringBuilder ( ) ; boolean quoteTerminated = qB . charAt ( pos ) == '"' ; if ( quoteTerminated ) pos ++ ; while ( pos < qB . length ( ) && ( Character . isLetterOrDigit ( qB . charAt ( pos ) ) || ( quoteTerminated && qB . charAt ( pos ) != '"' ) || qB . charAt ( pos ) == '*' ) ) { keyBuilder . append ( qB . charAt ( pos ) ) ; pos ++ ; } if ( quoteTerminated ) pos ++ ; int endPos = pos ; String keyname = keyBuilder . toString ( ) ; Preconditions . checkArgument ( StringUtils . isNotBlank ( keyname ) , "Found reference to empty key at position [%s]" , startPos ) ; String replacement ; if ( keyname . equals ( "*" ) ) { replacement = indexInformation . getFeatures ( ) . getWildcardField ( ) ; } else if ( transaction . containsRelationType ( keyname ) ) { PropertyKey key = transaction . getPropertyKey ( keyname ) ; Preconditions . checkNotNull ( key ) ; Preconditions . checkArgument ( index . indexesKey ( key ) , "The used key [%s] is not indexed in the targeted index [%s]" , key . name ( ) , query . getIndex ( ) ) ; replacement = key2Field ( index , key ) ; } else { Preconditions . checkArgument ( query . getUnknownKeyName ( ) != null , "Found reference to non-existant property key in query at position [%s]: %s" , startPos , keyname ) ; replacement = query . getUnknownKeyName ( ) ; } Preconditions . checkArgument ( StringUtils . isNotBlank ( replacement ) ) ; qB . replace ( startPos , endPos , replacement ) ; pos = startPos + replacement . length ( ) ; replacements ++ ; } String queryStr = qB . toString ( ) ; if ( replacements <= 0 ) log . warn ( "Could not convert given {} index query: [{}]" , resultType , query . getQuery ( ) ) ; log . info ( "Converted query string with {} replacements: [{}] => [{}]" , replacements , query . getQuery ( ) , queryStr ) ; RawQuery rawQuery = new RawQuery ( index . getStoreName ( ) , queryStr , query . getParameters ( ) ) ; if ( query . hasLimit ( ) ) rawQuery . setLimit ( query . getLimit ( ) ) ; rawQuery . setOffset ( query . getOffset ( ) ) ; return Iterables . transform ( backendTx . rawQuery ( index . getBackingIndexName ( ) , rawQuery ) , new Function < RawQuery . Result < String > , RawQuery . Result > ( ) { @ Nullable @ Override public RawQuery . Result apply ( @ Nullable RawQuery . Result < String > result ) { return new RawQuery . Result ( string2ElementId ( result . getResult ( ) ) , result . getScore ( ) ) ; } } ) ; } /* Utility Functions */
private static final MixedIndexType getMixedIndex ( String indexName , StandardTitanTx transaction ) { IndexType index = ManagementSystem . getGraphIndexDirect ( indexName , transaction ) ; Preconditions . checkArgument ( index != null , "Index with name [%s] is unknown or not configured properly" , indexName ) ; Preconditions . checkArgument ( index . isMixedIndex ( ) ) ; return ( MixedIndexType ) index ; } private static final String element2String ( TitanElement element ) { return element2String ( element . id ( ) ) ; } private static final String element2String ( Object elementId ) { Preconditions . checkArgument ( elementId instanceof Long || elementId instanceof RelationIdentifier ) ; if ( elementId instanceof Long ) return longID2Name ( ( Long ) elementId ) ; else return ( ( RelationIdentifier ) elementId ) . toString ( ) ; } private static final Object string2ElementId ( String str ) { if ( str . contains ( RelationIdentifier . TOSTRING_DELIMITER ) ) return RelationIdentifier . parse ( str ) ; else return name2LongID ( str ) ; } private static final String key2Field ( MixedIndexType index , PropertyKey key ) { return key2Field ( index . getField ( key ) ) ; } private static final String key2Field ( ParameterIndexField field ) { assert field != null ; return ParameterType . MAPPED_NAME . findParameter ( field . getParameters ( ) , keyID2Name ( field . getFieldKey ( ) ) ) ; } private static final String keyID2Name ( PropertyKey key ) { return longID2Name ( key . longId ( ) ) ; } private static final String longID2Name ( long id ) { Preconditions . checkArgument ( id > 0 ) ; return LongEncoding . encode ( id ) ; } private static final long name2LongID ( String name ) { return LongEncoding . decode ( name ) ; } private final StaticBuffer getIndexKey ( CompositeIndexType index , RecordEntry [ ] record ) { return getIndexKey ( index , IndexRecords . getValues ( record ) ) ; } private final StaticBuffer getIndexKey ( CompositeIndexType index , Object [ ] values ) { DataOutput out = serializer . getDataOutput ( 8 * DEFAULT_OBJECT_BYTELEN + 8 ) ; VariableLong . writePositive ( out , index . getID ( ) ) ; IndexField [ ] fields = index . getFieldKeys ( ) ; Preconditions . checkArgument ( fields . length > 0 && fields . length == values . length ) ; for ( int i = 0 ; i < fields . length ; i ++ ) { IndexField f = fields [ i ] ; Object value = values [ i ] ; Preconditions . checkNotNull ( value ) ; if ( AttributeUtil . hasGenericDataType ( f . getFieldKey ( ) ) ) { out . writeClassAndObject ( value ) ; } else { assert value . getClass ( ) . equals ( f . getFieldKey ( ) . dataType ( ) ) : value . getClass ( ) + " - " + f . getFieldKey ( ) . dataType ( ) ; out . writeObjectNotNull ( value ) ; } } StaticBuffer key = out . getStaticBuffer ( ) ; if ( hashKeys ) key = HashingUtil . hashPrefixKey ( hashLength , key ) ; return key ; } public long getIndexIdFromKey ( StaticBuffer key ) { if ( hashKeys ) key = HashingUtil . getKey ( hashLength , key ) ; return VariableLong . readPositive ( key . asReadBuffer ( ) ) ; } private final Entry getIndexEntry ( CompositeIndexType index , RecordEntry [ ] record , TitanElement element ) { DataOutput out = serializer . getDataOutput ( 1 + 8 + 8 * record . length + 4 * 8 ) ; out . putByte ( FIRST_INDEX_COLUMN_BYTE ) ; if ( index . getCardinality ( ) != Cardinality . SINGLE ) { VariableLong . writePositive ( out , element . longId ( ) ) ; if ( index . getCardinality ( ) != Cardinality . SET ) { for ( RecordEntry re : record ) { VariableLong . writePositive ( out , re . relationId ) ; } } } int valuePosition = out . getPosition ( ) ; if ( element instanceof TitanVertex ) { VariableLong . writePositive ( out , element . longId ( ) ) ; } else { assert element instanceof TitanRelation ; RelationIdentifier rid = ( RelationIdentifier ) element . id ( ) ; long [ ] longs = rid . getLongRepresentation ( ) ; Preconditions . checkArgument ( longs . length == 3 || longs . length == 4 ) ; for ( int i = 0 ; i < longs . length ; i ++ ) VariableLong . writePositive ( out , longs [ i ] ) ; } return new StaticArrayEntry ( out . getStaticBuffer ( ) , valuePosition ) ; } private static final RelationIdentifier bytebuffer2RelationId ( ReadBuffer b ) { long [ ] relationId = new long [ 4 ] ; for ( int i = 0 ; i < 3 ; i ++ ) relationId [ i ] = VariableLong . readPositive ( b ) ; if ( b . hasRemaining ( ) ) relationId [ 3 ] = VariableLong . readPositive ( b ) ; else relationId = Arrays . copyOfRange ( relationId , 0 , 3 ) ; return RelationIdentifier . get ( relationId ) ; } |
public class HelpView { /** * Duplicates JavaHelp topic tree into HelpTopicNode - based tree .
* @ param htnParent Current parent for HelpTopicNode - based tree .
* @ param ttnParent Current parent for JavaHelp TreeNode - based tree . */
private void initTopicTree ( HelpTopicNode htnParent , TreeNode ttnParent ) { } } | for ( int i = 0 ; i < ttnParent . getChildCount ( ) ; i ++ ) { TreeNode ttnChild = ttnParent . getChildAt ( i ) ; HelpTopic ht = getTopic ( ttnChild ) ; HelpTopicNode htnChild = new HelpTopicNode ( ht ) ; htnParent . addChild ( htnChild ) ; initTopicTree ( htnChild , ttnChild ) ; } |
public class AbstractDependencyFilenameStrategy { /** * { @ inheritDoc } */
public String getDependencyFileVersion ( Artifact artifact , Boolean useUniqueVersions ) { } } | if ( useUniqueVersions != null && useUniqueVersions ) { return UniqueVersionsHelper . getUniqueVersion ( artifact ) ; } return artifact . getVersion ( ) ; |
public class WSStatsHelper { /** * This method allows translation of the textual information .
* By default translation is enabled using the default Locale .
* @ param textInfoTranslationEnabled enable / disable
* @ param locale Locale to use for translation */
public static void setTextInfoTranslationEnabled ( boolean textInfoTranslationEnabled , Locale locale ) { } } | com . ibm . ws . pmi . stat . StatsImpl . setEnableNLS ( textInfoTranslationEnabled , locale ) ; |
public class ModelsImpl { /** * Update an entity role for a given entity .
* @ param appId The application ID .
* @ param versionId The version ID .
* @ param entityId The entity ID .
* @ param roleId The entity role ID .
* @ param updatePrebuiltEntityRoleOptionalParameter the object representing the optional parameters to be set before calling this API
* @ param serviceCallback the async ServiceCallback to handle successful and failed responses .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the { @ link ServiceFuture } object */
public ServiceFuture < OperationStatus > updatePrebuiltEntityRoleAsync ( UUID appId , String versionId , UUID entityId , UUID roleId , UpdatePrebuiltEntityRoleOptionalParameter updatePrebuiltEntityRoleOptionalParameter , final ServiceCallback < OperationStatus > serviceCallback ) { } } | return ServiceFuture . fromResponse ( updatePrebuiltEntityRoleWithServiceResponseAsync ( appId , versionId , entityId , roleId , updatePrebuiltEntityRoleOptionalParameter ) , serviceCallback ) ; |
public class OptionsMethodProcessor { /** * { @ inheritDoc } */
@ Override public ResourceModel processResourceModel ( ResourceModel resourceModel , Configuration configuration ) { } } | return ModelProcessorUtil . enhanceResourceModel ( resourceModel , false , methodList , true ) . build ( ) ; |
public class ExpressionsParser { /** * P14
* Not all of the listed operators are actually legal , but if not legal , then they are at least imaginable , so we parse them and flag them as errors in the AST phase .
* @ see < a href = " http : / / java . sun . com / docs / books / jls / third _ edition / html / lexical . html # 15.26 " > JLS section 15.26 < / a > */
Rule assignmentExpressionChaining ( ) { } } | return Sequence ( inlineIfExpressionChaining ( ) , set ( ) , Optional ( Sequence ( assignmentOperator ( ) . label ( "operator" ) , group . basics . optWS ( ) , assignmentExpressionChaining ( ) . label ( "RHS" ) ) ) . label ( "assignment" ) , set ( actions . createAssignmentExpression ( value ( ) , text ( "assignment/Sequence/operator" ) , value ( "assignment" ) ) ) ) ; |
public class DateUtil { /** * 2016-11-10 07:33:23 , 则返回2016-12-1 00:00:00 */
public static Date nextMonth ( @ NotNull final Date date ) { } } | return DateUtils . ceiling ( date , Calendar . MONTH ) ; |
public class UpdateLayerRequest { /** * A < code > VolumeConfigurations < / code > object that describes the layer ' s Amazon EBS volumes .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setVolumeConfigurations ( java . util . Collection ) } or { @ link # withVolumeConfigurations ( java . util . Collection ) }
* if you want to override the existing values .
* @ param volumeConfigurations
* A < code > VolumeConfigurations < / code > object that describes the layer ' s Amazon EBS volumes .
* @ return Returns a reference to this object so that method calls can be chained together . */
public UpdateLayerRequest withVolumeConfigurations ( VolumeConfiguration ... volumeConfigurations ) { } } | if ( this . volumeConfigurations == null ) { setVolumeConfigurations ( new com . amazonaws . internal . SdkInternalList < VolumeConfiguration > ( volumeConfigurations . length ) ) ; } for ( VolumeConfiguration ele : volumeConfigurations ) { this . volumeConfigurations . add ( ele ) ; } return this ; |
public class ProfileCsmConfigurationProvider { /** * ProfilesConfigFile immediately loads the profiles at construction time */
private ProfilesConfigFile getProfilesConfigFile ( ) { } } | if ( configFile == null ) { synchronized ( this ) { if ( configFile == null ) { try { configFile = new ProfilesConfigFile ( configFileLocationProvider . getLocation ( ) ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to load config file" , e ) ; } } } } return configFile ; |
public class WRadioButtonRenderer { /** * Paints the given WRadioButton .
* @ param component the WRadioButton to paint .
* @ param renderContext the RenderContext to paint to . */
@ Override public void doRender ( final WComponent component , final WebXmlRenderContext renderContext ) { } } | WRadioButton button = ( WRadioButton ) component ; XmlStringBuilder xml = renderContext . getWriter ( ) ; boolean readOnly = button . isReadOnly ( ) ; String value = button . getValue ( ) ; xml . appendTagOpen ( "ui:radiobutton" ) ; xml . appendAttribute ( "id" , component . getId ( ) ) ; xml . appendOptionalAttribute ( "class" , component . getHtmlClass ( ) ) ; xml . appendOptionalAttribute ( "track" , component . isTracking ( ) , "true" ) ; xml . appendOptionalAttribute ( "hidden" , button . isHidden ( ) , "true" ) ; xml . appendAttribute ( "groupName" , button . getGroupName ( ) ) ; xml . appendAttribute ( "value" , WebUtilities . encode ( value ) ) ; if ( readOnly ) { xml . appendAttribute ( "readOnly" , "true" ) ; } else { xml . appendOptionalAttribute ( "disabled" , button . isDisabled ( ) , "true" ) ; xml . appendOptionalAttribute ( "required" , button . isMandatory ( ) , "true" ) ; xml . appendOptionalAttribute ( "submitOnChange" , button . isSubmitOnChange ( ) , "true" ) ; xml . appendOptionalAttribute ( "toolTip" , button . getToolTip ( ) ) ; xml . appendOptionalAttribute ( "accessibleText" , button . getAccessibleText ( ) ) ; // Check for null option ( ie null or empty ) . Match isEmpty ( ) logic .
boolean isNull = value == null ? true : ( value . length ( ) == 0 ) ; xml . appendOptionalAttribute ( "isNull" , isNull , "true" ) ; } xml . appendOptionalAttribute ( "selected" , button . isSelected ( ) , "true" ) ; xml . appendEnd ( ) ; |
public class TinylogLogger { /** * Returns a throwable if the last argument is one .
* @ param arguments
* Passed arguments
* @ return Last argument as throwable or { @ code null } */
private static Throwable extractThrowable ( final Object [ ] arguments ) { } } | return arguments . length == 0 ? null : extractThrowable ( arguments [ arguments . length - 1 ] ) ; |
public class Arguments { /** * Return the value of a binding ( e . g . " value " for " - name = value " ) and the
* empty string " " for an option ( " - name " or " - name = " ) . A null value is
* returned if no binding or option is found .
* @ param name string name of the option or binding */
public String getValue ( String name ) { } } | for ( Entry e : commandLineArgs ) if ( name . equals ( e . name ) ) return e . val ; return System . getProperty ( "h2o.arg." + name ) ; |
public class AfplibFactoryImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public String convertColorSpecificationColSpceToString ( EDataType eDataType , Object instanceValue ) { } } | return instanceValue == null ? null : instanceValue . toString ( ) ; |
public class NodeUtil { /** * Finds the number of times a type is referenced within the node tree . */
static int getNodeTypeReferenceCount ( Node node , Token type , Predicate < Node > traverseChildrenPred ) { } } | return getCount ( node , new MatchNodeType ( type ) , traverseChildrenPred ) ; |
public class RelationalJMapper { /** * This method initializes relational maps starting from XML .
* @ param xmlPath xml path
* @ throws MalformedURLException
* @ throws IOException */
private void init ( String xmlPath ) throws MalformedURLException , IOException { } } | XML xml = new XML ( true , xmlPath ) ; if ( ! xml . isInheritedMapped ( configuredClass ) ) Error . classNotMapped ( configuredClass ) ; for ( Class < ? > classe : getClasses ( xml ) ) { relationalManyToOneMapper . put ( classe . getName ( ) , new JMapper ( configuredClass , classe , ChooseConfig . DESTINATION , xmlPath ) ) ; relationalOneToManyMapper . put ( classe . getName ( ) , new JMapper ( classe , configuredClass , ChooseConfig . SOURCE , xmlPath ) ) ; } |
public class CompleteRestoreTaskParameters { /** * Parses properties from task parameter string
* @ param taskParameters - JSON formatted set of parameters */
public static CompleteRestoreTaskParameters deserialize ( String taskParameters ) { } } | JaxbJsonSerializer < CompleteRestoreTaskParameters > serializer = new JaxbJsonSerializer < > ( CompleteRestoreTaskParameters . class ) ; try { CompleteRestoreTaskParameters params = serializer . deserialize ( taskParameters ) ; // Verify expected parameters
if ( null == params . getSpaceId ( ) || params . getSpaceId ( ) . isEmpty ( ) ) { throw new SnapshotDataException ( "Task parameter values may not be empty" ) ; } if ( params . getDaysToExpire ( ) < 0 ) { throw new SnapshotDataException ( "Task parameter value must be a positive integer" ) ; } return params ; } catch ( IOException e ) { throw new SnapshotDataException ( "Unable to parse task parameters due to: " + e . getMessage ( ) ) ; } |
public class RedisUtil { /** * 将有序集的元素转成String , 保存到集合中 .
* @ param set
* @ return */
public static Set < String > tupleToString ( Set < Tuple > set ) { } } | Set < String > result = new LinkedHashSet < String > ( ) ; for ( Tuple tuple : set ) { String element = tuple . getElement ( ) ; result . add ( element ) ; } return result ; |
public class ModelMetricsHandler { /** * Delete one or more ModelMetrics . */
@ SuppressWarnings ( "unused" ) // called through reflection by RequestServer
public ModelMetricsListSchemaV3 delete ( int version , ModelMetricsListSchemaV3 s ) { } } | ModelMetricsList m = s . createAndFillImpl ( ) ; s . fillFromImpl ( m . delete ( ) ) ; return s ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.