Added lots of helper functions to BdfObject and BdfNamedList
This commit is contained in:
parent
da3b6a117d
commit
8ca912589b
|
@ -1,9 +1,7 @@
|
||||||
package tests;
|
package tests;
|
||||||
|
|
||||||
import bdf.classes.IBdfClassManager;
|
import bdf.classes.IBdfClassManager;
|
||||||
import bdf.types.BdfNamedList;
|
|
||||||
import bdf.types.BdfObject;
|
import bdf.types.BdfObject;
|
||||||
import bdf.types.BdfTypes;
|
|
||||||
|
|
||||||
public class TestClass implements IBdfClassManager
|
public class TestClass implements IBdfClassManager
|
||||||
{
|
{
|
||||||
|
@ -12,16 +10,16 @@ public class TestClass implements IBdfClassManager
|
||||||
@Override
|
@Override
|
||||||
public void BdfClassLoad(BdfObject bdf)
|
public void BdfClassLoad(BdfObject bdf)
|
||||||
{
|
{
|
||||||
if(bdf.getType() != BdfTypes.NAMED_LIST) bdf.setNamedList(new BdfNamedList());
|
bdf.setNamedListIfInvalid();
|
||||||
BdfNamedList nl = bdf.getNamedList();
|
bdf.getNamedList().setIfUndefined("i", BdfObject.withInteger(0));
|
||||||
this.i = nl.contains("i") ? nl.get("i").getInteger() : 0;
|
this.i = bdf.getNamedList().get("i").getInteger();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void BdfClassSave(BdfObject bdf)
|
public void BdfClassSave(BdfObject bdf)
|
||||||
{
|
{
|
||||||
bdf.setNamedList(new BdfNamedList());
|
bdf.setNamedList();
|
||||||
bdf.getNamedList().set("i", BdfObject.with(i));
|
bdf.getNamedList().set("i", BdfObject.withInteger(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void tick()
|
public void tick()
|
||||||
|
|
Loading…
Reference in New Issue