FraunhoferISST / TREND

Traceability Enforcement of Datatransfers (TREND)
https://fraunhoferisst.github.io/TREND/
Other
5 stars 2 forks source link

Include a function to calculate available insert positions in a text #37

Closed gemdav closed 3 weeks ago

gemdav commented 1 month ago

🚀 Feature Request

Current Problem

Currently, while there is a function to create the required insert positions for a watermark, there is none to calculate the available insert positions in a text.

https://github.com/FraunhoferISST/TREND/blob/752be7c96116d2caab58c698b5dc65474a4138e9/watermarker/src/commonMain/kotlin/fileWatermarker/TextWatermarker.kt#L438-L442

Such a function would come in handy, especially when needing to calculate whether or how often a given watermark fits in a given text.

Proposed Solution

Add a function that calculates the available insert positions in a text to the TextWatermarker class. This function could look like this:

/** Counts the available number of insert positions in a [file] */
fun getAvailableInsertPositions(file: TextFile): Int {
    return placement(file.content).count()
}

Additional Context

hnorkowski commented 3 weeks ago

Solved by #40