/*PLEASE DO NOT EDIT THIS CODE*/
/*This code was generated using the UMPLE 1.38.0.9138.a49b0ba93 modeling language!*/
// line 1 "JavaScriptOptionalAssociation.ump"
class Team
{
  //------------------------
  // MEMBER VARIABLES
  //------------------------
  //Team Associations
  //------------------------
  // CONSTRUCTOR
  //------------------------
  constructor()
  {
    this._players = [];
  }
  //------------------------
  // INTERFACE
  //------------------------
  /* Code from template association_GetMany */
  getPlayer(index)
  {
    let aPlayer = this._players[index];
    return aPlayer;
  }
  getPlayers()
  {
    let newPlayers = this._players.slice();
    return newPlayers;
  }
  numberOfPlayers()
  {
    let number = this._players.length;
    return number;
  }
  hasPlayers()
  {
    let has = this._players.length > 0;
    return has;
  }
  indexOfPlayer(aPlayer)
  {
    let index = this._players.indexOf(aPlayer);
    return index;
  }
  /* Code from template association_MinimumNumberOfMethod */
  static minimumNumberOfPlayers()
  {
    return 0;
  }
  /* Code from template association_AddManyToOptionalOne */
  addPlayer(aPlayer)
  {
    let wasAdded = false;
    if (this._players.includes(aPlayer))
    {
      return false;
    }
    let existingTeam = aPlayer.getTeam();
    if (existingTeam == null)
    {
      aPlayer.setTeam(this);
    }
    else if (! (this == existingTeam))
    {
      existingTeam.removePlayer(aPlayer);
      this.addPlayer(aPlayer);
    }
    else
    {
      this._players.push(aPlayer);
    }
    wasAdded = true;
    return wasAdded;
  }
  removePlayer(aPlayer)
  {
    let wasRemoved = false;
    if (this._players.includes(aPlayer))
    {
      if (this._players.includes(aPlayer))
      {
        this._players.splice(this._players.indexOf(aPlayer), 1);
      }
      aPlayer.setTeam(null);
      wasRemoved = true;
    }
    return wasRemoved;
  }
  /* Code from template association_AddIndexControlFunctions */
  addPlayerAt(aPlayer, index)
  {
    let wasAdded = false;
    if (this.addPlayer(aPlayer))
    {
      if (index < 0)
      {
        index = 0;
      }
      if (index > this.numberOfPlayers())
      {
        index = this.numberOfPlayers() - 1;
      }
      if (this._players.includes(aPlayer))
      {
        this._players.splice(this._players.indexOf(aPlayer), 1);
      }
      this._players.splice(index, 0, aPlayer);
      wasAdded = true;
    }
    return wasAdded;
  }
  addOrMovePlayerAt(aPlayer, index)
  {
    let wasAdded = false;
    if (this._players.includes(aPlayer))
    {
      if (index < 0)
      {
        index = 0;
      }
      if (index > this.numberOfPlayers())
      {
        index = this.numberOfPlayers() - 1;
      }
      if (this._players.includes(aPlayer))
      {
        this._players.splice(this._players.indexOf(aPlayer), 1);
      }
      this._players.splice(index, 0, aPlayer);
      wasAdded = true;
    }
    else
    {
      wasAdded = this.addPlayerAt(aPlayer, index);
    }
    return wasAdded;
  }
  delete()
  {
    while (! (this._players.length == 0))
    {
      this._players[0].setTeam(null);
    }
  }
}

module.exports = Team;

/*PLEASE DO NOT EDIT THIS CODE*/
/*This code was generated using the UMPLE 1.38.0.9138.a49b0ba93 modeling language!*/
// line 6 "JavaScriptOptionalAssociation.ump"
class Player
{
  //------------------------
  // MEMBER VARIABLES
  //------------------------
  //Player Attributes
  //Player Associations
  //------------------------
  // CONSTRUCTOR
  //------------------------
  constructor(aName)
  {
    this._name = aName;
    this._team = null;
  }
  //------------------------
  // INTERFACE
  //------------------------
  setName(aName)
  {
    let wasSet = false;
    this._name = aName;
    wasSet = true;
    return wasSet;
  }
  getName()
  {
    return this._name;
  }
  /* Code from template association_GetOne */
  getTeam()
  {
    return this._team;
  }
  hasTeam()
  {
    let has = this._team != null;
    return has;
  }
  /* Code from template association_SetOptionalOneToMany */
  setTeam(aTeam)
  {
    let wasSet = false;
    let existingTeam = this._team;
    this._team = aTeam;
    if (existingTeam != null && ! (existingTeam == aTeam))
    {
      existingTeam.removePlayer(this);
    }
    if (aTeam != null)
    {
      aTeam.addPlayer(this);
    }
    wasSet = true;
    return wasSet;
  }
  delete()
  {
    if (this._team != null)
    {
      let placeholderTeam = this._team;
      this._team = null;
      placeholderTeam.removePlayer(this);
    }
  }
}

module.exports = Player;

/*PLEASE DO NOT EDIT THIS CODE*/
/*This code was generated using the UMPLE 1.38.0.9138.a49b0ba93 modeling language!*/
// line 1 "JavaScriptOptionalOneToOneAssociation.ump"
class Desk
{
  //------------------------
  // MEMBER VARIABLES
  //------------------------
  //Desk Associations
  //------------------------
  // CONSTRUCTOR
  //------------------------
  constructor()
  {
    this._chair = null;
  }
  //------------------------
  // INTERFACE
  //------------------------
  /* Code from template association_GetOne */
  getChair()
  {
    return this._chair;
  }
  hasChair()
  {
    let has = this._chair != null;
    return has;
  }
  /* Code from template association_SetOptionalOneToOptionalOne */
  setChair(aNewChair)
  {
    let wasSet = false;
    if (aNewChair == null)
    {
      let existingChair = this._chair;
      this._chair = null;
      if (existingChair != null && existingChair.getDesk() != null)
      {
        existingChair.setDesk(null);
      }
      wasSet = true;
      return wasSet;
    }
    let currentChair = this.getChair();
    if (currentChair != null && ! (currentChair == aNewChair))
    {
      currentChair.setDesk(null);
    }
    this._chair = aNewChair;
    let existingDesk = aNewChair.getDesk();
    if (! (this == existingDesk))
    {
      aNewChair.setDesk(this);
    }
    wasSet = true;
    return wasSet;
  }
  delete()
  {
    if (this._chair != null)
    {
      this._chair.setDesk(null);
    }
  }
}

module.exports = Desk;

/*PLEASE DO NOT EDIT THIS CODE*/
/*This code was generated using the UMPLE 1.38.0.9138.a49b0ba93 modeling language!*/
// line 1 "JavaScriptAttributes.ump"
class Person
{
  //------------------------
  // MEMBER VARIABLES
  //------------------------
  //Person Attributes
  //------------------------
  // CONSTRUCTOR
  //------------------------
  constructor(aName, aActive)
  {
    this._name = aName;
    this._age = 0;
    this._active = aActive;
  }
  //------------------------
  // INTERFACE
  //------------------------
  setName(aName)
  {
    let wasSet = false;
    this._name = aName;
    wasSet = true;
    return wasSet;
  }
  setAge(aAge)
  {
    let wasSet = false;
    this._age = aAge;
    wasSet = true;
    return wasSet;
  }
  setActive(aActive)
  {
    let wasSet = false;
    this._active = aActive;
    wasSet = true;
    return wasSet;
  }
  getName()
  {
    return this._name;
  }
  getAge()
  {
    return this._age;
  }
  getActive()
  {
    return this._active;
  }
  /* Code from template attribute_IsBoolean */
  isActive()
  {
    return this._active;
  }
  delete()
  {
  }
}

module.exports = Person;

