public class Example
extends java.lang.Object
| Constructor | Description |
|---|---|
Example(Attribute[] attribs) |
Creates an example with initial values taken from attributes.
|
Example(Attribute[] attribs,
Field[] fields) |
Creates an example with given values (which must be suitable to the attributes).
|
Example(Field[] fields) |
Makes a new example with given values.
|
| Modifier and Type | Method | Description |
|---|---|---|
void |
copy(Example example) |
Takes values of fields (and name) from another example.
|
Example |
duplicate() |
Makes a new instance of an example.
|
Field |
getField(int index) |
Gives a reference to a field at a specified index.
|
java.lang.String |
getName() |
Reads the example's name.
|
void |
setField(Field[] fields) |
Sets fields of this example.
|
void |
setName(java.lang.String name) |
Stores a new name for this example.
|
int |
size() |
Gives size of field table in the example.
|
java.lang.String |
toString() |
Returns a
String which represents the value of this example. |
public Example(Attribute[] attribs)
attribs - table of attributes to take fields from (cannot be empty)InvalidValueException - if given attribute table is emptyjava.lang.NullPointerException - when the table is nullpublic Example(Attribute[] attribs, Field[] fields)
attribs - table of attributes (cannot be empty)fields - table of fields to store in (must meet the attribtes' constraints)InvalidTypeException - if field's type is incorrectInvalidValueException - when atribute table is empty or field table length is incorrectjava.lang.NullPointerException - if any param is nullpublic Example(Field[] fields)
fields - table of values to store in the exampleInvalidValueException - when the table is emptyjava.lang.NullPointerException - if given table or any field inside is nullpublic void copy(Example example)
example - object to take fields fromInvalidTypeException - if the examples don't match each otherjava.lang.NullPointerException - if given example is nullpublic Example duplicate()
public Field getField(int index)
index - position in the exampleInvalidValueException - if the index is out of bound of the examplepublic int size()
public java.lang.String getName()
public void setName(java.lang.String name)
[A-Za-z_][A-Za-z_0-9]*name - new name of the exampleInvalidValueException - when the name cannot be acceptedpublic java.lang.String toString()
String which represents the value of this example.
This is a set of values taken from all fields and enclosed in brackets.toString in class java.lang.Objectpublic void setField(Field[] fields)
fields - new fields of this examplejava.lang.NullPointerException - if fields are null