SAM

org.topcased.modeler.sam.util
Class InstancesUtil

java.lang.Object
  extended by org.topcased.modeler.sam.util.InstancesUtil

public class InstancesUtil
extends java.lang.Object

Library of helper functions to deal with instances creation/checking in a "generic" way.


Constructor Summary
InstancesUtil()
           
 
Method Summary
static MultiPort createEmptyCopyMultiPort(MultiPort existingPort)
          Creates a new multiport and sets its name to that of the existing port.
static Port createEmptyCopyPort(Port existingPort)
          Creates a new empty Port and set its name to that of the existing port.
static ModelContent createModelContentCopy(ModelContent model)
          An empty copy of the ModelContent given in parameter.
static IConfiguration getconfiguration(GraphNode node)
           
static EObject getEmfElement(GraphElement graphElement)
          Convenience method returning the corresponding emf element.
static java.util.List<MultiPort> getListMultiPorts(ModelContent content)
           
static java.util.List<Port> getListPorts(ModelContent content)
           
static URI getSamdiUriFromSamUri(URI samUri)
          Used to get the uri to a '.samdi' file corresponding to the '.sam' file given in parameter.
static boolean isAnImport(EObject elementToImport)
          Checks that the element to import is a ModelContent and that it is at the top level of the hierarchy.
static boolean isAReference(EObject object)
          Checks wether the argument has its IsInstanceOf reference set.
static boolean isSamUri(URI uri)
          Convenience method testing wether a given uri (as returned by ResourceDialog.getURIs(), ie either a 'platform' or a 'file' uri) points to a local sam file.
static void setIsInstanceOf(EObject referencer, EObject referenced)
          Sets the name and instanceOf properties of the referencer aproprietly.
static void updateAllContents(ModelContent referencer, ModelContent referenced)
          Updates all the ports and multiports of the referencer according to what's found in the referenced.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InstancesUtil

public InstancesUtil()
Method Detail

isAReference

public static boolean isAReference(EObject object)
Checks wether the argument has its IsInstanceOf reference set.

Parameters:
object -
Returns:

isAnImport

public static boolean isAnImport(EObject elementToImport)
Checks that the element to import is a ModelContent and that it is at the top level of the hierarchy.

Parameters:
elementToImport -
Returns:

createEmptyCopyPort

public static Port createEmptyCopyPort(Port existingPort)
Creates a new empty Port and set its name to that of the existing port.

Parameters:
existingPort -
Returns:

createEmptyCopyMultiPort

public static MultiPort createEmptyCopyMultiPort(MultiPort existingPort)
Creates a new multiport and sets its name to that of the existing port.

Parameters:
existingPort -
Returns:

getEmfElement

public static EObject getEmfElement(GraphElement graphElement)
Convenience method returning the corresponding emf element.

Parameters:
graphElement -
Returns:

getListPorts

public static java.util.List<Port> getListPorts(ModelContent content)

getListMultiPorts

public static java.util.List<MultiPort> getListMultiPorts(ModelContent content)

updateAllContents

public static void updateAllContents(ModelContent referencer,
                                     ModelContent referenced)
Updates all the ports and multiports of the referencer according to what's found in the referenced.

Parameters:
referencer -
referenced -

createModelContentCopy

public static ModelContent createModelContentCopy(ModelContent model)
An empty copy of the ModelContent given in parameter.

Parameters:
model -
Returns:

getconfiguration

public static IConfiguration getconfiguration(GraphNode node)
Parameters:
node -
Returns:
the configuration for the given node

getSamdiUriFromSamUri

public static URI getSamdiUriFromSamUri(URI samUri)
Used to get the uri to a '.samdi' file corresponding to the '.sam' file given in parameter.

Parameters:
samUri -
Returns:

setIsInstanceOf

public static void setIsInstanceOf(EObject referencer,
                                   EObject referenced)
Sets the name and instanceOf properties of the referencer aproprietly.

Parameters:
referencer -
referenced -

isSamUri

public static boolean isSamUri(URI uri)
Convenience method testing wether a given uri (as returned by ResourceDialog.getURIs(), ie either a 'platform' or a 'file' uri) points to a local sam file.

Parameters:
uri -
Returns:
true if the uri represents a '.sam' file, false otherwise.

SAM

Copyright (c) 2005 TOPCASED Contributors 2005 - 2007. All rights reserved.