add spec reference setter

This commit is contained in:
REAndroid 2023-01-01 06:49:36 -05:00
parent d0f6703a19
commit cadd96846c

View File

@ -278,6 +278,10 @@ public class EntryBlock extends Block implements JSONConvert<JSONObject> {
mSpecReference.set(ref); mSpecReference.set(ref);
updateSpecRef(old, ref); updateSpecRef(old, ref);
} }
public void setSpecReference(SpecString specString){
removeSpecRef();
mSpecReference.set(specString.getIndex());
}
public BaseResValue getResValue(){ public BaseResValue getResValue(){
return mResValue; return mResValue;
} }
@ -620,6 +624,21 @@ public class EntryBlock extends Block implements JSONConvert<JSONObject> {
specStringNew.addReference(getSpecReferenceBlock()); specStringNew.addReference(getSpecReferenceBlock());
} }
} }
private void removeSpecRef(){
TypeBlock typeBlock=getTypeBlock();
if(typeBlock==null){
return;
}
PackageBlock packageBlock=typeBlock.getPackageBlock();
if(packageBlock==null){
return;
}
SpecStringPool specStringPool=packageBlock.getSpecStringPool();
SpecString specString=specStringPool.get(getSpecReference());
if(specString!=null){
specString.removeReference(getSpecReferenceBlock());
}
}
private void updatePackage(){ private void updatePackage(){
TypeBlock typeBlock=getTypeBlock(); TypeBlock typeBlock=getTypeBlock();
if(typeBlock==null){ if(typeBlock==null){