Skip to content
This repository was archived by the owner on May 7, 2024. It is now read-only.

Commit 7911253

Browse files
committed
feat: change Slot trait to enum
1 parent 8776825 commit 7911253

File tree

1 file changed

+27
-18
lines changed

1 file changed

+27
-18
lines changed

src/main/scala/Slot.scala

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,29 @@
1-
trait Slot:
2-
/**
3-
* This method is used to associate a value to a path.
4-
* @param value the value to be associated with the path
5-
* @return a tuple containing a path and the corresponding value
6-
*/
7-
def -> (value: Any): (Path, Any) = (Path(this), value)
8-
9-
/**
10-
* Creates a path by concatenating this slot with the given slot.
11-
* @param slot the slot to be concatenated
12-
* @return a path
13-
*/
14-
def /(slot: Slot): Path = Path(this, slot)
1+
/**
2+
* This enum defines the different slots that can be used.
3+
*/
4+
enum Slot:
5+
case Nbr(index: Int)
6+
case Rep(index: Int)
7+
case FoldHood(index: Int)
8+
case Branch(index: Int, tag: Boolean)
159

1610
object Slot:
17-
final case class Nbr(index: Int) extends Slot
18-
final case class Rep(index: Int) extends Slot
19-
final case class FoldHood(index: Int) extends Slot
20-
final case class Branch(index: Int, tag: Boolean) extends Slot
11+
extension (slot: Slot)
12+
/**
13+
* This method is used to associate a value to a path.
14+
*
15+
* @param value the value to be associated with the path
16+
* @return a tuple containing a path and the corresponding value
17+
*/
18+
def ->(value: Any): (Path, Any) = (Path(slot), value)
19+
/**
20+
* Creates a path by concatenating this slot with the given slot.
21+
*
22+
* @param slot the slot to be concatenated
23+
* @return a path
24+
*/
25+
def /(other: Slot): Path = Path(slot, other)
26+
27+
28+
29+

0 commit comments

Comments
 (0)