/*PLEASE DO NOT EDIT THIS CODE*/
/*This code was generated using the UMPLE 1.38.0.9138.a49b0ba93 modeling language!*/
// line 1 "JavaScriptMethods.ump"
class Greeter
{
  //------------------------
  // MEMBER VARIABLES
  //------------------------
  //Greeter Attributes
  //Greeter Associations
  //------------------------
  // CONSTRUCTOR
  //------------------------
  constructor(aName)
  {
    this._name = aName;
    this._notes = [];
  }
  //------------------------
  // INTERFACE
  //------------------------
  setName(aName)
  {
    let wasSet = false;
    this._name = aName;
    wasSet = true;
    return wasSet;
  }
  getName()
  {
    return this._name;
  }
  /* Code from template association_GetMany */
  getNote(index)
  {
    let aNote = this._notes[index];
    return aNote;
  }
  getNotes()
  {
    let newNotes = this._notes.slice();
    return newNotes;
  }
  numberOfNotes()
  {
    let number = this._notes.length;
    return number;
  }
  hasNotes()
  {
    let has = this._notes.length > 0;
    return has;
  }
  indexOfNote(aNote)
  {
    let index = this._notes.indexOf(aNote);
    return index;
  }
  /* Code from template association_MinimumNumberOfMethod */
  static minimumNumberOfNotes()
  {
    return 0;
  }
  /* Code from template association_AddManyToOptionalOne */
  addNote(aNote)
  {
    let wasAdded = false;
    if (this._notes.includes(aNote))
    {
      return false;
    }
    let existingGreeter = aNote.getGreeter();
    if (existingGreeter == null)
    {
      aNote.setGreeter(this);
    }
    else if (! (this == existingGreeter))
    {
      existingGreeter.removeNote(aNote);
      this.addNote(aNote);
    }
    else
    {
      this._notes.push(aNote);
    }
    wasAdded = true;
    return wasAdded;
  }
  removeNote(aNote)
  {
    let wasRemoved = false;
    if (this._notes.includes(aNote))
    {
      if (this._notes.includes(aNote))
      {
        this._notes.splice(this._notes.indexOf(aNote), 1);
      }
      aNote.setGreeter(null);
      wasRemoved = true;
    }
    return wasRemoved;
  }
  /* Code from template association_AddIndexControlFunctions */
  addNoteAt(aNote, index)
  {
    let wasAdded = false;
    if (this.addNote(aNote))
    {
      if (index < 0)
      {
        index = 0;
      }
      if (index > this.numberOfNotes())
      {
        index = this.numberOfNotes() - 1;
      }
      if (this._notes.includes(aNote))
      {
        this._notes.splice(this._notes.indexOf(aNote), 1);
      }
      this._notes.splice(index, 0, aNote);
      wasAdded = true;
    }
    return wasAdded;
  }
  addOrMoveNoteAt(aNote, index)
  {
    let wasAdded = false;
    if (this._notes.includes(aNote))
    {
      if (index < 0)
      {
        index = 0;
      }
      if (index > this.numberOfNotes())
      {
        index = this.numberOfNotes() - 1;
      }
      if (this._notes.includes(aNote))
      {
        this._notes.splice(this._notes.indexOf(aNote), 1);
      }
      this._notes.splice(index, 0, aNote);
      wasAdded = true;
    }
    else
    {
      wasAdded = this.addNoteAt(aNote, index);
    }
    return wasAdded;
  }
  delete()
  {
    while (! (this._notes.length == 0))
    {
      this._notes[0].setGreeter(null);
    }
  }
  /**
   * Reads an attribute through its generated getter
   */
  // line 7 "JavaScriptMethods.ump"
  greet()
  {
    return "Hello, " + this.getName() + "!";
  }
  /**
   * Takes parameters and reaches the generated association API
   */
  // line 13 "JavaScriptMethods.ump"
  leave(text, urgent)
  {
    const note = new Note(text, urgent);
    return this.addNote(note);
  }
  // line 19 "JavaScriptMethods.ump"
  pending()
  {
    return this.numberOfNotes();
  }
  // line 24 "JavaScriptMethods.ump"
  static language()
  {
    return "JavaScript";
  }
}

module.exports = Greeter;

const Note = require("./Note.js");

/*PLEASE DO NOT EDIT THIS CODE*/
/*This code was generated using the UMPLE 1.38.0.9138.a49b0ba93 modeling language!*/
// line 42 "JavaScriptMethods.ump"
class Shape
{
  //------------------------
  // MEMBER VARIABLES
  //------------------------
  //Shape Attributes
  //------------------------
  // CONSTRUCTOR
  //------------------------
  constructor(aName)
  {
    if (new.target === Shape)
    {
      throw new TypeError("Can't instantiate abstract class Shape");
    }
    this._name = aName;
  }
  //------------------------
  // INTERFACE
  //------------------------
  setName(aName)
  {
    let wasSet = false;
    this._name = aName;
    wasSet = true;
    return wasSet;
  }
  getName()
  {
    return this._name;
  }
  delete()
  {
  }
  // line 47 "JavaScriptMethods.ump"
  area()
  {
    throw new TypeError("area is abstract in Shape");
  }
  // line 49 "JavaScriptMethods.ump"
  describe()
  {
    return this.getName() + " of area " + this.area();
  }
}

module.exports = Shape;

/*PLEASE DO NOT EDIT THIS CODE*/
/*This code was generated using the UMPLE 1.38.0.9138.a49b0ba93 modeling language!*/
// line 55 "JavaScriptMethods.ump"
const Shape = require("./Shape.js");

class Square extends Shape
{
  //------------------------
  // MEMBER VARIABLES
  //------------------------
  //Square Attributes
  //------------------------
  // CONSTRUCTOR
  //------------------------
  constructor(aName, aSide)
  {
    super(aName);
    this._side = aSide;
  }
  //------------------------
  // INTERFACE
  //------------------------
  setSide(aSide)
  {
    let wasSet = false;
    this._side = aSide;
    wasSet = true;
    return wasSet;
  }
  getSide()
  {
    return this._side;
  }
  delete()
  {
    super.delete();
  }
  // line 60 "JavaScriptMethods.ump"
  area()
  {
    return this.getSide() * this.getSide();
  }
}

module.exports = Square;

/*PLEASE DO NOT EDIT THIS CODE*/
/*This code was generated using the UMPLE 1.38.0.9138.a49b0ba93 modeling language!*/
// line 1 "JavaScriptUnidirectionalOptionalOne.ump"
class Driver
{
  //------------------------
  // MEMBER VARIABLES
  //------------------------
  //Driver Associations
  //------------------------
  // CONSTRUCTOR
  //------------------------
  constructor()
  {
    this._car = null;
  }
  //------------------------
  // INTERFACE
  //------------------------
  /* Code from template association_GetOne */
  getCar()
  {
    return this._car;
  }
  hasCar()
  {
    let has = this._car != null;
    return has;
  }
  /* Code from template association_SetUnidirectionalOptionalOne */
  setCar(aNewCar)
  {
    let wasSet = false;
    this._car = aNewCar;
    wasSet = true;
    return wasSet;
  }
  delete()
  {
    this._car = null;
  }
}

module.exports = Driver;

/*PLEASE DO NOT EDIT THIS CODE*/
/*This code was generated using the UMPLE 1.38.0.9138.a49b0ba93 modeling language!*/
// line 9 "JavaScriptUnidirectionalOptionalOne.ump"
class Badge
{
  //------------------------
  // MEMBER VARIABLES
  //------------------------
  //Badge Attributes
  //Badge Associations
  //Helper Variables
  //------------------------
  // CONSTRUCTOR
  //------------------------
  constructor(aLabel, aStamp)
  {
    this._label = aLabel;
    this._canSetStamp = true;
    this.setStamp(aStamp);
  }
  //------------------------
  // INTERFACE
  //------------------------
  getLabel()
  {
    return this._label;
  }
  /* Code from template association_GetOne */
  getStamp()
  {
    return this._stamp;
  }
  hasStamp()
  {
    let has = this._stamp != null;
    return has;
  }
  /* Code from template association_SetUnidirectionalOptionalOne */
  setStamp(aNewStamp)
  {
    let wasSet = false;
    if (! this._canSetStamp)
    {
      return false;
    }
    this._canSetStamp = false;
    this._stamp = aNewStamp;
    wasSet = true;
    return wasSet;
  }
  delete()
  {
  }
}

module.exports = Badge;

