signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class ManagedDatabasesInner { /** * Gets a list of managed databases .
* @ param nextPageLink The NextLink from the previous successful call to List operation .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the PagedList & lt ; ManagedDatabaseInner & gt ; object */
public Observable < Page < ManagedDatabaseInner > > listByInstanceNextAsync ( final String nextPageLink ) { } } | return listByInstanceNextWithServiceResponseAsync ( nextPageLink ) . map ( new Func1 < ServiceResponse < Page < ManagedDatabaseInner > > , Page < ManagedDatabaseInner > > ( ) { @ Override public Page < ManagedDatabaseInner > call ( ServiceResponse < Page < ManagedDatabaseInner > > response ) { return response . body ( ) ; } } ) ; |
public class JRebirth { /** * Run into the JRebirth Thread Pool [ JTP ] < b > Synchronously < / b > .
* Be careful this method can be called through any thread .
* @ param runnableName the name of the runnable for logging purpose
* @ param runnable the task to run
* @ param timeout the optional timeout value after which the thread will be released ( default is 1000 ms ) */
public static void runIntoJTPSync ( final String runnableName , final Runnable runnable , final long ... timeout ) { } } | runIntoJTPSync ( new JrbReferenceRunnable ( runnableName , runnable ) , timeout ) ; |
public class BufferUtil { /** * Look for value k in buffer in the range [ begin , end ) . If the value is found , return its index .
* If not , return - ( i + 1 ) where i is the index where the value would be inserted . The buffer is
* assumed to contain sorted values where shorts are interpreted as unsigned integers .
* @ param array buffer where we search
* @ param begin first index ( inclusive )
* @ param end last index ( exclusive )
* @ param k value we search for
* @ return count */
public static int unsignedBinarySearch ( final ShortBuffer array , final int begin , final int end , final short k ) { } } | return branchyUnsignedBinarySearch ( array , begin , end , k ) ; |
public class ServletRequestWrapper { /** * Checks ( recursively ) if this ServletRequestWrapper wraps a
* { @ link ServletRequest } of the given class type .
* @ param wrappedType the ServletRequest class type to
* search for
* @ return true if this ServletRequestWrapper wraps a
* ServletRequest of the given class type , false otherwise
* @ throws IllegalArgumentException if the given class does not
* implement { @ link ServletRequest }
* @ since Servlet 3.0 */
public boolean isWrapperFor ( Class < ? > wrappedType ) { } } | if ( ! ServletRequest . class . isAssignableFrom ( wrappedType ) ) { throw new IllegalArgumentException ( "Given class " + wrappedType . getName ( ) + " not a subinterface of " + ServletRequest . class . getName ( ) ) ; } if ( wrappedType . isAssignableFrom ( request . getClass ( ) ) ) { return true ; } else if ( request instanceof ServletRequestWrapper ) { return ( ( ServletRequestWrapper ) request ) . isWrapperFor ( wrappedType ) ; } else { return false ; } |
public class ScheduledRunnable { /** * This method is periodically called by the { @ link ExecutorService } . */
@ Override public synchronized void run ( ) { } } | try { notifier . beforePollingCycle ( new BeforePollingCycleEvent ( dp ) ) ; if ( ! executor . isShutdown ( ) ) { executor . invokeAll ( pollers ) ; } notifier . afterPollingCycle ( new AfterPollingCycleEvent ( dp ) ) ; } catch ( InterruptedException e ) { // allow thread to exit gracefully
} catch ( Throwable t ) { LOG . error ( "Unexpected error!" , t ) ; } |
public class ProjectiveStructureByFactorization { /** * Sets pixel observations for a paricular view
* @ param view the view
* @ param pixelsInView list of 2D pixel observations */
public void setPixels ( int view , List < Point2D_F64 > pixelsInView ) { } } | if ( pixelsInView . size ( ) != pixels . numCols ) throw new IllegalArgumentException ( "Pixel count must be constant and match " + pixels . numCols ) ; int row = view * 2 ; for ( int i = 0 ; i < pixelsInView . size ( ) ; i ++ ) { Point2D_F64 p = pixelsInView . get ( i ) ; pixels . set ( row , i , p . x ) ; pixels . set ( row + 1 , i , p . y ) ; pixelScale = Math . max ( Math . abs ( p . x ) , Math . abs ( p . y ) ) ; } |
public class SearchExpressionUtils { /** * used by p : resolveWidgetVar */
public static String resolveWidgetVar ( String expression , UIComponent component ) { } } | UIComponent resolvedComponent = SearchExpressionFacade . resolveComponent ( FacesContext . getCurrentInstance ( ) , component , expression ) ; if ( resolvedComponent instanceof Widget ) { return "PF('" + ( ( Widget ) resolvedComponent ) . resolveWidgetVar ( ) + "')" ; } else { throw new FacesException ( "Component with clientId " + resolvedComponent . getClientId ( ) + " is not a Widget" ) ; } |
public class Prefser { /** * Puts value to the SharedPreferences .
* @ param key key under which value will be stored
* @ param value value to be stored
* @ param typeTokenOfT type token of T ( e . g . { @ code new TypeToken < > { } ) */
public < T > void put ( @ NonNull String key , @ NonNull T value , @ NonNull TypeToken < T > typeTokenOfT ) { } } | Preconditions . checkNotNull ( key , KEY_IS_NULL ) ; Preconditions . checkNotNull ( value , VALUE_IS_NULL ) ; Preconditions . checkNotNull ( typeTokenOfT , TYPE_TOKEN_OF_T_IS_NULL ) ; if ( ! accessorProvider . getAccessors ( ) . containsKey ( value . getClass ( ) ) ) { String jsonValue = jsonConverter . toJson ( value , typeTokenOfT . getType ( ) ) ; editor . putString ( key , String . valueOf ( jsonValue ) ) . apply ( ) ; return ; } Class < ? > classOfValue = value . getClass ( ) ; for ( Map . Entry < Class < ? > , Accessor < ? > > entry : accessorProvider . getAccessors ( ) . entrySet ( ) ) { if ( classOfValue . equals ( entry . getKey ( ) ) ) { @ SuppressWarnings ( "unchecked" ) Accessor < T > accessor = ( Accessor < T > ) entry . getValue ( ) ; accessor . put ( key , value ) ; } } |
public class CSVStream { /** * Returns a { @ link CsvMapper } that contains the default settings used by
* csvstream .
* @ return A new { @ link CsvMapper } setup to match the defaults used by csvstream */
public static CsvMapper defaultMapper ( ) { } } | final CsvMapper mapper = new CsvMapper ( ) ; mapper . enable ( CsvParser . Feature . TRIM_SPACES ) ; mapper . enable ( CsvParser . Feature . WRAP_AS_ARRAY ) ; mapper . configure ( JsonParser . Feature . ALLOW_YAML_COMMENTS , true ) ; return mapper ; |
public class PartitionedStepControllerImpl { /** * Verify the number of partitions in the plan makes sense .
* @ throws IllegalArgumentException if it doesn ' t make sense . */
private void validatePlanNumberOfPartitions ( PartitionPlanDescriptor currentPlan ) { } } | int numPreviousPartitions = getTopLevelStepInstance ( ) . getPartitionPlanSize ( ) ; int numCurrentPartitions = currentPlan . getNumPartitionsInPlan ( ) ; if ( logger . isLoggable ( Level . FINE ) ) { logger . fine ( "For step: " + getStepName ( ) + ", previous num partitions = " + numPreviousPartitions + ", and current num partitions = " + numCurrentPartitions ) ; } if ( executionType == ExecutionType . RESTART_NORMAL ) { if ( numPreviousPartitions == EntityConstants . PARTITION_PLAN_SIZE_UNINITIALIZED ) { logger . fine ( "For step: " + getStepName ( ) + ", previous num partitions has not been initialized, so don't validate the current plan size against it" ) ; } else if ( numCurrentPartitions != numPreviousPartitions ) { throw new IllegalArgumentException ( "Partition not configured for override, and previous execution used " + numPreviousPartitions + " number of partitions, while current plan uses a different number: " + numCurrentPartitions ) ; } } if ( numCurrentPartitions < 1 ) { throw new IllegalArgumentException ( "Partition plan size is calculated as " + numCurrentPartitions + ", but at least one partition is needed." ) ; } |
public class ProtobufProxyUtils { /** * Process protobuf type .
* @ param cls the cls
* @ return the string */
public static String processProtobufType ( Class < ? > cls ) { } } | FieldType fieldType = TYPE_MAPPING . get ( cls ) ; if ( fieldType != null ) { return fieldType . getType ( ) ; } return cls . getSimpleName ( ) ; |
public class ZaurusTableForm { /** * open the panel to insert a new row into the table */
public void insertNewRow ( ) { } } | // reset all fields
for ( int i = 0 ; i < komponente . length ; i ++ ) { komponente [ i ] . clearContent ( ) ; } // end of for ( int i = 0 ; i < komponente . length ; i + + )
// reset the field for the primary keys
for ( int i = 0 ; i < primaryKeys . length ; i ++ ) { komponente [ pkColIndex [ i ] ] . setEditable ( true ) ; } ZaurusEditor . printStatus ( "enter a new row for table " + tableName ) ; |
public class AbstractWebController { /** * Build a response object that signals a not - okay response with a given status { @ code code } .
* @ param < T > Some type extending the AbstractBase entity
* @ param code The status code to set as response code
* @ param msg The error message passed to the caller
* @ param msgKey The error message key passed to the caller
* @ param params A set of Serializable objects that are passed to the caller
* @ return A ResponseEntity with status { @ code code } */
protected < T extends AbstractBase > ResponseEntity < Response < T > > buildNOKResponseWithKey ( HttpStatus code , String msg , String msgKey , T ... params ) { } } | return buildResponse ( code , msg , msgKey , params ) ; |
public class DOMHelper { /** * Given an XML Namespace prefix and a context in which the prefix
* is to be evaluated , return the Namespace Name this prefix was
* bound to . Note that DOM Level 3 is expected to provide a version of
* this which deals with the DOM ' s " early binding " behavior .
* Default handling :
* @ param prefix String containing namespace prefix to be resolved ,
* without the ' : ' which separates it from the localname when used
* in a Node Name . The empty sting signifies the default namespace
* at this point in the document .
* @ param namespaceContext Element which provides context for resolution .
* ( We could extend this to work for other nodes by first seeking their
* nearest Element ancestor . )
* @ return a String containing the Namespace URI which this prefix
* represents in the specified context . */
public String getNamespaceForPrefix ( String prefix , Element namespaceContext ) { } } | int type ; Node parent = namespaceContext ; String namespace = null ; if ( prefix . equals ( "xml" ) ) { namespace = QName . S_XMLNAMESPACEURI ; // Hardcoded , per Namespace spec
} else if ( prefix . equals ( "xmlns" ) ) { // Hardcoded in the DOM spec , expected to be adopted by
// Namespace spec . NOTE : Namespace declarations _ must _ use
// the xmlns : prefix ; other prefixes declared as belonging
// to this namespace will not be recognized and should
// probably be rejected by parsers as erroneous declarations .
namespace = "http://www.w3.org/2000/xmlns/" ; } else { // Attribute name for this prefix ' s declaration
String declname = ( prefix == "" ) ? "xmlns" : "xmlns:" + prefix ; // Scan until we run out of Elements or have resolved the namespace
while ( ( null != parent ) && ( null == namespace ) && ( ( ( type = parent . getNodeType ( ) ) == Node . ELEMENT_NODE ) || ( type == Node . ENTITY_REFERENCE_NODE ) ) ) { if ( type == Node . ELEMENT_NODE ) { // Look for the appropriate Namespace Declaration attribute ,
// either " xmlns : prefix " or ( if prefix is " " ) " xmlns " .
// TODO : This does not handle " implicit declarations "
// which may be created when the DOM is edited . DOM Level
// 3 will define how those should be interpreted . But
// this issue won ' t arise in freshly - parsed DOMs .
// NOTE : declname is set earlier , outside the loop .
Attr attr = ( ( Element ) parent ) . getAttributeNode ( declname ) ; if ( attr != null ) { namespace = attr . getNodeValue ( ) ; break ; } } parent = getParentOfNode ( parent ) ; } } return namespace ; |
public class CommandParamsContext { /** * Register dynamic query el variable value . Variable will be completely handled by extension .
* Registration is required to validated not handled variables .
* @ param name variable name */
public void addDynamicElVarValue ( final String name ) { } } | check ( ! dynamicElValues . contains ( name ) , "Duplicate dynamic el variable %s declaration" , name ) ; check ( ! staticElValues . containsKey ( name ) , "El variable %s can't be registered as dynamic, because static declaration already defined" , name ) ; dynamicElValues . add ( name ) ; |
public class ResourceProcessor { /** * Bind indirect lookups to resource / resource - env / message - destination from
* the value from the binding file .
* Check for a binding in the ResourceRef , ResourceEnvRef and MessageDestinationRef
* binding maps , and if found , run the binding name through the variable map service
* ( server only ) , create a Ref Lookup binding , and finally add the reference to the
* ResRefList .
* Because of past supported behavior , a binding file match is accepted for any of
* the different binding types . For example , a resource - ref could be matched to a
* message - destination - ref binding .
* @ param resourceBinding the resource binding to resolve
* @ param refJndiName normalized or denormalized ref name
* @ return the Reference object that resolves the binding or null
* @ throws InjectionException if an error occurs creating the reference */
private Reference resolveFromBinding ( ResourceInjectionBinding resourceBinding , String refJndiName ) throws InjectionException { } } | String boundToJndiName = null ; Reference ref = null ; // Bind indirect jndi lookups to Resource - Refs
// Check for a binding in the ResourceRef Binding map , and if
// found , run the binding name through the variable map service
// ( server only ) , create a ResourceRef Lookup binding , and finally
// add the reference to the ResRefList .
if ( ivResRefBindings != null ) { boundToJndiName = ivResRefBindings . get ( refJndiName ) ; if ( boundToJndiName != null ) { // This call uses the variable map service , creates the
// reference and adds to the ResRefList .
ref = createResRefJndiLookup ( resourceBinding , refJndiName , boundToJndiName ) ; } } // Bind indirect jndi lookups to Resource - Env - Refs
// If a binding was not found yet , try the Resource Environment Ref
// Bindings , and if found , bind an Indirect Jndi Lookup .
if ( ref == null && ivResEnvRefBindings != null ) { boundToJndiName = ivResEnvRefBindings . get ( refJndiName ) ; if ( boundToJndiName != null ) { ref = createIndirectJndiLookup ( resourceBinding , boundToJndiName ) ; } } // Bind indirect jndi lookups to Message - Destination - Refs LI2281-25
// If a binding was not found yet , try the Message Destination Ref
// Bindings , and if found , bind an Indirect Jndi Lookup .
if ( ref == null && ivMsgDestRefBindings != null ) { boundToJndiName = ivMsgDestRefBindings . get ( refJndiName ) ; if ( boundToJndiName != null ) { ref = createIndirectJndiLookup ( resourceBinding , boundToJndiName ) ; } } return ref ; |
public class Postconditions { /** * A { @ code double } specialized version of { @ link # checkPostcondition ( Object ,
* Predicate , Function ) }
* @ param value The value
* @ param predicate The predicate
* @ param describer The describer of the predicate
* @ return value
* @ throws PostconditionViolationException If the predicate is false */
public static double checkPostconditionD ( final double value , final DoublePredicate predicate , final DoubleFunction < String > describer ) { } } | final boolean ok ; try { ok = predicate . test ( value ) ; } catch ( final Throwable e ) { throw failed ( e , Double . valueOf ( value ) , singleViolation ( failedPredicate ( e ) ) ) ; } return innerCheckD ( value , ok , describer ) ; |
public class Resolve { /** * Find an identifier among the members of a given type ` site ' .
* @ param env The current environment .
* @ param site The type containing the symbol to be found .
* @ param name The identifier ' s name .
* @ param kind Indicates the possible symbol kinds
* ( a subset of VAL , TYP ) . */
Symbol findIdentInType ( Env < AttrContext > env , Type site , Name name , int kind ) { } } | Symbol bestSoFar = typeNotFound ; Symbol sym ; if ( ( kind & VAR ) != 0 ) { sym = findField ( env , site , name , site . tsym ) ; if ( sym . exists ( ) ) return sym ; else if ( sym . kind < bestSoFar . kind ) bestSoFar = sym ; } if ( ( kind & TYP ) != 0 ) { sym = findMemberType ( env , site , name , site . tsym ) ; if ( sym . exists ( ) ) return sym ; else if ( sym . kind < bestSoFar . kind ) bestSoFar = sym ; } return bestSoFar ; |
public class CmsLoginForm { /** * Displays the given login error . < p >
* @ param messageHTML the error message */
void displayError ( String messageHTML ) { } } | // m _ fakeWindow . addStyleName ( " waggler " ) ;
m_error . setValue ( messageHTML ) ; m_error . setVisible ( true ) ; CmsVaadinUtils . waggleMeOnce ( m_fakeWindow ) ; // Add JavaScript code , which adds the wiggle class and removes it after a short time .
// JavaScript . getCurrent ( ) . execute (
// " wiggleElement = document . querySelectorAll ( \ " . waggler \ " ) [ 0 ] ; \ n "
// + " wiggleElement . className = wiggleElement . className + \ " waggle \ " ; \ n "
// + " setTimeout ( function ( ) { \ n "
// + " element = document . querySelectorAll ( \ " . waggle \ " ) [ 0 ] ; \ n "
// + " element . className = element . className . replace ( / \ \ bwaggle \ \ b / g , \ " \ " ) ; "
// + " } , 1500 ) ; " ) ; |
public class Normalizer { /** * Converts non - unicode and other strings into their unicode counterparts .
* @ param sentence
* the list of tokens
* @ param lang
* the language */
public static void convertNonCanonicalStrings ( final List < Token > sentence , final String lang ) { } } | // System . err . println ( ( int ) ' ’ ' ) ;
for ( final Token token : sentence ) { token . setTokenValue ( apostrophe . matcher ( token . getTokenValue ( ) ) . replaceAll ( "'" ) ) ; token . setTokenValue ( ellipsis . matcher ( token . getTokenValue ( ) ) . replaceAll ( THREE_DOTS ) ) ; token . setTokenValue ( longDash . matcher ( token . getTokenValue ( ) ) . replaceAll ( "--" ) ) ; if ( lang . equalsIgnoreCase ( "en" ) ) { token . setTokenValue ( oneFourth . matcher ( token . getTokenValue ( ) ) . replaceAll ( "1\\\\/4" ) ) ; token . setTokenValue ( oneThird . matcher ( token . getTokenValue ( ) ) . replaceAll ( "1\\\\/3" ) ) ; token . setTokenValue ( oneHalf . matcher ( token . getTokenValue ( ) ) . replaceAll ( "1\\\\/2" ) ) ; token . setTokenValue ( threeQuarters . matcher ( token . getTokenValue ( ) ) . replaceAll ( "3\\\\/4" ) ) ; token . setTokenValue ( sterling . matcher ( token . getTokenValue ( ) ) . replaceAll ( "#" ) ) ; } token . setTokenValue ( oneFourth . matcher ( token . getTokenValue ( ) ) . replaceAll ( "1/4" ) ) ; token . setTokenValue ( oneThird . matcher ( token . getTokenValue ( ) ) . replaceAll ( "1/3" ) ) ; token . setTokenValue ( oneHalf . matcher ( token . getTokenValue ( ) ) . replaceAll ( "1/2" ) ) ; token . setTokenValue ( twoThirds . matcher ( token . getTokenValue ( ) ) . replaceAll ( "2/3" ) ) ; token . setTokenValue ( threeQuarters . matcher ( token . getTokenValue ( ) ) . replaceAll ( "3/4" ) ) ; token . setTokenValue ( cents . matcher ( token . getTokenValue ( ) ) . replaceAll ( "cents" ) ) ; } |
public class MtoNCollectionPrefetcher { /** * Build the prefetch criteria
* @ param ids Collection of identities of M side
* @ param fkCol indirection table fks to this class
* @ param itemFkCol indirection table fks to item class
* @ param itemPkField
* @ return the Criteria */
private Criteria buildPrefetchCriteriaSingleKey ( Collection ids , String fkCol , String itemFkCol , FieldDescriptor itemPkField ) { } } | Criteria crit = new Criteria ( ) ; ArrayList values = new ArrayList ( ids . size ( ) ) ; Iterator iter = ids . iterator ( ) ; Identity id ; while ( iter . hasNext ( ) ) { id = ( Identity ) iter . next ( ) ; values . add ( id . getPrimaryKeyValues ( ) [ 0 ] ) ; } switch ( values . size ( ) ) { case 0 : break ; case 1 : crit . addEqualTo ( fkCol , values . get ( 0 ) ) ; break ; default : // create IN ( . . . ) for the single key field
crit . addIn ( fkCol , values ) ; break ; } crit . addEqualToField ( itemPkField . getAttributeName ( ) , itemFkCol ) ; return crit ; |
public class FileUtils { /** * Creates a string of XML that describes the supplied file or directory ( and , optionally , all its
* subdirectories ) . Includes absolute path , last modified time , read / write permissions , etc .
* @ param aFilePath The file or directory to be returned as XML
* @ param aPattern A regular expression pattern to evaluate file matches against
* @ param aDeepTransformation Whether the subdirectories are included
* @ return A string of XML describing the supplied file system path ' s structure
* @ throws FileNotFoundException If the supplied file or directory can not be found
* @ throws TransformerException If there is trouble with the XSL transformation */
public static String toXML ( final String aFilePath , final String aPattern , final boolean aDeepTransformation ) throws FileNotFoundException , TransformerException { } } | final Element element = toElement ( aFilePath , aPattern , aDeepTransformation ) ; return DOMUtils . toXML ( element ) ; |
public class StructureAlignmentOptimizer { /** * the equivalent residues : residues where Dij & lt ; = Dc and i , j is an aligned pair
* use the previous superimposing */
private boolean defineEquPos ( int alnLen , int [ ] [ ] alnList ) throws StructureException { } } | int i , r1 , r2 ; int equLenOld = equLen ; int [ ] [ ] equSetOld = new int [ 2 ] [ equLenOld ] ; for ( i = 0 ; i < equLen ; i ++ ) { equSetOld [ 0 ] [ i ] = equSet [ 0 ] [ i ] ; equSetOld [ 1 ] [ i ] = equSet [ 1 ] [ i ] ; } double rmsdOld = rmsd ; double dis ; equLen = 0 ; // if ( debug )
// System . out . println ( String . format ( " OPT : Dc % f , equLenOld % d , rmsdOld % f , alnLen % d " , Dc , equLenOld , rmsdOld , alnLen ) ) ;
for ( i = 0 ; i < alnLen ; i ++ ) { r1 = alnList [ 0 ] [ i ] ; r2 = alnList [ 1 ] [ i ] ; dis = Calc . getDistance ( cod1 [ r1 ] , cod2 [ r2 ] ) ; if ( dis <= Dc ) { // System . out . println ( r1 + " - " + r2 + " d : " + dis ) ;
equSet [ 0 ] [ equLen ] = r1 ; equSet [ 1 ] [ equLen ] = r2 ; equLen ++ ; } } superimposeBySet ( ) ; // if ( debug )
// System . out . println ( String . format ( " OPT : new equLen % d rmsd % f " , equLen , rmsd ) ) ;
boolean ifstop = false ; // if ( debug ) {
// System . out . print ( " OPT : rmsd diff : " + Math . abs ( rmsd - rmsdOld ) + " equLens : " + equLenOld + " : " + equLen ) ;
// if ( Math . abs ( rmsd - rmsdOld ) < 1e - 10)
// System . out . println ( " NO DIFF ! " ) ;
// else
// System . out . println ( " DIFF ! " ) ;
if ( ( Math . abs ( rmsd - rmsdOld ) < 1e-10 ) && ( equLenOld == equLen ) ) keepStep ++ ; else keepStep = 0 ; if ( keepStep > maxKeepStep ) { ifstop = true ; // converge
} // allowing up to maxKeepStep instead of 1 is essential for some special cases
else if ( stopRmsd < 0 ) { ifstop = false ; // condition 1 , continue
} else if ( ( rmsd <= stopRmsd * stopRmsdPer ) || ( rmsd < rmsdCut ) ) { ifstop = false ; // condition 2 , continue
} // rmsdCut is adopted or not ? to be tuned
else { ifstop = true ; // get worse
} if ( ( stopRmsd < 0 ) && ( equLen >= stopLenPer * equLen0 ) ) { // System . err . println ( " stopRmsd : " + stopRmsd + " setting to rmsd : " + rmsd ) ;
stopRmsd = rmsd ; // condition 1
} return ifstop ; |
public class Xsd2CobolTypesModelBuilder { /** * Visit each alternative of a choice in turn .
* Note that this produces a new complex type .
* @ param xsdChoice the XML schema choice
* @ param compositeTypes the lists of composite types being populated
* @ param choiceTypeName the name to use for this choice type */
private void visit ( XmlSchemaChoice xsdChoice , RootCompositeType compositeTypes , String choiceTypeName ) { } } | Map < String , Object > alternatives = new LinkedHashMap < String , Object > ( ) ; int fieldIndex = 0 ; for ( XmlSchemaChoiceMember alternative : xsdChoice . getItems ( ) ) { if ( alternative instanceof XmlSchemaElement ) { addField ( fieldIndex , alternative , alternatives , compositeTypes ) ; fieldIndex ++ ; } } compositeTypes . choiceTypes . put ( choiceTypeName , alternatives ) ; |
public class XStringForFSB { /** * Directly call the
* comment method on the passed LexicalHandler for the
* string - value .
* @ param lh A non - null reference to a LexicalHandler .
* @ throws org . xml . sax . SAXException */
public void dispatchAsComment ( org . xml . sax . ext . LexicalHandler lh ) throws org . xml . sax . SAXException { } } | fsb ( ) . sendSAXComment ( lh , m_start , m_length ) ; |
public class UtilSequence { /** * Get the parameter types as array .
* @ param context The context reference .
* @ param arguments The arguments list .
* @ return The arguments array . */
private static Class < ? > [ ] getParamTypes ( Context context , Object ... arguments ) { } } | final Collection < Object > params = new ArrayList < > ( ) ; params . add ( context ) ; params . addAll ( Arrays . asList ( arguments ) ) ; return UtilReflection . getParamTypes ( params . toArray ( ) ) ; |
public class FactoryThresholdBinary { /** * Applies a non - overlapping block mean threshold
* @ see ThresholdBlockMean
* @ param scale Scale factor adjust for threshold . 1.0 means no change .
* @ param down Should it threshold up or down .
* @ param regionWidth Approximate size of block region
* @ param inputType Type of input image
* @ return Filter to binary */
public static < T extends ImageGray < T > > InputToBinary < T > blockMean ( ConfigLength regionWidth , double scale , boolean down , boolean thresholdFromLocalBlocks , Class < T > inputType ) { } } | if ( BOverrideFactoryThresholdBinary . blockMean != null ) return BOverrideFactoryThresholdBinary . blockMean . handle ( regionWidth , scale , down , thresholdFromLocalBlocks , inputType ) ; BlockProcessor processor ; if ( inputType == GrayU8 . class ) processor = new ThresholdBlockMean_U8 ( scale , down ) ; else processor = new ThresholdBlockMean_F32 ( ( float ) scale , down ) ; if ( BoofConcurrency . USE_CONCURRENT ) { return new ThresholdBlock_MT ( processor , regionWidth , thresholdFromLocalBlocks , inputType ) ; } else { return new ThresholdBlock ( processor , regionWidth , thresholdFromLocalBlocks , inputType ) ; } |
public class ConfigurationFactory { /** * Create the bb - code processor from file with XML - configuration .
* @ param file file with configuration
* @ return bb - code processor
* @ throws TextProcessorFactoryException any problems */
public Configuration create ( File file ) { } } | try { Configuration configuration ; InputStream stream = new BufferedInputStream ( new FileInputStream ( file ) ) ; try { configuration = create ( stream ) ; } finally { stream . close ( ) ; } return configuration ; } catch ( IOException e ) { throw new TextProcessorFactoryException ( e ) ; } |
public class StackMachine { /** * int for consistency with other null check routines */
protected final int nullCheck ( int id , int s ) { } } | int k = stk ; while ( true ) { k -- ; StackEntry e = stack [ k ] ; if ( e . type == NULL_CHECK_START ) { if ( e . getNullCheckNum ( ) == id ) { return e . getNullCheckPStr ( ) == s ? 1 : 0 ; } } } |
public class ReferenceResolvingVisitor { /** * Declaration of the variable within a block */
@ Override public boolean visit ( VariableDeclarationStatement node ) { } } | for ( int i = 0 ; i < node . fragments ( ) . size ( ) ; ++ i ) { String nodeType = node . getType ( ) . toString ( ) ; VariableDeclarationFragment frag = ( VariableDeclarationFragment ) node . fragments ( ) . get ( i ) ; state . getNames ( ) . add ( frag . getName ( ) . getIdentifier ( ) ) ; state . getNameInstance ( ) . put ( frag . getName ( ) . toString ( ) , nodeType . toString ( ) ) ; } processType ( node . getType ( ) , TypeReferenceLocation . VARIABLE_DECLARATION , compilationUnit . getLineNumber ( node . getStartPosition ( ) ) , compilationUnit . getColumnNumber ( node . getStartPosition ( ) ) , node . getLength ( ) , node . toString ( ) ) ; return super . visit ( node ) ; |
public class CRCResourceManagementImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public void eSet ( int featureID , Object newValue ) { } } | switch ( featureID ) { case AfplibPackage . CRC_RESOURCE_MANAGEMENT__FMT_QUAL : setFmtQual ( ( Integer ) newValue ) ; return ; case AfplibPackage . CRC_RESOURCE_MANAGEMENT__RM_VALUE : setRMValue ( ( Integer ) newValue ) ; return ; case AfplibPackage . CRC_RESOURCE_MANAGEMENT__RES_CLASS_FLG : setResClassFlg ( ( Integer ) newValue ) ; return ; } super . eSet ( featureID , newValue ) ; |
public class JsonUtils { /** * Un - serialize a report with Json
* @ param artifact String
* @ return Artifact
* @ throws IOException */
public static Artifact unserializeArtifact ( final String artifact ) throws IOException { } } | final ObjectMapper mapper = new ObjectMapper ( ) ; mapper . disable ( MapperFeature . USE_GETTERS_AS_SETTERS ) ; return mapper . readValue ( artifact , Artifact . class ) ; |
public class Parser { /** * operand . */
private int peekTokenOrEOL ( ) throws IOException { } } | int tt = peekToken ( ) ; // Check for last peeked token flags
if ( ( currentFlaggedToken & TI_AFTER_EOL ) != 0 ) { tt = Token . EOL ; } return tt ; |
public class DbIdentityServiceProvider { /** * users / / / / / */
public UserEntity createNewUser ( String userId ) { } } | checkAuthorization ( Permissions . CREATE , Resources . USER , null ) ; return new UserEntity ( userId ) ; |
public class ClaimsUtils { /** * Convert the types jose4j uses for address , sub _ jwk , and jwk */
private void convertJoseTypes ( JwtClaims claimsSet ) { } } | // if ( claimsSet . hasClaim ( Claims . address . name ( ) ) ) {
// replaceMap ( Claims . address . name ( ) ) ;
// if ( claimsSet . hasClaim ( Claims . jwk . name ( ) ) ) {
// replaceMap ( Claims . jwk . name ( ) ) ;
// if ( claimsSet . hasClaim ( Claims . sub _ jwk . name ( ) ) ) {
// replaceMap ( Claims . sub _ jwk . name ( ) ) ;
if ( claimsSet . hasClaim ( "address" ) ) { replaceMapWithJsonObject ( "address" , claimsSet ) ; } if ( claimsSet . hasClaim ( "jwk" ) ) { replaceMapWithJsonObject ( "jwk" , claimsSet ) ; } if ( claimsSet . hasClaim ( "sub_jwk" ) ) { replaceMapWithJsonObject ( "sub_jwk" , claimsSet ) ; } if ( claimsSet . hasClaim ( "aud" ) ) { convertToList ( "aud" , claimsSet ) ; } if ( claimsSet . hasClaim ( "groups" ) ) { convertToList ( "groups" , claimsSet ) ; } |
public class ModuleRoles { /** * Update the given role instance on Contentful .
* Please make sure that the instance provided is fetched from Contentful . Otherwise you will
* get an exception thrown .
* @ param role the role fetched from Contentful , updated by caller , to be updated .
* @ return the updated role .
* @ throws IllegalArgumentException if space id is null .
* @ throws IllegalArgumentException if role is null .
* @ throws IllegalArgumentException if role id is null .
* @ throws IllegalArgumentException if role does not have a version attached . */
public CMARole update ( CMARole role ) { } } | assertNotNull ( role , "role" ) ; final String id = getResourceIdOrThrow ( role , "role" ) ; final String spaceId = getSpaceIdOrThrow ( role , "role" ) ; final Integer version = getVersionOrThrow ( role , "update" ) ; final CMASystem sys = role . getSystem ( ) ; role . setSystem ( null ) ; try { return service . update ( spaceId , id , role , version ) . blockingFirst ( ) ; } finally { role . setSystem ( sys ) ; } |
public class DocumentRootImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public NotificationChain basicSetBetaDistribution ( BetaDistributionType newBetaDistribution , NotificationChain msgs ) { } } | return ( ( FeatureMap . Internal ) getMixed ( ) ) . basicAdd ( BpsimPackage . Literals . DOCUMENT_ROOT__BETA_DISTRIBUTION , newBetaDistribution , msgs ) ; |
public class CmsContentService { /** * Stores the settings attributes to the container element bean persisted in the session cache . < p >
* The container page editor will write the container page XML . < p >
* @ param entity the entity
* @ param containerElement the container element
* @ param settingsConfig the settings configuration
* @ param nestedFormatters the nested formatters
* @ return < code > true < / code > in case any changed settings where saved */
@ SuppressWarnings ( "null" ) private boolean saveSettings ( CmsEntity entity , CmsContainerElementBean containerElement , Map < String , CmsXmlContentProperty > settingsConfig , List < I_CmsFormatterBean > nestedFormatters ) { } } | boolean hasChangedSettings = false ; Map < String , String > values = new HashMap < > ( containerElement . getIndividualSettings ( ) ) ; for ( Entry < String , CmsXmlContentProperty > settingsEntry : settingsConfig . entrySet ( ) ) { String value = null ; boolean nested = false ; if ( nestedFormatters != null ) { for ( I_CmsFormatterBean formatter : nestedFormatters ) { if ( settingsEntry . getKey ( ) . startsWith ( formatter . getId ( ) ) ) { CmsEntity nestedEntity = null ; CmsEntityAttribute attribute = entity . getAttribute ( getSettingsAttributeName ( formatter . getId ( ) ) ) ; if ( attribute != null ) { nestedEntity = attribute . getComplexValue ( ) ; CmsEntityAttribute valueAttribute = nestedEntity . getAttribute ( getSettingsAttributeName ( settingsEntry . getKey ( ) ) ) ; if ( valueAttribute != null ) { value = valueAttribute . getSimpleValue ( ) ; } } nested = true ; break ; } } } if ( ! nested ) { CmsEntityAttribute valueAttribute = entity . getAttribute ( getSettingsAttributeName ( settingsEntry . getKey ( ) ) ) ; if ( valueAttribute != null ) { value = valueAttribute . getSimpleValue ( ) ; } } if ( CmsStringUtil . isEmptyOrWhitespaceOnly ( value ) && ! HIDDEN_SETTINGS_WIDGET_NAME . equals ( settingsEntry . getValue ( ) . getWidget ( ) ) && values . containsKey ( settingsEntry . getKey ( ) ) ) { values . remove ( settingsEntry . getKey ( ) ) ; hasChangedSettings = true ; } else if ( CmsStringUtil . isNotEmptyOrWhitespaceOnly ( value ) && ! HIDDEN_SETTINGS_WIDGET_NAME . equals ( settingsEntry . getValue ( ) . getWidget ( ) ) && ! value . equals ( values . get ( settingsEntry . getKey ( ) ) ) ) { values . put ( settingsEntry . getKey ( ) , value ) ; hasChangedSettings = true ; } } if ( hasChangedSettings ) { containerElement . updateIndividualSettings ( values ) ; getSessionCache ( ) . setCacheContainerElement ( containerElement . editorHash ( ) , containerElement ) ; } return hasChangedSettings ; |
public class ChronoDateImpl { @ Override public long until ( Temporal endExclusive , TemporalUnit unit ) { } } | ChronoLocalDate end = getChronology ( ) . date ( endExclusive ) ; if ( unit instanceof ChronoUnit ) { return LocalDate . from ( this ) . until ( end , unit ) ; // TODO : this is wrong
} return unit . between ( this , end ) ; |
public class KeyAreaInfo { /** * Get the Field in this KeyField .
* @ param iKeyFieldSeq The position of this field in the key area .
* @ return The field . */
public FieldInfo getField ( int iKeyFieldSeq ) { } } | if ( iKeyFieldSeq >= m_vKeyFieldList . size ( ) ) return null ; return ( FieldInfo ) m_vKeyFieldList . elementAt ( iKeyFieldSeq ) ; |
public class RuleBasedTimeZone { /** * { @ inheritDoc }
* @ deprecated This API is ICU internal only .
* @ hide draft / provisional / internal are hidden on Android */
@ Deprecated @ Override public void getOffsetFromLocal ( long date , int nonExistingTimeOpt , int duplicatedTimeOpt , int [ ] offsets ) { } } | getOffset ( date , true , nonExistingTimeOpt , duplicatedTimeOpt , offsets ) ; |
public class FileListener { /** * Encode and write this field ' s data to the stream .
* @ param daOut The output stream to marshal the data to .
* @ param converter The field to serialize . */
public void writeField ( ObjectOutputStream daOut , Converter converter ) throws IOException { } } | String strFieldName = DBConstants . BLANK ; if ( converter != null ) if ( converter . getField ( ) != null ) strFieldName = converter . getField ( ) . getClass ( ) . getName ( ) ; Object data = null ; if ( converter != null ) data = converter . getData ( ) ; daOut . writeUTF ( strFieldName ) ; daOut . writeObject ( data ) ; |
public class CSSColorHelper { /** * Check if the passed String is valid CSS HSLA color value . Example value :
* < code > hsla ( 255,0 % , 0 % , 0.1 ) < / code >
* @ param sValue
* The value to check . May be < code > null < / code > .
* @ return < code > true < / code > if it is a CSS HSLA color value ,
* < code > false < / code > if not */
public static boolean isHSLAColorValue ( @ Nullable final String sValue ) { } } | final String sRealValue = StringHelper . trim ( sValue ) ; return StringHelper . hasText ( sRealValue ) && sRealValue . startsWith ( CCSSValue . PREFIX_HSLA ) && RegExHelper . stringMatchesPattern ( PATTERN_HSLA , sRealValue ) ; |
public class CmsContextMenuItemWidget { /** * Called when context menu item is clicked or is focused and enter is
* pressed . < p >
* @ return < code > true < / code > if context menu was closed after the click */
protected boolean onItemClicked ( ) { } } | if ( isEnabled ( ) ) { m_overlay . closeSubMenus ( ) ; if ( hasSubMenu ( ) ) { openSubMenu ( ) ; return false ; } else { if ( m_rootComponent . isHideAutomatically ( ) ) { closeContextMenu ( ) ; return true ; } return false ; } } return false ; |
public class SerializationFormat { /** * Makes sure the specified { @ link MediaType } or its compatible one is registered already . */
private static void checkMediaType ( Multimap < MediaType , SerializationFormat > simplifiedMediaTypeToFormats , MediaType mediaType ) { } } | final MediaType simplifiedMediaType = mediaType . withoutParameters ( ) ; for ( SerializationFormat format : simplifiedMediaTypeToFormats . get ( simplifiedMediaType ) ) { for ( MediaType registeredMediaType : format . mediaTypes ( ) ) { checkState ( ! registeredMediaType . is ( mediaType ) && ! mediaType . is ( registeredMediaType ) , "media type registered already: " , mediaType ) ; } } |
public class ManagementModelNode { /** * Get the DMR path for this node . For leaves , the DMR path is the path of its parent .
* @ return The DMR path for this node . */
public String addressPath ( ) { } } | if ( isLeaf ) { ManagementModelNode parent = ( ManagementModelNode ) getParent ( ) ; return parent . addressPath ( ) ; } StringBuilder builder = new StringBuilder ( ) ; for ( Object pathElement : getUserObjectPath ( ) ) { UserObject userObj = ( UserObject ) pathElement ; if ( userObj . isRoot ( ) ) { // don ' t want to escape root
builder . append ( userObj . getName ( ) ) ; continue ; } builder . append ( userObj . getName ( ) ) ; builder . append ( "=" ) ; builder . append ( userObj . getEscapedValue ( ) ) ; builder . append ( "/" ) ; } return builder . toString ( ) ; |
public class SortOrderTableHeaderCellRenderer { /** * Creates a triangle shape with the given coordinates
* @ param w The width
* @ param y0 The first y - coordinate
* @ param y1 The second y - coordinate
* @ return The shape */
private static Shape createArrowShape ( int w , int y0 , int y1 ) { } } | Path2D path = new Path2D . Double ( ) ; path . moveTo ( 0 , y0 ) ; if ( ( w & 1 ) == 0 ) { path . lineTo ( w >> 1 , y1 ) ; } else { int c = w >> 1 ; path . lineTo ( c , y1 ) ; path . lineTo ( c + 1 , y1 ) ; } path . lineTo ( w , y0 ) ; path . closePath ( ) ; return path ; |
public class Pharmazentralnummer { /** * / * Pharmazentral Nummer is a Code 3 of 9 symbol with an extra
* check digit . Now generates PZN - 8. */
@ Override protected void encode ( ) { } } | int l = content . length ( ) ; String localstr ; int zeroes , count = 0 , check_digit ; Code3Of9 c = new Code3Of9 ( ) ; if ( l > 7 ) { throw new OkapiException ( "Input data too long" ) ; } if ( ! content . matches ( "[0-9]+" ) ) { throw new OkapiException ( "Invalid characters in input" ) ; } localstr = "-" ; zeroes = 7 - l + 1 ; for ( int i = 1 ; i < zeroes ; i ++ ) localstr += '0' ; localstr += content ; for ( int i = 1 ; i < 8 ; i ++ ) { count += i * Character . getNumericValue ( localstr . charAt ( i ) ) ; } check_digit = count % 11 ; if ( check_digit == 11 ) { check_digit = 0 ; } if ( check_digit == 10 ) { throw new OkapiException ( "Not a valid PZN identifier" ) ; } encodeInfo += "Check Digit: " + check_digit + "\n" ; localstr += ( char ) ( check_digit + '0' ) ; c . setContent ( localstr ) ; readable = "PZN" + localstr ; pattern = new String [ 1 ] ; pattern [ 0 ] = c . pattern [ 0 ] ; row_count = 1 ; row_height = new int [ 1 ] ; row_height [ 0 ] = - 1 ; |
public class BlurDialogEngine { /** * Must be linked to the original lifecycle . */
public void onDetach ( ) { } } | if ( mBluringTask != null ) { mBluringTask . cancel ( true ) ; } mBluringTask = null ; mHoldingActivity = null ; |
public class AnnotatedLargeText { /** * For reusing code between text / html and text / plain , we run them both through the same code path
* and use this request attribute to differentiate . */
private boolean isHtml ( ) { } } | StaplerRequest req = Stapler . getCurrentRequest ( ) ; return req != null && req . getAttribute ( "html" ) != null ; |
public class HebrewCalendar { /** * Finds the day # of the first day in the given Hebrew year .
* To do this , we want to calculate the time of the Tishri 1 new moon
* in that year .
* The algorithm here is similar to ones described in a number of
* references , including :
* < ul >
* < li > " Calendrical Calculations " , by Nachum Dershowitz & Edward Reingold ,
* Cambridge University Press , 1997 , pages 85-91.
* < li > Hebrew Calendar Science and Myths ,
* < a href = " http : / / www . geocities . com / Athens / 1584 / " >
* http : / / www . geocities . com / Athens / 1584 / < / a >
* < li > The Calendar FAQ ,
* < a href = " http : / / www . faqs . org / faqs / calendars / faq / " >
* http : / / www . faqs . org / faqs / calendars / faq / < / a >
* < / ul > */
private static long startOfYear ( int year ) { } } | long day = cache . get ( year ) ; if ( day == CalendarCache . EMPTY ) { int months = ( 235 * year - 234 ) / 19 ; // # of months before year
long frac = months * MONTH_FRACT + BAHARAD ; // Fractional part of day #
day = months * 29 + ( frac / DAY_PARTS ) ; // Whole # part of calculation
frac = frac % DAY_PARTS ; // Time of day
int wd = ( int ) ( day % 7 ) ; // Day of week ( 0 = = Monday )
if ( wd == 2 || wd == 4 || wd == 6 ) { // If the 1st is on Sun , Wed , or Fri , postpone to the next day
day += 1 ; wd = ( int ) ( day % 7 ) ; } if ( wd == 1 && frac > 15 * HOUR_PARTS + 204 && ! isLeapYear ( year ) ) { // If the new moon falls after 3:11:20am ( 15h204p from the previous noon )
// on a Tuesday and it is not a leap year , postpone by 2 days .
// This prevents 356 - day years .
day += 2 ; } else if ( wd == 0 && frac > 21 * HOUR_PARTS + 589 && isLeapYear ( year - 1 ) ) { // If the new moon falls after 9:32:43 1/3am ( 21h589p from yesterday noon )
// on a Monday and * last * year was a leap year , postpone by 1 day .
// Prevents 382 - day years .
day += 1 ; } cache . put ( year , day ) ; } return day ; |
public class ESTemplate { /** * 提交批次 */
public void commit ( ) { } } | if ( getBulk ( ) . numberOfActions ( ) > 0 ) { BulkResponse response = getBulk ( ) . execute ( ) . actionGet ( ) ; if ( response . hasFailures ( ) ) { for ( BulkItemResponse itemResponse : response . getItems ( ) ) { if ( ! itemResponse . isFailed ( ) ) { continue ; } if ( itemResponse . getFailure ( ) . getStatus ( ) == RestStatus . NOT_FOUND ) { logger . error ( itemResponse . getFailureMessage ( ) ) ; } else { throw new RuntimeException ( "ES sync commit error" + itemResponse . getFailureMessage ( ) ) ; } } } } |
public class AndroidEncryptionUtils { /** * Returns the original data . Avoid calling this method on the UI thread if possible , since it may access to shared
* preferences .
* @ param base64Encrypted
* @ return the original data */
public static String decrypt ( String base64Encrypted ) { } } | if ( base64Encrypted != null ) { byte [ ] enc = Base64 . decode ( base64Encrypted , Base64 . DEFAULT ) ; byte [ ] result = doFinal ( Base64 . decode ( getBase64Key ( ) , Base64 . DEFAULT ) , Cipher . DECRYPT_MODE , enc ) ; return new String ( result ) ; } return null ; |
public class PermissionService { /** * Get permissions configuration for tenant .
* Map key is ROLE _ KEY : PRIVILEGE _ KEY and value id permission .
* @ param tenant the tenant
* @ return permissions */
public Map < String , Permission > getPermissions ( String tenant ) { } } | if ( ! permissions . containsKey ( tenant ) ) { return new HashMap < > ( ) ; } return permissions . get ( tenant ) ; |
public class AttachSecurityProfileRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( AttachSecurityProfileRequest attachSecurityProfileRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( attachSecurityProfileRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( attachSecurityProfileRequest . getSecurityProfileName ( ) , SECURITYPROFILENAME_BINDING ) ; protocolMarshaller . marshall ( attachSecurityProfileRequest . getSecurityProfileTargetArn ( ) , SECURITYPROFILETARGETARN_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class ReflexiveVerbsRule { /** * Find appropiate pronoun pattern . ( Troba el pronom feble apropiat ) */
@ Nullable private Pattern pronomPattern ( AnalyzedTokenReadings aToken ) { } } | if ( matchPostagRegexp ( aToken , VERB_1S ) && matchPostagRegexp ( aToken , VERB_3S ) ) return PRONOM_FEBLE_13S ; if ( matchPostagRegexp ( aToken , VERB_2S ) && matchPostagRegexp ( aToken , VERB_3S ) ) return PRONOM_FEBLE_23S ; else if ( matchPostagRegexp ( aToken , VERB_1S ) ) return PRONOM_FEBLE_1S ; else if ( matchPostagRegexp ( aToken , VERB_2S ) ) return PRONOM_FEBLE_2S ; else if ( matchPostagRegexp ( aToken , VERB_3S ) ) return PRONOM_FEBLE_3S ; else if ( matchPostagRegexp ( aToken , VERB_1P ) ) return PRONOM_FEBLE_1P ; else if ( matchPostagRegexp ( aToken , VERB_2P ) ) return PRONOM_FEBLE_2P ; else if ( matchPostagRegexp ( aToken , VERB_3P ) ) return PRONOM_FEBLE_3P ; else return null ; |
public class FileSystemDirectory { /** * / * ( non - Javadoc )
* @ see org . apache . lucene . store . Directory # deleteFile ( java . lang . String ) */
public void deleteFile ( String name ) throws IOException { } } | if ( ! fs . delete ( new Path ( directory , name ) ) ) { throw new IOException ( "Cannot delete index file " + name ) ; } |
public class DescribeTransitGatewayRouteTablesResult { /** * Information about the transit gateway route tables .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setTransitGatewayRouteTables ( java . util . Collection ) } or
* { @ link # withTransitGatewayRouteTables ( java . util . Collection ) } if you want to override the existing values .
* @ param transitGatewayRouteTables
* Information about the transit gateway route tables .
* @ return Returns a reference to this object so that method calls can be chained together . */
public DescribeTransitGatewayRouteTablesResult withTransitGatewayRouteTables ( TransitGatewayRouteTable ... transitGatewayRouteTables ) { } } | if ( this . transitGatewayRouteTables == null ) { setTransitGatewayRouteTables ( new com . amazonaws . internal . SdkInternalList < TransitGatewayRouteTable > ( transitGatewayRouteTables . length ) ) ; } for ( TransitGatewayRouteTable ele : transitGatewayRouteTables ) { this . transitGatewayRouteTables . add ( ele ) ; } return this ; |
public class LocaleUtils { /** * Returns the list of available locale suffixes for a message resource
* bundle
* @ param messageBundles
* the message bundles
* @ param fileSuffix
* the file suffix
* @ param servletContext
* the servlet context
* @ return the list of available locale suffixes for a message resource
* bundle */
public static List < String > getAvailableLocaleSuffixes ( String messageBundles , String fileSuffix , ServletContext servletContext ) { } } | Set < String > availableLocaleSuffixes = new HashSet < > ( ) ; Locale [ ] availableLocales = Locale . getAvailableLocales ( ) ; String [ ] msgBundleArray = messageBundles . split ( "\\|" ) ; for ( String messageBundle : msgBundleArray ) { addSuffixIfAvailable ( messageBundle , availableLocaleSuffixes , null , fileSuffix , servletContext ) ; for ( Locale locale : availableLocales ) { addSuffixIfAvailable ( messageBundle , availableLocaleSuffixes , locale , fileSuffix , servletContext ) ; } } return new ArrayList < > ( availableLocaleSuffixes ) ; |
public class ConsumerSessionImpl { /** * ( non - Javadoc )
* @ see com . ibm . wsspi . sib . core . ConsumerSession # start ( boolean ) */
@ Override public void start ( boolean deliverImmediately ) throws SISessionUnavailableException , SISessionDroppedException , SIErrorException { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && CoreSPIConsumerSession . tc . isEntryEnabled ( ) ) SibTr . entry ( CoreSPIConsumerSession . tc , "start" , new Object [ ] { this , Boolean . valueOf ( deliverImmediately ) } ) ; // start the LCP
_localConsumerPoint . start ( deliverImmediately ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( CoreSPIConsumerSession . tc , "start" ) ; |
public class QuartzSchedulerHelper { /** * Get the underlying Quartz scheduler
* @ param bStartAutomatically
* If < code > true < / code > the returned scheduler is automatically
* started . If < code > false < / code > the state is not changed .
* @ return The underlying Quartz scheduler . Never < code > null < / code > . */
@ Nonnull public static IScheduler getScheduler ( final boolean bStartAutomatically ) { } } | try { // Don ' t try to use a name - results in NPE
final IScheduler aScheduler = s_aSchedulerFactory . getScheduler ( ) ; if ( bStartAutomatically && ! aScheduler . isStarted ( ) ) aScheduler . start ( ) ; return aScheduler ; } catch ( final SchedulerException ex ) { throw new IllegalStateException ( "Failed to create" + ( bStartAutomatically ? " and start" : "" ) + " scheduler!" , ex ) ; } |
public class VirtualInterfaceMarshaller { /** * Marshall the given parameter object . */
public void marshall ( VirtualInterface virtualInterface , ProtocolMarshaller protocolMarshaller ) { } } | if ( virtualInterface == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( virtualInterface . getOwnerAccount ( ) , OWNERACCOUNT_BINDING ) ; protocolMarshaller . marshall ( virtualInterface . getVirtualInterfaceId ( ) , VIRTUALINTERFACEID_BINDING ) ; protocolMarshaller . marshall ( virtualInterface . getLocation ( ) , LOCATION_BINDING ) ; protocolMarshaller . marshall ( virtualInterface . getConnectionId ( ) , CONNECTIONID_BINDING ) ; protocolMarshaller . marshall ( virtualInterface . getVirtualInterfaceType ( ) , VIRTUALINTERFACETYPE_BINDING ) ; protocolMarshaller . marshall ( virtualInterface . getVirtualInterfaceName ( ) , VIRTUALINTERFACENAME_BINDING ) ; protocolMarshaller . marshall ( virtualInterface . getVlan ( ) , VLAN_BINDING ) ; protocolMarshaller . marshall ( virtualInterface . getAsn ( ) , ASN_BINDING ) ; protocolMarshaller . marshall ( virtualInterface . getAmazonSideAsn ( ) , AMAZONSIDEASN_BINDING ) ; protocolMarshaller . marshall ( virtualInterface . getAuthKey ( ) , AUTHKEY_BINDING ) ; protocolMarshaller . marshall ( virtualInterface . getAmazonAddress ( ) , AMAZONADDRESS_BINDING ) ; protocolMarshaller . marshall ( virtualInterface . getCustomerAddress ( ) , CUSTOMERADDRESS_BINDING ) ; protocolMarshaller . marshall ( virtualInterface . getAddressFamily ( ) , ADDRESSFAMILY_BINDING ) ; protocolMarshaller . marshall ( virtualInterface . getVirtualInterfaceState ( ) , VIRTUALINTERFACESTATE_BINDING ) ; protocolMarshaller . marshall ( virtualInterface . getCustomerRouterConfig ( ) , CUSTOMERROUTERCONFIG_BINDING ) ; protocolMarshaller . marshall ( virtualInterface . getMtu ( ) , MTU_BINDING ) ; protocolMarshaller . marshall ( virtualInterface . getJumboFrameCapable ( ) , JUMBOFRAMECAPABLE_BINDING ) ; protocolMarshaller . marshall ( virtualInterface . getVirtualGatewayId ( ) , VIRTUALGATEWAYID_BINDING ) ; protocolMarshaller . marshall ( virtualInterface . getDirectConnectGatewayId ( ) , DIRECTCONNECTGATEWAYID_BINDING ) ; protocolMarshaller . marshall ( virtualInterface . getRouteFilterPrefixes ( ) , ROUTEFILTERPREFIXES_BINDING ) ; protocolMarshaller . marshall ( virtualInterface . getBgpPeers ( ) , BGPPEERS_BINDING ) ; protocolMarshaller . marshall ( virtualInterface . getRegion ( ) , REGION_BINDING ) ; protocolMarshaller . marshall ( virtualInterface . getAwsDeviceV2 ( ) , AWSDEVICEV2_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class AWSIotClient { /** * Removes the specified policy from the specified certificate .
* < b > Note : < / b > This API is deprecated . Please use < a > DetachPolicy < / a > instead .
* @ param detachPrincipalPolicyRequest
* The input for the DetachPrincipalPolicy operation .
* @ return Result of the DetachPrincipalPolicy operation returned by the service .
* @ throws ResourceNotFoundException
* The specified resource does not exist .
* @ throws InvalidRequestException
* The request is not valid .
* @ throws ThrottlingException
* The rate exceeds the limit .
* @ throws UnauthorizedException
* You are not authorized to perform this operation .
* @ throws ServiceUnavailableException
* The service is temporarily unavailable .
* @ throws InternalFailureException
* An unexpected error has occurred .
* @ sample AWSIot . DetachPrincipalPolicy */
@ Override @ Deprecated public DetachPrincipalPolicyResult detachPrincipalPolicy ( DetachPrincipalPolicyRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeDetachPrincipalPolicy ( request ) ; |
public class SftpUtil { /** * Returns a SftpClient that is logged in to the sftp server that the
* endpoint is configured against .
* @ param muleContext
* @ param endpointName
* @ return
* @ throws IOException */
static protected SftpClient getSftpClient ( MuleContext muleContext , String endpointName ) throws IOException { } } | ImmutableEndpoint endpoint = getImmutableEndpoint ( muleContext , endpointName ) ; try { SftpClient sftpClient = SftpConnectionFactory . createClient ( endpoint ) ; return sftpClient ; } catch ( Exception e ) { throw new RuntimeException ( "Login failed" , e ) ; } /* EndpointURI endpointURI = endpoint . getEndpointURI ( ) ;
SftpClient sftpClient = new SftpClient ( endpointURI . getHost ( ) ) ;
SftpConnector sftpConnector = ( SftpConnector ) endpoint . getConnector ( ) ;
if ( sftpConnector . getIdentityFile ( ) ! = null ) {
try {
sftpClient . login ( endpointURI . getUser ( ) ,
sftpConnector . getIdentityFile ( ) ,
sftpConnector . getPassphrase ( ) ) ;
} catch ( Exception e ) {
throw new RuntimeException ( " Login failed " , e ) ;
} else {
try {
sftpClient . login ( endpointURI . getUser ( ) ,
endpointURI . getPassword ( ) ) ;
} catch ( Exception e ) {
throw new RuntimeException ( " Login failed " , e ) ;
return sftpClient ; */ |
public class PfafstetterNumber { /** * Checks if the actual pfafstetter object is downstream or not of the passed argument
* @ param pfafstetterNumber the pfafstetterNumber to check against .
* @ return true if the actual obj is downstream of the passed one . */
public boolean isDownStreamOf ( PfafstetterNumber pfafstetterNumber ) { } } | /* * all the upstreams will have same numbers until the last dot */
int lastDot = pfafstetterNumberString . lastIndexOf ( '.' ) ; String pre = pfafstetterNumberString . substring ( 0 , lastDot + 1 ) ; String lastNum = pfafstetterNumberString . substring ( lastDot + 1 , pfafstetterNumberString . length ( ) ) ; int lastNumInt = Integer . parseInt ( lastNum ) ; if ( lastNumInt % 2 == 0 ) { // it has to be the last piece of a river , therefore no piece contained
return false ; } else { /* * check if the passed one is upstream */
String pfaff = pfafstetterNumber . toString ( ) ; if ( pfaff . startsWith ( pre ) ) { // search for all those with a higher next number
String lastPart = pfaff . substring ( lastDot + 1 , pfaff . length ( ) ) ; String lastPartParent = StringUtilities . REGEX_PATTER_DOT . split ( lastPart ) [ 0 ] ; if ( Integer . parseInt ( lastPartParent ) >= lastNumInt ) { return true ; } } } return false ; |
public class RSMessageToClientManager { /** * TODO Je surcharge la methode ici , car sinon le decorator n ' est pas appliqué
* A remonter comme un bug probable
* @ param message
* @ param client
* @ return */
@ Override public MessageToClient createMessageToClient ( MessageFromClient message , HttpSession client ) { } } | return super . createMessageToClient ( message , client ) ; |
public class BasicInfoWindow { /** * resource ids */
private static void setResIds ( Context context ) { } } | String packageName = context . getPackageName ( ) ; // get application package name
mTitleId = context . getResources ( ) . getIdentifier ( "id/bubble_title" , null , packageName ) ; mDescriptionId = context . getResources ( ) . getIdentifier ( "id/bubble_description" , null , packageName ) ; mSubDescriptionId = context . getResources ( ) . getIdentifier ( "id/bubble_subdescription" , null , packageName ) ; mImageId = context . getResources ( ) . getIdentifier ( "id/bubble_image" , null , packageName ) ; if ( mTitleId == UNDEFINED_RES_ID || mDescriptionId == UNDEFINED_RES_ID || mSubDescriptionId == UNDEFINED_RES_ID || mImageId == UNDEFINED_RES_ID ) { Log . e ( IMapView . LOGTAG , "BasicInfoWindow: unable to get res ids in " + packageName ) ; } |
public class SystemObserver { /** * < p > This method returns a { @ link DisplayMetrics } object that contains the attributes of the
* default display of the device that the SDK is running on . Use this when you need to know the
* dimensions of the screen , density of pixels on the display or any other information that
* relates to the device screen . < / p >
* < p > Especially useful when operating without an Activity context , e . g . from a background
* service . < / p >
* @ param context Context .
* @ return < p > A { @ link DisplayMetrics } object representing the default display of the device . < / p >
* @ see DisplayMetrics */
static DisplayMetrics getScreenDisplay ( Context context ) { } } | DisplayMetrics displayMetrics = new DisplayMetrics ( ) ; if ( context != null ) { WindowManager windowManager = ( WindowManager ) context . getSystemService ( Context . WINDOW_SERVICE ) ; if ( windowManager != null ) { Display display = windowManager . getDefaultDisplay ( ) ; display . getMetrics ( displayMetrics ) ; } } return displayMetrics ; |
public class AttributedString { /** * gets an attribute value , but returns an annotation only if it ' s range does not extend outside the range beginIndex . . endIndex */
private Object getAttributeCheckRange ( Attribute attribute , int runIndex , int beginIndex , int endIndex ) { } } | Object value = getAttribute ( attribute , runIndex ) ; if ( value instanceof Annotation ) { // need to check whether the annotation ' s range extends outside the iterator ' s range
if ( beginIndex > 0 ) { int currIndex = runIndex ; int runStart = runStarts [ currIndex ] ; while ( runStart >= beginIndex && valuesMatch ( value , getAttribute ( attribute , currIndex - 1 ) ) ) { currIndex -- ; runStart = runStarts [ currIndex ] ; } if ( runStart < beginIndex ) { // annotation ' s range starts before iterator ' s range
return null ; } } int textLength = length ( ) ; if ( endIndex < textLength ) { int currIndex = runIndex ; int runLimit = ( currIndex < runCount - 1 ) ? runStarts [ currIndex + 1 ] : textLength ; while ( runLimit <= endIndex && valuesMatch ( value , getAttribute ( attribute , currIndex + 1 ) ) ) { currIndex ++ ; runLimit = ( currIndex < runCount - 1 ) ? runStarts [ currIndex + 1 ] : textLength ; } if ( runLimit > endIndex ) { // annotation ' s range ends after iterator ' s range
return null ; } } // annotation ' s range is subrange of iterator ' s range ,
// so we can return the value
} return value ; |
public class CacheConfiguration { /** * 载入缓存配置 ( cache . properties )
* @ return 缓存配置
* @ throws IOException 配置文件读取异常 */
public static CacheConfiguration build ( ) throws IOException { } } | File file = new File ( ClassLoaderUtils . getResourcePath ( "" ) + "cache.properties" ) ; return build ( file ) ; |
public class FileMonitor { /** * Add file to observer for . File may be any java . io . File ( including a
* directory ) and may well be a non - existing file in the case where the
* creating of the file is to be trepped .
* More than one file can be listened for . When the specified file is
* created , modified or deleted , listeners are notified .
* @ param directory the directory to listen for .
* @ param fileNameFilter the file name
* @ param processCurrentFiles whether to process current names */
public synchronized void monitor ( String directory , String fileNameFilter , boolean processCurrentFiles ) { } } | timer . schedule ( new FileMonitorNotifier ( this , directory , fileNameFilter , processCurrentFiles ) , 0 , pollingInterval ) ; |
public class KvStateSerializer { /** * Deserializes the value with the given serializer .
* @ param serializedValue Serialized value of type T
* @ param serializer Serializer for T
* @ param < T > Type of the value
* @ return Deserialized value or < code > null < / code > if the serialized value
* is < code > null < / code >
* @ throws IOException On failure during deserialization */
public static < T > T deserializeValue ( byte [ ] serializedValue , TypeSerializer < T > serializer ) throws IOException { } } | if ( serializedValue == null ) { return null ; } else { final DataInputDeserializer deser = new DataInputDeserializer ( serializedValue , 0 , serializedValue . length ) ; final T value = serializer . deserialize ( deser ) ; if ( deser . available ( ) > 0 ) { throw new IOException ( "Unconsumed bytes in the deserialized value. " + "This indicates a mismatch in the value serializers " + "used by the KvState instance and this access." ) ; } return value ; } |
public class AbstractFeatureAttrProcessor { /** * Determines the feature state
* @ param context the template context
* @ param tag the tag
* @ param attributeName the attribute name
* @ param attributeValue the attribute value
* @ param defaultState the default state if the expression evaluates to null
* @ return the feature state */
protected boolean determineFeatureState ( final ITemplateContext context , final IProcessableElementTag tag , final AttributeName attributeName , final String attributeValue , boolean defaultState ) { } } | final IStandardExpressionParser expressionParser = StandardExpressions . getExpressionParser ( context . getConfiguration ( ) ) ; final IStandardExpression expression = expressionParser . parseExpression ( context , attributeValue ) ; final Object value = expression . execute ( context ) ; if ( value != null ) { return isFeatureActive ( value . toString ( ) ) ; } else { return defaultState ; } |
public class SignatureUtils { /** * Ensure the running application and the target package has the same signature .
* @ param context the running application context .
* @ param targetPackageName the target package name .
* @ return true if the same signature . */
public static boolean ensureSameSignature ( Context context , String targetPackageName ) { } } | return ensureSameSignature ( context , targetPackageName , getSignatureHexCode ( context ) ) ; |
public class TopicBasedCache { /** * Find all registered < code > EventHandler < / code > references that have
* expressed interest in the specified topic .
* @ param topic
* the topic associated with the event to publish
* @ return the ( possibly empty ) list of handlers interested in the topic */
synchronized List < HandlerHolder > findHandlers ( String topic ) { } } | List < HandlerHolder > handlers = new ArrayList < HandlerHolder > ( ) ; List < HandlerHolder > discreteHandlers = discreteEventHandlers . get ( topic ) ; if ( discreteHandlers != null ) { handlers . addAll ( discreteHandlers ) ; } for ( Map . Entry < String , List < HandlerHolder > > entry : wildcardEventHandlers . entrySet ( ) ) { if ( topic . startsWith ( entry . getKey ( ) ) ) { handlers . addAll ( entry . getValue ( ) ) ; } } return handlers ; |
public class Form { /** * Encode the { @ link Form } using the " application / x - www - form - urlencoded " Content - Type .
* Each form parameter is represented as " key = value " where both key and value are url - encoded .
* @ return the url - encoded representation of the form . */
public String toUrlEncodedString ( ) { } } | QueryStringEncoder encoder = new QueryStringEncoder ( "" ) ; for ( Map . Entry < String , String > entry : formValues . entrySet ( ) ) { encoder . addParam ( entry . getKey ( ) , entry . getValue ( ) ) ; } StringBuilder ues = new StringBuilder ( encoder . toString ( ) ) ; if ( ues . length ( ) > 0 && ues . charAt ( 0 ) == '?' ) { ues . deleteCharAt ( 0 ) ; } return ues . toString ( ) ; |
public class Property { /** * Internal : Gets a { @ link Field } with any valid modifier , evaluating its hierarchy .
* @ param type the class from where to search , cannot be null
* @ param name the name of the field to search , cannot be null
* @ param requiredType the required type to match , cannot be null
* @ return the field , if found , else { @ code null } */
private static Field findAccessorField ( Class < ? > type , String name , Class < ? > requiredType ) { } } | Class < ? > current = type ; while ( current != null ) { for ( Field field : current . getDeclaredFields ( ) ) { if ( field . getName ( ) . equals ( name ) && field . getType ( ) . equals ( requiredType ) && ! isStatic ( field ) && ! field . isSynthetic ( ) && ( ! isPrivate ( field ) || field . getDeclaringClass ( ) == type ) ) { return field ; } } current = current . getSuperclass ( ) ; } return null ; |
public class JVnTextPro { /** * Process a file and return the processed text
* pipeline : sentence segmentation , tokenization , tone recover , word segmentation .
* @ param infile data file
* @ return processed text */
public String process ( File infile ) { } } | try { BufferedReader reader = new BufferedReader ( new InputStreamReader ( new FileInputStream ( infile ) , "UTF-8" ) ) ; String line , data = "" ; while ( ( line = reader . readLine ( ) ) != null ) { data += line + "\n" ; } reader . close ( ) ; String ret = process ( data ) ; return ret ; } catch ( Exception e ) { System . out . println ( e . getMessage ( ) ) ; e . printStackTrace ( ) ; return "" ; } |
public class PaytrailService { /** * This function can be used to validate parameters returned by return and notify requests .
* Parameters must be validated in order to avoid hacking of payment confirmation . */
public boolean confirmPayment ( String orderNumber , String timestamp , String paid , String method , String authCode ) { } } | String base = new StringBuilder ( ) . append ( orderNumber ) . append ( '|' ) . append ( timestamp ) . append ( '|' ) . append ( paid ) . append ( '|' ) . append ( method ) . append ( '|' ) . append ( merchantSecret ) . toString ( ) ; return StringUtils . equals ( StringUtils . upperCase ( DigestUtils . md5Hex ( base ) ) , authCode ) ; |
public class RadialPickerLayout { /** * When scroll forward / backward events are received , jump the time to the higher / lower
* discrete , visible value on the circle . */
@ SuppressLint ( "NewApi" ) @ Override public boolean performAccessibilityAction ( int action , Bundle arguments ) { } } | if ( super . performAccessibilityAction ( action , arguments ) ) { return true ; } int changeMultiplier = 0 ; if ( action == AccessibilityNodeInfo . ACTION_SCROLL_FORWARD ) { changeMultiplier = 1 ; } else if ( action == AccessibilityNodeInfo . ACTION_SCROLL_BACKWARD ) { changeMultiplier = - 1 ; } if ( changeMultiplier != 0 ) { int value = getCurrentlyShowingValue ( ) ; int stepSize = 0 ; int currentItemShowing = getCurrentItemShowing ( ) ; if ( currentItemShowing == HOUR_INDEX ) { stepSize = HOUR_VALUE_TO_DEGREES_STEP_SIZE ; value %= 12 ; } else if ( currentItemShowing == MINUTE_INDEX ) { stepSize = MINUTE_VALUE_TO_DEGREES_STEP_SIZE ; } int degrees = value * stepSize ; degrees = snapOnly30s ( degrees , changeMultiplier ) ; value = degrees / stepSize ; int maxValue = 0 ; int minValue = 0 ; if ( currentItemShowing == HOUR_INDEX ) { if ( mIs24HourMode ) { maxValue = 23 ; } else { maxValue = 12 ; minValue = 1 ; } } else { maxValue = 55 ; } if ( value > maxValue ) { // If we scrolled forward past the highest number , wrap around to the lowest .
value = minValue ; } else if ( value < minValue ) { // If we scrolled backward past the lowest number , wrap around to the highest .
value = maxValue ; } setItem ( currentItemShowing , value ) ; mListener . onValueSelected ( currentItemShowing , value , false ) ; return true ; } return false ; |
public class BasicStreamReader { /** * Method called by { @ link com . ctc . wstx . evt . DefaultEventAllocator }
* to get double - indirection necessary for constructing start element
* events .
* @ return Null , if stream does not point to start element ; whatever
* callback returns otherwise . */
@ Override public Object withStartElement ( ElemCallback cb , Location loc ) { } } | if ( mCurrToken != START_ELEMENT ) { return null ; } return cb . withStartElement ( loc , getName ( ) , mElementStack . createNonTransientNsContext ( loc ) , mAttrCollector . buildAttrOb ( ) , mStEmptyElem ) ; |
public class JavascriptEngine { /** * ( non - Javadoc )
* @ see javax . script . Invocable # getInterface ( java . lang . Class ) */
@ Override public < T > T getInterface ( Class < T > clasz ) { } } | return ( ( Invocable ) scriptEngine ) . getInterface ( clasz ) ; |
public class SecurityActions { /** * Execute the given function , in a privileged block if a security manager is checking .
* @ param function the function
* @ param t the first argument to the function
* @ param u the second argument to the function
* @ param < T > the type of the first argument to the function
* @ param < U > the type of the second argument to the function
* @ param < R > the type of the function return value
* @ return the return value of the function */
static < T , U , R > R privilegedExecution ( BiFunction < T , U , R > function , T t , U u ) { } } | return privilegedExecution ( ) . execute ( function , t , u ) ; |
public class Table { /** * Like { @ link # join } but does a straight join with the specified table . */
public final Cursor < T > straightJoin ( Connection conn , String table , String condition ) { } } | String query = "select " + listOfFields + " from " + name + " straight_join " + table + " " + condition ; return new Cursor < T > ( this , conn , query ) ; |
public class Optional { /** * Returns an { @ code Optional } with the specified present non - null value .
* @ param < T > the class of the value
* @ param value the value to be present , which must be non - null
* @ return an { @ code Optional } with the value present
* @ throws NullPointerException if value is null */
public static < T > Optional < T > of ( T value ) { } } | return new Optional < > ( Objects . requireNonNull ( value ) ) ; |
public class AcePathfinderUtil { /** * Renames a date variable from an event */
public static String getEventDateVar ( String event , String var ) { } } | var = var . toLowerCase ( ) ; if ( event == null || var . endsWith ( "date" ) || var . endsWith ( "dat" ) ) return var ; if ( event . equals ( "planting" ) ) { var = "pdate" ; } else if ( event . equals ( "irrigation" ) ) { var = "idate" ; } else if ( event . equals ( "fertilizer" ) ) { var = "fedate" ; } else if ( event . equals ( "tillage" ) ) { var = "tdate" ; } else if ( event . equals ( "harvest" ) ) { var = "hadat" ; } else if ( event . equals ( "organic_matter" ) ) { var = "omdat" ; } else if ( event . equals ( "chemicals" ) ) { var = "cdate" ; } else if ( event . equals ( "mulch-apply" ) ) { var = "mladat" ; } else if ( event . equals ( "mulch-remove" ) ) { var = "mlrdat" ; } return var ; |
public class SummernoteInitEvent { /** * Fires a summernote init event on all registered handlers in the handler
* manager . If no such handlers exist , this method will do nothing .
* @ param source the source of the handlers */
public static void fire ( final HasSummernoteInitHandlers source ) { } } | if ( TYPE != null ) { SummernoteInitEvent event = new SummernoteInitEvent ( ) ; source . fireEvent ( event ) ; } |
public class DACLAssertor { /** * Evaluates whether the DACL fulfills the given AdRoleAssertion and returns the list of unsatisfied AceAssertions
* ( if any ) .
* If the assertor was constructed with { @ code searchGroups = true } and the roleAssertion specifies a user , then
* all group SIDs contained in the roleAssertion will be tested for potential matches in the DACL if any rights are
* not directly granted to the user .
* @ param roleAssertion
* the AdRoleAssertion to test
* @ return List of unsatisfied AceAssertions ( if any ) . Empty if none . */
private List < AceAssertion > findUnsatisfiedAssertions ( final AdRoleAssertion roleAssertion ) { } } | HashMap < String , List < ACE > > acesBySIDMap = new HashMap < String , List < ACE > > ( ) ; for ( int i = 0 ; i < dacl . getAceCount ( ) ; i ++ ) { final ACE ace = dacl . getAce ( i ) ; LOG . trace ( "ACE {}: {}" , i , ace ) ; if ( ace . getSid ( ) != null ) { if ( ! acesBySIDMap . containsKey ( ace . getSid ( ) . toString ( ) ) ) { acesBySIDMap . put ( ace . getSid ( ) . toString ( ) , new ArrayList < ACE > ( ) ) ; } List < ACE > aces = acesBySIDMap . get ( ace . getSid ( ) . toString ( ) ) ; aces . add ( ace ) ; } } // Find any roleAssertion ACEs not matched in the DACL .
// Not using Java 8 or other libs for this to keep dependencies of ADSDDL as is .
List < AceAssertion > unsatisfiedAssertions = new ArrayList < > ( roleAssertion . getAssertions ( ) ) ; SID principal = roleAssertion . getPrincipal ( ) ; List < ACE > principalAces = acesBySIDMap . get ( principal . toString ( ) ) ; if ( principalAces == null ) { LOG . debug ( "findUnsatisfiedAssertions, no ACEs matching principal {} in DACL, will attempt to search member " + "groups" , principal ) ; } else { findUnmatchedAssertions ( principalAces , unsatisfiedAssertions ) ; LOG . debug ( "findUnsatisfiedAssertions, {} unsatisfied assertion(s) remain after checking the DACL against " + "principal {}, searching member groups if > 0" , unsatisfiedAssertions . size ( ) , principal ) ; } if ( ! unsatisfiedAssertions . isEmpty ( ) && searchGroups ) { if ( roleAssertion . isGroup ( ) ) { LOG . warn ( "findUnsatisfiedAssertions, unresolved assertions exist and requested to search member groups, " + "but the principal is a group - returning" ) ; return unsatisfiedAssertions ; } List < SID > tokenGroupSIDs = roleAssertion . getTokenGroups ( ) ; if ( tokenGroupSIDs == null ) { LOG . debug ( "findUnsatisfiedAssertions, unresolved assertions exist and no token groups found in " + "AdRoleAssertion - returning" ) ; return unsatisfiedAssertions ; } int groupCount = 1 ; for ( SID grpSID : tokenGroupSIDs ) { principalAces = acesBySIDMap . get ( grpSID . toString ( ) ) ; if ( principalAces == null ) { continue ; } LOG . debug ( "findUnsatisfiedAssertions, {} ACEs of group {}" , principalAces . size ( ) , grpSID ) ; findUnmatchedAssertions ( principalAces , unsatisfiedAssertions ) ; if ( unsatisfiedAssertions . isEmpty ( ) ) { LOG . info ( "findUnsatisfiedAssertions, all role assertions found in the DACL after searching {} " + "group(s)" , groupCount ) ; break ; } groupCount ++ ; } } return unsatisfiedAssertions ; |
public class RedisClusterStorage { /** * Pause all of the < code > { @ link Job } s < / code > in the given group - by pausing all of their
* < code > Trigger < / code > s .
* @ param groupMatcher the mather which will determine which job group should be paused
* @ param jedis a thread - safe Redis connection
* @ return a collection of names of job groups which have been paused
* @ throws JobPersistenceException */
@ Override public Collection < String > pauseJobs ( GroupMatcher < JobKey > groupMatcher , JedisCluster jedis ) throws JobPersistenceException { } } | Set < String > pausedJobGroups = new HashSet < > ( ) ; if ( groupMatcher . getCompareWithOperator ( ) == StringMatcher . StringOperatorName . EQUALS ) { final String jobGroupSetKey = redisSchema . jobGroupSetKey ( new JobKey ( "" , groupMatcher . getCompareToValue ( ) ) ) ; if ( jedis . sadd ( redisSchema . pausedJobGroupsSet ( ) , jobGroupSetKey ) > 0 ) { pausedJobGroups . add ( redisSchema . jobGroup ( jobGroupSetKey ) ) ; for ( String job : jedis . smembers ( jobGroupSetKey ) ) { pauseJob ( redisSchema . jobKey ( job ) , jedis ) ; } } } else { Map < String , Set < String > > jobGroups = new HashMap < > ( ) ; for ( final String jobGroupSetKey : jedis . smembers ( redisSchema . jobGroupsSet ( ) ) ) { if ( groupMatcher . getCompareWithOperator ( ) . evaluate ( redisSchema . jobGroup ( jobGroupSetKey ) , groupMatcher . getCompareToValue ( ) ) ) { jobGroups . put ( jobGroupSetKey , jedis . smembers ( jobGroupSetKey ) ) ; } } for ( final Map . Entry < String , Set < String > > entry : jobGroups . entrySet ( ) ) { if ( jedis . sadd ( redisSchema . pausedJobGroupsSet ( ) , entry . getKey ( ) ) > 0 ) { // This job group was not already paused . Pause it now .
pausedJobGroups . add ( redisSchema . jobGroup ( entry . getKey ( ) ) ) ; for ( final String jobHashKey : entry . getValue ( ) ) { pauseJob ( redisSchema . jobKey ( jobHashKey ) , jedis ) ; } } } } return pausedJobGroups ; |
public class InboundTransmissionParser { /** * Resets the state of the parsing state machine so that it is read to
* parse another transmission . */
private void reset ( ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "reset" ) ; throwable = null ; state = STATE_PARSING_PRIMARY_HEADER ; unparsedPrimaryHeader . position ( 0 ) ; unparsedPrimaryHeader . limit ( JFapChannelConstants . SIZEOF_PRIMARY_HEADER ) ; unparsedConversationHeader . position ( 0 ) ; unparsedConversationHeader . limit ( JFapChannelConstants . SIZEOF_CONVERSATION_HEADER ) ; unparsedFirstSegment . position ( 0 ) ; unparsedFirstSegment . limit ( JFapChannelConstants . SIZEOF_SEGMENT_START_HEADER ) ; unparsedPayloadData = null ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "reset" ) ; |
public class LDLTPermutedFactorization { /** * Diagonal pivoting method .
* @ see " STABILITY OF THE DIAGONAL PIVOTING METHOD WITH PARTIAL PIVOTING " 1.1 */
private void pldltpt ( ) throws Exception { } } | // matrix S will be changed by the factorization , ad we do not want to change the matrix passed in by the client
DoubleMatrix2D S = ( rescaler == null ) ? this . Q . copy ( ) : this . Q ; int n = S . rows ( ) ; DoubleMatrix2D A = S . copy ( ) ; this . P = DoubleFactory2D . sparse . identity ( n ) ; this . D = DoubleFactory2D . sparse . make ( n , n ) ; this . L = DoubleFactory2D . sparse . make ( n , n ) ; DoubleMatrix2D LT = ALG . transpose ( L ) ; // remove and work only with L
int s = 0 ; for ( int j = 0 ; j < n ; j ++ ) { // log . debug ( " j : " + j ) ;
DoubleMatrix2D LPart = null ; DoubleMatrix2D LTPart = null ; DoubleMatrix2D APart = null ; DoubleMatrix2D DPart = null ; double ajj = A . getQuick ( j , j ) ; if ( Math . abs ( ajj ) > 1.e-16 ) { // 1 x pivot
D . setQuick ( j , j , ajj ) ; s = 1 ; } else { // ajj = 0 , so the 2x2 matrix with ajj in its upper left position
// is non singular if a ( j + 1 , j ) = a ( j , j + 1 ) ! = 0
int k = - 1 ; for ( int r = j + 1 ; r < n ; r ++ ) { if ( Math . abs ( A . getQuick ( r , j ) ) > 1.e-16 ) { k = r ; break ; } } if ( k < 0 ) { throw new Exception ( "singular matrix" ) ; } // Symmetrically permute row / column k to position j + 1.
A = ColtUtils . symmPermutation ( A , k , j + 1 ) ; P . setQuick ( k , k , 0 ) ; P . setQuick ( j + 1 , j + 1 , 0 ) ; P . setQuick ( k , j + 1 , 1 ) ; P . setQuick ( j + 1 , k , 1 ) ; // Choose a 2 � 2 pivot ,
// D ( j : j + 1 ) ( j : j + 1 ) = A ( j : j + 1 ) ( j : j + 1)
D . setQuick ( j , j , A . getQuick ( j , j ) ) ; D . setQuick ( j , j + 1 , A . getQuick ( j , j + 1 ) ) ; D . setQuick ( j + 1 , j , A . getQuick ( j + 1 , j ) ) ; D . setQuick ( j + 1 , j + 1 , A . getQuick ( j + 1 , j + 1 ) ) ; s = 2 ; } // log . debug ( " s : " + s ) ;
// L ( j : n ) ( j : j + s - 1 ) = A ( j : n ) ( j : j + s - 1 ) . DInv ( j : j + s - 1 ) ( j : j + s - 1)
APart = A . viewPart ( j , j , n - j , 1 + s - 1 ) ; DPart = ALG . inverse ( D . viewPart ( j , j , 1 + s - 1 , 1 + s - 1 ) ) ; LPart = L . viewPart ( j , j , n - j , 1 + s - 1 ) ; DoubleMatrix2D AD = ALG . mult ( APart , DPart ) ; for ( int r = 0 ; r < LPart . rows ( ) ; r ++ ) { for ( int c = 0 ; c < LPart . columns ( ) ; c ++ ) { LPart . setQuick ( r , c , AD . getQuick ( r , c ) ) ; } } // A ( j + s - 1 : n ) ( j + s - 1 : n ) = A ( j + s - 1 : n ) ( j + s - 1 : n ) - L ( j + s - 1 : n ) ( j : j + s - 1 ) . D ( j : j + s - 1 ) ( j : j + s - 1 ) . LT ( j : j + s - 1 ) ( j + s - 1 : n )
LPart = L . viewPart ( j + s - 1 , j , n - ( j + s - 1 ) , 1 + s - 1 ) ; DPart = D . viewPart ( j , j , 1 + s - 1 , 1 + s - 1 ) ; LTPart = LT . viewPart ( j , j + s - 1 , s , n - ( j + s - 1 ) ) ; APart = A . viewPart ( j + s - 1 , j + s - 1 , n - ( j + s - 1 ) , n - ( j + s - 1 ) ) ; DoubleMatrix2D LDLT = ALG . mult ( LPart , ALG . mult ( DPart , LTPart ) ) ; for ( int r = 0 ; r < APart . rows ( ) ; r ++ ) { for ( int c = 0 ; c < APart . columns ( ) ; c ++ ) { APart . setQuick ( r , c , APart . getQuick ( r , c ) - LDLT . getQuick ( r , c ) ) ; } } // logger . debug ( " L : " + ArrayUtils . toString ( L . toArray ( ) ) ) ;
// logger . debug ( " A : " + ArrayUtils . toString ( A . toArray ( ) ) ) ;
j = j + s - 1 ; } |
public class Client { /** * Log a user out of any and all sessions .
* @ param id
* Id of the user to be modified
* @ return true if success
* @ throws OAuthSystemException - if there is a IOException reading parameters of the httpURLConnection
* @ throws OAuthProblemException - if there are errors validating the OneloginOAuthJSONResourceResponse and throwOAuthProblemException is enabled
* @ throws URISyntaxException - if there is an error when generating the target URL at the URIBuilder constructor
* @ see < a target = " _ blank " href = " https : / / developers . onelogin . com / api - docs / 1 / users / log - user - out " > Log User Out documentation < / a > */
public Boolean logUserOut ( long id ) throws OAuthSystemException , OAuthProblemException , URISyntaxException { } } | cleanError ( ) ; prepareToken ( ) ; OneloginURLConnectionClient httpClient = new OneloginURLConnectionClient ( ) ; OAuthClient oAuthClient = new OAuthClient ( httpClient ) ; URIBuilder url = new URIBuilder ( settings . getURL ( Constants . LOG_USER_OUT_URL , Long . toString ( id ) ) ) ; OAuthClientRequest bearerRequest = new OAuthBearerClientRequest ( url . toString ( ) ) . buildHeaderMessage ( ) ; Map < String , String > headers = getAuthorizedHeader ( ) ; bearerRequest . setHeaders ( headers ) ; Boolean success = true ; OneloginOAuthJSONResourceResponse oAuthResponse = oAuthClient . resource ( bearerRequest , OAuth . HttpMethod . PUT , OneloginOAuthJSONResourceResponse . class ) ; if ( oAuthResponse . getResponseCode ( ) != 200 ) { success = false ; error = oAuthResponse . getError ( ) ; errorDescription = oAuthResponse . getErrorDescription ( ) ; errorAttribute = oAuthResponse . getErrorAttribute ( ) ; } return success ; |
public class MP3FileID3Controller { /** * Set the text of the text frame specified by the id ( id3v2 only ) . The
* id should be one of the static strings specifed in ID3v2Frames class .
* All id ' s that begin with ' T ' ( excluding " TXXX " ) are considered text
* frames .
* @ param id the id of the frame to set the data for
* @ param data the data to set */
public void setTextFrame ( String id , String data ) { } } | if ( allow ( ID3V2 ) ) { id3v2 . setTextFrame ( id , data ) ; } |
public class Jenkins { /** * Gets the { @ link JobPropertyDescriptor } by name . Primarily used for making them web - visible . */
public JobPropertyDescriptor getJobProperty ( String shortClassName ) { } } | // combining these two lines triggers javac bug . See issue # 610.
Descriptor d = findDescriptor ( shortClassName , JobPropertyDescriptor . all ( ) ) ; return ( JobPropertyDescriptor ) d ; |
public class UrlCopy { /** * Performs the copy function .
* Source and destination urls must be specified otherwise
* a exception is thrown . Also , if source and destination url
* are ftp urls and thirdPartyCopy is enabled , third party transfer
* will be performed . Urls , of course , must be of supported protocol .
* Currently , gsiftp , ftp , https , http , and file are supported .
* This method does not cause the { @ link UrlCopyListener # transferCompleted ( ) }
* and { @ link UrlCopyListener # transferError ( Exception ) } to be called . If you want
* completion / failures to be signaled asynchronously , either call the
* { @ link # run } method or wrap this object in a { @ link Thread } .
* @ throws UrlCopyException in case of an error . */
public void copy ( ) throws UrlCopyException { } } | if ( srcUrl == null ) { throw new UrlCopyException ( "Source url is not specified" ) ; } if ( dstUrl == null ) { throw new UrlCopyException ( "Destination url is not specified" ) ; } String fromP = srcUrl . getProtocol ( ) ; String toP = dstUrl . getProtocol ( ) ; if ( thirdParty && fromP . endsWith ( "ftp" ) && toP . endsWith ( "ftp" ) ) { thirdPartyTransfer ( ) ; return ; } GlobusInputStream in = null ; GlobusOutputStream out = null ; boolean rs = false ; try { in = getInputStream ( ) ; long size = in . getSize ( ) ; if ( size == - 1 ) { logger . debug ( "Source size: unknown" ) ; } else { logger . debug ( "Source size: " + size ) ; } out = getOutputStream ( size ) ; rs = transfer ( size , in , out ) ; in . close ( ) ; out . close ( ) ; } catch ( Exception e ) { if ( out != null ) out . abort ( ) ; if ( in != null ) in . abort ( ) ; throw new UrlCopyException ( "UrlCopy transfer failed." , e ) ; } if ( ! rs && isCanceled ( ) ) { throw new UrlCopyException ( "Transfer Aborted" ) ; } |
public class CacheConfigurationBuilder { /** * Adds a { @ link Serializer } for cache values to the configured builder .
* { @ link Serializer } s are what enables cache storage beyond the heap tier .
* @ param valueSerializer the key serializer to use
* @ return a new builder with the added value serializer */
public CacheConfigurationBuilder < K , V > withValueSerializer ( Serializer < V > valueSerializer ) { } } | return withSerializer ( new DefaultSerializerConfiguration < > ( requireNonNull ( valueSerializer , "Null value serializer" ) , DefaultSerializerConfiguration . Type . VALUE ) ) ; |
public class Client { /** * Return the highest timestamp in the stored metrics .
* @ return The highest timestamp in the stored metrics . */
@ Override public DateTime getEnd ( ) { } } | try { final rh_protoClient client = getRpcClient ( OncRpcProtocols . ONCRPC_UDP ) ; try { return decodeTimestamp ( BlockingWrapper . execute ( ( ) -> client . getEnd_1 ( ) ) ) ; } finally { client . close ( ) ; } } catch ( OncRpcException | IOException | InterruptedException | RuntimeException ex ) { LOG . log ( Level . SEVERE , "getEnd RPC call failed" , ex ) ; throw new RuntimeException ( "RPC call failed" , ex ) ; } |
public class DirectionSplittingMentionEditor { /** * split the mention using the directions */
public Set < String > editMention ( String mention ) { } } | Set < String > result = new HashSet < String > ( ) ; // tokenize
StringTokenizer tokens = new StringTokenizer ( mention , delims , false ) ; List < String > tokenList = new LinkedList < String > ( ) ; if ( tokens . countTokens ( ) < 3 ) return result ; while ( tokens . hasMoreTokens ( ) ) { tokenList . add ( tokens . nextToken ( ) ) ; } String first = tokenList . get ( 0 ) ; String second = tokenList . get ( 1 ) ; String third = tokenList . get ( 2 ) ; if ( second . equals ( "and" ) || second . equals ( "or" ) || second . equals ( "to" ) ) { if ( directions . contains ( first ) && directions . contains ( third ) ) { // log . info ( first + " " + second + " " + third + " Full : " + s
int spot = mention . indexOf ( third ) + third . length ( ) ; result . add ( first + mention . substring ( spot ) ) ; result . add ( third + mention . substring ( spot ) ) ; } } return result ; |
public class AuthenticationProviderService { /** * Returns an AuthenticatedUser representing the user authenticated by the
* given credentials .
* @ param credentials
* The credentials to use for authentication .
* @ return
* An AuthenticatedUser representing the user authenticated by the
* given credentials .
* @ throws GuacamoleException
* If an error occurs while authenticating the user , or if access is
* denied . */
public AuthenticatedUser authenticateUser ( Credentials credentials ) throws GuacamoleException { } } | String username = null ; // Validate OpenID token in request , if present , and derive username
HttpServletRequest request = credentials . getRequest ( ) ; if ( request != null ) { String token = request . getParameter ( TokenField . PARAMETER_NAME ) ; if ( token != null ) username = tokenService . processUsername ( token ) ; } // If the username was successfully retrieved from the token , produce
// authenticated user
if ( username != null ) { // Create corresponding authenticated user
AuthenticatedUser authenticatedUser = authenticatedUserProvider . get ( ) ; authenticatedUser . init ( username , credentials ) ; return authenticatedUser ; } // Request OpenID token
throw new GuacamoleInvalidCredentialsException ( "Invalid login." , new CredentialsInfo ( Arrays . asList ( new Field [ ] { // OpenID - specific token ( will automatically redirect the user
// to the authorization page via JavaScript )
new TokenField ( confService . getAuthorizationEndpoint ( ) , confService . getScope ( ) , confService . getClientID ( ) , confService . getRedirectURI ( ) , nonceService . generate ( confService . getMaxNonceValidity ( ) * 60000L ) ) } ) ) ) ; |
public class HiveAvroORCQueryGenerator { /** * Generate DDL for dropping partitions of a table .
* ALTER TABLE finalTableName DROP IF EXISTS PARTITION partition _ spec , PARTITION partition _ spec , . . . ;
* @ param finalTableName Table name where partitions are dropped
* @ param partitionDMLInfos list of Partition to be dropped
* @ return DDL to drop partitions in < code > finalTableName < / code > */
public static List < String > generateDropPartitionsDDL ( final String dbName , final String finalTableName , final List < Map < String , String > > partitionDMLInfos ) { } } | if ( partitionDMLInfos . isEmpty ( ) ) { return Collections . emptyList ( ) ; } List < String > ddls = Lists . newArrayList ( ) ; ddls . add ( String . format ( "USE %s %n" , dbName ) ) ; // Join the partition specs
ddls . add ( String . format ( "ALTER TABLE %s DROP IF EXISTS %s" , finalTableName , Joiner . on ( "," ) . join ( Iterables . transform ( partitionDMLInfos , PARTITION_SPEC_GENERATOR ) ) ) ) ; return ddls ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.