public void setUp() { E = new Event(2,4); if (E == null); { } }
/// <summary> /// Creates the MoBi Event Assignemnts by the given Event Assignments by the /// given SBML Event. /// </summary> private void CreateEventAssignments(Event sbmlEvent) { if (sbmlEvent.getNumEventAssignments() <= 0) { return; } for (long i = 0; i < sbmlEvent.getNumEventAssignments(); i++) { CreateEventAssignment(sbmlEvent.getEventAssignment(i)); } }
public void test_Event_addEventAssignment2() { Event e = new Event(2,2); EventAssignment ea = new EventAssignment(2,3); ea.setVariable( "f"); ea.setMath(libsbml.parseFormula("a-n")); int i = e.addEventAssignment(ea); assertTrue( i == libsbml.LIBSBML_VERSION_MISMATCH ); assertTrue( e.getNumEventAssignments() == 0 ); ea = null; e = null; }
public void test_Event_addEventAssignment1() { Event e = new Event(2,2); EventAssignment ea = new EventAssignment(2,2); int i = e.addEventAssignment(ea); assertTrue( i == libsbml.LIBSBML_INVALID_OBJECT ); ea.setVariable( "f"); i = e.addEventAssignment(ea); assertTrue( i == libsbml.LIBSBML_INVALID_OBJECT ); ea.setMath(libsbml.parseFormula("a-n")); i = e.addEventAssignment(ea); assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS ); assertTrue( e.getNumEventAssignments() == 1 ); ea = null; e = null; }
/// <summary> /// Creates a MoBi Event by the given SBML Event. /// </summary> internal void CreateEvent(Event sbmlEvent) { EventBuilder = new EventBuilder() .WithId(sbmlEvent.getId() + SBMLConstants.SBML_EVENTBUILDER) .WithName(sbmlEvent.getId()) .WithDescription(sbmlEvent.getNotesString()); if (sbmlEvent.isSetTrigger()) { CreateCondition(sbmlEvent.getTrigger()); } CreateEventAssignments(sbmlEvent); CreateWarningsForUnsupportedFeatures(sbmlEvent); EventGroupBuilder.Add(EventBuilder); }
public void test_Event_createWithNS() { XMLNamespaces xmlns = new XMLNamespaces(); xmlns.add( "http://www.sbml.org", "testsbml"); SBMLNamespaces sbmlns = new SBMLNamespaces(2,4); sbmlns.addNamespaces(xmlns); Event object1 = new Event(sbmlns); assertTrue( object1.getTypeCode() == libsbml.SBML_EVENT ); assertTrue( object1.getMetaId() == "" ); assertTrue( object1.getNotes() == null ); assertTrue( object1.getAnnotation() == null ); assertTrue( object1.getLevel() == 2 ); assertTrue( object1.getVersion() == 4 ); assertTrue( object1.getNamespaces() != null ); assertTrue( object1.getNamespaces().getLength() == 2 ); object1 = null; }
/// <summary> /// Creates warnings to inform the user, that "Delay" and "Priority" of events are not supported/considered. /// </summary> private void CreateWarningsForUnsupportedFeatures(Event sbmlEvent) { if (sbmlEvent.isSetDelay()) { var msg = new NotificationMessage(_sbmlProject, MessageOrigin.All, null, NotificationType.Warning) { Message = SBMLConstants.SBML_FEATURE_NOT_SUPPORTED + ": Delay of Events is not considered." }; _sbmlInformation.NotificationMessages.Add(msg); } if (!sbmlEvent.isSetPriority()) { return; } var msg2 = new NotificationMessage(_sbmlProject, MessageOrigin.All, null, NotificationType.Warning) { Message = SBMLConstants.SBML_FEATURE_NOT_SUPPORTED + ": Priority of Events is not considered." }; _sbmlInformation.NotificationMessages.Add(msg2); }
public void test_L3_Event_createWithNS() { XMLNamespaces xmlns = new XMLNamespaces(); xmlns.add( "http://www.sbml.org", "testsbml"); SBMLNamespaces sbmlns = new SBMLNamespaces(3,1); sbmlns.addNamespaces(xmlns); Event e = new Event(sbmlns); assertTrue( e.getTypeCode() == libsbml.SBML_EVENT ); assertTrue( e.getMetaId() == "" ); assertTrue( e.getNotes() == null ); assertTrue( e.getAnnotation() == null ); assertTrue( e.getLevel() == 3 ); assertTrue( e.getVersion() == 1 ); assertTrue( e.getNamespaces() != null ); assertTrue( e.getNamespaces().getLength() == 2 ); assertTrue( e.getId() == "" ); assertTrue( e.getName() == "" ); assertTrue( e.getUseValuesFromTriggerTime() == true ); assertEquals( false, e.isSetId() ); assertEquals( false, e.isSetName() ); assertEquals( false, e.isSetUseValuesFromTriggerTime() ); e = null; }
public void test_Event_setTimeUnits3() { string units = "1second"; Event e = new Event(2,1); int i = e.setTimeUnits(units); assertTrue( i == libsbml.LIBSBML_INVALID_ATTRIBUTE_VALUE ); assertEquals( false, e.isSetTimeUnits() ); i = e.unsetTimeUnits(); assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS ); assertEquals( false, e.isSetTimeUnits() ); e = null; }
public void test_Event_setTimeUnits4() { Event e = new Event(2,1); int i = e.setTimeUnits(""); assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS ); assertEquals( false, e.isSetTimeUnits() ); e = null; }
public void test_Trigger_ancestor_create() { Event e = new Event(2,4); Trigger ea = e.createTrigger(); assertTrue( ea.getAncestorOfType(libsbml.SBML_EVENT) == e ); assertTrue( ea.getAncestorOfType(libsbml.SBML_DOCUMENT) == null ); assertTrue( ea.getAncestorOfType(libsbml.SBML_COMPARTMENT) == null ); Trigger obj = e.getTrigger(); assertTrue( obj.getAncestorOfType(libsbml.SBML_EVENT) == e ); assertTrue( obj.getAncestorOfType(libsbml.SBML_DOCUMENT) == null ); assertTrue( obj.getAncestorOfType(libsbml.SBML_COMPARTMENT) == null ); }
public void test_Event_setTimeUnits2() { string units = "second"; Event e = new Event(2,1); int i = e.setTimeUnits(units); assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS ); assertTrue(( units == e.getTimeUnits() )); assertEquals( true, e.isSetTimeUnits() ); i = e.unsetTimeUnits(); assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS ); assertEquals( false, e.isSetTimeUnits() ); e = null; }
public void test_EventAssignment_parent_add() { Event e = new Event(2,4); EventAssignment ea = new EventAssignment(2,4); ea.setVariable("c"); ea.setMath(libsbml.parseFormula("K+L")); e.addEventAssignment(ea); ea = null; ListOf lo = e.getListOfEventAssignments(); assertTrue( lo == e.getEventAssignment(0).getParentSBMLObject() ); assertTrue( e == lo.getParentSBMLObject() ); }
public void test_Event() { Event e = new Event(2,4); assertEquals( false, (e.hasRequiredElements()) ); Trigger t = new Trigger(2,4); t.setMath(libsbml.parseFormula("true")); e.setTrigger(t); assertEquals( false, (e.hasRequiredElements()) ); e.createEventAssignment(); assertEquals( true, e.hasRequiredElements() ); e = null; }
/** * Copy constructor; creates a copy of this Event. * * @param orig the object to copy. * * @throws SBMLConstructorException * Thrown if the argument @p orig is @c null. */ public Event(Event orig) : this(libsbmlPINVOKE.new_Event__SWIG_2(Event.getCPtr(orig)), true) { if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve(); }
public void test_EventAssignment_ancestor_create() { Event e = new Event(2,4); EventAssignment ea = e.createEventAssignment(); ListOf lo = e.getListOfEventAssignments(); assertTrue( ea.getAncestorOfType(libsbml.SBML_EVENT) == e ); assertTrue( ea.getAncestorOfType(libsbml.SBML_LIST_OF) == lo ); assertTrue( ea.getAncestorOfType(libsbml.SBML_DOCUMENT) == null ); assertTrue( ea.getAncestorOfType(libsbml.SBML_COMPARTMENT) == null ); EventAssignment obj = e.getEventAssignment(0); assertTrue( obj.getAncestorOfType(libsbml.SBML_EVENT) == e ); assertTrue( obj.getAncestorOfType(libsbml.SBML_LIST_OF) == lo ); assertTrue( obj.getAncestorOfType(libsbml.SBML_DOCUMENT) == null ); assertTrue( obj.getAncestorOfType(libsbml.SBML_COMPARTMENT) == null ); }
internal static HandleRef getCPtr(Event obj) { return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; }
internal static HandleRef getCPtrAndDisown(Event obj) { HandleRef ptr = new HandleRef(null, IntPtr.Zero); if (obj != null) { ptr = obj.swigCPtr; obj.swigCMemOwn = false; } return ptr; }
public void test_Trigger_parent_add() { Trigger d = new Trigger(2,4); Event e = new Event(2,4); e.setTrigger(d); d = null; assertTrue( e == e.getTrigger().getParentSBMLObject() ); e = null; }
public void test_Event_parent_add() { Event e = new Event(2,4); Trigger t = new Trigger(2,4); e.setTrigger(t); e.createEventAssignment(); Model m = new Model(2,4); m.addEvent(e); e = null; ListOf lo = m.getListOfEvents(); assertTrue( lo == m.getEvent(0).getParentSBMLObject() ); assertTrue( m == lo.getParentSBMLObject() ); }
public void test_EventAssignment_parent_create() { Event e = new Event(2,4); EventAssignment ea = e.createEventAssignment(); ListOf lo = e.getListOfEventAssignments(); assertTrue( lo == e.getEventAssignment(0).getParentSBMLObject() ); assertTrue( lo == ea.getParentSBMLObject() ); assertTrue( e == lo.getParentSBMLObject() ); }
public void test_Event_setUseValuesFromTriggerTime1() { Event e = new Event(2,4); int i = e.setUseValuesFromTriggerTime(false); assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS ); assertTrue( e.getUseValuesFromTriggerTime() == false ); i = e.setUseValuesFromTriggerTime(true); assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS ); assertTrue( e.getUseValuesFromTriggerTime() == true ); e = null; }
public void test_EventAssignment_ancestor_add() { Event e = new Event(2,4); EventAssignment ea = new EventAssignment(2,4); ea.setVariable("c"); ea.setMath(libsbml.parseFormula("K+L")); e.addEventAssignment(ea); ea = null; ListOf lo = e.getListOfEventAssignments(); EventAssignment obj = e.getEventAssignment(0); assertTrue( obj.getAncestorOfType(libsbml.SBML_EVENT) == e ); assertTrue( obj.getAncestorOfType(libsbml.SBML_LIST_OF) == lo ); assertTrue( obj.getAncestorOfType(libsbml.SBML_DOCUMENT) == null ); assertTrue( obj.getAncestorOfType(libsbml.SBML_COMPARTMENT) == null ); }
public void test_Event_setUseValuesFromTriggerTime2() { Event e = new Event(2,2); int i = e.setUseValuesFromTriggerTime(false); assertTrue( i == libsbml.LIBSBML_UNEXPECTED_ATTRIBUTE ); e = null; }
public void test_Event_addEventAssignment3() { Event e = new Event(2,2); int i = e.addEventAssignment(null); assertTrue( i == libsbml.LIBSBML_OPERATION_FAILED ); assertTrue( e.getNumEventAssignments() == 0 ); e = null; }
public void tearDown() { E = null; }
public void test_Delay_parent_add() { Delay d = new Delay(2,4); Event e = new Event(2,4); e.setDelay(d); d = null; assertTrue( e == e.getDelay().getParentSBMLObject() ); e = null; }
public void test_Delay_ancestor_create() { Event e = new Event(2,4); Delay ea = e.createDelay(); assertTrue( ea.getAncestorOfType(libsbml.SBML_EVENT) == e ); assertTrue( ea.getAncestorOfType(libsbml.SBML_DOCUMENT) == null ); assertTrue( ea.getAncestorOfType(libsbml.SBML_COMPARTMENT) == null ); Delay obj = e.getDelay(); assertTrue( obj.getAncestorOfType(libsbml.SBML_EVENT) == e ); assertTrue( obj.getAncestorOfType(libsbml.SBML_DOCUMENT) == null ); assertTrue( obj.getAncestorOfType(libsbml.SBML_COMPARTMENT) == null ); }
public void test_Event_ancestor_add() { Event e = new Event(2,4); Model m = new Model(2,4); Trigger t = new Trigger(2,4); e.setTrigger(t); e.createEventAssignment(); m.addEvent(e); e = null; ListOf lo = m.getListOfEvents(); Event obj = m.getEvent(0); assertTrue( obj.getAncestorOfType(libsbml.SBML_MODEL) == m ); assertTrue( obj.getAncestorOfType(libsbml.SBML_LIST_OF) == lo ); assertTrue( obj.getAncestorOfType(libsbml.SBML_DOCUMENT) == null ); assertTrue( obj.getAncestorOfType(libsbml.SBML_COMPARTMENT) == null ); }
/** * Adds a copy of the given Event object to this Model. * * @param e the Event object to add * * * @return integer value indicating success/failure of the * function. @if clike The value is drawn from the * enumeration #OperationReturnValues_t. @endif The possible values * returned by this function are: * @li @link libsbml#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS@endlink * @li @link libsbml#LIBSBML_LEVEL_MISMATCH LIBSBML_LEVEL_MISMATCH@endlink * @li @link libsbml#LIBSBML_VERSION_MISMATCH LIBSBML_VERSION_MISMATCH@endlink * @li @link libsbml#LIBSBML_DUPLICATE_OBJECT_ID LIBSBML_DUPLICATE_OBJECT_ID@endlink * @li @link libsbml#LIBSBML_INVALID_OBJECT LIBSBML_INVALID_OBJECT@endlink * @li @link libsbml#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED@endlink * * * @note This method should be used with some caution. The fact that this * method @em copies the object passed to it means that the caller will be * left holding a physically different object instance than the one contained * inside this object. Changes made to the original object instance (such as * resetting attribute values) will <em>not affect the instance in this * object</em>. In addition, the caller should make sure to free the * original object if it is no longer being used, or else a memory leak will * result. Please see other methods on this class (particularly a * corresponding method whose name begins with the word <code>create</code>) * for alternatives that do not lead to these issues. * * * * @see createEvent() */ public int addEvent(Event e) { int ret = libsbmlPINVOKE.Model_addEvent(swigCPtr, Event.getCPtr(e)); return ret; }
public void test_Event_createEventAssignment() { Event e = new Event(2,2); EventAssignment ea = e.createEventAssignment(); assertTrue( e.getNumEventAssignments() == 1 ); assertTrue( (ea).getLevel() == 2 ); assertTrue( (ea).getVersion() == 2 ); e = null; }
public void test_Event_constructor() { SBase s; try { s = new Event(2,1); s = new Event(2,2); s = new Event(2,3); s = new Event(2,4); s = new Event(3,1); s = new Event(SN21); s = new Event(SN22); s = new Event(SN23); s = new Event(SN24); s = new Event(SN31); } catch (SBMLConstructorException e) { s = null; } assertTrue(s != null); string msg = ""; try { s = new Event(1,1); } catch (SBMLConstructorException e) { msg = e.Message; } assertTrue(msg == ErrMsg); msg = ""; try { s = new Event(1,2); } catch (SBMLConstructorException e) { msg = e.Message; } assertTrue(msg == ErrMsg); msg = ""; try { s = new Event(9,8); } catch (SBMLConstructorException e) { msg = e.Message; } assertTrue(msg == ErrMsg); msg = ""; try { s = new Event(SN11); } catch (SBMLConstructorException e) { msg = e.Message; } assertTrue(msg == ErrMsg); msg = ""; try { s = new Event(SN12); } catch (SBMLConstructorException e) { msg = e.Message; } assertTrue(msg == ErrMsg); msg = ""; try { s = new Event(SN99); } catch (SBMLConstructorException e) { msg = e.Message; } assertTrue(msg == ErrMsg); }
public void test_Trigger_ancestor_add() { Trigger d = new Trigger(2,4); Event e = new Event(2,4); e.setTrigger(d); d = null; Trigger obj = e.getTrigger(); assertTrue( obj.getAncestorOfType(libsbml.SBML_EVENT) == e ); assertTrue( obj.getAncestorOfType(libsbml.SBML_MODEL) == null ); assertTrue( obj.getAncestorOfType(libsbml.SBML_DOCUMENT) == null ); e = null; }