/*PLEASE DO NOT EDIT THIS CODE*/
/*This code was generated using the UMPLE 1.38.0.9138.a49b0ba93 modeling language!*/
// line 1 "JavaScriptDirectedAssociation.ump"
class Library
{
  //------------------------
  // MEMBER VARIABLES
  //------------------------
  //Library Associations
  //------------------------
  // CONSTRUCTOR
  //------------------------
  constructor()
  {
    this._books = [];
  }
  //------------------------
  // INTERFACE
  //------------------------
  /* Code from template association_GetMany */
  getBook(index)
  {
    let aBook = this._books[index];
    return aBook;
  }
  getBooks()
  {
    let newBooks = this._books.slice();
    return newBooks;
  }
  numberOfBooks()
  {
    let number = this._books.length;
    return number;
  }
  hasBooks()
  {
    let has = this._books.length > 0;
    return has;
  }
  indexOfBook(aBook)
  {
    let index = this._books.indexOf(aBook);
    return index;
  }
  /* Code from template association_MinimumNumberOfMethod */
  static minimumNumberOfBooks()
  {
    return 0;
  }
  /* Code from template association_AddUnidirectionalMany */
  addBook(aBook)
  {
    let wasAdded = false;
    if (this._books.includes(aBook))
    {
      return false;
    }
    this._books.push(aBook);
    wasAdded = true;
    return wasAdded;
  }
  removeBook(aBook)
  {
    let wasRemoved = false;
    if (this._books.includes(aBook))
    {
      if (this._books.includes(aBook))
      {
        this._books.splice(this._books.indexOf(aBook), 1);
      }
      wasRemoved = true;
    }
    return wasRemoved;
  }
  /* Code from template association_AddIndexControlFunctions */
  addBookAt(aBook, index)
  {
    let wasAdded = false;
    if (this.addBook(aBook))
    {
      if (index < 0)
      {
        index = 0;
      }
      if (index > this.numberOfBooks())
      {
        index = this.numberOfBooks() - 1;
      }
      if (this._books.includes(aBook))
      {
        this._books.splice(this._books.indexOf(aBook), 1);
      }
      this._books.splice(index, 0, aBook);
      wasAdded = true;
    }
    return wasAdded;
  }
  addOrMoveBookAt(aBook, index)
  {
    let wasAdded = false;
    if (this._books.includes(aBook))
    {
      if (index < 0)
      {
        index = 0;
      }
      if (index > this.numberOfBooks())
      {
        index = this.numberOfBooks() - 1;
      }
      if (this._books.includes(aBook))
      {
        this._books.splice(this._books.indexOf(aBook), 1);
      }
      this._books.splice(index, 0, aBook);
      wasAdded = true;
    }
    else
    {
      wasAdded = this.addBookAt(aBook, index);
    }
    return wasAdded;
  }
  delete()
  {
    this._books.splice(0);
  }
}

module.exports = Library;

/*PLEASE DO NOT EDIT THIS CODE*/
/*This code was generated using the UMPLE 1.38.0.9138.a49b0ba93 modeling language!*/
// line 6 "JavaScriptDirectedAssociation.ump"
class Book
{
  //------------------------
  // MEMBER VARIABLES
  //------------------------
  //Book Attributes
  //------------------------
  // CONSTRUCTOR
  //------------------------
  constructor(aTitle)
  {
    this._title = aTitle;
  }
  //------------------------
  // INTERFACE
  //------------------------
  setTitle(aTitle)
  {
    let wasSet = false;
    this._title = aTitle;
    wasSet = true;
    return wasSet;
  }
  getTitle()
  {
    return this._title;
  }
  delete()
  {
  }
}

module.exports = Book;

/*PLEASE DO NOT EDIT THIS CODE*/
/*This code was generated using the UMPLE 1.38.0.9138.a49b0ba93 modeling language!*/
// line 1 "JavaScriptReflexiveAssociation.ump"
class Employee
{
  //------------------------
  // MEMBER VARIABLES
  //------------------------
  //Employee Attributes
  //Employee Associations
  //------------------------
  // CONSTRUCTOR
  //------------------------
  constructor(aName)
  {
    this._name = aName;
    this._boss = null;
    this._reports = [];
  }
  //------------------------
  // INTERFACE
  //------------------------
  setName(aName)
  {
    let wasSet = false;
    this._name = aName;
    wasSet = true;
    return wasSet;
  }
  getName()
  {
    return this._name;
  }
  /* Code from template association_GetMany */
  getReport(index)
  {
    let aReport = this._reports[index];
    return aReport;
  }
  getReports()
  {
    let newReports = this._reports.slice();
    return newReports;
  }
  numberOfReports()
  {
    let number = this._reports.length;
    return number;
  }
  hasReports()
  {
    let has = this._reports.length > 0;
    return has;
  }
  indexOfReport(aReport)
  {
    let index = this._reports.indexOf(aReport);
    return index;
  }
  /* Code from template association_GetOne */
  getBoss()
  {
    return this._boss;
  }
  hasBoss()
  {
    let has = this._boss != null;
    return has;
  }
  /* Code from template association_MinimumNumberOfMethod */
  static minimumNumberOfReports()
  {
    return 0;
  }
  /* Code from template association_AddManyToOptionalOne */
  addReport(aReport)
  {
    let wasAdded = false;
    if (this._reports.includes(aReport))
    {
      return false;
    }
    let existingBoss = aReport.getBoss();
    if (existingBoss == null)
    {
      aReport.setBoss(this);
    }
    else if (! (this == existingBoss))
    {
      existingBoss.removeReport(aReport);
      this.addReport(aReport);
    }
    else
    {
      this._reports.push(aReport);
    }
    wasAdded = true;
    return wasAdded;
  }
  removeReport(aReport)
  {
    let wasRemoved = false;
    if (this._reports.includes(aReport))
    {
      if (this._reports.includes(aReport))
      {
        this._reports.splice(this._reports.indexOf(aReport), 1);
      }
      aReport.setBoss(null);
      wasRemoved = true;
    }
    return wasRemoved;
  }
  /* Code from template association_AddIndexControlFunctions */
  addReportAt(aReport, index)
  {
    let wasAdded = false;
    if (this.addReport(aReport))
    {
      if (index < 0)
      {
        index = 0;
      }
      if (index > this.numberOfReports())
      {
        index = this.numberOfReports() - 1;
      }
      if (this._reports.includes(aReport))
      {
        this._reports.splice(this._reports.indexOf(aReport), 1);
      }
      this._reports.splice(index, 0, aReport);
      wasAdded = true;
    }
    return wasAdded;
  }
  addOrMoveReportAt(aReport, index)
  {
    let wasAdded = false;
    if (this._reports.includes(aReport))
    {
      if (index < 0)
      {
        index = 0;
      }
      if (index > this.numberOfReports())
      {
        index = this.numberOfReports() - 1;
      }
      if (this._reports.includes(aReport))
      {
        this._reports.splice(this._reports.indexOf(aReport), 1);
      }
      this._reports.splice(index, 0, aReport);
      wasAdded = true;
    }
    else
    {
      wasAdded = this.addReportAt(aReport, index);
    }
    return wasAdded;
  }
  /* Code from template association_SetOptionalOneToMany */
  setBoss(aBoss)
  {
    let wasSet = false;
    let existingBoss = this._boss;
    this._boss = aBoss;
    if (existingBoss != null && ! (existingBoss == aBoss))
    {
      existingBoss.removeReport(this);
    }
    if (aBoss != null)
    {
      aBoss.addReport(this);
    }
    wasSet = true;
    return wasSet;
  }
  delete()
  {
    while (! (this._reports.length == 0))
    {
      this._reports[0].setBoss(null);
    }
    if (this._boss != null)
    {
      let placeholderBoss = this._boss;
      this._boss = null;
      placeholderBoss.removeReport(this);
    }
  }
}

module.exports = Employee;

