function
 */
contract JZMToken is PausableToken {

    event TransferWithLock(address indexed from, address indexed to, address indexed locked, uint256 amount, uint256 releaseTime);
    
    mapping (address => address[] ) public balancesLocked;

    function transferWithLock(address _to, uint256 _amount, uint256 _releaseTime) public returns (bool) {
        JZMLock lock = new JZMLock(this, _to, _releaseTime);
        transfer(address(lock), _amount);
        balancesLocked[_to].push(lock);
        emit TransferWithLock(msg.sender, _to, address(lock), _amount, _releaseTime);
        return true;
    }

    
    function balanceOfLocked(address _owner) public view returns (uint256) {
        address[] memory lockTokenAddrs = balancesLocked[_owner];

        uint256 totalLockedBalance = 0;
        for (uint i = 0; i < lockTokenAddrs.length; i++) {
            totalLockedBalance = totalLockedBalance.add(balances[lockTokenAddrs[i]]);
        }
        
        return totalLockedBalance;
    }

    function releaseToken(address _owner) public returns (bool) {
        address[] memory lockTokenAddrs = balancesLocked[_owner];
        for (uint i = 0; i < lockTokenAddrs.length; i++) {
            JZMLock lock = JZMLock(lockTokenAddrs[i]);
            if (lock.canRelease() && balanceOf(lock)>0) {
                lock.release();
            }
        }
        return true;
    }
}