idx int64 0 165k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
145,500 | private void addFoldersToSearchIn ( final List < String > folders ) { if ( null == folders ) { return ; } for ( String folder : folders ) { if ( ! CmsResource . isFolder ( folder ) ) { folder += "/" ; } m_foldersToSearchIn . add ( folder ) ; } } | Adds folders to perform the search in . |
145,501 | private void setSearchScopeFilter ( CmsObject cms ) { final List < String > searchRoots = CmsSearchUtil . computeScopeFolders ( cms , this ) ; if ( ( null != getResourceTypes ( ) ) && containsFunctionType ( getResourceTypes ( ) ) ) { searchRoots . add ( "/system/modules/" ) ; } addFoldersToSearchIn ( searchRoots ) ; } | Sets the search scope . |
145,502 | private String dbProp ( String name ) { String dbType = m_setupBean . getDatabase ( ) ; Object prop = m_setupBean . getDatabaseProperties ( ) . get ( dbType ) . get ( dbType + "." + name ) ; if ( prop == null ) { return "" ; } return prop . toString ( ) ; } | Accesses a property from the DB configuration for the selected DB . |
145,503 | protected void add ( Widget child , Element container ) { child . removeFromParent ( ) ; getChildren ( ) . add ( child ) ; DOM . appendChild ( container , child . getElement ( ) ) ; adopt ( child ) ; } | Adds a new child widget to the panel attaching its Element to the specified container Element . |
145,504 | protected int adjustIndex ( Widget child , int beforeIndex ) { checkIndexBoundsForInsertion ( beforeIndex ) ; if ( child . getParent ( ) == this ) { int idx = getWidgetIndex ( child ) ; if ( idx < beforeIndex ) { beforeIndex -- ; } } return beforeIndex ; } | Adjusts beforeIndex to account for the possibility that the given widget is already a child of this panel . |
145,505 | protected void beginDragging ( MouseDownEvent event ) { m_dragging = true ; m_windowWidth = Window . getClientWidth ( ) ; m_clientLeft = Document . get ( ) . getBodyOffsetLeft ( ) ; m_clientTop = Document . get ( ) . getBodyOffsetTop ( ) ; DOM . setCapture ( getElement ( ) ) ; m_dragStartX = event . getX ( ) ; m_dragSt... | Called on mouse down in the caption area begins the dragging loop by turning on event capture . |
145,506 | protected void endDragging ( MouseUpEvent event ) { m_dragging = false ; DOM . releaseCapture ( getElement ( ) ) ; removeStyleName ( I_CmsLayoutBundle . INSTANCE . dialogCss ( ) . dragging ( ) ) ; } | Called on mouse up in the caption area ends dragging by ending event capture . |
145,507 | public Map < String , String > getParams ( ) { Map < String , String > params = new HashMap < > ( 1 ) ; params . put ( PARAM_COLLAPSED , Boolean . TRUE . toString ( ) ) ; return params ; } | Add the option specifying if the categories should be displayed collapsed when the dialog opens . |
145,508 | public static boolean updatingIndexNecessesary ( CmsObject cms ) { setCmsOfflineProject ( cms ) ; if ( isSolrSpellcheckIndexDirectoryEmpty ( ) ) { return true ; } long dateMostRecentDictionary = getMostRecentDate ( cms ) ; long dateOldestIndexWrite = getOldestIndexDate ( cms ) ; return dateMostRecentDictionary > dateOl... | Checks whether a built of the indices is necessary . |
145,509 | private static String getSolrSpellcheckRfsPath ( ) { String sPath = OpenCms . getSystemInfo ( ) . getWebInfRfsPath ( ) ; if ( ! OpenCms . getSystemInfo ( ) . getWebInfRfsPath ( ) . endsWith ( File . separator ) ) { sPath += File . separator ; } return sPath + "solr" + File . separator + "spellcheck" + File . separator ... | Returns the path in the RFS where the Solr spellcheck files reside . |
145,510 | private static void readAndAddDocumentsFromStream ( final SolrClient client , final String lang , final InputStream is , final List < SolrInputDocument > documents , final boolean closeStream ) { final BufferedReader br = new BufferedReader ( new InputStreamReader ( is ) ) ; try { String line = br . readLine ( ) ; whil... | Parses the dictionary from an InputStream . |
145,511 | private static void setCmsOfflineProject ( CmsObject cms ) { if ( null == cms ) { return ; } final CmsRequestContext cmsContext = cms . getRequestContext ( ) ; final CmsProject cmsProject = cmsContext . getCurrentProject ( ) ; if ( cmsProject . isOnlineProject ( ) ) { CmsProject cmsOfflineProject ; try { cmsOfflineProj... | Sets the appropriate OpenCms context . |
145,512 | private String toPath ( String name , IconSize size ) { return CmsStringUtil . joinPaths ( CmsWorkplace . getSkinUri ( ) , ICON_FOLDER , "" + name . hashCode ( ) ) + size . getSuffix ( ) ; } | Transforms user name and icon size into the image path . |
145,513 | private String toRfsName ( String name , IconSize size ) { return CmsStringUtil . joinPaths ( m_cache . getRepositoryPath ( ) , "" + name . hashCode ( ) ) + size . getSuffix ( ) ; } | Transforms user name and icon size into the rfs image path . |
145,514 | private I_CmsSearchIndex getIndex ( ) { I_CmsSearchIndex index = null ; if ( isInitialCall ( ) ) { index = OpenCms . getSearchManager ( ) . getIndex ( getSettings ( ) . getUserSettings ( ) . getWorkplaceSearchIndexName ( ) ) ; } else { index = OpenCms . getSearchManager ( ) . getIndex ( getJsp ( ) . getRequest ( ) . ge... | Gets the index to use in the search . |
145,515 | public void transform ( String name , String transform ) throws Exception { File configFile = new File ( m_configDir , name ) ; File transformFile = new File ( m_xsltDir , transform ) ; try ( InputStream stream = new FileInputStream ( transformFile ) ) { StreamSource source = new StreamSource ( stream ) ; transform ( c... | Transforms a config file with an XSLT transform . |
145,516 | public void transformConfig ( ) throws Exception { List < TransformEntry > entries = readTransformEntries ( new File ( m_xsltDir , "transforms.xml" ) ) ; for ( TransformEntry entry : entries ) { transform ( entry . getConfigFile ( ) , entry . getXslt ( ) ) ; } m_isDone = true ; } | Transforms the configuration . |
145,517 | public String validationErrors ( ) { List < String > errors = new ArrayList < > ( ) ; for ( File config : getConfigFiles ( ) ) { String filename = config . getName ( ) ; try ( FileInputStream stream = new FileInputStream ( config ) ) { CmsXmlUtils . unmarshalHelper ( CmsFileUtil . readFully ( stream , false ) , new Cms... | Gets validation errors either as a JSON string or null if there are no validation errors . |
145,518 | private List < File > getConfigFiles ( ) { String [ ] filenames = { "opencms-modules.xml" , "opencms-system.xml" , "opencms-vfs.xml" , "opencms-importexport.xml" , "opencms-sites.xml" , "opencms-variables.xml" , "opencms-scheduler.xml" , "opencms-workplace.xml" , "opencms-search.xml" } ; List < File > result = new Arra... | Gets existing config files . |
145,519 | private List < TransformEntry > readTransformEntries ( File file ) throws Exception { List < TransformEntry > result = new ArrayList < > ( ) ; try ( FileInputStream fis = new FileInputStream ( file ) ) { byte [ ] data = CmsFileUtil . readFully ( fis , false ) ; Document doc = CmsXmlUtils . unmarshalHelper ( data , null... | Reads entries from transforms . xml . |
145,520 | private void transform ( File file , Source transformSource ) throws TransformerConfigurationException , IOException , SAXException , TransformerException , ParserConfigurationException { Transformer transformer = m_transformerFactory . newTransformer ( transformSource ) ; transformer . setOutputProperty ( OutputKeys .... | Transforms a single configuration file using the given transformation source . |
145,521 | public List < CmsJspNavElement > getSubNavigation ( ) { if ( m_subNavigation == null ) { if ( m_resource . isFile ( ) ) { m_subNavigation = Collections . emptyList ( ) ; } else if ( m_navContext == null ) { try { throw new Exception ( "Can not get subnavigation because navigation context is not set." ) ; } catch ( Exce... | Gets the sub - entries of the navigation entry . |
145,522 | private Map < String , String > getLocaleProperties ( ) { if ( m_localeProperties == null ) { m_localeProperties = CmsCollectionsGenericWrapper . createLazyMap ( new CmsProperty . CmsPropertyLocaleTransformer ( m_properties , m_locale ) ) ; } return m_localeProperties ; } | Helper to get locale specific properties . |
145,523 | public void setEveryWorkingDay ( final boolean isEveryWorkingDay ) { if ( m_model . isEveryWorkingDay ( ) != isEveryWorkingDay ) { removeExceptionsOnChange ( new Command ( ) { public void execute ( ) { m_model . setEveryWorkingDay ( Boolean . valueOf ( isEveryWorkingDay ) ) ; m_model . setInterval ( getPatternDefaultVa... | Set the everyWorkingDay flag . |
145,524 | private void removeListener ( CmsUUID listenerId ) { getRequest ( ) . getSession ( ) . removeAttribute ( SESSION_ATTRIBUTE_LISTENER_ID ) ; m_listeners . remove ( listenerId ) ; } | Remove the listener active in this session . |
145,525 | private Map < String , String > parseAttributes ( I_CmsXmlContentLocation formatterLoc ) { Map < String , String > result = new LinkedHashMap < > ( ) ; for ( I_CmsXmlContentValueLocation mappingLoc : formatterLoc . getSubValues ( N_ATTRIBUTE ) ) { String key = CmsConfigurationReader . getString ( m_cms , mappingLoc . g... | Parses formatter attributes . |
145,526 | public Set < String > getConfiguredWorkplaceBundles ( ) { CmsADEConfigData configData = internalLookupConfiguration ( null , null ) ; return configData . getConfiguredWorkplaceBundles ( ) ; } | Returns the names of the bundles configured as workplace bundles in any module configuration . |
145,527 | public static String removeOpenCmsContext ( final String path ) { String context = OpenCms . getSystemInfo ( ) . getOpenCmsContext ( ) ; if ( path . startsWith ( context + "/" ) ) { return path . substring ( context . length ( ) ) ; } String renderPrefix = OpenCms . getStaticExportManager ( ) . getVfsPrefix ( ) ; if ( ... | Given a path to a VFS resource the method removes the OpenCms context in case the path is prefixed by that context . |
145,528 | public String getPermalink ( CmsObject cms , String resourceName , CmsUUID detailContentId ) { String permalink = "" ; try { permalink = substituteLink ( cms , CmsPermalinkResourceHandler . PERMALINK_HANDLER ) ; String id = cms . readResource ( resourceName , CmsResourceFilter . ALL ) . getStructureId ( ) . toString ( ... | Returns the perma link for the given resource and optional detail content . <p< |
145,529 | public String getPermalinkForCurrentPage ( CmsObject cms ) { return getPermalink ( cms , cms . getRequestContext ( ) . getUri ( ) , cms . getRequestContext ( ) . getDetailContentId ( ) ) ; } | Returns the perma link for the current page based on the URI and detail content id stored in the CmsObject passed as a parameter . <p< |
145,530 | public String getWorkplaceLink ( CmsObject cms , String resourceName , boolean forceSecure ) { String result = substituteLinkForUnknownTarget ( cms , resourceName , forceSecure ) ; return appendServerPrefix ( cms , result , resourceName , true ) ; } | Returns the link for the given workplace resource . |
145,531 | private Table buildTable ( CmsSqlConsoleResults results ) { IndexedContainer container = new IndexedContainer ( ) ; int numCols = results . getColumns ( ) . size ( ) ; for ( int c = 0 ; c < numCols ; c ++ ) { container . addContainerProperty ( Integer . valueOf ( c ) , results . getColumnType ( c ) , null ) ; } int r =... | Builds the table for the database results . |
145,532 | private void updateImageInfo ( ) { String crop = getCrop ( ) ; String point = getPoint ( ) ; m_imageInfoDisplay . fillContent ( m_info , crop , point ) ; } | Updates the image information . |
145,533 | public static CmsShell getTopShell ( ) { ArrayList < CmsShell > shells = SHELL_STACK . get ( ) ; if ( shells . isEmpty ( ) ) { return null ; } return shells . get ( shells . size ( ) - 1 ) ; } | Gets the top of thread - local shell stack or null if it is empty . |
145,534 | public static void popShell ( ) { ArrayList < CmsShell > shells = SHELL_STACK . get ( ) ; if ( shells . size ( ) > 0 ) { shells . remove ( shells . size ( ) - 1 ) ; } } | Removes top of thread - local shell stack . |
145,535 | public static CmsSearchConfigurationSorting create ( final String sortParam , final List < I_CmsSearchConfigurationSortOption > options , final I_CmsSearchConfigurationSortOption defaultOption ) { return ( null != sortParam ) || ( ( null != options ) && ! options . isEmpty ( ) ) || ( null != defaultOption ) ? new CmsSe... | Creates a sort configuration iff at least one of the parameters is not null and the options list is not empty . |
145,536 | public static CmsResourceTypeStatResultList init ( CmsResourceTypeStatResultList resList ) { if ( resList == null ) { return new CmsResourceTypeStatResultList ( ) ; } resList . deleteOld ( ) ; return resList ; } | Method to initialize the list . |
145,537 | protected boolean exportWithMinimalMetaData ( String path ) { String checkPath = path . startsWith ( "/" ) ? path + "/" : "/" + path + "/" ; for ( String p : m_parameters . getResourcesToExportWithMetaData ( ) ) { if ( checkPath . startsWith ( p ) ) { return false ; } } return true ; } | Check if the resource should be exported with minimal meta - data . This holds for resources that are not part of the export but must be exported as super - folders . |
145,538 | public void setDraggable ( Element elem , String draggable ) { super . setDraggable ( elem , draggable ) ; if ( "true" . equals ( draggable ) ) { elem . getStyle ( ) . setProperty ( "webkitUserDrag" , "element" ) ; } else { elem . getStyle ( ) . clearProperty ( "webkitUserDrag" ) ; } } | Webkit based browsers require that we set the webkit - user - drag style attribute to make an element draggable . |
145,539 | protected void createParentXmlElements ( CmsXmlContent xmlContent , String xmlPath , Locale l ) { if ( CmsXmlUtils . isDeepXpath ( xmlPath ) ) { String parentPath = CmsXmlUtils . removeLastXpathElement ( xmlPath ) ; if ( null == xmlContent . getValue ( parentPath , l ) ) { createParentXmlElements ( xmlContent , parentP... | Creates the parents of nested XML elements if necessary . |
145,540 | public byte [ ] join ( Map < Integer , byte [ ] > parts ) { checkArgument ( parts . size ( ) > 0 , "No parts provided" ) ; final int [ ] lengths = parts . values ( ) . stream ( ) . mapToInt ( v -> v . length ) . distinct ( ) . toArray ( ) ; checkArgument ( lengths . length == 1 , "Varying lengths of part values" ) ; fi... | Joins the given parts to recover the original secret . |
145,541 | public static Processor < DataSinkTask > sink ( DataSink dataSink , int parallelism , String description , UserConfig taskConf , ActorSystem system ) { io . gearpump . streaming . Processor < DataSinkTask > p = DataSinkProcessor . apply ( dataSink , parallelism , description , taskConf , system ) ; return new Processor... | Creates a Sink Processor |
145,542 | public static Processor < DataSourceTask > source ( DataSource source , int parallelism , String description , UserConfig taskConf , ActorSystem system ) { io . gearpump . streaming . Processor < DataSourceTask < Object , Object > > p = DataSourceProcessor . apply ( source , parallelism , description , taskConf , syste... | Creates a Source Processor |
145,543 | public Token recoverInline ( Parser recognizer ) throws RecognitionException { Token matchedSymbol = singleTokenDeletion ( recognizer ) ; if ( matchedSymbol != null ) { recognizer . consume ( ) ; return matchedSymbol ; } if ( singleTokenInsertion ( recognizer ) ) { return getMissingSymbol ( recognizer ) ; } throw new I... | Make sure we don t attempt to recover inline ; if the parser successfully recovers it won t throw an exception . |
145,544 | protected DirectiveStatement parseDirectiveStatement ( DirectiveStContext node ) { DirectiveStContext stContext = ( DirectiveStContext ) node ; DirectiveExpContext direExp = stContext . directiveExp ( ) ; Token token = direExp . Identifier ( ) . getSymbol ( ) ; String directive = token . getText ( ) . toLowerCase ( ) .... | directive dynamic xxx yy |
145,545 | public static NamingConvention determineNamingConvention ( TypeElement type , Iterable < ExecutableElement > methods , Messager messager , Types types ) { ExecutableElement beanMethod = null ; ExecutableElement prefixlessMethod = null ; for ( ExecutableElement method : methods ) { switch ( methodNameConvention ( method... | Determine whether the user has followed bean - like naming convention or not . |
145,546 | public SourceBuilder add ( String fmt , Object ... args ) { TemplateApplier . withParams ( args ) . onText ( source :: append ) . onParam ( this :: add ) . parse ( fmt ) ; return this ; } | Appends formatted text to the source . |
145,547 | public SourceBuilder addLine ( String fmt , Object ... args ) { add ( fmt , args ) ; source . append ( LINE_SEPARATOR ) ; return this ; } | Appends a formatted line of code to the source . |
145,548 | private Map < StandardMethod , UnderrideLevel > findUnderriddenMethods ( Iterable < ExecutableElement > methods ) { Map < StandardMethod , ExecutableElement > standardMethods = new LinkedHashMap < > ( ) ; for ( ExecutableElement method : methods ) { Optional < StandardMethod > standardMethod = maybeStandardMethod ( met... | Find any standard methods the user has underridden in their type . |
145,549 | private boolean hasToBuilderMethod ( DeclaredType builder , boolean isExtensible , Iterable < ExecutableElement > methods ) { for ( ExecutableElement method : methods ) { if ( isToBuilderMethod ( builder , method ) ) { if ( ! isExtensible ) { messager . printMessage ( ERROR , "No accessible no-args Builder constructor ... | Find a toBuilder method if the user has provided one . |
145,550 | private String generatedBuilderSimpleName ( TypeElement type ) { String packageName = elements . getPackageOf ( type ) . getQualifiedName ( ) . toString ( ) ; String originalName = type . getQualifiedName ( ) . toString ( ) ; checkState ( originalName . startsWith ( packageName + "." ) ) ; String nameWithoutPackage = o... | Returns the simple name of the builder class that should be generated for the given type . |
145,551 | public static void addToString ( SourceBuilder code , Datatype datatype , Map < Property , PropertyCodeGenerator > generatorsByProperty , boolean forPartial ) { String typename = ( forPartial ? "partial " : "" ) + datatype . getType ( ) . getSimpleName ( ) ; Predicate < PropertyCodeGenerator > isOptional = generator ->... | Generates a toString method using concatenation or a StringBuilder . |
145,552 | private static void bodyWithConcatenation ( SourceBuilder code , Map < Property , PropertyCodeGenerator > generatorsByProperty , String typename ) { code . add ( " return \"%s{" , typename ) ; String prefix = "" ; for ( Property property : generatorsByProperty . keySet ( ) ) { PropertyCodeGenerator generator = generat... | Generate the body of a toString method that uses plain concatenation . |
145,553 | private static void bodyWithBuilder ( SourceBuilder code , Datatype datatype , Map < Property , PropertyCodeGenerator > generatorsByProperty , String typename , Predicate < PropertyCodeGenerator > isOptional ) { Variable result = new Variable ( "result" ) ; code . add ( " %1$s %2$s = new %1$s(\"%3$s{" , StringBuilder ... | Generates the body of a toString method that uses a StringBuilder . |
145,554 | private static void bodyWithBuilderAndSeparator ( SourceBuilder code , Datatype datatype , Map < Property , PropertyCodeGenerator > generatorsByProperty , String typename ) { Variable result = new Variable ( "result" ) ; Variable separator = new Variable ( "separator" ) ; code . addLine ( " %1$s %2$s = new %1$s(\"%3$s... | Generates the body of a toString method that uses a StringBuilder and a separator variable . |
145,555 | public static void addLazyDefinitions ( SourceBuilder code ) { Set < Declaration > defined = new HashSet < > ( ) ; List < Declaration > declarations = code . scope ( ) . keysOfType ( Declaration . class ) . stream ( ) . sorted ( ) . collect ( toList ( ) ) ; while ( ! defined . containsAll ( declarations ) ) { for ( Dec... | Finds all lazily - declared classes and methods and adds their definitions to the source . |
145,556 | public void addPartialFieldAssignment ( SourceBuilder code , Excerpt finalField , String builder ) { addFinalFieldAssignment ( code , finalField , builder ) ; } | Add the final assignment of the property to the partial value object s source code . |
145,557 | public static void addActionsTo ( SourceBuilder code , Set < MergeAction > mergeActions , boolean forBuilder ) { SetMultimap < String , String > nounsByVerb = TreeMultimap . create ( ) ; mergeActions . forEach ( mergeAction -> { if ( forBuilder || ! mergeAction . builderOnly ) { nounsByVerb . put ( mergeAction . verb ,... | Emits a sentence fragment combining all the merge actions . |
145,558 | public static Variable upcastToGeneratedBuilder ( SourceBuilder code , Datatype datatype , String builder ) { return code . scope ( ) . computeIfAbsent ( Declaration . UPCAST , ( ) -> { Variable base = new Variable ( "base" ) ; code . addLine ( UPCAST_COMMENT ) . addLine ( "%s %s = %s;" , datatype . getGeneratedBuilder... | Upcasts a Builder instance to the generated superclass to allow access to private fields . |
145,559 | public static Optional < Variable > freshBuilder ( SourceBuilder code , Datatype datatype ) { if ( ! datatype . getBuilderFactory ( ) . isPresent ( ) ) { return Optional . empty ( ) ; } return Optional . of ( code . scope ( ) . computeIfAbsent ( Declaration . FRESH_BUILDER , ( ) -> { Variable defaults = new Variable ( ... | Declares a fresh Builder to copy default property values from . |
145,560 | public JavadocLink javadocMethodLink ( String memberName , Type ... types ) { return new JavadocLink ( "%s#%s(%s)" , getQualifiedName ( ) , memberName , ( Excerpt ) code -> { String separator = "" ; for ( Type type : types ) { code . add ( "%s%s" , separator , type . getQualifiedName ( ) ) ; separator = ", " ; } } ) ; ... | Returns a source excerpt of a JavaDoc link to a method on this type . |
145,561 | public Excerpt typeParameters ( ) { if ( getTypeParameters ( ) . isEmpty ( ) ) { return Excerpts . EMPTY ; } else { return Excerpts . add ( "<%s>" , Excerpts . join ( ", " , getTypeParameters ( ) ) ) ; } } | Returns a source excerpt of the type parameters of this type including angle brackets . Always an empty string if the type class is not generic . |
145,562 | protected Violation createViolation ( Integer lineNumber , String sourceLine , String message ) { Violation violation = new Violation ( ) ; violation . setRule ( this ) ; violation . setSourceLine ( sourceLine ) ; violation . setLineNumber ( lineNumber ) ; violation . setMessage ( message ) ; return violation ; } | Create and return a new Violation for this rule and the specified values |
145,563 | protected Violation createViolation ( SourceCode sourceCode , ASTNode node , String message ) { String sourceLine = sourceCode . line ( node . getLineNumber ( ) - 1 ) ; return createViolation ( node . getLineNumber ( ) , sourceLine , message ) ; } | Create a new Violation for the AST node . |
145,564 | protected Violation createViolationForImport ( SourceCode sourceCode , ImportNode importNode , String message ) { Map importInfo = ImportUtil . sourceLineAndNumberForImport ( sourceCode , importNode ) ; Violation violation = new Violation ( ) ; violation . setRule ( this ) ; violation . setSourceLine ( ( String ) impor... | Create and return a new Violation for this rule and the specified import |
145,565 | protected Violation createViolationForImport ( SourceCode sourceCode , String className , String alias , String violationMessage ) { Map importInfo = ImportUtil . sourceLineAndNumberForImport ( sourceCode , className , alias ) ; Violation violation = new Violation ( ) ; violation . setRule ( this ) ; violation . setSou... | Create and return a new Violation for this rule and the specified import className and alias |
145,566 | protected boolean shouldApplyThisRuleTo ( ClassNode classNode ) { boolean shouldApply = true ; String applyTo = getApplyToClassNames ( ) ; String doNotApplyTo = getDoNotApplyToClassNames ( ) ; if ( applyTo != null && applyTo . length ( ) > 0 ) { WildcardPattern pattern = new WildcardPattern ( applyTo , true ) ; shouldA... | Return true if this rule should be applied for the specified ClassNode based on the configuration of this rule . |
145,567 | public Results analyze ( RuleSet ruleSet ) { long startTime = System . currentTimeMillis ( ) ; DirectoryResults reportResults = new DirectoryResults ( ) ; int numThreads = Runtime . getRuntime ( ) . availableProcessors ( ) - 1 ; numThreads = numThreads > 0 ? numThreads : 1 ; ExecutorService pool = Executors . newFixedT... | Analyze all source code using the specified RuleSet and return the report results . |
145,568 | private static boolean isPredefinedConstant ( Expression expression ) { if ( expression instanceof PropertyExpression ) { Expression object = ( ( PropertyExpression ) expression ) . getObjectExpression ( ) ; Expression property = ( ( PropertyExpression ) expression ) . getProperty ( ) ; if ( object instanceof VariableE... | Tells you if the expression is a predefined constant like TRUE or FALSE . |
145,569 | public static boolean isMapLiteralWithOnlyConstantValues ( Expression expression ) { if ( expression instanceof MapExpression ) { List < MapEntryExpression > entries = ( ( MapExpression ) expression ) . getMapEntryExpressions ( ) ; for ( MapEntryExpression entry : entries ) { if ( ! isConstantOrConstantLiteral ( entry ... | Returns true if a Map literal that contains only entries where both key and value are constants . |
145,570 | public static boolean isListLiteralWithOnlyConstantValues ( Expression expression ) { if ( expression instanceof ListExpression ) { List < Expression > expressions = ( ( ListExpression ) expression ) . getExpressions ( ) ; for ( Expression e : expressions ) { if ( ! isConstantOrConstantLiteral ( e ) ) { return false ; ... | Returns true if a List literal that contains only entries that are constants . |
145,571 | public static boolean isConstant ( Expression expression , Object expected ) { return expression instanceof ConstantExpression && expected . equals ( ( ( ConstantExpression ) expression ) . getValue ( ) ) ; } | Tells you if an expression is the expected constant . |
145,572 | public static List < ? extends Expression > getMethodArguments ( ASTNode methodCall ) { if ( methodCall instanceof ConstructorCallExpression ) { return extractExpressions ( ( ( ConstructorCallExpression ) methodCall ) . getArguments ( ) ) ; } else if ( methodCall instanceof MethodCallExpression ) { return extractExpres... | Return the List of Arguments for the specified MethodCallExpression or a ConstructorCallExpression . The returned List contains either ConstantExpression or MapEntryExpression objects . |
145,573 | public static boolean isMethodNamed ( MethodCallExpression methodCall , String methodNamePattern , Integer numArguments ) { Expression method = methodCall . getMethod ( ) ; boolean IS_NAME_MATCH = false ; if ( method instanceof ConstantExpression ) { if ( ( ( ConstantExpression ) method ) . getValue ( ) instanceof Stri... | Return true only if the MethodCallExpression represents a method call for the specified method name |
145,574 | public static boolean isConstructorCall ( Expression expression , List < String > classNames ) { return expression instanceof ConstructorCallExpression && classNames . contains ( expression . getType ( ) . getName ( ) ) ; } | Return true if the expression is a constructor call on any of the named classes with any number of parameters . |
145,575 | public static boolean isConstructorCall ( Expression expression , String classNamePattern ) { return expression instanceof ConstructorCallExpression && expression . getType ( ) . getName ( ) . matches ( classNamePattern ) ; } | Return true if the expression is a constructor call on a class that matches the supplied . |
145,576 | public static AnnotationNode getAnnotation ( AnnotatedNode node , String name ) { List < AnnotationNode > annotations = node . getAnnotations ( ) ; for ( AnnotationNode annot : annotations ) { if ( annot . getClassNode ( ) . getName ( ) . equals ( name ) ) { return annot ; } } return null ; } | Return the AnnotationNode for the named annotation or else null . Supports Groovy 1 . 5 and Groovy 1 . 6 . |
145,577 | public static boolean hasAnnotation ( AnnotatedNode node , String name ) { return AstUtil . getAnnotation ( node , name ) != null ; } | Return true only if the node has the named annotation |
145,578 | public static boolean hasAnyAnnotation ( AnnotatedNode node , String ... names ) { for ( String name : names ) { if ( hasAnnotation ( node , name ) ) { return true ; } } return false ; } | Return true only if the node has any of the named annotations |
145,579 | public static List < Expression > getVariableExpressions ( DeclarationExpression declarationExpression ) { Expression leftExpression = declarationExpression . getLeftExpression ( ) ; if ( leftExpression instanceof ArrayExpression ) { List < Expression > expressions = ( ( ArrayExpression ) leftExpression ) . getExpressi... | Return the List of VariableExpression objects referenced by the specified DeclarationExpression . |
145,580 | public static boolean isFinalVariable ( DeclarationExpression declarationExpression , SourceCode sourceCode ) { if ( isFromGeneratedSourceCode ( declarationExpression ) ) { return false ; } List < Expression > variableExpressions = getVariableExpressions ( declarationExpression ) ; if ( ! variableExpressions . isEmpty ... | Return true if the DeclarationExpression represents a final variable declaration . |
145,581 | public static boolean isTrue ( Expression expression ) { if ( expression == null ) { return false ; } if ( expression instanceof PropertyExpression && classNodeImplementsType ( ( ( PropertyExpression ) expression ) . getObjectExpression ( ) . getType ( ) , Boolean . class ) ) { if ( ( ( PropertyExpression ) expression ... | Tells you if the expression is true which can be true or Boolean . TRUE . |
145,582 | public static boolean isFalse ( Expression expression ) { if ( expression == null ) { return false ; } if ( expression instanceof PropertyExpression && classNodeImplementsType ( ( ( PropertyExpression ) expression ) . getObjectExpression ( ) . getType ( ) , Boolean . class ) ) { if ( ( ( PropertyExpression ) expression... | Tells you if the expression is the false expression either literal or constant . |
145,583 | public static boolean respondsTo ( Object object , String methodName ) { MetaClass metaClass = DefaultGroovyMethods . getMetaClass ( object ) ; if ( ! metaClass . respondsTo ( object , methodName ) . isEmpty ( ) ) { return true ; } Map properties = DefaultGroovyMethods . getProperties ( object ) ; return properties . c... | Return true only if the specified object responds to the named method |
145,584 | public static boolean classNodeImplementsType ( ClassNode node , Class target ) { ClassNode targetNode = ClassHelper . make ( target ) ; if ( node . implementsInterface ( targetNode ) ) { return true ; } if ( node . isDerivedFrom ( targetNode ) ) { return true ; } if ( node . getName ( ) . equals ( target . getName ( )... | This method tells you if a ClassNode implements or extends a certain class . |
145,585 | public static boolean isClosureDeclaration ( ASTNode expression ) { if ( expression instanceof DeclarationExpression ) { if ( ( ( DeclarationExpression ) expression ) . getRightExpression ( ) instanceof ClosureExpression ) { return true ; } } if ( expression instanceof FieldNode ) { ClassNode type = ( ( FieldNode ) exp... | Returns true if the ASTNode is a declaration of a closure either as a declaration or a field . |
145,586 | public static List < String > getParameterNames ( MethodNode node ) { ArrayList < String > result = new ArrayList < String > ( ) ; if ( node . getParameters ( ) != null ) { for ( Parameter parameter : node . getParameters ( ) ) { result . add ( parameter . getName ( ) ) ; } } return result ; } | Gets the parameter names of a method node . |
145,587 | public static List < String > getArgumentNames ( MethodCallExpression methodCall ) { ArrayList < String > result = new ArrayList < String > ( ) ; Expression arguments = methodCall . getArguments ( ) ; List < Expression > argExpressions = null ; if ( arguments instanceof ArrayExpression ) { argExpressions = ( ( ArrayExp... | Gets the argument names of a method call . If the arguments are not VariableExpressions then a null will be returned . |
145,588 | public static boolean isSafe ( Expression expression ) { if ( expression instanceof MethodCallExpression ) { return ( ( MethodCallExpression ) expression ) . isSafe ( ) ; } if ( expression instanceof PropertyExpression ) { return ( ( PropertyExpression ) expression ) . isSafe ( ) ; } return false ; } | Tells you if the expression is a null safe dereference . |
145,589 | public static boolean isSpreadSafe ( Expression expression ) { if ( expression instanceof MethodCallExpression ) { return ( ( MethodCallExpression ) expression ) . isSpreadSafe ( ) ; } if ( expression instanceof PropertyExpression ) { return ( ( PropertyExpression ) expression ) . isSpreadSafe ( ) ; } return false ; } | Tells you if the expression is a spread operator call |
145,590 | public static boolean isMethodNode ( ASTNode node , String methodNamePattern , Integer numArguments , Class returnType ) { if ( ! ( node instanceof MethodNode ) ) { return false ; } if ( ! ( ( ( MethodNode ) node ) . getName ( ) . matches ( methodNamePattern ) ) ) { return false ; } if ( numArguments != null && ( ( Met... | Tells you if the ASTNode is a method node for the given name arity and return type . |
145,591 | public static boolean isVariable ( ASTNode expression , String pattern ) { return ( expression instanceof VariableExpression && ( ( VariableExpression ) expression ) . getName ( ) . matches ( pattern ) ) ; } | Tells you if the given ASTNode is a VariableExpression with the given name . |
145,592 | private static Class getClassForClassNode ( ClassNode type ) { Class primitiveType = getPrimitiveType ( type ) ; if ( primitiveType != null ) { return primitiveType ; } else if ( classNodeImplementsType ( type , String . class ) ) { return String . class ; } else if ( classNodeImplementsType ( type , ReentrantLock . cl... | This is private . It is a helper function for the utils . |
145,593 | public static int findFirstNonAnnotationLine ( ASTNode node , SourceCode sourceCode ) { if ( node instanceof AnnotatedNode && ! ( ( AnnotatedNode ) node ) . getAnnotations ( ) . isEmpty ( ) ) { AnnotationNode lastAnnotation = null ; for ( AnnotationNode annotation : ( ( AnnotatedNode ) node ) . getAnnotations ( ) ) { i... | gets the first non annotation line number of a node taking into account annotations . |
145,594 | protected boolean isFirstVisit ( Object expression ) { if ( visited . contains ( expression ) ) { return false ; } visited . add ( expression ) ; return true ; } | Return true if the AST expression has not already been visited . If it is the first visit register the expression so that the next visit will return false . |
145,595 | protected String sourceLineTrimmed ( ASTNode node ) { return sourceCode . line ( AstUtil . findFirstNonAnnotationLine ( node , sourceCode ) - 1 ) ; } | Return the trimmed source line corresponding to the specified AST node |
145,596 | protected String sourceLine ( ASTNode node ) { return sourceCode . getLines ( ) . get ( AstUtil . findFirstNonAnnotationLine ( node , sourceCode ) - 1 ) ; } | Return the raw source line corresponding to the specified AST node |
145,597 | public static < T > T buildJsonResponse ( Response response , Class < T > clazz ) throws IOException , SlackApiException { if ( response . code ( ) == 200 ) { String body = response . body ( ) . string ( ) ; DETAILED_LOGGER . accept ( new HttpResponseListener . State ( SlackConfig . DEFAULT , response , body ) ) ; retu... | use parseJsonResponse instead |
145,598 | public WebhookResponse send ( String url , Payload payload ) throws IOException { SlackHttpClient httpClient = getHttpClient ( ) ; Response httpResponse = httpClient . postJsonPostRequest ( url , payload ) ; String body = httpResponse . body ( ) . string ( ) ; httpClient . runHttpResponseListeners ( httpResponse , body... | Send a data to Incoming Webhook endpoint . |
145,599 | private void updateSession ( Session newSession ) { if ( this . currentSession == null ) { this . currentSession = newSession ; } else { synchronized ( this . currentSession ) { this . currentSession = newSession ; } } } | Overwrites the underlying WebSocket session . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.