-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathLabel.java
More file actions
51 lines (45 loc) · 1.76 KB
/
Label.java
File metadata and controls
51 lines (45 loc) · 1.76 KB
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
package org.variantsync.diffdetective.variation;
import java.util.List;
import org.variantsync.diffdetective.util.Assert;
import org.variantsync.diffdetective.variation.diff.Time;
import org.variantsync.diffdetective.variation.diff.VariationDiff; // For Javadoc
import org.variantsync.diffdetective.variation.tree.VariationTree; // For Javadoc
/**
* Base interface for labels of {@link VariationTree}s and {@link VariationDiff}s.
*/
public interface Label {
/**
* Returns the lines which need to be printed before the children of a node.
* Most lines associated with a node should be included in this list, for example, {@code #if}s are stored here.
*/
List<String> getLines();
/**
* Returns the lines which need to be printed after the children of a node.
* For example, {@code #endif}s are stored as trailing lines.
*/
List<String> getTrailingLines();
/**
* Returns a deep copy where the state that is only valid at {@code time} is set to its default
* value. Note that not all implementations need to have time dependent state.
*
* @see withTimeDependentStateFrom
*/
default Label withoutTimeDependentState(Time time) {
return this.clone();
}
/**
* Returns a deep copy where the state that is only valid at {@code time} is copied from
* {@code other}. All time independent state must be equal in {@code this} and {@code other}.
* Note that not all implementations need to have time dependent state.
*
* @see withoutTimeDependentState
*/
default Label withTimeDependentStateFrom(Label other, Time time) {
Assert.assertEquals(this, other);
return this.clone();
}
/**
* Creates a deep copy of this label.
*/
Label clone();
}