/*PLEASE DO NOT EDIT THIS CODE*/
/*This code was generated using the UMPLE 1.38.0.9138.a49b0ba93 modeling language!*/
// line 6 "JavaScriptReflexiveAssociation.ump"
class Friend
{
  //------------------------
  // MEMBER VARIABLES
  //------------------------
  //Friend Associations
  //------------------------
  // CONSTRUCTOR
  //------------------------
  constructor()
  {
    this._buddies = [];
    this._friends = [];
  }
  //------------------------
  // INTERFACE
  //------------------------
  /* Code from template association_GetMany */
  getBuddy(index)
  {
    let aBuddy = this._buddies[index];
    return aBuddy;
  }
  getBuddies()
  {
    let newBuddies = this._buddies.slice();
    return newBuddies;
  }
  numberOfBuddies()
  {
    let number = this._buddies.length;
    return number;
  }
  hasBuddies()
  {
    let has = this._buddies.length > 0;
    return has;
  }
  indexOfBuddy(aBuddy)
  {
    let index = this._buddies.indexOf(aBuddy);
    return index;
  }
  /* Code from template association_GetMany */
  getFriend(index)
  {
    let aFriend = this._friends[index];
    return aFriend;
  }
  getFriends()
  {
    let newFriends = this._friends.slice();
    return newFriends;
  }
  numberOfFriends()
  {
    let number = this._friends.length;
    return number;
  }
  hasFriends()
  {
    let has = this._friends.length > 0;
    return has;
  }
  indexOfFriend(aFriend)
  {
    let index = this._friends.indexOf(aFriend);
    return index;
  }
  /* Code from template association_MinimumNumberOfMethod */
  static minimumNumberOfBuddies()
  {
    return 0;
  }
  /* Code from template association_AddManyToManyMethod */
  addBuddy(aBuddy)
  {
    let wasAdded = false;
    if (this._buddies.includes(aBuddy))
    {
      return false;
    }
    this._buddies.push(aBuddy);
    if (aBuddy.indexOfFriend(this) != -1)
    {
      wasAdded = true;
    }
    else
    {
      wasAdded = aBuddy.addFriend(this);
      if (! wasAdded)
      {
        if (this._buddies.includes(aBuddy))
        {
          this._buddies.splice(this._buddies.indexOf(aBuddy), 1);
        }
      }
    }
    return wasAdded;
  }
  /* Code from template association_RemoveMany */
  removeBuddy(aBuddy)
  {
    let wasRemoved = false;
    if (! this._buddies.includes(aBuddy))
    {
      return wasRemoved;
    }
    let oldIndex = this._buddies.indexOf(aBuddy);
    this._buddies.splice(oldIndex, 1);
    if (aBuddy.indexOfFriend(this) == -1)
    {
      wasRemoved = true;
    }
    else
    {
      wasRemoved = aBuddy.removeFriend(this);
      if (! wasRemoved)
      {
        this._buddies.splice(oldIndex, 0, aBuddy);
      }
    }
    return wasRemoved;
  }
  /* Code from template association_AddIndexControlFunctions */
  addBuddyAt(aBuddy, index)
  {
    let wasAdded = false;
    if (this.addBuddy(aBuddy))
    {
      if (index < 0)
      {
        index = 0;
      }
      if (index > this.numberOfBuddies())
      {
        index = this.numberOfBuddies() - 1;
      }
      if (this._buddies.includes(aBuddy))
      {
        this._buddies.splice(this._buddies.indexOf(aBuddy), 1);
      }
      this._buddies.splice(index, 0, aBuddy);
      wasAdded = true;
    }
    return wasAdded;
  }
  addOrMoveBuddyAt(aBuddy, index)
  {
    let wasAdded = false;
    if (this._buddies.includes(aBuddy))
    {
      if (index < 0)
      {
        index = 0;
      }
      if (index > this.numberOfBuddies())
      {
        index = this.numberOfBuddies() - 1;
      }
      if (this._buddies.includes(aBuddy))
      {
        this._buddies.splice(this._buddies.indexOf(aBuddy), 1);
      }
      this._buddies.splice(index, 0, aBuddy);
      wasAdded = true;
    }
    else
    {
      wasAdded = this.addBuddyAt(aBuddy, index);
    }
    return wasAdded;
  }
  /* Code from template association_MinimumNumberOfMethod */
  static minimumNumberOfFriends()
  {
    return 0;
  }
  /* Code from template association_AddManyToManyMethod */
  addFriend(aFriend)
  {
    let wasAdded = false;
    if (this._friends.includes(aFriend))
    {
      return false;
    }
    this._friends.push(aFriend);
    if (aFriend.indexOfBuddy(this) != -1)
    {
      wasAdded = true;
    }
    else
    {
      wasAdded = aFriend.addBuddy(this);
      if (! wasAdded)
      {
        if (this._friends.includes(aFriend))
        {
          this._friends.splice(this._friends.indexOf(aFriend), 1);
        }
      }
    }
    return wasAdded;
  }
  /* Code from template association_RemoveMany */
  removeFriend(aFriend)
  {
    let wasRemoved = false;
    if (! this._friends.includes(aFriend))
    {
      return wasRemoved;
    }
    let oldIndex = this._friends.indexOf(aFriend);
    this._friends.splice(oldIndex, 1);
    if (aFriend.indexOfBuddy(this) == -1)
    {
      wasRemoved = true;
    }
    else
    {
      wasRemoved = aFriend.removeBuddy(this);
      if (! wasRemoved)
      {
        this._friends.splice(oldIndex, 0, aFriend);
      }
    }
    return wasRemoved;
  }
  /* Code from template association_AddIndexControlFunctions */
  addFriendAt(aFriend, index)
  {
    let wasAdded = false;
    if (this.addFriend(aFriend))
    {
      if (index < 0)
      {
        index = 0;
      }
      if (index > this.numberOfFriends())
      {
        index = this.numberOfFriends() - 1;
      }
      if (this._friends.includes(aFriend))
      {
        this._friends.splice(this._friends.indexOf(aFriend), 1);
      }
      this._friends.splice(index, 0, aFriend);
      wasAdded = true;
    }
    return wasAdded;
  }
  addOrMoveFriendAt(aFriend, index)
  {
    let wasAdded = false;
    if (this._friends.includes(aFriend))
    {
      if (index < 0)
      {
        index = 0;
      }
      if (index > this.numberOfFriends())
      {
        index = this.numberOfFriends() - 1;
      }
      if (this._friends.includes(aFriend))
      {
        this._friends.splice(this._friends.indexOf(aFriend), 1);
      }
      this._friends.splice(index, 0, aFriend);
      wasAdded = true;
    }
    else
    {
      wasAdded = this.addFriendAt(aFriend, index);
    }
    return wasAdded;
  }
  delete()
  {
    let copyOfBuddies = this._buddies.slice();
    this._buddies.splice(0);
    for (let aBuddy of copyOfBuddies) {
      aBuddy.removeFriend(this);
    }
    let copyOfFriends = this._friends.slice();
    this._friends.splice(0);
    for (let aFriend of copyOfFriends) {
      aFriend.removeBuddy(this);
    }
  }
}

module.exports = Friend;

/*PLEASE DO NOT EDIT THIS CODE*/
/*This code was generated using the UMPLE 1.38.0.9138.a49b0ba93 modeling language!*/
// line 10 "JavaScriptReflexiveAssociation.ump"
class Node
{
  //------------------------
  // MEMBER VARIABLES
  //------------------------
  //Node Associations
  //------------------------
  // CONSTRUCTOR
  //------------------------
  constructor()
  {
    this._next = null;
  }
  //------------------------
  // INTERFACE
  //------------------------
  /* Code from template association_GetOne */
  getNext()
  {
    return this._next;
  }
  hasNext()
  {
    let has = this._next != null;
    return has;
  }
  /* Code from template association_SetUnidirectionalOptionalOne */
  setNext(aNewNext)
  {
    let wasSet = false;
    this._next = aNewNext;
    wasSet = true;
    return wasSet;
  }
  delete()
  {
    this._next = null;
  }
}

module.exports = Node;

