blob: 1346fc9de7f74ac9cc1261ebdc1700a60881a0e8 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.prelude.query;
/**
* Common implementation for Item classes implementing the TaggableItem interface.
* Note that this file exist in 3 copies that should be kept in sync:
*
* CompositeTaggableItem.java
* SimpleTaggableItem.java
* TaggableSegmentItem.java
*
* These should only have trivial differences.
* (multiple inheritance or mixins would have been nice).
*
* @author arnej27959
*/
public abstract class TaggableSegmentItem extends SegmentItem implements TaggableItem {
protected TaggableSegmentItem(String rawWord, String current, boolean isFromQuery, boolean stemmed, Substring origin) {
super(rawWord, current, isFromQuery, stemmed, origin);
}
public int getUniqueID() {
return uniqueID;
}
public void setUniqueID(int id) {
setHasUniqueID(true);
uniqueID = id;
}
/** See {@link TaggableItem#setConnectivity} */
public void setConnectivity(Item item, double connectivity) {
setHasUniqueID(true);
item.setHasUniqueID(true);
if (connectedItem != null) {
// untangle old connectivity
connectedItem.connectedBacklink = null;
}
this.connectivity = connectivity;
connectedItem = item;
connectedItem.connectedBacklink = this;
}
public Item getConnectedItem() {
return connectedItem;
}
public double getConnectivity() {
return connectivity;
}
public void setSignificance(double significance) {
setHasUniqueID(true);
setExplicitSignificance(true);
this.significance = significance;
}
public void setExplicitSignificance(boolean explicitSignificance) {
this.explicitSignificance = explicitSignificance;
}
public boolean hasExplicitSignificance() {
return explicitSignificance;
}
public double getSignificance() {
return significance;
}
//Change access privilege from protected to public.
public boolean hasUniqueID() {
return super.hasUniqueID();
}
}
|