idx
int64
0
41.2k
question
stringlengths
73
5.81k
target
stringlengths
5
918
11,300
public void addData ( String key , String value ) throws InvalidPackageRevisionDataException { validateDataKey ( key ) ; data . put ( key , value ) ; }
Adds additional data related to the package revision
11,301
public void addPipeline ( String groupName , PipelineConfig pipelineConfig ) { groups . addPipeline ( groupName , pipelineConfig ) ; }
when adding pipelines groups or environments we must make sure that both merged and basic scopes are updated
11,302
List < ScmMaterialConfig > getScmMaterials ( ) { List < ScmMaterialConfig > scmMaterials = new ArrayList < > ( ) ; for ( FanInNode node : nodes . values ( ) ) { if ( node . materialConfig instanceof ScmMaterialConfig ) { scmMaterials . add ( ( ScmMaterialConfig ) node . materialConfig ) ; } } return scmMaterials ; }
Used in test Only
11,303
public TaskConfigProperty addProperty ( String propertyName ) { TaskConfigProperty property = new TaskConfigProperty ( propertyName ) ; add ( property ) ; return property ; }
Adds a property to the configuration of this task .
11,304
private void populatePlaceHolderStages ( PipelineInstanceModel pipeline ) { StageInstanceModels stageHistory = pipeline . getStageHistory ( ) ; String pipelineName = pipeline . getName ( ) ; appendFollowingStagesFromConfig ( pipelineName , stageHistory ) ; }
we need placeholder stage for unscheduled stages in pipeline so we can trigger it
11,305
public String getUploadUrlOfAgent ( JobIdentifier jobIdentifier , String filePath , int attempt ) { return format ( "%s/%s/%s/%s?attempt=%d&buildId=%d" , baseRemotingURL , "remoting" , "files" , jobIdentifier . artifactLocator ( filePath ) , attempt , jobIdentifier . getBuildId ( ) ) ; }
and therefore cannot locate job correctly when it is rescheduled
11,306
public Stage rerunStage ( String pipelineName , Integer pipelineCounter , String stageName , HttpOperationResult result ) { String identifier = StringUtils . join ( Arrays . asList ( pipelineName , pipelineCounter , stageName ) , "/" ) ; HealthStateType healthStateType = HealthStateType . general ( HealthStateScope . f...
Top - level operation only ; consumes exceptions
11,307
private boolean isStageActive ( Pipeline pipeline , StageConfig nextStage ) { return stageDao . isStageActive ( pipeline . getName ( ) , CaseInsensitiveString . str ( nextStage . name ( ) ) ) ; }
this method checks if specified stage is active in all pipelines
11,308
private synchronized Stage persistStage ( Pipeline pipeline , Stage stage ) { long pipelineId = pipeline . getId ( ) ; stage . setOrderId ( resolveStageOrder ( pipelineId , stage . getName ( ) ) ) ; Stage savedStage = stageDao . save ( pipeline , stage ) ; savedStage . setIdentifier ( new StageIdentifier ( pipeline . g...
need to synchronize this method call to make sure no concurrent issues .
11,309
private Integer resolveStageOrder ( long pipelineId , String stageName ) { Integer order = getStageOrderInPipeline ( pipelineId , stageName ) ; if ( order == null ) { order = getMaxStageOrderInPipeline ( pipelineId ) + 1 ; } return order ; }
stage order in current pipeline by 1 as current stage s order
11,310
final public < T > Property with ( Option < T > option , T value ) { if ( value != null ) { options . addOrSet ( option , value ) ; } return this ; }
Adds an option
11,311
public Property get ( String key ) { for ( Property property : properties ) { if ( property . getKey ( ) . equals ( key ) ) { return property ; } } return null ; }
Gets property for a given property key
11,312
protected static boolean matchPath ( String pattern , String str , boolean isCaseSensitive ) { return SelectorUtils . matchPath ( pattern , str , isCaseSensitive ) ; }
Test whether or not a given path matches a given pattern .
11,313
public static boolean addDefaultExclude ( String s ) { if ( defaultExcludes . indexOf ( s ) == - 1 ) { defaultExcludes . add ( s ) ; return true ; } return false ; }
Add a pattern to the default excludes unless it is already a default exclude .
11,314
public static void resetDefaultExcludes ( ) { defaultExcludes = new Vector ( ) ; for ( int i = 0 ; i < DEFAULTEXCLUDES . length ; i ++ ) { defaultExcludes . add ( DEFAULTEXCLUDES [ i ] ) ; } }
Go back to the hardwired default exclude patterns .
11,315
public DirectoryScanner scan ( ) throws IllegalStateException { synchronized ( scanLock ) { if ( scanning ) { while ( scanning ) { try { scanLock . wait ( ) ; } catch ( InterruptedException e ) { continue ; } } if ( illegal != null ) { throw illegal ; } return this ; } scanning = true ; } try { synchronized ( this ) { ...
Scan for files which match at least one include pattern and don t match any exclude patterns . If there are selectors then the files must pass muster there as well . Scans under basedir if set ; otherwise the include patterns without leading wildcards specify the absolute paths of the files that may be included .
11,316
protected synchronized void clearResults ( ) { filesIncluded = new Vector ( ) ; filesNotIncluded = new Vector ( ) ; filesExcluded = new Vector ( ) ; filesDeselected = new Vector ( ) ; dirsIncluded = new Vector ( ) ; dirsNotIncluded = new Vector ( ) ; dirsExcluded = new Vector ( ) ; dirsDeselected = new Vector ( ) ; eve...
Clear the result caches for a scan .
11,317
protected void scandir ( File dir , String vpath , boolean fast ) { if ( dir == null ) { throw new RuntimeException ( "dir must not be null." ) ; } String [ ] newfiles = dir . list ( ) ; if ( newfiles == null ) { if ( ! dir . exists ( ) ) { throw new RuntimeException ( dir + " doesn't exist." ) ; } else if ( ! dir . is...
Scan the given directory for files and directories . Found files and directories are placed in their respective collections based on the matching of includes excludes and the selectors . When a directory is found it is scanned recursively .
11,318
private void accountForIncludedFile ( String name , File file ) { processIncluded ( name , file , filesIncluded , filesExcluded , filesDeselected ) ; }
Process included file .
11,319
private void accountForIncludedDir ( String name , File file , boolean fast ) { processIncluded ( name , file , dirsIncluded , dirsExcluded , dirsDeselected ) ; if ( fast && couldHoldIncluded ( name ) && ! contentsExcluded ( name ) ) { scandir ( file , name + File . separator , fast ) ; } }
Process included directory .
11,320
protected boolean isIncluded ( String name ) { ensureNonPatternSetsReady ( ) ; if ( isCaseSensitive ( ) ? includeNonPatterns . contains ( name ) : includeNonPatterns . contains ( name . toUpperCase ( ) ) ) { return true ; } for ( int i = 0 ; i < includePatterns . length ; i ++ ) { if ( matchPath ( includePatterns [ i ]...
Test whether or not a name matches against at least one include pattern .
11,321
protected boolean couldHoldIncluded ( String name ) { for ( int i = 0 ; i < includes . length ; i ++ ) { if ( matchPatternStart ( includes [ i ] , name , isCaseSensitive ( ) ) && isMorePowerfulThanExcludes ( name , includes [ i ] ) && isDeeper ( includes [ i ] , name ) ) { return true ; } } return false ; }
Test whether or not a name matches the start of at least one include pattern .
11,322
private boolean isDeeper ( String pattern , String name ) { Vector p = SelectorUtils . tokenizePath ( pattern ) ; Vector n = SelectorUtils . tokenizePath ( name ) ; return p . contains ( "**" ) || p . size ( ) > n . size ( ) ; }
Verify that a pattern specifies files deeper than the level of the specified file .
11,323
private boolean contentsExcluded ( String name ) { name = ( name . endsWith ( File . separator ) ) ? name : name + File . separator ; for ( int i = 0 ; i < excludes . length ; i ++ ) { String e = excludes [ i ] ; if ( e . endsWith ( "**" ) && SelectorUtils . matchPath ( e . substring ( 0 , e . length ( ) - 2 ) , name ,...
Test whether all contents of the specified directory must be excluded .
11,324
protected boolean isExcluded ( String name ) { ensureNonPatternSetsReady ( ) ; if ( isCaseSensitive ( ) ? excludeNonPatterns . contains ( name ) : excludeNonPatterns . contains ( name . toUpperCase ( ) ) ) { return true ; } for ( int i = 0 ; i < excludePatterns . length ; i ++ ) { if ( matchPath ( excludePatterns [ i ]...
Test whether or not a name matches against at least one exclude pattern .
11,325
public synchronized String [ ] getIncludedFiles ( ) { if ( filesIncluded == null ) { throw new IllegalStateException ( "Must call scan() first" ) ; } String [ ] files = new String [ filesIncluded . size ( ) ] ; filesIncluded . copyInto ( files ) ; Arrays . sort ( files ) ; return files ; }
Return the names of the files which matched at least one of the include patterns and none of the exclude patterns . The names are relative to the base directory .
11,326
public synchronized String [ ] getNotIncludedFiles ( ) { slowScan ( ) ; String [ ] files = new String [ filesNotIncluded . size ( ) ] ; filesNotIncluded . copyInto ( files ) ; return files ; }
Return the names of the files which matched none of the include patterns . The names are relative to the base directory . This involves performing a slow scan if one has not already been completed .
11,327
public synchronized String [ ] getExcludedFiles ( ) { slowScan ( ) ; String [ ] files = new String [ filesExcluded . size ( ) ] ; filesExcluded . copyInto ( files ) ; return files ; }
Return the names of the files which matched at least one of the include patterns and at least one of the exclude patterns . The names are relative to the base directory . This involves performing a slow scan if one has not already been completed .
11,328
public synchronized String [ ] getIncludedDirectories ( ) { if ( dirsIncluded == null ) { throw new IllegalStateException ( "Must call scan() first" ) ; } String [ ] directories = new String [ dirsIncluded . size ( ) ] ; dirsIncluded . copyInto ( directories ) ; Arrays . sort ( directories ) ; return directories ; }
Return the names of the directories which matched at least one of the include patterns and none of the exclude patterns . The names are relative to the base directory .
11,329
public synchronized String [ ] getNotIncludedDirectories ( ) { slowScan ( ) ; String [ ] directories = new String [ dirsNotIncluded . size ( ) ] ; dirsNotIncluded . copyInto ( directories ) ; return directories ; }
Return the names of the directories which matched none of the include patterns . The names are relative to the base directory . This involves performing a slow scan if one has not already been completed .
11,330
public synchronized String [ ] getExcludedDirectories ( ) { slowScan ( ) ; String [ ] directories = new String [ dirsExcluded . size ( ) ] ; dirsExcluded . copyInto ( directories ) ; return directories ; }
Return the names of the directories which matched at least one of the include patterns and at least one of the exclude patterns . The names are relative to the base directory . This involves performing a slow scan if one has not already been completed .
11,331
public synchronized void addDefaultExcludes ( ) { int excludesLength = excludes == null ? 0 : excludes . length ; String [ ] newExcludes ; newExcludes = new String [ excludesLength + defaultExcludes . size ( ) ] ; if ( excludesLength > 0 ) { System . arraycopy ( excludes , 0 , newExcludes , 0 , excludesLength ) ; } Str...
Add default exclusions to the current exclusions set .
11,332
private String [ ] list ( File file ) { String [ ] files = ( String [ ] ) fileListMap . get ( file ) ; if ( files == null ) { files = file . list ( ) ; if ( files != null ) { fileListMap . put ( file , files ) ; } } return files ; }
Return a cached result of list performed on file if available . Invokes the method and caches the result otherwise .
11,333
private synchronized void clearCaches ( ) { fileListMap . clear ( ) ; includeNonPatterns . clear ( ) ; excludeNonPatterns . clear ( ) ; includePatterns = null ; excludePatterns = null ; areNonPatternSetsReady = false ; }
Clear internal caches .
11,334
private synchronized void ensureNonPatternSetsReady ( ) { if ( ! areNonPatternSetsReady ) { includePatterns = fillNonPatternSet ( includeNonPatterns , includes ) ; excludePatterns = fillNonPatternSet ( excludeNonPatterns , excludes ) ; areNonPatternSetsReady = true ; } }
Ensure that the in|exclude &quot ; patterns&quot ; have been properly divided up .
11,335
private String deDuplicatedErrors ( List < ConfigErrors > allErrors ) { Set < String > errors = allErrors . stream ( ) . map ( ConfigErrors :: firstError ) . collect ( Collectors . toSet ( ) ) ; return StringUtils . join ( errors , "," ) ; }
Hack to remove duplicate errors . See AdminRole . addError
11,336
public Result withSuccessMessages ( String ... successMessages ) { List < String > msgList = Arrays . asList ( successMessages ) ; return withSuccessMessages ( msgList ) ; }
Creates instance of result with specified success messages
11,337
public String getMessagesForDisplay ( ) { if ( messages . isEmpty ( ) ) { return "" ; } StringBuilder stringBuilder = new StringBuilder ( ) ; for ( String message : messages ) { stringBuilder . append ( message ) ; stringBuilder . append ( "\n" ) ; } String tempStr = stringBuilder . toString ( ) ; stringBuilder . delet...
Formats the messages in the result to a suitable form so that it can be used in user interface .
11,338
private void haltIfEntityWithSameIdExists ( ElasticProfile elasticProfile ) { if ( elasticProfileService . findProfile ( elasticProfile . getId ( ) ) == null ) { return ; } elasticProfile . addError ( "id" , format ( "Elastic profile ids should be unique. Elastic profile with id '%s' already exists." , elasticProfile ....
this is done in command as well keeping it here for early return instead of failing later during config update command .
11,339
public static String createBingUrl ( String keyword , int pageIndex ) throws Exception { int first = pageIndex * 10 - 9 ; keyword = URLEncoder . encode ( keyword , "utf-8" ) ; return String . format ( "http://cn.bing.com/search?q=%s&first=%s" , keyword , first ) ; }
construct the Bing Search url by the search keyword and the pageIndex
11,340
public CrawlDatum next ( ) { int topN = getConf ( ) . getTopN ( ) ; int maxExecuteCount = getConf ( ) . getOrDefault ( Configuration . KEY_MAX_EXECUTE_COUNT , Integer . MAX_VALUE ) ; if ( topN > 0 && totalGenerate >= topN ) { return null ; } CrawlDatum datum ; while ( true ) { try { datum = nextWithoutFilter ( ) ; if (...
return null if there is no CrawlDatum to generate
11,341
@ SuppressWarnings ( "unchecked" ) public double [ ] placement3DToMatrix ( AbstractHashMapVirtualObject ifcAxis2Placement3D ) { EReference refDirectionFeature = packageMetaData . getEReference ( "IfcAxis2Placement3D" , "RefDirection" ) ; AbstractHashMapVirtualObject location = ifcAxis2Placement3D . getDirectFeature ( p...
Pretty sure this is working correctly
11,342
public static float length ( float [ ] u ) { return ( float ) Math . abs ( Math . sqrt ( ( u [ X ] * u [ X ] ) + ( u [ Y ] * u [ Y ] ) + ( u [ Z ] * u [ Z ] ) ) ) ; }
mangnatude or length
11,343
private static double getPlaneAngle ( float [ ] v1 , float [ ] v2 , float [ ] v3 , float [ ] u1 , float [ ] u2 , float [ ] u3 ) { float [ ] cross1 = Vector . crossProduct ( new float [ ] { v2 [ 0 ] - v1 [ 0 ] , v2 [ 1 ] - v1 [ 1 ] , v2 [ 2 ] - v1 [ 2 ] } , new float [ ] { v3 [ 0 ] - v1 [ 0 ] , v3 [ 1 ] - v1 [ 1 ] , v3 ...
Get the angle in radians between two planes
11,344
public void addDecomposes ( IfcObjectDefinition parent , IfcObjectDefinition ... children ) throws IfcModelInterfaceException { IfcRelAggregates ifcRelAggregates = this . create ( IfcRelAggregates . class ) ; ifcRelAggregates . setRelatingObject ( parent ) ; for ( IfcObjectDefinition child : children ) { ifcRelAggregat...
Create a decomposes relationship
11,345
public SMethod findMethod ( String methodName ) { for ( SService sService : servicesByName . values ( ) ) { SMethod method = sService . getSMethod ( methodName ) ; if ( method != null ) { return method ; } } return null ; }
Inefficient method of getting a SMethod
11,346
public void addField ( String fieldName ) throws QueryException { EReference feature = null ; for ( TypeDef typeDef : types ) { if ( typeDef . geteClass ( ) . getEStructuralFeature ( fieldName ) == null ) { throw new QueryException ( "Class \"" + typeDef . geteClass ( ) . getName ( ) + "\" does not have the field \"" +...
Add the fields _after_ adding the types because the fields will be checked against the types all types should have the given field .
11,347
public static String getNewIfcGloballyUniqueId ( ) { Guid guid = getGuidFromUncompressedString ( UUID . randomUUID ( ) . toString ( ) ) ; String shortString = getCompressedStringFromGuid ( guid ) ; return shortString ; }
Generates a new GUID and returns a compressed string representation as used for IfcGloballyUniqueId
11,348
public static Guid getGuidFromUncompressedString ( String uncompressedGuidString ) { String [ ] parts = uncompressedGuidString . split ( "-" ) ; Guid guid = new Guid ( ) ; guid . Data1 = Long . parseLong ( parts [ 0 ] , 16 ) ; guid . Data2 = Integer . parseInt ( parts [ 1 ] , 16 ) ; guid . Data3 = Integer . parseInt ( ...
Converts an uncompressed String representation in an Guid - object
11,349
public static String getCompressedStringFromGuid ( Guid guid ) { long [ ] num = new long [ 6 ] ; char [ ] [ ] str = new char [ 6 ] [ 5 ] ; int i , j , n ; String result = new String ( ) ; num [ 0 ] = ( long ) ( guid . Data1 / 16777216 ) ; num [ 1 ] = ( long ) ( guid . Data1 % 16777216 ) ; num [ 2 ] = ( long ) ( guid . ...
Converts a Guid - object into a compressed string representation of a GUID
11,350
private static boolean cv_to_64 ( long number , char [ ] code , int len ) { long act ; int iDigit , nDigits ; char [ ] result = new char [ 5 ] ; if ( len > 5 ) return false ; act = number ; nDigits = len - 1 ; for ( iDigit = 0 ; iDigit < nDigits ; iDigit ++ ) { result [ nDigits - iDigit - 1 ] = cConversionTable [ ( int...
Conversion of an integer into a number with base 64 using the table cConversionTable
11,351
private static boolean cv_from_64 ( long [ ] res , char [ ] str ) { int len , i , j , index ; for ( len = 1 ; len < 5 ; len ++ ) if ( str [ len ] == '\0' ) break ; res [ 0 ] = 0 ; for ( i = 0 ; i < len ; i ++ ) { index = - 1 ; for ( j = 0 ; j < 64 ; j ++ ) { if ( cConversionTable [ j ] == str [ i ] ) { index = j ; brea...
Calculate a numberer from the code
11,352
public static boolean getGuidFromCompressedString ( String string , Guid guid ) throws InvalidGuidException { char [ ] [ ] str = new char [ 6 ] [ 5 ] ; int len , i , j , m ; long [ ] [ ] num = new long [ 6 ] [ 1 ] ; len = string . length ( ) ; if ( len != 22 ) throw new InvalidGuidException ( string , "Length must be 2...
Reconstructs a Guid - object form an compressed String representation of a GUID
11,353
public static String getUncompressedStringFromGuid ( Guid guid ) { String result = new String ( ) ; result += String . format ( "%1$08x" , guid . Data1 ) ; result += "-" ; result += String . format ( "%1$04x" , guid . Data2 ) ; result += "-" ; result += String . format ( "%1$04x" , guid . Data3 ) ; result += "-" ; resu...
Converts a Guid - object into a uncompressed String representation of a GUID
11,354
public static String compressGuidString ( String uncompressedString ) { Guid guid = getGuidFromUncompressedString ( uncompressedString ) ; return getCompressedStringFromGuid ( guid ) ; }
Converts an uncompressed String representation of a GUID into a compressed one
11,355
public static String uncompressGuidString ( String compressedString ) throws InvalidGuidException { Guid guid = new Guid ( ) ; getGuidFromCompressedString ( compressedString , guid ) ; return getUncompressedStringFromGuid ( guid ) ; }
Converts a compressed String representation of a GUID into an uncompressed one
11,356
public void initAllLoadedPlugins ( ) throws PluginException { LOGGER . debug ( "Initializig all loaded plugins" ) ; for ( Class < ? extends Plugin > pluginClass : implementations . keySet ( ) ) { Set < PluginContext > set = implementations . get ( pluginClass ) ; for ( PluginContext pluginContext : set ) { try { plugin...
This method will initialize all the loaded plugins
11,357
public static Map < String , Object > listProperties ( IfcObject ifcObject , String propertySetName ) { Map < String , Object > result = new HashMap < > ( ) ; for ( IfcRelDefines ifcRelDefines : ifcObject . getIsDefinedBy ( ) ) { if ( ifcRelDefines instanceof IfcRelDefinesByProperties ) { IfcRelDefinesByProperties ifcR...
Lists all properties of a given IfcPopertySet that are of type IfcPropertySingleValue all values are converted to the appropriate Java type
11,358
public static void transposeM ( float [ ] mTrans , int mTransOffset , float [ ] m , int mOffset ) { for ( int i = 0 ; i < 4 ; i ++ ) { int mBase = i * 4 + mOffset ; mTrans [ i + mTransOffset ] = m [ mBase ] ; mTrans [ i + 4 + mTransOffset ] = m [ mBase + 1 ] ; mTrans [ i + 8 + mTransOffset ] = m [ mBase + 2 ] ; mTrans ...
Transposes a 4 x 4 matrix .
11,359
public static void orthoM ( float [ ] m , int mOffset , float left , float right , float bottom , float top , float near , float far ) { if ( left == right ) { throw new IllegalArgumentException ( "left == right" ) ; } if ( bottom == top ) { throw new IllegalArgumentException ( "bottom == top" ) ; } if ( near == far ) ...
Computes an orthographic projection matrix .
11,360
public static void frustumM ( float [ ] m , int offset , float left , float right , float bottom , float top , float near , float far ) { if ( left == right ) { throw new IllegalArgumentException ( "left == right" ) ; } if ( top == bottom ) { throw new IllegalArgumentException ( "top == bottom" ) ; } if ( near == far )...
Define a projection matrix in terms of six clip planes
11,361
public static void perspectiveM ( float [ ] m , int offset , float fovy , float aspect , float zNear , float zFar ) { float f = 1.0f / ( float ) Math . tan ( fovy * ( Math . PI / 360.0 ) ) ; float rangeReciprocal = 1.0f / ( zNear - zFar ) ; m [ offset + 0 ] = f / aspect ; m [ offset + 1 ] = 0.0f ; m [ offset + 2 ] = 0....
Define a projection matrix in terms of a field of view angle an aspect ratio and z clip planes
11,362
public static void setIdentityM ( float [ ] sm , int smOffset ) { for ( int i = 0 ; i < 16 ; i ++ ) { sm [ smOffset + i ] = 0 ; } for ( int i = 0 ; i < 16 ; i += 5 ) { sm [ smOffset + i ] = 1.0f ; } }
Sets matrix m to the identity matrix .
11,363
public static void scaleM ( float [ ] sm , int smOffset , float [ ] m , int mOffset , float x , float y , float z ) { for ( int i = 0 ; i < 4 ; i ++ ) { int smi = smOffset + i ; int mi = mOffset + i ; sm [ smi ] = m [ mi ] * x ; sm [ 4 + smi ] = m [ 4 + mi ] * y ; sm [ 8 + smi ] = m [ 8 + mi ] * z ; sm [ 12 + smi ] = m...
Scales matrix m by x y and z putting the result in sm
11,364
public static void translateM ( float [ ] tm , int tmOffset , float [ ] m , int mOffset , float x , float y , float z ) { for ( int i = 0 ; i < 12 ; i ++ ) { tm [ tmOffset + i ] = m [ mOffset + i ] ; } for ( int i = 0 ; i < 4 ; i ++ ) { int tmi = tmOffset + i ; int mi = mOffset + i ; tm [ 12 + tmi ] = m [ mi ] * x + m ...
Translates matrix m by x y and z putting the result in tm
11,365
public static void translateM ( float [ ] m , int mOffset , float x , float y , float z ) { for ( int i = 0 ; i < 4 ; i ++ ) { int mi = mOffset + i ; m [ 12 + mi ] += m [ mi ] * x + m [ 4 + mi ] * y + m [ 8 + mi ] * z ; } }
Translates matrix m by x y and z in place .
11,366
public static void setRotateEulerM ( float [ ] rm , int rmOffset , float x , float y , float z ) { x *= ( float ) ( Math . PI / 180.0f ) ; y *= ( float ) ( Math . PI / 180.0f ) ; z *= ( float ) ( Math . PI / 180.0f ) ; float cx = ( float ) Math . cos ( x ) ; float sx = ( float ) Math . sin ( x ) ; float cy = ( float ) ...
Converts Euler angles to a rotation matrix
11,367
public static void setLookAtM ( float [ ] rm , int rmOffset , float eyeX , float eyeY , float eyeZ , float centerX , float centerY , float centerZ , float upX , float upY , float upZ ) { float fx = centerX - eyeX ; float fy = centerY - eyeY ; float fz = centerZ - eyeZ ; float rlf = 1.0f / Matrix . length ( fx , fy , fz...
Define a viewing transformation in terms of an eye point a center of view and an up vector .
11,368
public void activateServices ( ) throws BimserverDatabaseException , BimserverLockConflictException { try ( DatabaseSession session = bimDatabase . createSession ( ) ) { IfcModelInterface allOfType = session . getAllOfType ( StorePackage . eINSTANCE . getUser ( ) , OldQuery . getDefault ( ) ) ; for ( User user : allOfT...
Load all users from the database and their configured services . Registers each service .
11,369
public static void printSizes ( Component c ) { System . out . println ( "minimumSize = " + c . getMinimumSize ( ) ) ; System . out . println ( "preferredSize = " + c . getPreferredSize ( ) ) ; System . out . println ( "maximumSize = " + c . getMaximumSize ( ) ) ; }
A debugging utility that prints to stdout the component s minimum preferred and maximum sizes .
11,370
public String toGav ( ) { if ( purl . getNamespace ( ) != null && purl . getVersion ( ) != null ) { return String . format ( "%s:%s:%s" , purl . getNamespace ( ) , purl . getName ( ) , purl . getVersion ( ) ) ; } return null ; }
Returns the GAV representation of the Package URL as utilized in gradle builds .
11,371
public static SAXParser buildSecureSaxParser ( InputStream ... schemaStream ) throws ParserConfigurationException , SAXNotRecognizedException , SAXNotSupportedException , SAXException { final SAXParserFactory factory = SAXParserFactory . newInstance ( ) ; factory . setNamespaceAware ( true ) ; factory . setValidating (...
Constructs a validating secure SAX Parser .
11,372
public static SAXParser buildSecureSaxParser ( ) throws ParserConfigurationException , SAXNotRecognizedException , SAXNotSupportedException , SAXException { final SAXParserFactory factory = SAXParserFactory . newInstance ( ) ; factory . setFeature ( "http://apache.org/xml/features/disallow-doctype-decl" , true ) ; fact...
Constructs a secure SAX Parser .
11,373
public static DocumentBuilder buildSecureDocumentBuilder ( ) throws ParserConfigurationException { final DocumentBuilderFactory factory = DocumentBuilderFactory . newInstance ( ) ; factory . setFeature ( "http://apache.org/xml/features/disallow-doctype-decl" , true ) ; factory . setFeature ( "http://xml.org/sax/feature...
Constructs a new document builder with security features enabled .
11,374
public static String getPrettyParseExceptionInfo ( SAXParseException ex ) { final StringBuilder sb = new StringBuilder ( ) ; if ( ex . getSystemId ( ) != null ) { sb . append ( "systemId=" ) . append ( ex . getSystemId ( ) ) . append ( ", " ) ; } if ( ex . getPublicId ( ) != null ) { sb . append ( "publicId=" ) . appen...
Builds a prettier exception message .
11,375
public synchronized void save ( NvdCveInfo updatedValue ) throws UpdateException { if ( updatedValue == null ) { return ; } save ( LAST_UPDATED_BASE + updatedValue . getId ( ) , String . valueOf ( updatedValue . getTimestamp ( ) ) ) ; }
Saves the last updated information to the properties file .
11,376
public synchronized void save ( String key , String value ) throws UpdateException { properties . put ( key , value ) ; cveDB . saveProperty ( key , value ) ; }
Saves the key value pair to the properties store .
11,377
public synchronized Map < String , String > getMetaData ( ) { final Map < String , String > map = new TreeMap < > ( ) ; for ( Entry < Object , Object > entry : properties . entrySet ( ) ) { final String key = ( String ) entry . getKey ( ) ; if ( ! "version" . equals ( key ) ) { if ( key . startsWith ( "NVD CVE " ) ) { ...
Returns a map of the meta data from the database properties . This primarily contains timestamps of when the NVD CVE information was last updated .
11,378
public void processProperties ( Properties properties ) { this . groupId = interpolateString ( this . groupId , properties ) ; this . artifactId = interpolateString ( this . artifactId , properties ) ; this . version = interpolateString ( this . version , properties ) ; this . description = interpolateString ( this . d...
Process the Maven properties file and interpolate all properties .
11,379
public void execute ( ) throws BuildException { populateSettings ( ) ; try ( Engine engine = new Engine ( Update . class . getClassLoader ( ) , getSettings ( ) ) ) { try { engine . doUpdates ( ) ; } catch ( UpdateException ex ) { if ( this . isFailOnError ( ) ) { throw new BuildException ( ex ) ; } log ( ex . getMessag...
Executes the update by initializing the settings downloads the NVD XML data and then processes the data storing it in the local database .
11,380
public boolean update ( Engine engine ) throws UpdateException { this . settings = engine . getSettings ( ) ; try { final CveDB db = engine . getDatabase ( ) ; final boolean autoupdate = settings . getBoolean ( Settings . KEYS . AUTO_UPDATE , true ) ; final boolean enabled = settings . getBoolean ( Settings . KEYS . UP...
Downloads the current released version number and compares it to the running engine s version number . If the released version number is newer a warning is printed recommending an upgrade .
11,381
protected boolean shouldUpdate ( final long lastChecked , final long now , final DatabaseProperties properties , String currentVersion ) throws UpdateException { final int checkRange = 30 ; if ( ! DateUtil . withinDateRange ( lastChecked , now , checkRange ) ) { LOGGER . debug ( "Checking web for new version." ) ; fina...
Determines if a new version of the dependency - check engine has been released .
11,382
protected String getCurrentReleaseVersion ( ) { HttpURLConnection conn = null ; try { final String str = settings . getString ( Settings . KEYS . ENGINE_VERSION_CHECK_URL , "http://jeremylong.github.io/DependencyCheck/current.txt" ) ; final URL url = new URL ( str ) ; final URLConnectionFactory factory = new URLConnect...
Retrieves the current released version number from the github documentation site .
11,383
public static CharArraySet getStopWords ( ) { final CharArraySet words = StopFilter . makeStopSet ( ADDITIONAL_STOP_WORDS , true ) ; words . addAll ( EnglishAnalyzer . ENGLISH_STOP_WORDS_SET ) ; return words ; }
Returns the set of stop words being used .
11,384
protected TokenStreamComponents createComponents ( String fieldName ) { final Tokenizer source = new WhitespaceTokenizer ( ) ; TokenStream stream = source ; stream = new UrlTokenizingFilter ( stream ) ; stream = new AlphaNumericFilter ( stream ) ; stream = new WordDelimiterGraphFilter ( stream , WordDelimiterGraphFilte...
Creates a the TokenStreamComponents used to analyze the stream .
11,385
private void initSSLSocketFactoryEx ( KeyManager [ ] km , TrustManager [ ] tm , SecureRandom random ) throws NoSuchAlgorithmException , KeyManagementException { sslCtxt = SSLContext . getInstance ( "TLS" ) ; sslCtxt . init ( km , tm , random ) ; protocols = getProtocolList ( ) ; }
Initializes the SSL Socket Factory Extension .
11,386
@ SuppressWarnings ( "StringSplitter" ) protected String [ ] getProtocolList ( ) { SSLSocket socket = null ; String [ ] availableProtocols = null ; final String [ ] preferredProtocols = settings . getString ( Settings . KEYS . DOWNLOADER_TLS_PROTOCOL_LIST , "TLSv1.1,TLSv1.2,TLSv1.3" ) . split ( "," ) ; try { final SSLS...
Returns the protocol list .
11,387
public Iterable < T > filter ( final Iterable < T > iterable ) { return new Iterable < T > ( ) { public Iterator < T > iterator ( ) { return filter ( iterable . iterator ( ) ) ; } } ; }
Filters a given iterable .
11,388
private boolean cpeIdentifiersMatch ( Dependency dependency1 , Dependency dependency2 ) { if ( dependency1 == null || dependency1 . getVulnerableSoftwareIdentifiers ( ) == null || dependency2 == null || dependency2 . getVulnerableSoftwareIdentifiers ( ) == null ) { return false ; } boolean matches = false ; final int c...
Returns true if the CPE identifiers in the two supplied dependencies are equal .
11,389
private boolean vulnerabilitiesMatch ( Dependency dependency1 , Dependency dependency2 ) { final Set < Vulnerability > one = dependency1 . getVulnerabilities ( ) ; final Set < Vulnerability > two = dependency2 . getVulnerabilities ( ) ; return one != null && two != null && one . size ( ) == two . size ( ) && one . cont...
Returns true if the two dependencies have the same vulnerabilities .
11,390
private boolean hasSameBasePath ( Dependency dependency1 , Dependency dependency2 ) { if ( dependency1 == null || dependency2 == null ) { return false ; } final File lFile = new File ( dependency1 . getFilePath ( ) ) ; String left = lFile . getParent ( ) ; final File rFile = new File ( dependency2 . getFilePath ( ) ) ;...
Determines if the two dependencies have the same base path .
11,391
protected boolean isCore ( Dependency left , Dependency right ) { final String leftName = left . getFileName ( ) . toLowerCase ( ) ; final String rightName = right . getFileName ( ) . toLowerCase ( ) ; final boolean returnVal ; if ( left . isVirtual ( ) && ! right . isVirtual ( ) ) { returnVal = true ; } else if ( ! le...
This is likely a very broken attempt at determining if the left dependency is the core library in comparison to the right library .
11,392
private boolean hashesMatch ( Dependency dependency1 , Dependency dependency2 ) { if ( dependency1 == null || dependency2 == null || dependency1 . getSha1sum ( ) == null || dependency2 . getSha1sum ( ) == null ) { return false ; } return dependency1 . getSha1sum ( ) . equals ( dependency2 . getSha1sum ( ) ) ; }
Compares the SHA1 hashes of two dependencies to determine if they are equal .
11,393
protected boolean isShadedJar ( Dependency dependency , Dependency nextDependency ) { if ( dependency == null || dependency . getFileName ( ) == null || nextDependency == null || nextDependency . getFileName ( ) == null || dependency . getSoftwareIdentifiers ( ) . isEmpty ( ) || nextDependency . getSoftwareIdentifiers ...
Determines if the jar is shaded and the created pom . xml identified the same CPE as the jar - if so the pom . xml dependency should be removed .
11,394
private int countChar ( String string , char c ) { int count = 0 ; final int max = string . length ( ) ; for ( int i = 0 ; i < max ; i ++ ) { if ( c == string . charAt ( i ) ) { count ++ ; } } return count ; }
Counts the number of times the character is present in the string .
11,395
private boolean ecoSystemIs ( String ecoSystem , Dependency dependency , Dependency nextDependency ) { return ecoSystem . equals ( dependency . getEcosystem ( ) ) && ecoSystem . equals ( nextDependency . getEcosystem ( ) ) ; }
Determine if the dependency ecosystem is equal in the given dependencies .
11,396
private boolean namesAreEqual ( Dependency dependency , Dependency nextDependency ) { return dependency . getName ( ) != null && dependency . getName ( ) . equals ( nextDependency . getName ( ) ) ; }
Determine if the dependency name is equal in the given dependencies .
11,397
public static boolean npmVersionsMatch ( String current , String next ) { String left = current ; String right = next ; if ( left == null || right == null ) { return false ; } if ( left . equals ( right ) || "*" . equals ( left ) || "*" . equals ( right ) ) { return true ; } if ( left . contains ( " " ) ) { if ( right ...
Determine if the dependency version is equal in the given dependencies . This method attempts to evaluate version range checks .
11,398
private static String stripLeadingNonNumeric ( String str ) { for ( int x = 0 ; x < str . length ( ) ; x ++ ) { if ( Character . isDigit ( str . codePointAt ( x ) ) ) { return str . substring ( x ) ; } } return null ; }
Strips leading non - numeric values from the start of the string . If no numbers are present this will return null .
11,399
public List < Reference > getReferences ( boolean sorted ) { final List < Reference > sortedRefs = new ArrayList < > ( this . references ) ; if ( sorted ) { Collections . sort ( sortedRefs ) ; } return sortedRefs ; }
Returns the list of references . This is primarily used within the generated reports .