Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions atf-application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,53 @@
</dependency>
</dependencies>
</plugin>

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>3.0.5</version>
<configuration>
<effort>Max</effort>
<!-- Reports all bugs (other values are medium and max) -->
<threshold>medium</threshold>
<!-- Produces XML report -->
<xmlOutput>true</xmlOutput>
<omitVisitors>FindReturnRef,RuntimeExceptionCapture</omitVisitors>
</configuration>
<executions>
<execution>
<id>analyze-compile</id>
<phase>compile</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
<!--<plugin>-->
<!--<groupId>org.apache.maven.plugins</groupId>-->
<!--<artifactId>maven-pmd-plugin</artifactId>-->
<!--<version>3.12.0</version>-->
<!--<configuration>-->
<!--&lt;!&ndash;<linkXRef>true</linkXRef>&ndash;&gt;-->
<!--<sourceEncoding>UTF-8</sourceEncoding>-->
<!--<minimumTokens>30</minimumTokens>-->
<!--<targetJdk>1.8</targetJdk>-->
<!--<verbose>true</verbose>-->
<!--</configuration>-->
<!--<executions>-->
<!--<execution>-->
<!--<id>analyze-compile</id>-->
<!--<phase>compile</phase>-->
<!--<goals>-->
<!--<goal>pmd</goal>-->
<!--&lt;!&ndash;<goal>cpd</goal>&ndash;&gt;-->
<!--&lt;!&ndash;<goal>cpd-check</goal>&ndash;&gt;-->
<!--<goal>check</goal>-->
<!--</goals>-->
<!--</execution>-->
<!--</executions>-->
<!--</plugin>-->
</plugins>
</build>
<profiles>
Expand Down
196 changes: 99 additions & 97 deletions atf-application/src/main/java/ru/bsc/test/autotester/diff/Diff.java
Original file line number Diff line number Diff line change
@@ -1,97 +1,99 @@
/*
* Diff Match and Patch
* Copyright 2018 The diff-match-patch Authors.
* https://github.com/google/diff-match-patch
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package ru.bsc.test.autotester.diff;

/**
* Class representing one diff operation.
*/
@SuppressWarnings("all")
public class Diff {
/**
* One of: INSERT, DELETE or EQUAL.
*/
public Operation operation;
/**
* The text associated with this diff operation.
*/
public String text;

/**
* Constructor. Initializes the diff with the provided values.
* @param operation One of INSERT, DELETE or EQUAL.
* @param text The text being applied.
*/
public Diff(Operation operation, String text) {
// Construct a diff with the specified operation and text.
this.operation = operation;
this.text = text;
}

/**
* Display a human-readable version of this Diff.
* @return text version.
*/
public String toString() {
String prettyText = this.text.replace('\n', '\u00b6');
return "Diff(" + this.operation + ",\"" + prettyText + "\")";
}

/**
* Create a numeric hash value for a Diff.
* This function is not used by DMP.
* @return Hash value.
*/
@Override
public int hashCode() {
final int prime = 31;
int result = (operation == null) ? 0 : operation.hashCode();
result += prime * ((text == null) ? 0 : text.hashCode());
return result;
}

/**
* Is this Diff equivalent to another Diff?
* @param obj Another Diff to compare against.
* @return true or false.
*/
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
Diff other = (Diff) obj;
if (operation != other.operation) {
return false;
}
if (text == null) {
if (other.text != null) {
return false;
}
} else if (!text.equals(other.text)) {
return false;
}
return true;
}
}
/*
* Diff Match and Patch
* Copyright 2018 The diff-match-patch Authors.
* https://github.com/google/diff-match-patch
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package ru.bsc.test.autotester.diff;

import java.io.Serializable;

/**
* Class representing one diff operation.
*/
@SuppressWarnings("all")
public class Diff implements Serializable {
/**
* One of: INSERT, DELETE or EQUAL.
*/
public Operation operation;
/**
* The text associated with this diff operation.
*/
public String text;

/**
* Constructor. Initializes the diff with the provided values.
* @param operation One of INSERT, DELETE or EQUAL.
* @param text The text being applied.
*/
public Diff(Operation operation, String text) {
// Construct a diff with the specified operation and text.
this.operation = operation;
this.text = text;
}

/**
* Display a human-readable version of this Diff.
* @return text version.
*/
public String toString() {
String prettyText = this.text.replace('\n', '\u00b6');
return "Diff(" + this.operation + ",\"" + prettyText + "\")";
}

/**
* Create a numeric hash value for a Diff.
* This function is not used by DMP.
* @return Hash value.
*/
@Override
public int hashCode() {
final int prime = 31;
int result = (operation == null) ? 0 : operation.hashCode();
result += prime * ((text == null) ? 0 : text.hashCode());
return result;
}

/**
* Is this Diff equivalent to another Diff?
* @param obj Another Diff to compare against.
* @return true or false.
*/
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
Diff other = (Diff) obj;
if (operation != other.operation) {
return false;
}
if (text == null) {
if (other.text != null) {
return false;
}
} else if (!text.equals(other.text)) {
return false;
}
return true;
}
}
Loading