module NetSpider.Snapshot.Internal
( SnapshotLink(..),
linkNodeTuple,
linkNodePair,
SnapshotNode(..)
) where
import NetSpider.Pair (Pair(..))
import NetSpider.Timestamp (Timestamp)
data SnapshotLink n la =
SnapshotLink
{ _sourceNode :: !n,
_destinationNode :: !n,
_isDirected :: !Bool,
_linkTimestamp :: !Timestamp,
_linkAttributes :: !la
}
deriving (Show,Eq)
instance (Ord n, Eq la) => Ord (SnapshotLink n la) where
compare l r = compare (linkNodeTuple l) (linkNodeTuple r)
linkNodeTuple :: SnapshotLink n la -> (n, n)
linkNodeTuple link = (_sourceNode link, _destinationNode link)
linkNodePair :: SnapshotLink n la -> Pair n
linkNodePair = Pair . linkNodeTuple
data SnapshotNode n na =
SnapshotNode
{ _nodeId :: !n,
_isOnBoundary :: !Bool,
_nodeTimestamp :: !(Maybe Timestamp),
_nodeAttributes :: !(Maybe na)
}
deriving (Show,Eq)
instance (Ord n, Eq na) => Ord (SnapshotNode n na) where
compare l r = compare (_nodeId l) (_nodeId r)