data
Class Group

java.lang.Object
  extended bydata.Group

public class Group
extends Object

This class represents a group of Shapes, with the possibility to contain subgroups (which can contain subgroups and shapes, etc.).

One could argue that Groups can replace Shapes, grouping Curves instead of Shapes, but if I ever were to expand this program, having Shapes could be useful (for example when ControlPoints should be linked).

Since:
1.00
Version:
1.10
Author:
Berend "Kirk" Wouda

Field Summary
protected  ArrayList grouplist
          The List of Groups in this Group.
protected  String name
          The name of this Group.
protected  ArrayList shapelist
          The List of Shapes in this Group.
protected  int x
          The horizontal position of this Group.
protected  int y
          The vertical position of this Group.
 
Constructor Summary
Group(String name, int x, int y)
          Constructs a new Group with the given attributes.
 
Method Summary
 void addGroup(Group group)
          Adds the given Group to this Group.
 void addShape(Shape shape)
          Adds the given Shape to this Group.
 Group getGroup(int index)
          Returns the Group at index.
 String getName()
          Returns the name of this Group.
 int getNumberOfGroups()
          Returns the number of Groups in this Group.
 int getNumberOfShapes()
          Returns the number of Shapes in this Group.
 Shape getShape(int index)
          Returns the Shape at index.
 int getX()
          Returns the horizontal position of this Group.
 int getY()
          Returns the vertical position of this Group.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

protected String name
The name of this Group.


x

protected int x
The horizontal position of this Group.


y

protected int y
The vertical position of this Group.


shapelist

protected ArrayList shapelist
The List of Shapes in this Group.


grouplist

protected ArrayList grouplist
The List of Groups in this Group.

Constructor Detail

Group

public Group(String name,
             int x,
             int y)
Constructs a new Group with the given attributes.

Parameters:
name - The name of this Group.
x - The horizontal position of this Group.
y - The vertical position of this Group.
Method Detail

getName

public String getName()
Returns the name of this Group.

Returns:
The name of this Group.

getX

public int getX()
Returns the horizontal position of this Group.

Returns:
The horizontal position of this Group.

getY

public int getY()
Returns the vertical position of this Group.

Returns:
The vertical position of this Group.

getShape

public Shape getShape(int index)
Returns the Shape at index.

Parameters:
index - The index the Shape is at.
Returns:
The Shape at index.

addShape

public void addShape(Shape shape)
Adds the given Shape to this Group.

Parameters:
shape - The Shape to be added. May not be null.

getNumberOfShapes

public int getNumberOfShapes()
Returns the number of Shapes in this Group.

Returns:
The number of Shapes in this Group.

getGroup

public Group getGroup(int index)
Returns the Group at index.

Parameters:
index - The index the Group is at.
Returns:
The Group at index.

addGroup

public void addGroup(Group group)
Adds the given Group to this Group.

Parameters:
group - The Group to be added. May not be null.

getNumberOfGroups

public int getNumberOfGroups()
Returns the number of Groups in this Group.

Returns:
The number of Groups in this Group.