Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
com.acrolinx.sidebar.pojo.document.AcrolinxMatchWithReplacement Maven / Gradle / Ivy
/* Copyright (c) 2018 Acrolinx GmbH */
package com.acrolinx.sidebar.pojo.document;
import com.acrolinx.sidebar.pojo.document.externalcontent.ExternalContentMatch;
import java.util.List;
public class AcrolinxMatchWithReplacement extends AcrolinxMatch {
private String replacement;
public AcrolinxMatchWithReplacement(String content, IntRange intRange, String replacement) {
super(intRange, content);
this.replacement = replacement;
}
public AcrolinxMatchWithReplacement(
String content,
IntRange intRange,
String replacement,
List externalContentMatches) {
super(intRange, content, externalContentMatches);
this.replacement = replacement;
}
public AcrolinxMatchWithReplacement(
IntRange intRange, IntRange extractedRange, String content, String replacement) {
super(intRange, extractedRange, content);
this.replacement = replacement;
}
public AcrolinxMatchWithReplacement(
IntRange intRange,
IntRange extractedRange,
String content,
String replacement,
List externalContentMatches) {
super(intRange, extractedRange, content, externalContentMatches);
this.replacement = replacement;
}
public String getReplacement() {
return replacement;
}
@Override
public AcrolinxMatch setRange(IntRange intRange) {
if (getExtractedRange() != null) {
int minRange = super.getExtractedRange().getMinimumInteger();
int maxRange = super.getExtractedRange().getMaximumInteger();
if (this.getExternalContentMatches() != null) {
return new AcrolinxMatchWithReplacement(
intRange,
new IntRange(minRange, maxRange),
getContent(),
replacement,
this.getExternalContentMatches());
}
return new AcrolinxMatchWithReplacement(
intRange, new IntRange(minRange, maxRange), getContent(), replacement);
}
if (this.getExternalContentMatches() != null) {
return new AcrolinxMatchWithReplacement(
getContent(), intRange, replacement, this.getExternalContentMatches());
}
return new AcrolinxMatchWithReplacement(getContent(), intRange, replacement);
}
public AcrolinxMatchWithReplacement setReplacement(String replacement) {
int rangeMin = getRange().getMinimumInteger();
int rangeMax = getRange().getMaximumInteger();
IntRange intRange = new IntRange(rangeMin, rangeMax);
if (getExtractedRange() != null) {
int minRange = super.getExtractedRange().getMinimumInteger();
int maxRange = super.getExtractedRange().getMaximumInteger();
if (this.getExternalContentMatches() != null) {
return new AcrolinxMatchWithReplacement(
intRange,
new IntRange(minRange, maxRange),
getContent(),
replacement,
this.getExternalContentMatches());
}
return new AcrolinxMatchWithReplacement(
intRange, new IntRange(minRange, maxRange), getContent(), replacement);
}
if (this.getExternalContentMatches() != null) {
return new AcrolinxMatchWithReplacement(
getContent(), intRange, replacement, this.getExternalContentMatches());
}
return new AcrolinxMatchWithReplacement(getContent(), intRange, replacement);
}
@Override
public AcrolinxMatchWithReplacement copy() {
int rangeMin = getRange().getMinimumInteger();
int rangeMax = getRange().getMaximumInteger();
String content = getContent();
IntRange intRange = new IntRange(rangeMin, rangeMax);
if (getExtractedRange() != null) {
int minRange = super.getExtractedRange().getMinimumInteger();
int maxRange = super.getExtractedRange().getMaximumInteger();
if (this.getExternalContentMatches() != null) {
final List externalContentMatches = this.getExternalContentMatches();
return new AcrolinxMatchWithReplacement(
intRange,
new IntRange(minRange, maxRange),
getContent(),
getReplacement(),
externalContentMatches);
}
return new AcrolinxMatchWithReplacement(
intRange, new IntRange(minRange, maxRange), getContent(), getReplacement());
}
if (this.getExternalContentMatches() != null) {
final List externalContentMatches = this.getExternalContentMatches();
return new AcrolinxMatchWithReplacement(
content, intRange, getReplacement(), externalContentMatches);
}
return new AcrolinxMatchWithReplacement(content, intRange, getReplacement());
}
}