Mean Index for Non-periodic Orbits in Hamiltonian Systems