signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class RamLruCache { /** * Remove the eldest entries until the total of remaining entries is at or * below the requested size . * @ param maxSize the maximum size of the cache before returning . May be - 1 * to evict even 0 - sized elements . */ public void trimToSize ( int maxSize ) { } }
while ( true ) { K key ; V value ; synchronized ( this ) { if ( size < 0 || ( map . isEmpty ( ) && size != 0 ) ) { throw new IllegalStateException ( getClass ( ) . getName ( ) + ".sizeOf() is reporting inconsistent results!" ) ; } if ( size <= maxSize ) { break ; } Map . Entry < K , V > toEvict = null ; try { toEvict = ( Map . Entry < K , V > ) map . getClass ( ) . getMethod ( "eldest" ) . invoke ( map ) ; } catch ( NoSuchMethodException e ) { e . printStackTrace ( ) ; } catch ( InvocationTargetException e ) { e . printStackTrace ( ) ; } catch ( IllegalAccessException e ) { e . printStackTrace ( ) ; } if ( toEvict == null ) { break ; } key = toEvict . getKey ( ) ; value = toEvict . getValue ( ) ; map . remove ( key ) ; size -= safeSizeOf ( key , value ) ; evictionCount ++ ; } entryRemoved ( true , key , value , null ) ; }
public class BpmnXMLUtil { /** * add all attributes from XML to element extensionAttributes ( except blackListed ) . * @ param xtr * @ param element * @ param blackLists */ public static void addCustomAttributes ( XMLStreamReader xtr , BaseElement element , List < ExtensionAttribute > ... blackLists ) { } }
for ( int i = 0 ; i < xtr . getAttributeCount ( ) ; i ++ ) { ExtensionAttribute extensionAttribute = new ExtensionAttribute ( ) ; extensionAttribute . setName ( xtr . getAttributeLocalName ( i ) ) ; extensionAttribute . setValue ( xtr . getAttributeValue ( i ) ) ; if ( StringUtils . isNotEmpty ( xtr . getAttributeNamespace ( i ) ) ) { extensionAttribute . setNamespace ( xtr . getAttributeNamespace ( i ) ) ; } if ( StringUtils . isNotEmpty ( xtr . getAttributePrefix ( i ) ) ) { extensionAttribute . setNamespacePrefix ( xtr . getAttributePrefix ( i ) ) ; } if ( ! isBlacklisted ( extensionAttribute , blackLists ) ) { element . addAttribute ( extensionAttribute ) ; } }
public class FNCImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public void setXftUnits ( Integer newXftUnits ) { } }
Integer oldXftUnits = xftUnits ; xftUnits = newXftUnits ; if ( eNotificationRequired ( ) ) eNotify ( new ENotificationImpl ( this , Notification . SET , AfplibPackage . FNC__XFT_UNITS , oldXftUnits , xftUnits ) ) ;
public class EventDataObjectDeserializer { /** * Safe deserialize raw JSON into { @ code StripeObject } . This operation mutates the state , and the * successful result can be accessed via { @ link EventDataObjectDeserializer # getObject ( ) } . * Matching { @ link Event # getApiVersion ( ) } and { @ link Stripe # API _ VERSION } is necessary condition * to guarantee safe deserialization . * @ return whether deserialization has been successful . */ private boolean deserialize ( ) { } }
if ( ! apiVersionMatch ( ) ) { // when version mismatch , even when deserialization is successful , // we cannot guarantee data correctness . Old events containing fields that should be // translated / mapped to the new schema will simply not be captured by the new schema . return false ; } else if ( object != null ) { // already successfully deserialized return true ; } else { try { object = EventDataDeserializer . deserializeStripeObject ( rawJsonObject ) ; return true ; } catch ( JsonParseException e ) { // intentionally ignore exception to fulfill simply whether deserialization succeeds return false ; } }
public class DoubleUtils { /** * Returns the index of the first minimal element of the array within the specified bounds . That * is , if there is a unique minimum , its index is returned . If there are multiple values tied for * smallest , the index of the first is returned . If the supplied array is empty , an { @ link * IllegalArgumentException } is thrown . */ public static int argMin ( final double [ ] x , final int startInclusive , final int endExclusive ) { } }
checkArgument ( endExclusive > startInclusive ) ; checkArgument ( startInclusive >= 0 ) ; checkArgument ( endExclusive <= x . length ) ; double minValue = Double . MAX_VALUE ; int minIndex = 0 ; for ( int i = startInclusive ; i < endExclusive ; ++ i ) { final double val = x [ i ] ; if ( val < minValue ) { minIndex = i ; minValue = val ; } } return minIndex ;
public class EurekaClinicalClient { /** * Makes a POST call to the specified path . * @ param path the path to call . * @ throws ClientException if a status code other than 200 ( OK ) and 204 ( No * Content ) is returned . */ protected void doPost ( String path ) throws ClientException { } }
this . readLock . lock ( ) ; try { ClientResponse response = getResourceWrapper ( ) . rewritten ( path , HttpMethod . POST ) . post ( ClientResponse . class ) ; errorIfStatusNotEqualTo ( response , ClientResponse . Status . OK , ClientResponse . Status . NO_CONTENT ) ; response . close ( ) ; } catch ( ClientHandlerException ex ) { throw new ClientException ( ClientResponse . Status . INTERNAL_SERVER_ERROR , ex . getMessage ( ) ) ; } finally { this . readLock . unlock ( ) ; }
public class Functions { /** * Transforms the { @ link EntityID } to a { @ link UUID } supplier . * @ param id * ID annotation . * @ return ID supplier using annotation . * @ see # validateEntityID ( EntityID ) */ public static Supplier < UUID > toIDSupplier ( final EntityID id ) { } }
validateEntityID ( id ) ; // Random supplier if ( id . random ( ) ) { return RANDOM_ID_SUPPLIER ; } // Create ID final UUID newID ; if ( id . name ( ) . length ( ) > 0 ) { newID = UUID . fromString ( id . name ( ) ) ; } else { newID = new UUID ( id . mostSigBits ( ) , id . leastSigBits ( ) ) ; } // Create static ID supplier . return ( ) -> newID ;
public class SharesInner { /** * Refreshes the share metadata with the data from the cloud . * @ param deviceName The device name . * @ param name The share name . * @ param resourceGroupName The resource group name . * @ 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 beginRefresh ( String deviceName , String name , String resourceGroupName ) { } }
beginRefreshWithServiceResponseAsync ( deviceName , name , resourceGroupName ) . toBlocking ( ) . single ( ) . body ( ) ;
public class ServiceDiscoveryRunnable { /** * Trigger the loop every time enough ticks have been accumulated , or whenever any of the * visitors requests it . */ @ Override public long determineCurrentGeneration ( final AtomicLong generation , final long tick ) { } }
// If the scan interval was reached , trigger the // run . if ( tick - lastScan >= scanTicks ) { lastScan = tick ; return generation . incrementAndGet ( ) ; } // Otherwise , give the service discovery serviceDiscoveryVisitors a chance // to increment the generation . for ( ServiceDiscoveryTask visitor : visitors ) { visitor . determineGeneration ( generation , tick ) ; } return generation . get ( ) ;
public class SampleEventsProcessor { /** * Do simple validation before processing . * @ param event to validate */ private void validateEvent ( CloudTrailEvent event ) { } }
if ( event . getEventData ( ) . getAccountId ( ) == null ) { logger . error ( String . format ( "Event %s doesn't have account ID." , event . getEventData ( ) ) ) ; } // more validation here . . .
public class MicrochipPotentiometerBase { /** * Updates the cache to the wiper ' s value . * @ return The wiper ' s current value * @ throws IOException Thrown if communication fails or device returned a malformed result */ @ Override public int updateCacheFromDevice ( ) throws IOException { } }
currentValue = controller . getValue ( DeviceControllerChannel . valueOf ( channel ) , false ) ; return currentValue ;
public class HistoryReference { /** * ZAP : Support for multiple tags */ public void addTag ( String tag ) { } }
if ( insertTagDb ( tag ) ) { this . tags . add ( tag ) ; notifyEvent ( HistoryReferenceEventPublisher . EVENT_TAG_ADDED ) ; }
public class ArrayUtils { /** * Returns an { @ link Enumeration } enumerating over the elements in the array . * @ param < T > Class type of the elements in the array . * @ param array array to enumerate . * @ return an { @ link Enumeration } over the elements in the array or an empty { @ link Enumeration } * if the array is null or empty . * @ see java . util . Enumeration */ @ NullSafe @ SafeVarargs public static < T > Enumeration < T > asEnumeration ( T ... array ) { } }
return ( array == null ? Collections . emptyEnumeration ( ) : new Enumeration < T > ( ) { private int index = 0 ; @ Override public boolean hasMoreElements ( ) { return ( index < array . length ) ; } @ Override public T nextElement ( ) { Assert . isTrue ( hasMoreElements ( ) , new NoSuchElementException ( "No more elements" ) ) ; return array [ index ++ ] ; } } ) ;
public class FullDemo { /** * createDemoButtons , This creates the buttons for the demo , adds an action listener to each * button , and adds each button to the display panel . */ private static void createDemoButtons ( ) { } }
JPanel buttonPanel = new JPanel ( new WrapLayout ( ) ) ; panel . scrollPaneForButtons . setViewportView ( buttonPanel ) ; // Create each demo button , and add it to the panel . // Add an action listener to link it to its appropriate function . JButton showIntro = new JButton ( "Show Introduction Message" ) ; showIntro . addActionListener ( new ActionListener ( ) { @ Override public void actionPerformed ( ActionEvent e ) { showIntroductionClicked ( e ) ; } } ) ; buttonPanel . add ( showIntro ) ; JButton setTwoWithY2K = new JButton ( "Set DatePicker Two with New Years Day 2000" ) ; setTwoWithY2K . addActionListener ( new ActionListener ( ) { @ Override public void actionPerformed ( ActionEvent e ) { setTwoWithY2KButtonClicked ( e ) ; } } ) ; buttonPanel . add ( setTwoWithY2K ) ; JButton setDateOneWithTwo = new JButton ( "Set DatePicker One with the date in Two" ) ; setDateOneWithTwo . addActionListener ( new ActionListener ( ) { @ Override public void actionPerformed ( ActionEvent e ) { setOneWithTwoButtonClicked ( e ) ; } } ) ; buttonPanel . add ( setDateOneWithTwo ) ; JButton setOneWithFeb31 = new JButton ( "Set Text in DatePicker One to Feb 31, 1950" ) ; setOneWithFeb31 . addActionListener ( new ActionListener ( ) { @ Override public void actionPerformed ( ActionEvent e ) { setOneWithFeb31ButtonClicked ( e ) ; } } ) ; buttonPanel . add ( setOneWithFeb31 ) ; JButton getOneAndShow = new JButton ( "Get and show the date in DatePicker One" ) ; getOneAndShow . addActionListener ( new ActionListener ( ) { @ Override public void actionPerformed ( ActionEvent e ) { getOneAndShowButtonClicked ( e ) ; } } ) ; buttonPanel . add ( getOneAndShow ) ; JButton clearOneAndTwo = new JButton ( "Clear DatePickers One and Two" ) ; clearOneAndTwo . addActionListener ( new ActionListener ( ) { @ Override public void actionPerformed ( ActionEvent e ) { clearOneAndTwoButtonClicked ( e ) ; } } ) ; buttonPanel . add ( clearOneAndTwo ) ; JButton toggleButton = new JButton ( "Toggle DatePicker One" ) ; toggleButton . addMouseListener ( new MouseAdapter ( ) { @ Override public void mousePressed ( MouseEvent e ) { toggleDateOneButtonClicked ( ) ; } } ) ; buttonPanel . add ( toggleButton ) ; JButton setTimeOneWithTwo = new JButton ( "TimePickers: Set TimePicker One with the time in Two" ) ; setTimeOneWithTwo . addActionListener ( new ActionListener ( ) { @ Override public void actionPerformed ( ActionEvent e ) { setTimeOneWithTimeTwoButtonClicked ( e ) ; } } ) ; buttonPanel . add ( setTimeOneWithTwo ) ; JButton timeToggleButton = new JButton ( "Toggle TimePicker One" ) ; timeToggleButton . addMouseListener ( new MouseAdapter ( ) { @ Override public void mousePressed ( MouseEvent e ) { toggleTimeOneButtonClicked ( ) ; } } ) ; buttonPanel . add ( timeToggleButton ) ; // Add a button for showing the table editors demo . JButton tableEditorsDemoButton = new JButton ( "Show TableEditorsDemo" ) ; tableEditorsDemoButton . addMouseListener ( new MouseAdapter ( ) { @ Override public void mousePressed ( MouseEvent e ) { showTableEditorsDemoButtonClicked ( ) ; } } ) ; buttonPanel . add ( tableEditorsDemoButton ) ; // Add a button for showing system information . JButton showSystemInformationButton = new JButton ( "JDK Versions" ) ; showSystemInformationButton . addMouseListener ( new MouseAdapter ( ) { @ Override public void mousePressed ( MouseEvent e ) { showSystemInformationButtonClicked ( ) ; } } ) ; buttonPanel . add ( showSystemInformationButton ) ;
public class JSLocalConsumerPoint { /** * Update the max active messages field * Set by the MessagePump class to indicate that there has been an update * in the Threadpool class . * WARNING : if the max is ever set to zero ( now or on registration ) then counting * is disabled ( for performance ) , so if it ever gets reset to a non - zero * value we will not have accounted for any currently active messages so * the count will be out by a certain offset , which could cause it to go * negative . * @ param maxActiveMessages */ @ Override public void setMaxActiveMessages ( int maxActiveMessages ) { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "setMaxActiveMessages" , Integer . valueOf ( maxActiveMessages ) ) ; synchronized ( _asynchConsumerBusyLock ) { this . lock ( ) ; try { synchronized ( _maxActiveMessageLock ) { // If the new value is > previous value and // check if consumer is suspended and resume consumer . // But only do this if the message count is less than the curent active count if ( maxActiveMessages > _maxActiveMessages && maxActiveMessages < _currentActiveMessages ) { // If the consumer was suspended - reenable it if ( _consumerSuspended ) { // If this is part of an asynch callback we don ' t need to try and kick // off a new thread as the nextLocked will return us another message on // exit of the consumeMessages ( ) method . if ( _runningAsynchConsumer ) { _consumerSuspended = false ; _suspendFlags &= ~ DispatchableConsumerPoint . SUSPEND_FLAG_ACTIVE_MSGS ; } // Otherwise perform a full resume else { resumeConsumer ( DispatchableConsumerPoint . SUSPEND_FLAG_ACTIVE_MSGS ) ; } } } else if ( maxActiveMessages <= _currentActiveMessages && ! _consumerSuspended ) { // If the maxActiveMessages has been set to something lower than the current active message // count , then suspend the consumer until the messages have been processed _consumerSuspended = true ; _suspendFlags |= DispatchableConsumerPoint . SUSPEND_FLAG_ACTIVE_MSGS ; } _maxActiveMessages = maxActiveMessages ; } // active message lock } // this lock finally { this . unlock ( ) ; } } // async lock if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "setMaxActiveMessages" ) ;
public class JavaParser { /** * src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 1215:1 : primary : ( parExpression | nonWildcardTypeArguments ( explicitGenericInvocationSuffix | ' this ' arguments ) | ' this ' ( ' . ' Identifier ) * ( identifierSuffix ) ? | ' super ' superSuffix | epStatement ( ' . ' methodName ) * ( identifierSuffix ) ? | literal | ' new ' creator | i = Identifier ( ' . ' methodName ) * ( identifierSuffix ) ? | primitiveType ( ' [ ' ' ] ' ) * ' . ' ' class ' | ' void ' ' . ' ' class ' ) ; */ public final void primary ( ) throws RecognitionException { } }
int primary_StartIndex = input . index ( ) ; Token i = null ; try { if ( state . backtracking > 0 && alreadyParsedRule ( input , 127 ) ) { return ; } // src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 1216:5 : ( parExpression | nonWildcardTypeArguments ( explicitGenericInvocationSuffix | ' this ' arguments ) | ' this ' ( ' . ' Identifier ) * ( identifierSuffix ) ? | ' super ' superSuffix | epStatement ( ' . ' methodName ) * ( identifierSuffix ) ? | literal | ' new ' creator | i = Identifier ( ' . ' methodName ) * ( identifierSuffix ) ? | primitiveType ( ' [ ' ' ] ' ) * ' . ' ' class ' | ' void ' ' . ' ' class ' ) int alt170 = 10 ; switch ( input . LA ( 1 ) ) { case 36 : { alt170 = 1 ; } break ; case 53 : { alt170 = 2 ; } break ; case 111 : { alt170 = 3 ; } break ; case 108 : { alt170 = 4 ; } break ; case 70 : case 79 : case 80 : { alt170 = 5 ; } break ; case CharacterLiteral : case DecimalLiteral : case FloatingPointLiteral : case HexLiteral : case OctalLiteral : case StringLiteral : case 82 : case 98 : case 115 : { alt170 = 6 ; } break ; case 97 : { alt170 = 7 ; } break ; case Identifier : { alt170 = 8 ; } break ; case 65 : case 67 : case 71 : case 77 : case 85 : case 92 : case 94 : case 105 : { alt170 = 9 ; } break ; case 118 : { alt170 = 10 ; } break ; default : if ( state . backtracking > 0 ) { state . failed = true ; return ; } NoViableAltException nvae = new NoViableAltException ( "" , 170 , 0 , input ) ; throw nvae ; } switch ( alt170 ) { case 1 : // src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 1216:7 : parExpression { pushFollow ( FOLLOW_parExpression_in_primary5654 ) ; parExpression ( ) ; state . _fsp -- ; if ( state . failed ) return ; } break ; case 2 : // src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 1217:9 : nonWildcardTypeArguments ( explicitGenericInvocationSuffix | ' this ' arguments ) { pushFollow ( FOLLOW_nonWildcardTypeArguments_in_primary5664 ) ; nonWildcardTypeArguments ( ) ; state . _fsp -- ; if ( state . failed ) return ; // src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 1218:9 : ( explicitGenericInvocationSuffix | ' this ' arguments ) int alt162 = 2 ; int LA162_0 = input . LA ( 1 ) ; if ( ( LA162_0 == Identifier || LA162_0 == 108 ) ) { alt162 = 1 ; } else if ( ( LA162_0 == 111 ) ) { alt162 = 2 ; } else { if ( state . backtracking > 0 ) { state . failed = true ; return ; } NoViableAltException nvae = new NoViableAltException ( "" , 162 , 0 , input ) ; throw nvae ; } switch ( alt162 ) { case 1 : // src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 1218:10 : explicitGenericInvocationSuffix { pushFollow ( FOLLOW_explicitGenericInvocationSuffix_in_primary5675 ) ; explicitGenericInvocationSuffix ( ) ; state . _fsp -- ; if ( state . failed ) return ; } break ; case 2 : // src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 1218:44 : ' this ' arguments { match ( input , 111 , FOLLOW_111_in_primary5679 ) ; if ( state . failed ) return ; pushFollow ( FOLLOW_arguments_in_primary5681 ) ; arguments ( ) ; state . _fsp -- ; if ( state . failed ) return ; } break ; } } break ; case 3 : // src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 1219:9 : ' this ' ( ' . ' Identifier ) * ( identifierSuffix ) ? { match ( input , 111 , FOLLOW_111_in_primary5692 ) ; if ( state . failed ) return ; // src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 1219:16 : ( ' . ' Identifier ) * loop163 : while ( true ) { int alt163 = 2 ; int LA163_0 = input . LA ( 1 ) ; if ( ( LA163_0 == 47 ) ) { int LA163_3 = input . LA ( 2 ) ; if ( ( LA163_3 == Identifier ) ) { int LA163_37 = input . LA ( 3 ) ; if ( ( synpred249_Java ( ) ) ) { alt163 = 1 ; } } } switch ( alt163 ) { case 1 : // src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 1219:17 : ' . ' Identifier { match ( input , 47 , FOLLOW_47_in_primary5695 ) ; if ( state . failed ) return ; match ( input , Identifier , FOLLOW_Identifier_in_primary5697 ) ; if ( state . failed ) return ; } break ; default : break loop163 ; } } // src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 1219:34 : ( identifierSuffix ) ? int alt164 = 2 ; alt164 = dfa164 . predict ( input ) ; switch ( alt164 ) { case 1 : // src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 1219:35 : identifierSuffix { pushFollow ( FOLLOW_identifierSuffix_in_primary5702 ) ; identifierSuffix ( ) ; state . _fsp -- ; if ( state . failed ) return ; } break ; } } break ; case 4 : // src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 1220:9 : ' super ' superSuffix { match ( input , 108 , FOLLOW_108_in_primary5714 ) ; if ( state . failed ) return ; pushFollow ( FOLLOW_superSuffix_in_primary5716 ) ; superSuffix ( ) ; state . _fsp -- ; if ( state . failed ) return ; } break ; case 5 : // src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 1221:9 : epStatement ( ' . ' methodName ) * ( identifierSuffix ) ? { pushFollow ( FOLLOW_epStatement_in_primary5726 ) ; epStatement ( ) ; state . _fsp -- ; if ( state . failed ) return ; // src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 1221:21 : ( ' . ' methodName ) * loop165 : while ( true ) { int alt165 = 2 ; int LA165_0 = input . LA ( 1 ) ; if ( ( LA165_0 == 47 ) ) { int LA165_3 = input . LA ( 2 ) ; if ( ( LA165_3 == Identifier || LA165_3 == 75 || LA165_3 == 90 || LA165_3 == 95 || LA165_3 == 103 || LA165_3 == 117 ) ) { int LA165_38 = input . LA ( 3 ) ; if ( ( synpred253_Java ( ) ) ) { alt165 = 1 ; } } } switch ( alt165 ) { case 1 : // src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 1221:22 : ' . ' methodName { match ( input , 47 , FOLLOW_47_in_primary5729 ) ; if ( state . failed ) return ; pushFollow ( FOLLOW_methodName_in_primary5731 ) ; methodName ( ) ; state . _fsp -- ; if ( state . failed ) return ; } break ; default : break loop165 ; } } // src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 1221:39 : ( identifierSuffix ) ? int alt166 = 2 ; alt166 = dfa166 . predict ( input ) ; switch ( alt166 ) { case 1 : // src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 1221:40 : identifierSuffix { pushFollow ( FOLLOW_identifierSuffix_in_primary5736 ) ; identifierSuffix ( ) ; state . _fsp -- ; if ( state . failed ) return ; } break ; } } break ; case 6 : // src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 1222:9 : literal { pushFollow ( FOLLOW_literal_in_primary5748 ) ; literal ( ) ; state . _fsp -- ; if ( state . failed ) return ; } break ; case 7 : // src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 1223:9 : ' new ' creator { match ( input , 97 , FOLLOW_97_in_primary5758 ) ; if ( state . failed ) return ; pushFollow ( FOLLOW_creator_in_primary5760 ) ; creator ( ) ; state . _fsp -- ; if ( state . failed ) return ; } break ; case 8 : // src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 1224:9 : i = Identifier ( ' . ' methodName ) * ( identifierSuffix ) ? { i = ( Token ) match ( input , Identifier , FOLLOW_Identifier_in_primary5772 ) ; if ( state . failed ) return ; if ( state . backtracking == 0 ) { if ( ! "(" . equals ( input . LT ( 1 ) == null ? "" : input . LT ( 1 ) . getText ( ) ) ) identifiers . add ( ( i != null ? i . getText ( ) : null ) ) ; } // src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 1224:126 : ( ' . ' methodName ) * loop167 : while ( true ) { int alt167 = 2 ; int LA167_0 = input . LA ( 1 ) ; if ( ( LA167_0 == 47 ) ) { int LA167_3 = input . LA ( 2 ) ; if ( ( LA167_3 == Identifier || LA167_3 == 75 || LA167_3 == 90 || LA167_3 == 95 || LA167_3 == 103 || LA167_3 == 117 ) ) { int LA167_38 = input . LA ( 3 ) ; if ( ( synpred258_Java ( ) ) ) { alt167 = 1 ; } } } switch ( alt167 ) { case 1 : // src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 1224:127 : ' . ' methodName { match ( input , 47 , FOLLOW_47_in_primary5777 ) ; if ( state . failed ) return ; pushFollow ( FOLLOW_methodName_in_primary5779 ) ; methodName ( ) ; state . _fsp -- ; if ( state . failed ) return ; } break ; default : break loop167 ; } } // src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 1224:144 : ( identifierSuffix ) ? int alt168 = 2 ; alt168 = dfa168 . predict ( input ) ; switch ( alt168 ) { case 1 : // src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 1224:145 : identifierSuffix { pushFollow ( FOLLOW_identifierSuffix_in_primary5784 ) ; identifierSuffix ( ) ; state . _fsp -- ; if ( state . failed ) return ; } break ; } } break ; case 9 : // src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 1225:9 : primitiveType ( ' [ ' ' ] ' ) * ' . ' ' class ' { pushFollow ( FOLLOW_primitiveType_in_primary5796 ) ; primitiveType ( ) ; state . _fsp -- ; if ( state . failed ) return ; // src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 1225:23 : ( ' [ ' ' ] ' ) * loop169 : while ( true ) { int alt169 = 2 ; int LA169_0 = input . LA ( 1 ) ; if ( ( LA169_0 == 59 ) ) { alt169 = 1 ; } switch ( alt169 ) { case 1 : // src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 1225:24 : ' [ ' ' ] ' { match ( input , 59 , FOLLOW_59_in_primary5799 ) ; if ( state . failed ) return ; match ( input , 60 , FOLLOW_60_in_primary5801 ) ; if ( state . failed ) return ; } break ; default : break loop169 ; } } match ( input , 47 , FOLLOW_47_in_primary5805 ) ; if ( state . failed ) return ; match ( input , 72 , FOLLOW_72_in_primary5807 ) ; if ( state . failed ) return ; } break ; case 10 : // src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 1226:9 : ' void ' ' . ' ' class ' { match ( input , 118 , FOLLOW_118_in_primary5817 ) ; if ( state . failed ) return ; match ( input , 47 , FOLLOW_47_in_primary5819 ) ; if ( state . failed ) return ; match ( input , 72 , FOLLOW_72_in_primary5821 ) ; if ( state . failed ) return ; } break ; } } catch ( RecognitionException re ) { reportError ( re ) ; recover ( input , re ) ; } finally { // do for sure before leaving if ( state . backtracking > 0 ) { memoize ( input , 127 , primary_StartIndex ) ; } }
public class HttpFields { /** * Get field value without parameters . Some field values can have * parameters . This method separates the value from the parameters and * optionally populates a map with the parameters . For example : * < PRE > * FieldName : Value ; param1 = val1 ; param2 = val2 * < / PRE > * @ param value The Field value , possibly with parameters . * @ return The value . */ public static String stripParameters ( String value ) { } }
if ( value == null ) return null ; int i = value . indexOf ( ';' ) ; if ( i < 0 ) return value ; return value . substring ( 0 , i ) . trim ( ) ;
public class BoxPlot { /** * Little test program */ public static void main ( String [ ] argv ) throws IOException { } }
final File outputDir = new File ( argv [ 0 ] ) ; final Random rand = new Random ( ) ; final double mean1 = 5.0 ; final double mean2 = 7.0 ; final double dev1 = 2.0 ; final double dev2 = 4.0 ; final double [ ] data1 = new double [ 100 ] ; final double [ ] data2 = new double [ 100 ] ; for ( int i = 0 ; i < 100 ; ++ i ) { data1 [ i ] = rand . nextGaussian ( ) * dev1 + mean1 ; data2 [ i ] = rand . nextGaussian ( ) * dev2 + mean2 ; } BoxPlot . builder ( ) . addDataset ( Dataset . createAdoptingData ( "A" , data1 ) ) . addDataset ( Dataset . createAdoptingData ( "B" , data2 ) ) . setTitle ( "A vs B" ) . setXAxis ( Axis . xAxis ( ) . setLabel ( "FooCategory" ) . build ( ) ) . setYAxis ( Axis . yAxis ( ) . setLabel ( "FooValue" ) . setRange ( Range . closed ( 0.0 , 15.0 ) ) . build ( ) ) . hideKey ( ) . build ( ) . renderToEmptyDirectory ( outputDir ) ;
public class DateFormat { /** * Gets the date formatter with the given formatting style * for the default locale . * @ param style the given formatting style . For example , * SHORT for " M / d / yy " in the US locale . * @ return a date formatter . */ public final static DateFormat getDateInstance ( int style ) { } }
return get ( 0 , style , 2 , Locale . getDefault ( Locale . Category . FORMAT ) ) ;
public class AggregationDistinctQueryResult { /** * Divide one distinct query result to multiple child ones . * @ return multiple child distinct query results */ @ Override public List < DistinctQueryResult > divide ( ) { } }
return Lists . newArrayList ( Iterators . transform ( getResultData ( ) , new Function < QueryRow , DistinctQueryResult > ( ) { @ Override public DistinctQueryResult apply ( final QueryRow input ) { Set < QueryRow > resultData = new LinkedHashSet < > ( ) ; resultData . add ( input ) ; return new AggregationDistinctQueryResult ( getColumnLabelAndIndexMap ( ) , resultData . iterator ( ) , metaData ) ; } } ) ) ;
public class LinkType { /** * Checks whether a link reference can be handled by this link type * @ param linkRequest Link reference * @ return true if this link type can handle the given link reference */ @ SuppressWarnings ( "null" ) public boolean accepts ( @ NotNull LinkRequest linkRequest ) { } }
ValueMap props = linkRequest . getResourceProperties ( ) ; // check for matching link type ID in link resource String linkTypeId = props . get ( LinkNameConstants . PN_LINK_TYPE , String . class ) ; if ( StringUtils . isNotEmpty ( linkTypeId ) ) { return StringUtils . equals ( linkTypeId , getId ( ) ) ; } // if not link type is set at all check if link ref attribute contains a valid link else { String linkRef = props . get ( getPrimaryLinkRefProperty ( ) , String . class ) ; return accepts ( linkRef ) ; }
public class ZkKeyValueCacheUtil { /** * 设置分布式缓存的值 , 不建议高频次地对同一个key进行设置操作 。 * 只适合读频繁但写入少的场景 * todo Not tested * @ throws CacheLockedException 如果其他人正在写入该值 , 则禁止你写入 . */ public static void blockingSet ( String subPath , String data ) throws CacheLockedException { } }
if ( data == null ) { data = "" ; } String fullPath = getFullPath ( subPath ) ; /* Integer innerLockId = DistZkLocker . lock ( ZkKeyValueCacheUtil . class . getName ( ) + " - lock : " + fullPath . replace ( " / " , " _ " ) , 0) . onErrorResumeNext ( timeoutException - > { / / 遇到锁则直接超时不执行 return Single . error ( new CacheLockedException ( subPath ) ) ; } ) . blockingGet ( ) ; */ try { try { ZkConnection . client . setData ( ) . forPath ( fullPath , data . getBytes ( ) ) ; } catch ( KeeperException . NoNodeException e ) { ZkConnection . client . create ( ) . creatingParentContainersIfNeeded ( ) . forPath ( fullPath , data . getBytes ( ) ) ; } loadingCache . get ( subPath ) . snd = data ; } catch ( Throwable e ) { throw new RuntimeException ( e ) ; } finally { /* DistZkLocker . unlock ( innerLockId ) ; */ LOG . debug ( "nothing to do." ) ; }
public class AVIMConversationEventHandler { /** * 对话成员信息变更通知 。 * 常见的有 : 某成员权限发生变化 ( 如 , 被设为管理员等 ) 。 * @ param client 通知关联的 AVIMClient * @ param conversation 通知关联的对话 * @ param memberInfo 变更后的成员信息 * @ param updatedProperties 发生变更的属性列表 ( 当前固定为 " role " ) * @ param operator 操作者 id */ public void onMemberInfoUpdated ( AVIMClient client , AVIMConversation conversation , AVIMConversationMemberInfo memberInfo , List < String > updatedProperties , String operator ) { } }
LOGGER . d ( "Notification --- " + operator + " updated memberInfo: " + memberInfo . toString ( ) ) ;
public class DateTimeUtils { /** * Calculate the start - of - day point of a supplied { @ link Calendar } . * The returned { @ link Calendar } has its fields unsynced . Note : if { @ code origin } has * unsynced field , it may cause side - effect . * @ param origin * @ return */ public static Calendar startOfDay ( Calendar origin ) { } }
Calendar cal = ( Calendar ) origin . clone ( ) ; cal . set ( Calendar . MILLISECOND , 0 ) ; cal . set ( Calendar . SECOND , 0 ) ; cal . set ( Calendar . MINUTE , 0 ) ; cal . set ( Calendar . HOUR_OF_DAY , 0 ) ; return cal ;
public class DateUtils { /** * 添加秒 * @ param date 日期 * @ param amount 数量 * @ return 添加后的日期 */ public static Date addSecond ( Date date , int amount ) { } }
return add ( date , Calendar . SECOND , amount ) ;
public class ChecksumFileSystem { /** * The src file is under FS , and the dst is on the local disk . * Copy it from FS control to the local dst name . * If src and dst are directories , the copyCrc parameter * determines whether to copy CRC files . */ public void copyToLocalFile ( Path src , Path dst , boolean copyCrc ) throws IOException { } }
if ( ! fs . isDirectory ( src ) ) { // source is a file fs . copyToLocalFile ( src , dst ) ; FileSystem localFs = getLocal ( getConf ( ) ) . getRawFileSystem ( ) ; if ( localFs . isDirectory ( dst ) ) { dst = new Path ( dst , src . getName ( ) ) ; } dst = getChecksumFile ( dst ) ; if ( localFs . exists ( dst ) ) { // remove old local checksum file localFs . delete ( dst , true ) ; } Path checksumFile = getChecksumFile ( src ) ; if ( copyCrc && fs . exists ( checksumFile ) ) { // copy checksum file fs . copyToLocalFile ( checksumFile , dst ) ; } } else { FileStatus [ ] srcs = listStatus ( src ) ; for ( FileStatus srcFile : srcs ) { copyToLocalFile ( srcFile . getPath ( ) , new Path ( dst , srcFile . getPath ( ) . getName ( ) ) , copyCrc ) ; } }
public class RESTMBeanServerConnection { /** * { @ inheritDoc } */ @ Override public ObjectInstance createMBean ( String className , ObjectName name , ObjectName loaderName ) throws ReflectionException , InstanceAlreadyExistsException , MBeanRegistrationException , MBeanException , NotCompliantMBeanException , InstanceNotFoundException , IOException { } }
return createMBean ( className , name , loaderName , null , null , true , false ) ;
public class ServerHandshaker { /** * Retrieve the Kerberos key for the specified server principal * from the JAAS configuration file . * @ return true if successful , false if not available or invalid */ private boolean setupKerberosKeys ( ) { } }
if ( kerberosKeys != null ) { return true ; } try { final AccessControlContext acc = getAccSE ( ) ; kerberosKeys = AccessController . doPrivileged ( // Eliminate dependency on KerberosKey new PrivilegedExceptionAction < SecretKey [ ] > ( ) { public SecretKey [ ] run ( ) throws Exception { // get kerberos key for the default principal return Krb5Helper . getServerKeys ( acc ) ; } } ) ; // check permission to access and use the secret key of the // Kerberized " host " service if ( kerberosKeys != null && kerberosKeys . length > 0 ) { if ( debug != null && Debug . isOn ( "handshake" ) ) { for ( SecretKey k : kerberosKeys ) { System . out . println ( "Using Kerberos key: " + k ) ; } } String serverPrincipal = Krb5Helper . getServerPrincipalName ( kerberosKeys [ 0 ] ) ; SecurityManager sm = System . getSecurityManager ( ) ; try { if ( sm != null ) { // Eliminate dependency on ServicePermission sm . checkPermission ( Krb5Helper . getServicePermission ( serverPrincipal , "accept" ) , acc ) ; } } catch ( SecurityException se ) { kerberosKeys = null ; // % % % destroy keys ? or will that affect Subject ? if ( debug != null && Debug . isOn ( "handshake" ) ) System . out . println ( "Permission to access Kerberos" + " secret key denied" ) ; return false ; } } return ( kerberosKeys != null && kerberosKeys . length > 0 ) ; } catch ( PrivilegedActionException e ) { // Likely exception here is LoginExceptin if ( debug != null && Debug . isOn ( "handshake" ) ) { System . out . println ( "Attempt to obtain Kerberos key failed: " + e . toString ( ) ) ; } return false ; }
public class OpenJPAEnhancerMojo { /** * Notifies the watcher that a new file is created . * @ param file is the file . * @ return { @ literal false } if the pipeline processing must be interrupted for this event . Most watchers should * return { @ literal true } to let other watchers be notified . * @ throws org . wisdom . maven . WatchingException if the watcher failed to process the given file . */ @ Override public boolean fileCreated ( File file ) throws WatchingException { } }
try { List < File > entities = findEntityClassFiles ( ) ; enhance ( entities ) ; return true ; } catch ( MojoExecutionException e ) { throw new WatchingException ( "OpenJPA Enhancer" , "Error while enhancing JPA entities" , file , e ) ; }
public class AbstractImageGL { /** * Draws this image with the supplied transform , and source and target dimensions . */ void draw ( GLShader shader , InternalTransform xform , int tint , float dx , float dy , float dw , float dh , float sx , float sy , float sw , float sh ) { } }
float texWidth = width ( ) , texHeight = height ( ) ; drawImpl ( shader , xform , ensureTexture ( ) , tint , dx , dy , dw , dh , sx / texWidth , sy / texHeight , ( sx + sw ) / texWidth , ( sy + sh ) / texHeight ) ;
public class StringMatcher { /** * Implement UnicodeMatcher */ @ Override public int matches ( Replaceable text , int [ ] offset , int limit , boolean incremental ) { } }
// Note ( 1 ) : We process text in 16 - bit code units , rather than // 32 - bit code points . This works because stand - ins are // always in the BMP and because we are doing a literal match // operation , which can be done 16 - bits at a time . int i ; int [ ] cursor = new int [ ] { offset [ 0 ] } ; if ( limit < cursor [ 0 ] ) { // Match in the reverse direction for ( i = pattern . length ( ) - 1 ; i >= 0 ; -- i ) { char keyChar = pattern . charAt ( i ) ; // OK ; see note ( 1 ) above UnicodeMatcher subm = data . lookupMatcher ( keyChar ) ; if ( subm == null ) { if ( cursor [ 0 ] > limit && keyChar == text . charAt ( cursor [ 0 ] ) ) { // OK ; see note ( 1 ) above -- cursor [ 0 ] ; } else { return U_MISMATCH ; } } else { int m = subm . matches ( text , cursor , limit , incremental ) ; if ( m != U_MATCH ) { return m ; } } } // Record the match position , but adjust for a normal // forward start , limit , and only if a prior match does not // exist - - we want the rightmost match . if ( matchStart < 0 ) { matchStart = cursor [ 0 ] + 1 ; matchLimit = offset [ 0 ] + 1 ; } } else { for ( i = 0 ; i < pattern . length ( ) ; ++ i ) { if ( incremental && cursor [ 0 ] == limit ) { // We ' ve reached the context limit without a mismatch and // without completing our match . return U_PARTIAL_MATCH ; } char keyChar = pattern . charAt ( i ) ; // OK ; see note ( 1 ) above UnicodeMatcher subm = data . lookupMatcher ( keyChar ) ; if ( subm == null ) { // Don ' t need the cursor < limit check if // incremental is true ( because it ' s done above ) ; do need // it otherwise . if ( cursor [ 0 ] < limit && keyChar == text . charAt ( cursor [ 0 ] ) ) { // OK ; see note ( 1 ) above ++ cursor [ 0 ] ; } else { return U_MISMATCH ; } } else { int m = subm . matches ( text , cursor , limit , incremental ) ; if ( m != U_MATCH ) { return m ; } } } // Record the match position matchStart = offset [ 0 ] ; matchLimit = cursor [ 0 ] ; } offset [ 0 ] = cursor [ 0 ] ; return U_MATCH ;
public class NextUtil { /** * Rename images so that their name is unique */ public static ro . nextreports . server . domain . Report renameImagesAsUnique ( ro . nextreports . server . domain . Report report ) { } }
NextContent reportContent = ( NextContent ) report . getContent ( ) ; try { String masterContent = new String ( reportContent . getNextFile ( ) . getDataProvider ( ) . getBytes ( ) , "UTF-8" ) ; for ( JcrFile imageFile : reportContent . getImageFiles ( ) ) { String oldName = imageFile . getName ( ) ; int index = oldName . lastIndexOf ( ro . nextreports . server . report . util . ReportUtil . EXTENSION_SEPARATOR ) ; String newName = oldName . substring ( 0 , index ) + ro . nextreports . server . report . util . ReportUtil . IMAGE_DELIM + UUID . randomUUID ( ) . toString ( ) + oldName . substring ( index ) ; masterContent = masterContent . replaceAll ( oldName , newName ) ; imageFile . setName ( newName ) ; } JcrFile templateFile = reportContent . getTemplateFile ( ) ; if ( templateFile != null ) { String oldName = templateFile . getName ( ) ; int index = oldName . lastIndexOf ( ro . nextreports . server . report . util . ReportUtil . EXTENSION_SEPARATOR ) ; String newName = oldName . substring ( 0 , index ) + ro . nextreports . server . report . util . ReportUtil . IMAGE_DELIM + UUID . randomUUID ( ) . toString ( ) + oldName . substring ( index ) ; masterContent = masterContent . replaceAll ( oldName , newName ) ; templateFile . setName ( newName ) ; } reportContent . getNextFile ( ) . setDataProvider ( new JcrDataProviderImpl ( masterContent . getBytes ( "UTF-8" ) ) ) ; } catch ( UnsupportedEncodingException e ) { LOG . error ( "Error inside renameImagesAsUnique: " + e . getMessage ( ) , e ) ; e . printStackTrace ( ) ; } return report ;
public class Phaser { /** * Main implementation for methods arrive and arriveAndDeregister . * Manually tuned to speed up and minimize race windows for the * common case of just decrementing unarrived field . * @ param adjust value to subtract from state ; * ONE _ ARRIVAL for arrive , * ONE _ DEREGISTER for arriveAndDeregister */ private int doArrive ( int adjust ) { } }
final Phaser root = this . root ; for ( ; ; ) { long s = ( root == this ) ? state : reconcileState ( ) ; int phase = ( int ) ( s >>> PHASE_SHIFT ) ; if ( phase < 0 ) return phase ; int counts = ( int ) s ; int unarrived = ( counts == EMPTY ) ? 0 : ( counts & UNARRIVED_MASK ) ; if ( unarrived <= 0 ) throw new IllegalStateException ( badArrive ( s ) ) ; if ( UNSAFE . compareAndSwapLong ( this , stateOffset , s , s -= adjust ) ) { if ( unarrived == 1 ) { long n = s & PARTIES_MASK ; // base of next state int nextUnarrived = ( int ) n >>> PARTIES_SHIFT ; if ( root == this ) { if ( onAdvance ( phase , nextUnarrived ) ) n |= TERMINATION_BIT ; else if ( nextUnarrived == 0 ) n |= EMPTY ; else n |= nextUnarrived ; int nextPhase = ( phase + 1 ) & MAX_PHASE ; n |= ( long ) nextPhase << PHASE_SHIFT ; UNSAFE . compareAndSwapLong ( this , stateOffset , s , n ) ; releaseWaiters ( phase ) ; } else if ( nextUnarrived == 0 ) { // propagate deregistration phase = parent . doArrive ( ONE_DEREGISTER ) ; UNSAFE . compareAndSwapLong ( this , stateOffset , s , s | EMPTY ) ; } else phase = parent . doArrive ( ONE_ARRIVAL ) ; } return phase ; } }
public class Parser { /** * Converts JDBC - specific callable statement escapes { @ code { [ ? = ] call < some _ function > [ ( ? , * [ ? , . . ] ) ] } } into the PostgreSQL format which is { @ code select < some _ function > ( ? , [ ? , . . . ] ) as * result } or { @ code select * from < some _ function > ( ? , [ ? , . . . ] ) as result } ( 7.3) * @ param jdbcSql sql text with JDBC escapes * @ param stdStrings if backslash in single quotes should be regular character or escape one * @ param serverVersion server version * @ param protocolVersion protocol version * @ return SQL in appropriate for given server format * @ throws SQLException if given SQL is malformed */ public static JdbcCallParseInfo modifyJdbcCall ( String jdbcSql , boolean stdStrings , int serverVersion , int protocolVersion ) throws SQLException { } }
// Mini - parser for JDBC function - call syntax ( only ) // TODO : Merge with escape processing ( and parameter parsing ? ) so we only parse each query once . // RE : frequently used statements are cached ( see { @ link org . postgresql . jdbc . PgConnection # borrowQuery } ) , so this " merge " is not that important . String sql = jdbcSql ; boolean isFunction = false ; boolean outParamBeforeFunc = false ; int len = jdbcSql . length ( ) ; int state = 1 ; boolean inQuotes = false ; boolean inEscape = false ; int startIndex = - 1 ; int endIndex = - 1 ; boolean syntaxError = false ; int i = 0 ; while ( i < len && ! syntaxError ) { char ch = jdbcSql . charAt ( i ) ; switch ( state ) { case 1 : // Looking for { at start of query if ( ch == '{' ) { ++ i ; ++ state ; } else if ( Character . isWhitespace ( ch ) ) { ++ i ; } else { // Not function - call syntax . Skip the rest of the string . i = len ; } break ; case 2 : // After { , looking for ? or = , skipping whitespace if ( ch == '?' ) { outParamBeforeFunc = isFunction = true ; // { ? = call . . . } - - function with one out parameter ++ i ; ++ state ; } else if ( ch == 'c' || ch == 'C' ) { // { call . . . } - - proc with no out parameters state += 3 ; // Don ' t increase ' i ' } else if ( Character . isWhitespace ( ch ) ) { ++ i ; } else { // " { foo . . . " , doesn ' t make sense , complain . syntaxError = true ; } break ; case 3 : // Looking for = after ? , skipping whitespace if ( ch == '=' ) { ++ i ; ++ state ; } else if ( Character . isWhitespace ( ch ) ) { ++ i ; } else { syntaxError = true ; } break ; case 4 : // Looking for ' call ' after ' ? = ' skipping whitespace if ( ch == 'c' || ch == 'C' ) { ++ state ; // Don ' t increase ' i ' . } else if ( Character . isWhitespace ( ch ) ) { ++ i ; } else { syntaxError = true ; } break ; case 5 : // Should be at ' call ' either at start of string or after ? = if ( ( ch == 'c' || ch == 'C' ) && i + 4 <= len && jdbcSql . substring ( i , i + 4 ) . equalsIgnoreCase ( "call" ) ) { isFunction = true ; i += 4 ; ++ state ; } else if ( Character . isWhitespace ( ch ) ) { ++ i ; } else { syntaxError = true ; } break ; case 6 : // Looking for whitespace char after ' call ' if ( Character . isWhitespace ( ch ) ) { // Ok , we found the start of the real call . ++ i ; ++ state ; startIndex = i ; } else { syntaxError = true ; } break ; case 7 : // In " body " of the query ( after " { [ ? = ] call " ) if ( ch == '\'' ) { inQuotes = ! inQuotes ; ++ i ; } else if ( inQuotes && ch == '\\' && ! stdStrings ) { // Backslash in string constant , skip next character . i += 2 ; } else if ( ! inQuotes && ch == '{' ) { inEscape = ! inEscape ; ++ i ; } else if ( ! inQuotes && ch == '}' ) { if ( ! inEscape ) { // Should be end of string . endIndex = i ; ++ i ; ++ state ; } else { inEscape = false ; } } else if ( ! inQuotes && ch == ';' ) { syntaxError = true ; } else { // Everything else is ok . ++ i ; } break ; case 8 : // At trailing end of query , eating whitespace if ( Character . isWhitespace ( ch ) ) { ++ i ; } else { syntaxError = true ; } break ; default : throw new IllegalStateException ( "somehow got into bad state " + state ) ; } } // We can only legally end in a couple of states here . if ( i == len && ! syntaxError ) { if ( state == 1 ) { // Not an escaped syntax . return new JdbcCallParseInfo ( sql , isFunction ) ; } if ( state != 8 ) { syntaxError = true ; // Ran out of query while still parsing } } if ( syntaxError ) { throw new PSQLException ( GT . tr ( "Malformed function or procedure escape syntax at offset {0}." , i ) , PSQLState . STATEMENT_NOT_ALLOWED_IN_FUNCTION_CALL ) ; } String prefix = "select * from " ; String suffix = " as result" ; String s = jdbcSql . substring ( startIndex , endIndex ) ; int prefixLength = prefix . length ( ) ; StringBuilder sb = new StringBuilder ( prefixLength + jdbcSql . length ( ) + suffix . length ( ) + 10 ) ; sb . append ( prefix ) ; sb . append ( s ) ; int opening = s . indexOf ( '(' ) + 1 ; if ( opening == 0 ) { // here the function call has no parameters declaration eg : " { ? = call pack _ getValue } " sb . append ( outParamBeforeFunc ? "(?)" : "()" ) ; } else if ( outParamBeforeFunc ) { // move the single out parameter into the function call // so that it can be treated like all other parameters boolean needComma = false ; // the following loop will check if the function call has parameters // eg " { ? = call pack _ getValue ( ? ) } " vs " { ? = call pack _ getValue ( ) } for ( int j = opening + prefixLength ; j < sb . length ( ) ; j ++ ) { char c = sb . charAt ( j ) ; if ( c == ')' ) { break ; } if ( ! Character . isWhitespace ( c ) ) { needComma = true ; break ; } } // insert the return parameter as the first parameter of the function call if ( needComma ) { sb . insert ( opening + prefixLength , "?," ) ; } else { sb . insert ( opening + prefixLength , "?" ) ; } } sql = sb . append ( suffix ) . toString ( ) ; return new JdbcCallParseInfo ( sql , isFunction ) ;
public class DefaultDelegationProvider { /** * Creates the application to security roles mapping for a given application . * @ param appName the name of the application for which the mappings belong to . * @ param securityRoles the security roles of the application . */ public void createAppToSecurityRolesMapping ( String appName , Collection < SecurityRole > securityRoles ) { } }
// only add it if we don ' t have a cached copy appToSecurityRolesMap . putIfAbsent ( appName , securityRoles ) ;
public class UnrelatedCollectionContents { /** * adds this item ' s type and all of it ' s superclass / interfaces to the set of possible types that could define this added item * @ param supers * the current set of superclass items * @ param addItm * the item we are adding * @ throws ClassNotFoundException * if a superclass / interface is not found */ private static void addNewItem ( final Set < String > supers , final OpcodeStack . Item addItm ) throws ClassNotFoundException { } }
String itemSignature = addItm . getSignature ( ) ; if ( itemSignature . length ( ) == 0 ) { return ; } if ( itemSignature . startsWith ( Values . SIG_ARRAY_PREFIX ) ) { supers . add ( itemSignature ) ; return ; } JavaClass cls = addItm . getJavaClass ( ) ; if ( ( cls == null ) || Values . DOTTED_JAVA_LANG_OBJECT . equals ( cls . getClassName ( ) ) ) { return ; } supers . add ( cls . getClassName ( ) ) ; JavaClass [ ] infs = cls . getAllInterfaces ( ) ; for ( JavaClass inf : infs ) { String infName = inf . getClassName ( ) ; if ( ! "java.io.Serializable" . equals ( infName ) && ! "java.lang.Cloneable" . equals ( infName ) ) { supers . add ( infName ) ; } } JavaClass [ ] sups = cls . getSuperClasses ( ) ; for ( JavaClass sup : sups ) { String name = sup . getClassName ( ) ; if ( ! Values . DOTTED_JAVA_LANG_OBJECT . equals ( name ) ) { supers . add ( name ) ; } }
public class ThymeleafFactory { /** * Constructs the template engine . * @ param templateResolver The template resolver * @ param engineContextFactory The engine context factory * @ param linkBuilder The link builder * @ return The template engine */ @ Singleton public TemplateEngine templateEngine ( ITemplateResolver templateResolver , IEngineContextFactory engineContextFactory , ILinkBuilder linkBuilder ) { } }
TemplateEngine engine = new TemplateEngine ( ) ; engine . setEngineContextFactory ( engineContextFactory ) ; engine . setLinkBuilder ( linkBuilder ) ; engine . setTemplateResolver ( templateResolver ) ; return engine ;
public class NameConstraintsExtension { /** * Recalculate hasMin and hasMax flags . */ private void calcMinMax ( ) throws IOException { } }
hasMin = false ; hasMax = false ; if ( excluded != null ) { for ( int i = 0 ; i < excluded . size ( ) ; i ++ ) { GeneralSubtree subtree = excluded . get ( i ) ; if ( subtree . getMinimum ( ) != 0 ) hasMin = true ; if ( subtree . getMaximum ( ) != - 1 ) hasMax = true ; } } if ( permitted != null ) { for ( int i = 0 ; i < permitted . size ( ) ; i ++ ) { GeneralSubtree subtree = permitted . get ( i ) ; if ( subtree . getMinimum ( ) != 0 ) hasMin = true ; if ( subtree . getMaximum ( ) != - 1 ) hasMax = true ; } } minMaxValid = true ;
public class PebbleDictionary { /** * Returns the unsigned integer as a long to which the specified key is mapped , or null if the key does not exist in this * dictionary . We are using the Long type here so that we can remove the guava dependency . This is done so that we dont * have incompatibility issues with the UnsignedInteger class from the Holo application , which uses a newer version of Guava . * @ param key * key whose associated value is to be returned * @ return value to which the specified key is mapped */ public Long getUnsignedIntegerAsLong ( int key ) { } }
PebbleTuple tuple = getTuple ( key , PebbleTuple . TupleType . UINT ) ; if ( tuple == null ) { return null ; } return ( Long ) tuple . value ;
public class MeterUsageRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( MeterUsageRequest meterUsageRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( meterUsageRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( meterUsageRequest . getProductCode ( ) , PRODUCTCODE_BINDING ) ; protocolMarshaller . marshall ( meterUsageRequest . getTimestamp ( ) , TIMESTAMP_BINDING ) ; protocolMarshaller . marshall ( meterUsageRequest . getUsageDimension ( ) , USAGEDIMENSION_BINDING ) ; protocolMarshaller . marshall ( meterUsageRequest . getUsageQuantity ( ) , USAGEQUANTITY_BINDING ) ; protocolMarshaller . marshall ( meterUsageRequest . getDryRun ( ) , DRYRUN_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class Utility { /** * Prepares the list of Files and Folders inside ' inter ' Directory . * The list can be filtered through extensions . ' filter ' reference * is the FileFilter . A reference of ArrayList is passed , in case it * may contain the ListItem for parent directory . Returns the List of * Directories / files in the form of ArrayList . * @ param internalList ArrayList containing parent directory . * @ param inter The present directory to look into . * @ param filter Extension filter class reference , for filtering files . * @ return ArrayList of FileListItem containing file info of current directory . */ public static ArrayList < FileListItem > prepareFileListEntries ( ArrayList < FileListItem > internalList , File inter , ExtensionFilter filter ) { } }
try { // Check for each and every directory / file in ' inter ' directory . // Filter by extension using ' filter ' reference . for ( File name : inter . listFiles ( filter ) ) { // If file / directory can be read by the Application if ( name . canRead ( ) ) { // Create a row item for the directory list and define properties . FileListItem item = new FileListItem ( ) ; item . setFilename ( name . getName ( ) ) ; item . setDirectory ( name . isDirectory ( ) ) ; item . setLocation ( name . getAbsolutePath ( ) ) ; item . setTime ( name . lastModified ( ) ) ; // Add row to the List of directories / files internalList . add ( item ) ; } } // Sort the files and directories in alphabetical order . // See compareTo method in FileListItem class . Collections . sort ( internalList ) ; } catch ( NullPointerException e ) { // Just dont worry , it rarely occurs . e . printStackTrace ( ) ; internalList = new ArrayList < > ( ) ; } return internalList ;
public class QrCodeDecoderBits { /** * Decodes Kanji messages * @ param qr QR code * @ param data encoded data * @ return Location it has read up to in bits */ private int decodeKanji ( QrCode qr , PackedBits8 data , int bitLocation ) { } }
int lengthBits = QrCodeEncoder . getLengthBitsKanji ( qr . version ) ; int length = data . read ( bitLocation , lengthBits , true ) ; bitLocation += lengthBits ; byte rawdata [ ] = new byte [ length * 2 ] ; for ( int i = 0 ; i < length ; i ++ ) { if ( data . size < bitLocation + 13 ) { qr . failureCause = QrCode . Failure . MESSAGE_OVERFLOW ; return - 1 ; } int letter = data . read ( bitLocation , 13 , true ) ; bitLocation += 13 ; letter = ( ( letter / 0x0C0 ) << 8 ) | ( letter % 0x0C0 ) ; if ( letter < 0x01F00 ) { // In the 0x8140 to 0x9FFC range letter += 0x08140 ; } else { // In the 0xE040 to 0xEBBF range letter += 0x0C140 ; } rawdata [ i * 2 ] = ( byte ) ( letter >> 8 ) ; rawdata [ i * 2 + 1 ] = ( byte ) letter ; } // Shift _ JIS may not be supported in some environments : try { workString . append ( new String ( rawdata , "Shift_JIS" ) ) ; } catch ( UnsupportedEncodingException ignored ) { qr . failureCause = KANJI_UNAVAILABLE ; return - 1 ; } return bitLocation ;
public class AttributeService { /** * Set editable state on an attribute . This needs to also set the state on the associated attributes . * @ param attribute attribute for which the editable state needs to be set * @ param editable new editable state */ public void setAttributeEditable ( Attribute attribute , boolean editable ) { } }
attribute . setEditable ( editable ) ; if ( ! ( attribute instanceof LazyAttribute ) ) { // should not instantiate lazy attributes ! if ( attribute instanceof ManyToOneAttribute ) { setAttributeEditable ( ( ( ManyToOneAttribute ) attribute ) . getValue ( ) , editable ) ; } else if ( attribute instanceof OneToManyAttribute ) { List < AssociationValue > values = ( ( OneToManyAttribute ) attribute ) . getValue ( ) ; for ( AssociationValue value : values ) { setAttributeEditable ( value , editable ) ; } } }
public class FixedBucketsHistogram { /** * Serialize the histogram in sparse encoding mode . * The serialization header is always written , since the sparse encoding is only used in situations where the * header is required . * @ param nonEmptyBuckets Number of non - empty buckets in the histogram * @ return Serialized histogram with sparse encoding */ public byte [ ] toBytesSparse ( int nonEmptyBuckets ) { } }
int size = SERDE_HEADER_SIZE + getSparseStorageSize ( nonEmptyBuckets ) ; ByteBuffer buf = ByteBuffer . allocate ( size ) ; writeByteBufferSparse ( buf , nonEmptyBuckets ) ; return buf . array ( ) ;
public class PortletExecutionManager { /** * / * ( non - Javadoc ) * @ see org . apereo . portal . portlet . rendering . IPortletExecutionManager # getPortletHeadOutput ( org . apereo . portal . portlet . om . IPortletWindowId , javax . servlet . http . HttpServletRequest , javax . servlet . http . HttpServletResponse ) */ @ Override public String getPortletHeadOutput ( IPortletWindowId portletWindowId , HttpServletRequest request , HttpServletResponse response ) { } }
if ( doesPortletNeedHeaderWorker ( portletWindowId , request ) ) { final IPortletRenderExecutionWorker tracker = getRenderedPortletHeaderWorker ( portletWindowId , request , response ) ; final long timeout = getPortletRenderTimeout ( portletWindowId , request ) ; try { final String output = tracker . getOutput ( timeout ) ; return output == null ? "" : output ; } catch ( Exception e ) { logger . error ( "failed to render header output for " + portletWindowId , e ) ; return "" ; } } logger . debug ( portletWindowId + " does not produce output for header" ) ; return "" ;
public class Curve25519 { /** * / * Multiply two numbers . The output is in reduced form , the inputs need not * be . */ private static final long10 mul ( long10 xy , long10 x , long10 y ) { } }
/* sahn0: * Using local variables to avoid class access . * This seem to improve performance a bit . . . */ long x_0 = x . _0 , x_1 = x . _1 , x_2 = x . _2 , x_3 = x . _3 , x_4 = x . _4 , x_5 = x . _5 , x_6 = x . _6 , x_7 = x . _7 , x_8 = x . _8 , x_9 = x . _9 ; long y_0 = y . _0 , y_1 = y . _1 , y_2 = y . _2 , y_3 = y . _3 , y_4 = y . _4 , y_5 = y . _5 , y_6 = y . _6 , y_7 = y . _7 , y_8 = y . _8 , y_9 = y . _9 ; long t ; t = ( x_0 * y_8 ) + ( x_2 * y_6 ) + ( x_4 * y_4 ) + ( x_6 * y_2 ) + ( x_8 * y_0 ) + 2 * ( ( x_1 * y_7 ) + ( x_3 * y_5 ) + ( x_5 * y_3 ) + ( x_7 * y_1 ) ) + 38 * ( x_9 * y_9 ) ; xy . _8 = ( t & ( ( 1 << 26 ) - 1 ) ) ; t = ( t >> 26 ) + ( x_0 * y_9 ) + ( x_1 * y_8 ) + ( x_2 * y_7 ) + ( x_3 * y_6 ) + ( x_4 * y_5 ) + ( x_5 * y_4 ) + ( x_6 * y_3 ) + ( x_7 * y_2 ) + ( x_8 * y_1 ) + ( x_9 * y_0 ) ; xy . _9 = ( t & ( ( 1 << 25 ) - 1 ) ) ; t = ( x_0 * y_0 ) + 19 * ( ( t >> 25 ) + ( x_2 * y_8 ) + ( x_4 * y_6 ) + ( x_6 * y_4 ) + ( x_8 * y_2 ) ) + 38 * ( ( x_1 * y_9 ) + ( x_3 * y_7 ) + ( x_5 * y_5 ) + ( x_7 * y_3 ) + ( x_9 * y_1 ) ) ; xy . _0 = ( t & ( ( 1 << 26 ) - 1 ) ) ; t = ( t >> 26 ) + ( x_0 * y_1 ) + ( x_1 * y_0 ) + 19 * ( ( x_2 * y_9 ) + ( x_3 * y_8 ) + ( x_4 * y_7 ) + ( x_5 * y_6 ) + ( x_6 * y_5 ) + ( x_7 * y_4 ) + ( x_8 * y_3 ) + ( x_9 * y_2 ) ) ; xy . _1 = ( t & ( ( 1 << 25 ) - 1 ) ) ; t = ( t >> 25 ) + ( x_0 * y_2 ) + ( x_2 * y_0 ) + 19 * ( ( x_4 * y_8 ) + ( x_6 * y_6 ) + ( x_8 * y_4 ) ) + 2 * ( x_1 * y_1 ) + 38 * ( ( x_3 * y_9 ) + ( x_5 * y_7 ) + ( x_7 * y_5 ) + ( x_9 * y_3 ) ) ; xy . _2 = ( t & ( ( 1 << 26 ) - 1 ) ) ; t = ( t >> 26 ) + ( x_0 * y_3 ) + ( x_1 * y_2 ) + ( x_2 * y_1 ) + ( x_3 * y_0 ) + 19 * ( ( x_4 * y_9 ) + ( x_5 * y_8 ) + ( x_6 * y_7 ) + ( x_7 * y_6 ) + ( x_8 * y_5 ) + ( x_9 * y_4 ) ) ; xy . _3 = ( t & ( ( 1 << 25 ) - 1 ) ) ; t = ( t >> 25 ) + ( x_0 * y_4 ) + ( x_2 * y_2 ) + ( x_4 * y_0 ) + 19 * ( ( x_6 * y_8 ) + ( x_8 * y_6 ) ) + 2 * ( ( x_1 * y_3 ) + ( x_3 * y_1 ) ) + 38 * ( ( x_5 * y_9 ) + ( x_7 * y_7 ) + ( x_9 * y_5 ) ) ; xy . _4 = ( t & ( ( 1 << 26 ) - 1 ) ) ; t = ( t >> 26 ) + ( x_0 * y_5 ) + ( x_1 * y_4 ) + ( x_2 * y_3 ) + ( x_3 * y_2 ) + ( x_4 * y_1 ) + ( x_5 * y_0 ) + 19 * ( ( x_6 * y_9 ) + ( x_7 * y_8 ) + ( x_8 * y_7 ) + ( x_9 * y_6 ) ) ; xy . _5 = ( t & ( ( 1 << 25 ) - 1 ) ) ; t = ( t >> 25 ) + ( x_0 * y_6 ) + ( x_2 * y_4 ) + ( x_4 * y_2 ) + ( x_6 * y_0 ) + 19 * ( x_8 * y_8 ) + 2 * ( ( x_1 * y_5 ) + ( x_3 * y_3 ) + ( x_5 * y_1 ) ) + 38 * ( ( x_7 * y_9 ) + ( x_9 * y_7 ) ) ; xy . _6 = ( t & ( ( 1 << 26 ) - 1 ) ) ; t = ( t >> 26 ) + ( x_0 * y_7 ) + ( x_1 * y_6 ) + ( x_2 * y_5 ) + ( x_3 * y_4 ) + ( x_4 * y_3 ) + ( x_5 * y_2 ) + ( x_6 * y_1 ) + ( x_7 * y_0 ) + 19 * ( ( x_8 * y_9 ) + ( x_9 * y_8 ) ) ; xy . _7 = ( t & ( ( 1 << 25 ) - 1 ) ) ; t = ( t >> 25 ) + xy . _8 ; xy . _8 = ( t & ( ( 1 << 26 ) - 1 ) ) ; xy . _9 += ( t >> 26 ) ; return xy ;
public class PutSlotTypeResult { /** * A list of < code > EnumerationValue < / code > objects that defines the values that the slot type can take . * < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use * { @ link # setEnumerationValues ( java . util . Collection ) } or { @ link # withEnumerationValues ( java . util . Collection ) } if * you want to override the existing values . * @ param enumerationValues * A list of < code > EnumerationValue < / code > objects that defines the values that the slot type can take . * @ return Returns a reference to this object so that method calls can be chained together . */ public PutSlotTypeResult withEnumerationValues ( EnumerationValue ... enumerationValues ) { } }
if ( this . enumerationValues == null ) { setEnumerationValues ( new java . util . ArrayList < EnumerationValue > ( enumerationValues . length ) ) ; } for ( EnumerationValue ele : enumerationValues ) { this . enumerationValues . add ( ele ) ; } return this ;
public class ToolScreen { /** * Override this to add your tool buttons . */ public void setupEndSFields ( ) { } }
new SCannedBox ( this . getNextLocation ( ScreenConstants . RIGHT_OF_LAST_BUTTON_WITH_GAP , ScreenConstants . SET_ANCHOR ) , this , null , ScreenConstants . DEFAULT_DISPLAY , MenuConstants . HELP ) ;
public class GVRSceneObject { /** * Generate debug dump of the tree from the scene object . * It should include a newline character at the end . * @ param sb the { @ code StringBuffer } to dump the object . * @ param indent indentation level as number of spaces . */ public void prettyPrint ( StringBuffer sb , int indent ) { } }
sb . append ( Log . getSpaces ( indent ) ) ; sb . append ( getClass ( ) . getSimpleName ( ) ) ; sb . append ( " [name=" ) ; sb . append ( this . getName ( ) ) ; sb . append ( "]" ) ; sb . append ( System . lineSeparator ( ) ) ; GVRRenderData rdata = getRenderData ( ) ; GVRTransform trans = getTransform ( ) ; if ( rdata == null ) { sb . append ( Log . getSpaces ( indent + 2 ) ) ; sb . append ( "RenderData: null" ) ; sb . append ( System . lineSeparator ( ) ) ; } else { rdata . prettyPrint ( sb , indent + 2 ) ; } sb . append ( Log . getSpaces ( indent + 2 ) ) ; sb . append ( "Transform: " ) ; sb . append ( trans ) ; sb . append ( System . lineSeparator ( ) ) ; // dump its children for ( GVRSceneObject child : getChildren ( ) ) { child . prettyPrint ( sb , indent + 2 ) ; }
public class Criteria { /** * Retrieves or if necessary , creates a user alias to be used * by a child criteria * @ param attribute The alias to set */ private UserAlias getUserAlias ( Object attribute ) { } }
if ( m_userAlias != null ) { return m_userAlias ; } if ( ! ( attribute instanceof String ) ) { return null ; } if ( m_alias == null ) { return null ; } if ( m_aliasPath == null ) { boolean allPathsAliased = true ; return new UserAlias ( m_alias , ( String ) attribute , allPathsAliased ) ; } return new UserAlias ( m_alias , ( String ) attribute , m_aliasPath ) ;
public class CatchThrowable { /** * Use it to catch an throwable and to get access to the thrown throwable ( for further verifications ) . * In the following example you catch throwables that are thrown by obj . doX ( ) : * < code > catchThrowable ( obj ) . doX ( ) ; / / catch * if ( caughtThrowable ( ) ! = null ) { * assert " foobar " . equals ( caughtThrowable ( ) . getMessage ( ) ) ; / / further analysis * } < / code > If < code > doX ( ) < / code > * throws a throwable , then { @ link # caughtThrowable ( ) } will return the caught throwable . If < code > doX ( ) < / code > does * not throw a throwable , then { @ link # caughtThrowable ( ) } will return < code > null < / code > . * @ param actor The instance that shall be proxied . Must not be < code > null < / code > . */ public static void catchThrowable ( ThrowingCallable actor ) { } }
validateArguments ( actor , Throwable . class ) ; catchThrowable ( actor , Throwable . class , false ) ;
public class MapContext { /** * Get the array of all keys that provide valid sub - maps and descendents . * For example , a property map containing " test . one " , " users . nick " , * " users . john " will result in two keys : " test " and " users " . * @ param map The property map to retrieve from * @ return The array of all unique keys that provide sub maps as strings * @ see PropertyMap # subMapKeySet ( ) */ public String [ ] subMapKeysAsStrings ( PropertyMap map ) { } }
String [ ] result = null ; Set < ? > keySet = map . subMapKeySet ( ) ; int keySize = keySet . size ( ) ; if ( keySize > 0 ) { result = keySet . toArray ( new String [ keySize ] ) ; } return result ;
public class Binder { /** * Process the incoming arguments by calling the given static method on the * given class , inserting the result as the first argument . * @ param lookup the java . lang . invoke . MethodHandles . Lookup to use * @ param target the class on which the method is defined * @ param method the method to invoke on the first argument * @ return a new Binder */ public Binder foldStatic ( MethodHandles . Lookup lookup , Class < ? > target , String method ) { } }
return fold ( Binder . from ( type ( ) ) . invokeStaticQuiet ( lookup , target , method ) ) ;
public class RelationsCrud { /** * Add the spouses in husband / wife order . * @ param newFamily the family to modify * @ param spouseAttribute the spouse to add */ protected final void addSpouseAttribute ( final ApiFamily newFamily , final ApiAttribute spouseAttribute ) { } }
if ( "husband" . equals ( spouseAttribute . getType ( ) ) ) { newFamily . getSpouses ( ) . add ( 0 , spouseAttribute ) ; } else { newFamily . getSpouses ( ) . add ( spouseAttribute ) ; }
public class MjdbcPoolBinder { /** * Returns new Pooled { @ link DataSource } implementation * In case this function won ' t work - use { @ link # createDataSource ( java . util . Properties ) } * @ param driverClassName Driver Class name * @ param url Database connection url * @ param userName Database user name * @ param password Database user password * @ return new Pooled { @ link DataSource } implementation * @ throws SQLException */ public static DataSource createDataSource ( String driverClassName , String url , String userName , String password ) throws SQLException { } }
return createDataSource ( driverClassName , url , userName , password , 10 , 100 ) ;
public class Longs { /** * Converts a String into a Long by first parsing it as Double and then casting it to Long . * @ param s The String to convert , may be null or in decimal format * @ return The parsed Long or null when parsing is not possible */ public static Long parseDecimal ( final String s ) { } }
Long parsed = null ; try { if ( s != null ) { parsed = ( long ) Double . parseDouble ( s ) ; } } catch ( final NumberFormatException e ) { } return parsed ;
public class MultiMapLayer { /** * Fire the event that indicates all the layers were removed . * @ param removedObjects are the removed objects . */ protected void fireLayerRemoveAllEvent ( List < ? extends L > removedObjects ) { } }
fireLayerHierarchyChangedEvent ( new MapLayerHierarchyEvent ( this , removedObjects , Type . REMOVE_ALL_CHILDREN , - 1 , isTemporaryLayer ( ) ) ) ;
public class AstaDatabaseReader { /** * Releases a database connection , and cleans up any resources * associated with that connection . */ private void releaseConnection ( ) { } }
if ( m_rs != null ) { try { m_rs . close ( ) ; } catch ( SQLException ex ) { // silently ignore errors on close } m_rs = null ; } if ( m_ps != null ) { try { m_ps . close ( ) ; } catch ( SQLException ex ) { // silently ignore errors on close } m_ps = null ; }
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link MultiSolidCoverageType } { @ code > } * @ param value * Java instance representing xml element ' s value . * @ return * the new instance of { @ link JAXBElement } { @ code < } { @ link MultiSolidCoverageType } { @ code > } */ @ XmlElementDecl ( namespace = "http://www.opengis.net/gml" , name = "MultiSolidCoverage" , substitutionHeadNamespace = "http://www.opengis.net/gml" , substitutionHeadName = "_DiscreteCoverage" ) public JAXBElement < MultiSolidCoverageType > createMultiSolidCoverage ( MultiSolidCoverageType value ) { } }
return new JAXBElement < MultiSolidCoverageType > ( _MultiSolidCoverage_QNAME , MultiSolidCoverageType . class , null , value ) ;
public class XForLoopExpressionImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public NotificationChain basicSetDeclaredParam ( JvmFormalParameter newDeclaredParam , NotificationChain msgs ) { } }
JvmFormalParameter oldDeclaredParam = declaredParam ; declaredParam = newDeclaredParam ; if ( eNotificationRequired ( ) ) { ENotificationImpl notification = new ENotificationImpl ( this , Notification . SET , XbasePackage . XFOR_LOOP_EXPRESSION__DECLARED_PARAM , oldDeclaredParam , newDeclaredParam ) ; if ( msgs == null ) msgs = notification ; else msgs . add ( notification ) ; } return msgs ;
public class Processor { /** * Recursively process the given Block . * @ param root * The Block to process . * @ param listMode * Flag indicating that we ' re in a list item block . */ private void recurse ( final Block root , final boolean listMode ) { } }
Block block , list ; Line line = root . lines ; if ( listMode ) { root . removeListIndent ( this . config ) ; if ( this . useExtensions && root . lines != null && root . lines . getLineType ( this . config ) != LineType . CODE ) { root . id = root . lines . stripID ( ) ; } } while ( line != null && line . isEmpty ) { line = line . next ; } if ( line == null ) { return ; } while ( line != null ) { final LineType type = line . getLineType ( this . config ) ; switch ( type ) { case OTHER : { final boolean wasEmpty = line . prevEmpty ; while ( line != null && ! line . isEmpty ) { final LineType t = line . getLineType ( this . config ) ; if ( ( listMode || this . useExtensions ) && ( t == LineType . OLIST || t == LineType . ULIST ) ) { break ; } if ( this . useExtensions && ( t == LineType . CODE || t == LineType . FENCED_CODE ) ) { break ; } if ( t == LineType . HEADLINE || t == LineType . HEADLINE1 || t == LineType . HEADLINE2 || t == LineType . HR || t == LineType . BQUOTE || t == LineType . XML ) { break ; } line = line . next ; } final BlockType bt ; if ( line != null && ! line . isEmpty ) { bt = ( listMode && ! wasEmpty ) ? BlockType . NONE : BlockType . PARAGRAPH ; root . split ( line . previous ) . type = bt ; root . removeLeadingEmptyLines ( ) ; } else { bt = ( listMode && ( line == null || ! line . isEmpty ) && ! wasEmpty ) ? BlockType . NONE : BlockType . PARAGRAPH ; root . split ( line == null ? root . lineTail : line ) . type = bt ; root . removeLeadingEmptyLines ( ) ; } line = root . lines ; break ; } case CODE : while ( line != null && ( line . isEmpty || line . leading > 3 ) ) { line = line . next ; } block = root . split ( line != null ? line . previous : root . lineTail ) ; block . type = BlockType . CODE ; block . removeSurroundingEmptyLines ( ) ; break ; case XML : if ( line . previous != null ) { // FIXME . . . this looks wrong root . split ( line . previous ) ; } root . split ( line . xmlEndLine ) . type = BlockType . XML ; root . removeLeadingEmptyLines ( ) ; line = root . lines ; break ; case BQUOTE : while ( line != null ) { if ( ! line . isEmpty && ( line . prevEmpty && line . leading == 0 && line . getLineType ( this . config ) != LineType . BQUOTE ) ) { break ; } line = line . next ; } block = root . split ( line != null ? line . previous : root . lineTail ) ; block . type = BlockType . BLOCKQUOTE ; block . removeSurroundingEmptyLines ( ) ; block . removeBlockQuotePrefix ( ) ; this . recurse ( block , false ) ; line = root . lines ; break ; case HR : if ( line . previous != null ) { // FIXME . . . this looks wrong root . split ( line . previous ) ; } root . split ( line ) . type = BlockType . RULER ; root . removeLeadingEmptyLines ( ) ; line = root . lines ; break ; case FENCED_CODE : line = line . next ; while ( line != null ) { if ( line . getLineType ( this . config ) == LineType . FENCED_CODE ) { break ; } // TODO . . . is this really necessary ? Maybe add a special // flag ? line = line . next ; } if ( line != null ) { line = line . next ; } block = root . split ( line != null ? line . previous : root . lineTail ) ; block . type = BlockType . FENCED_CODE ; block . meta = Utils . getMetaFromFence ( block . lines . value ) ; block . lines . setEmpty ( ) ; if ( block . lineTail . getLineType ( this . config ) == LineType . FENCED_CODE ) { block . lineTail . setEmpty ( ) ; } block . removeSurroundingEmptyLines ( ) ; break ; case HEADLINE : case HEADLINE1 : case HEADLINE2 : if ( line . previous != null ) { root . split ( line . previous ) ; } if ( type != LineType . HEADLINE ) { line . next . setEmpty ( ) ; } block = root . split ( line ) ; block . type = BlockType . HEADLINE ; if ( type != LineType . HEADLINE ) { block . hlDepth = type == LineType . HEADLINE1 ? 1 : 2 ; } if ( this . useExtensions ) { block . id = block . lines . stripID ( ) ; } block . transfromHeadline ( ) ; root . removeLeadingEmptyLines ( ) ; line = root . lines ; break ; case OLIST : case ULIST : while ( line != null ) { final LineType t = line . getLineType ( this . config ) ; if ( ! line . isEmpty && ( line . prevEmpty && line . leading == 0 && ! ( t == LineType . OLIST || t == LineType . ULIST ) ) ) { break ; } line = line . next ; } list = root . split ( line != null ? line . previous : root . lineTail ) ; list . type = type == LineType . OLIST ? BlockType . ORDERED_LIST : BlockType . UNORDERED_LIST ; list . lines . prevEmpty = false ; list . lineTail . nextEmpty = false ; list . removeSurroundingEmptyLines ( ) ; list . lines . prevEmpty = list . lineTail . nextEmpty = false ; this . initListBlock ( list ) ; block = list . blocks ; while ( block != null ) { this . recurse ( block , true ) ; block = block . next ; } list . expandListParagraphs ( ) ; break ; default : line = line . next ; break ; } }
public class XhtmlTemplateEngine { /** * Loads and parses template document then returns it . * @ param builder DOM builder used to load document template , * @ param reader template document reader . * @ throws IOException if read operation fails or premature EOF . * @ throws TemplateException if template document is not XML or HTML . */ private static Document loadTemplateDocument ( String templateName , DocumentBuilder builder , Reader reader ) throws IOException { } }
final int READ_AHEAD_SIZE = 5 ; BufferedReader bufferedReader = new BufferedReader ( reader ) ; bufferedReader . mark ( READ_AHEAD_SIZE ) ; char [ ] cbuf = new char [ READ_AHEAD_SIZE ] ; for ( int i = 0 ; i < READ_AHEAD_SIZE ; ++ i ) { int c = bufferedReader . read ( ) ; if ( c == - 1 ) { throw new IOException ( String . format ( "Invalid X(HT)ML template |%s|. Premature EOF." , templateName ) ) ; } cbuf [ i ] = ( char ) c ; } String header = new String ( cbuf ) ; if ( header . charAt ( 0 ) != '<' ) { throw new TemplateException ( "Invalid X(HT)ML template |%s|. Seems not XML like document." , templateName ) ; } // trivial heuristic to determine file is XML or HTML ; if is not explicitly HTML is considered XML boolean isXML = true ; if ( header . charAt ( 1 ) == '!' ) { // HTML DOCTYPE always starts with < ! isXML = false ; } else if ( header . charAt ( 1 ) == '?' ) { // XML prolog always starts with < ? isXML = true ; } else { // if not explicitly found HTML DOCTYPE or XML prolog uses root element to detect if HTML // if anything else but < html document is considered XML log . warn ( "No prolog found for X(HT)ML template |%s|. Uses root element to detect document type." , templateName ) ; if ( header . toLowerCase ( ) . startsWith ( "<html" ) ) { isXML = false ; } } bufferedReader . reset ( ) ; return isXML ? builder . loadXML ( bufferedReader ) : builder . loadHTML ( bufferedReader ) ; // do not attempt to close reader because DocumentBuilder . load [ X | HT ] ML ( ) method takes care of that
public class Formula { /** * Applies a given function on this formula and returns the result . * @ param function the function * @ param cache indicates whether the result should be cached in this formula ' s cache * @ param < T > the result type of the function * @ return the result of the function application */ public < T > T apply ( final FormulaFunction < T > function , final boolean cache ) { } }
return function . apply ( this , cache ) ;
public class EJBThreadData { /** * Restores the callback bean after removing the thread context established * by a previous call to { @ link # pushCallbackBeanO } . */ public void popCallbackBeanO ( ) // d662032 { } }
final boolean isTraceOn = TraceComponent . isAnyTracingEnabled ( ) ; if ( isTraceOn && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "popCallbackBeanO: " + ivCallbackBeanOStack . peek ( ) ) ; ivHandleListContext . endContext ( ) ; BeanO beanO = ivCallbackBeanOStack . pop ( ) ; beanO . parkHandleList ( ) ;
public class PatternBox { /** * Two proteins have states that are members of the same complex . Handles nested complexes and * homologies . Also guarantees that relationship to the complex is through different direct * complex members . * @ return pattern */ public static Pattern inComplexWith ( ) { } }
Pattern p = new Pattern ( SequenceEntityReference . class , "Protein 1" ) ; p . add ( linkedER ( true ) , "Protein 1" , "generic Protein 1" ) ; p . add ( erToPE ( ) , "generic Protein 1" , "SPE1" ) ; p . add ( linkToComplex ( ) , "SPE1" , "PE1" ) ; p . add ( new PathConstraint ( "PhysicalEntity/componentOf" ) , "PE1" , "Complex" ) ; p . add ( new PathConstraint ( "Complex/component" ) , "Complex" , "PE2" ) ; p . add ( equal ( false ) , "PE1" , "PE2" ) ; p . add ( linkToSpecific ( ) , "PE2" , "SPE2" ) ; p . add ( peToER ( ) , "SPE2" , "generic Protein 2" ) ; p . add ( linkedER ( false ) , "generic Protein 2" , "Protein 2" ) ; p . add ( equal ( false ) , "Protein 1" , "Protein 2" ) ; p . add ( new Type ( SequenceEntityReference . class ) , "Protein 2" ) ; return p ;
public class WebJsJmsMessageEncoderImpl { /** * Encode a ' name = value ' pair */ private void encodePair ( StringBuffer result , String name , Object value , boolean first ) { } }
if ( ! first ) result . append ( '&' ) ; URLEncode ( result , name ) ; result . append ( '=' ) ; encodeObject ( result , value ) ;
public class StopSyncPRequest { /** * < code > optional . alluxio . grpc . file . StopSyncPOptions options = 2 ; < / code > */ public alluxio . grpc . StopSyncPOptionsOrBuilder getOptionsOrBuilder ( ) { } }
return options_ == null ? alluxio . grpc . StopSyncPOptions . getDefaultInstance ( ) : options_ ;
public class IssueManager { /** * DEPRECATED . use relation . delete ( ) */ @ Deprecated public void deleteIssueRelations ( Issue redmineIssue ) throws RedmineException { } }
for ( IssueRelation relation : redmineIssue . getRelations ( ) ) { deleteRelation ( relation . getId ( ) ) ; }
public class GobblinServiceJobScheduler { /** * { @ inheritDoc } */ @ Override public AddSpecResponse onAddSpec ( Spec addedSpec ) { } }
if ( this . helixManager . isPresent ( ) && ! this . helixManager . get ( ) . isConnected ( ) ) { // Specs in store will be notified when Scheduler is added as listener to FlowCatalog , so ignore // . . Specs if in cluster mode and Helix is not yet initialized _log . info ( "System not yet initialized. Skipping Spec Addition: " + addedSpec ) ; return null ; } _log . info ( "New Flow Spec detected: " + addedSpec ) ; if ( addedSpec instanceof FlowSpec ) { try { FlowSpec flowSpec = ( FlowSpec ) addedSpec ; Properties jobConfig = new Properties ( ) ; Properties flowSpecProperties = ( ( FlowSpec ) addedSpec ) . getConfigAsProperties ( ) ; jobConfig . putAll ( this . properties ) ; jobConfig . setProperty ( ConfigurationKeys . JOB_NAME_KEY , addedSpec . getUri ( ) . toString ( ) ) ; jobConfig . setProperty ( ConfigurationKeys . JOB_GROUP_KEY , flowSpec . getConfig ( ) . getValue ( ConfigurationKeys . FLOW_GROUP_KEY ) . toString ( ) ) ; jobConfig . setProperty ( ConfigurationKeys . FLOW_RUN_IMMEDIATELY , ConfigUtils . getString ( ( flowSpec ) . getConfig ( ) , ConfigurationKeys . FLOW_RUN_IMMEDIATELY , "false" ) ) ; if ( flowSpecProperties . containsKey ( ConfigurationKeys . JOB_SCHEDULE_KEY ) && StringUtils . isNotBlank ( flowSpecProperties . getProperty ( ConfigurationKeys . JOB_SCHEDULE_KEY ) ) ) { jobConfig . setProperty ( ConfigurationKeys . JOB_SCHEDULE_KEY , flowSpecProperties . getProperty ( ConfigurationKeys . JOB_SCHEDULE_KEY ) ) ; } boolean isExplain = ConfigUtils . getBoolean ( flowSpec . getConfig ( ) , ConfigurationKeys . FLOW_EXPLAIN_KEY , false ) ; String compiledFlow = null ; if ( ! isExplain ) { this . scheduledFlowSpecs . put ( addedSpec . getUri ( ) . toString ( ) , addedSpec ) ; if ( jobConfig . containsKey ( ConfigurationKeys . JOB_SCHEDULE_KEY ) ) { _log . info ( "{} Scheduling flow spec: {} " , this . serviceName , addedSpec ) ; scheduleJob ( jobConfig , null ) ; if ( PropertiesUtils . getPropAsBoolean ( jobConfig , ConfigurationKeys . FLOW_RUN_IMMEDIATELY , "false" ) ) { _log . info ( "RunImmediately requested, hence executing FlowSpec: " + addedSpec ) ; this . jobExecutor . execute ( new NonScheduledJobRunner ( flowSpec . getUri ( ) , false , jobConfig , null ) ) ; } } else { _log . info ( "No FlowSpec schedule found, so running FlowSpec: " + addedSpec ) ; this . jobExecutor . execute ( new NonScheduledJobRunner ( flowSpec . getUri ( ) , true , jobConfig , null ) ) ; } } else { // Return a compiled flow . try { this . orchestrator . getSpecCompiler ( ) . awaitHealthy ( ) ; } catch ( InterruptedException e ) { throw new RuntimeException ( e ) ; } Dag < JobExecutionPlan > dag = this . orchestrator . getSpecCompiler ( ) . compileFlow ( flowSpec ) ; if ( dag != null && ! dag . isEmpty ( ) ) { compiledFlow = dag . toString ( ) ; } _log . info ( "{} Skipping adding flow spec: {}, since it is an EXPLAIN request" , this . serviceName , addedSpec ) ; if ( this . flowCatalog . isPresent ( ) ) { _log . debug ( "{} Removing flow spec from FlowCatalog: {}" , this . serviceName , flowSpec ) ; this . flowCatalog . get ( ) . remove ( flowSpec . getUri ( ) , new Properties ( ) , false ) ; } } return new AddSpecResponse ( compiledFlow ) ; } catch ( JobException je ) { _log . error ( "{} Failed to schedule or run FlowSpec {}" , serviceName , addedSpec , je ) ; } } return null ;
public class LinnaeusSpecies { /** * setter for allIdsString - sets This feature contains all possible NCBI Taxonomy IDs . * @ generated * @ param v value to set into the feature */ public void setAllIdsString ( String v ) { } }
if ( LinnaeusSpecies_Type . featOkTst && ( ( LinnaeusSpecies_Type ) jcasType ) . casFeat_allIdsString == null ) jcasType . jcas . throwFeatMissing ( "allIdsString" , "ch.epfl.bbp.uima.types.LinnaeusSpecies" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( LinnaeusSpecies_Type ) jcasType ) . casFeatCode_allIdsString , v ) ;
public class Kryo { /** * Returns the best matching serializer for a class . This method can be overridden to implement custom logic to choose a * serializer . */ public Serializer getDefaultSerializer ( Class type ) { } }
if ( type == null ) throw new IllegalArgumentException ( "type cannot be null." ) ; Serializer serializerForAnnotation = getDefaultSerializerForAnnotatedType ( type ) ; if ( serializerForAnnotation != null ) return serializerForAnnotation ; for ( int i = 0 , n = defaultSerializers . size ( ) ; i < n ; i ++ ) { DefaultSerializerEntry entry = defaultSerializers . get ( i ) ; if ( entry . type . isAssignableFrom ( type ) && entry . serializerFactory . isSupported ( type ) ) return entry . serializerFactory . newSerializer ( this , type ) ; } return newDefaultSerializer ( type ) ;
public class Matrix4f { /** * Set this matrix to be an asymmetric off - center perspective projection frustum transformation for a right - handed * coordinate system using the given NDC z range . * The given angles < code > offAngleX < / code > and < code > offAngleY < / code > are the horizontal and vertical angles between * the line of sight and the line given by the center of the near and far frustum planes . So , when < code > offAngleY < / code > * is just < code > fovy / 2 < / code > then the projection frustum is rotated towards + Y and the bottom frustum plane * is parallel to the XZ - plane . * In order to apply the perspective projection transformation to an existing transformation , * use { @ link # perspectiveOffCenter ( float , float , float , float , float , float ) perspectiveOffCenter ( ) } . * @ see # perspectiveOffCenter ( float , float , float , float , float , float ) * @ param fovy * the vertical field of view in radians ( must be greater than zero and less than { @ link Math # PI PI } ) * @ param offAngleX * the horizontal angle between the line of sight and the line crossing the center of the near and far frustum planes * @ param offAngleY * the vertical angle between the line of sight and the line crossing the center of the near and far frustum planes * @ param aspect * the aspect ratio ( i . e . width / height ; must be greater than zero ) * @ param zNear * near clipping plane distance . If the special value { @ link Float # POSITIVE _ INFINITY } is used , the near clipping plane will be at positive infinity . * In that case , < code > zFar < / code > may not also be { @ link Float # POSITIVE _ INFINITY } . * @ param zFar * far clipping plane distance . If the special value { @ link Float # POSITIVE _ INFINITY } is used , the far clipping plane will be at positive infinity . * In that case , < code > zNear < / code > may not also be { @ link Float # POSITIVE _ INFINITY } . * @ param zZeroToOne * whether to use Vulkan ' s and Direct3D ' s NDC z range of < code > [ 0 . . + 1 ] < / code > when < code > true < / code > * or whether to use OpenGL ' s NDC z range of < code > [ - 1 . . + 1 ] < / code > when < code > false < / code > * @ return this */ public Matrix4f setPerspectiveOffCenter ( float fovy , float offAngleX , float offAngleY , float aspect , float zNear , float zFar , boolean zZeroToOne ) { } }
MemUtil . INSTANCE . zero ( this ) ; float h = ( float ) Math . tan ( fovy * 0.5f ) ; float xScale = 1.0f / ( h * aspect ) , yScale = 1.0f / h ; this . _m00 ( xScale ) ; this . _m11 ( yScale ) ; float offX = ( float ) Math . tan ( offAngleX ) , offY = ( float ) Math . tan ( offAngleY ) ; this . _m20 ( offX * xScale ) ; this . _m21 ( offY * yScale ) ; boolean farInf = zFar > 0 && Float . isInfinite ( zFar ) ; boolean nearInf = zNear > 0 && Float . isInfinite ( zNear ) ; if ( farInf ) { // See : " Infinite Projection Matrix " ( http : / / www . terathon . com / gdc07 _ lengyel . pdf ) float e = 1E-6f ; this . _m22 ( e - 1.0f ) ; this . _m32 ( ( e - ( zZeroToOne ? 1.0f : 2.0f ) ) * zNear ) ; } else if ( nearInf ) { float e = 1E-6f ; this . _m22 ( ( zZeroToOne ? 0.0f : 1.0f ) - e ) ; this . _m32 ( ( ( zZeroToOne ? 1.0f : 2.0f ) - e ) * zFar ) ; } else { this . _m22 ( ( zZeroToOne ? zFar : zFar + zNear ) / ( zNear - zFar ) ) ; this . _m32 ( ( zZeroToOne ? zFar : zFar + zFar ) * zNear / ( zNear - zFar ) ) ; } this . _m23 ( - 1.0f ) ; _properties ( offAngleX == 0.0f && offAngleY == 0.0f ? PROPERTY_PERSPECTIVE : 0 ) ; return this ;
public class EventManager { /** * Check if the event must be sent and fire it if must be done * @ param attributeName specified event attribute * @ param devFailed the attribute failed error to be sent as event * @ throws fr . esrf . Tango . DevFailed * @ throws DevFailed */ public void pushAttributeErrorEvent ( final String deviceName , final String attributeName , final DevFailed devFailed ) throws DevFailed { } }
xlogger . entry ( ) ; for ( final EventType eventType : EventType . values ( ) ) { final String fullName = EventUtilities . buildEventName ( deviceName , attributeName , eventType ) ; final EventImpl eventImpl = getEventImpl ( fullName ) ; if ( eventImpl != null ) { for ( ZMQ . Socket eventSocket : eventEndpoints . values ( ) ) { eventImpl . pushDevFailedEvent ( devFailed , eventSocket ) ; } } } xlogger . exit ( ) ;
public class CommandLineArgumentParser { /** * arguments involved . */ private void validateArgumentDefinitions ( ) { } }
for ( final NamedArgumentDefinition mutexSourceDef : namedArgumentDefinitions ) { for ( final String mutexTarget : mutexSourceDef . getMutexTargetList ( ) ) { final NamedArgumentDefinition mutexTargetDef = namedArgumentsDefinitionsByAlias . get ( mutexTarget ) ; if ( mutexTargetDef == null ) { throw new CommandLineException . CommandLineParserInternalException ( String . format ( "Argument '%s' references a nonexistent mutex argument '%s'" , mutexSourceDef . getArgumentAliasDisplayString ( ) , mutexTarget ) ) ; } else { // Add at least one alias for the mutex source to the mutex target to ensure the // relationship is symmetric for purposes of usage / help doc display . mutexTargetDef . addMutexTarget ( mutexSourceDef . getLongName ( ) ) ; } } }
public class RingbufferContainer { /** * Converts the { @ code item } into the ringbuffer { @ link InMemoryFormat } or * keeps it unchanged if the supplied argument is already in the ringbuffer * format . * @ param item the item * @ return the binary or deserialized format , depending on the { @ link RingbufferContainer # inMemoryFormat } * @ throws HazelcastSerializationException if the ring buffer is configured to keep items * in object format and the item could not be deserialized */ private E convertToRingbufferFormat ( Object item ) { } }
return inMemoryFormat == OBJECT ? ( E ) serializationService . toObject ( item ) : ( E ) serializationService . toData ( item ) ;
public class ThreadLocalRandom { /** * Returns an effectively unlimited stream of pseudorandom { @ code int } * values . * @ implNote This method is implemented to be equivalent to { @ code * ints ( Long . MAX _ VALUE ) } . * @ return a stream of pseudorandom { @ code int } values * @ since 1.8 */ public IntStream ints ( ) { } }
return StreamSupport . intStream ( new RandomIntsSpliterator ( 0L , Long . MAX_VALUE , Integer . MAX_VALUE , 0 ) , false ) ;
public class DatastreamFilenameHelper { /** * Add a content disposition header to a MIMETypedStream based on configuration preferences . * Header by default specifies " inline " ; if download = true then " attachment " is specified . * @ param context * @ param pid * @ param dsID * @ param download * true if file is to be downloaded * @ param asOfDateTime * @ param stream * @ throws Exception */ public final void addContentDispositionHeader ( Context context , String pid , String dsID , String download , Date asOfDateTime , MIMETypedStream stream ) throws Exception { } }
String headerValue = null ; String filename = null ; // is downloading requested ? if ( download != null && download . equals ( "true" ) ) { // generate an " attachment " content disposition header with the filename filename = getFilename ( context , pid , dsID , asOfDateTime , stream . getMIMEType ( ) ) ; headerValue = attachmentHeader ( filename ) ; } else { // is the content disposition header enabled in the case of not downloading ? if ( m_datastreamContentDispositionInlineEnabled . equals ( "true" ) ) { // it is . . . generate the header with " inline " filename = getFilename ( context , pid , dsID , asOfDateTime , stream . getMIMEType ( ) ) ; headerValue = inlineHeader ( filename ) ; } } // create content disposition header to add Property [ ] header = { new Property ( "content-disposition" , headerValue ) } ; // add header to existing headers if present , or set this as the new header if not if ( stream . header != null ) { Property headers [ ] = new Property [ stream . header . length + 1 ] ; System . arraycopy ( stream . header , 0 , headers , 0 , stream . header . length ) ; headers [ headers . length - 1 ] = header [ 0 ] ; stream . header = headers ; } else { stream . header = header ; }
public class XmlParser { public synchronized Node parse ( InputSource source ) throws IOException , SAXException { } }
Handler handler = new Handler ( ) ; XMLReader reader = _parser . getXMLReader ( ) ; reader . setContentHandler ( handler ) ; reader . setErrorHandler ( handler ) ; reader . setEntityResolver ( handler ) ; if ( log . isDebugEnabled ( ) ) log . debug ( "parsing: sid=" + source . getSystemId ( ) + ",pid=" + source . getPublicId ( ) ) ; _parser . parse ( source , handler ) ; if ( handler . _error != null ) throw handler . _error ; Node doc = ( Node ) handler . _top . get ( 0 ) ; handler . clear ( ) ; return doc ;
public class CassandraClientBase { /** * On super column . * @ param m * the m * @ param isRelation * the is relation * @ param relations * the relations * @ param entities * the entities * @ param superColumns * the super columns * @ param key * the key */ protected void onSuperColumn ( EntityMetadata m , boolean isRelation , List < String > relations , List < Object > entities , List < SuperColumn > superColumns , ByteBuffer key ) { } }
Object e = null ; Object id = PropertyAccessorHelper . getObject ( m . getIdAttribute ( ) . getJavaType ( ) , key . array ( ) ) ; ThriftRow tr = new ThriftRow ( id , m . getTableName ( ) , new ArrayList < Column > ( 0 ) , superColumns , new ArrayList < CounterColumn > ( 0 ) , new ArrayList < CounterSuperColumn > ( 0 ) ) ; e = getDataHandler ( ) . populateEntity ( tr , m , KunderaCoreUtils . getEntity ( e ) , relations , isRelation ) ; if ( log . isInfoEnabled ( ) ) { log . info ( "Populating data for super column family of clazz {} and row key {}." , m . getEntityClazz ( ) , tr . getId ( ) ) ; } if ( e != null ) { entities . add ( e ) ; }
public class CPlugin { /** * { @ inheritDoc } */ @ Override public void define ( Context context ) { } }
List < Object > l = new ArrayList < > ( ) ; // plugin elements l . add ( CLanguage . class ) ; l . add ( CDefaultProfile . class ) ; l . add ( CRuleRepository . class ) ; // reusable elements l . addAll ( getSensorsImpl ( ) ) ; // properties elements l . addAll ( generalProperties ( ) ) ; l . addAll ( codeAnalysisProperties ( ) ) ; l . addAll ( testingAndCoverageProperties ( ) ) ; l . addAll ( compilerWarningsProperties ( ) ) ; l . addAll ( duplicationsProperties ( ) ) ; context . addExtensions ( l ) ;
public class ConfigUtil { /** * { @ link # parseMetaData } helper function . */ protected static String parseValue ( String line ) { } }
int eidx = line . indexOf ( "=" ) ; return ( eidx == - 1 ) ? "" : line . substring ( eidx + 1 ) . trim ( ) ;
public class AnalyticsHandler { /** * Parses the query rows from the content stream as long as there is data to be found . */ private void parseQueryRows ( boolean lastChunk ) { } }
while ( true ) { int openBracketPos = findNextChar ( responseContent , '{' ) ; if ( isEmptySection ( openBracketPos ) || ( lastChunk && openBracketPos < 0 ) ) { sectionDone ( ) ; queryParsingState = transitionToNextToken ( lastChunk ) ; break ; } int closeBracketPos = findSectionClosingPosition ( responseContent , '{' , '}' ) ; if ( closeBracketPos == - 1 ) { break ; } int length = closeBracketPos - openBracketPos - responseContent . readerIndex ( ) + 1 ; responseContent . skipBytes ( openBracketPos ) ; ByteBuf resultSlice = responseContent . readSlice ( length ) ; queryRowObservable . onNext ( resultSlice . copy ( ) ) ; responseContent . discardSomeReadBytes ( ) ; }
public class DatatypeConverter { /** * Parse a duration value . * @ param value duration value * @ return Duration instance */ public static final Duration parseDuration ( String value ) { } }
return value == null ? null : Duration . getInstance ( Double . parseDouble ( value ) , TimeUnit . DAYS ) ;
public class Locations { /** * Creates a { @ link org . apache . twill . filesystem . Location } instance which represents the parent of the given location . * @ param location location to extra parent from . * @ return an instance representing the parent location or { @ code null } if there is no parent . */ @ Nullable public static Location getParent ( Location location ) { } }
URI source = location . toURI ( ) ; // If it is root , return null if ( "/" . equals ( source . getPath ( ) ) ) { return null ; } URI resolvedParent = URI . create ( source . toString ( ) + "/.." ) . normalize ( ) ; return location . getLocationFactory ( ) . create ( resolvedParent ) ;
public class CmsProjectDriver { /** * Writes data for a publish job . < p > * @ param dbc the database context * @ param publishJobHistoryId the publish job id * @ param queryKey the query to use * @ param fieldName the fiueld to use * @ param data the data to write * @ throws CmsDataAccessException if something goes wrong */ private void internalWritePublishJobData ( CmsDbContext dbc , CmsUUID publishJobHistoryId , String queryKey , String fieldName , byte [ ] data ) throws CmsDataAccessException { } }
Connection conn = null ; PreparedStatement stmt = null ; PreparedStatement commit = null ; ResultSet res = null ; boolean wasInTransaction = false ; try { conn = m_sqlManager . getConnection ( dbc ) ; stmt = m_sqlManager . getPreparedStatement ( conn , queryKey ) ; wasInTransaction = ! conn . getAutoCommit ( ) ; if ( ! wasInTransaction ) { conn . setAutoCommit ( false ) ; } // update the file content in the contents table stmt . setString ( 1 , publishJobHistoryId . toString ( ) ) ; res = stmt . executeQuery ( ) ; if ( ! res . next ( ) ) { throw new CmsDbEntryNotFoundException ( Messages . get ( ) . container ( Messages . ERR_READ_PUBLISH_JOB_1 , publishJobHistoryId ) ) ; } // write file content OutputStream output = CmsUserDriver . getOutputStreamFromBlob ( res , fieldName ) ; output . write ( data ) ; output . close ( ) ; if ( ! wasInTransaction ) { commit = m_sqlManager . getPreparedStatement ( conn , "C_COMMIT" ) ; commit . execute ( ) ; m_sqlManager . closeAll ( dbc , null , commit , null ) ; } m_sqlManager . closeAll ( dbc , null , stmt , res ) ; // this is needed so the finally block works correctly commit = null ; stmt = null ; res = null ; if ( ! wasInTransaction ) { conn . setAutoCommit ( true ) ; } } catch ( IOException e ) { throw new CmsDbIoException ( Messages . get ( ) . container ( Messages . ERR_WRITING_TO_OUTPUT_STREAM_1 , publishJobHistoryId ) , e ) ; } catch ( SQLException e ) { throw new CmsDbSqlException ( org . opencms . db . generic . Messages . get ( ) . container ( org . opencms . db . generic . Messages . ERR_GENERIC_SQL_1 , CmsDbSqlException . getErrorQuery ( stmt ) ) , e ) ; } finally { org . opencms . db . oracle . CmsSqlManager . closeAllInTransaction ( m_sqlManager , dbc , conn , stmt , res , commit , wasInTransaction ) ; }
public class RequiredValidator { /** * VALIDATE */ public void validate ( FacesContext facesContext , UIComponent uiComponent , Object value ) throws ValidatorException { } }
if ( facesContext == null ) { throw new NullPointerException ( "facesContext" ) ; } if ( uiComponent == null ) { throw new NullPointerException ( "uiComponent" ) ; } // Check if the value is empty like UIInput . validateValue boolean empty = value == null || ( value instanceof String && ( ( String ) value ) . length ( ) == 0 ) ; if ( empty ) { if ( uiComponent instanceof UIInput ) { UIInput uiInput = ( UIInput ) uiComponent ; if ( uiInput . getRequiredMessage ( ) != null ) { String requiredMessage = uiInput . getRequiredMessage ( ) ; throw new ValidatorException ( new FacesMessage ( FacesMessage . SEVERITY_ERROR , requiredMessage , requiredMessage ) ) ; } } throw new ValidatorException ( _MessageUtils . getMessage ( facesContext , facesContext . getViewRoot ( ) . getLocale ( ) , FacesMessage . SEVERITY_ERROR , UIInput . REQUIRED_MESSAGE_ID , new Object [ ] { _MessageUtils . getLabel ( facesContext , uiComponent ) } ) ) ; }
public class DefaultTextBundleRegistry { /** * java properties bundle name * @ param bundleName * @ param locale * @ return convented properties ended file path . */ protected final String toJavaResourceName ( String bundleName , Locale locale ) { } }
String fullName = bundleName ; final String localeName = toLocaleStr ( locale ) ; final String suffix = "properties" ; if ( ! "" . equals ( localeName ) ) fullName = fullName + "_" + localeName ; StringBuilder sb = new StringBuilder ( fullName . length ( ) + 1 + suffix . length ( ) ) ; sb . append ( fullName . replace ( '.' , '/' ) ) . append ( '.' ) . append ( suffix ) ; return sb . toString ( ) ;
public class TransientUserLayoutManagerWrapper { /** * Given an functional name , return its subscribe id . * @ param fname the functional name to lookup * @ return the fname ' s subscribe id . */ @ Override public String getSubscribeId ( String fname ) throws PortalException { } }
// see if a given subscribe id is already in the map String subId = mFnameMap . get ( fname ) ; if ( subId == null ) { // see if a given subscribe id is already in the layout subId = man . getSubscribeId ( fname ) ; } // obtain a description of the transient channel and // assign a new transient channel id if ( subId == null ) { try { IPortletDefinition chanDef = PortletDefinitionRegistryLocator . getPortletDefinitionRegistry ( ) . getPortletDefinitionByFname ( fname ) ; if ( chanDef != null ) { // assign a new id subId = getNextSubscribeId ( ) ; mFnameMap . put ( fname , subId ) ; mSubIdMap . put ( subId , fname ) ; mChanMap . put ( subId , chanDef ) ; } } catch ( Exception e ) { log . error ( "TransientUserLayoutManagerWrapper::getSubscribeId() : " + "an exception encountered while trying to obtain " + "ChannelDefinition for fname \"" + fname + "\" : " + e ) ; subId = null ; } } return subId ;
public class JumblrClient { /** * Get the queued posts for a given blog * @ param blogName the name of the blog * @ param options the options for this call ( or null ) * @ return a List of posts */ public List < Post > blogQueuedPosts ( String blogName , Map < String , ? > options ) { } }
return requestBuilder . get ( JumblrClient . blogPath ( blogName , "/posts/queue" ) , options ) . getPosts ( ) ;
public class Solo { /** * Scroll a AbsListView matching the specified index to the specified line . * @ param index the index of the { @ link AbsListView } to scroll * @ param line the line to scroll to */ public void scrollListToLine ( int index , int line ) { } }
if ( config . commandLogging ) { Log . d ( config . commandLoggingTag , "scrollListToLine(" + index + ", " + line + ")" ) ; } scroller . scrollListToLine ( waiter . waitForAndGetView ( index , AbsListView . class ) , line ) ;
public class SizeConstraintSetSummaryMarshaller { /** * Marshall the given parameter object . */ public void marshall ( SizeConstraintSetSummary sizeConstraintSetSummary , ProtocolMarshaller protocolMarshaller ) { } }
if ( sizeConstraintSetSummary == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( sizeConstraintSetSummary . getSizeConstraintSetId ( ) , SIZECONSTRAINTSETID_BINDING ) ; protocolMarshaller . marshall ( sizeConstraintSetSummary . getName ( ) , NAME_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class Routes { /** * Add a filter * @ param httpMethod the http - method of the route * @ param filter the filter to add */ public void add ( HttpMethod httpMethod , FilterImpl filter ) { } }
add ( httpMethod , filter . getPath ( ) , filter . getAcceptType ( ) , filter ) ;
public class JSLocalConsumerPoint { /** * ( non - Javadoc ) * @ see com . ibm . ws . sib . processor . impl . interfaces . ConsumerPoint # closeSession ( ) */ @ Override public void closeSession ( Throwable e ) throws SIConnectionLostException , SIResourceException , SIErrorException { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "closeSession" , e ) ; if ( e == null ) { // try and build an appropriate exception if ( _consumerKey . isClosedDueToDelete ( ) ) { e = new SISessionDroppedException ( nls . getFormattedMessage ( "DESTINATION_DELETED_ERROR_CWSIP00221" , new Object [ ] { _consumerDispatcher . getDestination ( ) . getName ( ) , _messageProcessor . getMessagingEngineName ( ) } , null ) ) ; } else if ( _consumerKey . isClosedDueToReceiveExclusive ( ) ) { e = new SISessionDroppedException ( nls . getFormattedMessage ( "DESTINATION_EXCLUSIVE_ERROR_CWSIP00222" , new Object [ ] { _consumerDispatcher . getDestination ( ) . getName ( ) , _messageProcessor . getMessagingEngineName ( ) } , null ) ) ; } } // and close the session _consumerSession . close ( ) ; if ( e != null ) notifyException ( e ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "closeSession" , e ) ;
public class CglibDynamicBeanProxy { /** * Creates a proxy class of bean and returns an instance of that class . * @ param context the activity context * @ param beanRule the bean rule * @ param args the arguments passed to a constructor * @ param argTypes the parameter types for a constructor * @ return a new proxy bean object */ public static Object newInstance ( ActivityContext context , BeanRule beanRule , Object [ ] args , Class < ? > [ ] argTypes ) { } }
Enhancer enhancer = new Enhancer ( ) ; enhancer . setClassLoader ( context . getEnvironment ( ) . getClassLoader ( ) ) ; enhancer . setSuperclass ( beanRule . getBeanClass ( ) ) ; enhancer . setCallback ( new CglibDynamicBeanProxy ( context , beanRule ) ) ; return enhancer . create ( argTypes , args ) ;
public class MAPProviderImpl { public void onTCBegin ( TCBeginIndication tcBeginIndication ) { } }
ApplicationContextName acn = tcBeginIndication . getApplicationContextName ( ) ; Component [ ] comps = tcBeginIndication . getComponents ( ) ; // ETS 300 974 Section 12.1.3 // On receipt of a TC - BEGIN indication primitive , the MAP PM shall : // - if no application - context - name is included in the primitive and if // the " Components present " indicator indicates " no components " , issue a // TC - U - ABORT request primitive ( note 2 ) . The local MAP - User is not // informed ; if ( acn == null && comps == null ) { loger . error ( String . format ( "Received TCBeginIndication=%s, both ApplicationContextName and Component[] are null. Send TC-U-ABORT to peer and not notifying the User" , tcBeginIndication ) ) ; try { this . fireTCAbortV1 ( tcBeginIndication . getDialog ( ) , false ) ; } catch ( MAPException e ) { loger . error ( "Error while firing TC-U-ABORT. " , e ) ; } return ; } MAPApplicationContext mapAppCtx = null ; MAPServiceBase perfSer = null ; if ( acn == null ) { // ApplicationContext is absent but components are absent - MAP // Version 1 // - if no application - context - name is included in the primitive and // if presence of components is indicated , wait for the first // TC - INVOKE primitive , and derive a version 1 // application - context - name from the operation code according to // table 12.1/1 ( note 1 ) ; // a ) if no application - context - name can be derived ( i . e . the // operation code does not exist in MAP V1 specifications ) , the MAP // PM shall issue a TC - U - ABORT request primitive ( note 2 ) . The local // MAP - User is not informed . // Extracting Invoke and operationCode Invoke invoke = null ; int operationCode = - 1 ; for ( Component c : comps ) { if ( c . getType ( ) == ComponentType . Invoke ) { invoke = ( Invoke ) c ; break ; } } if ( invoke != null ) { OperationCode oc = invoke . getOperationCode ( ) ; if ( oc != null && oc . getOperationType ( ) == OperationCodeType . Local ) { operationCode = ( int ) ( long ) oc . getLocalOperationCode ( ) ; } } if ( operationCode != - 1 ) { // Selecting the MAP service that can perform the operation , getting // ApplicationContext for ( MAPServiceBase ser : this . mapServices ) { MAPApplicationContext ac = ( ( MAPServiceBaseImpl ) ser ) . getMAPv1ApplicationContext ( operationCode , invoke ) ; if ( ac != null ) { perfSer = ser ; mapAppCtx = ac ; break ; } } } if ( mapAppCtx == null ) { // Invoke not found or has bad operationCode or operationCode is not supported try { this . fireTCAbortV1 ( tcBeginIndication . getDialog ( ) , false ) ; return ; } catch ( MAPException e ) { loger . error ( "Error while firing TC-U-ABORT. " , e ) ; } } } else { // ApplicationContext is present - MAP Version 2 or higher if ( MAPApplicationContext . getProtocolVersion ( acn . getOid ( ) ) < 2 ) { // if a version 1 application - context - name is included , the MAP // PM shall issue a TC - U - ABORT // request primitive with abort - reason " User - specific " and // user - information " MAP - ProviderAbortInfo " // indicating " abnormalDialogue " . The local MAP - user shall not // be informed . loger . error ( "Bad version of ApplicationContext if ApplicationContext exists. Must be 2 or greater" ) ; try { this . fireTCAbortProvider ( tcBeginIndication . getDialog ( ) , MAPProviderAbortReason . abnormalDialogue , null , false ) ; } catch ( MAPException e ) { loger . error ( "Error while firing TC-U-ABORT. " , e ) ; } return ; } mapAppCtx = MAPApplicationContext . getInstance ( acn . getOid ( ) ) ; // Check if ApplicationContext is recognizable for the implemented // services // If no - TC - U - ABORT - ACN - Not - Supported if ( mapAppCtx == null ) { StringBuffer s = new StringBuffer ( ) ; s . append ( "Unrecognizable ApplicationContextName is received: " ) ; for ( long l : acn . getOid ( ) ) { s . append ( l ) . append ( ", " ) ; } loger . error ( s . toString ( ) ) ; try { this . fireTCAbortACNNotSupported ( tcBeginIndication . getDialog ( ) , null , null , false ) ; } catch ( MAPException e ) { loger . error ( "Error while firing TC-U-ABORT. " , e ) ; } return ; } } AddressString destReference = null ; AddressString origReference = null ; MAPExtensionContainer extensionContainer = null ; boolean eriStyle = false ; AddressString eriMsisdn = null ; AddressString eriVlrNo = null ; UserInformation userInfo = tcBeginIndication . getUserInformation ( ) ; if ( userInfo == null ) { // if no User - information is present it is checked whether // presence of User Information in the // TC - BEGIN indication primitive is required for the received // application - context - name . If User // Information is required but not present , a TC - U - ABORT request // primitive with abort - reason // " User - specific " and user - information " MAP - ProviderAbortInfo " // indicating " abnormalDialogue " // shall be issued . The local MAP - user shall not be informed . // We demand User - information mandatory now for ACNs // that demand destination / origination reference presence // They are : callCompletionContext ( 8 ) , networkFunctionalSsContext ( 18) // and networkUnstructuredSsContext ( 19) // TODO : I am not absolutely sure that it is correct if ( mapAppCtx . getApplicationContextName ( ) == MAPApplicationContextName . callCompletionContext || mapAppCtx . getApplicationContextName ( ) == MAPApplicationContextName . networkFunctionalSsContext || mapAppCtx . getApplicationContextName ( ) == MAPApplicationContextName . networkUnstructuredSsContext ) { loger . error ( "When parsing TC-BEGIN: userInfo is mandatory for ACN==" + mapAppCtx . getApplicationContextName ( ) + " but not found" ) ; try { this . fireTCAbortProvider ( tcBeginIndication . getDialog ( ) , MAPProviderAbortReason . abnormalDialogue , null , false ) ; } catch ( MAPException e ) { loger . error ( "Error while firing TC-U-ABORT. " , e ) ; } return ; } } else { // if an application - context - name different from version 1 is // included in the primitive and if User - // information is present , the User - information must constitute // a syntactically correct MAP - OPEN // dialogue PDU . Otherwise a TC - U - ABORT request primitive with // abort - reason " User - specific " and // user - information " MAP - ProviderAbortInfo " indicating // " abnormalDialogue " shall be issued and the // local MAP - user shall not be informed . MAPOpenInfoImpl mapOpenInfoImpl = new MAPOpenInfoImpl ( ) ; if ( ! userInfo . isOid ( ) ) { loger . error ( "When parsing TC-BEGIN: userInfo.isOid() check failed" ) ; try { this . fireTCAbortProvider ( tcBeginIndication . getDialog ( ) , MAPProviderAbortReason . invalidPDU , null , false ) ; } catch ( MAPException e ) { loger . error ( "Error while firing TC-U-ABORT. " , e ) ; } return ; } long [ ] oid = userInfo . getOidValue ( ) ; MAPDialogueAS mapDialAs = MAPDialogueAS . getInstance ( oid ) ; if ( mapDialAs == null ) { loger . error ( "When parsing TC-BEGIN: Expected MAPDialogueAS.MAP_DialogueAS but is null" ) ; try { this . fireTCAbortProvider ( tcBeginIndication . getDialog ( ) , MAPProviderAbortReason . invalidPDU , null , false ) ; } catch ( MAPException e ) { loger . error ( "Error while firing TC-U-ABORT. " , e ) ; } return ; } if ( ! userInfo . isAsn ( ) ) { loger . error ( "When parsing TC-BEGIN: userInfo.isAsn() check failed" ) ; try { this . fireTCAbortProvider ( tcBeginIndication . getDialog ( ) , MAPProviderAbortReason . invalidPDU , null , false ) ; } catch ( MAPException e ) { loger . error ( "Error while firing TC-U-ABORT. " , e ) ; } return ; } try { byte [ ] asnData = userInfo . getEncodeType ( ) ; AsnInputStream ais = new AsnInputStream ( asnData ) ; int tag = ais . readTag ( ) ; // It should be MAP _ OPEN Tag if ( tag != MAPOpenInfoImpl . MAP_OPEN_INFO_TAG ) { loger . error ( "When parsing TC-BEGIN: MAP-OPEN dialog PDU must be received" ) ; try { this . fireTCAbortProvider ( tcBeginIndication . getDialog ( ) , MAPProviderAbortReason . invalidPDU , null , false ) ; } catch ( MAPException e ) { loger . error ( "Error while firing TC-U-ABORT. " , e ) ; } return ; } mapOpenInfoImpl . decodeAll ( ais ) ; destReference = mapOpenInfoImpl . getDestReference ( ) ; origReference = mapOpenInfoImpl . getOrigReference ( ) ; extensionContainer = mapOpenInfoImpl . getExtensionContainer ( ) ; eriStyle = mapOpenInfoImpl . getEriStyle ( ) ; eriMsisdn = mapOpenInfoImpl . getEriMsisdn ( ) ; eriVlrNo = mapOpenInfoImpl . getEriVlrNo ( ) ; } catch ( AsnException e ) { e . printStackTrace ( ) ; loger . error ( "AsnException when parsing MAP-OPEN Pdu: " + e . getMessage ( ) , e ) ; try { this . fireTCAbortProvider ( tcBeginIndication . getDialog ( ) , MAPProviderAbortReason . invalidPDU , null , false ) ; } catch ( MAPException e1 ) { loger . error ( "Error while firing TC-U-ABORT. " , e1 ) ; } return ; } catch ( IOException e ) { e . printStackTrace ( ) ; loger . error ( "IOException when parsing MAP-OPEN Pdu: " + e . getMessage ( ) ) ; try { this . fireTCAbortProvider ( tcBeginIndication . getDialog ( ) , MAPProviderAbortReason . invalidPDU , null , false ) ; } catch ( MAPException e1 ) { loger . error ( "Error while firing TC-U-ABORT. " , e1 ) ; } return ; } catch ( MAPParsingComponentException e ) { e . printStackTrace ( ) ; loger . error ( "MAPException when parsing MAP-OPEN Pdu: " + e . getMessage ( ) ) ; try { this . fireTCAbortProvider ( tcBeginIndication . getDialog ( ) , MAPProviderAbortReason . invalidPDU , null , false ) ; } catch ( MAPException e1 ) { loger . error ( "Error while firing TC-U-ABORT. " , e1 ) ; } return ; } } // Selecting the MAP service that can perform the ApplicationContext if ( perfSer == null ) { for ( MAPServiceBase ser : this . mapServices ) { ServingCheckData chkRes = ser . isServingService ( mapAppCtx ) ; switch ( chkRes . getResult ( ) ) { case AC_Serving : perfSer = ser ; break ; case AC_VersionIncorrect : try { this . fireTCAbortACNNotSupported ( tcBeginIndication . getDialog ( ) , null , chkRes . getAlternativeApplicationContext ( ) , false ) ; } catch ( MAPException e1 ) { loger . error ( "Error while firing TC-U-ABORT. " , e1 ) ; } break ; } if ( perfSer != null ) break ; } } // No MAPService can accept the received ApplicationContextName if ( perfSer == null ) { StringBuffer s = new StringBuffer ( ) ; s . append ( "Unsupported ApplicationContextName is received: " ) ; if ( acn != null ) { for ( long l : acn . getOid ( ) ) { s . append ( l ) . append ( ", " ) ; } } else { s . append ( "MAP V1" ) ; } loger . error ( s . toString ( ) ) ; try { this . fireTCAbortACNNotSupported ( tcBeginIndication . getDialog ( ) , null , null , false ) ; } catch ( MAPException e1 ) { loger . error ( "Error while firing TC-U-ABORT. " , e1 ) ; } return ; } // MAPService is not activated if ( ! perfSer . isActivated ( ) ) { StringBuffer s = new StringBuffer ( ) ; s . append ( "ApplicationContextName of non activated MAPService is received. Will send back TCAP Abort : " ) ; if ( acn != null ) { for ( long l : acn . getOid ( ) ) { s . append ( l ) . append ( ", " ) ; } } else { s . append ( "MAP V1" ) ; } loger . warn ( s . toString ( ) ) ; try { this . fireTCAbortACNNotSupported ( tcBeginIndication . getDialog ( ) , null , null , false ) ; } catch ( MAPException e1 ) { loger . error ( "Error while firing TC-U-ABORT. " , e1 ) ; } return ; } MAPDialogImpl mapDialogImpl = ( ( MAPServiceBaseImpl ) perfSer ) . createNewDialogIncoming ( mapAppCtx , tcBeginIndication . getDialog ( ) ) ; try { mapDialogImpl . getTcapDialog ( ) . getDialogLock ( ) . lock ( ) ; this . addDialog ( mapDialogImpl ) ; mapDialogImpl . tcapMessageType = MessageType . Begin ; mapDialogImpl . receivedOrigReference = origReference ; mapDialogImpl . receivedDestReference = destReference ; mapDialogImpl . receivedExtensionContainer = extensionContainer ; mapDialogImpl . setState ( MAPDialogState . INITIAL_RECEIVED ) ; mapDialogImpl . delayedAreaState = MAPDialogImpl . DelayedAreaState . No ; if ( eriStyle ) { this . deliverDialogRequestEri ( mapDialogImpl , destReference , origReference , eriMsisdn , eriVlrNo ) ; } else { this . deliverDialogRequest ( mapDialogImpl , destReference , origReference , extensionContainer ) ; } if ( mapDialogImpl . getState ( ) == MAPDialogState . EXPUNGED ) { // The Dialog was aborter or refused return ; } // Now let us decode the Components if ( comps != null ) { processComponents ( mapDialogImpl , comps ) ; } this . deliverDialogDelimiter ( mapDialogImpl ) ; finishComponentProcessingState ( mapDialogImpl ) ; if ( this . getTCAPProvider ( ) . getPreviewMode ( ) ) { DialogImpl dimp = ( DialogImpl ) tcBeginIndication . getDialog ( ) ; dimp . getPrevewDialogData ( ) . setUpperDialog ( mapDialogImpl ) ; } } finally { mapDialogImpl . getTcapDialog ( ) . getDialogLock ( ) . unlock ( ) ; }
public class CIType { /** * Tests , if this type is kind of the type in the parameter ( question is , is * this type a child of the parameter type ) . * @ param _ type type to test for parent * @ return true if this type is a child , otherwise false */ public boolean isKindOf ( final org . efaps . admin . datamodel . Type _type ) { } }
return getType ( ) . isKindOf ( _type ) ;
public class InkView { @ Override protected void onSizeChanged ( int w , int h , int oldw , int oldh ) { } }
super . onSizeChanged ( w , h , oldw , oldh ) ; clear ( ) ;
public class ChunkFrequencyManager { /** * Initialize the map of chunks . */ private void initChunkMap ( ) { } }
Statement stmt = null ; Connection connection = null ; try { Class . forName ( "org.sqlite.JDBC" ) ; connection = DriverManager . getConnection ( "jdbc:sqlite:" + databasePath ) ; // retrieve chunk IDs from database String sql = "SELECT id, chromosome, start FROM chunk" ; stmt = connection . createStatement ( ) ; ResultSet rs = stmt . executeQuery ( sql ) ; chunkIdMap = new HashMap < > ( ) ; while ( rs . next ( ) ) { chunkIdMap . put ( rs . getString ( "chromosome" ) + "_" + rs . getInt ( "start" ) , rs . getInt ( "id" ) ) ; } } catch ( SQLException e ) { logger . error ( e . getClass ( ) . getName ( ) + ": " + e . getMessage ( ) ) ; cleanConnectionClose ( connection , stmt ) ; } catch ( ClassNotFoundException e ) { logger . error ( e . getClass ( ) . getName ( ) + ": " + e . getMessage ( ) ) ; e . printStackTrace ( ) ; }
public class PackratMemo { /** * This method puts memozation elements into the buffer . It is designed in a * way , that entries , once set , are not changed anymore . This is needed not to * break references ! * @ param production * @ param position * @ param stackElement */ void setMemo ( String production , int position , int line , final MemoEntry stackElement ) { } }
Map < String , MemoEntry > map = memo . get ( position ) ; if ( map == null ) { map = new HashMap < String , MemoEntry > ( ) ; memo . put ( position , map ) ; map . put ( production , stackElement ) ; } else { if ( map . containsKey ( production ) ) { throw new RuntimeException ( "We should not set a memo twice. Modifying is needed afterwards." ) ; } map . put ( production , stackElement ) ; }
public class FileUtil { /** * 创建文件及其父目录 , 如果这个文件存在 , 直接返回这个文件 < br > * 此方法不对File对象类型做判断 , 如果File不存在 , 无法判断其类型 * @ param file 文件对象 * @ return 文件 , 若路径为null , 返回null * @ throws IORuntimeException IO异常 */ public static File touch ( File file ) throws IORuntimeException { } }
if ( null == file ) { return null ; } if ( false == file . exists ( ) ) { mkParentDirs ( file ) ; try { file . createNewFile ( ) ; } catch ( Exception e ) { throw new IORuntimeException ( e ) ; } } return file ;