Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SAT4J
sat4j
Commits
79ee6a46
Commit
79ee6a46
authored
Nov 10, 2018
by
Daniel Le Berre
Browse files
Fixes a few sonarqube violations.
parent
f3c86d8b
Changes
4
Hide whitespace changes
Inline
Side-by-side
org.sat4j.core/src/main/java/org/sat4j/minisat/constraints/cnf/BinaryClause.java
View file @
79ee6a46
...
...
@@ -49,8 +49,8 @@ import org.sat4j.specs.VarMapper;
* @author leberre
* @since 2.1
*/
public
abstract
class
BinaryClause
implements
Propagatable
,
Constr
,
Serializable
{
public
abstract
class
BinaryClause
implements
Propagatable
,
Constr
,
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
...
...
@@ -108,7 +108,8 @@ public abstract class BinaryClause implements Propagatable, Constr,
* @see Constr#simplify(Solver)
*/
public
boolean
simplify
()
{
if
(
this
.
voc
.
isSatisfied
(
this
.
head
)
||
this
.
voc
.
isSatisfied
(
this
.
tail
))
{
if
(
this
.
voc
.
isSatisfied
(
this
.
head
)
||
this
.
voc
.
isSatisfied
(
this
.
tail
))
{
return
true
;
}
return
false
;
...
...
@@ -220,6 +221,9 @@ public abstract class BinaryClause implements Propagatable, Constr,
if
(
obj
==
null
)
{
return
false
;
}
if
(
this
.
getClass
()
!=
obj
.
getClass
())
{
return
false
;
}
try
{
BinaryClause
wcl
=
(
BinaryClause
)
obj
;
if
(
wcl
.
head
!=
this
.
head
||
wcl
.
tail
!=
this
.
tail
)
{
...
...
@@ -233,7 +237,7 @@ public abstract class BinaryClause implements Propagatable, Constr,
@Override
public
int
hashCode
()
{
long
sum
=
this
.
head
+
this
.
tail
;
long
sum
=
(
long
)
this
.
head
+
this
.
tail
;
return
(
int
)
sum
/
2
;
}
...
...
org.sat4j.core/src/main/java/org/sat4j/minisat/constraints/cnf/HTClause.java
View file @
79ee6a46
...
...
@@ -128,7 +128,8 @@ public abstract class HTClause implements Propagatable, Constr, Serializable {
* @see Constr#simplify(Solver)
*/
public
boolean
simplify
()
{
if
(
this
.
voc
.
isSatisfied
(
this
.
head
)
||
this
.
voc
.
isSatisfied
(
this
.
tail
))
{
if
(
this
.
voc
.
isSatisfied
(
this
.
head
)
||
this
.
voc
.
isSatisfied
(
this
.
tail
))
{
return
true
;
}
for
(
int
middleLit
:
this
.
middleLits
)
{
...
...
@@ -273,6 +274,8 @@ public abstract class HTClause implements Propagatable, Constr, Serializable {
if
(
obj
==
null
)
{
return
false
;
}
if
(
this
.
getClass
()
!=
obj
.
getClass
())
return
false
;
try
{
HTClause
wcl
=
(
HTClause
)
obj
;
if
(
wcl
.
head
!=
this
.
head
||
wcl
.
tail
!=
this
.
tail
)
{
...
...
@@ -302,7 +305,7 @@ public abstract class HTClause implements Propagatable, Constr, Serializable {
@Override
public
int
hashCode
()
{
long
sum
=
this
.
head
+
this
.
tail
;
long
sum
=
(
long
)
this
.
head
+
this
.
tail
;
for
(
int
p
:
this
.
middleLits
)
{
sum
+=
p
;
}
...
...
org.sat4j.core/src/main/java/org/sat4j/minisat/constraints/cnf/WLClause.java
View file @
79ee6a46
...
...
@@ -245,6 +245,9 @@ public abstract class WLClause implements Propagatable, Constr, Serializable {
if
(
obj
==
null
)
{
return
false
;
}
if
(
this
.
getClass
()
!=
obj
.
getClass
())
{
return
false
;
}
try
{
WLClause
wcl
=
(
WLClause
)
obj
;
if
(
this
.
lits
.
length
!=
wcl
.
lits
.
length
)
{
...
...
org.sat4j.core/src/main/java/org/sat4j/minisat/core/SizeComparator.java
View file @
79ee6a46
...
...
@@ -51,10 +51,10 @@ public class SizeComparator implements Comparator<Constr>, Serializable {
* @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
*/
public
int
compare
(
Constr
c1
,
Constr
c2
)
{
long
delta
=
c1
.
size
()
-
c2
.
size
();
int
delta
=
c1
.
size
()
-
c2
.
size
();
if
(
delta
==
0
)
{
return
(
int
)
Math
.
round
(
c2
.
getActivity
()
-
c1
.
getActivity
());
}
return
(
int
)
delta
;
return
delta
;
}
}
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment