net.praqma.monkit
Class MonKit

java.lang.Object
  extended by net.praqma.monkit.MonKit

public class MonKit
extends Object


Field Summary
static String __ROOT_TAG
           
static String __SCHEMA
           
 
Constructor Summary
MonKit()
          Constructor initializing an empty MonKit
MonKit(Document doc)
          Constructor initializing a MonKit given a Document
MonKit(File destination)
          Constructor initializing an empty MonKit with a predefined output destination
 
Method Summary
 void add(List<MonKitCategory> categories)
          Add a List of categories to the MonKit
 void add(List<MonKitObservation> elements, String category)
          Add a series of observations
 void add(MonKitCategory mkc)
          Add another MonKitCategory to the MonKit
 void add(MonKitObservation mke, String category)
          Add an observation given a MonKitObservation
 void add(String name, String value, String category)
          Add an observation given the three arguments
 void addCategory(String name, String scale)
          Add a category to the MonKit
static MonKit fromString(String str)
          Given a String, a MonKit is initialized
static MonKit fromXML(File xml)
          Create a MonKit object from an xml file
 List<MonKitCategory> getCategories()
          Get a List of the available categories
 List<MonKitObservation> getObservations(String name)
          Retrieve the observations
static Schema getSchema()
           
 String getXML()
          Get the observations as String
static MonKit merge(List<MonKit> mks)
          Merge two or more MonKits
static MonKit merge(MonKit... mks)
          Merge two or more MonKits
 void save()
          Save the MonKit
 void save(File filename)
          Save the MonKit to a given destination
 List<MonKitObservation> toList(String name)
           
 String toString()
           
 boolean validate()
          Validate the MonKit xml file
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

__ROOT_TAG

public static final String __ROOT_TAG
See Also:
Constant Field Values

__SCHEMA

public static final String __SCHEMA
See Also:
Constant Field Values
Constructor Detail

MonKit

public MonKit()
Constructor initializing an empty MonKit


MonKit

public MonKit(File destination)
Constructor initializing an empty MonKit with a predefined output destination

Parameters:
destination - A File representing the output file

MonKit

public MonKit(Document doc)
       throws MonKitException
Constructor initializing a MonKit given a Document

Parameters:
doc - A valid MonKit Document
Throws:
MonKitException
Method Detail

fromXML

public static MonKit fromXML(File xml)
                      throws MonKitException
Create a MonKit object from an xml file

Parameters:
xml - A File with the MonKit obersations
Returns:
A new MonKit object
Throws:
MonKitException

fromString

public static MonKit fromString(String str)
                         throws MonKitException
Given a String, a MonKit is initialized

Parameters:
str - A valid MonKit
Returns:
A MonKit
Throws:
MonKitException

addCategory

public void addCategory(String name,
                        String scale)
Add a category to the MonKit

Parameters:
name - The name of the category
scale - The scale of the category

add

public void add(String name,
                String value,
                String category)
Add an observation given the three arguments

Parameters:
name - Name of the observation
scale - The scale of the observation
value - Value of the observation
Throws:
MonKitException

add

public void add(MonKitObservation mke,
                String category)
Add an observation given a MonKitObservation

Parameters:
mke - A MonKitElement

add

public void add(List<MonKitCategory> categories)
Add a List of categories to the MonKit

Parameters:
categories - The list of MonKitCategories

add

public void add(MonKitCategory mkc)
Add another MonKitCategory to the MonKit

Parameters:
mkc -

add

public void add(List<MonKitObservation> elements,
                String category)
Add a series of observations

Parameters:
elements - A list of MonKitObservations

getCategories

public List<MonKitCategory> getCategories()
Get a List of the available categories

Returns:

getObservations

public List<MonKitObservation> getObservations(String name)
Retrieve the observations

Returns:
A list of MonKitObservations

merge

public static MonKit merge(MonKit... mks)
Merge two or more MonKits

Parameters:
mks - An array of MonKits
Returns:
A new instantiation of MonKit

merge

public static MonKit merge(List<MonKit> mks)
Merge two or more MonKits

Parameters:
mks - A List of MonKits
Returns:
A new instantiation of MonKit

getXML

public String getXML()
Get the observations as String

Returns:

toString

public String toString()
Overrides:
toString in class Object

getSchema

public static Schema getSchema()

validate

public boolean validate()
Validate the MonKit xml file

Returns:
True or false whether the xml is valid or not

toList

public List<MonKitObservation> toList(String name)

save

public void save()
          throws IOException
Save the MonKit

Throws:
IOException

save

public void save(File filename)
          throws IOException
Save the MonKit to a given destination

Parameters:
filename -
Throws:
IOException


Copyright © 2011. All Rights Reserved.