/*PLEASE DO NOT EDIT THIS CODE*/
/*This code was generated using the UMPLE 1.38.0.9138.a49b0ba93 modeling language!*/
// line 14 "JavaScriptReflexiveAssociation.ump"
class Spouse
{
  //------------------------
  // MEMBER VARIABLES
  //------------------------
  //Spouse Associations
  //------------------------
  // CONSTRUCTOR
  //------------------------
  constructor()
  {
    this._partner = null;
    this._spouse = null;
  }
  //------------------------
  // INTERFACE
  //------------------------
  /* Code from template association_GetOne */
  getPartner()
  {
    return this._partner;
  }
  hasPartner()
  {
    let has = this._partner != null;
    return has;
  }
  /* Code from template association_GetOne */
  getSpouse()
  {
    return this._spouse;
  }
  hasSpouse()
  {
    let has = this._spouse != null;
    return has;
  }
  /* Code from template association_SetOptionalOneToOptionalOne */
  setPartner(aNewPartner)
  {
    let wasSet = false;
    if (aNewPartner == null)
    {
      let existingPartner = this._partner;
      this._partner = null;
      if (existingPartner != null && existingPartner.getSpouse() != null)
      {
        existingPartner.setSpouse(null);
      }
      wasSet = true;
      return wasSet;
    }
    let currentPartner = this.getPartner();
    if (currentPartner != null && ! (currentPartner == aNewPartner))
    {
      currentPartner.setSpouse(null);
    }
    this._partner = aNewPartner;
    let existingSpouse = aNewPartner.getSpouse();
    if (! (this == existingSpouse))
    {
      aNewPartner.setSpouse(this);
    }
    wasSet = true;
    return wasSet;
  }
  /* Code from template association_SetOptionalOneToOptionalOne */
  setSpouse(aNewSpouse)
  {
    let wasSet = false;
    if (aNewSpouse == null)
    {
      let existingSpouse = this._spouse;
      this._spouse = null;
      if (existingSpouse != null && existingSpouse.getPartner() != null)
      {
        existingSpouse.setPartner(null);
      }
      wasSet = true;
      return wasSet;
    }
    let currentSpouse = this.getSpouse();
    if (currentSpouse != null && ! (currentSpouse == aNewSpouse))
    {
      currentSpouse.setPartner(null);
    }
    this._spouse = aNewSpouse;
    let existingPartner = aNewSpouse.getPartner();
    if (! (this == existingPartner))
    {
      aNewSpouse.setPartner(this);
    }
    wasSet = true;
    return wasSet;
  }
  delete()
  {
    if (this._partner != null)
    {
      this._partner.setSpouse(null);
    }
    if (this._spouse != null)
    {
      this._spouse.setPartner(null);
    }
  }
}

module.exports = Spouse;

/*PLEASE DO NOT EDIT THIS CODE*/
/*This code was generated using the UMPLE 1.38.0.9138.a49b0ba93 modeling language!*/
/**
 * A class comment
 */
// line 2 "JavaScriptComments.ump"
class Doc1
{
  //------------------------
  // MEMBER VARIABLES
  //------------------------
  //Doc1 Attributes
  //------------------------
  // CONSTRUCTOR
  //------------------------
  constructor(aTitle)
  {
    this._title = aTitle;
    this._pages = 1;
  }
  //------------------------
  // INTERFACE
  //------------------------
  setTitle(aTitle)
  {
    let wasSet = false;
    this._title = aTitle;
    wasSet = true;
    return wasSet;
  }
  setPages(aPages)
  {
    let wasSet = false;
    this._pages = aPages;
    wasSet = true;
    return wasSet;
  }
  /**
   * attribute comment
   */
  getTitle()
  {
    return this._title;
  }
  getPages()
  {
    return this._pages;
  }
  delete()
  {
  }
}

module.exports = Doc1;

/*PLEASE DO NOT EDIT THIS CODE*/
/*This code was generated using the UMPLE 1.38.0.9138.a49b0ba93 modeling language!*/
// line 6 "JavaScriptInheritance.ump"
const Animal = require("./Animal.js");

class Dog extends Animal
{
  //------------------------
  // MEMBER VARIABLES
  //------------------------
  //Dog Attributes
  //------------------------
  // CONSTRUCTOR
  //------------------------
  constructor(aName)
  {
    super(aName);
    this._legs = 4;
  }
  //------------------------
  // INTERFACE
  //------------------------
  setLegs(aLegs)
  {
    let wasSet = false;
    this._legs = aLegs;
    wasSet = true;
    return wasSet;
  }
  getLegs()
  {
    return this._legs;
  }
  delete()
  {
    super.delete();
  }
}

module.exports = Dog;

/*PLEASE DO NOT EDIT THIS CODE*/
/*This code was generated using the UMPLE 1.38.0.9138.a49b0ba93 modeling language!*/
// line 1 "JavaScriptComposition.ump"
class House
{
  //------------------------
  // MEMBER VARIABLES
  //------------------------
  //House Associations
  //------------------------
  // CONSTRUCTOR
  //------------------------
  constructor()
  {
    this._rooms = [];
  }
  //------------------------
  // INTERFACE
  //------------------------
  /* Code from template association_GetMany */
  getRoom(index)
  {
    let aRoom = this._rooms[index];
    return aRoom;
  }
  getRooms()
  {
    let newRooms = this._rooms.slice();
    return newRooms;
  }
  numberOfRooms()
  {
    let number = this._rooms.length;
    return number;
  }
  hasRooms()
  {
    let has = this._rooms.length > 0;
    return has;
  }
  indexOfRoom(aRoom)
  {
    let index = this._rooms.indexOf(aRoom);
    return index;
  }
  /* Code from template association_MinimumNumberOfMethod */
  static minimumNumberOfRooms()
  {
    return 0;
  }
  /* Code from template association_AddManyToOptionalOne */
  addRoom(aRoom)
  {
    let wasAdded = false;
    if (this._rooms.includes(aRoom))
    {
      return false;
    }
    let existingHouse = aRoom.getHouse();
    if (existingHouse == null)
    {
      aRoom.setHouse(this);
    }
    else if (! (this == existingHouse))
    {
      existingHouse.removeRoom(aRoom);
      this.addRoom(aRoom);
    }
    else
    {
      this._rooms.push(aRoom);
    }
    wasAdded = true;
    return wasAdded;
  }
  removeRoom(aRoom)
  {
    let wasRemoved = false;
    if (this._rooms.includes(aRoom))
    {
      if (this._rooms.includes(aRoom))
      {
        this._rooms.splice(this._rooms.indexOf(aRoom), 1);
      }
      aRoom.setHouse(null);
      wasRemoved = true;
    }
    return wasRemoved;
  }
  /* Code from template association_AddIndexControlFunctions */
  addRoomAt(aRoom, index)
  {
    let wasAdded = false;
    if (this.addRoom(aRoom))
    {
      if (index < 0)
      {
        index = 0;
      }
      if (index > this.numberOfRooms())
      {
        index = this.numberOfRooms() - 1;
      }
      if (this._rooms.includes(aRoom))
      {
        this._rooms.splice(this._rooms.indexOf(aRoom), 1);
      }
      this._rooms.splice(index, 0, aRoom);
      wasAdded = true;
    }
    return wasAdded;
  }
  addOrMoveRoomAt(aRoom, index)
  {
    let wasAdded = false;
    if (this._rooms.includes(aRoom))
    {
      if (index < 0)
      {
        index = 0;
      }
      if (index > this.numberOfRooms())
      {
        index = this.numberOfRooms() - 1;
      }
      if (this._rooms.includes(aRoom))
      {
        this._rooms.splice(this._rooms.indexOf(aRoom), 1);
      }
      this._rooms.splice(index, 0, aRoom);
      wasAdded = true;
    }
    else
    {
      wasAdded = this.addRoomAt(aRoom, index);
    }
    return wasAdded;
  }
  delete()
  {
    while (this._rooms.length > 0)
    {
      let aRoom = this._rooms[this._rooms.length - 1];
      aRoom.delete();
      if (this._rooms.includes(aRoom))
      {
        this._rooms.splice(this._rooms.indexOf(aRoom), 1);
      }
    }
  }
}

module.exports = House;

/*PLEASE DO NOT EDIT THIS CODE*/
/*This code was generated using the UMPLE 1.38.0.9138.a49b0ba93 modeling language!*/
// line 1 "JavaScriptManyToManyAssociation.ump"
class Course
{
  //------------------------
  // MEMBER VARIABLES
  //------------------------
  //Course Associations
  //------------------------
  // CONSTRUCTOR
  //------------------------
  constructor()
  {
    this._students = [];
  }
  //------------------------
  // INTERFACE
  //------------------------
  /* Code from template association_GetMany */
  getStudent(index)
  {
    let aStudent = this._students[index];
    return aStudent;
  }
  getStudents()
  {
    let newStudents = this._students.slice();
    return newStudents;
  }
  numberOfStudents()
  {
    let number = this._students.length;
    return number;
  }
  hasStudents()
  {
    let has = this._students.length > 0;
    return has;
  }
  indexOfStudent(aStudent)
  {
    let index = this._students.indexOf(aStudent);
    return index;
  }
  /* Code from template association_MinimumNumberOfMethod */
  static minimumNumberOfStudents()
  {
    return 0;
  }
  /* Code from template association_AddManyToManyMethod */
  addStudent(aStudent)
  {
    let wasAdded = false;
    if (this._students.includes(aStudent))
    {
      return false;
    }
    this._students.push(aStudent);
    if (aStudent.indexOfCourse(this) != -1)
    {
      wasAdded = true;
    }
    else
    {
      wasAdded = aStudent.addCourse(this);
      if (! wasAdded)
      {
        if (this._students.includes(aStudent))
        {
          this._students.splice(this._students.indexOf(aStudent), 1);
        }
      }
    }
    return wasAdded;
  }
  /* Code from template association_RemoveMany */
  removeStudent(aStudent)
  {
    let wasRemoved = false;
    if (! this._students.includes(aStudent))
    {
      return wasRemoved;
    }
    let oldIndex = this._students.indexOf(aStudent);
    this._students.splice(oldIndex, 1);
    if (aStudent.indexOfCourse(this) == -1)
    {
      wasRemoved = true;
    }
    else
    {
      wasRemoved = aStudent.removeCourse(this);
      if (! wasRemoved)
      {
        this._students.splice(oldIndex, 0, aStudent);
      }
    }
    return wasRemoved;
  }
  /* Code from template association_AddIndexControlFunctions */
  addStudentAt(aStudent, index)
  {
    let wasAdded = false;
    if (this.addStudent(aStudent))
    {
      if (index < 0)
      {
        index = 0;
      }
      if (index > this.numberOfStudents())
      {
        index = this.numberOfStudents() - 1;
      }
      if (this._students.includes(aStudent))
      {
        this._students.splice(this._students.indexOf(aStudent), 1);
      }
      this._students.splice(index, 0, aStudent);
      wasAdded = true;
    }
    return wasAdded;
  }
  addOrMoveStudentAt(aStudent, index)
  {
    let wasAdded = false;
    if (this._students.includes(aStudent))
    {
      if (index < 0)
      {
        index = 0;
      }
      if (index > this.numberOfStudents())
      {
        index = this.numberOfStudents() - 1;
      }
      if (this._students.includes(aStudent))
      {
        this._students.splice(this._students.indexOf(aStudent), 1);
      }
      this._students.splice(index, 0, aStudent);
      wasAdded = true;
    }
    else
    {
      wasAdded = this.addStudentAt(aStudent, index);
    }
    return wasAdded;
  }
  delete()
  {
    let copyOfStudents = this._students.slice();
    this._students.splice(0);
    for (let aStudent of copyOfStudents) {
      aStudent.removeCourse(this);
    }
  }
}

module.exports = Course;

/*PLEASE DO NOT EDIT THIS CODE*/
/*This code was generated using the UMPLE 1.38.0.9138.a49b0ba93 modeling language!*/
// line 1 "JavaScriptEmptyClass.ump"
class Empty
{
  //------------------------
  // MEMBER VARIABLES
  //------------------------
  //------------------------
  // CONSTRUCTOR
  //------------------------
  constructor()
  {
  }
  //------------------------
  // INTERFACE
  //------------------------
  delete()
  {
  }
}

module.exports = Empty;

/*PLEASE DO NOT EDIT THIS CODE*/
/*This code was generated using the UMPLE 1.38.0.9138.a49b0ba93 modeling language!*/
// line 1 "JavaScriptCompositionVariants.ump"
class Car2
{
  //------------------------
  // MEMBER VARIABLES
  //------------------------
  //Car2 Associations
  //------------------------
  // CONSTRUCTOR
  //------------------------
  constructor()
  {
    this._engine = null;
  }
  //------------------------
  // INTERFACE
  //------------------------
  /* Code from template association_GetOne */
  getEngine()
  {
    return this._engine;
  }
  hasEngine()
  {
    let has = this._engine != null;
    return has;
  }
  /* Code from template association_SetOptionalOneToOptionalOne */
  setEngine(aNewEngine)
  {
    let wasSet = false;
    if (aNewEngine == null)
    {
      let existingEngine = this._engine;
      this._engine = null;
      if (existingEngine != null && existingEngine.getCar2() != null)
      {
        existingEngine.setCar2(null);
      }
      wasSet = true;
      return wasSet;
    }
    let currentEngine = this.getEngine();
    if (currentEngine != null && ! (currentEngine == aNewEngine))
    {
      currentEngine.setCar2(null);
    }
    this._engine = aNewEngine;
    let existingCar2 = aNewEngine.getCar2();
    if (! (this == existingCar2))
    {
      aNewEngine.setCar2(this);
    }
    wasSet = true;
    return wasSet;
  }
  delete()
  {
    let existingEngine = this._engine;
    this._engine = null;
    if (existingEngine != null)
    {
      existingEngine.delete();
      existingEngine.setCar2(null);
    }
  }
}

module.exports = Car2;

/*PLEASE DO NOT EDIT THIS CODE*/
/*This code was generated using the UMPLE 1.38.0.9138.a49b0ba93 modeling language!*/
// line 5 "JavaScriptCompositionVariants.ump"
class Engine
{
  //------------------------
  // MEMBER VARIABLES
  //------------------------
  //Engine Associations
  //------------------------
  // CONSTRUCTOR
  //------------------------
  constructor()
  {
    this._car2 = null;
  }
  //------------------------
  // INTERFACE
  //------------------------
  /* Code from template association_GetOne */
  getCar2()
  {
    return this._car2;
  }
  hasCar2()
  {
    let has = this._car2 != null;
    return has;
  }
  /* Code from template association_SetOptionalOneToOptionalOne */
  setCar2(aNewCar2)
  {
    let wasSet = false;
    if (aNewCar2 == null)
    {
      let existingCar2 = this._car2;
      this._car2 = null;
      if (existingCar2 != null && existingCar2.getEngine() != null)
      {
        existingCar2.setEngine(null);
      }
      wasSet = true;
      return wasSet;
    }
    let currentCar2 = this.getCar2();
    if (currentCar2 != null && ! (currentCar2 == aNewCar2))
    {
      currentCar2.setEngine(null);
    }
    this._car2 = aNewCar2;
    let existingEngine = aNewCar2.getEngine();
    if (! (this == existingEngine))
    {
      aNewCar2.setEngine(this);
    }
    wasSet = true;
    return wasSet;
  }
  delete()
  {
    if (this._car2 != null)
    {
      this._car2.setEngine(null);
    }
  }
}

module.exports = Engine;

