Graded state machines: the representation of temporal contingencies in feedback networks