public class Model
extends java.lang.Object
限定符和类型 | 类和说明 |
---|---|
static class |
Model.Align
Enumeration to specify a position of a component in GUI (left or right side).
|
protected class |
Model.Side
Helper class to hold the data of component loaded in left or right part of GUI
|
限定符和类型 | 字段和说明 |
---|---|
protected java.lang.String |
activeCoupleId |
protected Connections |
connections |
protected Coupling |
coupling |
private TransientCouple |
defaultCouplingParametersDonor |
protected Model.Side |
leftSide |
protected static int |
NONE |
protected Model.Side |
rightSide |
构造器和说明 |
---|
Model() |
限定符和类型 | 方法和说明 |
---|---|
void |
addComponent(Component component,
Model.Align align)
Loads given Component at given align, or removes it if component is null
|
Connection |
addConnection(Model.Align sourceAlign,
int sourceIndex,
int targetIndex)
Creates and saves new Connection.
|
private void |
checkBothComponentsLoaded()
Checks if both components (align LEFT and RIGHT) are loaded, i.e. if both
Half left and Half right have a component member.
|
private boolean |
checkComponentOverwrite(Model.Align align)
Checks if component exists at given Align.
|
private void |
checkIndex(Model.Align align,
int index)
Checks if given index is in range of the array of TransientGridRefs of
the component at given align.
|
private void |
checkValidComponentsSize(Coupling coupling)
Checks if given Coupling has at least 2 Components.
|
private TransientCouple |
createDefaultTransientCouple(Connection connection,
Couple activeCouple)
Creates TransientCouple for the given Connection.
|
void |
createNewCouple()
Creates an empty
Couple . |
int |
getCollectionSize(Model.Align align,
int index)
Gets collection size parameter of TransientGridRef
at given index at given half.
|
int |
getComponentId(Model.Align align) |
java.lang.String |
getComponentModel(Model.Align align) |
java.lang.String |
getComponentName(Model.Align align) |
java.lang.String |
getComponentSimulated(Model.Align align) |
Connection |
getConnectionAt(Model.Align align,
int index)
Returns a connection starting or ending at given Align and index if present.
|
java.util.List<Connection> |
getConnections() |
Coupling |
getCoupling() |
TransientCouple |
getDefaultCouplingParameter() |
java.lang.String |
getGridName(Model.Align align,
int index)
Gets alias name of Grid referenced by TransientGridRef at given index at
given half.
|
java.util.Map<java.lang.Integer,Grid> |
getGrids() |
int |
getLastSelectedTransientPanelIndex(Model.Align align) |
private Model.Side |
getSide(Model.Align align) |
int |
getSize(Model.Align align) |
TimestepUnit |
getTimestepUnit() |
TransientCouple |
getTransientCouple(Connection con) |
private int |
getTransientCoupleIndex(java.util.List<TransientCouple> transientCouples,
Connection connection)
Determines which of the
TransientCouple elements in
transientCouples corresponds to given Connection . |
java.util.List<TransientGridRef> |
getTransientGridRefs(Model.Align align)
Gets list of TransientGridRefs of given half.
|
java.util.List<TransientPanel.TransientPanelData> |
getTransientPanelsData(Model.Align align)
Retrieves all ui data of the TransientGridRef objects
that belong to given half.
|
java.util.Map<java.lang.Integer,Transient> |
getTransients() |
java.lang.String |
getTransientStandardName(Model.Align align,
int index)
Gets transient standard name of Transient referenced by TransientGridRef
at given index at given half.
|
boolean |
hasLastSelectedTransient(Model.Align align) |
boolean |
isComponentCoupled(Model.Align align)
Returns true, if component specified with align is coupled with any other component
|
boolean |
isConnectedAt(Model.Align align,
int index)
Checks if there is an incoming or outgoing connection at given align at
given index.
|
boolean |
isEmpty() |
boolean |
isEmpty(Model.Align align) |
boolean |
isSource(Model.Align align,
int index)
Checks if a connection at given align and given index is a source.
|
void |
loadComponents(int leftCompId,
int rightCompId)
Loads two components into the model to show them in UI.
|
void |
loadCoupling(Coupling coupling)
Takes a Coupling object and loads it into the model.
|
void |
removeConnection(Model.Align align,
int index)
Removes Connection at given align and given index.
|
void |
resetData()
Resets all data, including coupling and connections.
|
void |
resetLastSelectedTransientPanelIndex(Model.Align align) |
void |
resetTimestepValuesForAllTransientCouples()
Resets all transient couples' timestep values to default.
|
void |
setDefaultCouplingParameter(TransientCouple donor) |
void |
setLastSelectedTransientPanelIndex(Model.Align align,
int index) |
private void |
setSide(Model.Align align,
Model.Side side)
Replaces side with given side.
|
void |
updateTransientCoupleParameters(Connection connection,
TransientCouple transientCoupleDonor)
Updates the parameters of TransientCouple specified by connection to parameters of
TransientCouple passed as argument.
|
protected static final int NONE
protected Model.Side leftSide
protected Model.Side rightSide
protected Connections connections
protected java.lang.String activeCoupleId
protected Coupling coupling
private TransientCouple defaultCouplingParametersDonor
public void addComponent(Component component, Model.Align align)
component
- component to be loaded, or null to remove the component at give alignalign
- which side (LEFT or RIGHT), or null if we load the next after two componentspublic void createNewCouple()
Couple
.
Gathers all data from component of each align (LEFT and RIGHT), and merges it into an empty new couple.
It is assumed that, at the time this function is called, both sides (align LEFT and RIGHT) have components loaded.
public void loadComponents(int leftCompId, int rightCompId)
public void loadCoupling(Coupling coupling)
coupling
- coupling data from a parsed coupling xml filepublic void resetData()
public boolean isEmpty()
public boolean isEmpty(Model.Align align)
public Coupling getCoupling()
public int getSize(Model.Align align)
public int getComponentId(Model.Align align)
public java.lang.String getComponentName(Model.Align align)
public java.lang.String getComponentModel(Model.Align align)
public java.lang.String getComponentSimulated(Model.Align align)
public java.util.List<TransientPanel.TransientPanelData> getTransientPanelsData(Model.Align align)
align
- which half (LEFT or RIGHT)TransientPanel.TransientPanelData
public java.lang.String getTransientStandardName(Model.Align align, int index)
align
- which half (LEFT or RIGHT)index
- position in TransientGridRefspublic java.lang.String getGridName(Model.Align align, int index)
align
- which half (LEFT or RIGHT)index
- position in TransientGridRefspublic int getCollectionSize(Model.Align align, int index)
align
- which half (LEFT or RIGHT)index
- position in TransientGridRefspublic java.util.List<TransientGridRef> getTransientGridRefs(Model.Align align)
align
- which half (LEFT or RIGHT)public java.util.Map<java.lang.Integer,Transient> getTransients()
public java.util.Map<java.lang.Integer,Grid> getGrids()
public TimestepUnit getTimestepUnit()
public boolean hasLastSelectedTransient(Model.Align align)
public int getLastSelectedTransientPanelIndex(Model.Align align)
public void setLastSelectedTransientPanelIndex(Model.Align align, int index)
public void resetLastSelectedTransientPanelIndex(Model.Align align)
public java.util.List<Connection> getConnections()
public boolean isConnectedAt(Model.Align align, int index)
align
- which side (LEFT or RIGHT)index
- index of TransientGridRefpublic Connection getConnectionAt(Model.Align align, int index)
align
- which side (LEFT or RIGHT)index
- index of TransientGridRefpublic boolean isSource(Model.Align align, int index)
align
- which side (LEFT or RIGHT)index
- index of TransientGridRefpublic Connection addConnection(Model.Align sourceAlign, int sourceIndex, int targetIndex)
sourceAlign
- LEFT or RIGHTsourceIndex
- of source component paneltargetIndex
- of target component panelpublic boolean isComponentCoupled(Model.Align align)
align
- public void removeConnection(Model.Align align, int index)
align
- side where to remove (LEFT or RIGHT)index
- index where to removepublic TransientCouple getTransientCouple(Connection con)
private int getTransientCoupleIndex(java.util.List<TransientCouple> transientCouples, Connection connection)
TransientCouple
elements in
transientCouples corresponds to given Connection
.
Returns -1 if a corresponding TransientCouple could not be found.
transientCouples
- list to search inconnection
- to search forpublic void updateTransientCoupleParameters(Connection connection, TransientCouple transientCoupleDonor)
connection
- - connection to identify the TransientCoupletransientCoupleDonor
- -private boolean checkComponentOverwrite(Model.Align align)
align
- the side to check (LEFT or RIGHT)private void checkBothComponentsLoaded()
java.lang.Error
private void checkValidComponentsSize(Coupling coupling)
coupling
- Coupling to be checkedprivate void checkIndex(Model.Align align, int index)
align
- LEFT or RIGHTindex
- of transient panelprivate Model.Side getSide(Model.Align align)
private void setSide(Model.Align align, Model.Side side)
align
- tells if left or right half will be setside
- the side setting the valuesprivate TransientCouple createDefaultTransientCouple(Connection connection, Couple activeCouple)
connection
- representing TransientCoupleactiveCouple
- public void setDefaultCouplingParameter(TransientCouple donor)
public TransientCouple getDefaultCouplingParameter()
public void resetTimestepValuesForAllTransientCouples()