/*PLEASE DO NOT EDIT THIS CODE*/
/*This code was generated using the UMPLE 1.38.0.9138.a49b0ba93 modeling language!*/
// line 8 "JavaScriptCompositionVariants.ump"
class Folder
{
  //------------------------
  // MEMBER VARIABLES
  //------------------------
  //Folder Associations
  //------------------------
  // CONSTRUCTOR
  //------------------------
  constructor()
  {
    this._docs = [];
  }
  //------------------------
  // INTERFACE
  //------------------------
  /* Code from template association_GetMany */
  getDoc(index)
  {
    let aDoc = this._docs[index];
    return aDoc;
  }
  getDocs()
  {
    let newDocs = this._docs.slice();
    return newDocs;
  }
  numberOfDocs()
  {
    let number = this._docs.length;
    return number;
  }
  hasDocs()
  {
    let has = this._docs.length > 0;
    return has;
  }
  indexOfDoc(aDoc)
  {
    let index = this._docs.indexOf(aDoc);
    return index;
  }
  /* Code from template association_MinimumNumberOfMethod */
  static minimumNumberOfDocs()
  {
    return 0;
  }
  /* Code from template association_AddManyToManyMethod */
  addDoc(aDoc)
  {
    let wasAdded = false;
    if (this._docs.includes(aDoc))
    {
      return false;
    }
    this._docs.push(aDoc);
    if (aDoc.indexOfFolder(this) != -1)
    {
      wasAdded = true;
    }
    else
    {
      wasAdded = aDoc.addFolder(this);
      if (! wasAdded)
      {
        if (this._docs.includes(aDoc))
        {
          this._docs.splice(this._docs.indexOf(aDoc), 1);
        }
      }
    }
    return wasAdded;
  }
  /* Code from template association_RemoveMany */
  removeDoc(aDoc)
  {
    let wasRemoved = false;
    if (! this._docs.includes(aDoc))
    {
      return wasRemoved;
    }
    let oldIndex = this._docs.indexOf(aDoc);
    this._docs.splice(oldIndex, 1);
    if (aDoc.indexOfFolder(this) == -1)
    {
      wasRemoved = true;
    }
    else
    {
      wasRemoved = aDoc.removeFolder(this);
      if (! wasRemoved)
      {
        this._docs.splice(oldIndex, 0, aDoc);
      }
    }
    return wasRemoved;
  }
  /* Code from template association_AddIndexControlFunctions */
  addDocAt(aDoc, index)
  {
    let wasAdded = false;
    if (this.addDoc(aDoc))
    {
      if (index < 0)
      {
        index = 0;
      }
      if (index > this.numberOfDocs())
      {
        index = this.numberOfDocs() - 1;
      }
      if (this._docs.includes(aDoc))
      {
        this._docs.splice(this._docs.indexOf(aDoc), 1);
      }
      this._docs.splice(index, 0, aDoc);
      wasAdded = true;
    }
    return wasAdded;
  }
  addOrMoveDocAt(aDoc, index)
  {
    let wasAdded = false;
    if (this._docs.includes(aDoc))
    {
      if (index < 0)
      {
        index = 0;
      }
      if (index > this.numberOfDocs())
      {
        index = this.numberOfDocs() - 1;
      }
      if (this._docs.includes(aDoc))
      {
        this._docs.splice(this._docs.indexOf(aDoc), 1);
      }
      this._docs.splice(index, 0, aDoc);
      wasAdded = true;
    }
    else
    {
      wasAdded = this.addDocAt(aDoc, index);
    }
    return wasAdded;
  }
  delete()
  {
    while (this._docs.length > 0)
    {
      let aDoc = this._docs[this._docs.length - 1];
      aDoc.delete();
      if (this._docs.includes(aDoc))
      {
        this._docs.splice(this._docs.indexOf(aDoc), 1);
      }
    }
  }
}

module.exports = Folder;

/*PLEASE DO NOT EDIT THIS CODE*/
/*This code was generated using the UMPLE 1.38.0.9138.a49b0ba93 modeling language!*/
// line 12 "JavaScriptCompositionVariants.ump"
class Doc
{
  //------------------------
  // MEMBER VARIABLES
  //------------------------
  //Doc Associations
  //------------------------
  // CONSTRUCTOR
  //------------------------
  constructor()
  {
    this._folders = [];
  }
  //------------------------
  // INTERFACE
  //------------------------
  /* Code from template association_GetMany */
  getFolder(index)
  {
    let aFolder = this._folders[index];
    return aFolder;
  }
  getFolders()
  {
    let newFolders = this._folders.slice();
    return newFolders;
  }
  numberOfFolders()
  {
    let number = this._folders.length;
    return number;
  }
  hasFolders()
  {
    let has = this._folders.length > 0;
    return has;
  }
  indexOfFolder(aFolder)
  {
    let index = this._folders.indexOf(aFolder);
    return index;
  }
  /* Code from template association_MinimumNumberOfMethod */
  static minimumNumberOfFolders()
  {
    return 0;
  }
  /* Code from template association_AddManyToManyMethod */
  addFolder(aFolder)
  {
    let wasAdded = false;
    if (this._folders.includes(aFolder))
    {
      return false;
    }
    this._folders.push(aFolder);
    if (aFolder.indexOfDoc(this) != -1)
    {
      wasAdded = true;
    }
    else
    {
      wasAdded = aFolder.addDoc(this);
      if (! wasAdded)
      {
        if (this._folders.includes(aFolder))
        {
          this._folders.splice(this._folders.indexOf(aFolder), 1);
        }
      }
    }
    return wasAdded;
  }
  /* Code from template association_RemoveMany */
  removeFolder(aFolder)
  {
    let wasRemoved = false;
    if (! this._folders.includes(aFolder))
    {
      return wasRemoved;
    }
    let oldIndex = this._folders.indexOf(aFolder);
    this._folders.splice(oldIndex, 1);
    if (aFolder.indexOfDoc(this) == -1)
    {
      wasRemoved = true;
    }
    else
    {
      wasRemoved = aFolder.removeDoc(this);
      if (! wasRemoved)
      {
        this._folders.splice(oldIndex, 0, aFolder);
      }
    }
    return wasRemoved;
  }
  /* Code from template association_AddIndexControlFunctions */
  addFolderAt(aFolder, index)
  {
    let wasAdded = false;
    if (this.addFolder(aFolder))
    {
      if (index < 0)
      {
        index = 0;
      }
      if (index > this.numberOfFolders())
      {
        index = this.numberOfFolders() - 1;
      }
      if (this._folders.includes(aFolder))
      {
        this._folders.splice(this._folders.indexOf(aFolder), 1);
      }
      this._folders.splice(index, 0, aFolder);
      wasAdded = true;
    }
    return wasAdded;
  }
  addOrMoveFolderAt(aFolder, index)
  {
    let wasAdded = false;
    if (this._folders.includes(aFolder))
    {
      if (index < 0)
      {
        index = 0;
      }
      if (index > this.numberOfFolders())
      {
        index = this.numberOfFolders() - 1;
      }
      if (this._folders.includes(aFolder))
      {
        this._folders.splice(this._folders.indexOf(aFolder), 1);
      }
      this._folders.splice(index, 0, aFolder);
      wasAdded = true;
    }
    else
    {
      wasAdded = this.addFolderAt(aFolder, index);
    }
    return wasAdded;
  }
  delete()
  {
    let copyOfFolders = this._folders.slice();
    this._folders.splice(0);
    for (let aFolder of copyOfFolders) {
      aFolder.removeDoc(this);
    }
  }
}

module.exports = Doc;

/*PLEASE DO NOT EDIT THIS CODE*/
/*This code was generated using the UMPLE 1.38.0.9138.a49b0ba93 modeling language!*/
// line 15 "JavaScriptCompositionVariants.ump"
class Fleet
{
  //------------------------
  // MEMBER VARIABLES
  //------------------------
  //Fleet Associations
  //------------------------
  // CONSTRUCTOR
  //------------------------
  constructor()
  {
    this._flag = null;
  }
  //------------------------
  // INTERFACE
  //------------------------
  /* Code from template association_GetOne */
  getFlag()
  {
    return this._flag;
  }
  hasFlag()
  {
    let has = this._flag != null;
    return has;
  }
  /* Code from template association_SetOptionalOneToMany */
  setFlag(aFlag)
  {
    let wasSet = false;
    let existingFlag = this._flag;
    this._flag = aFlag;
    if (existingFlag != null && ! (existingFlag == aFlag))
    {
      existingFlag.removeFleet(this);
    }
    if (aFlag != null)
    {
      aFlag.addFleet(this);
    }
    wasSet = true;
    return wasSet;
  }
  delete()
  {
    let existingFlag = this._flag;
    this._flag = null;
    if (existingFlag != null)
    {
      existingFlag.delete();
    }
  }
}

module.exports = Fleet;

