idx int64 0 41.2k | question stringlengths 74 4.04k | target stringlengths 7 750 |
|---|---|---|
35,200 | protected void updateActivation ( Activation value , String xmlTag , Counter counter , Element element ) { boolean shouldExist = value != null ; Element root = updateElement ( counter , element , xmlTag , shouldExist ) ; if ( shouldExist ) { Counter innerCount = new Counter ( counter . getDepth ( ) + 1 ) ; findAndReplaceSimpleElement ( innerCount , root , "activeByDefault" , ( value . isActiveByDefault ( ) == false ) ? null : String . valueOf ( value . isActiveByDefault ( ) ) , "false" ) ; findAndReplaceSimpleElement ( innerCount , root , "jdk" , value . getJdk ( ) , null ) ; updateActivationOS ( value . getOs ( ) , "os" , innerCount , root ) ; updateActivationProperty ( value . getProperty ( ) , "property" , innerCount , root ) ; updateActivationFile ( value . getFile ( ) , "file" , innerCount , root ) ; } } | Method updateActivation . |
35,201 | protected void updateActivationFile ( ActivationFile value , String xmlTag , Counter counter , Element element ) { boolean shouldExist = value != null ; Element root = updateElement ( counter , element , xmlTag , shouldExist ) ; if ( shouldExist ) { Counter innerCount = new Counter ( counter . getDepth ( ) + 1 ) ; findAndReplaceSimpleElement ( innerCount , root , "missing" , value . getMissing ( ) , null ) ; findAndReplaceSimpleElement ( innerCount , root , "exists" , value . getExists ( ) , null ) ; } } | Method updateActivationFile . |
35,202 | protected void updateActivationOS ( ActivationOS value , String xmlTag , Counter counter , Element element ) { boolean shouldExist = value != null ; Element root = updateElement ( counter , element , xmlTag , shouldExist ) ; if ( shouldExist ) { Counter innerCount = new Counter ( counter . getDepth ( ) + 1 ) ; findAndReplaceSimpleElement ( innerCount , root , "name" , value . getName ( ) , null ) ; findAndReplaceSimpleElement ( innerCount , root , "family" , value . getFamily ( ) , null ) ; findAndReplaceSimpleElement ( innerCount , root , "arch" , value . getArch ( ) , null ) ; findAndReplaceSimpleElement ( innerCount , root , "version" , value . getVersion ( ) , null ) ; } } | Method updateActivationOS . |
35,203 | protected void updateActivationProperty ( ActivationProperty value , String xmlTag , Counter counter , Element element ) { boolean shouldExist = value != null ; Element root = updateElement ( counter , element , xmlTag , shouldExist ) ; if ( shouldExist ) { Counter innerCount = new Counter ( counter . getDepth ( ) + 1 ) ; findAndReplaceSimpleElement ( innerCount , root , "name" , value . getName ( ) , null ) ; findAndReplaceSimpleElement ( innerCount , root , "value" , value . getValue ( ) , null ) ; } } | Method updateActivationProperty . |
35,204 | protected void updateBuild ( Build value , String xmlTag , Counter counter , Element element ) { boolean shouldExist = value != null ; Element root = updateElement ( counter , element , xmlTag , shouldExist ) ; if ( shouldExist ) { Counter innerCount = new Counter ( counter . getDepth ( ) + 1 ) ; findAndReplaceSimpleElement ( innerCount , root , "sourceDirectory" , value . getSourceDirectory ( ) , null ) ; findAndReplaceSimpleElement ( innerCount , root , "scriptSourceDirectory" , value . getScriptSourceDirectory ( ) , null ) ; findAndReplaceSimpleElement ( innerCount , root , "testSourceDirectory" , value . getTestSourceDirectory ( ) , null ) ; findAndReplaceSimpleElement ( innerCount , root , "outputDirectory" , value . getOutputDirectory ( ) , null ) ; findAndReplaceSimpleElement ( innerCount , root , "testOutputDirectory" , value . getTestOutputDirectory ( ) , null ) ; iterateExtension ( innerCount , root , value . getExtensions ( ) , "extensions" , "extension" ) ; findAndReplaceSimpleElement ( innerCount , root , "defaultGoal" , value . getDefaultGoal ( ) , null ) ; iterateResource ( innerCount , root , value . getResources ( ) , "resources" , "resource" ) ; iterateResource ( innerCount , root , value . getTestResources ( ) , "testResources" , "testResource" ) ; findAndReplaceSimpleElement ( innerCount , root , "directory" , value . getDirectory ( ) , null ) ; findAndReplaceSimpleElement ( innerCount , root , "finalName" , value . getFinalName ( ) , null ) ; findAndReplaceSimpleLists ( innerCount , root , value . getFilters ( ) , "filters" , "filter" ) ; updatePluginManagement ( value . getPluginManagement ( ) , "pluginManagement" , innerCount , root ) ; iteratePlugin ( innerCount , root , value . getPlugins ( ) , "plugins" , "plugin" ) ; } } | Method updateBuild . |
35,205 | protected void updateBuildBase ( BuildBase value , String xmlTag , Counter counter , Element element ) { boolean shouldExist = value != null ; Element root = updateElement ( counter , element , xmlTag , shouldExist ) ; if ( shouldExist ) { Counter innerCount = new Counter ( counter . getDepth ( ) + 1 ) ; findAndReplaceSimpleElement ( innerCount , root , "defaultGoal" , value . getDefaultGoal ( ) , null ) ; iterateResource ( innerCount , root , value . getResources ( ) , "resources" , "resource" ) ; iterateResource ( innerCount , root , value . getTestResources ( ) , "testResources" , "testResource" ) ; findAndReplaceSimpleElement ( innerCount , root , "directory" , value . getDirectory ( ) , null ) ; findAndReplaceSimpleElement ( innerCount , root , "finalName" , value . getFinalName ( ) , null ) ; findAndReplaceSimpleLists ( innerCount , root , value . getFilters ( ) , "filters" , "filter" ) ; updatePluginManagement ( value . getPluginManagement ( ) , "pluginManagement" , innerCount , root ) ; iteratePlugin ( innerCount , root , value . getPlugins ( ) , "plugins" , "plugin" ) ; } } | Method updateBuildBase . |
35,206 | protected void updateCiManagement ( CiManagement value , String xmlTag , Counter counter , Element element ) { boolean shouldExist = value != null ; Element root = updateElement ( counter , element , xmlTag , shouldExist ) ; if ( shouldExist ) { Counter innerCount = new Counter ( counter . getDepth ( ) + 1 ) ; findAndReplaceSimpleElement ( innerCount , root , "system" , value . getSystem ( ) , null ) ; findAndReplaceSimpleElement ( innerCount , root , "url" , value . getUrl ( ) , null ) ; iterateNotifier ( innerCount , root , value . getNotifiers ( ) , "notifiers" , "notifier" ) ; } } | Method updateCiManagement . |
35,207 | protected void updateConfigurationContainer ( ConfigurationContainer value , String xmlTag , Counter counter , Element element ) { boolean shouldExist = value != null ; Element root = updateElement ( counter , element , xmlTag , shouldExist ) ; if ( shouldExist ) { Counter innerCount = new Counter ( counter . getDepth ( ) + 1 ) ; findAndReplaceSimpleElement ( innerCount , root , "inherited" , value . getInherited ( ) , null ) ; findAndReplaceXpp3DOM ( innerCount , root , "configuration" , ( Xpp3Dom ) value . getConfiguration ( ) ) ; } } | Method updateConfigurationContainer . |
35,208 | protected void updateContributor ( Contributor value , String xmlTag , Counter counter , Element element ) { Element root = element ; Counter innerCount = new Counter ( counter . getDepth ( ) + 1 ) ; findAndReplaceSimpleElement ( innerCount , root , "name" , value . getName ( ) , null ) ; findAndReplaceSimpleElement ( innerCount , root , "email" , value . getEmail ( ) , null ) ; findAndReplaceSimpleElement ( innerCount , root , "url" , value . getUrl ( ) , null ) ; findAndReplaceSimpleElement ( innerCount , root , "organization" , value . getOrganization ( ) , null ) ; findAndReplaceSimpleElement ( innerCount , root , "organizationUrl" , value . getOrganizationUrl ( ) , null ) ; findAndReplaceSimpleLists ( innerCount , root , value . getRoles ( ) , "roles" , "role" ) ; findAndReplaceSimpleElement ( innerCount , root , "timezone" , value . getTimezone ( ) , null ) ; findAndReplaceProperties ( innerCount , root , "properties" , value . getProperties ( ) ) ; } | Method updateContributor . |
35,209 | protected void updateDependency ( Dependency value , String xmlTag , Counter counter , Element element ) { Element root = element ; Counter innerCount = new Counter ( counter . getDepth ( ) + 1 ) ; findAndReplaceSimpleElement ( innerCount , root , "groupId" , value . getGroupId ( ) , null ) ; findAndReplaceSimpleElement ( innerCount , root , "artifactId" , value . getArtifactId ( ) , null ) ; findAndReplaceSimpleElement ( innerCount , root , "version" , value . getVersion ( ) , null ) ; findAndReplaceSimpleElement ( innerCount , root , "type" , value . getType ( ) , "jar" ) ; findAndReplaceSimpleElement ( innerCount , root , "classifier" , value . getClassifier ( ) , null ) ; findAndReplaceSimpleElement ( innerCount , root , "scope" , value . getScope ( ) , null ) ; findAndReplaceSimpleElement ( innerCount , root , "systemPath" , value . getSystemPath ( ) , null ) ; iterateExclusion ( innerCount , root , value . getExclusions ( ) , "exclusions" , "exclusion" ) ; findAndReplaceSimpleElement ( innerCount , root , "optional" , ( value . isOptional ( ) == false ) ? null : String . valueOf ( value . isOptional ( ) ) , "false" ) ; } | Method updateDependency . |
35,210 | protected void updateDependencyManagement ( DependencyManagement value , String xmlTag , Counter counter , Element element ) { boolean shouldExist = value != null ; Element root = updateElement ( counter , element , xmlTag , shouldExist ) ; if ( shouldExist ) { Counter innerCount = new Counter ( counter . getDepth ( ) + 1 ) ; iterateDependency ( innerCount , root , value . getDependencies ( ) , "dependencies" , "dependency" ) ; } } | Method updateDependencyManagement . |
35,211 | protected void updateDeploymentRepository ( DeploymentRepository value , String xmlTag , Counter counter , Element element ) { boolean shouldExist = value != null ; Element root = updateElement ( counter , element , xmlTag , shouldExist ) ; if ( shouldExist ) { Counter innerCount = new Counter ( counter . getDepth ( ) + 1 ) ; findAndReplaceSimpleElement ( innerCount , root , "uniqueVersion" , ( value . isUniqueVersion ( ) == true ) ? null : String . valueOf ( value . isUniqueVersion ( ) ) , "true" ) ; findAndReplaceSimpleElement ( innerCount , root , "id" , value . getId ( ) , null ) ; findAndReplaceSimpleElement ( innerCount , root , "name" , value . getName ( ) , null ) ; findAndReplaceSimpleElement ( innerCount , root , "url" , value . getUrl ( ) , null ) ; findAndReplaceSimpleElement ( innerCount , root , "layout" , value . getLayout ( ) , "default" ) ; } } | Method updateDeploymentRepository . |
35,212 | protected void updateDistributionManagement ( DistributionManagement value , String xmlTag , Counter counter , Element element ) { boolean shouldExist = value != null ; Element root = updateElement ( counter , element , xmlTag , shouldExist ) ; if ( shouldExist ) { Counter innerCount = new Counter ( counter . getDepth ( ) + 1 ) ; updateDeploymentRepository ( value . getRepository ( ) , "repository" , innerCount , root ) ; updateDeploymentRepository ( value . getSnapshotRepository ( ) , "snapshotRepository" , innerCount , root ) ; updateSite ( value . getSite ( ) , "site" , innerCount , root ) ; findAndReplaceSimpleElement ( innerCount , root , "downloadUrl" , value . getDownloadUrl ( ) , null ) ; updateRelocation ( value . getRelocation ( ) , "relocation" , innerCount , root ) ; findAndReplaceSimpleElement ( innerCount , root , "status" , value . getStatus ( ) , null ) ; } } | Method updateDistributionManagement . |
35,213 | protected Element updateElement ( Counter counter , Element parent , String name , boolean shouldExist ) { Element element = parent . getChild ( name , parent . getNamespace ( ) ) ; if ( ( element != null ) && shouldExist ) { counter . increaseCount ( ) ; } if ( ( element == null ) && shouldExist ) { element = factory . element ( name , parent . getNamespace ( ) ) ; insertAtPreferredLocation ( parent , element , counter ) ; counter . increaseCount ( ) ; } if ( ! shouldExist && ( element != null ) ) { int index = parent . indexOf ( element ) ; if ( index > 0 ) { Content previous = parent . getContent ( index - 1 ) ; if ( previous instanceof Text ) { Text txt = ( Text ) previous ; if ( txt . getTextTrim ( ) . length ( ) == 0 ) { parent . removeContent ( txt ) ; } } } parent . removeContent ( element ) ; } return element ; } | Method updateElement . |
35,214 | protected void updateExclusion ( Exclusion value , String xmlTag , Counter counter , Element element ) { Element root = element ; Counter innerCount = new Counter ( counter . getDepth ( ) + 1 ) ; findAndReplaceSimpleElement ( innerCount , root , "artifactId" , value . getArtifactId ( ) , null ) ; findAndReplaceSimpleElement ( innerCount , root , "groupId" , value . getGroupId ( ) , null ) ; } | Method updateExclusion . |
35,215 | protected void updateExtension ( Extension value , String xmlTag , Counter counter , Element element ) { Element root = element ; Counter innerCount = new Counter ( counter . getDepth ( ) + 1 ) ; findAndReplaceSimpleElement ( innerCount , root , "groupId" , value . getGroupId ( ) , null ) ; findAndReplaceSimpleElement ( innerCount , root , "artifactId" , value . getArtifactId ( ) , null ) ; findAndReplaceSimpleElement ( innerCount , root , "version" , value . getVersion ( ) , null ) ; } | Method updateExtension . |
35,216 | protected void updateFileSet ( FileSet value , String xmlTag , Counter counter , Element element ) { boolean shouldExist = value != null ; Element root = updateElement ( counter , element , xmlTag , shouldExist ) ; if ( shouldExist ) { Counter innerCount = new Counter ( counter . getDepth ( ) + 1 ) ; findAndReplaceSimpleElement ( innerCount , root , "directory" , value . getDirectory ( ) , null ) ; findAndReplaceSimpleLists ( innerCount , root , value . getIncludes ( ) , "includes" , "include" ) ; findAndReplaceSimpleLists ( innerCount , root , value . getExcludes ( ) , "excludes" , "exclude" ) ; } } | Method updateFileSet . |
35,217 | protected void updateIssueManagement ( IssueManagement value , String xmlTag , Counter counter , Element element ) { boolean shouldExist = value != null ; Element root = updateElement ( counter , element , xmlTag , shouldExist ) ; if ( shouldExist ) { Counter innerCount = new Counter ( counter . getDepth ( ) + 1 ) ; findAndReplaceSimpleElement ( innerCount , root , "system" , value . getSystem ( ) , null ) ; findAndReplaceSimpleElement ( innerCount , root , "url" , value . getUrl ( ) , null ) ; } } | Method updateIssueManagement . |
35,218 | protected void updateLicense ( License value , String xmlTag , Counter counter , Element element ) { Element root = element ; Counter innerCount = new Counter ( counter . getDepth ( ) + 1 ) ; findAndReplaceSimpleElement ( innerCount , root , "name" , value . getName ( ) , null ) ; findAndReplaceSimpleElement ( innerCount , root , "url" , value . getUrl ( ) , null ) ; findAndReplaceSimpleElement ( innerCount , root , "distribution" , value . getDistribution ( ) , null ) ; findAndReplaceSimpleElement ( innerCount , root , "comments" , value . getComments ( ) , null ) ; } | Method updateLicense . |
35,219 | protected void updateMailingList ( MailingList value , String xmlTag , Counter counter , Element element ) { Element root = element ; Counter innerCount = new Counter ( counter . getDepth ( ) + 1 ) ; findAndReplaceSimpleElement ( innerCount , root , "name" , value . getName ( ) , null ) ; findAndReplaceSimpleElement ( innerCount , root , "subscribe" , value . getSubscribe ( ) , null ) ; findAndReplaceSimpleElement ( innerCount , root , "unsubscribe" , value . getUnsubscribe ( ) , null ) ; findAndReplaceSimpleElement ( innerCount , root , "post" , value . getPost ( ) , null ) ; findAndReplaceSimpleElement ( innerCount , root , "archive" , value . getArchive ( ) , null ) ; findAndReplaceSimpleLists ( innerCount , root , value . getOtherArchives ( ) , "otherArchives" , "otherArchive" ) ; } | Method updateMailingList . |
35,220 | protected void updateModelBase ( ModelBase value , String xmlTag , Counter counter , Element element ) { boolean shouldExist = value != null ; Element root = updateElement ( counter , element , xmlTag , shouldExist ) ; if ( shouldExist ) { Counter innerCount = new Counter ( counter . getDepth ( ) + 1 ) ; findAndReplaceSimpleLists ( innerCount , root , value . getModules ( ) , "modules" , "module" ) ; iterateRepository ( innerCount , root , value . getRepositories ( ) , "repositories" , "repository" ) ; iterateRepository ( innerCount , root , value . getPluginRepositories ( ) , "pluginRepositories" , "pluginRepository" ) ; iterateDependency ( innerCount , root , value . getDependencies ( ) , "dependencies" , "dependency" ) ; findAndReplaceXpp3DOM ( innerCount , root , "reports" , ( Xpp3Dom ) value . getReports ( ) ) ; updateReporting ( value . getReporting ( ) , "reporting" , innerCount , root ) ; updateDependencyManagement ( value . getDependencyManagement ( ) , "dependencyManagement" , innerCount , root ) ; updateDistributionManagement ( value . getDistributionManagement ( ) , "distributionManagement" , innerCount , root ) ; findAndReplaceProperties ( innerCount , root , "properties" , value . getProperties ( ) ) ; } } | Method updateModelBase . |
35,221 | protected void updateNotifier ( Notifier value , String xmlTag , Counter counter , Element element ) { Element root = element ; Counter innerCount = new Counter ( counter . getDepth ( ) + 1 ) ; findAndReplaceSimpleElement ( innerCount , root , "type" , value . getType ( ) , "mail" ) ; findAndReplaceSimpleElement ( innerCount , root , "sendOnError" , ( value . isSendOnError ( ) == true ) ? null : String . valueOf ( value . isSendOnError ( ) ) , "true" ) ; findAndReplaceSimpleElement ( innerCount , root , "sendOnFailure" , ( value . isSendOnFailure ( ) == true ) ? null : String . valueOf ( value . isSendOnFailure ( ) ) , "true" ) ; findAndReplaceSimpleElement ( innerCount , root , "sendOnSuccess" , ( value . isSendOnSuccess ( ) == true ) ? null : String . valueOf ( value . isSendOnSuccess ( ) ) , "true" ) ; findAndReplaceSimpleElement ( innerCount , root , "sendOnWarning" , ( value . isSendOnWarning ( ) == true ) ? null : String . valueOf ( value . isSendOnWarning ( ) ) , "true" ) ; findAndReplaceSimpleElement ( innerCount , root , "address" , value . getAddress ( ) , null ) ; findAndReplaceProperties ( innerCount , root , "configuration" , value . getConfiguration ( ) ) ; } | Method updateNotifier . |
35,222 | protected void updateOrganization ( Organization value , String xmlTag , Counter counter , Element element ) { boolean shouldExist = value != null ; Element root = updateElement ( counter , element , xmlTag , shouldExist ) ; if ( shouldExist ) { Counter innerCount = new Counter ( counter . getDepth ( ) + 1 ) ; findAndReplaceSimpleElement ( innerCount , root , "name" , value . getName ( ) , null ) ; findAndReplaceSimpleElement ( innerCount , root , "url" , value . getUrl ( ) , null ) ; } } | Method updateOrganization . |
35,223 | protected void updateParent ( Parent value , String xmlTag , Counter counter , Element element ) { boolean shouldExist = value != null ; Element root = updateElement ( counter , element , xmlTag , shouldExist ) ; if ( shouldExist ) { Counter innerCount = new Counter ( counter . getDepth ( ) + 1 ) ; findAndReplaceSimpleElement ( innerCount , root , "artifactId" , value . getArtifactId ( ) , null ) ; findAndReplaceSimpleElement ( innerCount , root , "groupId" , value . getGroupId ( ) , null ) ; findAndReplaceSimpleElement ( innerCount , root , "version" , value . getVersion ( ) , null ) ; findAndReplaceSimpleElement ( innerCount , root , "relativePath" , value . getRelativePath ( ) , "../pom.xml" ) ; } } | Method updateParent . |
35,224 | protected void updatePatternSet ( PatternSet value , String xmlTag , Counter counter , Element element ) { boolean shouldExist = value != null ; Element root = updateElement ( counter , element , xmlTag , shouldExist ) ; if ( shouldExist ) { Counter innerCount = new Counter ( counter . getDepth ( ) + 1 ) ; findAndReplaceSimpleLists ( innerCount , root , value . getIncludes ( ) , "includes" , "include" ) ; findAndReplaceSimpleLists ( innerCount , root , value . getExcludes ( ) , "excludes" , "exclude" ) ; } } | Method updatePatternSet . |
35,225 | protected void updatePlugin ( Plugin value , String xmlTag , Counter counter , Element element ) { Element root = element ; Counter innerCount = new Counter ( counter . getDepth ( ) + 1 ) ; findAndReplaceSimpleElement ( innerCount , root , "groupId" , value . getGroupId ( ) , "org.apache.maven.plugins" ) ; findAndReplaceSimpleElement ( innerCount , root , "artifactId" , value . getArtifactId ( ) , null ) ; findAndReplaceSimpleElement ( innerCount , root , "version" , value . getVersion ( ) , null ) ; findAndReplaceSimpleElement ( innerCount , root , "extensions" , ( value . isExtensions ( ) == false ) ? null : String . valueOf ( value . isExtensions ( ) ) , "false" ) ; iteratePluginExecution ( innerCount , root , value . getExecutions ( ) , "executions" , "execution" ) ; iterateDependency ( innerCount , root , value . getDependencies ( ) , "dependencies" , "dependency" ) ; findAndReplaceXpp3DOM ( innerCount , root , "goals" , ( Xpp3Dom ) value . getGoals ( ) ) ; findAndReplaceSimpleElement ( innerCount , root , "inherited" , value . getInherited ( ) , null ) ; findAndReplaceXpp3DOM ( innerCount , root , "configuration" , ( Xpp3Dom ) value . getConfiguration ( ) ) ; } | Method updatePlugin . |
35,226 | protected void updatePluginConfiguration ( PluginConfiguration value , String xmlTag , Counter counter , Element element ) { boolean shouldExist = value != null ; Element root = updateElement ( counter , element , xmlTag , shouldExist ) ; if ( shouldExist ) { Counter innerCount = new Counter ( counter . getDepth ( ) + 1 ) ; updatePluginManagement ( value . getPluginManagement ( ) , "pluginManagement" , innerCount , root ) ; iteratePlugin ( innerCount , root , value . getPlugins ( ) , "plugins" , "plugin" ) ; } } | Method updatePluginConfiguration . |
35,227 | protected void updatePluginContainer ( PluginContainer value , String xmlTag , Counter counter , Element element ) { boolean shouldExist = value != null ; Element root = updateElement ( counter , element , xmlTag , shouldExist ) ; if ( shouldExist ) { Counter innerCount = new Counter ( counter . getDepth ( ) + 1 ) ; iteratePlugin ( innerCount , root , value . getPlugins ( ) , "plugins" , "plugin" ) ; } } | Method updatePluginContainer . |
35,228 | protected void updatePluginExecution ( PluginExecution value , String xmlTag , Counter counter , Element element ) { Element root = element ; Counter innerCount = new Counter ( counter . getDepth ( ) + 1 ) ; findAndReplaceSimpleElement ( innerCount , root , "id" , value . getId ( ) , "default" ) ; findAndReplaceSimpleElement ( innerCount , root , "phase" , value . getPhase ( ) , null ) ; findAndReplaceSimpleLists ( innerCount , root , value . getGoals ( ) , "goals" , "goal" ) ; findAndReplaceSimpleElement ( innerCount , root , "inherited" , value . getInherited ( ) , null ) ; findAndReplaceXpp3DOM ( innerCount , root , "configuration" , ( Xpp3Dom ) value . getConfiguration ( ) ) ; } | Method updatePluginExecution . |
35,229 | protected void updatePrerequisites ( Prerequisites value , String xmlTag , Counter counter , Element element ) { boolean shouldExist = value != null ; Element root = updateElement ( counter , element , xmlTag , shouldExist ) ; if ( shouldExist ) { Counter innerCount = new Counter ( counter . getDepth ( ) + 1 ) ; findAndReplaceSimpleElement ( innerCount , root , "maven" , value . getMaven ( ) , "2.0" ) ; } } | Method updatePrerequisites . |
35,230 | protected void updateProfile ( Profile value , String xmlTag , Counter counter , Element element ) { Element root = element ; Counter innerCount = new Counter ( counter . getDepth ( ) + 1 ) ; findAndReplaceSimpleElement ( innerCount , root , "id" , value . getId ( ) , null ) ; updateActivation ( value . getActivation ( ) , "activation" , innerCount , root ) ; updateBuildBase ( value . getBuild ( ) , "build" , innerCount , root ) ; findAndReplaceSimpleLists ( innerCount , root , value . getModules ( ) , "modules" , "module" ) ; iterateRepository ( innerCount , root , value . getRepositories ( ) , "repositories" , "repository" ) ; iterateRepository ( innerCount , root , value . getPluginRepositories ( ) , "pluginRepositories" , "pluginRepository" ) ; iterateDependency ( innerCount , root , value . getDependencies ( ) , "dependencies" , "dependency" ) ; findAndReplaceXpp3DOM ( innerCount , root , "reports" , ( Xpp3Dom ) value . getReports ( ) ) ; updateReporting ( value . getReporting ( ) , "reporting" , innerCount , root ) ; updateDependencyManagement ( value . getDependencyManagement ( ) , "dependencyManagement" , innerCount , root ) ; updateDistributionManagement ( value . getDistributionManagement ( ) , "distributionManagement" , innerCount , root ) ; findAndReplaceProperties ( innerCount , root , "properties" , value . getProperties ( ) ) ; } | Method updateProfile . |
35,231 | protected void updateRelocation ( Relocation value , String xmlTag , Counter counter , Element element ) { boolean shouldExist = value != null ; Element root = updateElement ( counter , element , xmlTag , shouldExist ) ; if ( shouldExist ) { Counter innerCount = new Counter ( counter . getDepth ( ) + 1 ) ; findAndReplaceSimpleElement ( innerCount , root , "groupId" , value . getGroupId ( ) , null ) ; findAndReplaceSimpleElement ( innerCount , root , "artifactId" , value . getArtifactId ( ) , null ) ; findAndReplaceSimpleElement ( innerCount , root , "version" , value . getVersion ( ) , null ) ; findAndReplaceSimpleElement ( innerCount , root , "message" , value . getMessage ( ) , null ) ; } } | Method updateRelocation . |
35,232 | protected void updateReporting ( Reporting value , String xmlTag , Counter counter , Element element ) { boolean shouldExist = value != null ; Element root = updateElement ( counter , element , xmlTag , shouldExist ) ; if ( shouldExist ) { Counter innerCount = new Counter ( counter . getDepth ( ) + 1 ) ; findAndReplaceSimpleElement ( innerCount , root , "excludeDefaults" , ( value . isExcludeDefaults ( ) == false ) ? null : String . valueOf ( value . isExcludeDefaults ( ) ) , "false" ) ; findAndReplaceSimpleElement ( innerCount , root , "outputDirectory" , value . getOutputDirectory ( ) , null ) ; iterateReportPlugin ( innerCount , root , value . getPlugins ( ) , "plugins" , "plugin" ) ; } } | Method updateReporting . |
35,233 | protected void updateReportPlugin ( ReportPlugin value , String xmlTag , Counter counter , Element element ) { Element root = element ; Counter innerCount = new Counter ( counter . getDepth ( ) + 1 ) ; findAndReplaceSimpleElement ( innerCount , root , "groupId" , value . getGroupId ( ) , "org.apache.maven.plugins" ) ; findAndReplaceSimpleElement ( innerCount , root , "artifactId" , value . getArtifactId ( ) , null ) ; findAndReplaceSimpleElement ( innerCount , root , "version" , value . getVersion ( ) , null ) ; findAndReplaceSimpleElement ( innerCount , root , "inherited" , value . getInherited ( ) , null ) ; findAndReplaceXpp3DOM ( innerCount , root , "configuration" , ( Xpp3Dom ) value . getConfiguration ( ) ) ; iterateReportSet ( innerCount , root , value . getReportSets ( ) , "reportSets" , "reportSet" ) ; } | Method updateReportPlugin . |
35,234 | protected void updateReportSet ( ReportSet value , String xmlTag , Counter counter , Element element ) { Element root = element ; Counter innerCount = new Counter ( counter . getDepth ( ) + 1 ) ; findAndReplaceSimpleElement ( innerCount , root , "id" , value . getId ( ) , "default" ) ; findAndReplaceXpp3DOM ( innerCount , root , "configuration" , ( Xpp3Dom ) value . getConfiguration ( ) ) ; findAndReplaceSimpleElement ( innerCount , root , "inherited" , value . getInherited ( ) , null ) ; findAndReplaceSimpleLists ( innerCount , root , value . getReports ( ) , "reports" , "report" ) ; } | Method updateReportSet . |
35,235 | protected void updateRepository ( Repository value , String xmlTag , Counter counter , Element element ) { Element root = element ; Counter innerCount = new Counter ( counter . getDepth ( ) + 1 ) ; updateRepositoryPolicy ( value . getReleases ( ) , "releases" , innerCount , root ) ; updateRepositoryPolicy ( value . getSnapshots ( ) , "snapshots" , innerCount , root ) ; findAndReplaceSimpleElement ( innerCount , root , "id" , value . getId ( ) , null ) ; findAndReplaceSimpleElement ( innerCount , root , "name" , value . getName ( ) , null ) ; findAndReplaceSimpleElement ( innerCount , root , "url" , value . getUrl ( ) , null ) ; findAndReplaceSimpleElement ( innerCount , root , "layout" , value . getLayout ( ) , "default" ) ; } | Method updateRepository . |
35,236 | protected void updateRepositoryBase ( RepositoryBase value , String xmlTag , Counter counter , Element element ) { boolean shouldExist = value != null ; Element root = updateElement ( counter , element , xmlTag , shouldExist ) ; if ( shouldExist ) { Counter innerCount = new Counter ( counter . getDepth ( ) + 1 ) ; findAndReplaceSimpleElement ( innerCount , root , "id" , value . getId ( ) , null ) ; findAndReplaceSimpleElement ( innerCount , root , "name" , value . getName ( ) , null ) ; findAndReplaceSimpleElement ( innerCount , root , "url" , value . getUrl ( ) , null ) ; findAndReplaceSimpleElement ( innerCount , root , "layout" , value . getLayout ( ) , "default" ) ; } } | Method updateRepositoryBase . |
35,237 | protected void updateRepositoryPolicy ( RepositoryPolicy value , String xmlTag , Counter counter , Element element ) { boolean shouldExist = value != null ; Element root = updateElement ( counter , element , xmlTag , shouldExist ) ; if ( shouldExist ) { Counter innerCount = new Counter ( counter . getDepth ( ) + 1 ) ; findAndReplaceSimpleElement ( innerCount , root , "enabled" , ( value . isEnabled ( ) == true ) ? null : String . valueOf ( value . isEnabled ( ) ) , "true" ) ; findAndReplaceSimpleElement ( innerCount , root , "updatePolicy" , value . getUpdatePolicy ( ) , null ) ; findAndReplaceSimpleElement ( innerCount , root , "checksumPolicy" , value . getChecksumPolicy ( ) , null ) ; } } | Method updateRepositoryPolicy . |
35,238 | protected void updateResource ( Resource value , String xmlTag , Counter counter , Element element ) { Element root = element ; Counter innerCount = new Counter ( counter . getDepth ( ) + 1 ) ; findAndReplaceSimpleElement ( innerCount , root , "targetPath" , value . getTargetPath ( ) , null ) ; findAndReplaceSimpleElement ( innerCount , root , "filtering" , ( value . isFiltering ( ) == false ) ? null : String . valueOf ( value . isFiltering ( ) ) , "false" ) ; findAndReplaceSimpleElement ( innerCount , root , "directory" , value . getDirectory ( ) , null ) ; findAndReplaceSimpleLists ( innerCount , root , value . getIncludes ( ) , "includes" , "include" ) ; findAndReplaceSimpleLists ( innerCount , root , value . getExcludes ( ) , "excludes" , "exclude" ) ; } | Method updateResource . |
35,239 | protected void updateScm ( Scm value , String xmlTag , Counter counter , Element element ) { boolean shouldExist = value != null ; Element root = updateElement ( counter , element , xmlTag , shouldExist ) ; if ( shouldExist ) { Counter innerCount = new Counter ( counter . getDepth ( ) + 1 ) ; findAndReplaceSimpleElement ( innerCount , root , "connection" , value . getConnection ( ) , null ) ; findAndReplaceSimpleElement ( innerCount , root , "developerConnection" , value . getDeveloperConnection ( ) , null ) ; findAndReplaceSimpleElement ( innerCount , root , "tag" , value . getTag ( ) , "HEAD" ) ; findAndReplaceSimpleElement ( innerCount , root , "url" , value . getUrl ( ) , null ) ; } } | Method updateScm . |
35,240 | protected void updateSite ( Site value , String xmlTag , Counter counter , Element element ) { boolean shouldExist = value != null ; Element root = updateElement ( counter , element , xmlTag , shouldExist ) ; if ( shouldExist ) { Counter innerCount = new Counter ( counter . getDepth ( ) + 1 ) ; findAndReplaceSimpleElement ( innerCount , root , "id" , value . getId ( ) , null ) ; findAndReplaceSimpleElement ( innerCount , root , "name" , value . getName ( ) , null ) ; findAndReplaceSimpleElement ( innerCount , root , "url" , value . getUrl ( ) , null ) ; } } | Method updateSite . |
35,241 | public static String validateRequired ( final InputComponent < ? , ? > input ) { String requiredMessage = null ; if ( input . isEnabled ( ) && input . isRequired ( ) && ! InputComponents . hasValue ( input ) ) { requiredMessage = input . getRequiredMessage ( ) ; if ( Strings . isNullOrEmpty ( requiredMessage ) ) { String labelValue = input . getLabel ( ) == null ? input . getName ( ) : input . getLabel ( ) ; if ( labelValue . endsWith ( COLON ) ) { labelValue = labelValue . substring ( 0 , labelValue . length ( ) - 1 ) ; } requiredMessage = labelValue + " must be specified." ; } } return requiredMessage ; } | Validate if an required and enabled input has a value . If not return the error message . |
35,242 | public static String getLabelFor ( InputComponent < ? , ? > input , boolean addColon ) { String label = input . getLabel ( ) ; if ( label == null ) { label = input . getName ( ) ; } if ( addColon && ! label . endsWith ( COLON ) ) { label += COLON ; } return label ; } | Returns the label for this component |
35,243 | private synchronized void refreshFlow ( ) { try { initialize ( ) ; } catch ( Exception e ) { throw new IllegalStateException ( "Error while initializing wizard" , e ) ; } int currentFlowPointer = this . flowPointer ; try { this . flowPointer = 0 ; while ( canMoveToNextStep ( ) ) { try { next ( ) . initialize ( ) ; } catch ( Exception e ) { throw new IllegalStateException ( "Error while moving to the next wizard step" , e ) ; } } cleanSubsequentStalePages ( ) ; } finally { this . flowPointer = currentFlowPointer ; } } | Refreshes the current flow so it s possible to eagerly fetch all the steps |
35,244 | private synchronized void cleanSubsequentStalePages ( ) { if ( flowPointer == 0 ) { flow . subList ( 1 , flow . size ( ) ) . clear ( ) ; subflow . clear ( ) ; } else { Iterator < WizardStepEntry > it = flow . listIterator ( flowPointer + 1 ) ; int subflowIdx = 0 ; while ( it . hasNext ( ) ) { WizardStepEntry entry = it . next ( ) ; if ( entry . subflowHead && ! subflow . contains ( entry ) ) { subflow . add ( subflowIdx ++ , entry ) ; } it . remove ( ) ; } } } | Remove stale pages in case of navigational changes |
35,245 | private List < Resource < ? > > allDirectoriesOnPath ( Resource < ? > startingDir ) { List < Resource < ? > > result = new ArrayList < > ( ) ; while ( startingDir != null ) { result . add ( startingDir ) ; startingDir = startingDir . getParent ( ) ; } return result ; } | Returns all directories on path starting from given directory up to the root . |
35,246 | private Project findProjectInDirectory ( Resource < ? > target , ProjectProvider projectProvider , Predicate < Project > filter ) { Project result = null ; Imported < ProjectCache > caches = getCaches ( ) ; if ( projectProvider . containsProject ( target ) ) { boolean cached = false ; for ( ProjectCache cache : caches ) { result = cache . get ( target ) ; if ( result != null && ! filter . accept ( result ) ) { result = null ; } if ( result != null ) { cached = true ; break ; } } if ( result == null ) { result = projectProvider . createProject ( target ) ; } if ( result != null && ! filter . accept ( result ) ) { result = null ; } if ( result != null && ! cached ) { registerAvailableFacets ( result ) ; cacheProject ( result ) ; } } return result ; } | Returns project residing in given directory if no such is found then null is returned . |
35,247 | public static NavigationResultBuilder create ( NavigationResult result ) { NavigationResultBuilder builder = new NavigationResultBuilder ( ) ; if ( result != null && result . getNext ( ) != null ) { builder . entries . addAll ( Arrays . asList ( result . getNext ( ) ) ) ; } return builder ; } | Create a new instance of a NavigationResultBuilder using the provided NavigationResult instance as a base . |
35,248 | public NavigationResultBuilder add ( NavigationResult result ) { if ( result != null && result . getNext ( ) != null ) { entries . addAll ( Arrays . asList ( result . getNext ( ) ) ) ; } return this ; } | Add a UICommand instance to create a single navigation entry . |
35,249 | public NavigationResultBuilder add ( UICommandMetadata metadata , Iterable < Class < ? extends UICommand > > types ) { List < NavigationResultEntry > internalEntries = new ArrayList < > ( ) ; for ( Class < ? extends UICommand > type : types ) { if ( UIWizard . class . isAssignableFrom ( type ) ) { throw new IllegalArgumentException ( "A UICommand of type " + type + " was added. " + UIWizard . class . getSimpleName ( ) + " instances should be added individually." ) ; } else { internalEntries . add ( new ClassNavigationResultEntry ( type ) ) ; } } entries . add ( new CompositeNavigationResultEntry ( metadata , internalEntries ) ) ; return this ; } | Add multiple UICommand types to create a single navigation entry . Every invocation of this method creates a separate navigation entry . UIWizard types must not be provided as arguments since wizards and wizard steps cannot be combined with other UICommand types in the same navigation entry . |
35,250 | public List < Resource < ? > > search ( ) { return match ( path . split ( Pattern . quote ( File . separator ) ) , 0 , res , new LinkedList < Resource < ? > > ( ) ) ; } | Perform a search by doing a breadth - first traversal of the resource tree for resources that match the path string . |
35,251 | public Resource < ? > getChild ( final String name ) { return getResourceFactory ( ) . create ( new File ( getUnderlyingResourceObject ( ) . getAbsolutePath ( ) , name ) ) ; } | Obtain a reference to the child resource . |
35,252 | public boolean isEJB ( JavaType < ? > javaType ) { return javaType . hasAnnotation ( Stateless . class ) || javaType . hasAnnotation ( Stateful . class ) || javaType . hasAnnotation ( Singleton . class ) || javaType . hasAnnotation ( MessageDriven . class ) ; } | Given a JavaType this method checks if it s an EJB or not |
35,253 | private static Prompt createPrompt ( Resource < ? > currentResource ) { if ( OperatingSystemUtils . isWindows ( ) ) { List < TerminalCharacter > prompt = new LinkedList < > ( ) ; prompt . add ( new TerminalCharacter ( '[' ) ) ; for ( char c : currentResource . getName ( ) . toCharArray ( ) ) { prompt . add ( new TerminalCharacter ( c ) ) ; } prompt . add ( new TerminalCharacter ( ']' ) ) ; prompt . add ( new TerminalCharacter ( '$' ) ) ; prompt . add ( new TerminalCharacter ( ' ' ) ) ; return new Prompt ( prompt ) ; } else { List < TerminalCharacter > prompt = new LinkedList < > ( ) ; prompt . add ( new TerminalCharacter ( '[' , new TerminalColor ( Color . BLUE , Color . DEFAULT ) , CharacterType . BOLD ) ) ; for ( char c : currentResource . getName ( ) . toCharArray ( ) ) { prompt . add ( new TerminalCharacter ( c ) ) ; } prompt . add ( new TerminalCharacter ( ']' , new TerminalColor ( Color . BLUE , Color . DEFAULT ) , CharacterType . BOLD ) ) ; prompt . add ( new TerminalCharacter ( '$' ) ) ; prompt . add ( new TerminalCharacter ( ' ' ) ) ; return new Prompt ( prompt ) ; } } | Creates an initial prompt |
35,254 | VersionRangeResult getVersions ( DependencyQuery query ) { Coordinate dep = query . getCoordinate ( ) ; try { String version = dep . getVersion ( ) ; if ( version == null || version . isEmpty ( ) ) { dep = CoordinateBuilder . create ( dep ) . setVersion ( "[,)" ) ; } else if ( ! version . matches ( "(\\(|\\[).*?(\\)|\\])" ) ) { dep = CoordinateBuilder . create ( dep ) . setVersion ( "[" + version + "]" ) ; } RepositorySystem maven = container . getRepositorySystem ( ) ; Settings settings = container . getSettings ( ) ; DefaultRepositorySystemSession session = container . setupRepoSession ( maven , settings ) ; Artifact artifact = MavenConvertUtils . coordinateToMavenArtifact ( dep ) ; List < RemoteRepository > remoteRepos = MavenConvertUtils . convertToMavenRepos ( query . getDependencyRepositories ( ) , settings ) ; remoteRepos . addAll ( MavenRepositories . getRemoteRepositories ( container , settings ) ) ; VersionRangeRequest rangeRequest = new VersionRangeRequest ( artifact , remoteRepos , null ) ; VersionRangeResult rangeResult = maven . resolveVersionRange ( session , rangeRequest ) ; return rangeResult ; } catch ( Exception e ) { throw new RuntimeException ( "Failed to look up versions for [" + dep + "]" , e ) ; } } | Returns the versions of a specific artifact |
35,255 | public static File getContextFile ( Resource < ? > r ) { do { Object o = r . getUnderlyingResourceObject ( ) ; if ( o instanceof File ) { return ( File ) r . getUnderlyingResourceObject ( ) ; } } while ( ( r = r . getParent ( ) ) != null ) ; return null ; } | A simple utility method to locate the outermost contextual File reference for the specified resource . |
35,256 | CliRequest createCliRequest ( String [ ] params , String workingDirectory ) { CliRequest cliRequest = null ; try { Constructor < CliRequest > constructor = CliRequest . class . getDeclaredConstructor ( String [ ] . class , ClassWorld . class ) ; constructor . setAccessible ( true ) ; cliRequest = constructor . newInstance ( params , null ) ; Field workingDirectoryField = CliRequest . class . getDeclaredField ( "workingDirectory" ) ; workingDirectoryField . setAccessible ( true ) ; workingDirectoryField . set ( cliRequest , workingDirectory ) ; Field multiModuleProjectDirectoryField = CliRequest . class . getDeclaredField ( "multiModuleProjectDirectory" ) ; multiModuleProjectDirectoryField . setAccessible ( true ) ; multiModuleProjectDirectoryField . set ( cliRequest , new File ( workingDirectory ) ) ; } catch ( Exception e ) { throw new RuntimeException ( "Error while creating CliRequest" , e ) ; } return cliRequest ; } | Horrible hack . Bad Maven API |
35,257 | protected void implementInterface ( InterfaceCapableSource < ? > source , Iterable < String > value , JavaSourceFacet facet ) { for ( String type : value ) { source . addInterface ( type ) ; } } | Interfaces don t require overriding method declarations |
35,258 | public static boolean isEnabled ( UICommand command , UIContext context ) { return ( command . isEnabled ( context ) && ! ( command instanceof UIWizardStep ) ) ; } | Returns true if this command can be invoked |
35,259 | public static String shellifyOptionValue ( String value ) { return COLONS . matcher ( WHITESPACES . matcher ( value . trim ( ) ) . replaceAll ( "_" ) ) . replaceAll ( "" ) . toUpperCase ( ) ; } | Shellifies an option value |
35,260 | public static String shellifyOptionNameDashed ( String name ) { String shellName = shellifyName ( name ) ; StringBuilder sb = new StringBuilder ( ) ; for ( int i = 0 ; i < shellName . length ( ) ; i ++ ) { char c = shellName . charAt ( i ) ; if ( Character . isUpperCase ( c ) ) { if ( i > 0 ) { char previousChar = shellName . charAt ( i - 1 ) ; char nextChar = ( i + 1 < shellName . length ( ) ) ? shellName . charAt ( i + 1 ) : '\0' ; if ( previousChar != '-' && ( ! Character . isUpperCase ( previousChar ) || Character . isLowerCase ( nextChar ) ) ) { sb . append ( '-' ) ; } } sb . append ( Character . toLowerCase ( c ) ) ; } else { sb . append ( c ) ; } } return sb . toString ( ) ; } | Shellifies an option name using the provided style |
35,261 | public static int execFromPath ( final String command , final String [ ] parms , final OutputStream out , final DirectoryResource path ) throws IOException { Assert . notNull ( command , "Command must not be null." ) ; Assert . notNull ( path , "Directory path must not be null." ) ; Assert . notNull ( out , "OutputStream must not be null." ) ; try { String [ ] commandTokens = parms == null ? new String [ 1 ] : new String [ parms . length + 1 ] ; commandTokens [ 0 ] = command ; if ( commandTokens . length > 1 ) { System . arraycopy ( parms , 0 , commandTokens , 1 , parms . length ) ; } ProcessBuilder builder = new ProcessBuilder ( commandTokens ) ; builder . directory ( path . getUnderlyingResourceObject ( ) ) ; builder . redirectErrorStream ( true ) ; Process p = builder . start ( ) ; InputStream stdout = p . getInputStream ( ) ; Thread outThread = new Thread ( new Receiver ( stdout , out ) ) ; outThread . start ( ) ; outThread . join ( ) ; return p . waitFor ( ) ; } catch ( InterruptedException e ) { e . printStackTrace ( ) ; return - 1 ; } } | Execute a native system command as if it were run from the given path . |
35,262 | public static void exec ( final boolean wait , final String command , final String ... parms ) throws IOException { String [ ] commandTokens = parms == null ? new String [ 1 ] : new String [ parms . length + 1 ] ; commandTokens [ 0 ] = command ; if ( commandTokens . length > 1 ) { System . arraycopy ( parms , 0 , commandTokens , 1 , parms . length ) ; } Runtime . getRuntime ( ) . exec ( commandTokens , null ) ; } | Execute the given system command |
35,263 | private String readInput ( PrintStream out , boolean echo ) throws InterruptedException { StringBuilder sb = new StringBuilder ( ) ; Key inputKey ; do { CommandOperation input = commandInvocation . getInput ( ) ; inputKey = input . getInputKey ( ) ; if ( inputKey == Key . CTRL_C || inputKey == Key . CTRL_D ) { throw new InterruptedException ( inputKey . name ( ) ) ; } else if ( inputKey == Key . BACKSPACE && sb . length ( ) > 0 ) { sb . setLength ( sb . length ( ) - 1 ) ; if ( echo ) { out . print ( Buffer . printAnsi ( "1D" ) ) ; out . flush ( ) ; out . print ( " " ) ; out . print ( Buffer . printAnsi ( "1D" ) ) ; out . flush ( ) ; } } else if ( inputKey . isPrintable ( ) ) { if ( echo ) out . print ( inputKey . getAsChar ( ) ) ; sb . append ( inputKey . getAsChar ( ) ) ; } } while ( inputKey != Key . ENTER && inputKey != Key . ENTER_2 ) ; return ( sb . length ( ) == 0 ) ? null : sb . toString ( ) ; } | Performs the hard work |
35,264 | public void preconfigureInput ( InputComponent < ? , ? > input , WithAttributes atts ) { if ( atts != null ) { input . setEnabled ( atts . enabled ( ) ) ; input . setLabel ( atts . label ( ) ) ; input . setRequired ( atts . required ( ) ) ; input . setRequiredMessage ( atts . requiredMessage ( ) ) ; input . setDescription ( atts . description ( ) ) ; input . setDeprecated ( atts . deprecated ( ) ) ; input . setDeprecatedMessage ( atts . deprecatedMessage ( ) ) ; if ( ! InputType . DEFAULT . equals ( atts . type ( ) ) ) { input . getFacet ( HintsFacet . class ) . setInputType ( atts . type ( ) ) ; } if ( ! atts . defaultValue ( ) . isEmpty ( ) ) { InputComponents . setDefaultValueFor ( converterFactory , ( InputComponent < ? , Object > ) input , atts . defaultValue ( ) ) ; } if ( ! atts . note ( ) . isEmpty ( ) ) { input . setNote ( atts . note ( ) ) ; } } } | Pre - configure input based on WithAttributes info if annotation exists |
35,265 | public DTOCollection from ( Project project , JavaClass < ? > entity , String dtoPackage ) { DTOCollection dtoCollection = new DTOCollection ( ) ; if ( entity == null ) { throw new IllegalArgumentException ( "The argument entity was null." ) ; } generatedDTOGraphForEntity ( project , entity , dtoPackage , true , false , dtoCollection ) ; return dtoCollection ; } | Creates a collection of DTOs for the provided JPA entity and any JPA entities referenced in the JPA entity . |
35,266 | public void start ( ) { synchronized ( this . lifecycleMonitor ) { if ( ! isRunning ( ) ) { log . info ( "start: Starting ConnectorManager" ) ; try { connector . start ( ) ; } catch ( ConfigError | RuntimeError ex ) { throw new ConfigurationException ( ex . getMessage ( ) , ex ) ; } catch ( Throwable ex ) { throw new IllegalStateException ( "Could not start the connector" , ex ) ; } running = true ; } } } | Start the connector accepting new connections |
35,267 | public void stop ( ) { synchronized ( this . lifecycleMonitor ) { if ( isRunning ( ) ) { log . info ( "stop: Stopping ConnectorManager" ) ; try { connector . stop ( ) ; } finally { running = false ; } } } } | Stop this connector logging out existing sessions closing their connections and stopping to accept new connections . |
35,268 | public void visitBracketedExpression ( Expr expr , Integer indent ) { boolean needsBrackets = needsBrackets ( expr ) ; if ( needsBrackets ) { out . print ( "(" ) ; } visitExpression ( expr , indent ) ; if ( needsBrackets ) { out . print ( ")" ) ; } } | Write a bracketed operand if necessary . Any operand whose human - readable representation can contain whitespace must have brackets around it . |
35,269 | public < T extends Type > T selectCandidate ( T candidate , T next , T actual , Environment environment ) { boolean left = subtypeOperator . isSubtype ( candidate , next , environment ) ; boolean right = subtypeOperator . isSubtype ( next , candidate , environment ) ; if ( left && ! right ) { return next ; } else if ( right && ! left ) { return candidate ; } left = isDerivation ( next , actual ) ; right = isDerivation ( candidate , actual ) ; if ( left && ! right ) { return next ; } else if ( right && ! left ) { return candidate ; } else { return null ; } } | Given two candidates return the more precise one . If no viable candidate return null ; |
35,270 | public static Type . Callable substitute ( Type . Callable fmp , Tuple < Template . Variable > templateParameters , Tuple < SyntacticItem > templateArguments ) { Function < Identifier , SyntacticItem > binding = WyilFile . bindingFunction ( templateParameters , templateArguments ) ; Tuple < Type > parameters = WyilFile . substitute ( fmp . getParameters ( ) , binding ) ; Tuple < Type > returns = WyilFile . substitute ( fmp . getReturns ( ) , binding ) ; if ( fmp instanceof Type . Method ) { Type . Method m = ( Type . Method ) fmp ; return new Type . Method ( parameters , returns , m . getCapturedLifetimes ( ) , new Tuple < > ( ) ) ; } else if ( fmp instanceof Type . Function ) { return new Type . Function ( parameters , returns ) ; } else { return new Type . Property ( parameters , returns ) ; } } | Apply an explicit binding to a given function method or property declaration via substitution . Observe we cannot just use the existing Type . substitute method as this accounts for lifetime captures . Therefore we first build the binding and then apply it to each of the parameters and returns . |
35,271 | public static < T extends SyntacticItem > java . util . function . Function < Identifier , SyntacticItem > bindingFunction ( Tuple < Template . Variable > variables , Tuple < T > arguments ) { return ( Identifier var ) -> { for ( int i = 0 ; i != variables . size ( ) ; ++ i ) { if ( var . equals ( variables . get ( i ) . getName ( ) ) ) { return arguments . get ( i ) ; } } return null ; } ; } | Create a simple binding function from two tuples representing the key set and value set respectively . |
35,272 | public static java . util . function . Function < Identifier , SyntacticItem > removeFromBinding ( java . util . function . Function < Identifier , SyntacticItem > binding , Tuple < Identifier > variables ) { return ( Identifier var ) -> { for ( int i = 0 ; i != variables . size ( ) ; ++ i ) { if ( var . equals ( variables . get ( i ) ) ) { return null ; } } return binding . apply ( var ) ; } ; } | Construct a binding function from another binding where a given set of variables are removed . This is necessary in situations where the given variables are captured . |
35,273 | protected < T extends SemanticType . Atom > T construct ( Disjunct type , LifetimeRelation lifetimes , Combinator < T > kind ) { T result = null ; Conjunct [ ] conjuncts = type . conjuncts ; for ( int i = 0 ; i != conjuncts . length ; ++ i ) { Conjunct conjunct = conjuncts [ i ] ; if ( ! isVoid ( conjunct , lifetimes ) ) { T tmp = construct ( conjunct , lifetimes , kind ) ; if ( tmp == null ) { } else if ( result == null ) { result = tmp ; } else { result = kind . union ( result , tmp , lifetimes ) ; } } } return result ; } | Construct a given target type from a given type in DisjunctiveNormalForm . |
35,274 | protected static int countMatchingFields ( Tuple < ? extends SemanticType . Field > lhsFields , Tuple < ? extends SemanticType . Field > rhsFields ) { int count = 0 ; for ( int i = 0 ; i != lhsFields . size ( ) ; ++ i ) { for ( int j = 0 ; j != rhsFields . size ( ) ; ++ j ) { SemanticType . Field lhsField = lhsFields . get ( i ) ; SemanticType . Field rhsField = rhsFields . get ( j ) ; Identifier lhsFieldName = lhsField . getName ( ) ; Identifier rhsFieldName = rhsField . getName ( ) ; if ( lhsFieldName . equals ( rhsFieldName ) ) { count = count + 1 ; } } } return count ; } | Count the number of matching fields . That is fields with the same name . |
35,275 | private Stmt parseHeadlessStatement ( EnclosingScope scope ) { int start = index ; Identifier blockName = parseOptionalIdentifier ( scope ) ; if ( blockName != null ) { if ( tryAndMatch ( true , Colon ) != null && isAtEOL ( ) ) { int end = index ; matchEndLine ( ) ; scope = scope . newEnclosingScope ( ) ; scope . declareLifetime ( blockName ) ; Stmt . Block body = parseBlock ( scope , false ) ; return annotateSourceLocation ( new Stmt . NamedBlock ( blockName , body ) , start ) ; } else { index = start ; } } if ( tryAndMatch ( false , Final ) != null || ( skipType ( scope ) && tryAndMatch ( false , Identifier ) != null ) ) { index = start ; return parseVariableDeclaration ( scope ) ; } index = start ; Expr e = parseExpression ( scope , false ) ; if ( e instanceof Expr . Invoke || e instanceof Expr . IndirectInvoke ) { matchEndLine ( ) ; return e ; } else { index = start ; return parseAssignmentStatement ( scope ) ; } } | A headless statement is one which has no identifying keyword . The set of headless statements include assignments invocations variable declarations and named blocks . |
35,276 | public Tuple < Expr > parseExpressions ( EnclosingScope scope , boolean terminated ) { ArrayList < Expr > returns = new ArrayList < > ( ) ; int next = skipLineSpace ( index ) ; returns . add ( parseExpression ( scope , terminated ) ) ; while ( tryAndMatch ( false , Comma ) != null ) { returns . add ( parseExpression ( scope , terminated ) ) ; } return new Tuple < > ( returns ) ; } | Parse a multi - expression ; that is a sequence of one or more expressions separated by comma s |
35,277 | private Expr parseBitwiseOrExpression ( EnclosingScope scope , boolean terminated ) { int start = index ; Expr lhs = parseBitwiseXorExpression ( scope , terminated ) ; if ( tryAndMatch ( terminated , VerticalBar ) != null ) { Expr rhs = parseExpression ( scope , terminated ) ; return annotateSourceLocation ( new Expr . BitwiseOr ( Type . Byte , new Tuple < > ( lhs , rhs ) ) , start ) ; } return lhs ; } | Parse an bitwise inclusive or expression |
35,278 | private Expr parseBitwiseXorExpression ( EnclosingScope scope , boolean terminated ) { int start = index ; Expr lhs = parseBitwiseAndExpression ( scope , terminated ) ; if ( tryAndMatch ( terminated , Caret ) != null ) { Expr rhs = parseExpression ( scope , terminated ) ; return annotateSourceLocation ( new Expr . BitwiseXor ( Type . Byte , new Tuple < > ( lhs , rhs ) ) , start ) ; } return lhs ; } | Parse an bitwise exclusive or expression |
35,279 | private Expr parseBitwiseAndExpression ( EnclosingScope scope , boolean terminated ) { int start = index ; Expr lhs = parseConditionExpression ( scope , terminated ) ; if ( tryAndMatch ( terminated , Ampersand ) != null ) { Expr rhs = parseExpression ( scope , terminated ) ; return annotateSourceLocation ( new Expr . BitwiseAnd ( Type . Byte , new Tuple < > ( lhs , rhs ) ) , start ) ; } return lhs ; } | Parse an bitwise and expression |
35,280 | private Expr parseConditionExpression ( EnclosingScope scope , boolean terminated ) { int start = index ; Token lookahead ; if ( ( lookahead = tryAndMatch ( terminated , Some , All ) ) != null ) { return parseQuantifierExpression ( lookahead , scope , terminated ) ; } Expr lhs = parseShiftExpression ( scope , terminated ) ; lookahead = tryAndMatch ( terminated , LessEquals , LeftAngle , GreaterEquals , RightAngle , EqualsEquals , NotEquals , Is , Subset , SubsetEquals , Superset , SupersetEquals ) ; if ( lookahead != null && lookahead . kind == Is ) { Type type = parseType ( scope ) ; lhs = annotateSourceLocation ( new Expr . Is ( lhs , type ) , start ) ; } else if ( lookahead != null ) { Expr rhs = parseShiftExpression ( scope , terminated ) ; switch ( lookahead . kind ) { case LessEquals : lhs = new Expr . IntegerLessThanOrEqual ( lhs , rhs ) ; break ; case LeftAngle : lhs = new Expr . IntegerLessThan ( lhs , rhs ) ; break ; case GreaterEquals : lhs = new Expr . IntegerGreaterThanOrEqual ( lhs , rhs ) ; break ; case RightAngle : lhs = new Expr . IntegerGreaterThan ( lhs , rhs ) ; break ; case EqualsEquals : lhs = new Expr . Equal ( lhs , rhs ) ; break ; case NotEquals : lhs = new Expr . NotEqual ( lhs , rhs ) ; break ; default : throw new RuntimeException ( "deadcode" ) ; } lhs = annotateSourceLocation ( lhs , start ) ; } return lhs ; } | Parse a condition expression . |
35,281 | private Expr parseAdditiveExpression ( EnclosingScope scope , boolean terminated ) { int start = index ; Expr lhs = parseMultiplicativeExpression ( scope , terminated ) ; Token lookahead ; while ( ( lookahead = tryAndMatch ( terminated , Plus , Minus ) ) != null ) { Expr rhs = parseMultiplicativeExpression ( scope , terminated ) ; switch ( lookahead . kind ) { case Plus : lhs = new Expr . IntegerAddition ( Type . Void , lhs , rhs ) ; break ; case Minus : lhs = new Expr . IntegerSubtraction ( Type . Void , lhs , rhs ) ; break ; default : throw new RuntimeException ( "deadcode" ) ; } lhs = annotateSourceLocation ( lhs , start ) ; } return lhs ; } | Parse an additive expression . |
35,282 | private Expr parseMultiplicativeExpression ( EnclosingScope scope , boolean terminated ) { int start = index ; Expr lhs = parseAccessExpression ( scope , terminated ) ; Token lookahead = tryAndMatch ( terminated , Star , RightSlash , Percent ) ; if ( lookahead != null ) { Expr rhs = parseAccessExpression ( scope , terminated ) ; switch ( lookahead . kind ) { case Star : lhs = new Expr . IntegerMultiplication ( Type . Void , lhs , rhs ) ; break ; case RightSlash : lhs = new Expr . IntegerDivision ( Type . Void , lhs , rhs ) ; break ; case Percent : lhs = new Expr . IntegerRemainder ( Type . Void , lhs , rhs ) ; break ; default : throw new RuntimeException ( "deadcode" ) ; } lhs = annotateSourceLocation ( lhs , start ) ; } return lhs ; } | Parse a multiplicative expression . |
35,283 | private Expr parseQualifiedAccess ( EnclosingScope scope , boolean terminated ) { int start = index ; Name name = parseName ( scope ) ; Decl . Link link = new Decl . Link < > ( name ) ; int mid = index ; Expr expr ; if ( skipTemplate ( scope ) && tryAndMatch ( terminated , LeftBrace ) != null ) { index = mid ; Tuple < ? extends SyntacticItem > templateArguments = parseOptionalTemplateArguments ( scope , terminated ) ; Decl . Binding < Type . Callable , Decl . Callable > binding = new Decl . Binding < > ( link , templateArguments ) ; match ( LeftBrace ) ; Tuple < Expr > arguments = parseInvocationArguments ( scope ) ; expr = new Expr . Invoke ( binding , arguments ) ; } else { expr = new Expr . StaticVariableAccess ( Type . Void , link ) ; } return annotateSourceLocation ( expr , start ) ; } | Attempt to parse a possible module identifier . This will reflect a true module identifier only if the root variable is not in the given environment . |
35,284 | public boolean skipTemplate ( EnclosingScope scope ) { int start = index ; if ( tryAndMatch ( false , LeftAngle ) == null ) { return true ; } else { boolean firstTime = true ; while ( tryAndMatch ( false , RightAngle ) == null ) { if ( ! firstTime && tryAndMatch ( false , Comma ) == null ) { index = start ; return false ; } else if ( ! skipLifetimeIdentifier ( scope ) && ! skipType ( scope ) ) { index = start ; return false ; } firstTime = false ; } } return true ; } | Decide whether we have a template argument list ahead . This actually requires infinite lookahead but in practice is pretty minimal work . |
35,285 | private Identifier parseLifetime ( EnclosingScope scope , boolean terminated ) { Identifier id = parseOptionalLifetimeIdentifier ( scope , terminated ) ; if ( id != null ) { return id ; } else { syntaxError ( "expecting lifetime identifier" , tokens . get ( index ) ) ; } throw new RuntimeException ( "deadcode" ) ; } | Parse a currently declared lifetime . |
35,286 | private Token match ( Token . Kind kind ) { checkNotEof ( ) ; Token token = tokens . get ( index ++ ) ; if ( token . kind != kind ) { syntaxError ( "expecting \"" + kind + "\" here" , token ) ; } return token ; } | Match a given token kind whilst moving passed any whitespace encountered inbetween . In the case that meet the end of the stream or we don t match the expected token then an error is thrown . |
35,287 | private Token [ ] match ( Token . Kind ... kinds ) { Token [ ] result = new Token [ kinds . length ] ; for ( int i = 0 ; i != result . length ; ++ i ) { checkNotEof ( ) ; Token token = tokens . get ( index ++ ) ; if ( token . kind == kinds [ i ] ) { result [ i ] = token ; } else { syntaxError ( "Expected \"" + kinds [ i ] + "\" here" , token ) ; } } return result ; } | Match a given sequence of tokens whilst moving passed any whitespace encountered inbetween . In the case that meet the end of the stream or we don t match the expected tokens in the expected order then an error is thrown . |
35,288 | private boolean lookaheadSequence ( boolean terminated , Token . Kind ... kinds ) { int next = index ; for ( Token . Kind k : kinds ) { next = terminated ? skipWhiteSpace ( next ) : skipLineSpace ( next ) ; if ( next >= tokens . size ( ) || tokens . get ( next ++ ) . kind != k ) { return false ; } } return true ; } | Attempt to match a given sequence of tokens in the given order whilst ignoring any whitespace in between . Note that in any case the index will be unchanged! |
35,289 | private boolean isAtEOL ( ) { int next = skipLineSpace ( index ) ; return next >= tokens . size ( ) || tokens . get ( next ) . kind == NewLine ; } | Check whether the current index is after skipping all line spaces at the end of a line . This method does not change the state! |
35,290 | private void matchEndLine ( ) { index = skipLineSpace ( index ) ; if ( index >= tokens . size ( ) ) { return ; } else if ( tokens . get ( index ) . kind != NewLine ) { syntaxError ( "expected end-of-line" , tokens . get ( index ) ) ; } else { index = index + 1 ; } } | Match a the end of a line . This is required to signal for example the end of the current statement . |
35,291 | private int skipWhiteSpace ( int index ) { while ( index < tokens . size ( ) && isWhiteSpace ( tokens . get ( index ) ) ) { index ++ ; } return index ; } | Skip over any whitespace characters starting from a given index and returning the first index passed any whitespace encountered . |
35,292 | private void skipEmptyLines ( ) { int tmp = index ; do { tmp = skipLineSpace ( tmp ) ; if ( tmp < tokens . size ( ) && tokens . get ( tmp ) . kind != Token . Kind . NewLine ) { return ; } else if ( tmp >= tokens . size ( ) ) { index = tmp ; return ; } tmp = tmp + 1 ; index = tmp ; } while ( true ) ; } | Skip over any empty lines . That is lines which contain only whitespace and comments . |
35,293 | private boolean isWhiteSpace ( Token token ) { return token . kind == Token . Kind . NewLine || isLineSpace ( token ) ; } | Define what is considered to be whitespace . |
35,294 | private BigInteger parseCharacter ( String input ) { int pos = 1 ; char c = input . charAt ( pos ++ ) ; if ( c == '\\' ) { switch ( input . charAt ( pos ++ ) ) { case 'b' : c = '\b' ; break ; case 't' : c = '\t' ; break ; case 'n' : c = '\n' ; break ; case 'f' : c = '\f' ; break ; case 'r' : c = '\r' ; break ; case '"' : c = '\"' ; break ; case '\'' : c = '\'' ; break ; case '\\' : c = '\\' ; break ; default : throw new RuntimeException ( "unrecognised escape character" ) ; } } return BigInteger . valueOf ( c ) ; } | Parse a character from a string of the form c or \ c . |
35,295 | protected byte [ ] parseUnicodeString ( Token token ) { String v = token . text ; v = v . substring ( 1 , v . length ( ) - 1 ) ; StringBuffer result = new StringBuffer ( ) ; for ( int i = 0 ; i < v . length ( ) ; i ++ ) { if ( v . charAt ( i ) == '\\' ) { if ( v . length ( ) <= i + 1 ) { throw new RuntimeException ( "unexpected end-of-string" ) ; } else { char replace = 0 ; int len = 2 ; switch ( v . charAt ( i + 1 ) ) { case 'b' : replace = '\b' ; break ; case 't' : replace = '\t' ; break ; case 'n' : replace = '\n' ; break ; case 'f' : replace = '\f' ; break ; case 'r' : replace = '\r' ; break ; case '"' : replace = '\"' ; break ; case '\'' : replace = '\'' ; break ; case '\\' : replace = '\\' ; break ; case 'u' : len = 6 ; String unicode = v . substring ( i + 2 , i + 6 ) ; replace = ( char ) Integer . parseInt ( unicode , 16 ) ; i = i + 5 ; break ; default : throw new RuntimeException ( "unknown escape character" ) ; } result . append ( replace ) ; i = i + 1 ; } } else { result . append ( v . charAt ( i ) ) ; } } try { return result . toString ( ) . getBytes ( "UTF8" ) ; } catch ( UnsupportedEncodingException e ) { syntaxError ( "invalid unicode string" , token ) ; return null ; } } | Parse a string constant whilst interpreting all escape characters . |
35,296 | private byte parseBinaryLiteral ( Token input ) { String text = input . text ; if ( text . length ( ) > 11 ) { syntaxError ( "invalid binary literal (too long)" , input ) ; } int val = 0 ; for ( int i = 2 ; i != text . length ( ) ; ++ i ) { char c = text . charAt ( i ) ; if ( c == '_' ) { continue ; } val = val << 1 ; if ( c == '1' ) { val = val | 1 ; } else if ( c == '0' ) { } else { syntaxError ( "invalid binary literal (invalid characters)" , input ) ; } } return ( byte ) val ; } | Parse a token representing a binary literal such as 0b0110 0b1111_0101 etc . |
35,297 | private BigInteger parseHexLiteral ( Token input ) { String text = input . text ; for ( int i = 2 ; i != text . length ( ) ; ++ i ) { char c = text . charAt ( i ) ; if ( c != '_' && ! isHexDigit ( c ) ) { syntaxError ( "invalid hex literal (invalid characters)" , input ) ; } } text = input . text . substring ( 2 ) . replace ( "_" , "" ) ; return new BigInteger ( text , 16 ) ; } | Parse a token representing a hex literal such as 0x |
35,298 | public static Environment declareThisWithin ( Decl . FunctionOrMethod decl , Environment environment ) { if ( decl instanceof Decl . Method ) { Decl . Method method = ( Decl . Method ) decl ; environment = environment . declareWithin ( "this" , method . getLifetimes ( ) ) ; } return environment ; } | Update the environment to reflect the fact that the special this lifetime is contained within all declared lifetime parameters . Observe that this only makes sense if the enclosing declaration is for a method . |
35,299 | public static Tuple < Decl . Variable > determineModifiedVariables ( Stmt . Block block ) { HashSet < Decl . Variable > modified = new HashSet < > ( ) ; determineModifiedVariables ( block , modified ) ; return new Tuple < > ( modified ) ; } | Determine the set of modifier variables for a given statement block . A modified variable is one which is assigned . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.