public class Sketch
extends java.lang.Object
implements java.io.Serializable
Modifier and Type | Field and Description |
---|---|
protected @NotNull cufy.util.Node<Sketch> |
components
A node relating to the components of this sketch.
|
protected @NotNull java.lang.String |
kind
The kind name of this sketch.
|
protected @NotNull java.util.Map<java.lang.String,java.lang.Object> |
meta
The additional meta-data of this sketch.
|
protected @NotNull java.lang.String |
name
The current name of this sketch.
|
protected @Nullable Tree |
tree
The tree this sketch is from.
|
Constructor and Description |
---|
Sketch()
Construct a new sketch.
|
Sketch(@NotNull java.lang.String kind)
Construct a new sketch.
|
Sketch(@NotNull java.lang.String name,
@NotNull java.lang.String kind)
Construct a new sketch.
|
Sketch(@NotNull Tree tree)
Construct a new sketch that references the given
tree as its tree. |
Sketch(@NotNull Tree tree,
@NotNull java.lang.String kind)
Construct a new sketch that references the given
tree as its tree. |
Sketch(@NotNull Tree tree,
@NotNull java.lang.String name,
@NotNull java.lang.String kind)
Construct a new sketch that references the given
tree as its tree. |
Modifier and Type | Method and Description |
---|---|
static cufy.util.Node.Key |
component(java.lang.String name)
Return the component key with the given
name . |
@NotNull Sketch |
get(cufy.util.Node.Key key)
Return the component of this sketch with the given
key . |
@NotNull java.lang.String |
getKind()
Return the kind of this sketch.
|
@NotNull java.util.Map<java.lang.String,java.lang.Object> |
getMeta()
Get the meta-data map of this sketch.
|
@NotNull java.lang.String |
getName()
Get the name of this tree.
|
@Nullable Tree |
getTree()
Return the tree of this sketch.
|
@NotNull Sketch |
replace(cufy.util.Node.Key key)
Replace the component of this sketch with the given
key with another
sketch. |
@NotNull Sketch |
setKind(@NotNull java.lang.String kind)
Set the kind of this sketch to be the given
kind . |
@NotNull Sketch |
setName(@NotNull java.lang.String name)
Set the name of this sketch to be the given
name . |
Sketch |
setTree(@NotNull Tree tree)
Set the tree this sketch is from to be the given
tree . |
@NotNull java.lang.String |
toString() |
@NotNull protected final @NotNull cufy.util.Node<Sketch> components
@NotNull protected final @NotNull java.util.Map<java.lang.String,java.lang.Object> meta
@NotNull protected @NotNull java.lang.String kind
@NotNull protected @NotNull java.lang.String name
@Nullable protected @Nullable Tree tree
public Sketch()
public Sketch(@NotNull @NotNull java.lang.String kind)
kind
- the initial kind of the constructed sketch.java.lang.NullPointerException
- if the given kind
is null.public Sketch(@NotNull @NotNull java.lang.String name, @NotNull @NotNull java.lang.String kind)
name
- the initial name of the constructed sketch.kind
- the initial kind of the constructed sketch.java.lang.NullPointerException
- if the given name
or kind
is null.public Sketch(@NotNull @NotNull Tree tree)
tree
as its tree.tree
- the tree the constructed sketch will be pointing to.java.lang.NullPointerException
- if the given tree
is null.public Sketch(@NotNull @NotNull Tree tree, @NotNull @NotNull java.lang.String kind)
tree
as its tree.tree
- the tree the constructed sketch will be pointing to.kind
- the initial kind of the constructed sketch.java.lang.NullPointerException
- if the given tree
or kind
is null.public Sketch(@NotNull @NotNull Tree tree, @NotNull @NotNull java.lang.String name, @NotNull @NotNull java.lang.String kind)
tree
as its tree.tree
- the tree the constructed sketch will be pointing to.name
- the initial name of the constructed sketch.kind
- the initial kind of the constructed sketch.java.lang.NullPointerException
- if the given tree
or name
or kind
is null.@NotNull @Contract(pure=true) public static cufy.util.Node.Key component(java.lang.String name)
name
.name
- the name of the component.java.lang.NullPointerException
- if the given name
is null.@NotNull @Contract(pure=true) public @NotNull java.lang.String toString()
toString
in class java.lang.Object
@NotNull @Contract(pure=true) public @NotNull Sketch get(@NotNull cufy.util.Node.Key key)
key
.key
- the key of the component.key
.java.lang.NullPointerException
- if the given key
is null.@NotNull @Contract(pure=true) public @NotNull java.lang.String getKind()
@NotNull @Contract(pure=true) public @NotNull java.util.Map<java.lang.String,java.lang.Object> getMeta()
@NotNull @Contract(pure=true) public @NotNull java.lang.String getName()
@Nullable @Contract(pure=true) public @Nullable Tree getTree()
@NotNull @Contract(mutates="this") public @NotNull Sketch replace(@NotNull cufy.util.Node.Key key)
key
with another
sketch.key
- the key of the component.java.lang.NullPointerException
- if the given key
is null.@NotNull @Contract(value="_->this", mutates="this") public @NotNull Sketch setKind(@NotNull @NotNull java.lang.String kind)
kind
.kind
- the kind of this sketch.@NotNull @Contract(value="_->this", mutates="this") public @NotNull Sketch setName(@NotNull @NotNull java.lang.String name)
name
.name
- the name of this sketch.@Contract(value="_->this", mutates="this") public Sketch setTree(@NotNull @NotNull Tree tree)
tree
.tree
- the tree to be set.java.lang.NullPointerException
- if the given tree
is null.java.lang.IllegalStateException
- if this sketch already have a tree set.