/*PLEASE DO NOT EDIT THIS CODE*/
/*This code was generated using the UMPLE 1.38.0.9138.a49b0ba93 modeling language!*/
// line 19 "JavaScriptCompositionVariants.ump"
class Flag
{
  //------------------------
  // MEMBER VARIABLES
  //------------------------
  //Flag Associations
  //------------------------
  // CONSTRUCTOR
  //------------------------
  constructor()
  {
    this._fleets = [];
  }
  //------------------------
  // INTERFACE
  //------------------------
  /* Code from template association_GetMany */
  getFleet(index)
  {
    let aFleet = this._fleets[index];
    return aFleet;
  }
  getFleets()
  {
    let newFleets = this._fleets.slice();
    return newFleets;
  }
  numberOfFleets()
  {
    let number = this._fleets.length;
    return number;
  }
  hasFleets()
  {
    let has = this._fleets.length > 0;
    return has;
  }
  indexOfFleet(aFleet)
  {
    let index = this._fleets.indexOf(aFleet);
    return index;
  }
  /* Code from template association_MinimumNumberOfMethod */
  static minimumNumberOfFleets()
  {
    return 0;
  }
  /* Code from template association_AddManyToOptionalOne */
  addFleet(aFleet)
  {
    let wasAdded = false;
    if (this._fleets.includes(aFleet))
    {
      return false;
    }
    let existingFlag = aFleet.getFlag();
    if (existingFlag == null)
    {
      aFleet.setFlag(this);
    }
    else if (! (this == existingFlag))
    {
      existingFlag.removeFleet(aFleet);
      this.addFleet(aFleet);
    }
    else
    {
      this._fleets.push(aFleet);
    }
    wasAdded = true;
    return wasAdded;
  }
  removeFleet(aFleet)
  {
    let wasRemoved = false;
    if (this._fleets.includes(aFleet))
    {
      if (this._fleets.includes(aFleet))
      {
        this._fleets.splice(this._fleets.indexOf(aFleet), 1);
      }
      aFleet.setFlag(null);
      wasRemoved = true;
    }
    return wasRemoved;
  }
  /* Code from template association_AddIndexControlFunctions */
  addFleetAt(aFleet, index)
  {
    let wasAdded = false;
    if (this.addFleet(aFleet))
    {
      if (index < 0)
      {
        index = 0;
      }
      if (index > this.numberOfFleets())
      {
        index = this.numberOfFleets() - 1;
      }
      if (this._fleets.includes(aFleet))
      {
        this._fleets.splice(this._fleets.indexOf(aFleet), 1);
      }
      this._fleets.splice(index, 0, aFleet);
      wasAdded = true;
    }
    return wasAdded;
  }
  addOrMoveFleetAt(aFleet, index)
  {
    let wasAdded = false;
    if (this._fleets.includes(aFleet))
    {
      if (index < 0)
      {
        index = 0;
      }
      if (index > this.numberOfFleets())
      {
        index = this.numberOfFleets() - 1;
      }
      if (this._fleets.includes(aFleet))
      {
        this._fleets.splice(this._fleets.indexOf(aFleet), 1);
      }
      this._fleets.splice(index, 0, aFleet);
      wasAdded = true;
    }
    else
    {
      wasAdded = this.addFleetAt(aFleet, index);
    }
    return wasAdded;
  }
  delete()
  {
    while (! (this._fleets.length == 0))
    {
      let aFleet = this._fleets[0];
      aFleet.setFlag(null);
      if (this._fleets.includes(aFleet))
      {
        this._fleets.splice(this._fleets.indexOf(aFleet), 1);
      }
    }
  }
}

module.exports = Flag;

/*PLEASE DO NOT EDIT THIS CODE*/
/*This code was generated using the UMPLE 1.38.0.9138.a49b0ba93 modeling language!*/
// line 1 "JavaScriptAdvancedAttributes.ump"
class Gadget
{
  //------------------------
  // MEMBER VARIABLES
  //------------------------
  //Gadget Attributes
  //Helper Variables
  //------------------------
  // CONSTRUCTOR
  //------------------------
  constructor(aName, aPrice, aCode)
  {
    this._name = aName;
    this._price = aPrice;
    this._weight = 1.5;
    this.resetStock();
    this._note = null;
    this._sold = false;
    this._code = aCode;
    this._canSetSerial = true;
    this._serial = null;
    this._canSetBatch = true;
    this._batch = 0;
    this._canSetRatio = true;
    this._ratio = 0;
    this._canSetSealed = true;
    this._sealed = false;
    this._year = 2026;
    this._offset = -1;
    this._depth = -0.5;
    this._visible = true;
    this._label = "say \"hi\"\n";
    this._tag = null;
  }
  //------------------------
  // INTERFACE
  //------------------------
  setName(aName)
  {
    let wasSet = false;
    this._name = aName;
    wasSet = true;
    return wasSet;
  }
  setPrice(aPrice)
  {
    let wasSet = false;
    this._price = aPrice;
    wasSet = true;
    return wasSet;
  }
  setWeight(aWeight)
  {
    let wasSet = false;
    this._weight = aWeight;
    wasSet = true;
    return wasSet;
  }
  /* Code from template attribute_SetDefaulted */
  setStock(aStock)
  {
    let wasSet = false;
    this._stock = aStock;
    wasSet = true;
    return wasSet;
  }
  resetStock()
  {
    let wasReset = false;
    this._stock = this.getDefaultStock();
    wasReset = true;
    return wasReset;
  }
  setNote(aNote)
  {
    let wasSet = false;
    this._note = aNote;
    wasSet = true;
    return wasSet;
  }
  setSold(aSold)
  {
    let wasSet = false;
    this._sold = aSold;
    wasSet = true;
    return wasSet;
  }
  /* Code from template attribute_SetImmutable */
  setSerial(aSerial)
  {
    let wasSet = false;
    if (! this._canSetSerial)
    {
      return false;
    }
    this._canSetSerial = false;
    this._serial = aSerial;
    wasSet = true;
    return wasSet;
  }
  /* Code from template attribute_SetImmutable */
  setBatch(aBatch)
  {
    let wasSet = false;
    if (! this._canSetBatch)
    {
      return false;
    }
    this._canSetBatch = false;
    this._batch = aBatch;
    wasSet = true;
    return wasSet;
  }
  /* Code from template attribute_SetImmutable */
  setRatio(aRatio)
  {
    let wasSet = false;
    if (! this._canSetRatio)
    {
      return false;
    }
    this._canSetRatio = false;
    this._ratio = aRatio;
    wasSet = true;
    return wasSet;
  }
  /* Code from template attribute_SetImmutable */
  setSealed(aSealed)
  {
    let wasSet = false;
    if (! this._canSetSealed)
    {
      return false;
    }
    this._canSetSealed = false;
    this._sealed = aSealed;
    wasSet = true;
    return wasSet;
  }
  setOffset(aOffset)
  {
    let wasSet = false;
    this._offset = aOffset;
    wasSet = true;
    return wasSet;
  }
  setDepth(aDepth)
  {
    let wasSet = false;
    this._depth = aDepth;
    wasSet = true;
    return wasSet;
  }
  setVisible(aVisible)
  {
    let wasSet = false;
    this._visible = aVisible;
    wasSet = true;
    return wasSet;
  }
  setLabel(aLabel)
  {
    let wasSet = false;
    this._label = aLabel;
    wasSet = true;
    return wasSet;
  }
  setTag(aTag)
  {
    let wasSet = false;
    this._tag = aTag;
    wasSet = true;
    return wasSet;
  }
  getName()
  {
    return this._name;
  }
  getPrice()
  {
    return this._price;
  }
  getWeight()
  {
    return this._weight;
  }
  getStock()
  {
    return this._stock;
  }
  /* Code from template attribute_GetDefaulted */
  getDefaultStock()
  {
    return 10;
  }
  getNote()
  {
    return this._note;
  }
  getSold()
  {
    return this._sold;
  }
  getCode()
  {
    return this._code;
  }
  getSerial()
  {
    return this._serial;
  }
  getBatch()
  {
    return this._batch;
  }
  getRatio()
  {
    return this._ratio;
  }
  getSealed()
  {
    return this._sealed;
  }
  getYear()
  {
    return this._year;
  }
  getOffset()
  {
    return this._offset;
  }
  getDepth()
  {
    return this._depth;
  }
  getVisible()
  {
    return this._visible;
  }
  getLabel()
  {
    return this._label;
  }
  getTag()
  {
    return this._tag;
  }
  /* Code from template attribute_IsBoolean */
  isSold()
  {
    return this._sold;
  }
  /* Code from template attribute_IsBoolean */
  isSealed()
  {
    return this._sealed;
  }
  /* Code from template attribute_IsBoolean */
  isVisible()
  {
    return this._visible;
  }
  delete()
  {
  }
}

module.exports = Gadget;