This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scala.collection.GenSeqLike | |
import scala.collection.mutable.ArraySeq | |
/** | |
* A lazily sorted vector. | |
* | |
* Some operations may force some sorting, so return a LazySortedVector as well as the expected result. | |
*/ | |
sealed trait LazySortedVector[E] { | |
/** Vector length. */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.NoSuchElementException | |
trait MBiMap[K, V] { | |
def insert(k: K, v: V): MBiMap[K, V] | |
def remove(k: K): MBiMap[K, V] | |
def lookup(k: K): V | |
} | |
object MBiMap { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trait Graph[V, E] { | |
type Col[A] | |
type Incidence[A] | |
def vertices: Col[V] | |
def edges: Col[E] | |
def incidenceOption(e: E): Incidence[V] | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import uk.co.turingatemyhamster.graphvizs.exec | |
val gOut = dot2dotG(Graph(false, GraphType.Digraph, Some("g"), | |
EdgeStatement("a1") -> "a2" -> "a3" -> "a4", | |
EdgeStatement("a1") -> "a4" )) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Adjust the volume on something that produces noise. | |
*/ | |
@annotation.implicitNotFound("Could not work out how to adjust the volume for a ${A}.") | |
trait VolumeAdjuster[A] { | |
def makeLouder(a: A): Unit | |
def makeQuieter(a: A): Unit | |
} | |
case class TV() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** A mixin that exposes the text and document of any Swing component using the Document abstraction. | |
The text updates when the input is accepted by the component. The document text reflects what is typed. */ | |
trait TextVar { | |
/** Things that must be provided by any class that this is mixed into. */ | |
self : { | |
def getText(): String | |
def setText(s: String): Unit | |
def getDocument(): Document | |
def addActionListener(al: ActionListener): Unit | |
} => |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trait CNat { | |
type succ <: CNat | |
type pred <: CNat | |
} | |
trait _0 extends CNat { | |
type pred = _0 | |
type succ = CSucc[_0] | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package sbol.device | |
import java.net.URI | |
import sbol.util.{Annotated, Described, Identified} | |
/** | |
* A Device is the unit of functional design composition. | |
* | |
* @author Matthew Pocock | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** Witness that a type is safe to serialize. */ | |
@implicitNotFound(msg="Could not show ${S} to be serialization-safe") | |
trait SerializationSafe[S] | |
/** Serialization-safe witnesses. */ | |
object SerializationSafe { | |
/** If you are serializable, you are serialization-safe. */ | |
implicit def serializableIsSafe[S <: Serializable](s: S) = new SerializationSafe[S] {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// some types so that we know cardinalities | |
type Optional[T] // 0..1 | |
type Required[T] // 1 | |
type Many[T] // 0..* | |
// a value range restriction | |
type PositiveInteger // x: Int => x > 0 | |
// a whole load of DNA components grouped for whatever reason | |
trait Collection { |
OlderNewer