Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Oobranch c : ootext and rangesort #7788

Merged
merged 25 commits into from
Jul 12, 2021
Merged

Oobranch c : ootext and rangesort #7788

merged 25 commits into from
Jul 12, 2021

Conversation

antalk2
Copy link
Contributor

@antalk2 antalk2 commented Jun 3, 2021

Adds

  • ootext: interpret HTML-like markup into a writer document
  • rangesort : sort XTextRange ranges visually and check if they overlap

* vendor and browser-specific", so probably best to avoid them if possible.
*
*/
public static OOText setLocale(OOText s, String locale) {
Copy link
Member

@Siedlerchr Siedlerchr Jun 4, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please no single character variables, better give it a more meaningful variable. Same applies for others

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

renamed to OOText ootext

NoSuchElementException,
CreationException {

final boolean debugThisFun = false;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can this be removed? Better use LOGGER.debug(...)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to use LOGGER.debug() and not to use debugThisFun

  • I believe LOGGER calls will be included in production code.
  • Is this intended?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is fine. debug calls are only enabled with the debug flag starting parameter.

@calixtus
Copy link
Member

Just a question: VoidResult feels a bit strange. Using an optional is no alternative?

@antalk2
Copy link
Contributor Author

antalk2 commented Jun 18, 2021

Just a question: VoidResult feels a bit strange. Using an optional is no alternative?

That would be Optional<ERRORTYPE>. Its normal use is Optional<RESULTTYPE>

At a call site this would mean using the first alternatives below

 Failure                                                 
 --------------------------------       
 return Optional.of(message)                 
 return VoidResult.error(message)         

 Success
 --------------------------
 return Optional.empty()
 return VoidResult.ok()

Answer:

  • Technically: both Optional and VoidResult can store 0 or 1 values,
    in this respect they are equivalent
    • Actually, VoidResult is just a wrapper around an Optional
  • In terms of communication to human readers when used:
    • Optional.empty() normally suggests failure, VoidResult.ok() does not.
    • Optional.of(message) may be confused with success,
      VoidResult.error(message) cannot
    • VoidResult is "the other half" (the failure branch) of Result
      • its content is accessed through getError, mapError, ifError, not get, map, ifPresent

Just as a basic enum does not add new capabilities to a set of constants,
and a function does the same as its inlined version, VoidResult does not add new capabilities.
Everything you can do with it can be translated to using Optional (while carefully keeping track of which
Optionals represent values we wanted and which represent errors).
These Optionals can in turn can be translated to using null (again, carefully keeping track of which
values may be null and which ones can be safely dereferenced).

VoidResult does allow

  • a clear distinction between success and failure when
    calls to get something that might not be available (Optional) and
    calls to precondition checking where we can only get reasons for failure
    (VoidResult)
    appear together.
    Using Optional for both is possible, but is more error-prone.

  • it also allows using uniform verbs (isError, getError, ifError, return {Void}Result.error) for "we have a problem" when

    • checking preconditions (VoidResult) is mixed with
    • "I need an X" orelse "we have a problem" (Result)
  • at a functions head:

    • VoidResult<String> function() says: no result, but may get an error message
    • Optional<String> function() says: a String result or nothing.

Summary: technically could use Optional or null but it would be less precise,
leaving more room for confusion and bugs. Forces use of getError instead of get,
and isError or isOk instead of isPresentor isEmpty.

From this and an earlier question it seems that https://en.wikipedia.org/wiki/Result_type
is not well-known among the maintainers. It is not unknown in java:

It can be considered as an extended Optional, that can provide details on "why empty"?
It can be considered as an alternative to throwing an exception: we return an error instead.
It shares the problem that in a function several types of errors may occur,
but we can only return a single error type. Java solves this using checked exceptions
being all descendants of Exception.
Methods throwing checked exceptions however cannot be used with for example List.map.

I used OOError as the unified error type: it can store error messages and wrap exceptions.
It depends on (extends) JabRefException (this forces it to at least logic) and also provides
showErrorDialog (forcing it to gui).

@calixtus
Copy link
Member

Please don't suppose that all the maintainers don't know their stuff, it's just me who asked a question, since Im not a computer scientist by education. Please remember that we do this all in our free time and JabRef as a project for people to learn about Open Source and programming. Especially me. Always learning. 😉

@calixtus
Copy link
Member

But thanks for the very good answer.

@antalk2
Copy link
Contributor Author

antalk2 commented Jun 18, 2021

Please don't suppose that all the maintainers don't know their stuff, it's just me who asked a question,

OK, I just needed some phrase to introduce why am I going into these details.

since Im not a computer scientist by education.

Neither I am. The verbosity and some of the repetition is probably partly due to that: I am clarifying my thoughts
about the details for myself as well.

@koppor
Copy link
Member

koppor commented Jun 21, 2021

@antalk2 Would you find time to convert #7788 (comment) into an ADR? 😇 --> https://github.com/adr/adr-manager/ (would be nice for others reading the code later)


if (o instanceof ComparableMark) {
ComparableMark other = (ComparableMark) o;
return ((this.position.X == other.position.X)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For consistency I would use also Object.equals

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code is possibly inconsistent with hashCode using position below, while I used position.x and position.y here.
Part of my confusion comes from that I feel "equal" should consider the content part,
however in compareTo I did not want to prescribe comparability for the content.

I think I implemented equals and hashCode because Comparable seems to require it,
in order to make it suitable as a key in TreeMap and HashMap

Although compareTo appeared to me as "natural order", it is probably not that in the sense
as Comparable expects it. Considering right-to-left languages suggests that it is not even
natural in a non-technical sense.

Dropping implements Comparable<ComparableMark<T>>, compareTo, equals and hashCode,
adding private static int compareTopToBottomLeftToRight(ComparableMark a, ComparableMark b)
to RangeSortVisual instead

@antalk2
Copy link
Contributor Author

antalk2 commented Jun 23, 2021

@antalk2 Would you find time to convert #7788 (comment) into an ADR? innocent --> https://github.com/adr/adr-manager/ (would be nice for others reading the code later)

I seem to have lost my earlier answer suggesting a description in docs/openoffice instead.

I wrote this: https://github.com/koppor/jabref/blob/69f7be4215bdbb21789a7946c08bc8a9db4c8719/docs/openoffice/ooresult-ooerror.md

I also attempted to compare with other solutions I could come up with: https://github.com/koppor/jabref/blob/69f7be4215bdbb21789a7946c08bc8a9db4c8719/docs/openoffice/ooresult-alternatives.md

I think that OOResult as used in OOBibBase2 resulted in too much boilerplate in the actions,
making them hard to read. The best I could come up with is throwing an exception: basically
throwing OOError instead of returning it allows us to catch and show all of them in a single location.

Copy link
Member

@k3KAW8Pnf7mkmdSMPHz27 k3KAW8Pnf7mkmdSMPHz27 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, looks good to me, and all the comments are very appreciated!

90%+ of my comments are nitpicks, so take the "Request changes" with a grain of salt.

  1. Nitpicks = change them if you agree (e.g., do they improve readability?), but I'd be ok with merging without those changes.
  2. I'd suggest that you use /** for private methods/variables as well, some tools expect it.
  3. Try to avoid having loose comments between methods, it's better if you either make it a JavaDoc or comment inside the method so there is no ambiguity of what it is referring to

Comment on lines +192 to +194
switch (tagName) {
case "b":
formatStack.pushLayer(setCharWeight(FontWeight.BOLD));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Siedlerchr shouldn't the indention of case fail checkstyle?


public static class HolderComparatorWithinPartition implements Comparator<RangeHolder> {

XTextRangeCompare cmp;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: private final

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, private final XTextRangeCompare cmp;

HolderComparatorWithinPartition itself could be private as well.

Changed class comment (on to: HolderComparatorWithinPartition)

    /**
     * Compare two RangeHolders (using RangeHolder.getRange()) within an XText.
     *
     * Note: since we only look at the ranges, this comparison is generally not consistent with
     * `equals` on the RangeHolders. Probably should not be used for key comparison in
     * TreeMap&lt;RangeHolder&gt; or Set&lt;RangeHolder&gt;
     *
     */

Note: TreeMap&lt;RangeHolder&gt; or Set&lt;RangeHolder&gt; is hard to read, but I believe javadoc /** */ expects it.
Is there a way to make the comment both readable and javadoc-compatible?

Maybe, like /* Object.equal */, the content of the "Note:" part it is expected to be well-known among java users,
thus superfluous.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HolderComparatorWithinPartition itself could be private as well.

Fair enough. If you aren't going to use it in a later PR.

Note: TreeMap<RangeHolder> or Set<RangeHolder> is hard to read, but I believe javadoc /** */ expects it.

What about {@code TreeMap<RangeHolder>} or {@code Set<RangeHolder>}?

Maybe, like /* Object.equal */, the content of the "Note:" part it is expected to be well-known among java users,
thus superfluous.

Kind of, but with /* Object.equal */, you are already saying that you are @Override an inherited method. I am also not sure that the concept of consistency with equals is that well-known X)

Perhaps say that the natural ordering isn't consistent with equals? I don't think it is likely to be an issue, and depending on what you are extending with RangeHolder it might not be true.

Comment on lines 42 to 44
throws
WrappedTargetException,
NoDocumentException {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: they are not thrown?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apparently not. Removed.

Question: is there an option or tool to discover such superfluous exception declarations?

Copy link
Member

@k3KAW8Pnf7mkmdSMPHz27 k3KAW8Pnf7mkmdSMPHz27 Jul 8, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is built into IntelliJ :/

Perhaps PMD? I haven't tried any except IntelliJ/CheckStyle. I think any code inspection tool should be able to find them (and a lot more).

Perhaps it is something we should look into adding to our checkstyle settings.

Comment on lines 63 to 65
if (positions.size() != inputSize) {
throw new IllegalStateException("visualSort: positions.size() != inputSize");
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This cannot happen? One element is added to positions for each element in inputs? Or is it thrown if there are changes in the document before the method finishes?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say it should not happen.
I think at some point I was losing positions corresponding to some inputs because
set below was a Set and reference marks in footnotes mapped to
the exact same coordinates (of the footnote marker), and the Set silently
ignored the duplicates.

UnoScreenRefresh.hasControllersLocked(doc) was another instance: in this case
the cursor position was not updated, and I think we got the same (wrong) position for
each range we wanted to test.

This cannot happen?

I hope it cannot. If it does, we have a problem.

Or is it thrown if there are changes in the document before the method finishes?

I cannot tell what could happen if the user changes the document or even just the cursor position
while we are trying to use it. Neither the documentation of gotoRange nor of getPosition discusses the possibility of failure. Nor does the getViewCursor documentation mentions it. Yet they can, and did fail,
and I was trying to program against observed (as opposed to documented) behaviour.

On the other hand we have two more checks on the size, probably the last one is enough to discover if there is a problem.

Removing the first two tests, keeping only if (result.size() != inputSize)

JabRef#7788 (review)

- more use of StringUtil.isNullOrEmpty
- private final XTextRangeCompare cmp;
- List<V> partition = partitions.computeIfAbsent(partitionKey, _key -> new ArrayList<>());
- visualSort does not throw WrappedTargetException, NoDocumentException
- set renamed to comparableMarks
antalk2 added a commit to antalk2/jabref that referenced this pull request Jul 9, 2021
JabRef#7788 (review)

- more use of StringUtil.isNullOrEmpty
- private final XTextRangeCompare cmp;
- List<V> partition = partitions.computeIfAbsent(partitionKey, _key -> new ArrayList<>());
- visualSort does not throw WrappedTargetException, NoDocumentException
- set renamed to comparableMarks
@Siedlerchr
Copy link
Member

Okay, in order to move forward I am merging this now

@Siedlerchr Siedlerchr merged commit b6a287f into JabRef:main Jul 12, 2021
antalk2 added a commit to antalk2/jabref that referenced this pull request Jul 13, 2021
JabRef#7788 (review)

- more use of StringUtil.isNullOrEmpty
- private final XTextRangeCompare cmp;
- List<V> partition = partitions.computeIfAbsent(partitionKey, _key -> new ArrayList<>());
- visualSort does not throw WrappedTargetException, NoDocumentException
- set renamed to comparableMarks
antalk2 added a commit to antalk2/jabref that referenced this pull request Jul 13, 2021
JabRef#7788 (review)

- more use of StringUtil.isNullOrEmpty
- private final XTextRangeCompare cmp;
- List<V> partition = partitions.computeIfAbsent(partitionKey, _key -> new ArrayList<>());
- visualSort does not throw WrappedTargetException, NoDocumentException
- set renamed to comparableMarks
antalk2 added a commit to antalk2/jabref that referenced this pull request Jul 13, 2021
JabRef#7788 (review)

- more use of StringUtil.isNullOrEmpty
- private final XTextRangeCompare cmp;
- List<V> partition = partitions.computeIfAbsent(partitionKey, _key -> new ArrayList<>());
- visualSort does not throw WrappedTargetException, NoDocumentException
- set renamed to comparableMarks
antalk2 added a commit to antalk2/jabref that referenced this pull request Jul 13, 2021
JabRef#7788 (review)

- more use of StringUtil.isNullOrEmpty
- private final XTextRangeCompare cmp;
- List<V> partition = partitions.computeIfAbsent(partitionKey, _key -> new ArrayList<>());
- visualSort does not throw WrappedTargetException, NoDocumentException
- set renamed to comparableMarks
antalk2 added a commit to antalk2/jabref that referenced this pull request Jul 13, 2021
JabRef#7788 (review)

- more use of StringUtil.isNullOrEmpty
- private final XTextRangeCompare cmp;
- List<V> partition = partitions.computeIfAbsent(partitionKey, _key -> new ArrayList<>());
- visualSort does not throw WrappedTargetException, NoDocumentException
- set renamed to comparableMarks
antalk2 added a commit to antalk2/jabref that referenced this pull request Jul 13, 2021
JabRef#7788 (review)

- more use of StringUtil.isNullOrEmpty
- private final XTextRangeCompare cmp;
- List<V> partition = partitions.computeIfAbsent(partitionKey, _key -> new ArrayList<>());
- visualSort does not throw WrappedTargetException, NoDocumentException
- set renamed to comparableMarks
Siedlerchr added a commit that referenced this pull request Jul 15, 2021
* upstream/main: (45 commits)
  Squashed 'buildres/csl/csl-styles/' changes from ec4a4c0..176997d (#7910)
  Update citeproc-java to 3.0.0-alpha.2 (#7911)
  Search in PDF Files (#2838)
  Removed references to apache commons logging (#7907)
  Oobranch c : ootext and rangesort (#7788)
  Bump jackson-datatype-jsr310 from 2.12.3 to 2.12.4 (#7901)
  fix markdownlint
  Bump jackson-dataformat-yaml from 2.12.3 to 2.12.4 (#7899)
  Bump postgresql from 42.2.22 to 42.2.23 (#7902)
  Bump classgraph from 4.8.109 to 4.8.110 (#7900)
  Bump gittools/actions from 0.9.9 to 0.9.10 (#7898)
  Bump flowless from 0.6.3 to 0.6.4 (#7903)
  Bump jsoup from 1.13.1 to 1.14.1 (#7904)
  Bump tika-core from 1.26 to 1.27 (#7897)
  Try even more empty lines to provoke conflicts in CHANGELOG.md after a release
  Fix position in CHANGELOG.md
  Add corporate proxy workaround for Version.getAllAvailableVersions() (#7890)
  Update to Java 16 in build.gradle (#7892)
  Preparing Changelog for the next release cycle
  New development cycle
  ...

# Conflicts:
#	gradle/wrapper/gradle-wrapper.properties
Siedlerchr pushed a commit that referenced this pull request Aug 2, 2021
* step0 : start model/openoffice, logic/openoffice/style

* correction: import order

* add general utilities

* add UNO utilities, move CreationException, NoDocumentException

* Xlint:unchecked model/openoffice/util

* add ootext

* add rangesort

* add compareStartsUnsafe, compareStartsThenEndsUnsafe

* add Tuple3

* add ootext

* add rangesort

* delNamesArray size correction

* rangeSort update

* cleanup

* style additions

* checkstyle on tests

* add missing message

* ootext changes from improve-reversibility-rebased-03

* rangesort changes from improve-reversibility-rebased-03

* rangesort update from improve-reversibility-rebased-03

add comment on RangeSet.add costs
use UnoTextRange.compareXXXUnsafe

* use longer lines in comments

* propagate changes from improve-reversibility-rebased-03

* deleted    src/main/java/org/jabref/model/openoffice/rangesort/RangeSet.java

* deleted    src/main/java/org/jabref/model/openoffice/rangesort/RangeSet.java

* use StringUtil.isNullOrEmpty

* no natural sort for ComparableMark

* in response to review

#7788 (review)

- more use of StringUtil.isNullOrEmpty
- private final XTextRangeCompare cmp;
- List<V> partition = partitions.computeIfAbsent(partitionKey, _key -> new ArrayList<>());
- visualSort does not throw WrappedTargetException, NoDocumentException
- set renamed to comparableMarks

* use {@code }, PMD suggestions

* update model/style from improve-reversibility-rebased-03

* update logic/style from improve-reversibility-rebased-03

* replaced single-character names in OOBibStyle.java (in changed part)

* some longer names in OOBibStyleGetCitationMarker.java

* drop normalizePageInfos, use 'preferred' and 'fallback' in getAuthorLastSeparatorInTextWithFallBack

* checkstyle

* use putIfAbsent

* use "{}" with LOGGER

* use Objects.hash and Objects.equals in CitationLookupResult

* simplified CitedKey.getBibEntry

* more use of "{}" in LOGGER

* Citation.lookup: use streams

* Citation.lookup: Optional::get before findFirst
Siedlerchr pushed a commit that referenced this pull request Aug 21, 2021
* step0 : start model/openoffice, logic/openoffice/style

* correction: import order

* add general utilities

* add UNO utilities, move CreationException, NoDocumentException

* Xlint:unchecked model/openoffice/util

* add ootext

* add rangesort

* add compareStartsUnsafe, compareStartsThenEndsUnsafe

* add Tuple3

* add ootext

* add rangesort

* delNamesArray size correction

* rangeSort update

* cleanup

* style additions

* add backend

* checkstyle on tests

* add missing message

* add backend

* apply  oobranch-D-update.patch

* apply  oobranch-E-update.patch

* deleted    src/main/java/org/jabref/model/openoffice/rangesort/RangeSet.java

* use StringUtil.isNullOrEmpty

* no natural sort for ComparableMark

* in response to review

#7788 (review)

- more use of StringUtil.isNullOrEmpty
- private final XTextRangeCompare cmp;
- List<V> partition = partitions.computeIfAbsent(partitionKey, _key -> new ArrayList<>());
- visualSort does not throw WrappedTargetException, NoDocumentException
- set renamed to comparableMarks

* use {@code }, PMD suggestions

* update logic/style from improve-reversibility-rebased-03

* update model/style from improve-reversibility-rebased-03

* replaced single-character names in OOBibStyle.java (in changed part)

* some longer names in OOBibStyleGetCitationMarker.java

* drop normalizePageInfos, use 'preferred' and 'fallback' in getAuthorLastSeparatorInTextWithFallBack

* checkstyle

* use putIfAbsent

* use "{}" with LOGGER

* use Objects.hash and Objects.equals in CitationLookupResult

* simplified CitedKey.getBibEntry

* more use of "{}" in LOGGER

* more use of "{}" in LOGGER

* Citation.lookup: use streams

* Citation.lookup: Optional::get before findFirst

* putIfAbsent returns null for new entry

* What is 52 in Backend52

* apply 2021-08-20-a/oobranch-E-update.patch

Brings oobranch-E up to
89b0968 @ origin/improve-reversibility-rebased-03 Merge remote-tracking branch 'upstream/main' into improve-reversibility-rebased-03

* putIfAbsent returns null for new entry

* What is 52 in Backend52

* using orElseThrow

* using StringBuilder

* refMarkName renamed to markName

* import StringBuilder is not needed

* orElseThrow correction (now without message)

* update

* orElseThrow correction

* renamed cg to group

* drop message not understandable by end user

* reorganized reference mark name generation

In Backend52:
- use a single expression
- expand comment
- rename refMarkName to markName

Collectors.joining(",") moved to Codec52.getUniqueMarkName

* renamed nCitations to numberOfCitations and totalCitations

* format

* insert dummy case JabRef60: branch

* indent case-label in model/style

* indent case-label in logic/backend

* indent case-label in model/ootext

* rname cgPageInfos tro pageInfos

* renamed cgPageInfo to singlePageInfo

* replace Collectors.toSet() with new HashSet<>()

* use method reference

* drop two comments

* use String.join

* remove nr/nrm prefixes from NamedRange and NamedRangeManager methods

* align dots
Siedlerchr pushed a commit that referenced this pull request Nov 14, 2021
* step0 : start model/openoffice, logic/openoffice/style

* correction: import order

* add general utilities

* add UNO utilities, move CreationException, NoDocumentException

* Xlint:unchecked model/openoffice/util

* add ootext

* add rangesort

* add compareStartsUnsafe, compareStartsThenEndsUnsafe

* add Tuple3

* add ootext

* add rangesort

* delNamesArray size correction

* rangeSort update

* cleanup

* style additions

* add backend

* add frontend

* add actions

* checkstyle on tests

* add missing message

* add backend

* add frontend

* add actions

* apply oobranch-[DEFG]-update.patch

* not using RangeSet

* use StringUtil.isNullOrEmpty

* no natural sort for ComparableMark

* in response to review

#7788 (review)

- more use of StringUtil.isNullOrEmpty
- private final XTextRangeCompare cmp;
- List<V> partition = partitions.computeIfAbsent(partitionKey, _key -> new ArrayList<>());
- visualSort does not throw WrappedTargetException, NoDocumentException
- set renamed to comparableMarks

* use {@code }, PMD suggestions

* update logic/style from improve-reversibility-rebased-03

* update model/style from improve-reversibility-rebased-03

* replaced single-character names in OOBibStyle.java (in changed part)

* some longer names in OOBibStyleGetCitationMarker.java

* drop normalizePageInfos, use 'preferred' and 'fallback' in getAuthorLastSeparatorInTextWithFallBack

* checkstyle

* use putIfAbsent

* use "{}" with LOGGER

* use Objects.hash and Objects.equals in CitationLookupResult

* simplified CitedKey.getBibEntry

* more use of "{}" in LOGGER

* more use of "{}" in LOGGER

* more use of "{}" in LOGGER

* Citation.lookup: use streams

* Citation.lookup: Optional::get before findFirst

* putIfAbsent returns null for new entry

* What is 52 in Backend52

* apply 2021-08-20-a/oobranch-E-update.patch

Brings oobranch-E up to
89b0968 @ origin/improve-reversibility-rebased-03 Merge remote-tracking branch 'upstream/main' into improve-reversibility-rebased-03

* sync to improve-reversibility-rebased-03 cb13256

commit cb13256 (HEAD -> improve-reversibility-rebased-03, origin/improve-reversibility-rebased-03)
Author: Antal K <antalk2@gmail.com>
Date:   Fri Aug 20 11:39:39 2021 +0200

    align dots

* longer name

* follow some PMD suggestions

* apply suggested changes
Siedlerchr added a commit that referenced this pull request Mar 11, 2022
* step0 : start model/openoffice, logic/openoffice/style

* correction: import order

* add general utilities

* add UNO utilities, move CreationException, NoDocumentException

* Xlint:unchecked model/openoffice/util

* add ootext

* add rangesort

* add compareStartsUnsafe, compareStartsThenEndsUnsafe

* add Tuple3

* add ootext

* add rangesort

* delNamesArray size correction

* rangeSort update

* cleanup

* style additions

* add backend

* add frontend

* add actions

* add gui stuff

* integrate

* cleanup

* checkstyle on tests

* add missing message

* add backend

* add frontend

* add actions

* add gui stuff

* integrate

* cleanup

* remove duplicate

* apply oobranch-[DEFGH]-update.patch

* apply oobranch-[DEFGH]-update.patch

* not using RangeSet

* not using RangeSet

* not using RangeSet

* merged

* cleanup

* remove duplicate

* toString

* add docs/openoffice

* markdown-lint

* use StringUtil.isNullOrEmpty

* no natural sort for ComparableMark

* in response to review

#7788 (review)

- more use of StringUtil.isNullOrEmpty
- private final XTextRangeCompare cmp;
- List<V> partition = partitions.computeIfAbsent(partitionKey, _key -> new ArrayList<>());
- visualSort does not throw WrappedTargetException, NoDocumentException
- set renamed to comparableMarks

* use {@code }, PMD suggestions

* use StringUtil.isNullOrEmpty

* no natural sort for ComparableMark

* in response to review

#7788 (review)

- more use of StringUtil.isNullOrEmpty
- private final XTextRangeCompare cmp;
- List<V> partition = partitions.computeIfAbsent(partitionKey, _key -> new ArrayList<>());
- visualSort does not throw WrappedTargetException, NoDocumentException
- set renamed to comparableMarks

* use {@code }, PMD suggestions

* update logic/style from improve-reversibility-rebased-03

* update model/style from improve-reversibility-rebased-03

* update logic/style from improve-reversibility-rebased-03

* update model/style from improve-reversibility-rebased-03

* replaced single-character names in OOBibStyle.java (in changed part)

* some longer names in OOBibStyleGetCitationMarker.java

* drop normalizePageInfos, use 'preferred' and 'fallback' in getAuthorLastSeparatorInTextWithFallBack

* checkstyle

* use putIfAbsent

* use "{}" with LOGGER

* use Objects.hash and Objects.equals in CitationLookupResult

* simplified CitedKey.getBibEntry

* replaced single-character names in OOBibStyle.java (in changed part)

* some longer names in OOBibStyleGetCitationMarker.java

* OOBibStyle

* checkstyle

* use putIfAbsent

* use "{}" with LOGGER

* use Objects.hash and Objects.equals in CitationLookupResult

* simplified CitedKey.getBibEntry

* drop import StringUtil

* drop import ArrayList

* more use of "{}" in LOGGER

* more use of "{}" in LOGGER

* more use of "{}" in LOGGER

* more use of "{}" in LOGGER

* more use of "{}" in LOGGER

* more use of "{}" in LOGGER

* Citation.lookup: use streams

* Citation.lookup: use streams

* Citation.lookup: Optional::get before findFirst

* Citation.lookup: Optional::get before findFirst

* removed catch RuntimeException around UnoCursor.getViewCursor

Apparently cannot throw here.
NoDocumentException is caught elsewhere, before we get here.
com.sun.star.uno.RuntimeException is caught below, for cursor.getStart();

* removed catch RuntimeException around UnoCursor.getViewCursor

Apparently cannot throw here.
NoDocumentException is caught elsewhere, before we get here.
com.sun.star.uno.RuntimeException is caught below, for cursor.getStart();

* drop unused message

* drop unused message

* putIfAbsent returns null for new entry

* putIfAbsent returns null for new entry

* What is 52 in Backend52

* What is 52 in Backend52

* apply 2021-08-20-a/oobranch-E-update.patch

Brings oobranch-E up to
89b0968 @ origin/improve-reversibility-rebased-03 Merge remote-tracking branch 'upstream/main' into improve-reversibility-rebased-03

* apply 2021-08-20-a/oobranch-E-update.patch

Brings oobranch-E up to
89b0968 @ origin/improve-reversibility-rebased-03 Merge remote-tracking branch 'upstream/main' into improve-reversibility-rebased-03

* sync to improve-reversibility-rebased-03 cb13256

commit cb13256 (HEAD -> improve-reversibility-rebased-03, origin/improve-reversibility-rebased-03)
Author: Antal K <antalk2@gmail.com>
Date:   Fri Aug 20 11:39:39 2021 +0200

    align dots

* sync to improve-reversibility-rebased-03 cb13256

commit cb13256 (HEAD -> improve-reversibility-rebased-03, origin/improve-reversibility-rebased-03)
Author: Antal K <antalk2@gmail.com>
Date:   Fri Aug 20 11:39:39 2021 +0200

    align dots

* longer name

* follow some PMD suggestions

* follow some PMD suggestions

* apply suggested changes

* fixed merge errors

* reformatted

* autoreformatted all oo packages, smaller rewordings, few ide suggestions

* autoreformatted all oo tests, fixed l10n, applied small ide suggestions

* Applied some ide suggestions, reworded some variables, reworded-removed-reformatted some comments

* Changed File to Path

Co-authored-by: Christoph <siedlerkiller@gmail.com>

Co-authored-by: Carl Christian Snethlage <50491877+calixtus@users.noreply.github.com>
Co-authored-by: Christoph <siedlerkiller@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants