Greet 2014
Documentation for the GREET 2014 API
 All Classes Namespaces Functions Variables Enumerations Properties Events
Greet.DataStructureV3.DataHelper Class Reference

More...

Inheritance diagram for Greet.DataStructureV3.DataHelper:
Greet.DataStructureV3.Interfaces.IDataHelper

Public Member Functions

 DataHelper (GData data)
 Default construsctor, needs a reference to an instance of a GData object More...
 
void addInputToBiogenicCarbonMatrix (Dictionary< Guid, Dictionary< Guid, double >> CarbonTransferts, IInput input)
 Tests if a transfer value can be added for that new input (i.e. if we already have some outputs defined) Otherwise do not change anything to the transfert matrix More...
 
void addInputToBiogenicCarbonMatrix (IProcess process, IIO output)
 
IIO createNewCoProduct (int resourceId, double amount=0, string quantity="joules")
 Creates a new output if the resource ID exists in the database, returns null otherwise More...
 
IInput createNewInput (int resourceId, double amount=0, string quantity="joules", int source=0)
 Creates a new input if resource ID exists in the database, returns null otherwise More...
 
IIO createNewMainOutput (int resourceId, double amount=0, string quantity="joules")
 Creates a new output if the resource ID exists in the database, returns null otherwise More...
 
IPathway createNewPathway (string name="")
 Creates a new instance of a Pathway WITHOUT adding it to the dataset More...
 
IProcess createNewProcess (int type, string name="")
 Creates a new instance of a process either stationary or transportation More...
 
IResource createNewResource (string name="")
 Creates a new instance of a resource given a name for that resource More...
 
IMix DuplicateMix (IMix mix)
 Creates a new instance of a mix with a new ID and new output ID Takes care of registering all parameters and assiging new IDs More...
 
IPathway DuplicatePathway (IPathway o)
 Creates a copy of a pathway with an identical structure but a whole new set of IDs More...
 
IStationaryProcess DuplicateStationaryProcess (IStationaryProcess stationaryProcess)
 Creates a copy of a stationary process with an identical structure but new IDs and parameters More...
 
ITransportationProcess DuplicateTransportationProcess (ITransportationProcess transportationProcess)
 Creates a copy of a transportation process with an identical structure but new IDs and parameters More...
 
bool insertOrUpdatePathway (IPathway pathway, out string errorMessage)
 Tries to insert a pathway in the database, checks for validity before insertion If a pathway with the same ID is already inserted, then overwrites the existing one with the new pathway given as a parameter More...
 
bool insertOrUpdateProcess (IProcess process, out string errorMessage)
 Tries to insert a process in the database, checks for validity before insertion If a process with the same ID is already inserted, then overwrites the existing one with the new process given as a parameter More...
 
bool insertOrUpdateProcessOutput (IProcess process, IIO output, out string errorMessage)
 
bool insertOrUpdateResource (IResource resource)
 Inserts a new resource in the database or replace the one with the same ID if it already exists More...
 
bool insertProcessInput (IProcess process, IInput input, bool toGroup, out string errorMessage)
 Inserts an input to a StationaryProcess only if the Input is either and InputWithShare or if the input is an Input More...
 
List< IDependentItemmixDependentItems (IDependentItem idi)
 List of all data that is dependent on the inputted object. More...
 
List< IDependentItemPathwayDependentItems (IDependentItem pathway, Guid output=new Guid())
 List all instances that are dependent of the Pathway passed as a argument More...
 
int PathwayMainOutputResouce (int pathwayId)
 Returns the resource ID of the main output for a given pathway More...
 
List< IDependentItemProcessDependentItems (IDependentItem idi, Guid io=new Guid())
 Checks if a process is used in pathways, if the io Guid is provided we'll only check for the specified io otherwise we'll check for any of the input or outputs. More...
 
List< IInputResourceReferenceProduceResource (int resourceId)
 This is a list of all mixes and pathways that output a given resource. More...
 
