- java.lang.Object
-
- org.mal_lang.langspec.Asset
-
public final class Asset extends Object
Immutable class representing an asset in a MAL language.- Since:
- 1.0.0
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description AttackStep
getAttackStep(String name)
Returns the attack step with the namename
in thisAsset
object.List<AttackStep>
getAttackSteps()
Returns a list of all attack steps in thisAsset
object.Category
getCategory()
Returns the category of thisAsset
object.Field
getField(String name)
Returns the field with the namename
in thisAsset
object.List<Field>
getFields()
Returns a list of all fields in thisAsset
object.AttackStep
getLocalAttackStep(String name)
Returns the local attack step with the namename
in thisAsset
object.List<AttackStep>
getLocalAttackSteps()
Returns a list of all local attack steps in thisAsset
object.Field
getLocalField(String name)
Returns the local field with the namename
in thisAsset
object.List<Field>
getLocalFields()
Returns a list of all local fields in thisAsset
object.byte[]
getLocalPngIcon()
Returns the local PNG icon of thisAsset
object.byte[]
getLocalSvgIcon()
Returns the local SVG icon of thisAsset
object.Variable
getLocalVariable(String name)
Returns the local variable with the namename
in thisAsset
object.List<Variable>
getLocalVariables()
Returns a list of all local variables in thisAsset
object.Meta
getMeta()
Returns the meta info of thisAsset
object.String
getName()
Returns the name of thisAsset
object.byte[]
getPngIcon()
Returns the PNG icon of thisAsset
object.Asset
getSuperAsset()
Returns the super asset of thisAsset
object.byte[]
getSvgIcon()
Returns the SVG icon of thisAsset
object.Variable
getVariable(String name)
Returns the variable with the namename
in thisAsset
object.List<Variable>
getVariables()
Returns a list of all variables in thisAsset
object.boolean
hasAttackStep(String name)
Returns whethername
is the name of an attack step in thisAsset
object.boolean
hasField(String name)
Returns whethername
is the name of a field in thisAsset
object.boolean
hasLocalAttackStep(String name)
Returns whethername
is the name of a local attack step in thisAsset
object.boolean
hasLocalField(String name)
Returns whethername
is the name of a local field in thisAsset
object.boolean
hasLocalPngIcon()
Returns whether thisAsset
object has a local PNG icon.boolean
hasLocalSvgIcon()
Returns whether thisAsset
object has a local SVG icon.boolean
hasLocalVariable(String name)
Returns whethername
is the name of a local variable in thisAsset
object.boolean
hasPngIcon()
Returns whether thisAsset
object has an PNG icon.boolean
hasSuperAsset()
Returns whether thisAsset
object has a super asset.boolean
hasSvgIcon()
Returns whether thisAsset
object has an SVG icon.boolean
hasVariable(String name)
Returns whethername
is the name of a variable in thisAsset
object.boolean
isAbstract()
Returns whether thisAsset
object is abstract.boolean
isSubTypeOf(Asset other)
Returns whether thisAsset
object is a sub type ofother
.static Asset
leastUpperBound(Asset asset1, Asset asset2)
Returns the least upper bound ofasset1
andasset2
, ornull
ifasset1
andasset2
have no upper bound.
-
-
-
Method Detail
-
getName
public String getName()
Returns the name of thisAsset
object.- Returns:
- the name of this
Asset
object - Since:
- 1.0.0
-
getMeta
public Meta getMeta()
Returns the meta info of thisAsset
object.- Returns:
- the meta info of this
Asset
object - Since:
- 1.0.0
-
getCategory
public Category getCategory()
Returns the category of thisAsset
object.- Returns:
- the category of this
Asset
object - Since:
- 1.0.0
-
isAbstract
public boolean isAbstract()
Returns whether thisAsset
object is abstract.- Returns:
- whether this
Asset
object is abstract - Since:
- 1.0.0
-
hasSuperAsset
public boolean hasSuperAsset()
Returns whether thisAsset
object has a super asset.- Returns:
- whether this
Asset
object has a super asset - Since:
- 1.0.0
-
getSuperAsset
public Asset getSuperAsset()
Returns the super asset of thisAsset
object.- Returns:
- the super asset of this
Asset
object - Throws:
UnsupportedOperationException
- if thisAsset
object does not have a super asset- Since:
- 1.0.0
-
hasLocalField
public boolean hasLocalField(String name)
Returns whethername
is the name of a local field in thisAsset
object.- Parameters:
name
- the name of the local field- Returns:
- whether
name
is the name of a local field in thisAsset
object - Throws:
NullPointerException
- ifname
isnull
- Since:
- 1.0.0
-
getLocalField
public Field getLocalField(String name)
Returns the local field with the namename
in thisAsset
object.- Parameters:
name
- the name of the local field- Returns:
- the local field with the name
name
in thisAsset
object - Throws:
NullPointerException
- ifname
isnull
IllegalArgumentException
- ifname
is not the name of a local field in thisAsset
object- Since:
- 1.0.0
-
getLocalFields
public List<Field> getLocalFields()
Returns a list of all local fields in thisAsset
object.- Returns:
- a list of all local fields in this
Asset
object - Since:
- 1.0.0
-
hasField
public boolean hasField(String name)
Returns whethername
is the name of a field in thisAsset
object.- Parameters:
name
- the name of the field- Returns:
- whether
name
is the name of a field in thisAsset
object - Throws:
NullPointerException
- ifname
isnull
- Since:
- 1.0.0
-
getField
public Field getField(String name)
Returns the field with the namename
in thisAsset
object.- Parameters:
name
- the name of the field- Returns:
- the field with the name
name
in thisAsset
object - Throws:
NullPointerException
- ifname
isnull
IllegalArgumentException
- ifname
is not the name of a field in thisAsset
object- Since:
- 1.0.0
-
getFields
public List<Field> getFields()
Returns a list of all fields in thisAsset
object.- Returns:
- a list of all fields in this
Asset
object - Since:
- 1.0.0
-
hasLocalVariable
public boolean hasLocalVariable(String name)
Returns whethername
is the name of a local variable in thisAsset
object.- Parameters:
name
- the name of the local variable- Returns:
- whether
name
is the name of a local variable in thisAsset
object - Throws:
NullPointerException
- ifname
isnull
- Since:
- 1.0.0
-
getLocalVariable
public Variable getLocalVariable(String name)
Returns the local variable with the namename
in thisAsset
object.- Parameters:
name
- the name of the local variable- Returns:
- the local variable with the name
name
in thisAsset
object - Throws:
NullPointerException
- ifname
isnull
IllegalArgumentException
- ifname
is not the name of a local variable in thisAsset
object- Since:
- 1.0.0
-
getLocalVariables
public List<Variable> getLocalVariables()
Returns a list of all local variables in thisAsset
object.- Returns:
- a list of all local variables in this
Asset
object - Since:
- 1.0.0
-
hasVariable
public boolean hasVariable(String name)
Returns whethername
is the name of a variable in thisAsset
object.- Parameters:
name
- the name of the variable- Returns:
- whether
name
is the name of a variable in thisAsset
object - Throws:
NullPointerException
- ifname
isnull
- Since:
- 1.0.0
-
getVariable
public Variable getVariable(String name)
Returns the variable with the namename
in thisAsset
object.- Parameters:
name
- the name of the variable- Returns:
- the variable with the name
name
in thisAsset
object - Throws:
NullPointerException
- ifname
isnull
IllegalArgumentException
- ifname
is not the name of a variable in thisAsset
object- Since:
- 1.0.0
-
getVariables
public List<Variable> getVariables()
Returns a list of all variables in thisAsset
object.- Returns:
- a list of all variables in this
Asset
object - Since:
- 1.0.0
-
hasLocalAttackStep
public boolean hasLocalAttackStep(String name)
Returns whethername
is the name of a local attack step in thisAsset
object.- Parameters:
name
- the name of the local attack step- Returns:
- whether
name
is the name of a local attack step in thisAsset
object - Throws:
NullPointerException
- ifname
isnull
- Since:
- 1.0.0
-
getLocalAttackStep
public AttackStep getLocalAttackStep(String name)
Returns the local attack step with the namename
in thisAsset
object.- Parameters:
name
- the name of the local attack step- Returns:
- the local attack step with the name
name
in thisAsset
object - Throws:
NullPointerException
- ifname
isnull
IllegalArgumentException
- ifname
is not the name of a local attack step in thisAsset
object- Since:
- 1.0.0
-
getLocalAttackSteps
public List<AttackStep> getLocalAttackSteps()
Returns a list of all local attack steps in thisAsset
object.- Returns:
- a list of all local attack steps in this
Asset
object - Since:
- 1.0.0
-
hasAttackStep
public boolean hasAttackStep(String name)
Returns whethername
is the name of an attack step in thisAsset
object.- Parameters:
name
- the name of the attack step- Returns:
- whether
name
is the name of an attack step in thisAsset
object - Throws:
NullPointerException
- ifname
isnull
- Since:
- 1.0.0
-
getAttackStep
public AttackStep getAttackStep(String name)
Returns the attack step with the namename
in thisAsset
object.- Parameters:
name
- the name of the attack step- Returns:
- the attack step with the name
name
in thisAsset
object - Throws:
NullPointerException
- ifname
isnull
IllegalArgumentException
- ifname
is not the name of an attack step in thisAsset
object- Since:
- 1.0.0
-
getAttackSteps
public List<AttackStep> getAttackSteps()
Returns a list of all attack steps in thisAsset
object.- Returns:
- a list of all attack steps in this
Asset
object - Since:
- 1.0.0
-
hasLocalSvgIcon
public boolean hasLocalSvgIcon()
Returns whether thisAsset
object has a local SVG icon.- Returns:
- whether this
Asset
object has a local SVG icon - Since:
- 1.0.0
-
getLocalSvgIcon
public byte[] getLocalSvgIcon()
Returns the local SVG icon of thisAsset
object.- Returns:
- the local SVG icon of this
Asset
object - Throws:
UnsupportedOperationException
- if thisAsset
object does not have a local SVG icon- Since:
- 1.0.0
-
hasSvgIcon
public boolean hasSvgIcon()
Returns whether thisAsset
object has an SVG icon.- Returns:
- whether this
Asset
object has an SVG icon - Since:
- 1.0.0
-
getSvgIcon
public byte[] getSvgIcon()
Returns the SVG icon of thisAsset
object.- Returns:
- the SVG icon of this
Asset
object - Throws:
UnsupportedOperationException
- if thisAsset
object does not have an SVG icon- Since:
- 1.0.0
-
hasLocalPngIcon
public boolean hasLocalPngIcon()
Returns whether thisAsset
object has a local PNG icon.- Returns:
- whether this
Asset
object has a local PNG icon - Since:
- 1.0.0
-
getLocalPngIcon
public byte[] getLocalPngIcon()
Returns the local PNG icon of thisAsset
object.- Returns:
- the local PNG icon of this
Asset
object - Throws:
UnsupportedOperationException
- if thisAsset
object does not have a local PNG icon- Since:
- 1.0.0
-
hasPngIcon
public boolean hasPngIcon()
Returns whether thisAsset
object has an PNG icon.- Returns:
- whether this
Asset
object has an PNG icon - Since:
- 1.0.0
-
getPngIcon
public byte[] getPngIcon()
Returns the PNG icon of thisAsset
object.- Returns:
- the PNG icon of this
Asset
object - Throws:
UnsupportedOperationException
- if thisAsset
object does not have an PNG icon- Since:
- 1.0.0
-
isSubTypeOf
public boolean isSubTypeOf(Asset other)
Returns whether thisAsset
object is a sub type ofother
.- Parameters:
other
- anotherAsset
object- Returns:
- whether this
Asset
object is a sub type ofother
- Throws:
NullPointerException
- ifother
isnull
- Since:
- 1.0.0
-
leastUpperBound
public static Asset leastUpperBound(Asset asset1, Asset asset2)
Returns the least upper bound ofasset1
andasset2
, ornull
ifasset1
andasset2
have no upper bound.- Parameters:
asset1
- anAsset
objectasset2
- anAsset
object- Returns:
- the least upper bound of
asset1
andasset2
, ornull
ifasset1
andasset2
have no upper bound - Throws:
NullPointerException
- ifasset1
orasset2
isnull
- Since:
- 1.0.0
-
-