Skip to content

Commit

Permalink
Deploying to gh-pages from @ 3a430fc 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
oxisto committed Nov 19, 2024
1 parent 6360134 commit 31b4d93
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
<div class="cover ">
<h1 class="cover"><span>hash</span><wbr><span><span>Code</span></span></h1>
</div>
<div class="platform-hinted " data-platform-hinted="data-platform-hinted"><div class="content sourceset-dependent-content" data-active="" data-togglable=":cpg-core:dokkaHtmlPartial/main"><div class="symbol monospace"><span class="token keyword">open </span><span class="token keyword">override </span><span class="token keyword">fun </span><a href="hash-code.html"><span class="token function">hashCode</span></a><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">: </span><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a></div><p class="paragraph">Implementation of hash code. We are including the name and the location in this hash code as a compromise between including too few attributes and performance. Please note that this means, that two nodes that might be semantically equal, such as two record declarations with the same name but different location (e.g. because of header files) will be sorted into different hash keys.</p><p class="paragraph">That means, that you need to be careful, if you use a <a href="../../de.fraunhofer.aisec.cpg.graph/-node/index.html">Node</a> as a key in a hash map. You should make sure that the <a href="../../../cpg-core/de.fraunhofer.aisec.cpg.graph.statements.expressions/-binary-operator/location.html">location</a> is set before you add it to a hash map. This can be a little tricky, since normally the Handler class will set the location after it has "handled" the node. However, most <a href="../../de.fraunhofer.aisec.cpg.graph/-node-builder/index.html">NodeBuilder</a> will have an optional parameter to set the location already when creating the node.</p></div></div>
<div class="platform-hinted " data-platform-hinted="data-platform-hinted"><div class="content sourceset-dependent-content" data-active="" data-togglable=":cpg-core:dokkaHtmlPartial/main"><div class="symbol monospace"><span class="token keyword">open </span><span class="token keyword">override </span><span class="token keyword">fun </span><a href="hash-code.html"><span class="token function">hashCode</span></a><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">: </span><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a></div><p class="paragraph">Implementation of hash code. We are including the name and the location in this hash code as a compromise between including too few attributes and performance. Please note that this means, that two nodes that might be semantically equal, such as two record declarations with the same name but different location (e.g. because of header files) will be sorted into different hash keys.</p><p class="paragraph">That means, that you need to be careful, if you use a Node as a key in a hash map. You should make sure that the <a href="../../../cpg-core/de.fraunhofer.aisec.cpg.graph.statements.expressions/-binary-operator/location.html">location</a> is set before you add it to a hash map. This can be a little tricky, since normally the Handler class will set the location after it has "handled" the node. However, most NodeBuilder will have an optional parameter to set the location already when creating the node.</p></div></div>
</div>
<div class="footer">
<span class="go-to-top-icon"><a href="#content" id="go-to-top-link"></a></span><span>© 2024 Copyright</span><span class="pull-right"><span>Generated by </span><a href="https://github.com/Kotlin/dokka"><span>dokka</span><span class="padded-icon"></span></a></span>
Expand Down

0 comments on commit 31b4d93

Please sign in to comment.