idx
int64
0
165k
question
stringlengths
73
4.15k
target
stringlengths
5
918
len_question
int64
21
890
len_target
int64
3
255
7,800
public ApiResponse < GetEnabledResponse > getEnabledWithHttpInfo ( ) throws ApiException { com . squareup . okhttp . Call call = getEnabledValidateBeforeCall ( null , null ) ; Type localVarReturnType = new TypeToken < GetEnabledResponse > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ; }
Get SAML state . Returns SAML current state .
83
11
7,801
public ApiResponse < GetLocationResponse > getLocationsWithHttpInfo ( ) throws ApiException { com . squareup . okhttp . Call call = getLocationsValidateBeforeCall ( null , null ) ; Type localVarReturnType = new TypeToken < GetLocationResponse > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ; }
Get exist locations . Returns exist locations .
85
8
7,802
public ApiResponse < PostLocationResponse > postLocationWithHttpInfo ( ) throws ApiException { com . squareup . okhttp . Call call = postLocationValidateBeforeCall ( null , null ) ; Type localVarReturnType = new TypeToken < PostLocationResponse > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ; }
Set main settings . Change global settings .
83
8
7,803
public ApiResponse < GetSubResponse > checkMigrateConflictsWithHttpInfo ( ) throws ApiException { com . squareup . okhttp . Call call = checkMigrateConflictsValidateBeforeCall ( null , null ) ; Type localVarReturnType = new TypeToken < GetSubResponse > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ; }
Get migrate check for conflicts . Get migrate check for conflicts
89
11
7,804
public ApiResponse < CheckPostMigrateStatistic > checkPostMigrateStatisticWithHttpInfo ( ) throws ApiException { com . squareup . okhttp . Call call = checkPostMigrateStatisticValidateBeforeCall ( null , null ) ; Type localVarReturnType = new TypeToken < CheckPostMigrateStatistic > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ; }
Post statistic migrate . Post statistic migrate
97
7
7,805
public ApiResponse < GetExportStatisticDefinitions > getExportStatisticDefinitionsWithHttpInfo ( ) throws ApiException { com . squareup . okhttp . Call call = getExportStatisticDefinitionsValidateBeforeCall ( null , null ) ; Type localVarReturnType = new TypeToken < GetExportStatisticDefinitions > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ; }
Get export statistic definitions . Get export statistic definitions
97
9
7,806
public ApiResponse < GetStatisticDefinitionsResponse > getStatisticDefinitionsWithHttpInfo ( ) throws ApiException { com . squareup . okhttp . Call call = getStatisticDefinitionsValidateBeforeCall ( null , null ) ; Type localVarReturnType = new TypeToken < GetStatisticDefinitionsResponse > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ; }
Get statistic definitions . Returns statistic definitions records .
95
9
7,807
public ApiResponse < PostImportStatisticDefinitions > postImportStatisticDefinitionsWithHttpInfo ( ) throws ApiException { com . squareup . okhttp . Call call = postImportStatisticDefinitionsValidateBeforeCall ( null , null ) ; Type localVarReturnType = new TypeToken < PostImportStatisticDefinitions > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ; }
Post import statistic definitions . Post import statistic definitions
97
9
7,808
public ApiResponse < GetStatisticDefinitionsResponse > postStatisticDefinitionsWithHttpInfo ( ) throws ApiException { com . squareup . okhttp . Call call = postStatisticDefinitionsValidateBeforeCall ( null , null ) ; Type localVarReturnType = new TypeToken < GetStatisticDefinitionsResponse > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ; }
Post statistic definitions . Returns statistic definitions records .
95
9
7,809
public static QueueConfiguration customGame ( boolean force , String gameId , int team ) { return new CustomGameQueueConfiguration ( force , gameId , team ) ; }
Joins custom game .
35
5
7,810
public static PortletApplicationContext getPortletApplicationContext ( PortletRequest request , PortletContext portletContext ) throws IllegalStateException { PortletApplicationContext portletApplicationContext = ( PortletApplicationContext ) request . getAttribute ( ContribDispatcherPortlet . PORTLET_APPLICATION_CONTEXT_ATTRIBUTE ) ; if ( portletApplicationContext == null ) { if ( portletContext == null ) { throw new IllegalStateException ( "No PortletApplicationContext found: not in a DispatcherPortlet request?" ) ; } portletApplicationContext = PortletApplicationContextUtils2 . getRequiredPortletApplicationContext ( portletContext ) ; } return portletApplicationContext ; }
Look for the PortletApplicationContext associated with the DispatcherPortlet that has initiated request processing and for the global context if none was found associated with the current request . This method is useful to allow components outside the framework such as JSP tag handlers to access the most specific application context available .
153
60
7,811
public static ApplicationContext getWebApplicationContext ( PortletRequest request , PortletContext portletContext ) throws IllegalStateException { PortletApplicationContext portletApplicationContext = ( PortletApplicationContext ) request . getAttribute ( ContribDispatcherPortlet . PORTLET_APPLICATION_CONTEXT_ATTRIBUTE ) ; if ( portletApplicationContext != null ) { return portletApplicationContext ; } if ( portletContext == null ) { throw new IllegalStateException ( "No PortletApplicationContext found: not in a DispatcherPortlet request?" ) ; } portletApplicationContext = PortletApplicationContextUtils2 . getPortletApplicationContext ( portletContext ) ; if ( portletApplicationContext != null ) { return portletApplicationContext ; } return PortletApplicationContextUtils . getRequiredWebApplicationContext ( portletContext ) ; }
Look for the PortletApplicationContext associated with the DispatcherPortlet that has initiated request processing for the global portlet context if none was found associated with the current request and for the global context if no global portlet context was found . This method is useful to allow components outside the framework such as JSP tag handlers to access the most specific application context available .
185
74
7,812
public void initializeWithCode ( String authCode , String redirectUri ) throws ProvisioningApiException { initialize ( null , authCode , redirectUri ) ; }
Initialize the API with an code from the auth service .
35
12
7,813
public UpdatableGameState update ( GameUpdateApiResponse gameUpdateData ) { return new UpdatableGameState ( gameUpdateData . getTurn ( ) , startData , MapPatcher . patch ( gameUpdateData . getMapDiff ( ) , rawMapArray ) , MapPatcher . patch ( gameUpdateData . getCitiesDiff ( ) , rawCitiesArray ) , gameUpdateData . getGenerals ( ) , createPlayersInfo ( startData , gameUpdateData ) , gameUpdateData . getAttackIndex ( ) ) ; }
Updates game state from previous turn with new information received from server . The method only works fine if updates are applied in sequence as server is only sending map differences in update messages .
116
36
7,814
public ApiResponse < GetMOHFilesResponse > getMOHFilesWithHttpInfo ( ) throws ApiException { com . squareup . okhttp . Call call = getMOHFilesValidateBeforeCall ( null , null ) ; Type localVarReturnType = new TypeToken < GetMOHFilesResponse > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ; }
Get WAV files for MOH . Returns exist WAV files .
91
14
7,815
public ApiResponse < GetMOHSettings > getMOHSettingsWithHttpInfo ( ) throws ApiException { com . squareup . okhttp . Call call = getMOHSettingsValidateBeforeCall ( null , null ) ; Type localVarReturnType = new TypeToken < GetMOHSettings > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ; }
Get exist setting . Returns exist setting from MOH .
89
11
7,816
public ApiResponse < PostCheckInactivity > checkInactivityWithHttpInfo ( ) throws ApiException { com . squareup . okhttp . Call call = checkInactivityValidateBeforeCall ( null , null ) ; Type localVarReturnType = new TypeToken < PostCheckInactivity > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ; }
Inactivity . Inactivity .
87
6
7,817
public ApiResponse < GetSubResponse > getSubWithHttpInfo ( ) throws ApiException { com . squareup . okhttp . Call call = getSubValidateBeforeCall ( null , null ) ; Type localVarReturnType = new TypeToken < GetSubResponse > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ; }
Get sub . Sub
83
4
7,818
public ApiResponse < PostImportResponse > postImportWithHttpInfo ( ) throws ApiException { com . squareup . okhttp . Call call = postImportValidateBeforeCall ( null , null ) ; Type localVarReturnType = new TypeToken < PostImportResponse > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ; }
PostImport . postImport
83
5
7,819
public ApiResponse < PostUsers > postUsersWithHttpInfo ( ) throws ApiException { com . squareup . okhttp . Call call = postUsersValidateBeforeCall ( null , null ) ; Type localVarReturnType = new TypeToken < PostUsers > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ; }
Post users . postUsers
81
5
7,820
public ApiResponse < PostValidateImportResponse > postValidateImportWithHttpInfo ( ) throws ApiException { com . squareup . okhttp . Call call = postValidateImportValidateBeforeCall ( null , null ) ; Type localVarReturnType = new TypeToken < PostValidateImportResponse > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ; }
Post Validate Import . post validate import
91
8
7,821
public ApiResponse < PutUsers > putUsersWithHttpInfo ( ) throws ApiException { com . squareup . okhttp . Call call = putUsersValidateBeforeCall ( null , null ) ; Type localVarReturnType = new TypeToken < PutUsers > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ; }
Put users . putUsers
81
5
7,822
protected Class < ? > determineContextClass ( PortletContext portletContext ) { String contextClassName = portletContext . getInitParameter ( CONTEXT_CLASS_PARAM ) ; if ( contextClassName != null ) { try { return ClassUtils . forName ( contextClassName , ClassUtils . getDefaultClassLoader ( ) ) ; } catch ( ClassNotFoundException ex ) { throw new ApplicationContextException ( "Failed to load custom context class [" + contextClassName + "]" , ex ) ; } } else { contextClassName = defaultStrategies . getProperty ( PortletApplicationContext . class . getName ( ) ) ; try { return ClassUtils . forName ( contextClassName , PortletContextLoader . class . getClassLoader ( ) ) ; } catch ( ClassNotFoundException ex ) { throw new ApplicationContextException ( "Failed to load default context class [" + contextClassName + "]" , ex ) ; } } }
Return the PortletApplicationContext implementation class to use either the default XmlPortletApplicationContext or a custom context class if specified .
206
27
7,823
public ApiResponse < GetArgsResponse > argsWithHttpInfo ( ) throws ApiException { com . squareup . okhttp . Call call = argsValidateBeforeCall ( null , null ) ; Type localVarReturnType = new TypeToken < GetArgsResponse > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ; }
Get provisioning arguments . Returns some of provisioning variables .
81
12
7,824
public ApiResponse < DynconfigGetConfigResponse > dynconfigGetConfigWithHttpInfo ( ) throws ApiException { com . squareup . okhttp . Call call = dynconfigGetConfigValidateBeforeCall ( null , null ) ; Type localVarReturnType = new TypeToken < DynconfigGetConfigResponse > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ; }
Get config . json file . Returns config . json file .
91
12
7,825
public ApiResponse < GetConfigResponse > getConfigWithHttpInfo ( ) throws ApiException { com . squareup . okhttp . Call call = getConfigValidateBeforeCall ( null , null ) ; Type localVarReturnType = new TypeToken < GetConfigResponse > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ; }
Get analytics config . Returns exist config .
83
8
7,826
public void deleteUser ( String userDBID , Boolean keepPlaces ) throws ProvisioningApiException { try { ApiSuccessResponse resp = usersApi . deleteUser ( userDBID , keepPlaces ) ; if ( ! resp . getStatus ( ) . getCode ( ) . equals ( 0 ) ) { throw new ProvisioningApiException ( "Error deleting user. Code: " + resp . getStatus ( ) . getCode ( ) ) ; } } catch ( ApiException e ) { throw new ProvisioningApiException ( "Error deleting user" , e ) ; } }
Deletes a user with the given DBID .
126
10
7,827
public void updateUser ( String userDBID , User user ) throws ProvisioningApiException { try { ApiSuccessResponse resp = usersApi . updateUser ( userDBID , new UpdateUserData ( ) . data ( Converters . convertUserToUpdateUserDataData ( user ) ) ) ; if ( ! resp . getStatus ( ) . getCode ( ) . equals ( 0 ) ) { throw new ProvisioningApiException ( "Error updating user. Code: " + resp . getStatus ( ) . getCode ( ) ) ; } } catch ( ApiException e ) { throw new ProvisioningApiException ( "Error updating user" , e ) ; } }
Updates the attributes of a user with the given DBID .
144
13
7,828
public Results < DnGroup > searchDnGroups ( SearchParams searchParams ) throws ProvisioningApiException { return searchDnGroups ( searchParams . getLimit ( ) , searchParams . getOffset ( ) , searchParams . getSearchTerm ( ) , searchParams . getSearchKey ( ) , searchParams . getMatchMethod ( ) , searchParams . getSortKey ( ) , searchParams . getSortAscending ( ) , searchParams . getSortMethod ( ) ) ; }
Get Dn groups . Get Dn groups from Configuration Server with the specified filters .
116
17
7,829
public ApiResponse < GetInboundResponse > getInboundSettingsWithHttpInfo ( ) throws ApiException { com . squareup . okhttp . Call call = getInboundSettingsValidateBeforeCall ( null , null ) ; Type localVarReturnType = new TypeToken < GetInboundResponse > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ; }
Get inbound settings . Returns inbound settings .
89
10
7,830
public ApiResponse < GetOutboundResponse > getOutboundSettingsWithHttpInfo ( ) throws ApiException { com . squareup . okhttp . Call call = getOutboundSettingsValidateBeforeCall ( null , null ) ; Type localVarReturnType = new TypeToken < GetOutboundResponse > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ; }
Get outbound settings . Returns outbound settings .
89
10
7,831
private static Element lookupId ( List < Element > fields ) { Element objectIdField = null ; Element uuidField = null ; Element _idField = null ; Element idField = null ; for ( Element field : fields ) { if ( field . getAnnotation ( Id . class ) != null ) { return field ; } if ( isObjectId ( field ) ) { objectIdField = field ; } else if ( isUUID ( field ) ) { uuidField = field ; } else if ( field . getSimpleName ( ) . contentEquals ( ID_FIELD_NAME ) ) { _idField = field ; } else if ( field . getSimpleName ( ) . contentEquals ( "id" ) ) { idField = field ; } } if ( objectIdField != null ) { return objectIdField ; } if ( uuidField != null ) { return uuidField ; } if ( _idField != null ) { return _idField ; } if ( idField != null ) { return idField ; } return null ; }
Find a field with the
223
5
7,832
public User getUser ( String fieldName , String fieldValue ) { Select q = new Select ( ) . from ( User . class ) ; String nameColumn = ModelReflector . instance ( User . class ) . getColumnDescriptor ( fieldName ) . getName ( ) ; q . where ( new Expression ( q . getPool ( ) , nameColumn , Operator . EQ , new BindVariable ( q . getPool ( ) , fieldValue ) ) ) ; List < ? extends User > users = q . execute ( User . class ) ; if ( users . size ( ) == 1 ) { return users . get ( 0 ) ; } return null ; }
Can be cast to any user model class as the proxy implements all the user classes .
139
17
7,833
@ Override public Response intercept ( Chain chain ) throws IOException { Request request = chain . request ( ) ; request = request . newBuilder ( ) . addHeader ( TRACEID_HEADER , makeUniqueId ( ) ) . addHeader ( SPANID_HEADER , makeUniqueId ( ) ) . build ( ) ; return chain . proceed ( request ) ; }
64 - bit ids
79
5
7,834
public ApiResponse < GetAuditResponse > getAuditWithHttpInfo ( ) throws ApiException { com . squareup . okhttp . Call call = getAuditValidateBeforeCall ( null , null ) ; Type localVarReturnType = new TypeToken < GetAuditResponse > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ; }
Get audit records . Returns audit records .
87
8
7,835
public Options getOptions ( String personDBID , String agentGroupDBID ) throws ProvisioningApiException { try { OptionsGetResponseSuccess resp = optionsApi . optionsGet ( personDBID , agentGroupDBID ) ; if ( ! resp . getStatus ( ) . getCode ( ) . equals ( 0 ) ) { throw new ProvisioningApiException ( "Error getting options. Code: " + resp . getStatus ( ) . getCode ( ) ) ; } Options out = new Options ( ) ; out . setOptions ( ( Map < String , Object > ) resp . getData ( ) . getOptions ( ) ) ; out . setCmeAppName ( resp . getData ( ) . getCmeAppName ( ) ) ; out . setCmeAppDBID ( resp . getData ( ) . getCmeAppDBID ( ) ) ; return out ; } catch ( ApiException e ) { throw new ProvisioningApiException ( "Error getting options" , e ) ; } }
Get options . Get options for a specified application and merge them with the person and agent group annexes .
215
21
7,836
public void modifyOptions ( Map < String , Object > options ) throws ProvisioningApiException { try { OptionsPostResponseStatusSuccess resp = optionsApi . optionsPost ( new OptionsPost ( ) . data ( new OptionsPostData ( ) . options ( options ) ) ) ; if ( ! resp . getStatus ( ) . getCode ( ) . equals ( 0 ) ) { throw new ProvisioningApiException ( "Error modifying options. Code: " + resp . getStatus ( ) . getCode ( ) ) ; } } catch ( ApiException e ) { throw new ProvisioningApiException ( "Error modifying options" , e ) ; } }
Modify options . Replace the existing application options with the specified new values .
138
15
7,837
public void updateOptions ( Map < String , Object > newOptions , Map < String , Object > changedOptions , Map < String , Object > deletedOptions ) throws ProvisioningApiException { try { OptionsPutResponseStatusSuccess resp = optionsApi . optionsPut ( new OptionsPut ( ) . data ( new OptionsPutData ( ) . newOptions ( newOptions ) . changedOptions ( changedOptions ) . deletedOptions ( deletedOptions ) ) ) ; if ( ! resp . getStatus ( ) . getCode ( ) . equals ( 0 ) ) { throw new ProvisioningApiException ( "Error updating options. Code: " + resp . getStatus ( ) . getCode ( ) ) ; } } catch ( ApiException e ) { throw new ProvisioningApiException ( "Error updating options" , e ) ; } }
Add edit or delete options values . Add edit or delete option values for the specified application .
173
18
7,838
private final EvalResult doDefine ( List < SExpression > subexpressions , Environment environment , ParametricBfgBuilder builder , EvalContext context ) { int nameToBind = subexpressions . get ( 1 ) . getConstantIndex ( ) ; if ( subexpressions . size ( ) == 3 ) { // (define name value-expression) // Binds a name to the value of value-expression Object valueToBind = eval ( subexpressions . get ( 2 ) , environment , builder , context ) . getValue ( ) ; environment . bindName ( nameToBind , valueToBind ) ; } else if ( subexpressions . size ( ) >= 4 ) { // (define procedure-name (arg1 ...) procedure-body) // syntactic sugar equivalent to (define procedure-name (lambda (arg1 ...) procedure-body AmbLambdaValue lambdaValue = makeLambda ( subexpressions . get ( 2 ) , subexpressions . subList ( 3 , subexpressions . size ( ) ) , environment ) ; environment . bindName ( nameToBind , lambdaValue ) ; } return new EvalResult ( ConstantValue . UNDEFINED ) ; }
Evaluates the define special form .
252
8
7,839
public static String password ( int length ) { StringBuilder result = new StringBuilder ( ) ; byte [ ] values = byteArray ( length ) ; // We use a modulus of an increasing index rather than of the byte values // to avoid certain characters coming up more often. int index = 0 ; for ( int i = 0 ; i < length ; i ++ ) { index += ( values [ i ] & 0xff ) ; index = index % passwordCharacters . length ( ) ; result . append ( passwordCharacters . charAt ( index ) ) ; } return result . toString ( ) ; }
Generates a random password .
123
6
7,840
public CcgSyntaxTree getSyntacticParse ( ) { HeadedSyntacticCategory originalSyntax = null ; if ( unaryRule != null ) { originalSyntax = unaryRule . getUnaryRule ( ) . getInputSyntacticCategory ( ) . getCanonicalForm ( ) ; } else { originalSyntax = syntax ; } if ( isTerminal ( ) ) { return CcgSyntaxTree . createTerminal ( syntax . getSyntax ( ) , originalSyntax . getSyntax ( ) , spanStart , spanEnd , words , posTags , originalSyntax ) ; } else { CcgSyntaxTree leftTree = left . getSyntacticParse ( ) ; CcgSyntaxTree rightTree = right . getSyntacticParse ( ) ; return CcgSyntaxTree . createNonterminal ( syntax . getSyntax ( ) , originalSyntax . getSyntax ( ) , leftTree , rightTree ) ; } }
Gets a representation of the syntactic structure of this parse omitting all semantic information .
217
18
7,841
public Expression2 getLogicalForm ( ) { Expression2 preUnaryLogicalForm = getPreUnaryLogicalForm ( ) ; if ( unaryRule == null ) { return preUnaryLogicalForm ; } else if ( preUnaryLogicalForm == null || unaryRule . getUnaryRule ( ) . getLogicalForm ( ) == null ) { return null ; } else { return Expression2 . nested ( unaryRule . getUnaryRule ( ) . getLogicalForm ( ) , preUnaryLogicalForm ) ; } }
Gets the logical form for this CCG parse .
120
11
7,842
public SpannedExpression getLogicalFormForSpan ( int spanStart , int spanEnd ) { CcgParse spanningParse = getParseForSpan ( spanStart , spanEnd ) ; Expression2 lf = spanningParse . getPreUnaryLogicalForm ( ) ; if ( lf != null ) { return new SpannedExpression ( spanningParse . getHeadedSyntacticCategory ( ) , spanningParse . getLogicalForm ( ) , spanningParse . getSpanStart ( ) , spanningParse . getSpanEnd ( ) ) ; } else { return null ; } }
Returns the logical form for the smallest subtree of the parse which completely contains the given span .
135
19
7,843
public List < SpannedExpression > getSpannedLogicalForms ( ) { List < SpannedExpression > spannedExpressions = Lists . newArrayList ( ) ; getSpannedLogicalFormsHelper ( spannedExpressions ) ; return spannedExpressions ; }
Gets the logical forms for every subspan of this parse tree . Many of the returned logical forms combine with each other during the parse of the sentence .
60
31
7,844
public List < String > getSpannedWords ( ) { if ( isTerminal ( ) ) { return words ; } else { List < String > words = Lists . newArrayList ( ) ; words . addAll ( left . getSpannedWords ( ) ) ; words . addAll ( right . getSpannedWords ( ) ) ; return words ; } }
Gets all of the words spanned by this node of the parse tree in sentence order .
76
19
7,845
public List < String > getSpannedPosTags ( ) { if ( isTerminal ( ) ) { return posTags ; } else { List < String > tags = Lists . newArrayList ( ) ; tags . addAll ( left . getSpannedPosTags ( ) ) ; tags . addAll ( right . getSpannedPosTags ( ) ) ; return tags ; } }
Gets all of the part - of - speech tags spanned by this node of the parse tree in sentence order .
80
24
7,846
public List < LexiconEntryInfo > getSpannedLexiconEntries ( ) { if ( isTerminal ( ) ) { return Arrays . asList ( lexiconEntry ) ; } else { List < LexiconEntryInfo > lexiconEntries = Lists . newArrayList ( ) ; lexiconEntries . addAll ( left . getSpannedLexiconEntries ( ) ) ; lexiconEntries . addAll ( right . getSpannedLexiconEntries ( ) ) ; return lexiconEntries ; } }
Gets the lexicon entries for all terminal children of this parse tree node in left - to - right order .
112
23
7,847
public List < DependencyStructure > getAllDependencies ( ) { List < DependencyStructure > deps = Lists . newArrayList ( ) ; if ( ! isTerminal ( ) ) { deps . addAll ( left . getAllDependencies ( ) ) ; deps . addAll ( right . getAllDependencies ( ) ) ; } deps . addAll ( dependencies ) ; return deps ; }
Gets all dependency structures populated during parsing .
93
9
7,848
public Multimap < Integer , DependencyStructure > getAllDependenciesIndexedByHeadWordIndex ( ) { Multimap < Integer , DependencyStructure > map = HashMultimap . create ( ) ; for ( DependencyStructure dep : getAllDependencies ( ) ) { map . put ( dep . getHeadWordIndex ( ) , dep ) ; } return map ; }
Gets all dependency structures populated during parsing indexed by the word that projects the dependency .
86
17
7,849
@ Override public void load ( UnitDaoFactory unitDaoFactory ) { BufferedReader reader = new BufferedReader ( new InputStreamReader ( fileInputStream ) ) ; BufferedReaderIterator iterator = new BufferedReaderIterator ( reader ) ; StringBuilder currentQuery = new StringBuilder ( ) ; while ( iterator . hasNext ( ) ) { String line = iterator . next ( ) . trim ( ) ; if ( ! isCommentOrEmptyLine ( line ) ) { currentQuery . append ( line ) . append ( " " ) ; } if ( isEndOfQuery ( line ) ) { unitDaoFactory . getUnitDao ( ) . execute ( currentQuery . toString ( ) ) ; currentQuery = new StringBuilder ( ) ; } } }
Execute the SQL file s content .
161
8
7,850
private static ParserInfo createParser ( LexiconInductionCcgParserFactory factory , SufficientStatistics currentParameters , Collection < LexiconEntry > currentLexicon ) { ParametricCcgParser family = factory . getParametricCcgParser ( currentLexicon ) ; SufficientStatistics newParameters = family . getNewSufficientStatistics ( ) ; if ( currentParameters != null ) { newParameters . transferParameters ( currentParameters ) ; } return new ParserInfo ( currentLexicon , family , newParameters , family . getModelFromParameters ( newParameters ) ) ; }
Creates a CCG parser given parameters and a lexicon .
122
13
7,851
private double getPartitionFunction ( List < CcgParse > parses ) { double partitionFunction = 0.0 ; for ( CcgParse parse : parses ) { partitionFunction += parse . getSubtreeProbability ( ) ; } return partitionFunction ; }
Gets the sum total probability assigned to all parses .
60
12
7,852
public static ParametricFactorGraph buildSequenceModel ( Iterable < String > emissionFeatureLines , String featureDelimiter ) { // Read in the possible values of each variable. List < String > words = StringUtils . readColumnFromDelimitedLines ( emissionFeatureLines , 0 , featureDelimiter ) ; List < String > labels = StringUtils . readColumnFromDelimitedLines ( emissionFeatureLines , 1 , featureDelimiter ) ; List < String > emissionFeatures = StringUtils . readColumnFromDelimitedLines ( emissionFeatureLines , 2 , featureDelimiter ) ; // Create dictionaries for each variable's values. DiscreteVariable wordType = new DiscreteVariable ( "word" , words ) ; DiscreteVariable labelType = new DiscreteVariable ( "label" , labels ) ; DiscreteVariable emissionFeatureType = new DiscreteVariable ( "emissionFeature" , emissionFeatures ) ; // Create a dynamic factor graph with a single plate replicating // the input/output variables. ParametricFactorGraphBuilder builder = new ParametricFactorGraphBuilder ( ) ; builder . addPlate ( PLATE_NAME , new VariableNumMap ( Ints . asList ( 1 , 2 ) , Arrays . asList ( INPUT_NAME , OUTPUT_NAME ) , Arrays . asList ( wordType , labelType ) ) , 10000 ) ; String inputPattern = PLATE_NAME + "/?(0)/" + INPUT_NAME ; String outputPattern = PLATE_NAME + "/?(0)/" + OUTPUT_NAME ; String nextOutputPattern = PLATE_NAME + "/?(1)/" + OUTPUT_NAME ; VariableNumMap plateVars = new VariableNumMap ( Ints . asList ( 1 , 2 ) , Arrays . asList ( inputPattern , outputPattern ) , Arrays . asList ( wordType , labelType ) ) ; // Read in the emission features (for the word/label weights). VariableNumMap x = plateVars . getVariablesByName ( inputPattern ) ; VariableNumMap y = plateVars . getVariablesByName ( outputPattern ) ; VariableNumMap emissionFeatureVar = VariableNumMap . singleton ( 0 , "emissionFeature" , emissionFeatureType ) ; TableFactor emissionFeatureFactor = TableFactor . fromDelimitedFile ( Arrays . asList ( x , y , emissionFeatureVar ) , emissionFeatureLines , featureDelimiter , false , SparseTensorBuilder . getFactory ( ) ) . cacheWeightPermutations ( ) ; System . out . println ( emissionFeatureFactor . getVars ( ) ) ; // Add a parametric factor for the word/label weights DiscreteLogLinearFactor emissionFactor = new DiscreteLogLinearFactor ( x . union ( y ) , emissionFeatureVar , emissionFeatureFactor ) ; builder . addFactor ( WORD_LABEL_FACTOR , emissionFactor , VariableNamePattern . fromTemplateVariables ( plateVars , VariableNumMap . EMPTY ) ) ; // Create a factor connecting adjacent labels VariableNumMap adjacentVars = new VariableNumMap ( Ints . asList ( 0 , 1 ) , Arrays . asList ( outputPattern , nextOutputPattern ) , Arrays . asList ( labelType , labelType ) ) ; builder . addFactor ( TRANSITION_FACTOR , DiscreteLogLinearFactor . createIndicatorFactor ( adjacentVars ) , VariableNamePattern . fromTemplateVariables ( adjacentVars , VariableNumMap . EMPTY ) ) ; return builder . build ( ) ; }
Constructs a sequence model from the lines of a file containing features of the emission distribution .
773
18
7,853
public void addConstantFactor ( String factorName , PlateFactor factor ) { constantFactors . add ( factor ) ; constantFactorNames . add ( factorName ) ; }
Adds an unparameterized dynamically - instantiated factor to the model under construction .
36
17
7,854
public void addFactor ( String factorName , T factor , VariablePattern factorPattern ) { parametricFactors . add ( factor ) ; factorPatterns . add ( factorPattern ) ; parametricFactorNames . add ( factorName ) ; }
Adds a parameterized factor to the log linear model being constructed .
50
13
7,855
@ Override public void load ( UnitDaoFactory unitDaoFactory ) { for ( String query : queries ) { unitDaoFactory . getUnitDao ( ) . execute ( query ) ; } }
Execute the SQL queries .
44
6
7,856
private static final boolean longMultisetsEqual ( long [ ] firstDeps , long [ ] secondDeps ) { if ( firstDeps . length != secondDeps . length ) { return false ; } Arrays . sort ( firstDeps ) ; Arrays . sort ( secondDeps ) ; for ( int i = 0 ; i < firstDeps . length ; i ++ ) { if ( firstDeps [ i ] != secondDeps [ i ] ) { return false ; } } return true ; }
Checks if two multisets of long numbers contain the same keys with the same frequency
110
18
7,857
public int add ( T item ) { if ( itemIndex . containsKey ( item ) ) { // Items can only be added once return itemIndex . get ( item ) ; } int index = items . size ( ) ; itemIndex . put ( item , index ) ; items . add ( item ) ; return index ; }
Add a new element to this set . Note that there can only be a single copy of any given item in the list . Returns the index of the added item .
67
33
7,858
public int getIndex ( Object item ) { if ( ! itemIndex . containsKey ( item ) ) { throw new NoSuchElementException ( "No such item: " + item ) ; } return itemIndex . get ( item ) ; }
Get the index in the list of the specified item .
50
11
7,859
public T get ( int index ) { if ( index >= items . size ( ) || index < 0 ) { throw new IndexOutOfBoundsException ( "size: " + items . size ( ) + " index: " + index ) ; } return items . get ( index ) ; }
Get the item with the specified index .
61
8
7,860
public int getParentExpressionIndex ( int index ) { if ( index == 0 ) { return - 1 ; } else { int [ ] parts = findSubexpression ( index ) ; int parentIndex = subexpressions . get ( parts [ 0 ] ) . getParentExpressionIndex ( parts [ 1 ] ) ; if ( parentIndex == - 1 ) { // index refers to a child of this expression. return 0 ; } else { // Return the index into this expression of the chosen child, // plus the index into that expression. return parentIndex + parts [ 2 ] ; } } }
Get the index of the parent expression that contains the given index . Returns - 1 if the indexed expression has no parent .
123
24
7,861
public void nextState ( IncEvalState prev , IncEvalState next , Object continuation , Environment env , Object denotation , Object diagram , Object otherArgs , LogFunction log ) { next . set ( continuation , env , denotation , diagram , prev . getProb ( ) , null ) ; }
Override this method in subclasses to implement scoring of search states and accumulating features .
64
16
7,862
public static Object convert ( String dataType , Object record ) { if ( record == null ) { return null ; } if ( dataType . equals ( UUID ) ) { return java . util . UUID . fromString ( record . toString ( ) ) ; } //TODO: add a lot of else if here for the other data types else { return record ; } }
Based on the generic data type convert record to an appropriate Java Data type
80
14
7,863
public ModelDef [ ] correct ( ) { for ( ModelDef m : modelList ) { this . model = m ; correct1to1Detail ( ) ; } for ( ModelDef m : modelList ) { this . model = m ; removeUnnecessaryHasOneToSelf ( ) ; } for ( ModelDef m : modelList ) { this . model = m ; removeUnnecessaryHasManyToSelf ( ) ; } for ( ModelDef m : modelList ) { this . model = m ; crossOutLinkerTables ( ) ; } for ( ModelDef m : modelList ) { this . model = m ; removeHasOneToBothPrimaryAndForeignKey ( ) ; } return modelList ; }
Run each one at a time for all models in such a way that it won t disturb the other
149
20
7,864
private void removeHasOneToBothPrimaryAndForeignKey ( ) { String [ ] primaryKeys = model . getPrimaryAttributes ( ) ; String [ ] hasOne = model . getHasOne ( ) ; String [ ] hasOneLocal = model . getHasOneLocalColumn ( ) ; String [ ] hasOneReferenced = model . getHasOneReferencedColumn ( ) ; for ( String pk : primaryKeys ) { int pkIndex = CStringUtils . indexOf ( hasOneLocal , pk ) ; if ( pkIndex >= 0 ) { System . out . println ( "\n" + pk + " is a primary key of [" + model . getTableName ( ) + "] (" + hasOneLocal [ pkIndex ] + ")" + "and foreign key to [" + hasOne [ pkIndex ] + "](" + hasOneReferenced [ pkIndex ] + ")" ) ; System . out . println ( "removing [" + hasOne [ pkIndex ] + "] from [" + model . getTableName ( ) + "]" ) ; model = removeFromHasOne ( model , hasOne [ pkIndex ] ) ; } } }
user_info . user_id is the primary key while it is refering to users . user_id user_info . User will create a cyclic recursive mapping to users and user_info and back . Remove that hasOne which is both primary and foreign to prevent that .
256
57
7,865
private void correct1to1Detail ( ) { String [ ] hasManyTables = model . getHasMany ( ) ; for ( String hasMany : hasManyTables ) { if ( shouldBeMoved ( model , hasMany ) ) { model = moveFromHasManyToHasOne ( model , hasMany ) ; } } }
If the localColum of that hasMany table is the primary attributes AND it refer to the primary column of this table
72
24
7,866
private void crossOutLinkerTables ( ) { String [ ] primaryKeys = model . getPrimaryAttributes ( ) ; if ( primaryKeys != null && primaryKeys . length == 2 ) { //there are only 2 primary keys //if both primary keys look up to different table which is also a primary key String [ ] hasOne = model . getHasOne ( ) ; String [ ] hasOneLocalColum = model . getHasOneLocalColumn ( ) ; String [ ] hasOneReferencedColumn = model . getHasOneReferencedColumn ( ) ; int indexP1 = CStringUtils . indexOf ( hasOneLocalColum , primaryKeys [ 0 ] ) ; int indexP2 = CStringUtils . indexOf ( hasOneLocalColum , primaryKeys [ 1 ] ) ; if ( indexP1 >= 0 && indexP2 >= 0 ) { String t1 = hasOne [ indexP1 ] ; String t2 = hasOne [ indexP2 ] ; String ref1 = hasOneReferencedColumn [ indexP1 ] ; String ref2 = hasOneReferencedColumn [ indexP2 ] ; ModelDef m1 = getModel ( t1 ) ; boolean isRef1Primary = CStringUtils . inArray ( m1 . getPrimaryAttributes ( ) , ref1 ) ; ModelDef m2 = getModel ( t2 ) ; boolean isRef2Primary = CStringUtils . inArray ( m2 . getPrimaryAttributes ( ) , ref2 ) ; if ( model != m1 && model != m2 && isRef1Primary && isRef2Primary ) { removeFromHasMany ( m1 , model . getTableName ( ) ) ; //remove the hasMany of this table removeFromHasMany ( m2 , model . getTableName ( ) ) ; //remove the hasMany of this table addToHasMany ( m1 , m2 . getTableName ( ) , ref2 , null ) ; addToHasMany ( m2 , m1 . getTableName ( ) , ref1 , null ) ; } } } }
Remove a linker table present in the hasMany then short circuit right away to the linked table
442
19
7,867
public Map < U , Double > getActiveFeatures ( Tensor featureVector ) { Preconditions . checkArgument ( featureVector . getDimensionSizes ( ) . length == 1 && featureVector . getDimensionSizes ( ) [ 0 ] == getNumberOfFeatures ( ) ) ; Map < U , Double > features = Maps . newHashMap ( ) ; Iterator < KeyValue > keyValueIter = featureVector . keyValueIterator ( ) ; while ( keyValueIter . hasNext ( ) ) { KeyValue featureKeyValue = keyValueIter . next ( ) ; features . put ( featureIndexes . get ( featureKeyValue . getKey ( ) [ 0 ] ) , featureKeyValue . getValue ( ) ) ; } return features ; }
Given a feature vector get the features which were active for it . This method inverts the mapping from feature sets to feature vectors performed by this class .
161
30
7,868
public void sendAdvertisement ( final BasicTrustGraphAdvertisement message , final TrustGraphNodeId sender , final TrustGraphNodeId toNeighbor , final int ttl ) { final BasicTrustGraphAdvertisement outboundMessage = message . copyWith ( sender , ttl ) ; final TrustGraphNode toNode = nodes . get ( toNeighbor ) ; toNode . handleAdvertisement ( outboundMessage ) ; }
send a local advertisement to the node specified with the given ttl .
82
14
7,869
public LocalTrustGraphNode addNode ( final TrustGraphNodeId nodeId ) { final LocalTrustGraphNode node = createNode ( nodeId ) ; addNode ( node ) ; return node ; }
Create and add a new trust graph node with the given id .
41
13
7,870
public void addDirectedRoute ( final LocalTrustGraphNode from , final LocalTrustGraphNode to ) { from . getRoutingTable ( ) . addNeighbor ( to . getId ( ) ) ; }
Add a directed trust graph link between two nodes .
44
10
7,871
public void addDirectedRoute ( final TrustGraphNodeId from , final TrustGraphNodeId to ) { final TrustGraphNode fromNode = nodes . get ( from ) ; fromNode . getRoutingTable ( ) . addNeighbor ( to ) ; }
create a directed trust link between two nodes . The node with id from will trust the node with id to .
54
22
7,872
public void addRoute ( final TrustGraphNodeId a , final TrustGraphNodeId b ) { addDirectedRoute ( a , b ) ; addDirectedRoute ( b , a ) ; }
create a bidirectional trust link between the nodes with ids a and b
41
16
7,873
public void addRoute ( final LocalTrustGraphNode a , final LocalTrustGraphNode b ) { addDirectedRoute ( a , b ) ; addDirectedRoute ( b , a ) ; }
add bidirectioanl trust graph links between two nodes .
41
13
7,874
private < T > T populateEntity ( final T t , final Map < Field , Long > enumeratesMap , final Set < Field > nullableFields , final int currentEmbeddedDepth ) { final Map < Field , GenContainer > genContainers = this . populateScanner . scan ( t . getClass ( ) ) ; for ( final Map . Entry < Field , GenContainer > annotatedField : genContainers . entrySet ( ) ) { final Field field = annotatedField . getKey ( ) ; // If field had errors or null gen in prev populate iteration, just skip that field if ( nullableFields . contains ( field ) ) continue ; try { field . setAccessible ( true ) ; final Object objValue = generateObject ( field , annotatedField . getValue ( ) , enumeratesMap , nullableFields , currentEmbeddedDepth ) ; field . set ( t , objValue ) ; } catch ( ClassCastException e ) { logger . warning ( e . getMessage ( ) + " | field TYPE and GENERATE TYPE are not compatible" ) ; nullableFields . add ( field ) ; // skip field due to error as if it null throw e ; } catch ( IllegalAccessException e ) { logger . warning ( e . getMessage ( ) + " | have NO ACCESS to field: " + field . getName ( ) ) ; nullableFields . add ( field ) ; // skip field due to error as if it null } catch ( Exception e ) { logger . warning ( e . getMessage ( ) ) ; nullableFields . add ( field ) ; // skip field due to error as if it null } finally { annotatedField . getKey ( ) . setAccessible ( false ) ; } } return t ; }
Populate single entity
375
4
7,875
private Object generateObject ( final Field field , final GenContainer container , final Map < Field , Long > enumerateMap , final Set < Field > nullableFields , final int currentEmbeddedDepth ) { final IGenerator generator = genStorage . getGenInstance ( container . getGeneratorClass ( ) ) ; final Annotation annotation = container . getMarker ( ) ; Object generated ; if ( EmbeddedGenerator . class . equals ( container . getGeneratorClass ( ) ) ) { generated = generateEmbeddedObject ( annotation , field , nullableFields , currentEmbeddedDepth ) ; } else if ( enumerateMap . containsKey ( field ) ) { generated = generateEnumerateObject ( field , enumerateMap ) ; } else if ( container . isComplex ( ) ) { // If complexGen can generate embedded objects // And not handling it like BasicComplexGenerator, you are StackOverFlowed generated = ( ( IComplexGenerator ) generator ) . generate ( annotation , field , genStorage , currentEmbeddedDepth ) ; } else { generated = generator . generate ( ) ; } final Object casted = castObject ( generated , field . getType ( ) ) ; if ( casted == null ) nullableFields . add ( field ) ; return casted ; }
Generate populate field value
275
5
7,876
private Object generateEmbeddedObject ( final Annotation annotation , final Field field , final Set < Field > nullableFields , final int currentEmbeddedDepth ) { final int fieldDepth = getDepth ( annotation ) ; if ( fieldDepth < currentEmbeddedDepth ) return null ; final Object embedded = instantiate ( field . getType ( ) ) ; if ( embedded == null ) { nullableFields . add ( field ) ; return null ; } return populateEntity ( embedded , buildEnumerateMap ( field . getType ( ) ) , buildNullableSet ( ) , currentEmbeddedDepth + 1 ) ; }
Generate embedded field value
130
5
7,877
private Object generateEnumerateObject ( final Field field , final Map < Field , Long > enumerateMap ) { final Long currentEnumerateValue = enumerateMap . get ( field ) ; Object objValue = BasicCastUtils . castToNumber ( currentEnumerateValue , field . getType ( ) ) ; // Increment numerate number for generated field enumerateMap . computeIfPresent ( field , ( k , v ) -> v + 1 ) ; return objValue ; }
Generate enumerate field next value
103
7
7,878
private Map < Field , Long > buildEnumerateMap ( final Class t ) { return this . enumerateScanner . scan ( t ) . entrySet ( ) . stream ( ) . collect ( Collectors . toMap ( Map . Entry :: getKey , e -> ( ( GenEnumerate ) e . getValue ( ) . get ( 0 ) ) . from ( ) ) ) ; }
Setup map for enumerate fields
84
6
7,879
public Factor getRootFactor ( ExpressionTree tree , VariableNumMap expressionVar ) { List < Assignment > roots = Lists . newArrayList ( ) ; if ( tree . getSubstitutions ( ) . size ( ) == 0 ) { roots . add ( expressionVar . outcomeArrayToAssignment ( tree . getExpressionNode ( ) ) ) ; } else { for ( ExpressionTree substitution : tree . getSubstitutions ( ) ) { roots . add ( expressionVar . outcomeArrayToAssignment ( substitution . getExpressionNode ( ) ) ) ; } } return TableFactor . pointDistribution ( expressionVar , roots . toArray ( new Assignment [ 0 ] ) ) ; }
This method is a hack that enables the use of the substitutions field of ExpressionTree at the root of the CFG parse . In the future these substitutions should be handled using unary rules in the CFG parser .
145
45
7,880
public synchronized void clearDisappearedJob ( ) { getCron4jJobList ( ) . stream ( ) . filter ( job -> job . isDisappeared ( ) ) . forEach ( job -> { final LaJobKey jobKey = job . getJobKey ( ) ; jobKeyJobMap . remove ( jobKey ) ; jobOrderedList . remove ( job ) ; job . getJobUnique ( ) . ifPresent ( jobUnique -> jobUniqueJobMap . remove ( jobUnique ) ) ; cron4jTaskJobMap . remove ( job . getCron4jTask ( ) ) ; } ) ; }
Clear disappeared jobs from job list if it exists .
133
10
7,881
public void addUnreplicatedFactor ( String factorName , Factor factor , VariableNumMap vars ) { plateFactors . add ( new ReplicatedFactor ( factor , new WrapperVariablePattern ( vars ) ) ) ; plateFactorNames . add ( factorName ) ; }
Adds an unreplicated factor to the model being constructed . The factor will match only the variables which it is defined over .
58
25
7,882
private boolean isComplex ( final Field field ) { final Class < ? > declaringClass = field . getType ( ) ; return ( declaringClass . equals ( List . class ) || declaringClass . equals ( Set . class ) || declaringClass . equals ( Map . class ) ) || declaringClass . getTypeName ( ) . endsWith ( "[][]" ) || declaringClass . getTypeName ( ) . endsWith ( "[]" ) ; }
Check if the field have complex suitable generator
93
8
7,883
private GenContainer findGenAnnotation ( final Field field ) { for ( Annotation annotation : field . getDeclaredAnnotations ( ) ) { for ( Annotation inline : annotation . annotationType ( ) . getDeclaredAnnotations ( ) ) { if ( isGen . test ( inline ) ) { return GenContainer . asGen ( inline , annotation ) ; } } } return null ; }
Found only first found gen annotation on field
82
8
7,884
private static void markEntityVars ( HeadedSyntacticCategory cat , int [ ] uniqueVars , boolean [ ] isEntityVar ) { if ( cat . isAtomic ( ) ) { for ( int var : cat . getUniqueVariables ( ) ) { int index = Ints . indexOf ( uniqueVars , var ) ; isEntityVar [ index ] = true ; } } else { markEntityVars ( cat . getArgumentType ( ) , uniqueVars , isEntityVar ) ; markEntityVars ( cat . getReturnType ( ) , uniqueVars , isEntityVar ) ; } }
Marks all unique variables in a syntactic category associated with atomic syntactic categories .
133
17
7,885
@ Override public Iterator < Class > getClassesToDeleteIterator ( ) { if ( fixture instanceof CleanableFixture ) { return cleanableFixture ( ) . getClassesToDeleteIterator ( ) ; } return Collections . < Class > emptyList ( ) . iterator ( ) ; }
Returns an ordered iterator of mapping classes to delete from database .
63
12
7,886
private String buildCsvValue ( final Field field , final String fieldValue ) { return ( areTextValuesWrapped && field . getType ( ) . equals ( String . class ) || isValueWrappable . test ( fieldValue ) ) ? wrapWithQuotes ( fieldValue ) : fieldValue ; }
Build correct final export field value in CSV format Check for wrap option for field value
64
16
7,887
private String generateCsvHeader ( final IClassContainer container ) { final String separatorAsStr = String . valueOf ( separator ) ; return container . getFormatSupported ( Format . CSV ) . entrySet ( ) . stream ( ) . map ( e -> e . getValue ( ) . getExportName ( ) ) . collect ( Collectors . joining ( separatorAsStr ) ) ; }
Generates header for CSV file
84
6
7,888
public SyntacticCategory assignFeatures ( Map < Integer , String > assignedFeatures , Map < Integer , Integer > relabeledFeatures ) { String newFeatureValue = featureValue ; int newFeatureVariable = featureVariable ; if ( assignedFeatures . containsKey ( featureVariable ) ) { newFeatureValue = assignedFeatures . get ( featureVariable ) ; newFeatureVariable = - 1 ; } else if ( relabeledFeatures . containsKey ( featureVariable ) ) { newFeatureVariable = relabeledFeatures . get ( newFeatureVariable ) ; } if ( isAtomic ( ) ) { return SyntacticCategory . createAtomic ( value , newFeatureValue , newFeatureVariable ) ; } else { SyntacticCategory assignedReturn = returnType . assignFeatures ( assignedFeatures , relabeledFeatures ) ; SyntacticCategory assignedArgument = argumentType . assignFeatures ( assignedFeatures , relabeledFeatures ) ; return SyntacticCategory . createFunctional ( direction , assignedReturn , assignedArgument , newFeatureValue , newFeatureVariable ) ; } }
Assigns values to or relabels feature variables in this category .
215
15
7,889
public SyntacticCategory assignAllFeatures ( String value ) { Set < Integer > featureVars = Sets . newHashSet ( ) ; getAllFeatureVariables ( featureVars ) ; Map < Integer , String > valueMap = Maps . newHashMap ( ) ; for ( Integer var : featureVars ) { valueMap . put ( var , value ) ; } return assignFeatures ( valueMap , Collections . < Integer , Integer > emptyMap ( ) ) ; }
Assigns value to all unfilled feature variables .
98
11
7,890
public SyntacticCategory getWithoutFeatures ( ) { if ( isAtomic ( ) ) { return createAtomic ( value , DEFAULT_FEATURE_VALUE , - 1 ) ; } else { return createFunctional ( getDirection ( ) , returnType . getWithoutFeatures ( ) , argumentType . getWithoutFeatures ( ) ) ; } }
Get a syntactic category identical to this one except with all feature values replaced by the default value .
73
20
7,891
public List < SyntacticCategory > getArgumentList ( ) { if ( isAtomic ( ) ) { return Lists . newArrayList ( ) ; } else { List < SyntacticCategory > args = getReturn ( ) . getArgumentList ( ) ; args . add ( getArgument ( ) ) ; return args ; } }
Gets the sequence of arguments that this category accepts . Note that the returned arguments themselves may be functional types .
71
22
7,892
private static MaxMarginalSet cliqueTreeToMaxMarginalSet ( CliqueTree cliqueTree , FactorGraph originalFactorGraph ) { for ( int i = 0 ; i < cliqueTree . numFactors ( ) ; i ++ ) { computeMarginal ( cliqueTree , i , false ) ; } return new FactorMaxMarginalSet ( cliqueTree , originalFactorGraph . getConditionedValues ( ) ) ; }
Retrieves max marginals from the given clique tree .
87
13
7,893
public String sign ( String content , PrivateKey privateKey ) { if ( content == null ) { return null ; } byte [ ] bytes = content . getBytes ( StandardCharsets . UTF_8 ) ; InputStream input = new ByteArrayInputStream ( bytes ) ; return sign ( input , privateKey ) ; // ByteArrayInputStream does not need to be closed. }
Generates a digital signature for the given string .
79
10
7,894
public boolean verify ( String content , PublicKey publicKey , String signature ) { byte [ ] bytes = content . getBytes ( StandardCharsets . UTF_8 ) ; InputStream input = new ByteArrayInputStream ( bytes ) ; return verify ( input , publicKey , signature ) ; // ByteArrayInputStream does not need to be closed. }
Verifies whether the given content matches the given signature .
73
11
7,895
public final Assignment union ( Assignment other ) { Preconditions . checkNotNull ( other ) ; if ( other . size ( ) == 0 ) { return this ; } if ( vars . length == 0 ) { return other ; } // Merge varnums / values int [ ] otherNums = other . getVariableNumsArray ( ) ; int [ ] myNums = getVariableNumsArray ( ) ; Object [ ] otherVals = other . getValuesArray ( ) ; Object [ ] myVals = getValuesArray ( ) ; int [ ] mergedNums = new int [ otherNums . length + myNums . length ] ; Object [ ] mergedVals = new Object [ otherNums . length + myNums . length ] ; int i = 0 ; int j = 0 ; int numFilled = 0 ; while ( i < otherNums . length && j < myNums . length ) { if ( otherNums [ i ] < myNums [ j ] ) { mergedNums [ numFilled ] = otherNums [ i ] ; mergedVals [ numFilled ] = otherVals [ i ] ; i ++ ; numFilled ++ ; } else if ( otherNums [ i ] > myNums [ j ] ) { mergedNums [ numFilled ] = myNums [ j ] ; mergedVals [ numFilled ] = myVals [ j ] ; j ++ ; numFilled ++ ; } else { Preconditions . checkState ( false , "Cannot combine non-disjoint assignments: %s with %s" , this , other ) ; } } // One list might still have elements in it. while ( i < otherNums . length ) { mergedNums [ numFilled ] = otherNums [ i ] ; mergedVals [ numFilled ] = otherVals [ i ] ; i ++ ; numFilled ++ ; } while ( j < myNums . length ) { mergedNums [ numFilled ] = myNums [ j ] ; mergedVals [ numFilled ] = myVals [ j ] ; j ++ ; numFilled ++ ; } Preconditions . checkState ( numFilled == mergedNums . length ) ; return Assignment . fromSortedArrays ( mergedNums , mergedVals ) ; }
Combines two assignments into a single joint assignment to all of the variables in each assignment . The two assignments must contain disjoint sets of variables .
502
30
7,896
@ Deprecated public final Assignment removeAll ( Collection < Integer > varNumsToRemove ) { return removeAll ( Ints . toArray ( varNumsToRemove ) ) ; }
Returns a copy of this assignment without any assignments to the variable numbers in varNumsToRemove
39
19
7,897
public Assignment mapVariables ( Map < Integer , Integer > varMap ) { int [ ] newVarNums = new int [ vars . length ] ; Object [ ] newValues = new Object [ vars . length ] ; int numFilled = 0 ; for ( int i = 0 ; i < vars . length ; i ++ ) { if ( varMap . containsKey ( vars [ i ] ) ) { newVarNums [ numFilled ] = varMap . get ( vars [ i ] ) ; newValues [ numFilled ] = values [ i ] ; numFilled ++ ; } } if ( numFilled < newVarNums . length ) { newVarNums = Arrays . copyOf ( newVarNums , numFilled ) ; newValues = Arrays . copyOf ( newValues , numFilled ) ; } return Assignment . fromUnsortedArrays ( newVarNums , newValues ) ; }
Return a new assignment where each var num has been replaced by its value in varMap .
204
18
7,898
private String [ ] curateIgnoredColumns ( String [ ] ignoredColumns ) { if ( ignoredColumns == null ) { return null ; } else { String [ ] curated = new String [ ignoredColumns . length ] ; for ( int i = 0 ; i < ignoredColumns . length ; i ++ ) { if ( ignoredColumns [ i ] != null ) { String [ ] splinters = ignoredColumns [ i ] . split ( "\\." ) ; if ( splinters != null && splinters . length > 0 ) { String last = splinters [ splinters . length - 1 ] ; curated [ i ] = last ; } } } return curated ; } }
while ignoring specific table
144
4
7,899
private boolean hasFileChangedUnexpectedly ( ) { synchronized ( this ) { if ( mDiskWritesInFlight > 0 ) { // If we know we caused it, it's not unexpected. if ( DEBUG ) System . out . println ( "disk write in flight, not unexpected." ) ; return false ; } } if ( ! mFile . canRead ( ) ) { return true ; } synchronized ( this ) { return mStatTimestamp != mFile . lastModified ( ) || mStatSize != mFile . length ( ) ; } }
we didn t instigate .
116
6