void removeInputToBiogenicCarbonMatrix (Dictionary< Guid, Dictionary< Guid, double >> CarbonTransferts, Guid guid)
 Removes the carbon transfer ratio associated with an input Guid More...
 
List< IDependentItemresourceDependentItems (IDependentItem r)
 List of all data that is dependent on the inputted object. More...
 
List< IDependentItemTechnologyDependentItems (IDependentItem idi)
 
List< int > unUsed ()
 
List< int > unUsedMixes ()
 This method returns a list of mixes that are un-used by other parts of the sofware. In other words there is no other entitiy in Greet that is dependent on these mixes. More...
 
List< int > unUsedPathways ()
 This method returns a list of pathways that are un-used by other parts of the sofware. In other words there is no other entitiy in Greet that is dependent on these pathways. More...
 
List< int > unUsedResources ()
 This method returns a list of resources that are un-used by other parts of the sofware. In other words there is no other entitiy in Greet that is dependent on these resources. More...
 
List< int > unUsedTechnologies ()
 
List< int > unUsedVehicles ()
 This method returns a list of vehicles that are un-used by other parts of the sofware. In other words there is no other entitiy in Greet that is dependent on these vehicles. More...
 
List< int > usedMixes ()
 This method returns a list of mixes that are used by other parts of the software. In other words there are entities in Greet dependent on the exisitence of these mixes. More...
 
List< int > usedPathways ()
 This method returns a list of pathways that are used by other parts of the software. In other words there are entities in Greet dependent on the exisitence of these pathways. More...
 
List< int > usedProcesses ()
 
List< int > usedResources ()
 This method returns a list of resources that are used by other parts of the software. In other words there are entities in Greet dependent on the exisitence of these resources. More...
 
List< int > usedTechnologies ()
 
List< int > usedVehicles ()
 This method returns a list of vehicles that are used by other parts of the software. In other words there are entities in Greet dependent on the exisitence of these vehicles. More...
 
List< IDependentItemVehicleDependentItems (IDependentItem idi)
 List of all data that is dependent on the inputted object. More...
 

Detailed Description

A wrapper class for the data class. Simplify the usage of the data class by providing easier entry point to manage data.

The main idea is that by using this wrapper class, the data will be managed and in a consitance state at any time.

It is recomended to use the wrapper class for any operations that are done from External libraries such as Model or Gui. If functionalities are missing, send a request or inplement a new method here and respect the naming convention and conventional interfaces

Constructor & Destructor Documentation

Greet.DataStructureV3.DataHelper.DataHelper ( GData  data)

Default construsctor, needs a reference to an instance of a GData object

Parameters
data

Member Function Documentation

void Greet.DataStructureV3.DataHelper.addInputToBiogenicCarbonMatrix ( Dictionary< Guid, Dictionary< Guid, double >>  CarbonTransferts,
IInput  input 
)

Tests if a transfer value can be added for that new input (i.e. if we already have some outputs defined) Otherwise do not change anything to the transfert matrix

Parameters
CarbonTransfertsReference to an instance of a CarbonTransferMatrix
inputInput beeing added

Implements Greet.DataStructureV3.Interfaces.IDataHelper.

void Greet.DataStructureV3.DataHelper.addInputToBiogenicCarbonMatrix ( IProcess  process,
IIO  output 
)

Adds an output ratio to the carbon transfer ratio matrix.

Also adds all inputs that may be added if necessary

Parameters
processprocess for which we want to add an output
outputthe output beeing added to the process

Implements Greet.DataStructureV3.Interfaces.IDataHelper.

IIO Greet.DataStructureV3.DataHelper.createNewCoProduct ( int  resourceId,
double  amount = 0,
string  quantity = "joules" 
)

Creates a new output if the resource ID exists in the database, returns null otherwise

Parameters
resourceIdID of an existing resource
amountDesign amount for the output
quantityQuantity for the design amount
Returns
New instance of Output or null

