/**
  * Returns the instance(s) connected to this instance through the role "ordered pairs".
  *
  * @return the connected instance(s)
  * @throws PDStoreException
  */
 public Collection<PDOrderedPair> getOrderedPairss() throws PDStoreException {
   Set<PDOrderedPair> result = new HashSet<PDOrderedPair>();
   GUID PDOrderedPairTypeId = new GUID("b3ba85348e0ede11980f9a097666e103");
   pdWorkingCopy.getInstances(
       this, roleOrderedPairsId, PDOrderedPair.class, PDOrderedPairTypeId, result);
   return result;
 }
  /**
   * Connects this instance to the given instance using role "ordered pairs". If the given instance
   * is null, nothing happens.
   *
   * @param orderedPairs the instance to connect
   * @throws PDStoreException
   */
  public void addOrderedPairs(GUID orderedPairs) throws PDStoreException {

    if (orderedPairs != null) {

      pdWorkingCopy.addLink(this.id, roleOrderedPairsId, orderedPairs);
    }
  }
  @Override
  public void keyPressed(KeyEvent arg0) {
    if (!arg0.isActionKey()) {

      char c = arg0.getKeyChar();

      if (c == ' ' || c == '\n') {
        uncommitedText += c;
        System.out.println("you typed the word: \"" + uncommitedText + "\"");

        /*
         * Code for communicating with PDStore here
         * 1. Create PDWord instance?
         * 2. Commit to PDStore?
         */
        PDWord word = new PDWord(store);
        word.addText(uncommitedText);
        PDOperation op = new PDOperation(store);
        op.setCommand(editor.INSERT);
        Date date = new Date();
        op.setTimeStamp(date.getTime());
        op.setUser(TextEditor.userName);
        PDInsert insert = new PDInsert(store);
        insert.setWord(word);
        insert.setAfter(word);
        op.setSuperParameter(insert);

        history.addOperation(op);

        store.commit();

        // this.repaint();

        uncommitedText = "";
      } else if (c == '\u0008') { // backspace character
        int i = uncommitedText.length();
        uncommitedText = uncommitedText.substring(0, i - 1);
      } else {
        uncommitedText += c;
      }
    }
  }
 /**
  * Sets the name of this instance. In PDStore every instance can be given a name. If the instance
  * already has a name, the name will be overwritten. If the given name is null, an existing name
  * will be removed.
  *
  * @return name the new instance name
  * @throws PDStoreException
  */
 public void setName(String name) throws PDStoreException {
   pdWorkingCopy.setName(id, name);
 }
 /**
  * Gets the name of this instance. In PDStore every instance can be given a name.
  *
  * @return name the instance name
  * @throws PDStoreException
  */
 public String getName() throws PDStoreException {
   return pdWorkingCopy.getName(id);
 }
 /**
  * Loads an instance object of this type into a cache. If the instance is already in the cache,
  * the cached instance is returned.
  *
  * @param PDWorkingCopy pdWorkingCopy to load the instance into
  * @param id GUID of the instance Do not directly call this method. Use the newInstance() method
  *     in PDCache which would call this method
  */
 public static PDOrder load(PDWorkingCopy pdWorkingCopy, GUID id) {
   PDInstance instance = pdWorkingCopy.load(typeId, id);
   return (PDOrder) instance;
 }
 /**
  * Connects this instance to the given instance using role "ordered pairs". If there is already an
  * instance connected to this instance through role "ordered pairs", the link will be overwritten.
  * If the given instance is null, an existing link is removed."
  *
  * @param orderedPairs the instance to connect
  * @throws PDStoreException
  */
 public void setOrderedPairs(GUID orderedPairs) throws PDStoreException {
   pdWorkingCopy.setLink(this.id, roleOrderedPairsId, orderedPairs);
 }
 /**
  * Removes the link from this instance through role "ordered pairs" to the given instance, if the
  * link exists. If there is no such link, nothing happens.orderedPairs.getId() If the given
  * instance is null, nothing happens.
  *
  * @throws PDStoreException
  */
 public void removeOrderedPairs(Object orderedPairs) throws PDStoreException {
   if (orderedPairs == null) return;
   pdWorkingCopy.removeLink(this.id, roleOrderedPairsId, orderedPairs);
 }
 /**
  * Removes the link from this instance through role "ordered pairs".
  *
  * @throws PDStoreException
  */
 public void removeOrderedPairs() throws PDStoreException {
   pdWorkingCopy.removeLink(
       this.id, roleOrderedPairsId, pdWorkingCopy.getInstance(this, roleOrderedPairsId));
 }
 /**
  * Returns the instance connected to this instance through the role "ordered pairs".
  *
  * @return the connected instance
  * @throws PDStoreException
  */
 public PDOrderedPair getOrderedPairs() throws PDStoreException {
   return (PDOrderedPair) pdWorkingCopy.getInstance(this, roleOrderedPairsId);
 }
 /**
  * Removes the icon of this instance. In PDStore every instance can be given an icon. If the
  * instance does not have an icon, nothing happens.
  *
  * @throws PDStoreException
  */
 public void removeIcon() throws PDStoreException {
   pdWorkingCopy.removeIcon(id);
 }
 /**
  * Sets the icon of this instance. In PDStore every instance can be given an icon. If the instance
  * already has an icon, the icon will be overwritten. If the given icon is null, an existing icon
  * will be removed.
  *
  * @return icon the new instance icon
  * @throws PDStoreException
  */
 public void setIcon(Blob icon) throws PDStoreException {
   pdWorkingCopy.setIcon(id, icon);
 }
 /**
  * Gets the icon of this instance. In PDStore every instance can be given an icon.
  *
  * @return icon the instance icon
  * @throws PDStoreException
  */
 public Blob getIcon() throws PDStoreException {
   return pdWorkingCopy.getIcon(id);
 }