com.strider.datadefender.discoverer.Probability   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 13
c 0
b 0
f 0
dl 0
loc 24
ccs 0
cts 9
cp 0
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getSentence() 0 2 1
A getProbabilityValue() 0 2 1
A Probability(String,Double) 0 3 1
A compare() 0 3 1
1
/*
2
 *
3
 * Copyright 2014-2020, Armenak Grigoryan, and individual contributors as indicated
4
 * by the @authors tag. See the copyright.txt in the distribution for a
5
 * full listing of individual contributors.
6
 *
7
 * This is free software; you can redistribute it and/or modify it
8
 * under the terms of the GNU Lesser General Public License as
9
 * published by the Free Software Foundation; either version 2.1 of
10
 * the License, or (at your option) any later version.
11
 *
12
 * This software is distributed in the hope that it will be useful,
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
 * Lesser General Public License for more details.
16
 *
17
 */
18
19
package com.strider.datadefender.discoverer;
20
21
import java.util.Comparator;
22
23
/**
24
 * This class represents the probability of sentence in database column
25
 * 
26
 * @author Armenak Grigoryan
27
 */
28
public class Probability {
29
    private final String sentence;
30
    private final Double probabilityValue;
31
32
    public Probability(final String sentence, final Double probabilityValue) {
33
        this.sentence         = sentence;
34
        this.probabilityValue = probabilityValue;
35
    }
36
37
    public Double getProbabilityValue() {
38
        return this.probabilityValue;
39
    }
40
41
    public String getSentence() {
42
        return this.sentence;
43
    }
44
45
    /**
46
     * @return comparator used for sorting
47
     */
48
49
  public static Comparator<Probability> compare() {
50
      return Comparator.comparing(Probability::getSentence)
51
              .thenComparing(Probability::getProbabilityValue);            
52
  }    
53
}
54