Implements Greet.DataStructureV3.Interfaces.IDataHelper.

IInput Greet.DataStructureV3.DataHelper.createNewInput ( int  resourceId,
double  amount = 0,
string  quantity = "joules",
int  source = 0 
)

Creates a new input if resource ID exists in the database, returns null otherwise

Parameters
resourceIdID of an existing resource
amountDesign amount for the input
quantityQuantity for the design amount
sourceSource of the input, 0=Well, 1=Previous, 2=Pathway, 3=Mix
Returns
New instance of Input or null

Implements Greet.DataStructureV3.Interfaces.IDataHelper.

IIO Greet.DataStructureV3.DataHelper.createNewMainOutput ( int  resourceId,
double  amount = 0,
string  quantity = "joules" 
)

Creates a new output if the resource ID exists in the database, returns null otherwise

Parameters
resourceIdID of an existing resource
amountDesign amount for the output
quantityQuantity for the design amount
Returns
New instance of Output or null

Implements Greet.DataStructureV3.Interfaces.IDataHelper.

IPathway Greet.DataStructureV3.DataHelper.createNewPathway ( string  name = "")

Creates a new instance of a Pathway WITHOUT adding it to the dataset

Parameters
nameOptional name for the created pathway
Returns
New instance of pathway

Implements Greet.DataStructureV3.Interfaces.IDataHelper.

IProcess Greet.DataStructureV3.DataHelper.createNewProcess ( int  type,
string  name = "" 
)

Creates a new instance of a process either stationary or transportation

Parameters
type0 for stationary, 1 for transportation
nameOptional name for the newly created process
Returns
Null if type is not 0 nor 1, otherwise an instance of a new Process

Implements Greet.DataStructureV3.Interfaces.IDataHelper.

IResource Greet.DataStructureV3.DataHelper.createNewResource ( string  name = "")

Creates a new instance of a resource given a name for that resource

Parameters
nameOptional name for the resource
Returns
New instance of the created resource

Implements Greet.DataStructureV3.Interfaces.IDataHelper.

IMix Greet.DataStructureV3.DataHelper.DuplicateMix ( IMix  mix)

Creates a new instance of a mix with a new ID and new output ID Takes care of registering all parameters and assiging new IDs

Parameters
mixThe mix to be duplicated
Returns
A new instance of the mix

Implements Greet.DataStructureV3.Interfaces.IDataHelper.

IPathway Greet.DataStructureV3.DataHelper.DuplicatePathway ( IPathway  o)

Creates a copy of a pathway with an identical structure but a whole new set of IDs

Parameters
o
Returns

Implements Greet.DataStructureV3.Interfaces.IDataHelper.

IStationaryProcess Greet.DataStructureV3.DataHelper.DuplicateStationaryProcess ( IStationaryProcess  stationaryProcess)

Creates a copy of a stationary process with an identical structure but new IDs and parameters

Parameters
stationaryProcessThe process to be duplicated
Returns
The new instance of a duplicated process

Implements Greet.DataStructureV3.Interfaces.IDataHelper.

ITransportationProcess Greet.DataStructureV3.DataHelper.DuplicateTransportationProcess ( ITransportationProcess  transportationProcess)

Creates a copy of a transportation process with an identical structure but new IDs and parameters

Parameters
transportationProcessThe process to be duplicated
Returns
The new instance of a duplicated process

Implements Greet.DataStructureV3.Interfaces.IDataHelper.

bool Greet.DataStructureV3.DataHelper.insertOrUpdatePathway ( IPathway  pathway,
out string  errorMessage 
)

Tries to insert a pathway in the database, checks for validity before insertion If a pathway with the same ID is already inserted, then overwrites the existing one with the new pathway given as a parameter

Parameters
pathwayPathway to be inserted
errorMessageError messages if any when checking the integrity of that pathway
Returns
True if pathway inserted correctly without any issues

