[jsword-devel] GBF tag support for Hebrew and Greek...

Jacky Cheung jsword-devel@crosswire.org
Sat, 24 May 2003 13:52:30 +0800


This is a multi-part message in MIME format.
--------------080809010002040509000808
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

Hi,

Please find the patch for GBF tag support for Heb. and Greek attached. 
There is a huge change in the GBFFilter class.  Thanks.

Best regards,
Jacky

P.S.
Now, the GUI can should hyperlink for tagged word but cannot link to 
lexcon. Furthermore, the translated output of the text looks not good 
enough. I know that somebody has written an XSL file for to convert OSIS 
XML to HTML.


--------------080809010002040509000808
Content-Type: text/plain;
 name="gbf.patch"
Content-Transfer-Encoding: base64
Content-Disposition: inline;
 filename="gbf.patch"

SW5kZXg6IGpzd29yZC9qYXZhL2pzd29yZC9vcmcvY3Jvc3N3aXJlL2pzd29yZC9ib29rL2Rh
dGEvR0JGRmlsdGVyLmphdmEKPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQpSQ1MgZmlsZTogL2N2cy9qc3dvcmQv
anN3b3JkL2phdmEvanN3b3JkL29yZy9jcm9zc3dpcmUvanN3b3JkL2Jvb2svZGF0YS9HQkZG
aWx0ZXIuamF2YSx2CnJldHJpZXZpbmcgcmV2aXNpb24gMS43CmRpZmYgLXUgLXIxLjcgR0JG
RmlsdGVyLmphdmEKLS0tIGpzd29yZC9qYXZhL2pzd29yZC9vcmcvY3Jvc3N3aXJlL2pzd29y
ZC9ib29rL2RhdGEvR0JGRmlsdGVyLmphdmEJMTcgTWF5IDIwMDMgMTU6MDA6MTQgLTAwMDAJ
MS43CisrKyBqc3dvcmQvamF2YS9qc3dvcmQvb3JnL2Nyb3Nzd2lyZS9qc3dvcmQvYm9vay9k
YXRhL0dCRkZpbHRlci5qYXZhCTI0IE1heSAyMDAzIDA1OjQ1OjMxIC0wMDAwCkBAIC0zLDcg
KzMsNyBAQAogCiBpbXBvcnQgamF2YS51dGlsL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aCgpIC0gMTsKKyAgICAgICAgICAgIGlmIChsYXN0SW5kZXggPj0gMCAmJiBwbGFp
bi5jaGFyQXQobGFzdEluZGV4KSA9PSAoKGNoYXIpIDEzKSkKICAgICAgICAgICAgIHsKLSAg
ICAgICAgICAgICAgICBFbGVtZW50IGN1cnJlbnQgPSAoRWxlbWVudCkgc3RhY2suZ2V0Rmly
c3QoKTsKLSAgICAgICAgICAgICAgICBMaXN0IGxpc3QgPSBKQVhCVXRpbC5nZXRMaXN0KGN1
cnJlbnQpOyAKLSAgICAgICAgICAgICAgICBsaXN0LmFkZCgoU3RyaW5nKSB0b2tlbik7Cisg
ICAgICAgICAgICAgICAgcGxhaW4gPSBwbGFpbi5zdWJzdHJpbmcoMCwgbGFzdEluZGV4KTsK
ICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGVsc2UgaWYgKHRva2VuIGluc3RhbmNlb2Yg
VGFnKQotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIFRhZyB0YWcgPSAoVGFnKSB0
b2tlbjsKKyAgICAgICAgICAgIHJlbWFpbnMgPSBwbGFpbjsKKyAgICAgICAgfQorICAgICAg
ICAKKyAgICAgICAgLyoqCisgICAgICAgICAqIEdldCBOZXh0IHRhZ3MgaW4gdGhlIHN0cmlu
ZworICAgICAgICAgKi8KKyAgICAgICAgcHVibGljIElUYWcgZ2V0TmV4dFRhZygpIHsKKyAg
ICAgICAgICAgIGlmIChyZXR2YWwuaXNFbXB0eSgpKSB7CisgICAgICAgICAgICAgICAgaWYg
KHJlbWFpbnMgPT0gbnVsbCkKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7Cisg
ICAgICAgICAgICAgICAgcGFyc2VOZXh0VGFnKCk7CisgICAgICAgICAgICB9CisgICAgICAg
ICAgICByZXR1cm4gKElUYWcpIHJldHZhbC5yZW1vdmUoMCk7CisgICAgICAgIH0KICAgICAg
ICAgCi0gICAgICAgICAgICAgICAgLy8gc2tpcCBvdmVyIHRoZSByZXN0IG9mIHRoZSBmb290
bm90ZQotICAgICAgICAgICAgICAgIGlmICh0YWcuZXF1YWxzKEZPT1ROT1RFX1NUQVJUKSkK
LSAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgIExpc3QgZm9vdG5vdGUg
PSBnZXRUb2tlbnNVbnRpbChpdCwgRk9PVE5PVEVfU1RPUCk7Ci0gICAgICAgICAgICAgICAg
ICAgIFN0cmluZyBjb250ZW50ID0gZmlsdGVyVGV4dChmb290bm90ZSk7Ci0gICAgICAgICAg
ICAgICAgICAgIAotICAgICAgICAgICAgICAgICAgICAvLyBUaGlzIGNvdWxkIGJlIGEgbWFy
a2VyIG9yIGl0IGNvdWxkIGJlIHRoZSBib2R5IG9mIHRoZSBub3RlCi0gICAgICAgICAgICAg
ICAgICAgIC8vIFdlIHRlbGwgd2hpY2ggYnkgc3RyaW5nIGxlbmd0aC4gPD0gMSBpcyBhIG1h
cmtlciB3aGljaCB3ZQotICAgICAgICAgICAgICAgICAgICAvLyBpZ25vcmUgZm9yIHNpbXBs
aWNpdHkKLSAgICAgICAgICAgICAgICAgICAgaWYgKGNvbnRlbnQubGVuZ3RoKCkgPiAxKQor
ICAgICAgICBwcml2YXRlIHZvaWQgcGFyc2VOZXh0VGFnKCkgeworICAgICAgICAgICAgaWYg
KHJlbWFpbnMgPT0gbnVsbCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICByZXR1
cm47CisgICAgICAgICAgICB9CisgICAgICAgICAgICAKKyAgICAgICAgICAgIGludCBsdHBv
cyA9IHJlbWFpbnMuaW5kZXhPZignPCcpOworICAgICAgICAgICAgaW50IGd0cG9zID0gcmVt
YWlucy5pbmRleE9mKCc+Jyk7CisgICAgICAgICAgICAKKyAgICAgICAgICAgIGlmIChsdHBv
cyA9PSAtMSAmJiBndHBvcyA9PSAtMSkgeworICAgICAgICAgICAgICAgIC8vIG5vIG1vcmUg
dGFncyB0byBkZWNvZGUKKyAgICAgICAgICAgICAgICByZXR2YWwuYWRkKG5ldyBUZXh0VGFn
KHJlbWFpbnMpKTsKKyAgICAgICAgICAgICAgICByZW1haW5zID0gbnVsbDsKKyAgICAgICAg
ICAgICAgICByZXR1cm47CisgICAgICAgICAgICB9CisgICAgICAgICAgICAKKyAgICAgICAg
ICAgIC8vIGNoZWNrIHRoYXQgd2UgZG9uJ3QgaGF2ZSB1bm1hdGNoZWQgdGFncworICAgICAg
ICAgICAgaWYgKGx0cG9zID09IC0xIHx8IGd0cG9zID09IC0xKSB7CisgICAgICAgICAgICAg
ICAgbG9nLndhcm4oImlnbm9yaW5nIHVubWF0Y2hlZCAnPCcgb3IgJz4nIGluIGdiZjogIity
ZW1haW5zKTsKKyAgICAgICAgICAgICAgICByZXR2YWwuYWRkKG5ldyBUZXh0VGFnKHJlbWFp
bnMpKTsKKyAgICAgICAgICAgICAgICByZW1haW5zID0gbnVsbDsKKyAgICAgICAgICAgICAg
ICByZXR1cm47CisgICAgICAgICAgICB9CisgICAgICAgICAgICAKKyAgICAgICAgICAgIC8v
IGNoZWNrIHRoYXQgdGhlIHRhZ3MgYXJlIGluIGEgc2Vuc2libGUgb3JkZXIKKyAgICAgICAg
ICAgIGlmIChsdHBvcyA+IGd0cG9zKSB7CisgICAgICAgICAgICAgICAgbG9nLndhcm4oImln
bm9yaW5nIHVubWF0Y2hlZCAnPCcgb3IgJz4nIGluIGdiZjogIityZW1haW5zKTsKKyAgICAg
ICAgICAgICAgICByZXR2YWwuYWRkKG5ldyBUZXh0VGFnKHJlbWFpbnMpKTsKKyAgICAgICAg
ICAgICAgICByZW1haW5zID0gbnVsbDsKKyAgICAgICAgICAgICAgICByZXR1cm47CisgICAg
ICAgICAgICB9CisgICAgICAgICAgICAKKyAgICAgICAgICAgIC8vIGdlbmVyYXRlIHRhZ3MK
KyAgICAgICAgICAgIFN0cmluZyBzdGFydCA9IHJlbWFpbnMuc3Vic3RyaW5nKDAsIGx0cG9z
KTsKKyAgICAgICAgICAgIGludCBzdHJMZW4gPSBzdGFydC5sZW5ndGgoKTsKKyAgICAgICAg
ICAgIGlmIChzdHJMZW4gPiAwKSB7CisgICAgICAgICAgICAgICAgaW50IGJlZ2luSW5kZXgg
PSAwOworICAgICAgICAgICAgICAgIGJvb2xlYW4gaW5TZXBTdHIgPSBpc1NlcGVyYXRvcihz
dGFydC5jaGFyQXQoMCkpOworICAgICAgICAgICAgICAgIC8vIHNwbGl0IHdvcmRzIGZyb20g
c2VwZXJhdG9ycy4uLgorICAgICAgICAgICAgICAgIC8vIGUuZy4sICJhIGIgYz8gZSBnLiIg
LT4gImEgYiBjIiwgIj8gIiwgImUgZy4iCisgICAgICAgICAgICAgICAgLy8gICAgICAgImEg
YiBjPHRhZz4gZSBnLiIgLT4gImEgYiBjIiwgdGFnLCAiICIsICJlIGcuIgorICAgICAgICAg
ICAgICAgIGZvcihpbnQgaT0xOyBpblNlcFN0ciAmJiBpPHN0ckxlbjsgaSsrKSB7CisgICAg
ICAgICAgICAgICAgICAgIGNoYXIgY3VycmVudENoYXIgPSBzdGFydC5jaGFyQXQoaSk7Cisg
ICAgICAgICAgICAgICAgICAgIGlmICghaXNTZXBlcmF0b3IoY3VycmVudENoYXIpKQogICAg
ICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBOb3RlIG5vdGUg
PSBKQVhCVXRpbC5mYWN0b3J5KCkuY3JlYXRlTm90ZSgpOwotICAgICAgICAgICAgICAgICAg
ICAgICAgbm90ZS5zZXROKCIiKyhtYXJrZXIrKykpOwotICAgICAgICAgICAgICAgICAgICAg
ICAgbm90ZS5nZXRDb250ZW50KCkuYWRkKGNvbnRlbnQpOwotICAgICAgICAgICAgICAgICAg
ICAgICAgRWxlbWVudCBjdXJyZW50ID0gKEVsZW1lbnQpIHN0YWNrLmdldEZpcnN0KCk7Ci0g
ICAgICAgICAgICAgICAgICAgICAgICAKLSAgICAgICAgICAgICAgICAgICAgICAgIExpc3Qg
bGlzdCA9IEpBWEJVdGlsLmdldExpc3QoY3VycmVudCk7IAotICAgICAgICAgICAgICAgICAg
ICAgICAgbGlzdC5hZGQobm90ZSk7CisgICAgICAgICAgICAgICAgICAgICAgICByZXR2YWwu
YWRkKG5ldyBUZXh0VGFnKHN0YXJ0LnN1YnN0cmluZyhiZWdpbkluZGV4LCBpKSkpOworICAg
ICAgICAgICAgICAgICAgICAgICAgYmVnaW5JbmRleCA9IGk7CisgICAgICAgICAgICAgICAg
ICAgICAgICBpblNlcFN0ciA9IGZhbHNlOwogICAgICAgICAgICAgICAgICAgICB9CiAgICAg
ICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGVsc2UgaWYgKHRhZy5lcXVhbHMoUEFS
QUdSQVBIKSkKLSAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgIC8vIGln
bm9yZSBwYXJhZ3JhcGggbWFya2VycwotICAgICAgICAgICAgICAgIH0gICAgICAgICAgICAg
ICAgCi0gICAgICAgICAgICAgICAgZWxzZSBpZiAodGFnLmVxdWFscyhJVEFMSUNTX1NUQVJU
KSkKLSAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgIFNlZyBzZWcgPSBK
QVhCVXRpbC5mYWN0b3J5KCkuY3JlYXRlU2VnKCk7Ci0gICAgICAgICAgICAgICAgICAgIEVs
ZW1lbnQgY3VycmVudCA9IChFbGVtZW50KSBzdGFjay5nZXRGaXJzdCgpOwotICAgICAgICAg
ICAgICAgICAgICAKLSAgICAgICAgICAgICAgICAgICAgTGlzdCBsaXN0ID0gSkFYQlV0aWwu
Z2V0TGlzdChjdXJyZW50KTsgCi0gICAgICAgICAgICAgICAgICAgIGxpc3QuYWRkKHNlZyk7
Ci0KLSAgICAgICAgICAgICAgICAgICAgc3RhY2suYWRkRmlyc3Qoc2VnKTsKLSAgICAgICAg
ICAgICAgICB9ICAgICAgICAgICAgICAgIAotICAgICAgICAgICAgICAgIGVsc2UgaWYgKHRh
Zy5lcXVhbHMoSVRBTElDU19TVE9QKSkKLSAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAg
ICAgICAgICAgIE9iamVjdCB0b3AgPSBzdGFjay5yZW1vdmVGaXJzdCgpOwotICAgICAgICAg
ICAgICAgICAgICAKLSAgICAgICAgICAgICAgICAgICAgLy8gQ2hlY2sgdGhhdCB3ZSBhcmUg
cHJvcGVybHkgdHJlZSBzdHJ1Y3R1cmVkCi0gICAgICAgICAgICAgICAgICAgIGlmICghKHRv
cCBpbnN0YW5jZW9mIFNlZykpCi0gICAgICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAg
ICAgICAgICAgICAgIHRocm93IG5ldyBMb2dpY0Vycm9yKCk7Ci0gICAgICAgICAgICAgICAg
ICAgIH0KLSAgICAgICAgICAgICAgICB9ICAgICAgICAgICAgICAgIAotICAgICAgICAgICAg
ICAgIGVsc2UKLSAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgIC8vIHVu
a25vd24gdGFncwotICAgICAgICAgICAgICAgICAgICBsb2cud2FybigiSWdub3JpbmcgdGFn
IG9mICIrdGFnLmdldFRhZygpKTsKKyAgICAgICAgICAgICAgICBpZiAoYmVnaW5JbmRleCA8
IHN0ckxlbikgeworICAgICAgICAgICAgICAgICAgICByZXR2YWwuYWRkKG5ldyBUZXh0VGFn
KHN0YXJ0LnN1YnN0cmluZyhiZWdpbkluZGV4KSkpOwogICAgICAgICAgICAgICAgIH0KICAg
ICAgICAgICAgIH0KLSAgICAgICAgICAgIGVsc2UKLSAgICAgICAgICAgIHsKLSAgICAgICAg
ICAgICAgICB0aHJvdyBuZXcgRGF0YUV4Y2VwdGlvbihNc2cuR0JGX0JBRFRPS0VOLCBuZXcg
T2JqZWN0W10geyB0b2tlbiB9KTsKKyAgICAgICAgICAgIAorICAgICAgICAgICAgU3RyaW5n
IHRhZyA9IHJlbWFpbnMuc3Vic3RyaW5nKGx0cG9zKzEsIGd0cG9zKTsKKyAgICAgICAgICAg
IGlmICh0YWcubGVuZ3RoKCkgPiAwKSB7CisgICAgICAgICAgICAgICAgcmV0dmFsLmFkZChj
cmVhdGVUYWcodGFnKSk7CiAgICAgICAgICAgICB9CisgICAgICAgICAgICAKKyAgICAgICAg
ICAgIHJlbWFpbnMgPSByZW1haW5zLnN1YnN0cmluZyhndHBvcysxKTsKICAgICAgICAgfQot
Ci0gICAgICAgIHN0YWNrLnJlbW92ZUZpcnN0KCk7CisgICAgICAgIAorICAgICAgICBwcml2
YXRlIGJvb2xlYW4gaXNTZXBlcmF0b3IoY2hhciBjKSB7CisgICAgICAgICAgICBmaW5hbCBT
dHJpbmcgc2VwZXJhdG9ycyA9ICIgLDo7Lj8hIjsKKyAgICAgICAgICAgIHJldHVybiBzZXBl
cmF0b3JzLmluZGV4T2YoYykgPj0gMDsKKyAgICAgICAgfQorICAgICAgICAKKyAgICAgICAg
cHJpdmF0ZSBJVGFnIGNyZWF0ZVRhZyhTdHJpbmcgdGFnKSB7CisgICAgICAgICAgICBpZiAo
dGFnLmVxdWFscygiUkIiKSkgeworICAgICAgICAgICAgICAgIHJldHVybiBuZXcgVGV4dFdp
dGhFbWJlZGRlZEZvb3Rub3RlKCk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpZiAo
dGFnLmVxdWFscygiUkYiKSkgeworICAgICAgICAgICAgICAgIHJldHVybiBuZXcgRm9vdG5v
dGVTdGFydFRhZygpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgaWYgKHRhZy5lcXVh
bHMoIlJmIikpIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gbmV3IEZvb3Rub3RlRW5kVGFn
KCk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpZiAodGFnLmVxdWFscygiRkkiKSkg
eworICAgICAgICAgICAgICAgIHJldHVybiBuZXcgSXRhbGljU3RhcnRUYWcoKTsKKyAgICAg
ICAgICAgIH0KKyAgICAgICAgICAgIGlmICh0YWcuZXF1YWxzKCJGaSIpKSB7CisgICAgICAg
ICAgICAgICAgcmV0dXJuIG5ldyBJdGFsaWNFbmRUYWcoKTsKKyAgICAgICAgICAgIH0KKyAg
ICAgICAgICAgIGlmICh0YWcuZXF1YWxzKCJDTSIpKSB7CisgICAgICAgICAgICAgICAgcmV0
dXJuIG5ldyBQYXJhZ3JhcGhUYWcoKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGlm
ICh0YWcuc3RhcnRzV2l0aCgiV1QiKSkgeworICAgICAgICAgICAgICAgIHJldHVybiBuZXcg
U3Ryb25nc01vcnBoUmVmVGFnKHRhZyk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBp
ZiAodGFnLnN0YXJ0c1dpdGgoIldIIikgfHwgdGFnLnN0YXJ0c1dpdGgoIldHIikpIHsKKyAg
ICAgICAgICAgICAgICByZXR1cm4gbmV3IFN0cm9uZ3NXb3JkUmVmVGFnKHRhZyk7CisgICAg
ICAgICAgICB9CisgICAgICAgICAgICByZXR1cm4gbmV3IFVua25vd25UYWcodGFnKTsKKyAg
ICAgICAgfQorICAgICAgICBwcml2YXRlIFN0cmluZyByZW1haW5zOworICAgICAgICBwcml2
YXRlIExpc3QgcmV0dmFsID0gbmV3IEFycmF5TGlzdCgpOwogICAgIH0KIAogICAgIC8qKgot
ICAgICAqIFN0cmlwIGFsbCB0aGUgVGFncyBmcm9tIGEgTGlzdCBhbmQgcmV0dXJuIGp1c3Qg
dGhlIHRleHQKKyAgICAgKiBHQkYgVGFnIGludGVyZmFjZQorICAgICAqCisgICAgICogTm93
IHRoZSBudW1iZXIgb2Ygc3VwcG9ydGVkIHRhZ3MgYXJlIHNtYWxsLgorICAgICAqIElmIHRo
ZSBudW1iZXIgYmVjb21lIGxhcmdlLCByZWZhY3Rvci4uLgorICAgICAqIDEuIHJlZmFjdG9y
IElUYWcgdG8gcHVibGljIGFic3RyYWN0IGNsYXNzIEdCRlRhZworICAgICAqIDIuIG1vdmUg
Y3JlYXRlVGFnKCkgdG8gR0JGVGFnCisgICAgICogMy4gbW92ZSB0YWcgY2xhc3NlcyB0byBH
QkZ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SAgICAgICAgTGlzdCBpZ25vcmVkID0gbmV3IEFycmF5
TGlzdCgpOwotCi0gICAgICAgIHdoaWxlICh0cnVlKQorICAgICAgICBwdWJsaWMgdm9pZCB1
cGRhdGVPc2lzU3RhY2soU3RhY2sgc3RhY2spIHRocm93cyBKQVhCRXhjZXB0aW9uCiAgICAg
ICAgIHsKLSAgICAgICAgICAgIGlmICghaXQuaGFzTmV4dCgpKQotICAgICAgICAgICAgewot
ICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgfQotICAgICAgICAKLSAgICAg
ICAgICAgIE9iamVjdCB0b2tlbiA9IGl0Lm5leHQoKTsKLSAgICAgICAgICAgIGlmICh0b2tl
biBpbnN0YW5jZW9mIFN0cmluZykKKyAgICAgICAgICAgIEVsZW1lbnQgY3VycmVudCA9IChF
bGVtZW50KSBzdGFjay5wZWVrKCk7CisgICAgICAgICAgICBpZiAoIShjdXJyZW50IGluc3Rh
bmNlb2YgTm90ZSkpCiAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgaWdub3JlZC5h
ZGQodG9rZW4pOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgZWxzZSBpZiAodG9rZW4g
aW5zdGFuY2VvZiBUYWcpCi0gICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgVGFnIHRh
ZyA9IChUYWcpIHRva2VuOwotICAgICAgICAgICAgICAgIGlmICh0YWcuZXF1YWxzKGVuZCkp
Ci0gICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICBicmVhazsKLSAgICAg
ICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgZWxzZQotICAgICAgICAgICAgICAgIHsK
LSAgICAgICAgICAgICAgICAgICAgaWdub3JlZC5hZGQodG9rZW4pOwotICAgICAgICAgICAg
ICAgIH0KLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGVsc2UKLSAgICAgICAgICAgIHsK
LSAgICAgICAgICAgICAgICB0aHJvdyBuZXcgSkFYQkV4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Ag
ICAgIGludCBndHBvcyA9IHJlbWFpbnMuaW5kZXhPZignPicpOworICAgICAgICAgICAgTm90
ZSBub3RlID0gKE5vdGUpIHN0YWNrLnBvcCgpOworICAgICAgICAgICAgTGlzdCBsaXN0ID0g
SkFYQlV0aWwuZ2V0TGlzdChub3RlKTsKIAotICAgICAgICAgICAgaWYgKGx0cG9zID09IC0x
ICYmIGd0cG9zID09IC0xKQotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIC8vIG5v
IG1vcmUgdGFncyB0byBkZWNvZGUKLSAgICAgICAgICAgICAgICByZXR2YWwuYWRkKHJlbWFp
bnMpOwotICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgaWYgKGxpc3Quc2l6
ZSgpIDwgMSkgeworICAgICAgICAgICAgICAgIEpBWEJVdGlsLmdldExpc3QoKEVsZW1lbnQp
c3RhY2sucGVlaygpKS5yZW1vdmUobm90ZSk7CiAgICAgICAgICAgICB9CisgICAgICAgIH0K
KyAgICB9CiAKLSAgICAgICAgICAgIC8vIGNoZWNrIHRoYXQgd2UgZG9uJ3QgaGF2ZSB1bm1h
dGNoZWQgdGFncwotICAgICAgICAgICAgaWYgKGx0cG9zID09IC0xIHx8IGd0cG9zID09IC0x
KQotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIGxvZy53YXJuKCJpZ25vcmluZyB1
bm1hdGNoZWQgJzwnIG9yICc+JyBpbiBnYmY6ICIrcmVtYWlucyk7Ci0gICAgICAgICAgICAg
ICAgcmV0dmFsLmFkZChyZW1haW5zKTsKLSAgICAgICAgICAgICAgICBicmVhazsKLSAgICAg
ICAgICAgIH0KLSAgICAgICAgICAgIAotICAgICAgICAgICAgLy8gY2hlY2sgdGhhdCB0aGUg
dGFncyBhcmUgaW4gYSBzZW5zaWJsZSBvcmRlcgotICAgICAgICAgICAgaWYgKGx0cG9zID4g
Z3Rwb3MpCi0gICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgbG9nLndhcm4oImlnbm9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Wlucy5zdWJzdHJpbmcobHRwb3MrMSwgZ3Rwb3MpOwot
ICAgICAgICAgICAgcmV0dmFsLmFkZChuZXcgVGFnKHRhZykpOwotICAgICAgICAgICAgCi0g
ICAgICAgICAgICByZW1haW5zID0gcmVtYWlucy5zdWJzdHJpbmcoZ3Rwb3MrMSk7CisgICAg
ICAgICAgICBzdGFjay5wdXNoKHNlZyk7CisgICAgICAgICAgICAgKi8KICAgICAgICAgfQot
Ci0gICAgICAgIHJldHVybiByZXR2YWw7CiAgICAgfQogCiAgICAgLyoqCi0gICAgICogQSBH
QkYgVGFnCisgICAgICogVGFnIHN5bnRheDogPEZJPm5vdGU8Rmk+CiAgICAgICovCi0gICAg
cHJpdmF0ZSBzdGF0aWMgY2xhc3MgVGFnCisgICAgcHJpdmF0ZSBzdGF0aWMgY2xhc3MgSXRh
bGljRW5kVGFnIGltcGxlbWVudHMgSVRhZwogICAgIHsKLSAgICAgICAgcHVibGljIFRhZyhT
dHJpbmcgdGFnKQorICAgICAgICBwdWJsaWMgdm9pZCB1cGRhdGVPc2lzU3RhY2soU3RhY2sg
c3RhY2spCiAgICAgICAgIHsKLSAgICAgICAgICAgIHRoaXMudGFnID0gdGFnOworICAgICAg
ICAgICAgLy8gcmVtYXJrZWQsIGZvciB0aGUgWFNMIGRvZXMgbm90IHRyYW5zbGF0ZSBpdCBj
b3JyZWN0bHkKKyAgICAgICAgICAgIC8vIHN0YWNrLnBvcCgpOwogICAgICAgICB9CisgICAg
fQogCi0gICAgICAgIHB1YmxpYyBTdHJpbmcgZ2V0VGFnKCkKKyAgICAvKioKKyAgICAgKiBU
YWcgc3ludGF4OiBXb3JkczxDTT4KKyAgICAgKi8KKyAgICBwcml2YXRlIHN0YXRpYyBjbGFz
cyBQYXJhZ3JhcGhUYWcgaW1wbGVtZW50cyBJVGFnCisgICAgeworICAgICAgICBwdWJsaWMg
dm9pZCB1cGRhdGVPc2lzU3RhY2soU3RhY2sgc3RhY2spIHsKKyAgICAgICAgICAgIEpBWEJV
dGlsLmdldExpc3QoKEVsZW1lbnQpc3RhY2sucGVlaygpKS5hZGQoQ2hhcmFjdGVyLnRvU3Ry
aW5nKCe2JykpOworICAgICAgICB9CisgICAgfQorICAgIAorICAgIC8qKgorICAgICAqIFRh
ZyBzeW50YXg6IHdvcmQ8V0h4eHh4PiBvciB3b3JkPFdHeHh4eD4KKyAgICAgKi8KKyAgICBw
cml2YXRlIHN0YXRpYyBjbGFzcyBTdHJvbmdzV29yZFJlZlRhZyBpbXBsZW1lbnRzIElUYWcK
KyAgICB7CisgICAgICAgIHB1YmxpYyBTdHJvbmdzV29yZFJlZlRhZyhTdHJpbmcgdGFnTmFt
ZSkKICAgICAgICAgewotICAgICAgICAgICAgcmV0dXJuIHRhZzsKKyAgICAgICAgICAgIHRh
ZyA9IHRhZ05hbWUudHJpbSgpOwogICAgICAgICB9Ci0KLSAgICAgICAgcHVibGljIGJvb2xl
YW4gZXF1YWxzKE9iamVjdCBvYmopCisgICAgICAgIHB1YmxpYyB2b2lkIHVwZGF0ZU9zaXNT
dGFjayhTdGFjayBzdGFjaykgdGhyb3dzIEpBWEJFeGNlcHRpb24KICAgICAgICAgewotICAg
ICAgICAgICAgaWYgKG9iaiA9PSBudWxsKQotICAgICAgICAgICAgICAgIHJldHVybiBmYWxz
ZTsKLQotICAgICAgICAgICAgaWYgKG9iai5nZXRDbGFzcygpICE9IHRoaXMuZ2V0Q2xhc3Mo
KSkKLSAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7Ci0KLSAgICAgICAgICAgIFRhZyB0
aGF0ID0gKFRhZykgb2JqOwotICAgICAgICAgICAgcmV0dXJuIHRoaXMudGFnLmVxdWFscyh0
aGF0LnRhZyk7CisgICAgICAgICAgICBFbGVtZW50IGVsZSA9IChFbGVtZW50KSBzdGFjay5w
ZWVrKCk7CisgICAgICAgICAgICBMaXN0IGxpc3QgPSBKQVhCVXRpbC5nZXRMaXN0KGVsZSk7
CisgICAgICAgICAgICBpZiAobGlzdC5pc0VtcHR5KCkpCisgICAgICAgICAgICB7CisgICAg
ICAgICAgICAgICAgbG9nLmVycm9yKCJTb3VyY2UgaGFzIHByb2JsZW0gZm9yIHRhZyA8IiAr
IHRhZyArICI+LiIpOworICAgICAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgICAgIH0K
KyAgICAgICAgICAgIGludCBsYXN0SW5kZXggPSBsaXN0LnNpemUoKSAtIDE7CisgICAgICAg
ICAgICBPYmplY3QgcHJldk9iaiA9IGxpc3QuZ2V0KGxhc3RJbmRleCk7CisgICAgICAgICAg
ICBXIHdvcmQgPSBudWxsOworICAgICAgICAgICAgaWYgKHByZXZPYmogaW5zdGFuY2VvZiBT
dHJpbmcpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgd29yZCA9IEpBWEJVdGls
LmZhY3RvcnkoKS5jcmVhdGVXKCk7CisgICAgICAgICAgICAgICAgd29yZC5nZXRDb250ZW50
KCkuYWRkKHByZXZPYmopOworICAgICAgICAgICAgICAgIGxpc3Quc2V0KGxhc3RJbmRleCwg
d29yZCk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBlbHNlIGlmIChwcmV2T2JqIGlu
c3RhbmNlb2YgVykgeworICAgICAgICAgICAgICAgIHdvcmQgPSAoVykgcHJldk9iajsKKyAg
ICAgICAgICAgIH0KKyAgICAgICAgICAgIGVsc2UgeworICAgICAgICAgICAgICAgIGxvZy5l
cnJvcigiU291cmNlIGhhcyBwcm9ibGVtIGZvciB0YWcgPCIgKyB0YWcgKyAiPi4iKTsKKyAg
ICAgICAgICAgICAgICByZXR1cm47CisgICAgICAgICAgICB9CisgICAgICAgICAgICBTdHJp
bmcgZXhpc3RpbmdMZW1tYSA9IHdvcmQuZ2V0TGVtbWEoKTsKKyAgICAgICAgICAgIFN0cmlu
Z0J1ZmZlciBuZXdMZW1tYSA9IG5ldyBTdHJpbmdCdWZmZXIoKTsKKyAgICAgICAgICAgIGlm
IChleGlzdGluZ0xlbW1hICE9IG51bGwgJi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uZXJyb3Io
IlNvdXJjZSBoYXMgcHJvYmxlbSBmb3IgdGFnIDwiICsgdGFnICsgIj4uIik7CisgICAgICAg
ICAgICAgICAgcmV0dXJuOworICAgICAgICAgICAgfQorICAgICAgICAgICAgaW50IGxhc3RJ
bmRleCA9IGxpc3Quc2l6ZSgpIC0gMTsKKyAgICAgICAgICAgIE9iamVjdCBwcmV2T2JqID0g
bGlzdC5nZXQobGFzdEluZGV4KTsKKyAgICAgICAgICAgIFcgd29yZCA9IG51bGw7CisgICAg
ICAgICAgICBpZiAocHJldk9iaiBpbnN0YW5jZW9mIFN0cmluZykKKyAgICAgICAgICAgIHsK
KyAgICAgICAgICAgICAgICB3b3JkID0gSkFYQlV0aWwuZmFjdG9yeSgpLmNyZWF0ZVcoKTsK
KyAgICAgICAgICAgICAgICB3b3JkLmdldENvbnRlbnQoKS5hZGQocHJldk9iaik7CisgICAg
ICAgICAgICAgICAgbGlzdC5zZXQobGFzdEluZGV4LCB3b3JkKTsKKyAgICAgICAgICAgIH0K
KyAgICAgICAgICAgIGVsc2UgaWYgKHByZXZPYmogaW5zdGFuY2VvZiBXKSB7CisgICAgICAg
ICAgICAgICAgd29yZCA9IChXKSBwcmV2T2JqOworICAgICAgICAgICAgfQorICAgICAgICAg
ICAgZWxzZSB7CisgICAgICAgICAgICAgICAgbG9nLmVycm9yKCJTb3VyY2UgaGFzIHByb2Js
ZW0gZm9yIHRhZyA8IiArIHRhZyArICI+LiIpOworICAgICAgICAgICAgICAgIHJldHVybjsK
KyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIFN0cmluZyBleGlzdGluZ01vcnBoID0gd29y
ZC5nZXRNb3JwaCgpOworICAgICAgICAgICAgU3RyaW5nQnVmZmVyIG5ld01vcnBoID0gbmV3
IFN0cmluZ0J1ZmZlcigpOworICAgICAgICAgICAgaWYgKGV4aXN0aW5nTW9ycGggIT0gbnVs
bCAmJiBleGlzdGluZ01vcnBoLmxlbmd0aCgpID4gMCkgeworICAgICAgICAg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YWNr
KSB0aHJvd3MgSkFYQkV4Y2VwdGlvbgorICAgICAgICB7CisgICAgICAgICAgICBFbGVtZW50
IGVsZSA9IChFbGVtZW50KSBzdGFjay5wZWVrKCk7CisgICAgICAgICAgICBMaXN0IGxpc3Qg
PSBKQVhCVXRpbC5nZXRMaXN0KGVsZSk7CisgICAgICAgICAgICBsaXN0LmFkZCh0ZXh0KTsK
KyAgICAgICAgfQorICAgICAgICBwcml2YXRlIFN0cmluZyB0ZXh0OworICAgIH0KKyAgICAK
KyAgICAvKioKKyAgICAgKiBVbmtub3duIFRhZy4gRWl0aGVyIG5vdCBzdXBwb3J0ZWQgdGFn
IG9yIHRhZyBub3QgZGVmaW5lZCBpbiBHQkYgc3BlY2lmaWNhdGlvbgorICAgICAqLworICAg
IHByaXZhdGUgc3RhdGljIGNsYXNzIFVua25vd25UYWcgaW1wbGVtZW50cyBJVGFnCisgICAg
eworICAgICAgICBwdWJsaWMgVW5rbm93blRhZyhTdHJpbmcgdGFnTmFtZSkKKyAgICAgICAg
eworICAgICAgICAgICAgdGFnID0gdGFnTmFtZTsKKyAgICAgICAgfQorICAgICAgICBwdWJs
aWMgdm9pZCB1cGRhdGVPc2lzU3RhY2soU3RhY2sgc3RhY2spCisgICAgICAgIHsKKyAgICAg
ICAgICAgIC8vIHVua25vd24gdGFncworICAgICAgICAgICAgbG9nLndhcm4oIklnbm9yaW5n
IHRhZyBvZiAiKyB0YWcpOworICAgICAgICB9CisgICAgICAgIHByaXZhdGUgU3RyaW5nIHRh
ZzsKKyAgICB9CiAKICAgICAvKioKICAgICAgKiBUaGUgbG9nIHN0cmVhbQpJbmRleDoganN3
b3JkL2phdmEvanN3b3JkL29yZy9jcm9zc3dpcmUvanN3b3JkL2Jvb2svZGF0YS9KQVhCVXRp
bC5qYXZhCj09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT0KUkNTIGZpbGU6IC9jdnMvanN3b3JkL2p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ICAgICAgICAgIHJldHVybiAoKERpdikgY3VycmVu
dCkuZ2V0Q29udGVudCgpOworICAgICAgICB9CisgICAgICAgIGVsc2UgaWYgKGN1cnJlbnQg
aW5zdGFuY2VvZiBOb3RlKQorICAgICAgICB7CisgICAgICAgICAgICByZXR1cm4gKChOb3Rl
KSBjdXJyZW50KS5nZXRDb250ZW50KCk7CisgICAgICAgIH0KKyAgICAgICAgZWxzZSBpZiAo
Y3VycmVudCBpbnN0YW5jZW9mIFcpCisgICAgICAgIHsKKyAgICAgICAgICAgIHJldHVybiAo
KFcpIGN1cnJlbnQpLmdldENvbnRlbnQoKTsKICAgICAgICAgfQogICAgICAgICAKICAgICAg
ICAgbG9nLmVycm9yKCJ1bmtub3duIGVsZW1lbnQ6ICIrY3VycmVudC5nZXRDbGFzcygpLmdl
dE5hbWUoKSk7Cgo=
--------------080809010002040509000808--