@@ -96,33 +96,34 @@ default void setAll(T value) {
96
96
}
97
97
}
98
98
99
- default List <T > rayCast (MatrixPosition position , Direction direction ) {
99
+ default List <Matrix . Entry < T > > rayCast (MatrixPosition position , Direction direction ) {
100
100
return rayCast (position , direction , Integer .MAX_VALUE );
101
101
}
102
102
103
103
/**
104
104
* Inclusive ray cast from the given position
105
105
*/
106
- default List <T > rayCast (MatrixPosition position , Direction direction , int limit ) {
106
+ default List <Matrix . Entry < T > > rayCast (MatrixPosition position , Direction direction , int limit ) {
107
107
MatrixPosition current = position ;
108
- List <T > elements = new ArrayList <>(limit );
108
+ List <Matrix . Entry < T > > elements = new ArrayList <>(limit );
109
109
while (inBounds (current ) && elements .size () < limit ) {
110
- elements .add (this .get (current ));
110
+ var entry = Matrix .Entry .of (current , this .get (current ));
111
+ elements .add (entry );
111
112
current = current .move (direction );
112
113
}
113
114
return elements ;
114
115
}
115
116
116
- default List <T > rayCastWhile (MatrixPosition position , Direction direction , Predicate <? super Matrix .Entry <T >> predicate ) {
117
+ default List <Matrix . Entry < T > > rayCastWhile (MatrixPosition position , Direction direction , Predicate <? super Matrix .Entry <T >> predicate ) {
117
118
MatrixPosition current = position ;
118
- List <T > elements = new ArrayList <>();
119
+ List <Matrix . Entry < T > > elements = new ArrayList <>();
119
120
while (inBounds (current )) {
120
121
T currentElement = this .get (current );
121
122
var entry = Matrix .Entry .of (current , currentElement );
122
123
if (!predicate .test (entry )) {
123
124
break ;
124
125
}
125
- elements .add (currentElement );
126
+ elements .add (entry );
126
127
current = current .move (direction );
127
128
}
128
129
return elements ;
0 commit comments