public static MysqlGTIDSet parse(String gtidData) {
        Map<String, UUIDSet> m;

        if (gtidData == null || gtidData.length() < 1) {
            m = new HashMap<String, UUIDSet>();
        } else {
            // 存在多个GTID时会有回车符
            String[] uuidStrs = gtidData.replaceAll("\n", "").split(",");
            m = new HashMap<String, UUIDSet>(uuidStrs.length);
            for (int i = 0; i < uuidStrs.length; i++) {
                UUIDSet uuidSet = UUIDSet.parse(uuidStrs[i]);
                m.put(uuidSet.SID.toString(), uuidSet);
            }
        }

        MysqlGTIDSet gs = new MysqlGTIDSet();
        gs.sets = m;

        return gs;
    }
public static MysqlGTIDSet parse ( String gtidData ) { Map < String , UUIDSet > m ; if ( gtidData == null || gtidData . length ( ) < 1 ) { m = new HashMap < String , UUIDSet > ( ) ; } else { String [ ] uuidStrs = gtidData . replaceAll ( "\n" , "" ) . split ( "," ) ; m = new HashMap < String , UUIDSet > ( uuidStrs . length ) ; for ( int i = 0 ; i < uuidStrs . length ; i ++ ) { UUIDSet uuidSet = UUIDSet . parse ( uuidStrs [ i ] ) ; m . put ( uuidSet . SID . toString ( ) , uuidSet ) ; } } MysqlGTIDSet gs = new MysqlGTIDSet ( ) ; gs . sets = m ; return gs ; }
解析如下格式的字符串为MysqlGTIDSet: 726757ad-4455-11e8-ae04-0242ac110002:1 =>
MysqlGTIDSet{ sets: { 726757ad-4455-11e8-ae04-0242ac110002: UUIDSet{ SID:
726757ad-4455-11e8-ae04-0242ac110002, intervals: [{start:1, stop:2}] } }
} 726757ad-4455-11e8-ae04-0242ac110002:1-3 => MysqlGTIDSet{ sets: {
726757ad-4455-11e8-ae04-0242ac110002: UUIDSet{ SID:
726757ad-4455-11e8-ae04-0242ac110002, intervals: [{start:1, stop:4}] } }
} 726757ad-4455-11e8-ae04-0242ac110002:1-3:4 => MysqlGTIDSet{ sets: {
726757ad-4455-11e8-ae04-0242ac110002: UUIDSet{ SID:
726757ad-4455-11e8-ae04-0242ac110002, intervals: [{start:1, stop:5}] } }
} 726757ad-4455-11e8-ae04-0242ac110002:1-3:7-9 => MysqlGTIDSet{ sets: {
726757ad-4455-11e8-ae04-0242ac110002: UUIDSet{ SID:
726757ad-4455-11e8-ae04-0242ac110002, intervals: [{start:1, stop:4},
{start:7, stop: 10}] } } }
726757ad-4455-11e8-ae04-0242ac110002:1-3,726757
ad-4455-11e8-ae04-0242ac110003:4 => MysqlGTIDSet{ sets: {
726757ad-4455-11e8-ae04-0242ac110002: UUIDSet{ SID:
726757ad-4455-11e8-ae04-0242ac110002, intervals: [{start:1, stop:4}] },
726757ad-4455-11e8-ae04-0242ac110003: UUIDSet{ SID:
726757ad-4455-11e8-ae04-0242ac110002, intervals: [{start:4, stop:5}] } }
}

@param gtidData
@return