signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class StringTokenIterator { /** * Returns the next element in the iteration . * @ return the next element in the iteration . * @ exception java . util . NoSuchElementException iteration has no more elements . */ public String next ( ) { } }
if ( ! hasNext ( ) ) { throw new NoSuchElementException ( ) ; } String next = this . next ; this . next = fetchNext ( ) ; return next ;
public class ZealotKhala { /** * 生成带 " OR " 前缀不等查询的SQL片段 . * @ param field 数据库字段 * @ param value 值 * @ return ZealotKhala实例 */ public ZealotKhala orNotEqual ( String field , Object value ) { } }
return this . doNormal ( ZealotConst . OR_PREFIX , field , value , ZealotConst . NOT_EQUAL_SUFFIX , true ) ;
public class BlockingList { /** * Attempt to retrieve the element at the specified index , using the provided { @ link Retriever } . * This method will release all read locks held by this thread , then acquire a write lock . * It will then re - acquire the same number of read locks before exiting the method . * @ param index the index of the key whose associated element is required * @ return true if the element was found or has failed permanently , false otherwise */ private boolean tryToFetchElement ( int index ) { } }
// must release read locks before acquiring write lock final int readLocks = stateLock . releaseReadLocksAndAcquireWriteLock ( ) ; try { return couldStillTurnUp ( elements [ index ] ) ? reallyTryToFetchElement ( index ) : true ; } finally { stateLock . downgradeWriteLockToReadLocks ( readLocks ) ; }
public class DispatcherThread { /** * accumulated queue sizes of all actors * @ return */ public int getAccumulatedQSizes ( ) { } }
int res = 0 ; final Actor actors [ ] = this . actors ; for ( int i = 0 ; i < actors . length ; i ++ ) { res += actors [ i ] . getQSizes ( ) ; } return res ;
public class ListEditor { /** * implement ListSelectionListener */ public void valueChanged ( ListSelectionEvent lse ) { } }
int selectedIndex = list . getSelectedIndex ( ) ; if ( selectedIndex == - 1 ) { editButton . setEnabled ( false ) ; removeButton . setEnabled ( false ) ; moveUpButton . setEnabled ( false ) ; moveDownButton . setEnabled ( false ) ; return ; } editButton . setEnabled ( true ) ; removeButton . setEnabled ( true ) ; moveUpButton . setEnabled ( selectedIndex != 0 ) ; moveDownButton . setEnabled ( selectedIndex != list . getLastVisibleIndex ( ) ) ;
public class AsyncLookupInBuilder { /** * Get a value inside the JSON document . * @ param paths the path inside the document where to get the value from . * @ return this builder for chaining . */ public AsyncLookupInBuilder get ( String ... paths ) { } }
if ( paths == null || paths . length == 0 ) { throw new IllegalArgumentException ( "Path is mandatory for subdoc get" ) ; } for ( String path : paths ) { if ( StringUtil . isNullOrEmpty ( path ) ) { throw new IllegalArgumentException ( "Path is mandatory for subdoc get" ) ; } this . specs . add ( new LookupSpec ( Lookup . GET , path ) ) ; } return this ;
public class ResourceFactory { /** * 将对象以指定资源名注入到资源池中 , 并同步已被注入的资源 * @ param < A > 泛型 * @ param name 资源名 * @ param rs 资源对象 * @ return 旧资源对象 */ public < A > A register ( final String name , final A rs ) { } }
return register ( true , name , rs ) ;
public class JodaBeanXmlReader { /** * Reads and parses to a bean . * @ param < T > the root type * @ param input the input string , not null * @ param rootType the root type , not null * @ return the bean , not null */ public < T > T read ( final String input , Class < T > rootType ) { } }
return read ( new StringReader ( input ) , rootType ) ;
public class StatusMessageRepository { /** * region > findByTransactionId */ @ Programmatic public List < StatusMessage > findByTransactionId ( final UUID transactionId ) { } }
return repositoryService . allMatches ( new QueryDefault < > ( StatusMessage . class , "findByTransactionId" , "transactionId" , transactionId ) ) ;
public class Files { /** * Atomic download file from specified URL to local target file . This method guarantee atomic operation : file is * actually created only if transfer completes with success . For this purpose download is performed to a temporary * file that is renamed after transfer complete . Of course , if transfer fails rename does not occur . * @ param url source file URL , * @ param file local target file . * @ throws IOException if transfer or local write fails . */ public static void download ( URL url , File file ) throws IOException { } }
final File partialFile = new File ( file . getAbsolutePath ( ) + PARTIAL_FILE_SUFFIX ) ; try { Files . copy ( url , partialFile ) ; renameTo ( partialFile , file ) ; } finally { // last resort to ensure partially file does not hang around on error // do not test for delete execution fail since , at this point , the partial file state is not certain partialFile . delete ( ) ; }
public class PacketStream { /** * - - - " TRANSFER FROM " METHODS - - - */ public Promise transferFrom ( File source ) { } }
try { return transferFrom ( new FileInputStream ( source ) ) ; } catch ( Throwable cause ) { return Promise . reject ( cause ) ; }
public class KeyAndCertificateFactory { /** * Create a random 2048 bit RSA key pair with the given length */ KeyPair generateKeyPair ( int keySize ) throws Exception { } }
KeyPairGenerator generator = KeyPairGenerator . getInstance ( KEY_GENERATION_ALGORITHM , PROVIDER_NAME ) ; generator . initialize ( keySize , new SecureRandom ( ) ) ; return generator . generateKeyPair ( ) ;
public class ProGradePolicyEntry { /** * Method for determining whether this ProgradePolicyEntry implies given permission . * @ param pd active ProtectionDomain to test * @ param permission Permission which need to be determined * @ return true if ProgradePolicyEntry implies given Permission , false otherwise */ public boolean implies ( ProtectionDomain pd , Permission permission ) { } }
if ( neverImplies ) { if ( debug ) { ProGradePolicyDebugger . log ( "This entry never imply anything." ) ; } return false ; } // codesource if ( codeSource != null && pd . getCodeSource ( ) != null ) { if ( debug ) { ProGradePolicyDebugger . log ( "Evaluate codesource..." ) ; ProGradePolicyDebugger . log ( " Policy codesource: " + codeSource . toString ( ) ) ; ProGradePolicyDebugger . log ( " Active codesource: " + pd . getCodeSource ( ) . toString ( ) ) ; } if ( ! codeSource . implies ( pd . getCodeSource ( ) ) ) { if ( debug ) { ProGradePolicyDebugger . log ( "Evaluation (codesource) failed." ) ; } return false ; } } // principals if ( ! principals . isEmpty ( ) ) { if ( debug ) { ProGradePolicyDebugger . log ( "Evaluate principals..." ) ; } Principal [ ] pdPrincipals = pd . getPrincipals ( ) ; if ( pdPrincipals == null || pdPrincipals . length == 0 ) { if ( debug ) { ProGradePolicyDebugger . log ( "Evaluation (principals) failed. There is no active principals." ) ; } return false ; } if ( debug ) { ProGradePolicyDebugger . log ( "Policy principals:" ) ; for ( ProGradePrincipal principal : principals ) { ProGradePolicyDebugger . log ( " " + principal . toString ( ) ) ; } ProGradePolicyDebugger . log ( "Active principals:" ) ; if ( pdPrincipals . length == 0 ) { ProGradePolicyDebugger . log ( " none" ) ; } for ( int i = 0 ; i < pdPrincipals . length ; i ++ ) { Principal principal = pdPrincipals [ i ] ; ProGradePolicyDebugger . log ( " " + principal . toString ( ) ) ; } } for ( ProGradePrincipal principal : principals ) { boolean contain = false ; for ( int i = 0 ; i < pdPrincipals . length ; i ++ ) { if ( principal . hasWildcardClassName ( ) ) { contain = true ; break ; } Principal pdPrincipal = pdPrincipals [ i ] ; if ( pdPrincipal . getClass ( ) . getName ( ) . equals ( principal . getClassName ( ) ) ) { if ( principal . hasWildcardPrincipal ( ) ) { contain = true ; break ; } if ( pdPrincipal . getName ( ) . equals ( principal . getPrincipalName ( ) ) ) { contain = true ; break ; } } } if ( ! contain ) { if ( debug ) { ProGradePolicyDebugger . log ( "Evaluation (principals) failed." ) ; } return false ; } } } // permissions if ( debug ) { ProGradePolicyDebugger . log ( "Evaluation codesource/principals passed." ) ; String grantOrDeny = ( grant ) ? "granting" : "denying" ; Enumeration < Permission > elements = permissions . elements ( ) ; while ( elements . hasMoreElements ( ) ) { Permission nextElement = elements . nextElement ( ) ; ProGradePolicyDebugger . log ( " " + grantOrDeny + " " + nextElement . toString ( ) ) ; } } boolean toReturn = permissions . implies ( permission ) ; if ( debug ) { if ( toReturn ) { ProGradePolicyDebugger . log ( "Needed permission found in this entry." ) ; } else { ProGradePolicyDebugger . log ( "Needed permission wasn't found in this entry." ) ; } } return toReturn ;
public class NioChannel { private String getPort ( SocketAddress socketAddress ) { } }
return socketAddress == null ? "*missing*" : Integer . toString ( ( ( InetSocketAddress ) socketAddress ) . getPort ( ) ) ;
public class LUDecomposition { /** * Return upper triangular factor * @ return U */ @ Nonnull public Matrix getU ( ) { } }
final Matrix aNewMatrix = new Matrix ( m_nCols , m_nCols ) ; final double [ ] [ ] aNewArray = aNewMatrix . internalGetArray ( ) ; for ( int nRow = 0 ; nRow < m_nCols ; nRow ++ ) { final double [ ] aSrcRow = m_aLU [ nRow ] ; final double [ ] aDstRow = aNewArray [ nRow ] ; for ( int nCol = 0 ; nCol < m_nCols ; nCol ++ ) if ( nRow <= nCol ) aDstRow [ nCol ] = aSrcRow [ nCol ] ; else aDstRow [ nCol ] = 0.0 ; } return aNewMatrix ;
public class QueryExecutorImpl { /** * Receive the field descriptions from the back end . */ private Field [ ] receiveFields ( ) throws IOException { } }
int msgSize = pgStream . receiveInteger4 ( ) ; int size = pgStream . receiveInteger2 ( ) ; Field [ ] fields = new Field [ size ] ; if ( LOGGER . isLoggable ( Level . FINEST ) ) { LOGGER . log ( Level . FINEST , " <=BE RowDescription({0})" , size ) ; } for ( int i = 0 ; i < fields . length ; i ++ ) { String columnLabel = pgStream . receiveString ( ) ; int tableOid = pgStream . receiveInteger4 ( ) ; short positionInTable = ( short ) pgStream . receiveInteger2 ( ) ; int typeOid = pgStream . receiveInteger4 ( ) ; int typeLength = pgStream . receiveInteger2 ( ) ; int typeModifier = pgStream . receiveInteger4 ( ) ; int formatType = pgStream . receiveInteger2 ( ) ; fields [ i ] = new Field ( columnLabel , typeOid , typeLength , typeModifier , tableOid , positionInTable ) ; fields [ i ] . setFormat ( formatType ) ; LOGGER . log ( Level . FINEST , " {0}" , fields [ i ] ) ; } return fields ;
public class A_CmsWorkplaceApp { /** * Returns the parameters contained in the state string . < p > * @ param state the state * @ return the parameters */ public static Map < String , String > getParamsFromState ( String state ) { } }
Map < String , String > result = new HashMap < String , String > ( ) ; int separatorIndex = state . indexOf ( PARAM_SEPARATOR ) ; while ( separatorIndex >= 0 ) { state = state . substring ( separatorIndex + 2 ) ; int assignIndex = state . indexOf ( PARAM_ASSIGN ) ; if ( assignIndex > 0 ) { String key = state . substring ( 0 , assignIndex ) ; state = state . substring ( assignIndex + 2 ) ; separatorIndex = state . indexOf ( PARAM_SEPARATOR ) ; String value = null ; if ( separatorIndex < 0 ) { value = state ; } else if ( separatorIndex > 0 ) { value = state . substring ( 0 , separatorIndex ) ; } if ( CmsStringUtil . isNotEmptyOrWhitespaceOnly ( value ) ) { result . put ( key , CmsEncoder . decode ( value , CmsEncoder . ENCODING_UTF_8 ) ) ; } } else { separatorIndex = - 1 ; } } return result ;
public class TaskEntity { /** * authorizations / / / / / */ public void fireAuthorizationProvider ( ) { } }
PropertyChange assigneePropertyChange = propertyChanges . get ( ASSIGNEE ) ; if ( assigneePropertyChange != null ) { String oldAssignee = assigneePropertyChange . getOrgValueString ( ) ; String newAssignee = assigneePropertyChange . getNewValueString ( ) ; fireAssigneeAuthorizationProvider ( oldAssignee , newAssignee ) ; } PropertyChange ownerPropertyChange = propertyChanges . get ( OWNER ) ; if ( ownerPropertyChange != null ) { String oldOwner = ownerPropertyChange . getOrgValueString ( ) ; String newOwner = ownerPropertyChange . getNewValueString ( ) ; fireOwnerAuthorizationProvider ( oldOwner , newOwner ) ; }
public class LogMgr { /** * Appends a log record to the file . The record contains an arbitrary array * of values . The method also writes an integer to the end of each log * record whose value is the offset of the corresponding integer for the * previous log record . These integers allow log records to be read in * reverse order . * @ param rec * the list of values * @ return the LSN of the log record */ public LogSeqNum append ( Constant [ ] rec ) { } }
logMgrLock . lock ( ) ; try { // two integers that point to the previous and next log records int recsize = pointerSize * 2 ; for ( Constant c : rec ) recsize += Page . size ( c ) ; // if the log record doesn ' t fit , move to the next block if ( currentPos + recsize >= BLOCK_SIZE ) { flush ( ) ; appendNewBlock ( ) ; } // Get the current LSN LogSeqNum lsn = currentLSN ( ) ; // Append a record for ( Constant c : rec ) appendVal ( c ) ; finalizeRecord ( ) ; // Remember this LSN lastLsn = lsn ; return lsn ; } finally { logMgrLock . unlock ( ) ; }
public class Calc { /** * Returns the Vector that needs to be applied to shift a set of atoms to * the Centroid , if the centroid is already known * @ param atomSet * array of Atoms * @ return the vector needed to shift the set of atoms to its geometric * center */ public static final Atom getCenterVector ( Atom [ ] atomSet , Atom centroid ) { } }
double [ ] coords = new double [ 3 ] ; coords [ 0 ] = 0 - centroid . getX ( ) ; coords [ 1 ] = 0 - centroid . getY ( ) ; coords [ 2 ] = 0 - centroid . getZ ( ) ; Atom shiftVec = new AtomImpl ( ) ; shiftVec . setCoords ( coords ) ; return shiftVec ;
public class CmsModelPageTreeItem { /** * Handles direct editing of the gallery title . < p > * @ param editEntry the edit entry * @ param newTitle the new title */ void handleEdit ( CmsClientSitemapEntry editEntry , final String newTitle ) { } }
if ( CmsStringUtil . isEmpty ( newTitle ) ) { String dialogTitle = Messages . get ( ) . key ( Messages . GUI_EDIT_TITLE_ERROR_DIALOG_TITLE_0 ) ; String dialogText = Messages . get ( ) . key ( Messages . GUI_TITLE_CANT_BE_EMPTY_0 ) ; CmsAlertDialog alert = new CmsAlertDialog ( dialogTitle , dialogText ) ; alert . center ( ) ; return ; } String oldTitle = editEntry . getPropertyValue ( CmsClientProperty . PROPERTY_TITLE ) ; if ( ! oldTitle . equals ( newTitle ) ) { CmsPropertyModification propMod = new CmsPropertyModification ( getEntryId ( ) , CmsClientProperty . PROPERTY_TITLE , newTitle , true ) ; final List < CmsPropertyModification > propChanges = new ArrayList < CmsPropertyModification > ( ) ; propChanges . add ( propMod ) ; CmsSitemapController controller = CmsSitemapView . getInstance ( ) . getController ( ) ; controller . edit ( editEntry , propChanges , CmsReloadMode . reloadEntry ) ; }
public class StandardAtomGenerator { /** * Generate the displayed atom symbol for an atom in given structure with the specified hydrogen * position . * @ param container structure to which the atom belongs * @ param atom the atom to generate the symbol for * @ param position the hydrogen position * @ param model additional rendering options * @ return atom symbol */ AtomSymbol generateSymbol ( IAtomContainer container , IAtom atom , HydrogenPosition position , RendererModel model ) { } }
if ( atom instanceof IPseudoAtom ) { IPseudoAtom pAtom = ( IPseudoAtom ) atom ; if ( pAtom . getAttachPointNum ( ) <= 0 ) { if ( pAtom . getLabel ( ) . equals ( "*" ) ) { int mass = unboxSafely ( pAtom . getMassNumber ( ) , 0 ) ; int charge = unboxSafely ( pAtom . getFormalCharge ( ) , 0 ) ; int hcnt = unboxSafely ( pAtom . getImplicitHydrogenCount ( ) , 0 ) ; int nrad = container . getConnectedSingleElectronsCount ( atom ) ; if ( mass != 0 || charge != 0 || hcnt != 0 ) { return generatePeriodicSymbol ( 0 , hcnt , mass , charge , nrad , position ) ; } } return generatePseudoSymbol ( accessPseudoLabel ( pAtom , "?" ) , position ) ; } else return null ; // attach point drawn in bond generator } else { int number = unboxSafely ( atom . getAtomicNumber ( ) , Elements . ofString ( atom . getSymbol ( ) ) . number ( ) ) ; // unset the mass if it ' s the major isotope ( could be an option ) Integer mass = atom . getMassNumber ( ) ; if ( number != 0 && mass != null && model != null && model . get ( StandardGenerator . OmitMajorIsotopes . class ) && isMajorIsotope ( number , mass ) ) { mass = null ; } return generatePeriodicSymbol ( number , unboxSafely ( atom . getImplicitHydrogenCount ( ) , 0 ) , unboxSafely ( mass , - 1 ) , unboxSafely ( atom . getFormalCharge ( ) , 0 ) , container . getConnectedSingleElectronsCount ( atom ) , position ) ; }
public class Ifc2x3tc1PackageImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public EClass getIfcExtendedMaterialProperties ( ) { } }
if ( ifcExtendedMaterialPropertiesEClass == null ) { ifcExtendedMaterialPropertiesEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc2x3tc1Package . eNS_URI ) . getEClassifiers ( ) . get ( 213 ) ; } return ifcExtendedMaterialPropertiesEClass ;
public class ParserUtils { /** * Returns an ArrayList of items in a delimited string . If there is no * qualifier around the text , the qualifier parameter can be left null , or * empty . There should not be any line breaks in the string . Each line of * the file should be passed in individually . * Elements which are not qualified will have leading and trailing white * space removed . This includes unqualified elements , which may be * contained in an unqualified parse : " data " , data , " data " * Special thanks to Benoit for contributing this much improved speedy parser : 0) * @ author Benoit Xhenseval * @ param line - * String of data to be parsed * @ param delimiter - * Delimiter separating each element * @ param qualifier - * qualifier which is surrounding the text * @ param initialSize - * initial capacity of the List size * @ param preserveLeadingWhitespace * Keep any leading spaces * @ param preserveTrailingWhitespace * Keep any trailing spaces * @ return List */ public static List < String > splitLine ( final String line , final char delimiter , final char qualifier , final int initialSize , final boolean preserveLeadingWhitespace , final boolean preserveTrailingWhitespace ) { } }
final List < String > list = new ArrayList < > ( initialSize ) ; if ( delimiter == 0 ) { list . add ( line ) ; return list ; } else if ( line == null ) { return list ; } String trimmedLine ; if ( delimiter == '\t' || delimiter == ' ' ) { // skip the trim for these delimiters , doing the trim will mess up the parse // on empty records which contain just the delimiter trimmedLine = line ; } else { trimmedLine = line ; if ( ! preserveLeadingWhitespace ) { trimmedLine = ParserUtils . lTrim ( line ) ; } if ( ! preserveTrailingWhitespace ) { trimmedLine = ParserUtils . rTrim ( line ) ; } } final int size = trimmedLine . length ( ) ; if ( size == 0 ) { list . add ( "" ) ; return list ; } boolean insideQualifier = false ; char previousChar = 0 ; boolean blockWasInQualifier = false ; final String doubleQualifier = "" + qualifier + qualifier ; char [ ] newBlock = new char [ size ] ; int sizeSelected = 0 ; for ( int i = 0 ; i < size ; i ++ ) { final char currentChar = trimmedLine . charAt ( i ) ; if ( currentChar == '\uFEFF' ) { continue ; // skip bad char } if ( ( currentChar != delimiter || insideQualifier ) && currentChar != qualifier ) { previousChar = currentChar ; newBlock [ sizeSelected ++ ] = currentChar ; continue ; } if ( currentChar == delimiter ) { // we ' ve found the delimiter ( eg , ) if ( ! insideQualifier ) { String trimmed = String . valueOf ( newBlock , 0 , sizeSelected ) ; if ( ! blockWasInQualifier ) { if ( ! preserveLeadingWhitespace ) { trimmed = ParserUtils . lTrim ( trimmed ) ; } if ( ! preserveTrailingWhitespace ) { trimmed = ParserUtils . rTrim ( trimmed ) ; } } if ( trimmed == null || trimmed . length ( ) == 1 && ( trimmed . charAt ( 0 ) == delimiter || trimmed . charAt ( 0 ) == qualifier ) ) { list . add ( "" ) ; } else { list . add ( replace ( trimmed , doubleQualifier , String . valueOf ( qualifier ) , - 1 ) ) ; } blockWasInQualifier = false ; sizeSelected = 0 ; } } else if ( currentChar == qualifier ) { if ( ! insideQualifier && previousChar != qualifier ) { if ( previousChar == delimiter || previousChar == 0 || previousChar == ' ' ) { insideQualifier = true ; sizeSelected = 0 ; } else { newBlock [ sizeSelected ++ ] = currentChar ; } } else { if ( i + 1 < size && delimiter != ' ' ) { // this is used to allow unescaped qualifiers to be contained within the element // do not run this check is a space is being used as a delimiter // we don ' t want to trim the delimiter off // loop until we find a char that is not a space , or we reach the end of the line . int start = i + 1 ; char charToCheck = trimmedLine . charAt ( start ) ; while ( charToCheck == ' ' ) { start ++ ; if ( start == size ) { break ; } charToCheck = trimmedLine . charAt ( start ) ; } if ( charToCheck != delimiter ) { previousChar = currentChar ; newBlock [ sizeSelected ++ ] = currentChar ; continue ; } } insideQualifier = false ; blockWasInQualifier = true ; // last column ( e . g . finishes with " ) if ( i == size - 1 ) { String str = String . valueOf ( newBlock , 0 , sizeSelected ) ; str = replace ( str , doubleQualifier , String . valueOf ( qualifier ) , - 1 ) ; list . add ( str ) ; sizeSelected = 0 ; } } } previousChar = currentChar ; } if ( sizeSelected > 0 ) { String str = String . valueOf ( newBlock , 0 , sizeSelected ) ; str = replace ( str , doubleQualifier , String . valueOf ( qualifier ) , - 1 ) ; if ( blockWasInQualifier ) { if ( str . charAt ( str . length ( ) - 1 ) == qualifier ) { list . add ( str . substring ( 0 , str . length ( ) - 1 ) ) ; } else { list . add ( str ) ; } } else { String s = str ; if ( ! preserveLeadingWhitespace ) { s = ParserUtils . lTrim ( s ) ; } if ( ! preserveTrailingWhitespace ) { s = ParserUtils . rTrim ( s ) ; } list . add ( s ) ; } } else if ( trimmedLine . charAt ( size - 1 ) == delimiter ) { list . add ( "" ) ; } return list ;
public class CommandsResource { /** * This method is only used to warm up JBoss Forge so we can create a sample project on startup in a temporary directory */ public Response doExecute ( String name , ExecutionRequest executionRequest , CommandCompletePostProcessor postProcessor , UserDetails userDetails , RestUIContext uiContext ) throws Exception { } }
try ( RestUIContext context = uiContext ) { UICommand command = getCommandByName ( context , name ) ; if ( command == null ) { return Response . status ( Status . NOT_FOUND ) . build ( ) ; } List < Map < String , Object > > inputList = executionRequest . getInputList ( ) ; // lets ensure a valid targetLocation for new projects if ( Objects . equal ( PROJECT_NEW_COMMAND , name ) ) { if ( inputList . size ( ) > 0 ) { Map < String , Object > map = inputList . get ( 0 ) ; map . put ( TARGET_LOCATION_PROPERTY , projectFileSystem . getUserProjectFolderLocation ( userDetails ) ) ; } } CommandController controller = createController ( context , command ) ; configureAttributeMaps ( userDetails , controller , executionRequest ) ; ExecutionResult answer = null ; if ( controller instanceof WizardCommandController ) { WizardCommandController wizardCommandController = ( WizardCommandController ) controller ; List < WizardCommandController > controllers = new ArrayList < > ( ) ; List < CommandInputDTO > stepPropertiesList = new ArrayList < > ( ) ; List < ExecutionResult > stepResultList = new ArrayList < > ( ) ; List < ValidationResult > stepValidationList = new ArrayList < > ( ) ; controllers . add ( wizardCommandController ) ; WizardCommandController lastController = wizardCommandController ; Result lastResult = null ; int page = executionRequest . wizardStep ( ) ; int nextPage = page + 1 ; boolean canMoveToNextStep = false ; for ( Map < String , Object > inputs : inputList ) { UICommands . populateController ( inputs , lastController , getConverterFactory ( ) ) ; List < UIMessage > messages = lastController . validate ( ) ; ValidationResult stepValidation = UICommands . createValidationResult ( context , lastController , messages ) ; stepValidationList . add ( stepValidation ) ; if ( ! stepValidation . isValid ( ) ) { break ; } canMoveToNextStep = lastController . canMoveToNextStep ( ) ; boolean valid = lastController . isValid ( ) ; if ( ! canMoveToNextStep ) { if ( lastController . canExecute ( ) ) { // lets assume we can execute now LOG . info ( "About to invoked command " + name + " stepValidation: " + stepValidation + " messages: " + messages + " with " + executionRequest ) ; lastResult = lastController . execute ( ) ; LOG . debug ( "Invoked command " + name + " with " + executionRequest + " result: " + lastResult ) ; ExecutionResult stepResults = UICommands . createExecutionResult ( context , lastResult , false ) ; stepResultList . add ( stepResults ) ; break ; } else { stepValidation . addValidationError ( "Forge command failed with an internal error" ) ; LOG . warn ( "Cannot move to next step as canExecute() returns false but the validation seems to be fine!" ) ; break ; } } else if ( ! valid ) { stepValidation . addValidationError ( "Forge command is not valid but didn't report any validation errors!" ) ; LOG . warn ( "Cannot move to next step as invalid despite the validation saying otherwise" ) ; break ; } WizardCommandController nextController = lastController . next ( ) ; if ( nextController != null ) { if ( nextController == lastController ) { LOG . warn ( "No idea whats going on ;)" ) ; break ; } lastController = nextController ; lastController . initialize ( ) ; controllers . add ( lastController ) ; CommandInputDTO stepDto = UICommands . createCommandInputDTO ( context , command , lastController ) ; stepPropertiesList . add ( stepDto ) ; } else { int i = 0 ; for ( WizardCommandController stepController : controllers ) { Map < String , Object > stepControllerInputs = inputList . get ( i ++ ) ; UICommands . populateController ( stepControllerInputs , stepController , getConverterFactory ( ) ) ; lastResult = stepController . execute ( ) ; LOG . debug ( "Invoked command " + name + " with " + executionRequest + " result: " + lastResult ) ; ExecutionResult stepResults = UICommands . createExecutionResult ( context , lastResult , false ) ; stepResultList . add ( stepResults ) ; } break ; } } answer = UICommands . createExecutionResult ( context , lastResult , canMoveToNextStep ) ; WizardResultsDTO wizardResultsDTO = new WizardResultsDTO ( stepPropertiesList , stepValidationList , stepResultList ) ; answer . setWizardResults ( wizardResultsDTO ) ; } else { Map < String , Object > inputs = inputList . get ( 0 ) ; UICommands . populateController ( inputs , controller , getConverterFactory ( ) ) ; Result result = controller . execute ( ) ; LOG . debug ( "Invoked command " + name + " with " + executionRequest + " result: " + result ) ; answer = UICommands . createExecutionResult ( context , result , false ) ; } if ( answer . isCommandCompleted ( ) && postProcessor != null ) { postProcessor . firePostCompleteActions ( name , executionRequest , context , controller , answer , request ) ; } context . setCommitMessage ( ExecutionRequest . createCommitMessage ( name , executionRequest ) ) ; return Response . ok ( answer ) . build ( ) ; }
public class Package { /** * Parse package . json . * @ param file the file to parse * @ return a new Package instance for the specified file * @ throws IOException if an error occurs */ public static Package parse ( File file ) throws IOException { } }
ObjectMapper mapper = new ObjectMapper ( ) ; return mapper . readValue ( file , Package . class ) ;
public class SiftsXMLParser { /** * I take a xml element and the tag name , look for the tag and get * the text content * i . e for < employee > < name > John < / name > < / employee > xml snippet if * the Element points to employee node and tagName is ' name ' I will return John */ @ SuppressWarnings ( "unused" ) private String getTextValue ( Element ele , String tagName ) { } }
String textVal = null ; NodeList nl = ele . getElementsByTagName ( tagName ) ; if ( nl != null && nl . getLength ( ) > 0 ) { Element el = ( Element ) nl . item ( 0 ) ; textVal = el . getFirstChild ( ) . getNodeValue ( ) ; } return textVal ;
public class AbstractFuture { /** * { @ inheritDoc } * < p > The default { @ link AbstractFuture } implementation throws { @ code InterruptedException } if the * current thread is interrupted before or during the call , even if the value is already * available . * @ throws InterruptedException if the current thread was interrupted before or during the call * ( optional but recommended ) . * @ throws CancellationException { @ inheritDoc } */ @ CanIgnoreReturnValue @ Override public V get ( long timeout , TimeUnit unit ) throws InterruptedException , TimeoutException , ExecutionException { } }
// NOTE : if timeout < 0 , remainingNanos will be < 0 and we will fall into the while ( true ) loop // at the bottom and throw a timeoutexception . long remainingNanos = unit . toNanos ( timeout ) ; // we rely on the implicit null check on unit . if ( Thread . interrupted ( ) ) { throw new InterruptedException ( ) ; } Object localValue = value ; if ( localValue != null & ! ( localValue instanceof AbstractFuture . SetFuture ) ) { return getDoneValue ( localValue ) ; } // we delay calling nanoTime until we know we will need to either park or spin final long endNanos = remainingNanos > 0 ? System . nanoTime ( ) + remainingNanos : 0 ; long_wait_loop : if ( remainingNanos >= SPIN_THRESHOLD_NANOS ) { Waiter oldHead = waiters ; if ( oldHead != Waiter . TOMBSTONE ) { Waiter node = new Waiter ( ) ; do { node . setNext ( oldHead ) ; if ( ATOMIC_HELPER . casWaiters ( this , oldHead , node ) ) { while ( true ) { LockSupport . parkNanos ( this , remainingNanos ) ; // Check interruption first , if we woke up due to interruption we need to honor that . if ( Thread . interrupted ( ) ) { removeWaiter ( node ) ; throw new InterruptedException ( ) ; } // Otherwise re - read and check doneness . If we loop then it must have been a spurious // wakeup localValue = value ; if ( localValue != null & ! ( localValue instanceof AbstractFuture . SetFuture ) ) { return getDoneValue ( localValue ) ; } // timed out ? remainingNanos = endNanos - System . nanoTime ( ) ; if ( remainingNanos < SPIN_THRESHOLD_NANOS ) { // Remove the waiter , one way or another we are done parking this thread . removeWaiter ( node ) ; break long_wait_loop ; // jump down to the busy wait loop } } } oldHead = waiters ; // re - read and loop . } while ( oldHead != Waiter . TOMBSTONE ) ; } // re - read value , if we get here then we must have observed a TOMBSTONE while trying to add a // waiter . return getDoneValue ( value ) ; } // If we get here then we have remainingNanos < SPIN _ THRESHOLD _ NANOS and there is no node on the // waiters list while ( remainingNanos > 0 ) { localValue = value ; if ( localValue != null & ! ( localValue instanceof AbstractFuture . SetFuture ) ) { return getDoneValue ( localValue ) ; } if ( Thread . interrupted ( ) ) { throw new InterruptedException ( ) ; } remainingNanos = endNanos - System . nanoTime ( ) ; } throw new TimeoutException ( ) ;
public class EConv { /** * / * rb _ trans _ conv */ private EConvResult transConv ( byte [ ] in , Ptr inPtr , int inStop , byte [ ] out , Ptr outPtr , int outStop , int flags , Ptr resultPositionPtr ) { } }
// null check if ( elements [ 0 ] . lastResult == EConvResult . AfterOutput ) elements [ 0 ] . lastResult = EConvResult . SourceBufferEmpty ; for ( int i = numTranscoders - 1 ; 0 <= i ; i -- ) { switch ( elements [ i ] . lastResult ) { case InvalidByteSequence : case IncompleteInput : case UndefinedConversion : case AfterOutput : case Finished : return transConvNeedReport ( in , inPtr , inStop , out , outPtr , outStop , flags , resultPositionPtr , i + 1 , i ) ; case DestinationBufferFull : case SourceBufferEmpty : break ; default : throw new InternalException ( "unexpected transcode last result" ) ; } } /* / ^ [ sd ] + $ / is confirmed . but actually / ^ s * d * $ / . */ if ( elements [ numTranscoders - 1 ] . lastResult == EConvResult . DestinationBufferFull && ( flags & AFTER_OUTPUT ) != 0 ) { EConvResult res = transConv ( NULL_STRING , Ptr . NULL , 0 , out , outPtr , outStop , ( flags & ~ AFTER_OUTPUT ) | PARTIAL_INPUT , resultPositionPtr ) ; return res . isSourceBufferEmpty ( ) ? EConvResult . AfterOutput : res ; } return transConvNeedReport ( in , inPtr , inStop , out , outPtr , outStop , flags , resultPositionPtr , 0 , - 1 ) ;
public class Mirrors { /** * { @ code true } if { @ code type } is a { @ link Provider } . */ static boolean isProvider ( TypeMirror type ) { } }
return MoreTypes . isType ( type ) && MoreTypes . isTypeOf ( Provider . class , type ) ;
public class UnicodeSet { /** * Compares UnicodeSets , in three different ways . * @ see java . lang . Comparable # compareTo ( java . lang . Object ) */ public int compareTo ( UnicodeSet o , ComparisonStyle style ) { } }
if ( style != ComparisonStyle . LEXICOGRAPHIC ) { int diff = size ( ) - o . size ( ) ; if ( diff != 0 ) { return ( diff < 0 ) == ( style == ComparisonStyle . SHORTER_FIRST ) ? - 1 : 1 ; } } int result ; for ( int i = 0 ; ; ++ i ) { if ( 0 != ( result = list [ i ] - o . list [ i ] ) ) { // if either list ran out , compare to the last string if ( list [ i ] == HIGH ) { if ( strings . isEmpty ( ) ) return 1 ; String item = strings . first ( ) ; return compare ( item , o . list [ i ] ) ; } if ( o . list [ i ] == HIGH ) { if ( o . strings . isEmpty ( ) ) return - 1 ; String item = o . strings . first ( ) ; int compareResult = compare ( item , list [ i ] ) ; return compareResult > 0 ? - 1 : compareResult < 0 ? 1 : 0 ; // Reverse the order . } // otherwise return the result if even index , or the reversal if not return ( i & 1 ) == 0 ? result : - result ; } if ( list [ i ] == HIGH ) { break ; } } return compare ( strings , o . strings ) ;
public class CmsGlobalConfigurationCacheEventHandler { /** * Clears the online caches . < p > */ protected void onlineCacheClear ( ) { } }
for ( CachePair cachePair : m_caches ) { try { cachePair . getOnlineCache ( ) . clear ( ) ; } catch ( Throwable e ) { LOG . error ( e . getLocalizedMessage ( ) , e ) ; } }
public class MultiMap { /** * Return the first value stored for the supplied key * @ param key The key * @ return the first value stored for the key , null if there are no values stored */ public String getFirst ( String key ) { } }
if ( key == null ) throw new IllegalArgumentException ( "Null keys not allowed." ) ; List < String > vals = map . get ( key ) ; if ( vals == null || vals . size ( ) == 0 ) return null ; return vals . get ( 0 ) ;
public class Command { /** * Extract a byte array from a CORBA Any object . * @ param in The CORBA Any object * @ return The extracted byte array * @ exception DevFailed If the Any object does not contains a data of the * waited type . * Click < a href = " . . / . . / tango _ basic / idl _ html / Tango . html # DevFailed " > here < / a > to read * < b > DevFailed < / b > exception specification */ public byte [ ] extract_DevVarCharArray ( Any in ) throws DevFailed { } }
byte [ ] data = null ; try { data = DevVarCharArrayHelper . extract ( in ) ; } catch ( BAD_OPERATION ex ) { throw_bad_type ( "DevVarCharArray" ) ; } return data ;
public class MutablePropertySources { /** * Add the given property source at a particular index in the list . */ private void addAtIndex ( int index , PropertySource < ? > propertySource ) { } }
removeIfPresent ( propertySource ) ; this . propertySourceList . add ( index , propertySource ) ;
public class JavacParser { /** * Inserts the annotations ( and possibly a new array level ) * to the left - most type in an array or nested type . * When parsing a type like { @ code @ B Outer . Inner @ A [ ] } , the * { @ code @ A } annotation should target the array itself , while * { @ code @ B } targets the nested type { @ code Outer } . * Currently the parser parses the annotation first , then * the array , and then inserts the annotation to the left - most * nested type . * When { @ code createNewLevel } is true , then a new array * level is inserted as the most inner type , and have the * annotations target it . This is useful in the case of * varargs , e . g . { @ code String @ A [ ] @ B . . . } , as the parser * first parses the type { @ code String @ A [ ] } then inserts * a new array level with { @ code @ B } annotation . */ private JCExpression insertAnnotationsToMostInner ( JCExpression type , List < JCAnnotation > annos , boolean createNewLevel ) { } }
int origEndPos = getEndPos ( type ) ; JCExpression mostInnerType = type ; JCArrayTypeTree mostInnerArrayType = null ; while ( TreeInfo . typeIn ( mostInnerType ) . hasTag ( TYPEARRAY ) ) { mostInnerArrayType = ( JCArrayTypeTree ) TreeInfo . typeIn ( mostInnerType ) ; mostInnerType = mostInnerArrayType . elemtype ; } if ( createNewLevel ) { mostInnerType = to ( F . at ( token . pos ) . TypeArray ( mostInnerType ) ) ; } JCExpression mostInnerTypeToReturn = mostInnerType ; if ( annos . nonEmpty ( ) ) { JCExpression lastToModify = mostInnerType ; while ( TreeInfo . typeIn ( mostInnerType ) . hasTag ( SELECT ) || TreeInfo . typeIn ( mostInnerType ) . hasTag ( TYPEAPPLY ) ) { while ( TreeInfo . typeIn ( mostInnerType ) . hasTag ( SELECT ) ) { lastToModify = mostInnerType ; mostInnerType = ( ( JCFieldAccess ) TreeInfo . typeIn ( mostInnerType ) ) . getExpression ( ) ; } while ( TreeInfo . typeIn ( mostInnerType ) . hasTag ( TYPEAPPLY ) ) { lastToModify = mostInnerType ; mostInnerType = ( ( JCTypeApply ) TreeInfo . typeIn ( mostInnerType ) ) . clazz ; } } mostInnerType = F . at ( annos . head . pos ) . AnnotatedType ( annos , mostInnerType ) ; if ( TreeInfo . typeIn ( lastToModify ) . hasTag ( TYPEAPPLY ) ) { ( ( JCTypeApply ) TreeInfo . typeIn ( lastToModify ) ) . clazz = mostInnerType ; } else if ( TreeInfo . typeIn ( lastToModify ) . hasTag ( SELECT ) ) { ( ( JCFieldAccess ) TreeInfo . typeIn ( lastToModify ) ) . selected = mostInnerType ; } else { // We never saw a SELECT or TYPEAPPLY , return the annotated type . mostInnerTypeToReturn = mostInnerType ; } } if ( mostInnerArrayType == null ) { return mostInnerTypeToReturn ; } else { mostInnerArrayType . elemtype = mostInnerTypeToReturn ; storeEnd ( type , origEndPos ) ; return type ; }
public class BuiltInCheckerSuppliers { /** * Returns a { @ link ScannerSupplier } with the { @ link BugChecker } s that are in the ENABLED lists . */ public static ScannerSupplier defaultChecks ( ) { } }
return allChecks ( ) . filter ( Predicates . or ( Predicates . in ( ENABLED_ERRORS ) , Predicates . in ( ENABLED_WARNINGS ) ) ) ;
public class DFSInputStream { /** * Get block at the specified position . Fetch it from the namenode if not * cached . * If updatePosition is true , it is required that the the method is * called inside the synchronized block , since the current block information * will be updated . * @ param offset * @ param updatePosition * @ param throwWhenNoFound * when no block found for the offset return null instead of * throwing an exception * @ return located block * @ throws IOException */ private LocatedBlock getBlockAt ( long offset , boolean updatePosition , boolean throwWhenNotFound ) throws IOException { } }
assert ( locatedBlocks != null ) : "locatedBlocks is null" ; // search cached blocks first locatedBlocks . blockLocationInfoExpiresIfNeeded ( ) ; LocatedBlock blk = locatedBlocks . getBlockContainingOffset ( offset ) ; if ( blk == null ) { // block is not cached // fetch more blocks LocatedBlocks newBlocks ; newBlocks = getLocatedBlocks ( src , offset , prefetchSize ) ; if ( newBlocks == null ) { if ( ! throwWhenNotFound ) { return null ; } throw new IOException ( "Could not find target position " + offset ) ; } locatedBlocks . insertRange ( newBlocks . getLocatedBlocks ( ) ) ; locatedBlocks . setFileLength ( newBlocks . getFileLength ( ) ) ; } blk = locatedBlocks . getBlockContainingOffset ( offset ) ; if ( blk == null ) { if ( ! throwWhenNotFound ) { return null ; } throw new IOException ( "Failed to determine location for block at " + "offset=" + offset ) ; } if ( updatePosition ) { // update current position this . pos = offset ; this . blockEnd = blk . getStartOffset ( ) + blk . getBlockSize ( ) - 1 ; this . currentBlock = blk . getBlock ( ) ; isCurrentBlockUnderConstruction = locatedBlocks . isUnderConstructionBlock ( this . currentBlock ) ; } return blk ;
public class DefaultCSRFErrorHandler { /** * Returns a { @ code FORBIDDEN } result . * @ param context the current context * @ param reason the error message * @ return a { @ code FORBIDDEN } result */ @ Override public Result onError ( Context context , String reason ) { } }
return Results . forbidden ( reason ) ;
public class NodeSetDTM { /** * Returns the previous node in the set and moves the position of the * iterator backwards in the set . * @ return The previous < code > Node < / code > in the set being iterated over , * or < code > DTM . NULL < / code > if there are no more members in that set . * @ throws DOMException * INVALID _ STATE _ ERR : Raised if this method is called after the * < code > detach < / code > method was invoked . * @ throws RuntimeException thrown if this NodeSetDTM is not of * a cached type , and hence doesn ' t know what the previous node was . */ public int previousNode ( ) { } }
if ( ! m_cacheNodes ) throw new RuntimeException ( XSLMessages . createXPATHMessage ( XPATHErrorResources . ER_NODESETDTM_CANNOT_ITERATE , null ) ) ; // " This NodeSetDTM can not iterate to a previous node ! " ) ; if ( ( m_next - 1 ) > 0 ) { m_next -- ; return this . elementAt ( m_next ) ; } else return DTM . NULL ;
public class CheapIntMap { /** * Returns the object with the specified key , null if no object exists * in the table with that key . */ public Object get ( int key ) { } }
int size = _keys . length , start = key % size ; for ( int ii = 0 ; ii < size ; ii ++ ) { int idx = ( ii + start ) % size ; if ( _keys [ idx ] == key ) { return _values [ idx ] ; } } return null ;
public class QueryBuilder { /** * Shortcut for { @ link # insertInto ( CqlIdentifier ) insertInto ( CqlIdentifier . fromCql ( table ) ) } . */ @ NonNull public static InsertInto insertInto ( @ NonNull String table ) { } }
return insertInto ( CqlIdentifier . fromCql ( table ) ) ;
public class MaskUtil { /** * Finish defining the screen mask */ public static void finishDefineMask ( ) { } }
GL . glDepthMask ( false ) ; GL . glColorMask ( true , true , true , true ) ;
public class LocatorRestServiceImpl { /** * For the given service return endpoint reference randomly selected from * list of endpoints currently registered at the service locator server . * @ param input * String encoded name of service * @ param input * List of encoded additional parameters separated by comma * @ return endpoint references or < code > null < / code > */ @ Override public W3CEndpointReference lookupEndpoint ( String arg0 , List < String > arg1 ) { } }
QName serviceName = null ; try { serviceName = QName . valueOf ( URLDecoder . decode ( arg0 , "UTF-8" ) ) ; } catch ( UnsupportedEncodingException e1 ) { throw new WebApplicationException ( Response . status ( Status . INTERNAL_SERVER_ERROR ) . entity ( "Error during decoding serviceName" ) . build ( ) ) ; } List < String > names = null ; String adress = null ; SLPropertiesMatcher matcher = null ; try { matcher = createMatcher ( arg1 ) ; } catch ( UnsupportedEncodingException e1 ) { throw new WebApplicationException ( Response . status ( Status . INTERNAL_SERVER_ERROR ) . entity ( "Error during decoding serviceName" ) . build ( ) ) ; } try { initLocator ( ) ; if ( matcher == null ) { names = locatorClient . lookup ( serviceName ) ; } else { names = locatorClient . lookup ( serviceName , matcher ) ; } } catch ( ServiceLocatorException e ) { throw new WebApplicationException ( Response . status ( Status . INTERNAL_SERVER_ERROR ) . entity ( e . getMessage ( ) ) . build ( ) ) ; } catch ( InterruptedException e ) { throw new WebApplicationException ( Response . status ( Status . INTERNAL_SERVER_ERROR ) . entity ( e . getMessage ( ) ) . build ( ) ) ; } if ( names != null && ! names . isEmpty ( ) ) { names = getRotatedList ( names ) ; adress = names . get ( 0 ) ; } else { if ( LOG . isLoggable ( Level . WARNING ) ) { LOG . log ( Level . WARNING , "lookup Endpoint for " + serviceName + " failed, service is not known." ) ; } throw new WebApplicationException ( Response . status ( Status . NOT_FOUND ) . entity ( "lookup Endpoint for " + serviceName + " failed, service is not known." ) . build ( ) ) ; } return buildEndpoint ( serviceName , adress ) ;
public class ModifyDBInstanceRequest { /** * A list of EC2 VPC security groups to authorize on this DB instance . This change is asynchronously applied as soon * as possible . * Not applicable . The associated list of EC2 VPC security groups is managed by the DB cluster . For more * information , see < a > ModifyDBCluster < / a > . * Constraints : * < ul > * < li > * If supplied , must match existing VpcSecurityGroupIds . * < / li > * < / ul > * < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use * { @ link # setVpcSecurityGroupIds ( java . util . Collection ) } or { @ link # withVpcSecurityGroupIds ( java . util . Collection ) } * if you want to override the existing values . * @ param vpcSecurityGroupIds * A list of EC2 VPC security groups to authorize on this DB instance . This change is asynchronously applied * as soon as possible . < / p > * Not applicable . The associated list of EC2 VPC security groups is managed by the DB cluster . For more * information , see < a > ModifyDBCluster < / a > . * Constraints : * < ul > * < li > * If supplied , must match existing VpcSecurityGroupIds . * < / li > * @ return Returns a reference to this object so that method calls can be chained together . */ public ModifyDBInstanceRequest withVpcSecurityGroupIds ( String ... vpcSecurityGroupIds ) { } }
if ( this . vpcSecurityGroupIds == null ) { setVpcSecurityGroupIds ( new java . util . ArrayList < String > ( vpcSecurityGroupIds . length ) ) ; } for ( String ele : vpcSecurityGroupIds ) { this . vpcSecurityGroupIds . add ( ele ) ; } return this ;
public class ECKey { /** * Compute the encoded X , Y coordinates of a public point . * This is the encoded public key without the leading byte . * @ param pubPoint * a public point * @ return 64 - byte X , Y point pair */ public static byte [ ] pubBytesWithoutFormat ( ECPoint pubPoint ) { } }
final byte [ ] pubBytes = pubPoint . getEncoded ( /* uncompressed */ false ) ; return Arrays . copyOfRange ( pubBytes , 1 , pubBytes . length ) ;
public class EnvelopeServerHandler { /** * Performs a single method invocation . * @ param method the method to invoke * @ param payload the serialized parameter received from the client * @ param requestId the unique identifier of the request * @ param channel the channel to use for responding to the client * @ param < I > the type of the method ' s parameter * @ param < O > the return type of the method */ private < I extends Message , O extends Message > void invoke ( ServerMethod < I , O > method , ByteString payload , long requestId , Channel channel ) { } }
FutureCallback < O > callback = new ServerMethodCallback < > ( method , requestId , channel ) ; try { I request = method . inputParser ( ) . parseFrom ( payload ) ; ListenableFuture < O > result = method . invoke ( request ) ; pendingRequests . put ( requestId , result ) ; Futures . addCallback ( result , callback , responseCallbackExecutor ) ; } catch ( InvalidProtocolBufferException ipbe ) { callback . onFailure ( ipbe ) ; }
public class JsonStreamWriter { /** * Write a long attribute . * @ param name attribute name * @ param value attribute value */ public void writeNameValuePair ( String name , long value ) throws IOException { } }
internalWriteNameValuePair ( name , Long . toString ( value ) ) ;
public class IDBasedSubsetTabuMemory { /** * Registers an applied subset move by storing all involved IDs ( added or deleted ) in the tabu memory . It is required * that the given move is of type { @ link SubsetMove } , else an { @ link IncompatibleTabuMemoryException } will be thrown . * The argument < code > visitedSolution < / code > is ignored , as the applied move contains all necessary information , and * may be < code > null < / code > . If < code > appliedMove < / code > is < code > null < / code > , calling this method does not have any * effect . * @ param visitedSolution newly visited solution ( not used here , allowed be < code > null < / code > ) * @ param appliedMove applied move of which all involved IDs are stored in the tabu memory * @ throws IncompatibleTabuMemoryException if the given move is not of type { @ link SubsetMove } */ @ Override public void registerVisitedSolution ( SubsetSolution visitedSolution , Move < ? super SubsetSolution > appliedMove ) { } }
// don ' t do anything if move is null if ( appliedMove != null ) { // check move type if ( appliedMove instanceof SubsetMove ) { // cast SubsetMove sMove = ( SubsetMove ) appliedMove ; // store involved IDs memory . addAll ( sMove . getAddedIDs ( ) ) ; memory . addAll ( sMove . getDeletedIDs ( ) ) ; } else { // wrong move type throw new IncompatibleTabuMemoryException ( "ID based subset tabu memory can only be used in combination with " + "neighbourhoods that generate moves of type SubsetMove. Received: " + appliedMove . getClass ( ) . getName ( ) ) ; } }
public class ExtendedListeningPoint { /** * Create a Via Header based on the host , port and transport of this listening point * @ param usePublicAddress if true , the host will be the global ip address found by STUN otherwise * it will be the local network interface ipaddress * @ param branch the branch id to use * @ return the via header */ public ViaHeader createViaHeader ( String branch , boolean usePublicAddress ) { } }
try { String host = getIpAddress ( usePublicAddress ) ; ViaHeader via = SipFactoryImpl . headerFactory . createViaHeader ( host , port , transport , branch ) ; return via ; } catch ( ParseException ex ) { logger . error ( "Unexpected error while creating a via header" , ex ) ; throw new IllegalArgumentException ( "Unexpected exception when creating via header " , ex ) ; } catch ( InvalidArgumentException e ) { logger . error ( "Unexpected error while creating a via header" , e ) ; throw new IllegalArgumentException ( "Unexpected exception when creating via header " , e ) ; }
public class CmsHistoryDriver { /** * Tests if a history resource does exist . < p > * @ param dbc the current database context * @ param resource the resource to test * @ param publishTag the publish tag of the resource to test * @ return < code > true < / code > if the resource already exists , < code > false < / code > otherwise * @ throws CmsDataAccessException if something goes wrong */ protected boolean internalValidateResource ( CmsDbContext dbc , CmsResource resource , int publishTag ) throws CmsDataAccessException { } }
Connection conn = null ; PreparedStatement stmt = null ; ResultSet res = null ; boolean exists = false ; try { conn = m_sqlManager . getConnection ( dbc ) ; stmt = m_sqlManager . getPreparedStatement ( conn , "C_HISTORY_EXISTS_RESOURCE" ) ; stmt . setString ( 1 , resource . getResourceId ( ) . toString ( ) ) ; stmt . setInt ( 2 , publishTag ) ; res = stmt . executeQuery ( ) ; exists = res . next ( ) ; } catch ( SQLException e ) { throw new CmsDbSqlException ( Messages . get ( ) . container ( Messages . ERR_GENERIC_SQL_1 , CmsDbSqlException . getErrorQuery ( stmt ) ) , e ) ; } finally { m_sqlManager . closeAll ( dbc , conn , stmt , res ) ; } return exists ;
public class EmbeddedCLIServiceClient { /** * / * ( non - Javadoc ) * @ see org . apache . hive . service . cli . CLIServiceClient # getFunctions ( org . apache . hive . service . cli . SessionHandle , java . lang . String ) */ @ Override public OperationHandle getFunctions ( SessionHandle sessionHandle , String catalogName , String schemaName , String functionName ) throws HiveSQLException { } }
return cliService . getFunctions ( sessionHandle , catalogName , schemaName , functionName ) ;
public class LazyObject { /** * Returns the integer value stored in this object for the given key . * @ param key the name of the field on this object * @ return an integer value * @ throws LazyException if the value for the given key was not an integer . */ public int getInt ( String key ) throws LazyException { } }
LazyNode token = getFieldToken ( key ) ; return token . getIntValue ( ) ;
public class DataContextUtils { /** * Copies the source file to a file , replacing the @ key . X @ tokens with the values from the data * context * @ param script source file path * @ param dataContext input data context * @ param framework the framework * @ param style line ending style * @ param destination destination file , or null to create a temp file * @ return the token replaced temp file , or null if an error occurs . * @ throws java . io . IOException on io error */ public static File replaceTokensInScript ( final String script , final Map < String , Map < String , String > > dataContext , final Framework framework , final ScriptfileUtils . LineEndingStyle style , final File destination ) throws IOException { } }
if ( null == script ) { throw new NullPointerException ( "script cannot be null" ) ; } // use ReplaceTokens to replace tokens within the content final Reader read = new StringReader ( script ) ; final Map < String , String > toks = flattenDataContext ( dataContext ) ; final ReplaceTokenReader replaceTokens = new ReplaceTokenReader ( read , toks :: get , true , '@' , '@' ) ; final File temp ; if ( null != destination ) { ScriptfileUtils . writeScriptFile ( null , null , replaceTokens , style , destination ) ; temp = destination ; } else { if ( null == framework ) { throw new NullPointerException ( "framework cannot be null" ) ; } temp = ScriptfileUtils . writeScriptTempfile ( framework , replaceTokens , style ) ; } ScriptfileUtils . setExecutePermissions ( temp ) ; return temp ;
public class CircuitBreakerConfiguration { /** * Initializes the CircuitBreaker registry . * @ param circuitBreakerRegistry The circuit breaker registry . */ public void initCircuitBreakerRegistry ( CircuitBreakerRegistry circuitBreakerRegistry ) { } }
circuitBreakerProperties . getBackends ( ) . forEach ( ( name , properties ) -> circuitBreakerRegistry . circuitBreaker ( name , circuitBreakerProperties . createCircuitBreakerConfig ( properties ) ) ) ;
public class JSON { /** * / * ObjectWriteContext : Tree support */ @ Override public void writeTree ( JsonGenerator g , TreeNode tree ) throws IOException { } }
if ( _treeCodec == null ) { _noTreeCodec ( "write TreeNode" ) ; } _treeCodec . writeTree ( g , tree ) ;
public class ExecutionCompletionService { /** * { @ inheritDoc CompletionService } * This future object may not be used as a NotifyingFuture . That is because * internally this class sets the listener to provide ability to add to the queue . */ public Future < V > submit ( Callable < V > task ) { } }
if ( task == null ) throw new NullPointerException ( ) ; NotifyingFuture < V > f = executor . submit ( task ) ; f . setListener ( listener ) ; return f ;
public class HistoricExternalTaskLogManager { /** * fire history events / / / / / */ public void fireExternalTaskCreatedEvent ( final ExternalTask externalTask ) { } }
if ( isHistoryEventProduced ( HistoryEventTypes . EXTERNAL_TASK_CREATE , externalTask ) ) { HistoryEventProcessor . processHistoryEvents ( new HistoryEventProcessor . HistoryEventCreator ( ) { @ Override public HistoryEvent createHistoryEvent ( HistoryEventProducer producer ) { return producer . createHistoricExternalTaskLogCreatedEvt ( externalTask ) ; } } ) ; }
public class CmsMultiDialog { /** * Sets the title of the dialog depending on the operation type , multiple or single operation . < p > * @ param singleKey the key for the single operation * @ param multiKey the key for the multiple operation */ public void setDialogTitle ( String singleKey , String multiKey ) { } }
if ( isMultiOperation ( ) ) { // generate title with number of selected resources and parent folder parameters String resCount = String . valueOf ( getResourceList ( ) . size ( ) ) ; String currentFolder = CmsResource . getFolderPath ( getSettings ( ) . getExplorerResource ( ) ) ; currentFolder = CmsStringUtil . formatResourceName ( currentFolder , 40 ) ; Object [ ] params = new Object [ ] { resCount , currentFolder } ; setParamTitle ( key ( multiKey , params ) ) ; } else { // generate title using the resource name as parameter for the key String resourceName = CmsStringUtil . formatResourceName ( getParamResource ( ) , 50 ) ; setParamTitle ( key ( singleKey , new Object [ ] { resourceName } ) ) ; }
public class CssParser { /** * With inparam token being the first token of an atrule param , create the * construct and return it . * @ return A CssConstruct , or null if fail . */ private CssConstruct handleAtRuleParam ( CssToken start , CssTokenIterator iter , CssContentHandler doc , CssErrorHandler err ) { } }
return CssConstructFactory . create ( start , iter , MATCH_SEMI_OPENBRACE , ContextRestrictions . ATRULE_PARAM ) ;
public class Ifc4PackageImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public EClass getIfcSweptDiskSolidPolygonal ( ) { } }
if ( ifcSweptDiskSolidPolygonalEClass == null ) { ifcSweptDiskSolidPolygonalEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc4Package . eNS_URI ) . getEClassifiers ( ) . get ( 687 ) ; } return ifcSweptDiskSolidPolygonalEClass ;
public class SliceUtf8 { /** * Counts the code points within UTF - 8 encoded slice up to { @ code length } . * Note : This method does not explicitly check for valid UTF - 8 , and may * return incorrect results or throw an exception for invalid UTF - 8. */ public static int countCodePoints ( Slice utf8 , int offset , int length ) { } }
checkPositionIndexes ( offset , offset + length , utf8 . length ( ) ) ; // Quick exit if empty string if ( length == 0 ) { return 0 ; } int continuationBytesCount = 0 ; // Length rounded to 8 bytes int length8 = length & 0x7FFF_FFF8 ; for ( ; offset < length8 ; offset += 8 ) { // Count bytes which are NOT the start of a code point continuationBytesCount += countContinuationBytes ( utf8 . getLongUnchecked ( offset ) ) ; } // Enough bytes left for 32 bits ? if ( offset + 4 < length ) { // Count bytes which are NOT the start of a code point continuationBytesCount += countContinuationBytes ( utf8 . getIntUnchecked ( offset ) ) ; offset += 4 ; } // Do the rest one by one for ( ; offset < length ; offset ++ ) { // Count bytes which are NOT the start of a code point continuationBytesCount += countContinuationBytes ( utf8 . getByteUnchecked ( offset ) ) ; } verify ( continuationBytesCount <= length ) ; return length - continuationBytesCount ;
public class SARLLabelProvider { /** * Replies the image for the given element . * < p > This function is a Xtext dispatch function for { @ link # imageDescriptor ( Object ) } . * @ param element the element . * @ return the image descriptor . * @ see # imageDescriptor ( Object ) */ protected ImageDescriptor imageDescriptor ( SarlEvent element ) { } }
final JvmDeclaredType jvmElement = this . jvmModelAssociations . getInferredType ( element ) ; return this . images . forEvent ( element . getVisibility ( ) , this . adornments . get ( jvmElement ) ) ;
public class ObjectStoreDeleteOperation { /** * Calls { @ link ObjectStoreClient # delete ( String , Config ) } for the object ot be deleted * { @ inheritDoc } * @ see org . apache . gobblin . writer . objectstore . ObjectStoreOperation # execute ( org . apache . gobblin . writer . objectstore . ObjectStoreClient ) */ @ Override public DeleteResponse execute ( ObjectStoreClient objectStoreClient ) throws IOException { } }
objectStoreClient . delete ( this . objectId , this . deleteConfig ) ; return new DeleteResponse ( HttpStatus . SC_ACCEPTED ) ;
public class CmsObject { /** * Moves a resource to the given destination . < p > * A move operation in OpenCms is always a copy ( as sibling ) followed by a delete , * this is a result of the online / offline structure of the * OpenCms VFS . This way you can see the deleted files / folders in the offline * project , and you will be unable to undelete them . < p > * @ param source the name of the resource to move ( full current site relative path ) * @ param destination the destination resource name ( full current site relative path ) * @ throws CmsException if something goes wrong * @ see # renameResource ( String , String ) */ public void moveResource ( String source , String destination ) throws CmsException { } }
CmsResource resource = readResource ( source , CmsResourceFilter . IGNORE_EXPIRATION ) ; getResourceType ( resource ) . moveResource ( this , m_securityManager , resource , destination ) ;
public class DynaFormRow { /** * Adds a label with given text , colspan and rowspan . * @ param value label text * @ param colspan colspan * @ param rowspan rowspan * @ return DynaFormLabel added label */ public DynaFormLabel addLabel ( final String value , final int colspan , final int rowspan ) { } }
return addLabel ( value , true , colspan , rowspan ) ;
public class InternalSimpleExpressionsParser { /** * InternalSimpleExpressions . g : 195:1 : entryRuleAndExpression returns [ EObject current = null ] : iv _ ruleAndExpression = ruleAndExpression EOF ; */ public final EObject entryRuleAndExpression ( ) throws RecognitionException { } }
EObject current = null ; EObject iv_ruleAndExpression = null ; try { // InternalSimpleExpressions . g : 196:2 : ( iv _ ruleAndExpression = ruleAndExpression EOF ) // InternalSimpleExpressions . g : 197:2 : iv _ ruleAndExpression = ruleAndExpression EOF { newCompositeNode ( grammarAccess . getAndExpressionRule ( ) ) ; pushFollow ( FOLLOW_1 ) ; iv_ruleAndExpression = ruleAndExpression ( ) ; state . _fsp -- ; current = iv_ruleAndExpression ; match ( input , EOF , FOLLOW_2 ) ; } } catch ( RecognitionException re ) { recover ( input , re ) ; appendSkippedTokens ( ) ; } finally { } return current ;
public class Histogram { /** * Return the minimum value in the histogram . */ public Optional < Double > max ( ) { } }
if ( isEmpty ( ) ) return Optional . empty ( ) ; return Optional . of ( buckets_ . get ( buckets_ . size ( ) - 1 ) . getRange ( ) . getCeil ( ) ) ;
public class CommonOps_DDF6 { /** * < p > Performs the following operation : < br > * < br > * a = a + b < br > * a < sub > ij < / sub > = a < sub > ij < / sub > + b < sub > ij < / sub > < br > * @ param a A Matrix . Modified . * @ param b A Matrix . Not modified . */ public static void addEquals ( DMatrix6x6 a , DMatrix6x6 b ) { } }
a . a11 += b . a11 ; a . a12 += b . a12 ; a . a13 += b . a13 ; a . a14 += b . a14 ; a . a15 += b . a15 ; a . a16 += b . a16 ; a . a21 += b . a21 ; a . a22 += b . a22 ; a . a23 += b . a23 ; a . a24 += b . a24 ; a . a25 += b . a25 ; a . a26 += b . a26 ; a . a31 += b . a31 ; a . a32 += b . a32 ; a . a33 += b . a33 ; a . a34 += b . a34 ; a . a35 += b . a35 ; a . a36 += b . a36 ; a . a41 += b . a41 ; a . a42 += b . a42 ; a . a43 += b . a43 ; a . a44 += b . a44 ; a . a45 += b . a45 ; a . a46 += b . a46 ; a . a51 += b . a51 ; a . a52 += b . a52 ; a . a53 += b . a53 ; a . a54 += b . a54 ; a . a55 += b . a55 ; a . a56 += b . a56 ; a . a61 += b . a61 ; a . a62 += b . a62 ; a . a63 += b . a63 ; a . a64 += b . a64 ; a . a65 += b . a65 ; a . a66 += b . a66 ;
public class IOSDriverAdapter { /** * can set null */ public static void setAdapter ( final WebDriver driver ) { } }
AdapterContainer container = AdapterContainer . globalInstance ( ) ; container . setScreenCaptureAdapter ( new WebDriverScreenCaptureAdapter ( driver ) ) ;
public class Network { /** * unsupported */ public static JSONObject canClearBrowserCache ( ) { } }
try { JSONObject cmd = new JSONObject ( ) ; cmd . put ( "method" , "Network.canClearBrowserCache" ) ; return cmd ; } catch ( JSONException e ) { throw new WebDriverException ( e ) ; }
public class DefaultIoFuture { /** * Wait for the Future to be ready . If the requested delay is 0 or * negative , this method immediately returns the value of the * ' ready ' flag . * Every 5 second , the wait will be suspended to be able to check if * there is a deadlock or not . * @ param timeoutMillis The delay we will wait for the Future to be ready * @ param interruptable Tells if the wait can be interrupted or not * @ return < code > true < / code > if the Future is ready * @ throws InterruptedException If the thread has been interrupted * when it ' s not allowed . */ private boolean await0 ( long timeoutMillis , boolean interruptable ) throws InterruptedException { } }
long endTime = System . currentTimeMillis ( ) + timeoutMillis ; if ( endTime < 0 ) { endTime = Long . MAX_VALUE ; } synchronized ( lock ) { if ( ready ) { return ready ; } else if ( timeoutMillis <= 0 ) { return ready ; } waiters ++ ; try { for ( ; ; ) { try { long timeOut = Math . min ( timeoutMillis , DEAD_LOCK_CHECK_INTERVAL ) ; lock . wait ( timeOut ) ; } catch ( InterruptedException e ) { if ( interruptable ) { throw e ; } } if ( ready ) { return true ; } if ( endTime < System . currentTimeMillis ( ) ) { return ready ; } } } finally { waiters -- ; if ( ! ready ) { checkDeadLock ( ) ; } } }
public class MilestonesApi { /** * Get the list of merge requests associated with the specified group milestone . * @ param groupIdOrPath the group in the form of an Integer ( ID ) , String ( path ) , or Group instance * @ param milestoneId the milestone ID to get the merge requests for * @ return a list of merge requests associated with the specified milestone * @ throws GitLabApiException if any exception occurs */ public List < MergeRequest > getGroupMergeRequest ( Object groupIdOrPath , Integer milestoneId ) throws GitLabApiException { } }
Response response = get ( Response . Status . OK , getDefaultPerPageParam ( ) , "groups" , getGroupIdOrPath ( groupIdOrPath ) , "milestones" , milestoneId , "merge_requests" ) ; return ( response . readEntity ( new GenericType < List < MergeRequest > > ( ) { } ) ) ;
public class RewritableImportSection { /** * @ param typeFqn * The fully qualified name of the type to import . E . g . < code > java . util . List < / code > . May not be * < code > null < / code > . * @ param member * member name to import . May not be < code > null < / code > . For wildcard use < code > * < / code > */ public boolean addStaticImport ( final String typeFqn , final String member ) { } }
if ( typeFqn == null || member == null ) { throw new IllegalArgumentException ( "Type name " + typeFqn + ". Member name: " + member ) ; } if ( hasStaticImport ( typeFqn , member , false ) ) { return false ; } XImportDeclaration importDecl = createImport ( typeFqn , member ) ; importDecl . setStatic ( true ) ; return addedImportDeclarations . add ( importDecl ) ;
public class dnsnameserver { /** * Use this API to disable dnsnameserver of given name . */ public static base_response disable ( nitro_service client , String ip ) throws Exception { } }
dnsnameserver disableresource = new dnsnameserver ( ) ; disableresource . ip = ip ; return disableresource . perform_operation ( client , "disable" ) ;
public class EncodeTask { /** * Returns the message string of the custom encryption information . * @ param customInfoArray JSONArray which contains the list of custom encryption information . Null is not expected . */ protected String getDescription ( JSONArray customInfoArray ) { } }
StringBuffer sb = new StringBuffer ( ) ; sb . append ( getMessage ( "encode.option-custom.encryption" ) ) ; for ( int i = 0 ; i < customInfoArray . size ( ) ; i ++ ) { JSONObject customInfo = ( JSONObject ) customInfoArray . get ( i ) ; String name = ( String ) customInfo . get ( "name" ) ; sb . append ( getMessage ( "encode.option-desc.custom.feature" , name ) ) ; sb . append ( ( String ) customInfo . get ( "featurename" ) ) ; sb . append ( getMessage ( "encode.option-desc.custom.description" , name ) ) ; sb . append ( ( String ) customInfo . get ( "description" ) ) ; } return sb . toString ( ) ;
public class MyfacesLogger { /** * Find or create a logger for a named subsystem . If a logger has * already been created with the given name it is returned . Otherwise * a new logger is created . * If a new logger is created its log level will be configured * based on the LogManager and it will configured to also send logging * output to its parent loggers Handlers . It will be registered in * the LogManager global namespace . * If the named Logger already exists and does not yet have a * localization resource bundle then the given resource bundle * name is used . If the named Logger already exists and has * a different resource bundle name then an IllegalArgumentException * is thrown . * @ param name A name for the logger . This should * be a dot - separated name and should normally * be based on the package name or class name * of the subsystem , such as java . net * or javax . swing * @ param resourceBundleName name of ResourceBundle to be used for localizing * messages for this logger . * @ return a suitable Logger * @ throws MissingResourceException if the named ResourceBundle cannot be found . * @ throws IllegalArgumentException if the Logger already exists and uses * a different resource bundle name . */ private static MyfacesLogger createMyfacesLogger ( String name , String resourceBundleName ) { } }
if ( name == null ) { throw new IllegalArgumentException ( _LOG . getMessage ( "LOGGER_NAME_REQUIRED" ) ) ; } Logger log = Logger . getLogger ( name , resourceBundleName ) ; return new MyfacesLogger ( log ) ;
public class RandomUtil { /** * Picks a random object from the supplied iterator ( which must iterate over exactly * < code > count < / code > objects using the given Random . * @ param r the random number generator to use . * @ return a randomly selected item . * @ exception NoSuchElementException thrown if the iterator provides fewer than * < code > count < / code > elements . */ public static < T > T pickRandom ( Iterator < T > iter , int count , Random r ) { } }
if ( count < 1 ) { throw new IllegalArgumentException ( "Must have at least one element [count=" + count + "]" ) ; } for ( int ii = 0 , ll = getInt ( count , r ) ; ii < ll ; ii ++ ) { iter . next ( ) ; } return iter . next ( ) ;
public class Bytes { /** * Lexicographically compare two arrays . * @ param buffer1 left operand * @ param buffer2 right operand * @ param offset1 Where to start comparing in the left buffer * @ param offset2 Where to start comparing in the right buffer * @ param length1 How much to compare from the left buffer * @ param length2 How much to compare from the right buffer * @ return 0 if equal , < 0 if left is less than right , etc . */ public static int compareTo ( byte [ ] buffer1 , int offset1 , int length1 , byte [ ] buffer2 , int offset2 , int length2 ) { } }
return LexicographicalComparerHolder . BEST_COMPARER . compareTo ( buffer1 , offset1 , length1 , buffer2 , offset2 , length2 ) ;
public class JsonMapper { /** * Serialize a list of objects to a JSON String . * @ param list The list of objects to serialize . */ public String serialize ( List < T > list ) throws IOException { } }
StringWriter sw = new StringWriter ( ) ; JsonGenerator jsonGenerator = LoganSquare . JSON_FACTORY . createGenerator ( sw ) ; serialize ( list , jsonGenerator ) ; jsonGenerator . close ( ) ; return sw . toString ( ) ;
public class Lexicon { /** * returns the position of a given tokenform or - 1 if the tokenform is * unknown or has been filtered out * @ param tokenForm * @ return */ public int getIndex ( String tokenForm ) { } }
// tokenForm = tokenForm . replaceAll ( " \ \ W + " , " _ " ) ; int [ ] index = ( int [ ] ) tokenForm2index . get ( tokenForm ) ; if ( index == null ) return - 1 ; return index [ 0 ] ;
public class WaveData { /** * Convert the audio bytes into the stream * @ param audio _ bytes The audio byts * @ param two _ bytes _ data True if we using double byte data * @ return The byte bufer of data */ private static ByteBuffer convertAudioBytes ( byte [ ] audio_bytes , boolean two_bytes_data ) { } }
ByteBuffer dest = ByteBuffer . allocateDirect ( audio_bytes . length ) ; dest . order ( ByteOrder . nativeOrder ( ) ) ; ByteBuffer src = ByteBuffer . wrap ( audio_bytes ) ; src . order ( ByteOrder . LITTLE_ENDIAN ) ; if ( two_bytes_data ) { ShortBuffer dest_short = dest . asShortBuffer ( ) ; ShortBuffer src_short = src . asShortBuffer ( ) ; while ( src_short . hasRemaining ( ) ) dest_short . put ( src_short . get ( ) ) ; } else { while ( src . hasRemaining ( ) ) dest . put ( src . get ( ) ) ; } dest . rewind ( ) ; return dest ;
public class SlimFixtureWithMap { /** * Adds value to ( end of ) a list . * @ param value value to be stored . * @ param name name of list to extend . */ public void addValueTo ( Object value , String name ) { } }
getMapHelper ( ) . addValueToIn ( value , name , getCurrentValues ( ) ) ;
public class CmsContainerPageElementPanel { /** * Gets the editable list elements . < p > * @ return the editable list elements */ protected List < Element > getEditableElements ( ) { } }
List < Element > elems = CmsDomUtil . getElementsByClass ( CmsGwtConstants . CLASS_EDITABLE , Tag . div , getElement ( ) ) ; List < Element > result = Lists . newArrayList ( ) ; for ( Element currentElem : elems ) { // don ' t return elements which are contained in nested containers if ( m_parent . getContainerId ( ) . equals ( getParentContainerId ( currentElem ) ) ) { result . add ( currentElem ) ; } } return result ;
public class SQLTemplatesRegistry { /** * Get a SQLTemplates . Builder instance that matches best the SQL engine of the * given database metadata * @ param md database metadata * @ return templates * @ throws SQLException */ public SQLTemplates . Builder getBuilder ( DatabaseMetaData md ) throws SQLException { } }
String name = md . getDatabaseProductName ( ) . toLowerCase ( ) ; if ( name . equals ( "cubrid" ) ) { return CUBRIDTemplates . builder ( ) ; } else if ( name . equals ( "apache derby" ) ) { return DerbyTemplates . builder ( ) ; } else if ( name . startsWith ( "firebird" ) ) { return FirebirdTemplates . builder ( ) ; } else if ( name . equals ( "h2" ) ) { return H2Templates . builder ( ) ; } else if ( name . equals ( "hsql" ) ) { return HSQLDBTemplates . builder ( ) ; } else if ( name . equals ( "mysql" ) ) { return MySQLTemplates . builder ( ) ; } else if ( name . equals ( "oracle" ) ) { return OracleTemplates . builder ( ) ; } else if ( name . equals ( "postgresql" ) ) { return PostgreSQLTemplates . builder ( ) ; } else if ( name . equals ( "sqlite" ) ) { return SQLiteTemplates . builder ( ) ; } else if ( name . startsWith ( "teradata" ) ) { return TeradataTemplates . builder ( ) ; } else if ( name . equals ( "microsoft sql server" ) ) { switch ( md . getDatabaseMajorVersion ( ) ) { case 13 : case 12 : case 11 : return SQLServer2012Templates . builder ( ) ; case 10 : return SQLServer2008Templates . builder ( ) ; case 9 : return SQLServer2005Templates . builder ( ) ; default : return SQLServerTemplates . builder ( ) ; } } else { return new SQLTemplates . Builder ( ) { @ Override protected SQLTemplates build ( char escape , boolean quote ) { return new SQLTemplates ( Keywords . DEFAULT , "\"" , escape , quote , false ) ; } } ; }
public class DefaultVaadinSharedSecurity { /** * Returns the HTTP request bound to the current thread . */ protected HttpServletRequest getCurrentRequest ( ) { } }
final HttpServletRequest request = httpService . getCurrentRequest ( ) ; if ( request == null ) { throw new IllegalStateException ( "No HttpServletRequest bound to current thread" ) ; } return request ;
public class States { /** * merge multiple state objects in order * @ param states states * @ return */ public static StateObj state ( StateObj ... states ) { } }
MutableStateObj mutable = mutable ( ) ; for ( StateObj state : states ) { mutable . updateState ( state ) ; } return state ( mutable . getState ( ) ) ;
public class ApplicationLauncherApp { /** * Opens github page of source code up in a browser window */ private void openInGitHub ( AppInfo info ) { } }
if ( Desktop . isDesktopSupported ( ) ) { try { URI uri = new URI ( UtilIO . getGithubURL ( info . app . getPackage ( ) . getName ( ) , info . app . getSimpleName ( ) ) ) ; if ( ! uri . getPath ( ) . isEmpty ( ) ) Desktop . getDesktop ( ) . browse ( uri ) ; else System . err . println ( "Bad URL received" ) ; } catch ( Exception e1 ) { JOptionPane . showMessageDialog ( this , "Open GitHub Error" , "Error connecting: " + e1 . getMessage ( ) , JOptionPane . ERROR_MESSAGE ) ; System . err . println ( e1 . getMessage ( ) ) ; } }
public class CmsStaticExportRfsRule { /** * Checks if a vfsName matches the given related system resource patterns . < p > * @ param vfsName the vfs name of a resource to check * @ return true if the name matches one of the given related system resource patterns */ public boolean match ( String vfsName ) { } }
for ( int j = 0 ; j < m_relatedSystemResources . size ( ) ; j ++ ) { Pattern pattern = m_relatedSystemResources . get ( j ) ; if ( pattern . matcher ( vfsName ) . matches ( ) ) { return true ; } } return false ;
public class AbstractExtendedSet { /** * { @ inheritDoc } */ @ Override public ExtendedSet < T > complemented ( ) { } }
ExtendedSet < T > clone = clone ( ) ; clone . complement ( ) ; return clone ;
public class SimpleSessionManager { @ Override public < ATTRIBUTE > OptionalThing < ATTRIBUTE > getAttribute ( String key , Class < ATTRIBUTE > attributeType ) { } }
assertArgumentNotNull ( "key" , key ) ; final OptionalThing < ATTRIBUTE > foundShared = findAttributeInShareStorage ( key , attributeType ) ; if ( foundShared . isPresent ( ) ) { return foundShared ; } if ( isSuppressHttpSession ( ) ) { // needs to check because it cannot use attribute name list in message return OptionalThing . ofNullable ( null , ( ) -> { final String msg = "Not found the session attribute in shared storage by the string key: " + key ; throw new SessionAttributeNotFoundException ( msg ) ; } ) ; } final boolean withShared = true ; // automatically synchronize with shared storage return findHttpAttribute ( key , attributeType , withShared ) ;
public class SARLPreferences { /** * Replies the SARL output path in the global preferences . * @ return the output path for SARL compiler in the global preferences . */ public static IPath getGlobalSARLOutputPath ( ) { } }
final Injector injector = LangActivator . getInstance ( ) . getInjector ( LangActivator . IO_SARL_LANG_SARL ) ; final IOutputConfigurationProvider configurationProvider = injector . getInstance ( IOutputConfigurationProvider . class ) ; final OutputConfiguration config = Iterables . find ( configurationProvider . getOutputConfigurations ( ) , it -> Objects . equals ( it . getName ( ) , IFileSystemAccess . DEFAULT_OUTPUT ) ) ; if ( config != null ) { final String path = config . getOutputDirectory ( ) ; if ( ! Strings . isNullOrEmpty ( path ) ) { final IPath pathObject = Path . fromOSString ( path ) ; if ( pathObject != null ) { return pathObject ; } } } throw new IllegalStateException ( "No global preferences found for SARL." ) ; // $ NON - NLS - 1 $
public class VectorVectorMult_DDRM { /** * Performs a rank one update on matrix A using vectors u and w . The results are stored in B . < br > * < br > * B = A + & gamma ; u w < sup > T < / sup > < br > * This is called a rank1 update because the matrix u w < sup > T < / sup > has a rank of 1 . Both A and B * can be the same matrix instance , but there is a special rank1Update for that . * @ param gamma A scalar . * @ param A A m by m matrix . Not modified . * @ param u A vector with m elements . Not modified . * @ param w A vector with m elements . Not modified . * @ param B A m by m matrix where the results are stored . Modified . */ public static void rank1Update ( double gamma , DMatrixRMaj A , DMatrixRMaj u , DMatrixRMaj w , DMatrixRMaj B ) { } }
int n = u . getNumElements ( ) ; int matrixIndex = 0 ; for ( int i = 0 ; i < n ; i ++ ) { double elementU = u . data [ i ] ; for ( int j = 0 ; j < n ; j ++ , matrixIndex ++ ) { B . data [ matrixIndex ] = A . data [ matrixIndex ] + gamma * elementU * w . data [ j ] ; } }
public class ZContext { /** * Creates a new managed socket within this ZContext instance . * Use this to get automatic management of the socket at shutdown * @ param type * socket type * @ return * Newly created Socket object */ public Socket createSocket ( SocketType type ) { } }
// Create and register socket Socket socket = context . socket ( type ) ; socket . setRcvHWM ( this . rcvhwm ) ; socket . setSndHWM ( this . sndhwm ) ; sockets . add ( socket ) ; return socket ;
public class Db { /** * 创建Db * @ param ds 数据源 * @ param driverClassName 数据库连接驱动类名 * @ return Db */ public static Db use ( DataSource ds , String driverClassName ) { } }
return new Db ( ds , DialectFactory . newDialect ( driverClassName ) ) ;
public class ns_vserver_appflow_config { /** * < pre > * Performs generic data validation for the operation to be performed * < / pre > */ protected void validate ( String operationType ) throws Exception { } }
super . validate ( operationType ) ; MPSString name_validator = new MPSString ( ) ; name_validator . setConstraintMaxStrLen ( MPSConstants . GENERIC_CONSTRAINT , 255 ) ; name_validator . validate ( operationType , name , "\"name\"" ) ; MPSIPAddress ip_address_validator = new MPSIPAddress ( ) ; ip_address_validator . validate ( operationType , ip_address , "\"ip_address\"" ) ; MPSString type_validator = new MPSString ( ) ; type_validator . setConstraintMaxStrLen ( MPSConstants . GENERIC_CONSTRAINT , 64 ) ; type_validator . setConstraintMinStrLen ( MPSConstants . GENERIC_CONSTRAINT , 2 ) ; type_validator . validate ( operationType , type , "\"type\"" ) ; MPSIPAddress ns_ip_address_validator = new MPSIPAddress ( ) ; ns_ip_address_validator . validate ( operationType , ns_ip_address , "\"ns_ip_address\"" ) ; MPSString state_validator = new MPSString ( ) ; state_validator . validate ( operationType , state , "\"state\"" ) ; MPSString appflowlog_validator = new MPSString ( ) ; appflowlog_validator . validate ( operationType , appflowlog , "\"appflowlog\"" ) ; MPSString es4nslog_validator = new MPSString ( ) ; es4nslog_validator . validate ( operationType , es4nslog , "\"es4nslog\"" ) ; MPSString appflow_policy_rule_validator = new MPSString ( ) ; appflow_policy_rule_validator . validate ( operationType , appflow_policy_rule , "\"appflow_policy_rule\"" ) ; MPSString servicetype_validator = new MPSString ( ) ; servicetype_validator . validate ( operationType , servicetype , "\"servicetype\"" ) ; MPSString icalog_validator = new MPSString ( ) ; icalog_validator . validate ( operationType , icalog , "\"icalog\"" ) ;
public class CPDefinitionGroupedEntryUtil { /** * Returns all the cp definition grouped entries where uuid = & # 63 ; and companyId = & # 63 ; . * @ param uuid the uuid * @ param companyId the company ID * @ return the matching cp definition grouped entries */ public static List < CPDefinitionGroupedEntry > findByUuid_C ( String uuid , long companyId ) { } }
return getPersistence ( ) . findByUuid_C ( uuid , companyId ) ;
public class CertificateManager { /** * This method retrieves a private key from a key store . * @ param keyStore The key store containing the private key . * @ param keyName The name ( alias ) of the private key . * @ param password The password used to encrypt the private key . * @ return The decrypted private key . */ public final PrivateKey retrievePrivateKey ( KeyStore keyStore , String keyName , char [ ] password ) { } }
try { logger . entry ( ) ; PrivateKey privateKey = ( PrivateKey ) keyStore . getKey ( keyName , password ) ; logger . exit ( ) ; return privateKey ; } catch ( KeyStoreException | NoSuchAlgorithmException | UnrecoverableKeyException e ) { RuntimeException exception = new RuntimeException ( "An unexpected exception occurred while attempting to retrieve a private key." , e ) ; logger . error ( exception . toString ( ) ) ; throw exception ; }
public class OgmLoader { /** * { @ inheritDoc } */ @ Override public Object load ( Serializable id , Object optionalObject , SharedSessionContractImplementor session , LockOptions lockOptions ) { } }
List results = loadEntity ( id , optionalObject , session , lockOptions , OgmLoadingContext . EMPTY_CONTEXT ) ; if ( results . size ( ) == 1 ) { return results . get ( 0 ) ; } else if ( results . size ( ) == 0 ) { return null ; } else { // in the relational mode , collection owner means cartesian product // does not make sense in OGM throw new HibernateException ( "More than one row with the given identifier was found: " + id + ", for class: " + getEntityPersisters ( ) [ 0 ] . getEntityName ( ) ) ; }
public class SimpleLabelAwareIterator { /** * This method returns next LabelledDocument from underlying iterator * @ return */ @ Override public LabelledDocument nextDocument ( ) { } }
LabelledDocument document = currentIterator . next ( ) ; for ( String label : document . getLabels ( ) ) { labels . storeLabel ( label ) ; } return document ;