signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class ServicesInner { /** * Start service . * The services resource is the top - level resource that represents the Data Migration Service . This action starts the service and the service can be used for data migration . * @ param groupName Name of the resource group * @ param serviceName Name of the service * @ throws IllegalArgumentException thrown if parameters fail the validation * @ throws ApiErrorException thrown if the request is rejected by server * @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent */ public void start ( String groupName , String serviceName ) { } }
startWithServiceResponseAsync ( groupName , serviceName ) . toBlocking ( ) . last ( ) . body ( ) ;
public class MethodCompiler { /** * Store into local variable * < p > Stack : . . . , value = & gt ; . . . * @ param name local variable name * @ throws IOException * @ see nameArgument * @ see addVariable */ public void tstore ( String name ) throws IOException { } }
TypeMirror cn = getLocalType ( name ) ; int index = getLocalVariableIndex ( name ) ; if ( Typ . isPrimitive ( cn ) ) { tstore ( cn , index ) ; } else { astore ( index ) ; }
public class BufferMgr { /** * Unpins the specified buffer . If the buffer ' s pin count becomes 0 , then * the threads on the wait list are notified . * @ param buff * the buffer to be unpinned */ public void unpin ( Buffer buff ) { } }
BlockId blk = buff . block ( ) ; PinnedBuffer pinnedBuff = pinnedBuffers . get ( blk ) ; if ( pinnedBuff != null ) { pinnedBuff . pinnedCount -- ; if ( pinnedBuff . pinnedCount == 0 ) { bufferPool . unpin ( buff ) ; pinnedBuffers . remove ( blk ) ; synchronized ( bufferPool ) { bufferPool . notifyAll ( ) ; } } }
public class ReplacedStepTree { /** * This happens when a SqlgVertexStep has a SelectOne step where the label is for an element on the path * that is before the current optimized steps . * @ return */ public boolean orderByHasSelectOneStepAndForLabelNotInTree ( ) { } }
Set < String > labels = new HashSet < > ( ) ; for ( ReplacedStep < ? , ? > replacedStep : linearPathToLeafNode ( ) ) { for ( String label : labels ) { labels . add ( SqlgUtil . originalLabel ( label ) ) ; } for ( Pair < Traversal . Admin < ? , ? > , Comparator < ? > > objects : replacedStep . getSqlgComparatorHolder ( ) . getComparators ( ) ) { Traversal . Admin < ? , ? > traversal = objects . getValue0 ( ) ; if ( traversal . getSteps ( ) . size ( ) == 1 && traversal . getSteps ( ) . get ( 0 ) instanceof SelectOneStep ) { // xxxxx . select ( " a " ) . order ( ) . by ( select ( " a " ) . by ( " name " ) , Order . decr ) SelectOneStep selectOneStep = ( SelectOneStep ) traversal . getSteps ( ) . get ( 0 ) ; Preconditions . checkState ( selectOneStep . getScopeKeys ( ) . size ( ) == 1 , "toOrderByClause expects the selectOneStep to have one scopeKey!" ) ; Preconditions . checkState ( selectOneStep . getLocalChildren ( ) . size ( ) == 1 , "toOrderByClause expects the selectOneStep to have one traversal!" ) ; Preconditions . checkState ( selectOneStep . getLocalChildren ( ) . get ( 0 ) instanceof ElementValueTraversal || selectOneStep . getLocalChildren ( ) . get ( 0 ) instanceof TokenTraversal , "toOrderByClause expects the selectOneStep's traversal to be a ElementValueTraversal or a TokenTraversal!" ) ; String selectKey = ( String ) selectOneStep . getScopeKeys ( ) . iterator ( ) . next ( ) ; if ( ! labels . contains ( selectKey ) ) { return true ; } } } } return false ;
public class ContentType { /** * < p > getInstance . < / p > * @ param type a { @ link java . lang . String } object . * @ return a { @ link com . greenpepper . server . domain . component . ContentType } object . */ public static ContentType getInstance ( String type ) { } }
if ( type . equals ( TEST . toString ( ) ) ) { return TEST ; } else if ( type . equals ( REQUIREMENT . toString ( ) ) ) { return REQUIREMENT ; } else if ( type . equals ( BOTH . toString ( ) ) ) { return BOTH ; } return UNKNOWN ;
public class CommerceSubscriptionEntryPersistenceImpl { /** * Returns the last commerce subscription entry in the ordered set where groupId = & # 63 ; . * @ param groupId the group ID * @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > ) * @ return the last matching commerce subscription entry * @ throws NoSuchSubscriptionEntryException if a matching commerce subscription entry could not be found */ @ Override public CommerceSubscriptionEntry findByGroupId_Last ( long groupId , OrderByComparator < CommerceSubscriptionEntry > orderByComparator ) throws NoSuchSubscriptionEntryException { } }
CommerceSubscriptionEntry commerceSubscriptionEntry = fetchByGroupId_Last ( groupId , orderByComparator ) ; if ( commerceSubscriptionEntry != null ) { return commerceSubscriptionEntry ; } StringBundler msg = new StringBundler ( 4 ) ; msg . append ( _NO_SUCH_ENTITY_WITH_KEY ) ; msg . append ( "groupId=" ) ; msg . append ( groupId ) ; msg . append ( "}" ) ; throw new NoSuchSubscriptionEntryException ( msg . toString ( ) ) ;
public class UserInfo { /** * Get the table name . */ public String getTableNames ( boolean bAddQuotes ) { } }
return ( m_tableName == null ) ? Record . formatTableNames ( USER_INFO_FILE , bAddQuotes ) : super . getTableNames ( bAddQuotes ) ;
public class GosuStringUtil { /** * < p > Right pad a String with a specified String . < / p > * < p > The String is padded to the size of < code > size < / code > . < / p > * < pre > * GosuStringUtil . rightPad ( null , * , * ) = null * GosuStringUtil . rightPad ( " " , 3 , " z " ) = " zzz " * GosuStringUtil . rightPad ( " bat " , 3 , " yz " ) = " bat " * GosuStringUtil . rightPad ( " bat " , 5 , " yz " ) = " batyz " * GosuStringUtil . rightPad ( " bat " , 8 , " yz " ) = " batyzyzy " * GosuStringUtil . rightPad ( " bat " , 1 , " yz " ) = " bat " * GosuStringUtil . rightPad ( " bat " , - 1 , " yz " ) = " bat " * GosuStringUtil . rightPad ( " bat " , 5 , null ) = " bat " * GosuStringUtil . rightPad ( " bat " , 5 , " " ) = " bat " * < / pre > * @ param str the String to pad out , may be null * @ param size the size to pad to * @ param padStr the String to pad with , null or empty treated as single space * @ return right padded String or original String if no padding is necessary , * < code > null < / code > if null String input */ public static String rightPad ( String str , int size , String padStr ) { } }
if ( str == null ) { return null ; } if ( isEmpty ( padStr ) ) { padStr = " " ; } int padLen = padStr . length ( ) ; int strLen = str . length ( ) ; int pads = size - strLen ; if ( pads <= 0 ) { return str ; // returns original String when possible } if ( padLen == 1 && pads <= PAD_LIMIT ) { return rightPad ( str , size , padStr . charAt ( 0 ) ) ; } if ( pads == padLen ) { return str . concat ( padStr ) ; } else if ( pads < padLen ) { return str . concat ( padStr . substring ( 0 , pads ) ) ; } else { char [ ] padding = new char [ pads ] ; char [ ] padChars = padStr . toCharArray ( ) ; for ( int i = 0 ; i < pads ; i ++ ) { padding [ i ] = padChars [ i % padLen ] ; } return str . concat ( new String ( padding ) ) ; }
public class CalendarPicker { /** * / * [ deutsch ] * < p > Erzeugt einen neuen { @ code CalendarPicker } f & uuml ; r den hebr & auml ; ischen ( j & uuml ; dischen ) Kalender . < / p > * @ param locale the language and country configuration * @ param todaySupplier determines the current calendar date * @ return CalendarPicker * @ since 4.36 */ public static CalendarPicker < HebrewCalendar > hebrew ( Locale locale , Supplier < HebrewCalendar > todaySupplier ) { } }
return CalendarPicker . create ( HebrewCalendar . axis ( ) , new FXCalendarSystemHebrew ( ) , locale , todaySupplier ) ;
public class JSONObject { /** * Equivalent to { @ code put ( name , value ) } when both parameters are non - null ; does * nothing otherwise . * @ param name the name of the property * @ param value the value of the property * @ return this object . * @ throws JSONException if an error occurs */ public JSONObject putOpt ( String name , Object value ) throws JSONException { } }
if ( name == null || value == null ) { return this ; } return put ( name , value ) ;
public class JpaToOneRelation { private String getManyToOneCascade ( ) { } }
Assert . isTrue ( relation . isManyToOne ( ) ) ; return jpaCascade ( this , relation . getFromAttribute ( ) . getColumnConfig ( ) . getManyToOneConfig ( ) , relation . getFromEntity ( ) . getConfig ( ) . getCelerio ( ) . getConfiguration ( ) . getDefaultManyToOneConfig ( ) ) ;
public class ParaProcessorBuilder { /** * 注册一个类型对应的参数获取器 * ParameterGetterBuilder . me ( ) . regist ( java . lang . String . class , StringParaGetter . class , null ) ; * @ param typeClass 类型 , 例如 java . lang . Integer . class * @ param pgClass 参数获取器实现类 , 必须继承ParaGetter * @ param defaultValue , 默认值 , 比如int的默认值为0 , java . lang . Integer的默认值为null */ public < T > void regist ( Class < T > typeClass , Class < ? extends ParaGetter < T > > pgClass , String defaultValue ) { } }
this . typeMap . put ( typeClass . getName ( ) , new Holder ( pgClass , defaultValue ) ) ;
public class DateAdapter { /** * SECTION : PRE - PROCESSING */ protected String beforeParse ( String string ) { } }
if ( preParseCallback == null ) { return string ; } return preParseCallback . process ( string ) ;
public class SqlParamUtils { /** * SQLパラメータの解析 * @ param sql 解析対象SQL * @ return SQLを解析して取得したパラメータキーのセット */ public static Set < String > getSqlParams ( final String sql ) { } }
SqlParser parser = new SqlParserImpl ( sql ) ; ContextTransformer transformer = parser . parse ( ) ; Node rootNode = transformer . getRoot ( ) ; Set < String > params = new LinkedHashSet < > ( ) ; traverseNode ( rootNode , params ) ; params . removeIf ( s -> CONSTANT_PAT . matcher ( s ) . matches ( ) ) ; return params ;
public class LogManager { /** * Attemps to delete all provided segments from a log and returns how many it was able to */ private int deleteSegments ( Log log , List < LogSegment > segments ) { } }
int total = 0 ; for ( LogSegment segment : segments ) { boolean deleted = false ; try { try { segment . getMessageSet ( ) . close ( ) ; } catch ( IOException e ) { logger . warn ( e . getMessage ( ) , e ) ; } if ( ! segment . getFile ( ) . delete ( ) ) { deleted = true ; } else { total += 1 ; } } finally { logger . warn ( String . format ( "DELETE_LOG[%s] %s => %s" , log . name , segment . getFile ( ) . getAbsolutePath ( ) , deleted ) ) ; } } return total ;
public class DRL6StrictParser { /** * positionalConstraints : = constraint ( COMMA constraint ) * SEMICOLON * @ param pattern * @ throws org . antlr . runtime . RecognitionException */ private void positionalConstraints ( PatternDescrBuilder < ? > pattern ) throws RecognitionException { } }
constraint ( pattern , true , "" ) ; if ( state . failed ) return ; while ( input . LA ( 1 ) == DRL6Lexer . COMMA ) { match ( input , DRL6Lexer . COMMA , null , null , DroolsEditorType . SYMBOL ) ; if ( state . failed ) return ; constraint ( pattern , true , "" ) ; if ( state . failed ) return ; } match ( input , DRL6Lexer . SEMICOLON , null , null , DroolsEditorType . SYMBOL ) ; if ( state . failed ) return ;
public class FlowConfigV2Client { /** * Delete a flow configuration * @ param flowId identifier of flow configuration to delete * @ throws RemoteInvocationException */ public void deleteFlowConfigWithStateStore ( FlowId flowId ) throws RemoteInvocationException { } }
LOG . debug ( "deleteFlowConfig and state store with groupName " + flowId . getFlowGroup ( ) + " flowName " + flowId . getFlowName ( ) ) ; DeleteRequest < FlowConfig > deleteRequest = _flowconfigsV2RequestBuilders . delete ( ) . id ( new ComplexResourceKey < > ( flowId , new FlowStatusId ( ) ) ) . setHeader ( DELETE_STATE_STORE_KEY , Boolean . TRUE . toString ( ) ) . build ( ) ; ResponseFuture < EmptyRecord > response = _restClient . get ( ) . sendRequest ( deleteRequest ) ; response . getResponse ( ) ;
public class PropertyTypeRef { /** * Specifies the * < a href = " http : / / docs . oracle . com / javase / tutorial / javabeans / index . html " target = " _ blank " > JavaBean < / a > to access the * property from . * Examples : * < pre > * / / import static { @ link org . fest . reflect . core . Reflection # property ( String ) org . fest . reflect . core . Reflection . property } ; * / / Equivalent to " String name = person . getName ( ) " * String name = { @ link org . fest . reflect . core . Reflection # property ( String ) property } ( " name " ) . { @ link org . fest . reflect . beanproperty . PropertyName # ofType ( Class ) ofType } ( String . class ) . { @ link org . fest . reflect . beanproperty . PropertyType # in ( Object ) in } ( person ) . { @ link org . fest . reflect . beanproperty . PropertyAccessor # get ( ) get } ( ) ; * / / Equivalent to " person . setName ( " Yoda " ) " * { @ link org . fest . reflect . core . Reflection # property ( String ) property } ( " name " ) . { @ link org . fest . reflect . beanproperty . PropertyName # ofType ( Class ) ofType } ( String . class ) . { @ link org . fest . reflect . beanproperty . PropertyType # in ( Object ) in } ( person ) . { @ link org . fest . reflect . beanproperty . PropertyAccessor # set ( Object ) set } ( " Yoda " ) ; * / / Equivalent to " List & lt ; String & gt ; powers = jedi . getPowers ( ) " * List & lt ; String & gt ; powers = { @ link org . fest . reflect . core . Reflection # property ( String ) property } ( " powers " ) . { @ link org . fest . reflect . beanproperty . PropertyName # ofType ( org . fest . reflect . reference . TypeRef ) ofType } ( new { @ link org . fest . reflect . reference . TypeRef TypeRef } & lt ; List & lt ; String & gt ; & gt ; ( ) { } ) . { @ link org . fest . reflect . beanproperty . PropertyTypeRef # in ( Object ) in } ( jedi ) . { @ link org . fest . reflect . beanproperty . PropertyAccessor # get ( ) get } ( ) ; * / / Equivalent to " jedi . setPowers ( powers ) " * List & lt ; String & gt ; powers = new ArrayList & lt ; String & gt ; ( ) ; * powers . add ( " heal " ) ; * { @ link org . fest . reflect . core . Reflection # property ( String ) property } ( " powers " ) . { @ link org . fest . reflect . beanproperty . PropertyName # ofType ( org . fest . reflect . reference . TypeRef ) ofType } ( new { @ link org . fest . reflect . reference . TypeRef TypeRef } & lt ; List & lt ; String & gt ; & gt ; ( ) { } ) . { @ link org . fest . reflect . beanproperty . PropertyTypeRef # in ( Object ) in } ( jedi ) . { @ link org . fest . reflect . beanproperty . PropertyAccessor # set ( Object ) set } ( powers ) ; * < / pre > * @ param target the object containing the property to access . * @ return the created property accessor . * @ throws NullPointerException if the given target is { @ code null } . * @ throws ReflectionError if a property with a matching name and type cannot be found . */ public @ NotNull PropertyAccessor < T > in ( @ NotNull Object target ) { } }
return new PropertyAccessor < T > ( propertyName , value . rawType ( ) , target ) ;
public class ValueTaglet { /** * Given the name of the field , return the corresponding VariableElement . Return null * due to invalid use of value tag if the name is null or empty string and if * the value tag is not used on a field . * @ param holder the element holding the tag * @ param config the current configuration of the doclet . * @ param tag the value tag . * @ return the corresponding VariableElement . If the name is null or empty string , * return field that the value tag was used in . Return null if the name is null * or empty string and if the value tag is not used on a field . */ private VariableElement getVariableElement ( Element holder , Configuration config , DocTree tag ) { } }
Utils utils = config . utils ; CommentHelper ch = utils . getCommentHelper ( holder ) ; String signature = ch . getReferencedSignature ( tag ) ; if ( signature == null ) { // no reference // Base case : no label . if ( utils . isVariableElement ( holder ) ) { return ( VariableElement ) ( holder ) ; } else { // If the value tag does not specify a parameter which is a valid field and // it is not used within the comments of a valid field , return null . return null ; } } String [ ] sigValues = signature . split ( "#" ) ; String memberName = null ; TypeElement te = null ; if ( sigValues . length == 1 ) { // Case 2 : @ value in same class . if ( utils . isExecutableElement ( holder ) || utils . isVariableElement ( holder ) ) { te = utils . getEnclosingTypeElement ( holder ) ; } else if ( utils . isTypeElement ( holder ) ) { te = utils . getTopMostContainingTypeElement ( holder ) ; } memberName = sigValues [ 0 ] ; } else { // Case 3 : @ value in different class . Elements elements = config . docEnv . getElementUtils ( ) ; te = elements . getTypeElement ( sigValues [ 0 ] ) ; memberName = sigValues [ 1 ] ; } if ( te == null ) { return null ; } for ( Element field : utils . getFields ( te ) ) { if ( utils . getSimpleName ( field ) . equals ( memberName ) ) { return ( VariableElement ) field ; } } return null ;
public class LongMatrix { /** * Update all elements based on points * @ param func */ public < E extends Exception > void updateAll ( final Try . IntBiFunction < Long , E > func ) throws E { } }
if ( isParallelable ( ) ) { if ( rows <= cols ) { IntStream . range ( 0 , rows ) . parallel ( ) . forEach ( new Try . IntConsumer < E > ( ) { @ Override public void accept ( final int i ) throws E { for ( int j = 0 ; j < cols ; j ++ ) { a [ i ] [ j ] = func . apply ( i , j ) ; } } } ) ; } else { IntStream . range ( 0 , cols ) . parallel ( ) . forEach ( new Try . IntConsumer < E > ( ) { @ Override public void accept ( final int j ) throws E { for ( int i = 0 ; i < rows ; i ++ ) { a [ i ] [ j ] = func . apply ( i , j ) ; } } } ) ; } } else { if ( rows <= cols ) { for ( int i = 0 ; i < rows ; i ++ ) { for ( int j = 0 ; j < cols ; j ++ ) { a [ i ] [ j ] = func . apply ( i , j ) ; } } } else { for ( int j = 0 ; j < cols ; j ++ ) { for ( int i = 0 ; i < rows ; i ++ ) { a [ i ] [ j ] = func . apply ( i , j ) ; } } } }
public class RPUtils { /** * Scan for leaves accumulating * the nodes in the passed in list * @ param nodes the nodes so far * @ param scan the tree to scan */ public static void scanForLeaves ( List < RPNode > nodes , RPTree scan ) { } }
scanForLeaves ( nodes , scan . getRoot ( ) ) ;
public class EnvironmentSettingsInner { /** * Provisions / deprovisions required resources for an environment setting based on current state of the lab / environment setting . * @ param resourceGroupName The name of the resource group . * @ param labAccountName The name of the lab Account . * @ param labName The name of the lab . * @ param environmentSettingName The name of the environment Setting . * @ param useExistingImage Whether to use existing VM custom image when publishing . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ throws CloudException thrown if the request is rejected by server * @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent */ public void publish ( String resourceGroupName , String labAccountName , String labName , String environmentSettingName , Boolean useExistingImage ) { } }
publishWithServiceResponseAsync ( resourceGroupName , labAccountName , labName , environmentSettingName , useExistingImage ) . toBlocking ( ) . single ( ) . body ( ) ;
public class CmsWebdavServlet { /** * Handles the special WebDAV methods . < p > * @ param req the servlet request we are processing * @ param resp the servlet response we are creating * @ throws IOException if an input / output error occurs * @ throws ServletException if a servlet - specified error occurs */ @ Override protected void service ( HttpServletRequest req , HttpServletResponse resp ) throws ServletException , IOException { } }
String method = req . getMethod ( ) ; if ( LOG . isDebugEnabled ( ) ) { String path = getRelativePath ( req ) ; LOG . debug ( "[" + method + "] " + path ) ; } // check authorization String auth = req . getHeader ( HEADER_AUTHORIZATION ) ; if ( ( auth == null ) || ! auth . toUpperCase ( ) . startsWith ( AUTHORIZATION_BASIC_PREFIX ) ) { // no authorization data is available requestAuthorization ( resp ) ; if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( Messages . get ( ) . getBundle ( ) . key ( Messages . LOG_NO_AUTHORIZATION_0 ) ) ; } return ; } // get encoded user and password , following after " BASIC " String base64Token = auth . substring ( 6 ) ; // decode it , using base 64 decoder String token = new String ( Base64 . decodeBase64 ( base64Token . getBytes ( ) ) ) ; String password = null ; int pos = token . indexOf ( SEPARATOR_CREDENTIALS ) ; if ( pos != - 1 ) { m_username = token . substring ( 0 , pos ) ; password = token . substring ( pos + 1 ) ; } // get session try { m_session = m_repository . login ( m_username , password ) ; } catch ( CmsException ex ) { m_session = null ; } if ( m_session == null ) { if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( Messages . get ( ) . getBundle ( ) . key ( Messages . LOG_LOGIN_FAILED_1 , m_username ) ) ; } resp . setStatus ( HttpServletResponse . SC_FORBIDDEN ) ; return ; } if ( method . equals ( METHOD_PROPFIND ) ) { doPropfind ( req , resp ) ; } else if ( method . equals ( METHOD_PROPPATCH ) ) { doProppatch ( req , resp ) ; } else if ( method . equals ( METHOD_MKCOL ) ) { doMkcol ( req , resp ) ; } else if ( method . equals ( METHOD_COPY ) ) { doCopy ( req , resp ) ; } else if ( method . equals ( METHOD_MOVE ) ) { doMove ( req , resp ) ; } else if ( method . equals ( METHOD_LOCK ) ) { doLock ( req , resp ) ; } else if ( method . equals ( METHOD_UNLOCK ) ) { doUnlock ( req , resp ) ; } else { // DefaultServlet processing super . service ( req , resp ) ; }
public class CreateCodeRepositoryRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( CreateCodeRepositoryRequest createCodeRepositoryRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( createCodeRepositoryRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( createCodeRepositoryRequest . getCodeRepositoryName ( ) , CODEREPOSITORYNAME_BINDING ) ; protocolMarshaller . marshall ( createCodeRepositoryRequest . getGitConfig ( ) , GITCONFIG_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class DirtyItemList { /** * Paints all the dirty items in this list using the supplied graphics context . The items are * removed from the dirty list after being painted and the dirty list ends up empty . */ public void paintAndClear ( Graphics2D gfx ) { } }
int icount = _items . size ( ) ; for ( int ii = 0 ; ii < icount ; ii ++ ) { DirtyItem item = _items . get ( ii ) ; item . paint ( gfx ) ; item . clear ( ) ; _freelist . add ( item ) ; } _items . clear ( ) ;
public class Expressions { /** * Create a new Template expression * @ param template template * @ param args template parameters * @ return template expression */ public static BooleanTemplate booleanTemplate ( String template , Object ... args ) { } }
return booleanTemplate ( createTemplate ( template ) , ImmutableList . copyOf ( args ) ) ;
public class ModelConstraints { /** * Checks the foreignkeys of a reference . * @ param modelDef The model * @ param refDef The reference descriptor * @ exception ConstraintException If the value for foreignkey is invalid */ private void checkReferenceForeignkeys ( ModelDef modelDef , ReferenceDescriptorDef refDef ) throws ConstraintException { } }
String foreignkey = refDef . getProperty ( PropertyHelper . OJB_PROPERTY_FOREIGNKEY ) ; if ( ( foreignkey == null ) || ( foreignkey . length ( ) == 0 ) ) { throw new ConstraintException ( "The reference " + refDef . getName ( ) + " in class " + refDef . getOwner ( ) . getName ( ) + " has no foreignkeys" ) ; } // we know that the class is present because the reference constraints have been checked already ClassDescriptorDef ownerClass = ( ClassDescriptorDef ) refDef . getOwner ( ) ; ArrayList keyFields ; FieldDescriptorDef keyField ; try { keyFields = ownerClass . getFields ( foreignkey ) ; } catch ( NoSuchFieldException ex ) { throw new ConstraintException ( "The reference " + refDef . getName ( ) + " in class " + refDef . getOwner ( ) . getName ( ) + " specifies a foreignkey " + ex . getMessage ( ) + " that is not a persistent field in its owner class " + ownerClass . getName ( ) ) ; } for ( int idx = 0 ; idx < keyFields . size ( ) ; idx ++ ) { keyField = ( FieldDescriptorDef ) keyFields . get ( idx ) ; if ( keyField . getBooleanProperty ( PropertyHelper . OJB_PROPERTY_IGNORE , false ) ) { throw new ConstraintException ( "The reference " + refDef . getName ( ) + " in class " + ownerClass . getName ( ) + " uses the field " + keyField . getName ( ) + " as foreignkey although this field is ignored in this class" ) ; } } // for the referenced class and any subtype that is instantiable ( i . e . not an interface or abstract class ) // there must be the same number of primary keys and the jdbc types of the primary keys must // match the jdbc types of the foreignkeys ( in the correct order ) String targetClassName = refDef . getProperty ( PropertyHelper . OJB_PROPERTY_CLASS_REF ) ; ArrayList queue = new ArrayList ( ) ; ClassDescriptorDef referencedClass ; ArrayList primFields ; FieldDescriptorDef primField ; String primType ; String keyType ; queue . add ( modelDef . getClass ( targetClassName ) ) ; while ( ! queue . isEmpty ( ) ) { referencedClass = ( ClassDescriptorDef ) queue . get ( 0 ) ; queue . remove ( 0 ) ; for ( Iterator it = referencedClass . getExtentClasses ( ) ; it . hasNext ( ) ; ) { queue . add ( it . next ( ) ) ; } if ( ! referencedClass . getBooleanProperty ( PropertyHelper . OJB_PROPERTY_GENERATE_REPOSITORY_INFO , true ) ) { continue ; } primFields = referencedClass . getPrimaryKeys ( ) ; if ( primFields . size ( ) != keyFields . size ( ) ) { throw new ConstraintException ( "The number of foreignkeys (" + keyFields . size ( ) + ") of the reference " + refDef . getName ( ) + " in class " + refDef . getOwner ( ) . getName ( ) + " doesn't match the number of primarykeys (" + primFields . size ( ) + ") of the referenced class (or its subclass) " + referencedClass . getName ( ) ) ; } for ( int idx = 0 ; idx < primFields . size ( ) ; idx ++ ) { keyField = ( FieldDescriptorDef ) keyFields . get ( idx ) ; primField = ( FieldDescriptorDef ) primFields . get ( idx ) ; primType = primField . getProperty ( PropertyHelper . OJB_PROPERTY_JDBC_TYPE ) ; keyType = keyField . getProperty ( PropertyHelper . OJB_PROPERTY_JDBC_TYPE ) ; if ( ! primType . equals ( keyType ) ) { throw new ConstraintException ( "The jdbc-type of foreignkey " + keyField . getName ( ) + " of the reference " + refDef . getName ( ) + " in class " + refDef . getOwner ( ) . getName ( ) + " doesn't match the jdbc-type of the corresponding primarykey " + primField . getName ( ) + " of the referenced class (or its subclass) " + referencedClass . getName ( ) ) ; } } }
public class Json { /** * Escape quotation mark , reverse solidus and control characters ( U + 0000 through U + 001F ) . * @ param value * @ return escaped value * @ see < a href = " http : / / www . ietf . org / rfc / rfc4627 . txt " > http : / / www . ietf . org / rfc / rfc4627 . txt < / a > */ static String escape ( String value ) { } }
StringBuilder builder = new StringBuilder ( ) ; for ( int i = 0 ; i < value . length ( ) ; i ++ ) { char c = value . charAt ( i ) ; String replacement = REPLACEMENTS . get ( c ) ; if ( replacement != null ) { builder . append ( replacement ) ; } else { builder . append ( c ) ; } } return builder . toString ( ) ;
public class InjectProgram { /** * Configures a bean given a class to instantiate . */ final protected < T > T configureImpl ( Class < T > type ) // , ContextConfig env ) throws ConfigException { } }
try { T value = type . newInstance ( ) ; InjectContext context = null ; injectTop ( value , context ) ; // Config . init ( value ) ; return value ; } catch ( RuntimeException e ) { throw e ; } catch ( Exception e ) { throw ConfigException . wrap ( e ) ; }
public class ProcessStore { /** * Stores a process ( eg . a running script ) , so that the * process can be reached later ( eg . to cancel it when blocked ) . * @ param process The process to be stored */ public static synchronized void setProcess ( String applicationName , String scopedInstancePath , Process process ) { } }
PROCESS_MAP . put ( toAgentId ( applicationName , scopedInstancePath ) , process ) ;
public class Cargo { /** * Does not take into account the possibility of the cargo having been * ( errouneously ) loaded onto another carrier after it has been unloaded at * the final destination . * @ return True if the cargo has been unloaded at the final destination . */ public boolean isUnloadedAtDestination ( ) { } }
for ( HandlingEvent event : deliveryHistory ( ) . eventsOrderedByCompletionTime ( ) ) { if ( Type . UNLOAD . equals ( event . getType ( ) ) && getDestination ( ) . equals ( event . getLocation ( ) ) ) { return true ; } } return false ;
public class ModelsImpl { /** * Update an entity role for a given entity . * @ param appId The application ID . * @ param versionId The version ID . * @ param hEntityId The hierarchical entity extractor ID . * @ param roleId The entity role ID . * @ param updateHierarchicalEntityRoleOptionalParameter the object representing the optional parameters to be set before calling this API * @ param serviceCallback the async ServiceCallback to handle successful and failed responses . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the { @ link ServiceFuture } object */ public ServiceFuture < OperationStatus > updateHierarchicalEntityRoleAsync ( UUID appId , String versionId , UUID hEntityId , UUID roleId , UpdateHierarchicalEntityRoleOptionalParameter updateHierarchicalEntityRoleOptionalParameter , final ServiceCallback < OperationStatus > serviceCallback ) { } }
return ServiceFuture . fromResponse ( updateHierarchicalEntityRoleWithServiceResponseAsync ( appId , versionId , hEntityId , roleId , updateHierarchicalEntityRoleOptionalParameter ) , serviceCallback ) ;
public class GaloisField { /** * Perform Gaussian elimination on the given matrix . This matrix has to be a * fat matrix ( number of rows > number of columns ) . */ public void gaussianElimination ( int [ ] [ ] matrix ) { } }
assert ( matrix != null && matrix . length > 0 && matrix [ 0 ] . length > 0 && matrix . length < matrix [ 0 ] . length ) ; int height = matrix . length ; int width = matrix [ 0 ] . length ; for ( int i = 0 ; i < height ; i ++ ) { boolean pivotFound = false ; // scan the column for a nonzero pivot and swap it to the diagonal for ( int j = i ; j < height ; j ++ ) { if ( matrix [ i ] [ j ] != 0 ) { int [ ] tmp = matrix [ i ] ; matrix [ i ] = matrix [ j ] ; matrix [ j ] = tmp ; pivotFound = true ; break ; } } if ( ! pivotFound ) { continue ; } int pivot = matrix [ i ] [ i ] ; for ( int j = i ; j < width ; j ++ ) { matrix [ i ] [ j ] = divide ( matrix [ i ] [ j ] , pivot ) ; } for ( int j = i + 1 ; j < height ; j ++ ) { int lead = matrix [ j ] [ i ] ; for ( int k = i ; k < width ; k ++ ) { matrix [ j ] [ k ] = add ( matrix [ j ] [ k ] , multiply ( lead , matrix [ i ] [ k ] ) ) ; } } } for ( int i = height - 1 ; i >= 0 ; i -- ) { for ( int j = 0 ; j < i ; j ++ ) { int lead = matrix [ j ] [ i ] ; for ( int k = i ; k < width ; k ++ ) { matrix [ j ] [ k ] = add ( matrix [ j ] [ k ] , multiply ( lead , matrix [ i ] [ k ] ) ) ; } } }
public class AbstractExternalAuthenticationController { /** * Checks if the IsPassive flag is set in the AuthnRequest and fails with a NO _ PASSIVE error code if this is the case . * Implementations that do support passive authentication MUST override this method and handle the IsPassive * processing themselves . * @ param profileRequestContext * the context * @ throws ExternalAutenticationErrorCodeException * if the IsPassive - flag is set */ protected void processIsPassive ( ProfileRequestContext < ? , ? > profileRequestContext ) throws ExternalAutenticationErrorCodeException { } }
final AuthnRequest authnRequest = this . getAuthnRequest ( profileRequestContext ) ; if ( authnRequest != null && authnRequest . isPassive ( ) != null && authnRequest . isPassive ( ) == Boolean . TRUE ) { logger . info ( "AuthnRequest contains IsPassive=true, can not continue ..." ) ; Status status = IdpErrorStatusException . getStatusBuilder ( StatusCode . REQUESTER ) . subStatusCode ( StatusCode . NO_PASSIVE ) . statusMessage ( "Can not perform passive authentication" ) . build ( ) ; throw new IdpErrorStatusException ( status , AuthnEventIds . NO_PASSIVE ) ; }
public class Cluster { /** * In the event that the node has been evicted and is reconnecting , this method * clears out all existing state before relaunching to ensure a clean launch . */ private void ensureCleanStartup ( ) { } }
forceShutdown ( ) ; ScheduledThreadPoolExecutor oldPool = pool . getAndSet ( createScheduledThreadExecutor ( ) ) ; oldPool . shutdownNow ( ) ; claimedForHandoff . clear ( ) ; workUnitsPeggedToMe . clear ( ) ; state . set ( NodeState . Fresh ) ;
public class ReflectUtil { /** * Returns a setter method based on the fieldName and the java beans setter naming convention or null if none exists . * If multiple setters with different parameter types are present , an exception is thrown . * If they have the same parameter type , one of those methods is returned . */ public static Method getSingleSetter ( String fieldName , Class < ? > clazz ) { } }
String setterName = buildSetterName ( fieldName ) ; try { // Using getMathods ( ) , getMathod ( . . . ) expects exact parameter type // matching and ignores inheritance - tree . Method [ ] methods = clazz . getMethods ( ) ; List < Method > candidates = new ArrayList < Method > ( ) ; Set < Class < ? > > parameterTypes = new HashSet < Class < ? > > ( ) ; for ( Method method : methods ) { if ( method . getName ( ) . equals ( setterName ) ) { Class < ? > [ ] paramTypes = method . getParameterTypes ( ) ; if ( paramTypes != null && paramTypes . length == 1 ) { candidates . add ( method ) ; parameterTypes . add ( paramTypes [ 0 ] ) ; } } } if ( parameterTypes . size ( ) > 1 ) { throw LOG . ambiguousSetterMethod ( setterName , clazz . getName ( ) ) ; } if ( candidates . size ( ) >= 1 ) { return candidates . get ( 0 ) ; } return null ; } catch ( SecurityException e ) { throw LOG . unableToAccessMethod ( setterName , clazz . getName ( ) ) ; }
public class MessageDigestFileDigester { /** * { @ inheritDoc } */ public String calculate ( File file ) throws DigesterException , NoSuchAlgorithmException { } }
// Try to open the file . FileInputStream fis ; try { fis = new FileInputStream ( file ) ; } catch ( Exception e ) { throw new DigesterException ( "Unable not read " + file . getPath ( ) + ": " + e . getMessage ( ) ) ; } String result ; try { MessageDigest messageDigest = MessageDigest . getInstance ( algorithm ) ; // Stream the file contents to the MessageDigest . byte [ ] buffer = new byte [ STREAMING_BUFFER_SIZE ] ; int size = fis . read ( buffer , 0 , STREAMING_BUFFER_SIZE ) ; while ( size >= 0 ) { messageDigest . update ( buffer , 0 , size ) ; size = fis . read ( buffer , 0 , STREAMING_BUFFER_SIZE ) ; } result = new String ( Hex . encode ( messageDigest . digest ( ) ) ) ; } catch ( IOException e ) { throw new DigesterException ( "Unable to calculate the " + getAlgorithm ( ) + " hashcode for " + file . getPath ( ) + ": " + e . getMessage ( ) ) ; } finally { try { fis . close ( ) ; } catch ( IOException e ) { // Don ' t take any chance , return an empty string if something went wrong . result = "" ; } } return result ;
public class GanttDesignerReader { /** * Read task data from a Gantt Designer file . * @ param gantt Gantt Designer file */ private void processTasks ( Gantt gantt ) { } }
ProjectCalendar calendar = m_projectFile . getDefaultCalendar ( ) ; for ( Gantt . Tasks . Task ganttTask : gantt . getTasks ( ) . getTask ( ) ) { String wbs = ganttTask . getID ( ) ; ChildTaskContainer parentTask = getParentTask ( wbs ) ; Task task = parentTask . addTask ( ) ; // ganttTask . getB ( ) / / bar type // ganttTask . getBC ( ) / / bar color task . setCost ( ganttTask . getC ( ) ) ; task . setName ( ganttTask . getContent ( ) ) ; task . setDuration ( ganttTask . getD ( ) ) ; task . setDeadline ( ganttTask . getDL ( ) ) ; // ganttTask . getH ( ) / / height // ganttTask . getIn ( ) ; / / indent task . setWBS ( wbs ) ; task . setPercentageComplete ( ganttTask . getPC ( ) ) ; task . setStart ( ganttTask . getS ( ) ) ; // ganttTask . getU ( ) ; / / Unknown // ganttTask . getVA ( ) ; / / Valign task . setFinish ( calendar . getDate ( task . getStart ( ) , task . getDuration ( ) , false ) ) ; m_taskMap . put ( wbs , task ) ; }
public class FileSystem { /** * create a directory with the provided permission * The permission of the directory is set to be the provided permission as in * setPermission , not permission & ~ umask * @ see # create ( FileSystem , Path , FsPermission ) * @ param fs file system handle * @ param dir the name of the directory to be created * @ param permission the permission of the directory * @ return true if the directory creation succeeds ; false otherwise * @ throws IOException */ public static boolean mkdirs ( FileSystem fs , Path dir , FsPermission permission ) throws IOException { } }
// create the directory using the default permission boolean result = fs . mkdirs ( dir ) ; // set its permission to be the supplied one fs . setPermission ( dir , permission ) ; return result ;
public class Measure { /** * setter for unit - sets iso * @ generated * @ param v value to set into the feature */ public void setUnit ( String v ) { } }
if ( Measure_Type . featOkTst && ( ( Measure_Type ) jcasType ) . casFeat_unit == null ) jcasType . jcas . throwFeatMissing ( "unit" , "ch.epfl.bbp.uima.types.Measure" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( Measure_Type ) jcasType ) . casFeatCode_unit , v ) ;
public class ManagementPoliciesInner { /** * Sets the managementpolicy to the specified storage account . * @ param resourceGroupName The name of the resource group within the user ' s subscription . The name is case insensitive . * @ param accountName The name of the storage account within the specified resource group . Storage account names must be between 3 and 24 characters in length and use numbers and lower - case letters only . * @ param policy The Storage Account ManagementPolicy , in JSON format . See more details in : https : / / docs . microsoft . com / en - us / azure / storage / common / storage - lifecycle - managment - concepts . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable to the ManagementPolicyInner object */ public Observable < ManagementPolicyInner > createOrUpdateAsync ( String resourceGroupName , String accountName , ManagementPolicySchema policy ) { } }
return createOrUpdateWithServiceResponseAsync ( resourceGroupName , accountName , policy ) . map ( new Func1 < ServiceResponse < ManagementPolicyInner > , ManagementPolicyInner > ( ) { @ Override public ManagementPolicyInner call ( ServiceResponse < ManagementPolicyInner > response ) { return response . body ( ) ; } } ) ;
public class GenJsCodeVisitor { /** * Example : * < pre > * { for $ foo in $ boo . foos } * { ifempty } * { / for } * < / pre > * might generate * < pre > * var foo2List = opt _ data . boo . foos ; * var foo2ListLen = foo2List . length ; * if ( foo2ListLen > 0 ) { * } else { * < / pre > */ @ Override protected void visitForNode ( ForNode node ) { } }
boolean hasIfempty = ( node . numChildren ( ) == 2 ) ; // NOTE : below we call id ( varName ) on a number of variables instead of using // VariableDeclaration . ref ( ) , this is because the refs ( ) might be referenced on the other side // of a call to visitChildrenReturningCodeChunk . // That will break the normal behavior of FormattingContext being able to tell whether or not an // initial statement has already been generated because it eagerly coerces the value to a // string . This will lead to redundant variable declarations . // When visitChildrenReturningCodeChunk is gone , this can be cleaned up , but for now we have to // manually decide where to declare the variables . List < Statement > statements = new ArrayList < > ( ) ; // Build some local variable names . ForNonemptyNode nonEmptyNode = ( ForNonemptyNode ) node . getChild ( 0 ) ; String varPrefix = nonEmptyNode . getVarName ( ) + node . getId ( ) ; // TODO ( b / 32224284 ) : A more consistent pattern for local variable management . String limitName = varPrefix + "ListLen" ; Expression limitInitializer ; Optional < RangeArgs > args = RangeArgs . createFromNode ( node ) ; Function < Expression , Expression > getDataItemFunction ; if ( args . isPresent ( ) ) { RangeArgs range = args . get ( ) ; // if any of the expressions are too expensive , allocate local variables for them final Expression start = maybeStashInLocal ( range . start ( ) . isPresent ( ) ? translateExpr ( range . start ( ) . get ( ) ) : Expression . number ( 0 ) , varPrefix + "_RangeStart" , statements ) ; final Expression end = maybeStashInLocal ( translateExpr ( range . limit ( ) ) , varPrefix + "_RangeEnd" , statements ) ; final Expression step = maybeStashInLocal ( range . increment ( ) . isPresent ( ) ? translateExpr ( range . increment ( ) . get ( ) ) : Expression . number ( 1 ) , varPrefix + "_RangeStep" , statements ) ; // the logic we want is // step * ( end - start ) < 0 ? 0 : ( ( end - start ) / step + ( ( end - start ) % step = = 0 ? 0 : 1 ) ) ; // but given that all javascript numbers are doubles we can simplify this somewhat . // Math . max ( 0 , Match . ceil ( ( end - start ) / step ) ) // should yield identical results . limitInitializer = dottedIdNoRequire ( "Math.max" ) . call ( number ( 0 ) , dottedIdNoRequire ( "Math.ceil" ) . call ( end . minus ( start ) . divideBy ( step ) ) ) ; // optimize for foreach over a range getDataItemFunction = index -> start . plus ( index . times ( step ) ) ; } else { // Define list var and list - len var . Expression dataRef = translateExpr ( node . getExpr ( ) ) ; final String listVarName = varPrefix + "List" ; Expression listVar = VariableDeclaration . builder ( listVarName ) . setRhs ( dataRef ) . build ( ) . ref ( ) ; // does it make sense to store this in a variable ? limitInitializer = listVar . dotAccess ( "length" ) ; getDataItemFunction = index -> id ( listVarName ) . bracketAccess ( index ) ; } // Generate the foreach body as a CodeChunk . Expression limit = id ( limitName ) ; statements . add ( VariableDeclaration . builder ( limitName ) . setRhs ( limitInitializer ) . build ( ) ) ; Statement foreachBody = handleForeachLoop ( nonEmptyNode , limit , getDataItemFunction ) ; if ( hasIfempty ) { // If there is an ifempty node , wrap the foreach body in an if statement and append the // ifempty body as the else clause . Statement ifemptyBody = visitChildrenReturningCodeChunk ( node . getChild ( 1 ) ) ; Expression limitCheck = limit . op ( Operator . GREATER_THAN , number ( 0 ) ) ; foreachBody = ifStatement ( limitCheck , foreachBody ) . setElse ( ifemptyBody ) . build ( ) ; } statements . add ( foreachBody ) ; jsCodeBuilder . append ( Statement . of ( statements ) ) ;
public class DbEntityManager { /** * Flushes the entity cache : * Depending on the entity state , the required { @ link DbOperation } is performed and the cache is updated . */ protected void flushEntityCache ( ) { } }
List < CachedDbEntity > cachedEntities = dbEntityCache . getCachedEntities ( ) ; for ( CachedDbEntity cachedDbEntity : cachedEntities ) { flushCachedEntity ( cachedDbEntity ) ; } // log cache state after flush LOG . flushedCacheState ( dbEntityCache . getCachedEntities ( ) ) ;
public class AbstractOAuthGetToken { /** * Executes the HTTP request for a temporary or long - lived token . * @ return OAuth credentials response object */ public final OAuthCredentialsResponse execute ( ) throws IOException { } }
HttpRequestFactory requestFactory = transport . createRequestFactory ( ) ; HttpRequest request = requestFactory . buildRequest ( usePost ? HttpMethods . POST : HttpMethods . GET , this , null ) ; createParameters ( ) . intercept ( request ) ; HttpResponse response = request . execute ( ) ; response . setContentLoggingLimit ( 0 ) ; OAuthCredentialsResponse oauthResponse = new OAuthCredentialsResponse ( ) ; UrlEncodedParser . parse ( response . parseAsString ( ) , oauthResponse ) ; return oauthResponse ;
public class ElemTemplateElement { /** * This after the template ' s children have been composed . */ public void endCompose ( StylesheetRoot sroot ) throws TransformerException { } }
StylesheetRoot . ComposeState cstate = sroot . getComposeState ( ) ; cstate . popStackMark ( ) ;
public class CmsSitemapController { /** * Loads the model pages . < p > */ public void loadModelPages ( ) { } }
CmsRpcAction < CmsModelInfo > action = new CmsRpcAction < CmsModelInfo > ( ) { @ Override public void execute ( ) { start ( 500 , false ) ; getService ( ) . getModelInfos ( m_data . getRoot ( ) . getId ( ) , this ) ; } @ Override protected void onResponse ( CmsModelInfo result ) { stop ( false ) ; CmsSitemapView . getInstance ( ) . displayModelPages ( result ) ; } } ; action . execute ( ) ;
public class Bootstrap { /** * Support customized language config * @ param dataMaster master of the config * @ param locale The Locale to set . * @ param randomGenerator specific random generator * @ return FariyModule instance in accordance with locale */ private static FairyModule getFairyModuleForLocale ( DataMaster dataMaster , Locale locale , RandomGenerator randomGenerator ) { } }
LanguageCode code ; try { code = LanguageCode . valueOf ( locale . getLanguage ( ) . toUpperCase ( ) ) ; } catch ( IllegalArgumentException e ) { LOG . warn ( "Uknown locale " + locale ) ; code = LanguageCode . EN ; } switch ( code ) { case PL : return new PlFairyModule ( dataMaster , randomGenerator ) ; case EN : return new EnFairyModule ( dataMaster , randomGenerator ) ; case ES : return new EsFairyModule ( dataMaster , randomGenerator ) ; case FR : return new EsFairyModule ( dataMaster , randomGenerator ) ; case SV : return new SvFairyModule ( dataMaster , randomGenerator ) ; case ZH : return new ZhFairyModule ( dataMaster , randomGenerator ) ; case DE : return new DeFairyModule ( dataMaster , randomGenerator ) ; case KA : return new KaFairyModule ( dataMaster , randomGenerator ) ; default : LOG . info ( "No data for your language - using EN" ) ; return new EnFairyModule ( dataMaster , randomGenerator ) ; }
public class RemediationConfigurationMarshaller { /** * Marshall the given parameter object . */ public void marshall ( RemediationConfiguration remediationConfiguration , ProtocolMarshaller protocolMarshaller ) { } }
if ( remediationConfiguration == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( remediationConfiguration . getConfigRuleName ( ) , CONFIGRULENAME_BINDING ) ; protocolMarshaller . marshall ( remediationConfiguration . getTargetType ( ) , TARGETTYPE_BINDING ) ; protocolMarshaller . marshall ( remediationConfiguration . getTargetId ( ) , TARGETID_BINDING ) ; protocolMarshaller . marshall ( remediationConfiguration . getTargetVersion ( ) , TARGETVERSION_BINDING ) ; protocolMarshaller . marshall ( remediationConfiguration . getParameters ( ) , PARAMETERS_BINDING ) ; protocolMarshaller . marshall ( remediationConfiguration . getResourceType ( ) , RESOURCETYPE_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class BshArray { /** * Find a more specific type if the element type is Object . class . * @ param baseType the element type * @ param fromValue the array to inspect * @ param length the length of the array * @ return baseType unless baseType is Object . class and common is not */ public static Class < ? > commonType ( Class < ? > baseType , Object fromValue , IntSupplier length ) { } }
if ( Object . class != baseType ) return baseType ; Class < ? > common = null ; int len = length . getAsInt ( ) ; for ( int i = 0 ; i < len ; i ++ ) if ( Object . class == ( common = Types . getCommonType ( common , Types . getType ( Array . get ( fromValue , 0 ) ) ) ) ) break ; if ( null != common && common != baseType ) return common ; return baseType ;
public class AnnotationDB { /** * Scanns both the method and its parameters for annotations . * @ param cf */ protected void scanMethods ( ClassFile cf ) { } }
List < ClassFile > methods = cf . getMethods ( ) ; if ( methods == null ) return ; for ( Object obj : methods ) { MethodInfo method = ( MethodInfo ) obj ; if ( scanMethodAnnotations ) { AnnotationsAttribute visible = ( AnnotationsAttribute ) method . getAttribute ( AnnotationsAttribute . visibleTag ) ; AnnotationsAttribute invisible = ( AnnotationsAttribute ) method . getAttribute ( AnnotationsAttribute . invisibleTag ) ; if ( visible != null ) populate ( visible . getAnnotations ( ) , cf . getName ( ) ) ; if ( invisible != null ) populate ( invisible . getAnnotations ( ) , cf . getName ( ) ) ; } if ( scanParameterAnnotations ) { ParameterAnnotationsAttribute paramsVisible = ( ParameterAnnotationsAttribute ) method . getAttribute ( ParameterAnnotationsAttribute . visibleTag ) ; ParameterAnnotationsAttribute paramsInvisible = ( ParameterAnnotationsAttribute ) method . getAttribute ( ParameterAnnotationsAttribute . invisibleTag ) ; if ( paramsVisible != null && paramsVisible . getAnnotations ( ) != null ) { for ( Annotation [ ] anns : paramsVisible . getAnnotations ( ) ) { populate ( anns , cf . getName ( ) ) ; } } if ( paramsInvisible != null && paramsInvisible . getAnnotations ( ) != null ) { for ( Annotation [ ] anns : paramsInvisible . getAnnotations ( ) ) { populate ( anns , cf . getName ( ) ) ; } } } }
public class SerializedFormBuilder { /** * Build the serialized form . */ public void build ( ) throws IOException { } }
if ( ! serialClassFoundToDocument ( configuration . root . classes ( ) ) ) { // Nothing to document . return ; } try { writer = configuration . getWriterFactory ( ) . getSerializedFormWriter ( ) ; if ( writer == null ) { // Doclet does not support this output . return ; } } catch ( Exception e ) { throw new DocletAbortException ( e ) ; } build ( layoutParser . parseXML ( NAME ) , contentTree ) ; writer . close ( ) ;
public class MultifactorTrustedDevicesReportEndpoint { /** * Devices registered and trusted . * @ return the set */ @ ReadOperation public Set < ? extends MultifactorAuthenticationTrustRecord > devices ( ) { } }
val onOrAfter = expireRecordsByDate ( ) ; return this . mfaTrustEngine . get ( onOrAfter ) ;
public class StatefulRandomIntSpout { /** * These two methods are required to implement the IStatefulComponent interface */ @ Override public void preSave ( String checkpointId ) { } }
System . out . println ( String . format ( "Saving spout state at checkpoint %s" , checkpointId ) ) ;
public class SynchronousParameterUpdater { /** * Returns the current status of this parameter server * updater * @ return */ @ Override public Map < String , Number > status ( ) { } }
Map < String , Number > ret = new HashMap < > ( ) ; ret . put ( "workers" , workers ) ; ret . put ( "accumulatedUpdates" , numUpdates ( ) ) ; return ret ;
public class ReadOnlyStyledDocument { /** * Note : there must be a " ensureValid _ ( ) " call preceding the call of this method */ private Tuple3 < ReadOnlyStyledDocument < PS , SEG , S > , RichTextChange < PS , SEG , S > , MaterializedListModification < Paragraph < PS , SEG , S > > > replace ( BiIndex start , BiIndex end , UnaryOperator < ReadOnlyStyledDocument < PS , SEG , S > > f ) { } }
int pos = tree . getSummaryBetween ( 0 , start . major ) . map ( s -> s . length ( ) + 1 ) . orElse ( 0 ) + start . minor ; List < Paragraph < PS , SEG , S > > removedPars = getParagraphs ( ) . subList ( start . major , end . major + 1 ) ; return end . map ( this :: split ) . map ( ( l0 , r ) -> { return start . map ( l0 :: split ) . map ( ( l , removed ) -> { ReadOnlyStyledDocument < PS , SEG , S > replacement = f . apply ( removed ) ; ReadOnlyStyledDocument < PS , SEG , S > doc = l . concatR ( replacement ) . concat ( r ) ; RichTextChange < PS , SEG , S > change = new RichTextChange < > ( pos , removed , replacement ) ; List < Paragraph < PS , SEG , S > > addedPars = doc . getParagraphs ( ) . subList ( start . major , start . major + replacement . getParagraphCount ( ) ) ; MaterializedListModification < Paragraph < PS , SEG , S > > parChange = MaterializedListModification . create ( start . major , removedPars , addedPars ) ; return t ( doc , change , parChange ) ; } ) ; } ) ;
public class BitapPattern { /** * Returns a BitapMatcher preforming a fuzzy search in a whole { @ code sequence } . Search allows no more than { @ code * maxNumberOfErrors } number of substitutions / insertions / deletions . Matcher will return positions of last matched * letter in the motif in ascending order . * @ param maxNumberOfErrors maximal number of allowed substitutions / insertions / deletions * @ param sequence target sequence * @ return matcher which will return positions of last matched letter in the motif */ public BitapMatcher substitutionAndIndelMatcherLast ( int maxNumberOfErrors , final Sequence sequence ) { } }
return substitutionAndIndelMatcherLast ( maxNumberOfErrors , sequence , 0 , sequence . size ( ) ) ;
public class OtterController { /** * = = = = = mbean info = = = = = */ public String getHeapMemoryUsage ( ) { } }
MemoryUsage memoryUsage = ManagementFactory . getMemoryMXBean ( ) . getHeapMemoryUsage ( ) ; return JsonUtils . marshalToString ( memoryUsage ) ;
public class RedisClient { /** * Deletes inverted indexes from redis . * @ param connection * redis instance . * @ param wrapper * attribute wrapper * @ param member * sorted set member name . */ private void unIndex ( final Object connection , final AttributeWrapper wrapper , final String member ) { } }
Set < String > keys = wrapper . getIndexes ( ) . keySet ( ) ; for ( String key : keys ) { if ( resource != null && resource . isActive ( ) ) { ( ( Transaction ) connection ) . zrem ( key , member ) ; } else { ( ( Pipeline ) connection ) . zrem ( key , member ) ; } }
public class BottomSheet { /** * Sets the sensitivity , which specifies the distance after which dragging has an effect on the * bottom sheet , in relation to an internal value range . * @ param dragSensitivity * The drag sensitivity , which should be set , as a { @ link Float } value . The drag * sensitivity must be at lest 0 and at maximum 1 */ public final void setDragSensitivity ( final float dragSensitivity ) { } }
Condition . INSTANCE . ensureAtLeast ( dragSensitivity , 0 , "The drag sensitivity must be at least 0" ) ; Condition . INSTANCE . ensureAtMaximum ( dragSensitivity , 1 , "The drag sensitivity must be at maximum 1" ) ; this . dragSensitivity = dragSensitivity ; adaptDragSensitivity ( ) ;
public class EglCore { /** * Makes our EGL context current , using the supplied surface for both " draw " and " read " . */ public void makeCurrent ( EGLSurface eglSurface ) { } }
if ( mEGLDisplay == EGL14 . EGL_NO_DISPLAY ) { // called makeCurrent ( ) before create ? Log . d ( TAG , "NOTE: makeCurrent w/o display" ) ; } if ( ! EGL14 . eglMakeCurrent ( mEGLDisplay , eglSurface , eglSurface , mEGLContext ) ) { throw new RuntimeException ( "eglMakeCurrent failed" ) ; }
public class ConnectionWatcher { /** * 含有重试机制的retry , 加锁 , 一直尝试连接 , 直至成功 */ public synchronized void reconnect ( ) { } }
LOGGER . info ( "start to reconnect...." ) ; int retries = 0 ; while ( true ) { try { if ( ! zk . getState ( ) . equals ( States . CLOSED ) ) { break ; } LOGGER . warn ( "zookeeper lost connection, reconnect" ) ; close ( ) ; connect ( internalHost ) ; } catch ( Exception e ) { LOGGER . error ( retries + "\t" + e . toString ( ) ) ; // sleep then retry try { int sec = ResilientActiveKeyValueStore . RETRY_PERIOD_SECONDS ; LOGGER . warn ( "sleep " + sec ) ; TimeUnit . SECONDS . sleep ( sec ) ; } catch ( InterruptedException e1 ) { } } }
public class SparseMatrix { /** * Applies the given { @ code procedure } to each non - zero element of the specified column of this matrix . * @ param j the column index . * @ param procedure the { @ link VectorProcedure } . */ public void eachNonZeroInColumn ( int j , VectorProcedure procedure ) { } }
VectorIterator it = nonZeroIteratorOfColumn ( j ) ; while ( it . hasNext ( ) ) { double x = it . next ( ) ; int i = it . index ( ) ; procedure . apply ( i , x ) ; }
public class AbstractDatatypeDetector { /** * Called from { @ link # registerDefaultDatatypes ( ) } to add JSR310 datatypes . Can also be called standalone or * overridden for customization . */ protected void registerJavaTimeDatatypes ( ) { } }
// prevent compile - time dependencies and GWT availability problems registerStandardDatatype ( "java.time.LocalTime" ) ; registerStandardDatatype ( "java.time.LocalDate" ) ; registerStandardDatatype ( "java.time.LocalDateTime" ) ; registerStandardDatatype ( "java.time.MonthDay" ) ; registerStandardDatatype ( "java.time.Year" ) ; registerStandardDatatype ( "java.time.YearMonth" ) ; registerStandardDatatype ( "java.time.Instant" ) ; registerStandardDatatype ( "java.time.Duration" ) ; registerStandardDatatype ( "java.time.Period" ) ; registerStandardDatatype ( "java.time.OffsetTime" ) ; registerStandardDatatype ( "java.time.OffsetDate" ) ; registerStandardDatatype ( "java.time.OffsetDateTime" ) ; registerStandardDatatype ( "java.time.ZoneId" ) ; registerStandardDatatype ( "java.time.ZonedDateTime" ) ; registerStandardDatatype ( "java.time.ZoneOffset" ) ; registerStandardDatatype ( "java.time.ZoneRegion" ) ;
public class StringCharacterIterator { /** * Implements CharacterIterator . next ( ) for String . * @ see CharacterIterator # next * @ deprecated ICU 2.4 . Use java . text . StringCharacterIterator instead . */ @ Deprecated public char next ( ) { } }
if ( pos < end - 1 ) { pos ++ ; return text . charAt ( pos ) ; } else { pos = end ; return DONE ; }
public class FSNamesystem { /** * Counts the number of live nodes in the given list */ private int countLiveNodes ( Block b , Iterator < DatanodeDescriptor > nodeIter ) { } }
int live = 0 ; Collection < DatanodeDescriptor > nodesCorrupt = null ; if ( corruptReplicas . size ( ) != 0 ) { nodesCorrupt = corruptReplicas . getNodes ( b ) ; } while ( nodeIter . hasNext ( ) ) { DatanodeDescriptor node = nodeIter . next ( ) ; if ( ( ( nodesCorrupt != null ) && ( nodesCorrupt . contains ( node ) ) ) || node . isDecommissionInProgress ( ) || node . isDecommissioned ( ) ) { // do nothing } else { live ++ ; } } return live ;
public class ExceptionUtils { /** * < p > Returns the list of < code > Throwable < / code > objects in the * exception chain . < / p > * < p > A throwable without cause will return a list containing * one element - the input throwable . * A throwable with one cause will return a list containing * two elements . - the input throwable and the cause throwable . * A < code > null < / code > throwable will return a list of size zero . < / p > * < p > This method handles recursive cause structures that might * otherwise cause infinite loops . The cause chain is processed until * the end is reached , or until the next item in the chain is already * in the result set . < / p > * @ param throwable the throwable to inspect , may be null * @ return the list of throwables , never null * @ since Commons Lang 2.2 */ @ GwtIncompatible ( "incompatible method" ) public static List < Throwable > getThrowableList ( Throwable throwable ) { } }
final List < Throwable > list = new ArrayList < > ( ) ; while ( throwable != null && ! list . contains ( throwable ) ) { list . add ( throwable ) ; throwable = throwable . getCause ( ) ; } return list ;
public class PCA { /** * Returns the first non zero column * @ param x the matrix to get a column from * @ return the first non zero column */ private static Vec getColumn ( Matrix x ) { } }
Vec t ; for ( int i = 0 ; i < x . cols ( ) ; i ++ ) { t = x . getColumn ( i ) ; if ( t . dot ( t ) > 0 ) return t ; } throw new ArithmeticException ( "Matrix is essentially zero" ) ;
public class SimonUtils { /** * Shrinks the middle of the input string if it is too long , so it does not exceed limitTo . * @ since 3.2 */ public static String compact ( String input , int limitTo ) { } }
if ( input == null || input . length ( ) <= limitTo ) { return input ; } int headLength = limitTo / 2 ; int tailLength = limitTo - SHRINKED_STRING . length ( ) - headLength ; if ( tailLength < 0 ) { tailLength = 1 ; } return input . substring ( 0 , headLength ) + SHRINKED_STRING + input . substring ( input . length ( ) - tailLength ) ;
public class Portmapper { /** * Given program and version of a service , query its tcp port number * @ param program * The program number , used to identify it for RPC calls . * @ param version * The program version number , used to identify it for RPC calls . * @ param serverIP * The server IP address . * @ return The port number for the program . */ public static int queryPortFromPortMap ( int program , int version , String serverIP ) throws IOException { } }
GetPortResponse response = null ; GetPortRequest request = new GetPortRequest ( program , version ) ; for ( int i = 0 ; i < _maxRetry ; ++ i ) { try { Xdr portmapXdr = new Xdr ( PORTMAP_MAX_REQUEST_SIZE ) ; request . marshalling ( portmapXdr ) ; Xdr reply = NetMgr . getInstance ( ) . sendAndWait ( serverIP , PMAP_PORT , _usePrivilegedPort , portmapXdr , PORTMAP_RPC_TIMEOUT ) ; response = new GetPortResponse ( ) ; response . unmarshalling ( reply ) ; } catch ( RpcException e ) { handleRpcException ( e , i , serverIP ) ; } } int port = response . getPort ( ) ; if ( port == 0 ) { // A port value of zeros means the program has not been // registered . String msg = String . format ( "No registry entry for program: %s, version: %s, serverIP: %s" , program , version , serverIP ) ; throw new IOException ( msg ) ; } return port ;
public class ClassUtils { /** * Gets the constructor with the specified signature from the given class type . * @ param < T > the generic class type from which to get the constructor . * @ param type the Class type from which to get the Constructor . * @ param parameterTypes an array of class types indicating the constructor signature . * @ return a Constructor from the given class type with a matching signature . * @ see java . lang . Class * @ see java . lang . Class # getDeclaredConstructor ( Class [ ] ) * @ see java . lang . reflect . Constructor */ public static < T > Constructor < T > getConstructor ( Class < T > type , Class < ? > ... parameterTypes ) { } }
try { return type . getDeclaredConstructor ( parameterTypes ) ; } catch ( NoSuchMethodException cause ) { throw new ConstructorNotFoundException ( cause ) ; }
public class ConstantsSummaryBuilder { /** * Build the summary for the current class . * @ param node the XML element that specifies which components to document * @ param summariesTree the tree to which the class constant summary will be added */ public void buildClassConstantSummary ( XMLNode node , Content summariesTree ) { } }
ClassDoc [ ] classes = currentPackage . name ( ) . length ( ) > 0 ? currentPackage . allClasses ( ) : configuration . classDocCatalog . allClasses ( DocletConstants . DEFAULT_PACKAGE_NAME ) ; Arrays . sort ( classes ) ; Content classConstantTree = writer . getClassConstantHeader ( ) ; for ( int i = 0 ; i < classes . length ; i ++ ) { if ( ! classDocsWithConstFields . contains ( classes [ i ] ) || ! classes [ i ] . isIncluded ( ) ) { continue ; } currentClass = classes [ i ] ; // Build the documentation for the current class . buildChildren ( node , classConstantTree ) ; } summariesTree . addContent ( classConstantTree ) ;
public class AmazonNeptuneClient { /** * Lists all the subscription descriptions for a customer account . The description for a subscription includes * SubscriptionName , SNSTopicARN , CustomerID , SourceType , SourceID , CreationTime , and Status . * If you specify a SubscriptionName , lists the description for that subscription . * @ param describeEventSubscriptionsRequest * @ return Result of the DescribeEventSubscriptions operation returned by the service . * @ throws SubscriptionNotFoundException * @ sample AmazonNeptune . DescribeEventSubscriptions * @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / neptune - 2014-10-31 / DescribeEventSubscriptions " * target = " _ top " > AWS API Documentation < / a > */ @ Override public DescribeEventSubscriptionsResult describeEventSubscriptions ( DescribeEventSubscriptionsRequest request ) { } }
request = beforeClientExecution ( request ) ; return executeDescribeEventSubscriptions ( request ) ;
public class NumberChineseFormater { /** * 阿拉伯数字转换成中文 , 小数点后四舍五入保留两位 . 使用于整数 、 小数的转换 . * @ param amount 数字 * @ param isUseTraditional 是否使用繁体 * @ param isMoneyMode 是否为金额模式 * @ return 中文 */ public static String format ( double amount , boolean isUseTraditional , boolean isMoneyMode ) { } }
final String [ ] numArray = isUseTraditional ? traditionalDigits : simpleDigits ; if ( amount > 99999999999999.99 || amount < - 99999999999999.99 ) { throw new IllegalArgumentException ( "Number support only: (-99999999999999.99 ~ 99999999999999.99)!" ) ; } boolean negative = false ; if ( amount < 0 ) { negative = true ; amount = - amount ; } long temp = Math . round ( amount * 100 ) ; int numFen = ( int ) ( temp % 10 ) ; temp = temp / 10 ; int numJiao = ( int ) ( temp % 10 ) ; temp = temp / 10 ; // 将数字以万为单位分为多份 int [ ] parts = new int [ 20 ] ; int numParts = 0 ; for ( int i = 0 ; temp != 0 ; i ++ ) { int part = ( int ) ( temp % 10000 ) ; parts [ i ] = part ; numParts ++ ; temp = temp / 10000 ; } boolean beforeWanIsZero = true ; // 标志 “ 万 ” 下面一级是不是 0 String chineseStr = StrUtil . EMPTY ; for ( int i = 0 ; i < numParts ; i ++ ) { String partChinese = toChinese ( parts [ i ] , isUseTraditional ) ; if ( i % 2 == 0 ) { beforeWanIsZero = StrUtil . isEmpty ( partChinese ) ; } if ( i != 0 ) { if ( i % 2 == 0 ) { chineseStr = "亿" + chineseStr ; } else { if ( "" . equals ( partChinese ) && false == beforeWanIsZero ) { // 如果 “ 万 ” 对应的 part 为 0 , 而 “ 万 ” 下面一级不为 0 , 则不加 “ 万 ” , 而加 “ 零 ” chineseStr = "零" + chineseStr ; } else { if ( parts [ i - 1 ] < 1000 && parts [ i - 1 ] > 0 ) { // 如果 " 万 " 的部分不为 0 , 而 " 万 " 前面的部分小于 1000 大于 0 , 则万后面应该跟 “ 零 ” chineseStr = "零" + chineseStr ; } chineseStr = "万" + chineseStr ; } } } chineseStr = partChinese + chineseStr ; } // 整数部分为 0 , 则表达为 " 零 " if ( StrUtil . EMPTY . equals ( chineseStr ) ) { chineseStr = numArray [ 0 ] ; } // 负数 if ( negative ) { // 整数部分不为 0 chineseStr = "负" + chineseStr ; } // 小数部分 if ( numFen != 0 || numJiao != 0 ) { if ( numFen == 0 ) { chineseStr += ( isMoneyMode ? "元" : "点" ) + numArray [ numJiao ] + ( isMoneyMode ? "角" : "" ) ; } else { // “ 分 ” 数不为 0 if ( numJiao == 0 ) { chineseStr += ( isMoneyMode ? "元零" : "点零" ) + numArray [ numFen ] + ( isMoneyMode ? "分" : "" ) ; } else { chineseStr += ( isMoneyMode ? "元" : "点" ) + numArray [ numJiao ] + ( isMoneyMode ? "角" : "" ) + numArray [ numFen ] + ( isMoneyMode ? "分" : "" ) ; } } } else if ( isMoneyMode ) { // 无小数部分的金额结尾 chineseStr += "元整" ; } return chineseStr ;
public class DatabaseRelationDefinition { /** * gets attribute with the specified position * @ param index is position < em > starting at 1 < / em > * @ return attribute at the position */ @ Override public Attribute getAttribute ( int index ) { } }
Attribute attribute = attributes . get ( index - 1 ) ; return attribute ;
public class HandyDateExpressionObject { protected AccessibleConfig getApplicationConfig ( ) { } }
if ( cachedApplicationConfig != null ) { return cachedApplicationConfig ; } synchronized ( this ) { if ( cachedApplicationConfig != null ) { return cachedApplicationConfig ; } cachedApplicationConfig = ContainerUtil . getComponent ( AccessibleConfig . class ) ; } return cachedApplicationConfig ;
public class MessageMgr { /** * Creates a new information message . * @ param what the what part of the message ( what has happened ) * @ param obj objects to add to the message * @ return new information message */ public static Message5WH createInfoMessage ( String what , Object ... obj ) { } }
return new Message5WH_Builder ( ) . addWhat ( FormattingTupleWrapper . create ( what , obj ) ) . setType ( E_MessageType . INFO ) . build ( ) ;
public class TaskLockbox { /** * Release lock held for a task on a particular interval . Does nothing if the task does not currently * hold the mentioned lock . * @ param task task to unlock * @ param interval interval to unlock */ public void unlock ( final Task task , final Interval interval ) { } }
giant . lock ( ) ; try { final String dataSource = task . getDataSource ( ) ; final NavigableMap < DateTime , SortedMap < Interval , List < TaskLockPosse > > > dsRunning = running . get ( task . getDataSource ( ) ) ; if ( dsRunning == null || dsRunning . isEmpty ( ) ) { return ; } final SortedMap < Interval , List < TaskLockPosse > > intervalToPosses = dsRunning . get ( interval . getStart ( ) ) ; if ( intervalToPosses == null || intervalToPosses . isEmpty ( ) ) { return ; } final List < TaskLockPosse > possesHolder = intervalToPosses . get ( interval ) ; if ( possesHolder == null || possesHolder . isEmpty ( ) ) { return ; } final List < TaskLockPosse > posses = possesHolder . stream ( ) . filter ( posse -> posse . containsTask ( task ) ) . collect ( Collectors . toList ( ) ) ; for ( TaskLockPosse taskLockPosse : posses ) { final TaskLock taskLock = taskLockPosse . getTaskLock ( ) ; // Remove task from live list log . info ( "Removing task[%s] from TaskLock[%s]" , task . getId ( ) , taskLock . getGroupId ( ) ) ; final boolean removed = taskLockPosse . removeTask ( task ) ; if ( taskLockPosse . isTasksEmpty ( ) ) { log . info ( "TaskLock is now empty: %s" , taskLock ) ; possesHolder . remove ( taskLockPosse ) ; } if ( possesHolder . isEmpty ( ) ) { intervalToPosses . remove ( interval ) ; } if ( intervalToPosses . isEmpty ( ) ) { dsRunning . remove ( interval . getStart ( ) ) ; } if ( running . get ( dataSource ) . size ( ) == 0 ) { running . remove ( dataSource ) ; } // Wake up blocking - lock waiters lockReleaseCondition . signalAll ( ) ; // Remove lock from storage . If it cannot be removed , just ignore the failure . try { taskStorage . removeLock ( task . getId ( ) , taskLock ) ; } catch ( Exception e ) { log . makeAlert ( e , "Failed to clean up lock from storage" ) . addData ( "task" , task . getId ( ) ) . addData ( "dataSource" , taskLock . getDataSource ( ) ) . addData ( "interval" , taskLock . getInterval ( ) ) . addData ( "version" , taskLock . getVersion ( ) ) . emit ( ) ; } if ( ! removed ) { log . makeAlert ( "Lock release without acquire" ) . addData ( "task" , task . getId ( ) ) . addData ( "interval" , interval ) . emit ( ) ; } } } finally { giant . unlock ( ) ; }
public class SolrIndex { /** * Wait for all the collection shards to be ready . */ private static void waitForRecoveriesToFinish ( CloudSolrClient server , String collection ) throws KeeperException , InterruptedException { } }
ZkStateReader zkStateReader = server . getZkStateReader ( ) ; try { boolean cont = true ; while ( cont ) { boolean sawLiveRecovering = false ; zkStateReader . updateClusterState ( true ) ; ClusterState clusterState = zkStateReader . getClusterState ( ) ; Map < String , Slice > slices = clusterState . getSlicesMap ( collection ) ; Preconditions . checkNotNull ( "Could not find collection:" + collection , slices ) ; // change paths for Replica . State per Solr refactoring // remove SYNC state per : http : / / tinyurl . com / pag6rwt for ( Map . Entry < String , Slice > entry : slices . entrySet ( ) ) { Map < String , Replica > shards = entry . getValue ( ) . getReplicasMap ( ) ; for ( Map . Entry < String , Replica > shard : shards . entrySet ( ) ) { String state = shard . getValue ( ) . getStr ( ZkStateReader . STATE_PROP ) ; if ( ( state . equals ( Replica . State . RECOVERING ) || state . equals ( Replica . State . DOWN ) ) && clusterState . liveNodesContain ( shard . getValue ( ) . getStr ( ZkStateReader . NODE_NAME_PROP ) ) ) { sawLiveRecovering = true ; } } } if ( ! sawLiveRecovering ) { cont = false ; } else { Thread . sleep ( 1000 ) ; } } } finally { logger . info ( "Exiting solr wait" ) ; }
public class LogTransferListener { /** * ( non - Javadoc ) * @ see org . sonatype . aether . util . listener . AbstractTransferListener # transferInitiated * ( org . sonatype . aether . transfer . TransferEvent ) */ @ Override public void transferInitiated ( TransferEvent event ) { } }
TransferResource resource = event . getResource ( ) ; StringBuilder sb = new StringBuilder ( ) . append ( event . getRequestType ( ) == TransferEvent . RequestType . PUT ? "Uploading" : "Downloading" ) . append ( ":" ) . append ( resource . getRepositoryUrl ( ) ) . append ( resource . getResourceName ( ) ) ; downloads . put ( resource , new Long ( 0 ) ) ; log . fine ( sb . toString ( ) ) ;
public class ScanIterator { /** * Sequentially iterate over elements in a set identified by { @ code key } . This method uses { @ code SSCAN } to perform an * iterative scan . * @ param commands the commands interface , must not be { @ literal null } . * @ param key the set to scan . * @ param scanArgs the scan arguments , must not be { @ literal null } . * @ param < K > Key type . * @ param < V > Value type . * @ return a new { @ link ScanIterator } . */ public static < K , V > ScanIterator < V > sscan ( RedisSetCommands < K , V > commands , K key , ScanArgs scanArgs ) { } }
LettuceAssert . notNull ( scanArgs , "ScanArgs must not be null" ) ; return sscan ( commands , key , Optional . of ( scanArgs ) ) ;
public class IterationSegmentStages { /** * During iteration , nextTier ( ) is called in doReplaceValue ( ) - > relocation ( ) - > alloc ( ) . * When the entry is relocated to the next tier , an entry should be inserted into hash * lookup . To insert an entry into hashLookup , should 1 ) locate empty slot , see { @ link * KeySearch # initKeySearch ( ) } , and 2 ) know the part of the hash code to insert , we know * it during iteration */ @ Override public void nextTier ( ) { } }
super . nextTier ( ) ; if ( it . hashLookupEntryInit ( ) ) hls . initSearchKey ( hh . h ( ) . hashLookup . key ( it . hashLookupEntry ) ) ;
public class Helpers { /** * Checks if a parameter exists . If it exists , it is updated . If it doesn ' t , it is created . Only works for parameters which key is * unique . Will create a transaction on the given entity manager . */ static void setSingleParam ( String key , String value , DbConn cnx ) { } }
QueryResult r = cnx . runUpdate ( "globalprm_update_value_by_key" , value , key ) ; if ( r . nbUpdated == 0 ) { cnx . runUpdate ( "globalprm_insert" , key , value ) ; } cnx . commit ( ) ;
public class JobHistoryService { /** * Returns a specific job ' s data by job ID * @ param jobId the fully qualified cluster + job identifier * @ param populateTasks if { @ code true } populate the { @ link TaskDetails } * records for the job */ public JobDetails getJobByJobID ( QualifiedJobId jobId , boolean populateTasks ) throws IOException { } }
JobDetails job = null ; JobKey key = idService . getJobKeyById ( jobId ) ; if ( key != null ) { byte [ ] historyKey = jobKeyConv . toBytes ( key ) ; Table historyTable = hbaseConnection . getTable ( TableName . valueOf ( Constants . HISTORY_TABLE ) ) ; Result result = historyTable . get ( new Get ( historyKey ) ) ; historyTable . close ( ) ; if ( result != null && ! result . isEmpty ( ) ) { job = new JobDetails ( key ) ; job . populate ( result ) ; if ( populateTasks ) { populateTasks ( job ) ; } } } return job ;
public class FunctionUtils { /** * Do if function . * @ param < R > the type parameter * @ param condition the condition * @ param trueFunction the true function * @ param falseFunction the false function * @ return the function */ @ SneakyThrows public static < R > Supplier < R > doIf ( final boolean condition , final Supplier < R > trueFunction , final Supplier < R > falseFunction ) { } }
return ( ) -> { try { if ( condition ) { return trueFunction . get ( ) ; } return falseFunction . get ( ) ; } catch ( final Throwable e ) { LOGGER . warn ( e . getMessage ( ) , e ) ; return falseFunction . get ( ) ; } } ;
public class MessageSource { /** * Get a raw message from the resource bundles using the given code . */ public String getMessage ( final String code ) { } }
assert code != null ; MissingResourceException error = null ; ResourceBundle [ ] bundles = getBundles ( ) ; for ( int i = 0 ; i < bundles . length ; i ++ ) { try { return bundles [ i ] . getString ( code ) ; } catch ( MissingResourceException e ) { // FIXME : For now just save the first error , should really roll a new message with all of the details if ( error != null ) { error = e ; } } } assert error != null ; throw error ;
public class JoinableResourceBundlePropertySerializer { /** * Returns the list of bundle names * @ param bundles * the bundles * @ return the list of bundle names */ private static List < String > getBundleNames ( List < JoinableResourceBundle > bundles ) { } }
List < String > bundleNames = new ArrayList < > ( ) ; for ( Iterator < JoinableResourceBundle > iterator = bundles . iterator ( ) ; iterator . hasNext ( ) ; ) { bundleNames . add ( iterator . next ( ) . getName ( ) ) ; } return bundleNames ;
public class ListTagsLogGroupRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( ListTagsLogGroupRequest listTagsLogGroupRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( listTagsLogGroupRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( listTagsLogGroupRequest . getLogGroupName ( ) , LOGGROUPNAME_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class DatabaseSpec { /** * Truncate table in MongoDB . * @ param database Mongo database * @ param table Mongo table */ @ Given ( "^I drop every document at a MongoDB database '(.+?)' and table '(.+?)'" ) public void truncateTableInMongo ( String database , String table ) { } }
commonspec . getMongoDBClient ( ) . connectToMongoDBDataBase ( database ) ; commonspec . getMongoDBClient ( ) . dropAllDataMongoDBCollection ( table ) ;
public class DateFunctions { /** * Returned expression results in Date part as an integer . * The date expression is a string in a supported format , and part is one of the supported date part strings . */ public static Expression datePartStr ( Expression expression , DatePartExt part ) { } }
return x ( "DATE_PART_STR(" + expression . toString ( ) + ", \"" + part . toString ( ) + "\")" ) ;
public class SaneSession { /** * Lists the devices known to the SANE daemon . * @ return a list of devices that may be opened , see { @ link SaneDevice # open } * @ throws IOException if an error occurs while communicating with the SANE daemon * @ throws SaneException if the SANE backend returns an error in response to this request */ public List < SaneDevice > listDevices ( ) throws IOException , SaneException { } }
outputStream . write ( SaneRpcCode . SANE_NET_GET_DEVICES ) ; outputStream . flush ( ) ; return inputStream . readDeviceList ( ) ;
public class AWSCodeCommitClient { /** * Returns the base - 64 encoded content of an individual blob within a repository . * @ param getBlobRequest * Represents the input of a get blob operation . * @ return Result of the GetBlob operation returned by the service . * @ throws RepositoryNameRequiredException * A repository name is required but was not specified . * @ throws InvalidRepositoryNameException * At least one specified repository name is not valid . < / p > < note > * This exception only occurs when a specified repository name is not valid . Other exceptions occur when a * required repository parameter is missing , or when a specified repository does not exist . * @ throws RepositoryDoesNotExistException * The specified repository does not exist . * @ throws BlobIdRequiredException * A blob ID is required but was not specified . * @ throws InvalidBlobIdException * The specified blob is not valid . * @ throws BlobIdDoesNotExistException * The specified blob does not exist . * @ throws EncryptionIntegrityChecksFailedException * An encryption integrity check failed . * @ throws EncryptionKeyAccessDeniedException * An encryption key could not be accessed . * @ throws EncryptionKeyDisabledException * The encryption key is disabled . * @ throws EncryptionKeyNotFoundException * No encryption key was found . * @ throws EncryptionKeyUnavailableException * The encryption key is not available . * @ throws FileTooLargeException * The specified file exceeds the file size limit for AWS CodeCommit . For more information about limits in * AWS CodeCommit , see < a href = " http : / / docs . aws . amazon . com / codecommit / latest / userguide / limits . html " > AWS * CodeCommit User Guide < / a > . * @ sample AWSCodeCommit . GetBlob * @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / codecommit - 2015-04-13 / GetBlob " target = " _ top " > AWS API * Documentation < / a > */ @ Override public GetBlobResult getBlob ( GetBlobRequest request ) { } }
request = beforeClientExecution ( request ) ; return executeGetBlob ( request ) ;
public class ProtoUtils { /** * Given a protobuf rebalance - partition info , converts it into our * rebalance - partition info * @ param rebalanceTaskInfoMap Proto - buff version of * RebalanceTaskInfoMap * @ return RebalanceTaskInfo object . */ public static RebalanceTaskInfo decodeRebalanceTaskInfoMap ( VAdminProto . RebalanceTaskInfoMap rebalanceTaskInfoMap ) { } }
RebalanceTaskInfo rebalanceTaskInfo = new RebalanceTaskInfo ( rebalanceTaskInfoMap . getStealerId ( ) , rebalanceTaskInfoMap . getDonorId ( ) , decodeStoreToPartitionIds ( rebalanceTaskInfoMap . getPerStorePartitionIdsList ( ) ) , new ClusterMapper ( ) . readCluster ( new StringReader ( rebalanceTaskInfoMap . getInitialCluster ( ) ) ) ) ; return rebalanceTaskInfo ;
public class BroadleafPayPalCheckoutController { /** * Completes checkout for a PayPal payment . If there ' s already a PayPal payment we go ahead and make sure the details * of the payment are updated to all of the forms filled out by the customer since they could ' ve updated shipping * information , added a promotion , or other various things to the order . * @ return Redirect URL to either add the payment and checkout or just checkout * @ throws PaymentException */ @ RequestMapping ( value = "/checkout/complete" , method = RequestMethod . POST ) public String completeCheckout ( ) throws PaymentException { } }
paymentService . updatePayPalPaymentForFulfillment ( ) ; String paymentId = paymentService . getPayPalPaymentIdFromCurrentOrder ( ) ; String payerId = paymentService . getPayPalPayerIdFromCurrentOrder ( ) ; if ( StringUtils . isBlank ( paymentId ) ) { throw new PaymentException ( "Unable to complete checkout because no PayPal payment id was found on the current order" ) ; } if ( StringUtils . isBlank ( payerId ) ) { throw new PaymentException ( "Unable to complete checkout because no PayPal payer id was found on the current order" ) ; } return "redirect:/paypal-checkout/return?" + MessageConstants . HTTP_PAYMENTID + "=" + paymentId + "&" + MessageConstants . HTTP_PAYERID + "=" + payerId ;
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link CovarianceElementType } { @ code > } * @ param value * Java instance representing xml element ' s value . * @ return * the new instance of { @ link JAXBElement } { @ code < } { @ link CovarianceElementType } { @ code > } */ @ XmlElementDecl ( namespace = "http://www.opengis.net/gml" , name = "includesElement" ) public JAXBElement < CovarianceElementType > createIncludesElement ( CovarianceElementType value ) { } }
return new JAXBElement < CovarianceElementType > ( _IncludesElement_QNAME , CovarianceElementType . class , null , value ) ;
public class RPMBuilder { /** * Add file to package from path . * @ param source * @ param target Target path like / opt / application / bin / foo * @ return * @ throws IOException */ @ Override public FileBuilder addFile ( Path source , Path target ) throws IOException { } }
checkTarget ( target ) ; FileBuilder fb = new FileBuilder ( ) ; fb . target = target ; fb . size = ( int ) Files . size ( source ) ; try ( FileChannel fc = FileChannel . open ( source , READ ) ) { fb . content = fc . map ( FileChannel . MapMode . READ_ONLY , 0 , fb . size ) ; } FileTime fileTime = Files . getLastModifiedTime ( source ) ; fb . time = ( int ) fileTime . to ( TimeUnit . SECONDS ) ; fb . compressFilename ( ) ; fileBuilders . add ( fb ) ; return fb ;
public class MiniSatStyleSolver { /** * Computes the next number in the Luby sequence . * @ param y the restart increment * @ param x the current number of restarts * @ return the next number in the Luby sequence */ protected static double luby ( double y , int x ) { } }
int intX = x ; int size = 1 ; int seq = 0 ; while ( size < intX + 1 ) { seq ++ ; size = 2 * size + 1 ; } while ( size - 1 != intX ) { size = ( size - 1 ) >> 1 ; seq -- ; intX = intX % size ; } return Math . pow ( y , seq ) ;
public class BatchListIncomingTypedLinksResponseMarshaller { /** * Marshall the given parameter object . */ public void marshall ( BatchListIncomingTypedLinksResponse batchListIncomingTypedLinksResponse , ProtocolMarshaller protocolMarshaller ) { } }
if ( batchListIncomingTypedLinksResponse == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( batchListIncomingTypedLinksResponse . getLinkSpecifiers ( ) , LINKSPECIFIERS_BINDING ) ; protocolMarshaller . marshall ( batchListIncomingTypedLinksResponse . getNextToken ( ) , NEXTTOKEN_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class WatchTextBatchSpout { /** * { @ inheritDoc } */ @ SuppressWarnings ( { } }
"rawtypes" } ) @ Override public void open ( Map conf , TopologyContext context ) { this . taskIndex = context . getThisTaskIndex ( ) ; this . dataFileName = this . baseFileName + "_" + this . taskIndex ; this . targetFile = new File ( this . dataFileDir , this . dataFileName ) ;
public class GregorianCalendar { /** * Sets the GregorianCalendar change date . This is the point when the switch * from Julian dates to Gregorian dates occurred . Default is October 15, * 1582 . Previous to this , dates will be in the Julian calendar . * To obtain a pure Julian calendar , set the change date to * < code > Date ( Long . MAX _ VALUE ) < / code > . To obtain a pure Gregorian calendar , * set the change date to < code > Date ( Long . MIN _ VALUE ) < / code > . * @ param date the given Gregorian cutover date . */ public void setGregorianChange ( Date date ) { } }
gregorianCutover = date . getTime ( ) ; // If the cutover has an extreme value , then create a pure // Gregorian or pure Julian calendar by giving the cutover year and // JD extreme values . if ( gregorianCutover <= MIN_MILLIS ) { gregorianCutoverYear = cutoverJulianDay = Integer . MIN_VALUE ; } else if ( gregorianCutover >= MAX_MILLIS ) { gregorianCutoverYear = cutoverJulianDay = Integer . MAX_VALUE ; } else { // Precompute two internal variables which we use to do the actual // cutover computations . These are the Julian day of the cutover // and the cutover year . cutoverJulianDay = ( int ) floorDivide ( gregorianCutover , ONE_DAY ) ; // Convert cutover millis to extended year GregorianCalendar cal = new GregorianCalendar ( getTimeZone ( ) ) ; cal . setTime ( date ) ; gregorianCutoverYear = cal . get ( EXTENDED_YEAR ) ; }
public class BELUtilities { /** * Returns the first message available in a stack trace . * This method can be used to obtain the first occurrence of * { @ link Exception # getMessage ( ) the exception message } through a series of * { @ link Exception # getCause ( ) causes } . * @ param t the { @ link Throwable throwable } * @ return { @ link String } ; may be null */ public static String getFirstMessage ( Throwable t ) { } }
if ( t == null ) { return null ; } String ret = t . getMessage ( ) ; Throwable cause = t ; while ( cause . getCause ( ) != null ) { cause = cause . getCause ( ) ; if ( cause . getMessage ( ) != null ) { ret = cause . getMessage ( ) ; } } return ret ;