codeblocks
Class BlockGenus

java.lang.Object
  extended by codeblocks.BlockGenus

public class BlockGenus
extends java.lang.Object

A genus describes the properties that define a block. For example, fd is a block genus that describes all forward block instances in Starlogo. The BlockGenus class stores all the immutable properties and socket information of a genus.


Method Summary
 boolean areSocketsExpandable()
          Returns true iff this genus's sockets are expandable
 java.lang.String getBlockDescription()
          Returns the String block text description of this.
 java.awt.Color getColor()
          Returns the Color of this; May return Color.Black if color was unspecified.
 java.util.List<java.util.List<BlockConnector>> getExpandGroups()
          Returns the expand groups of this.
 java.lang.String getGenusName()
          Returns the name of this genus
static BlockGenus getGenusWithName(java.lang.String name)
          Returns the BlockGenus with the specified name; null if this name does not exist
 BlockConnector getInitAfter()
          Returns the initial after connector of this
 BlockConnector getInitBefore()
          Returns the initial before connector of this
 java.util.Map<BlockImageIcon.ImageLocation,BlockImageIcon> getInitBlockImageMap()
          Returns the initial BlockImageIcon mapping of this.
 java.lang.Iterable<java.lang.String> getInitialArgumentDescriptions()
          Returns the set of argument descriptions of this.
 java.lang.String getInitialLabel()
          Returns the initial label of this
 BlockConnector getInitPlug()
          Returns the initial plug connector of this
 java.lang.Iterable<BlockConnector> getInitSockets()
          Returns the initial set of sockets of this
 java.lang.String getLabelPrefix()
          Returns the String block label prefix of this
 java.lang.String getLabelSuffix()
          Returns the String block label prefix of this
 java.lang.String getProperty(java.lang.String property)
          Returns the value of the specified language dependent property
 java.util.List<java.lang.String> getSiblingsList()
          Returns the siblings of this genus.
 java.lang.Iterable<java.lang.String> getStubList()
          Returns a list of the stub kinds (or stub genus names) of this; if this genus does not have any stubs, returns an empty list
 boolean hasAfterConnector()
          Returns true if this genus has a "after" connector; false otherwise.
 boolean hasBeforeConnector()
          Returns true if this genus has a "before" connector; false otherwise.
 boolean hasDefaultArgs()
          Returns true iff any one of the connectors for this genus has default arguments; false otherwise
 boolean hasSiblings()
          Returns true if this genus has siblings; false otherwise.
 boolean hasStubs()
          Returns true is this genus has stubs (references such as getters, setters, etc.); false otherwise
 boolean isCommandBlock()
          Returns true if this block is a command block (i.e.
 boolean isDataBlock()
          Returns true if this block is a data block a.k.a.
 boolean isDeclaration()
          Returns true if this genus is a declaration block.
 boolean isFunctionBlock()
          Returns true iff this block is a function block, which takes in an input and produces an output.
 boolean isInfix()
          Returns true iff this genus is an infix operator.
 boolean isLabelEditable()
          Returns true if the label of this is editable; false otherwise
 boolean isLabelValue()
          Returns true if the value of this genus is contained within the label of this; false otherwise
 boolean isListRelated()
          Returns true if this block is a list or a list operator (determined by whether it has at least one list connector of any type); false otherwise.
 boolean isPageLabelSetByPage()
          Returns true iff this genus can have page label.
 boolean isProcedureDeclBlock()
          Returns true if this block is a procedure declaration block; false otherwise
 boolean isProcedureParamBlock()
          Returns true if this block is a procedure parameter block; false otherwise
 boolean isVariableDeclBlock()
          Returns true if this block is a variable declaration block; false otherwise
 boolean labelMustBeUnique()
          Returns true if the label of this must be unique; false otherwise
static void loadBlockGenera(org.w3c.dom.Element root)
          Loads the all the initial BlockGenuses and BlockGenus families of this language
static void main(java.lang.String[] args)
           
static void resetAllGenuses()
          Resets all the Block Genuses of current language.
 java.lang.String toString()
          Returns String representation of this
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

resetAllGenuses

public static void resetAllGenuses()
Resets all the Block Genuses of current language.


getGenusWithName

public static BlockGenus getGenusWithName(java.lang.String name)
Returns the BlockGenus with the specified name; null if this name does not exist

Parameters:
name - the name of the desired BlockGenus
Returns:
the BlockGenus with the specified name; null if this name does not exist

getSiblingsList

public java.util.List<java.lang.String> getSiblingsList()
Returns the siblings of this genus. If this genus has no siblings, returns an empty list. Each element in the list is the block genus name of a sibling. Note: For a genus to have siblings, its label must be uneditable. An editable label interferes with the drop down menu widget that blocks with siblings have.

Returns:
the siblings of this genus.

hasSiblings

public boolean hasSiblings()
Returns true if this genus has siblings; false otherwise. Note: For a genus to have siblings, its label must be uneditable. An editable label interferes with the drop down menu widget that blocks with siblings have.

Returns:
true if this genus has siblings; false otherwise.

getStubList

public java.lang.Iterable<java.lang.String> getStubList()
Returns a list of the stub kinds (or stub genus names) of this; if this genus does not have any stubs, returns an empty list

Returns:
a list of the stub kinds (or stub genus names) of this; if this genus does not have any stubs, returns an empty list

hasStubs

public boolean hasStubs()
Returns true is this genus has stubs (references such as getters, setters, etc.); false otherwise

Returns:
true is this genus has stubs (references such as getters, setters, etc.); false otherwise

hasDefaultArgs

public boolean hasDefaultArgs()
Returns true iff any one of the connectors for this genus has default arguments; false otherwise

Returns:
true iff any one of the connectors for this genus has default arguments; false otherwise

isCommandBlock

public boolean isCommandBlock()
Returns true if this block is a command block (i.e. forward, say, etc.); false otherwise

Returns:
true if this block is a command block (i.e. forward, say, etc.); false otherwise

isDataBlock

public boolean isDataBlock()
Returns true if this block is a data block a.k.a. a primitive (i.e. number, string, boolean); false otherwise

Returns:
Returns true if this block is a data block a.k.a. a primitive (i.e. number, string, boolean); false otherwise

isFunctionBlock

public boolean isFunctionBlock()
Returns true iff this block is a function block, which takes in an input and produces an output. (i.e. math blocks, arctan, add to list); false otherwise.

Returns:
true iff this block is a function block, which takes in an input and produces an output. (i.e. math blocks, arctan, add to list); false otherwise.

isVariableDeclBlock

public boolean isVariableDeclBlock()
Returns true if this block is a variable declaration block; false otherwise

Returns:
true if this block is a variable declaration block; false otherwise

isProcedureDeclBlock

public boolean isProcedureDeclBlock()
Returns true if this block is a procedure declaration block; false otherwise

Returns:
true if this block is a procedure declaration block; false otherwise

isProcedureParamBlock

public boolean isProcedureParamBlock()
Returns true if this block is a procedure parameter block; false otherwise


isDeclaration

public boolean isDeclaration()
Returns true if this genus is a declaration block. Declaration blocks define variables and procedures.


isListRelated

public boolean isListRelated()
Returns true if this block is a list or a list operator (determined by whether it has at least one list connector of any type); false otherwise.

Returns:
is determined by whether it has at least one list connector of any type.

hasBeforeConnector

public boolean hasBeforeConnector()
Returns true if this genus has a "before" connector; false otherwise.

Returns:
true is this genus has a "before" connector; false otherwise.

hasAfterConnector

public boolean hasAfterConnector()
Returns true if this genus has a "after" connector; false otherwise.

Returns:
true if this genus has a "after" connector; false otherwise.

isLabelValue

public boolean isLabelValue()
Returns true if the value of this genus is contained within the label of this; false otherwise

Returns:
true if the value of this genus is contained within the label of this; false otherwise

isLabelEditable

public boolean isLabelEditable()
Returns true if the label of this is editable; false otherwise

Returns:
true if the label of this is editable; false otherwise

isPageLabelSetByPage

public boolean isPageLabelSetByPage()
Returns true iff this genus can have page label.

Returns:
true iff this genus can have page label

labelMustBeUnique

public boolean labelMustBeUnique()
Returns true if the label of this must be unique; false otherwise

Returns:
true if the label of this must be unique; false otherwise

areSocketsExpandable

public boolean areSocketsExpandable()
Returns true iff this genus's sockets are expandable


isInfix

public boolean isInfix()
Returns true iff this genus is an infix operator. This genus must be supporting two bottom sockets.

Returns:
true iff this genus is an infix operator. This genus must be supporting two bottom sockets.

getGenusName

public java.lang.String getGenusName()
Returns the name of this genus

Returns:
the name of this genus

getInitialLabel

public java.lang.String getInitialLabel()
Returns the initial label of this

Returns:
the initial label of this

getLabelPrefix

public java.lang.String getLabelPrefix()
Returns the String block label prefix of this

Returns:
the String block label prefix of this

getLabelSuffix

public java.lang.String getLabelSuffix()
Returns the String block label prefix of this

Returns:
the String block label prefix of this

getBlockDescription

public java.lang.String getBlockDescription()
Returns the String block text description of this. Also known as the block tool tip, or block description. If no descriptions exists, return null.


getInitialArgumentDescriptions

public java.lang.Iterable<java.lang.String> getInitialArgumentDescriptions()
Returns the set of argument descriptions of this. Argument index to argument description relationship may not be inferred as one-to-one. That is, an existing socket may not have an existing description (in the case if incomplete descriptions). An existing description may not have an existing socket (in the case of expandable socket sizes). If no descriptions exists, return null.


getColor

public java.awt.Color getColor()
Returns the Color of this; May return Color.Black if color was unspecified.

Returns:
the Color of this; May return Color.Black if color was unspecified.

getInitBlockImageMap

public java.util.Map<BlockImageIcon.ImageLocation,BlockImageIcon> getInitBlockImageMap()
Returns the initial BlockImageIcon mapping of this. Returned Map is unmodifiable.

Returns:
the initial and unmodifiable BlockImageIcon mapping of this

getProperty

public java.lang.String getProperty(java.lang.String property)
Returns the value of the specified language dependent property

Parameters:
property - the property to look up
Returns:
the value of the specified language dependent property; null if property does not exist

getInitSockets

public java.lang.Iterable<BlockConnector> getInitSockets()
Returns the initial set of sockets of this

Returns:
the initial set of sockets of this

getInitPlug

public BlockConnector getInitPlug()
Returns the initial plug connector of this

Returns:
the initial plug connector of this

getInitBefore

public BlockConnector getInitBefore()
Returns the initial before connector of this

Returns:
the initial before connector of this

getInitAfter

public BlockConnector getInitAfter()
Returns the initial after connector of this

Returns:
the initial after connector of this

getExpandGroups

public java.util.List<java.util.List<BlockConnector>> getExpandGroups()
Returns the expand groups of this. Not modifiable.


loadBlockGenera

public static void loadBlockGenera(org.w3c.dom.Element root)
Loads the all the initial BlockGenuses and BlockGenus families of this language

Parameters:
root - the Element carrying the specifications of the BlockGenuses

toString

public java.lang.String toString()
Returns String representation of this

Overrides:
toString in class java.lang.Object

main

public static void main(java.lang.String[] args)