Sho SHIMIZU

Rename to avoid confusion with values and values()

Change-Id: I6e4d4bad0300790207a17bb934d1771175a01efa
...@@ -37,7 +37,7 @@ import java.util.stream.Collectors; ...@@ -37,7 +37,7 @@ import java.util.stream.Collectors;
37 final class EncodableDiscreteResources implements DiscreteResources { 37 final class EncodableDiscreteResources implements DiscreteResources {
38 private static final Codecs CODECS = Codecs.getInstance(); 38 private static final Codecs CODECS = Codecs.getInstance();
39 private final DiscreteResource parent; 39 private final DiscreteResource parent;
40 - private final Map<Class<?>, EncodedDiscreteResources> values; 40 + private final Map<Class<?>, EncodedDiscreteResources> map;
41 41
42 private static Class<?> getClass(DiscreteResource resource) { 42 private static Class<?> getClass(DiscreteResource resource) {
43 return resource.valueAs(Object.class).map(Object::getClass).get(); 43 return resource.valueAs(Object.class).map(Object::getClass).get();
...@@ -65,22 +65,22 @@ final class EncodableDiscreteResources implements DiscreteResources { ...@@ -65,22 +65,22 @@ final class EncodableDiscreteResources implements DiscreteResources {
65 return new EncodableDiscreteResources(parent, values); 65 return new EncodableDiscreteResources(parent, values);
66 } 66 }
67 67
68 - private EncodableDiscreteResources(DiscreteResource parent, Map<Class<?>, EncodedDiscreteResources> values) { 68 + private EncodableDiscreteResources(DiscreteResource parent, Map<Class<?>, EncodedDiscreteResources> map) {
69 this.parent = parent; 69 this.parent = parent;
70 - this.values = values; 70 + this.map = map;
71 } 71 }
72 72
73 // for serializer 73 // for serializer
74 private EncodableDiscreteResources() { 74 private EncodableDiscreteResources() {
75 this.parent = null; 75 this.parent = null;
76 - this.values = null; 76 + this.map = null;
77 } 77 }
78 78
79 @Override 79 @Override
80 public Optional<DiscreteResource> lookup(DiscreteResourceId id) { 80 public Optional<DiscreteResource> lookup(DiscreteResourceId id) {
81 DiscreteResource resource = Resources.discrete(id).resource(); 81 DiscreteResource resource = Resources.discrete(id).resource();
82 Class<?> cls = getClass(resource); 82 Class<?> cls = getClass(resource);
83 - return Optional.ofNullable(values.get(cls)) 83 + return Optional.ofNullable(map.get(cls))
84 .filter(x -> x.contains(resource)) 84 .filter(x -> x.contains(resource))
85 .map(x -> resource); 85 .map(x -> resource);
86 } 86 }
...@@ -98,7 +98,7 @@ final class EncodableDiscreteResources implements DiscreteResources { ...@@ -98,7 +98,7 @@ final class EncodableDiscreteResources implements DiscreteResources {
98 98
99 @Override 99 @Override
100 public boolean isEmpty() { 100 public boolean isEmpty() {
101 - return values.values().stream() 101 + return map.values().stream()
102 .allMatch(x -> x.isEmpty()); 102 .allMatch(x -> x.isEmpty());
103 } 103 }
104 104
...@@ -120,14 +120,14 @@ final class EncodableDiscreteResources implements DiscreteResources { ...@@ -120,14 +120,14 @@ final class EncodableDiscreteResources implements DiscreteResources {
120 120
121 @Override 121 @Override
122 public Set<DiscreteResource> values() { 122 public Set<DiscreteResource> values() {
123 - return values.values().stream() 123 + return map.values().stream()
124 .flatMap(x -> x.values(parent.id()).stream()) 124 .flatMap(x -> x.values(parent.id()).stream())
125 .collect(Collectors.toCollection(LinkedHashSet::new)); 125 .collect(Collectors.toCollection(LinkedHashSet::new));
126 } 126 }
127 127
128 @Override 128 @Override
129 public <T> Set<DiscreteResource> valuesOf(Class<T> cls) { 129 public <T> Set<DiscreteResource> valuesOf(Class<T> cls) {
130 - return Optional.ofNullable(values.get(cls)) 130 + return Optional.ofNullable(map.get(cls))
131 .map(x -> x.values(parent.id())) 131 .map(x -> x.values(parent.id()))
132 .orElse(ImmutableSet.of()); 132 .orElse(ImmutableSet.of());
133 } 133 }
...@@ -137,12 +137,12 @@ final class EncodableDiscreteResources implements DiscreteResources { ...@@ -137,12 +137,12 @@ final class EncodableDiscreteResources implements DiscreteResources {
137 } 137 }
138 138
139 Map<Class<?>, EncodedDiscreteResources> rawValues() { 139 Map<Class<?>, EncodedDiscreteResources> rawValues() {
140 - return values; 140 + return map;
141 } 141 }
142 142
143 @Override 143 @Override
144 public int hashCode() { 144 public int hashCode() {
145 - return Objects.hash(parent, values); 145 + return Objects.hash(parent, map);
146 } 146 }
147 147
148 @Override 148 @Override
...@@ -155,7 +155,7 @@ final class EncodableDiscreteResources implements DiscreteResources { ...@@ -155,7 +155,7 @@ final class EncodableDiscreteResources implements DiscreteResources {
155 } 155 }
156 final EncodableDiscreteResources other = (EncodableDiscreteResources) obj; 156 final EncodableDiscreteResources other = (EncodableDiscreteResources) obj;
157 return Objects.equals(this.parent, other.parent) 157 return Objects.equals(this.parent, other.parent)
158 - && Objects.equals(this.values, other.values); 158 + && Objects.equals(this.map, other.map);
159 } 159 }
160 160
161 @Override 161 @Override
......