Implements Greet.DataStructureV3.Interfaces.IDataHelper.

bool Greet.DataStructureV3.DataHelper.insertOrUpdateProcess ( IProcess  process,
out string  errorMessage 
)

Tries to insert a process in the database, checks for validity before insertion If a process with the same ID is already inserted, then overwrites the existing one with the new process given as a parameter

Parameters
processProcess to be inserted
errorMessageError messages if any when checking the integrity of that process
Returns

Implements Greet.DataStructureV3.Interfaces.IDataHelper.

bool Greet.DataStructureV3.DataHelper.insertOrUpdateProcessOutput ( IProcess  process,
IIO  output,
out string  errorMessage 
)

If the output is a MainOutput, sets or update the existing main output of the process

If the output is a CoProduct, adds or update an existing co-product that outputs the same resource ID

Parameters
processProcess to which we want to add an output(Main output or co-product)
outputOutput to be added to the process
errorMessageError messages if any errors
Returns
True if inserted or updated, false otherwise

Implements Greet.DataStructureV3.Interfaces.IDataHelper.

bool Greet.DataStructureV3.DataHelper.insertOrUpdateResource ( IResource  resource)

Inserts a new resource in the database or replace the one with the same ID if it already exists

Parameters
resourceThe new resource to be added or used as an update
Returns
True if insertion was done

Implements Greet.DataStructureV3.Interfaces.IDataHelper.

bool Greet.DataStructureV3.DataHelper.insertProcessInput ( IProcess  process,
IInput  input,
bool  toGroup,
out string  errorMessage 
)

Inserts an input to a StationaryProcess only if the Input is either and InputWithShare or if the input is an Input

Parameters
processStationary process to which the input is going to be added
inputThe instance of an input to add to the process
toGroupIf input is an instance on Input, setting to true will add in process Group, ignored otherwise
errorMessageError message for insertion or errors detected in the process integrity after insertion
Returns
True if added to the process, false otherwise

Implements Greet.DataStructureV3.Interfaces.IDataHelper.

List<IDependentItem> Greet.DataStructureV3.DataHelper.mixDependentItems ( IDependentItem  idi)

List of all data that is dependent on the inputted object.

Parameters
pw
Returns

Implements Greet.DataStructureV3.Interfaces.IDataHelper.

List<IDependentItem> Greet.DataStructureV3.DataHelper.PathwayDependentItems ( IDependentItem  pathway,
Guid  output = new Guid() 
)

List all instances that are dependent of the Pathway passed as a argument

Parameters
pathwayThe pathway for which we want to know all the dependencies
outputOptional GUID for the output that we want to test. If empty all outputs are considered
Returns

Implements Greet.DataStructureV3.Interfaces.IDataHelper.

int Greet.DataStructureV3.DataHelper.PathwayMainOutputResouce ( int  pathwayId)

Returns the resource ID of the main output for a given pathway

Parameters
pathwayId
Returns

Implements Greet.DataStructureV3.Interfaces.IDataHelper.

List<IDependentItem> Greet.DataStructureV3.DataHelper.ProcessDependentItems ( IDependentItem  idi,
Guid  io = new Guid() 
)

Checks if a process is used in pathways, if the io Guid is provided we'll only check for the specified io otherwise we'll check for any of the input or outputs.

Parameters
idiProcess IDependentItem
ioSpecific IO GUID if necessary
Returns

Implements Greet.DataStructureV3.Interfaces.IDataHelper.

List<IInputResourceReference> Greet.DataStructureV3.DataHelper.ProduceResource ( int  resourceId)

This is a list of all mixes and pathways that output a given resource.

Parameters
resourceIdThe resource id whose list of possible ways is needed
Returns
The return type is a list of InputResourceReference's because this object can represent a pathway or a mix depending on the source attribute of the object

Implements Greet.DataStructureV3.Interfaces.IDataHelper.

void Greet.DataStructureV3.DataHelper.removeInputToBiogenicCarbonMatrix ( Dictionary< Guid, Dictionary< Guid, double >>  CarbonTransferts,
Guid  guid 
)

Removes the carbon transfer ratio associated with an input Guid

Parameters
dictionaryReference to an instance of a CarbonTransferMatrix
inputID of Input beeing removed

Implements Greet.DataStructureV3.Interfaces.IDataHelper.

List<IDependentItem> Greet.DataStructureV3.DataHelper.resourceDependentItems ( IDependentItem  r)

List of all data that is dependent on the inputted object.

Parameters
pw
Returns

Implements Greet.DataStructureV3.Interfaces.IDataHelper.

List<IDependentItem> Greet.DataStructureV3.DataHelper.TechnologyDependentItems ( IDependentItem  idi)

Parameters
idi
Returns

Implements Greet.DataStructureV3.Interfaces.IDataHelper.

List<int> Greet.DataStructureV3.DataHelper.unUsed ( )
List<int> Greet.DataStructureV3.DataHelper.unUsedMixes ( )

This method returns a list of mixes that are un-used by other parts of the sofware. In other words there is no other entitiy in Greet that is dependent on these mixes.

Returns

Implements Greet.DataStructureV3.Interfaces.IDataHelper.

List<int> Greet.DataStructureV3.DataHelper.unUsedPathways ( )

This method returns a list of pathways that are un-used by other parts of the sofware. In other words there is no other entitiy in Greet that is dependent on these pathways.

Returns

Implements Greet.DataStructureV3.Interfaces.IDataHelper.

List<int> Greet.DataStructureV3.DataHelper.unUsedResources ( )

This method returns a list of resources that are un-used by other parts of the sofware. In other words there is no other entitiy in Greet that is dependent on these resources.

Returns

Implements Greet.DataStructureV3.Interfaces.IDataHelper.

List<int> Greet.DataStructureV3.DataHelper.unUsedTechnologies ( )
List<int> Greet.DataStructureV3.DataHelper.unUsedVehicles ( )

This method returns a list of vehicles that are un-used by other parts of the sofware. In other words there is no other entitiy in Greet that is dependent on these vehicles.

Returns

Implements Greet.DataStructureV3.Interfaces.IDataHelper.

List<int> Greet.DataStructureV3.DataHelper.usedMixes ( )

This method returns a list of mixes that are used by other parts of the software. In other words there are entities in Greet dependent on the exisitence of these mixes.

Returns

Implements Greet.DataStructureV3.Interfaces.IDataHelper.

List<int> Greet.DataStructureV3.DataHelper.usedPathways ( )

This method returns a list of pathways that are used by other parts of the software. In other words there are entities in Greet dependent on the exisitence of these pathways.

Returns

Implements Greet.DataStructureV3.Interfaces.IDataHelper.

List<int> Greet.DataStructureV3.DataHelper.usedProcesses ( )
List<int> Greet.DataStructureV3.DataHelper.usedResources ( )

This method returns a list of resources that are used by other parts of the software. In other words there are entities in Greet dependent on the exisitence of these resources.

Returns

Implements Greet.DataStructureV3.Interfaces.IDataHelper.

List<int> Greet.DataStructureV3.DataHelper.usedTechnologies ( )
List<int> Greet.DataStructureV3.DataHelper.usedVehicles ( )

This method returns a list of vehicles that are used by other parts of the software. In other words there are entities in Greet dependent on the exisitence of these vehicles.

Returns

Implements Greet.DataStructureV3.Interfaces.IDataHelper.

List<IDependentItem> Greet.DataStructureV3.DataHelper.VehicleDependentItems ( IDependentItem  idi)

List of all data that is dependent on the inputted object.

Parameters
veh
Returns

Implements Greet.DataStructureV3.Interfaces.IDataHelper.


The documentation for this class was generated from the following file: