public GikoletKDDIP30MIDlet() {
    // TODO 修正予定
    // super("MIDlet-X-AllowURL-", "2.cgi");

    super(false);

    Vector vs = new Vector();
    Vector vws = new Vector();

    for (int i = 1; i <= 3; i++) {
      String server = getAppProperty("MIDlet-X-AllowURL-" + i);
      if (server != null) {
        if (server.indexOf("2ch.net") != -1 || server.indexOf("bbspink.com") != -1) {
          vws.addElement(server);
        } else {
          vs.addElement(server + "2.cgi");
        }
      }
    }
    _writableHosts = new String[vws.size()];
    vws.copyInto(_writableHosts);

    String[] severs = new String[vs.size()];
    vs.copyInto(severs);

    startGikolet(severs);
  }
Exemplo n.º 2
1
 /**
  * Event.detail line start offset (input) Event.text line text (input) LineStyleEvent.styles
  * Enumeration of StyleRanges, need to be in order. (output) LineStyleEvent.background line
  * background color (output)
  */
 public void lineGetStyle(LineStyleEvent event) {
   Vector styles = new Vector();
   int token;
   StyleRange lastStyle;
   // If the line is part of a block comment, create one style for the entire line.
   if (inBlockComment(event.lineOffset, event.lineOffset + event.lineText.length())) {
     styles.addElement(
         new StyleRange(event.lineOffset, event.lineText.length(), getColor(COMMENT), null));
     event.styles = new StyleRange[styles.size()];
     styles.copyInto(event.styles);
     return;
   }
   Color defaultFgColor = ((Control) event.widget).getForeground();
   scanner.setRange(event.lineText);
   token = scanner.nextToken();
   while (token != EOF) {
     if (token == OTHER) {
       // do nothing for non-colored tokens
     } else if (token != WHITE) {
       Color color = getColor(token);
       // Only create a style if the token color is different than the
       // widget's default foreground color and the token's style is not
       // bold.  Keywords are bolded.
       if ((!color.equals(defaultFgColor)) || (token == KEY)) {
         StyleRange style =
             new StyleRange(
                 scanner.getStartOffset() + event.lineOffset, scanner.getLength(), color, null);
         if (token == KEY) {
           style.fontStyle = SWT.BOLD;
         }
         if (styles.isEmpty()) {
           styles.addElement(style);
         } else {
           // Merge similar styles.  Doing so will improve performance.
           lastStyle = (StyleRange) styles.lastElement();
           if (lastStyle.similarTo(style) && (lastStyle.start + lastStyle.length == style.start)) {
             lastStyle.length += style.length;
           } else {
             styles.addElement(style);
           }
         }
       }
     } else if ((!styles.isEmpty())
         && ((lastStyle = (StyleRange) styles.lastElement()).fontStyle == SWT.BOLD)) {
       int start = scanner.getStartOffset() + event.lineOffset;
       lastStyle = (StyleRange) styles.lastElement();
       // A font style of SWT.BOLD implies that the last style
       // represents a java keyword.
       if (lastStyle.start + lastStyle.length == start) {
         // Have the white space take on the style before it to
         // minimize the number of style ranges created and the
         // number of font style changes during rendering.
         lastStyle.length += scanner.getLength();
       }
     }
     token = scanner.nextToken();
   }
   event.styles = new StyleRange[styles.size()];
   styles.copyInto(event.styles);
 }
Exemplo n.º 3
1
  /**
   * Event.detail line start offset (input) Event.text line text (input) LineStyleEvent.styles
   * Enumeration of StyleRanges, need to be in order. (output) LineStyleEvent.background line
   * background color (output)
   */
  public void lineGetStyle(LineStyleEvent event) {
    Vector<StyleRange> styles = new Vector<StyleRange>();
    int token;
    StyleRange lastStyle;

    if (inBlockComment(event.lineOffset, event.lineOffset + event.lineText.length())) {
      styles.addElement(
          new StyleRange(event.lineOffset, event.lineText.length() + 4, colors[2], null));
      event.styles = new StyleRange[styles.size()];
      styles.copyInto(event.styles);
      return;
    }
    scanner.setRange(event.lineText);
    String xs = ((StyledText) event.widget).getText();
    if (xs != null) parseBlockComments(xs);
    token = scanner.nextToken();
    while (token != EOF) {
      if (token == OTHER) {
        // do nothing
      } else if ((token == WHITE) && (!styles.isEmpty())) {
        int start = scanner.getStartOffset() + event.lineOffset;
        lastStyle = (StyleRange) styles.lastElement();
        if (lastStyle.fontStyle != SWT.NORMAL) {
          if (lastStyle.start + lastStyle.length == start) {
            // have the white space take on the style before it to minimize font style
            // changes
            lastStyle.length += scanner.getLength();
          }
        }
      } else {
        Color color = getColor(token);
        if (color != colors[0]) { // hardcoded default foreground color, black
          StyleRange style =
              new StyleRange(
                  scanner.getStartOffset() + event.lineOffset, scanner.getLength(), color, null);
          if (token == KEY) {
            style.fontStyle = SWT.BOLD;
          }
          if (styles.isEmpty()) {
            styles.addElement(style);
          } else {
            lastStyle = (StyleRange) styles.lastElement();
            if (lastStyle.similarTo(style) && (lastStyle.start + lastStyle.length == style.start)) {
              lastStyle.length += style.length;
            } else {
              styles.addElement(style);
            }
          }
        }
      }
      token = scanner.nextToken();
    }
    event.styles = new StyleRange[styles.size()];
    styles.copyInto(event.styles);
  }
Exemplo n.º 4
1
  /**
   * doLmsCommit. This method takes the Javascript cmi model and attempts to update the CMI xml sco
   * file. It takes the javascript model as a 2-D array of name/value pairs, finds the element in
   * the JDOM model, updates it with the new value and then writes the new model back to disk.
   *
   * @param scoElementsPreUpdate
   */
  public void doLmsCommit(final String[][] scoElementsPreUpdate) {
    // System.out.println("reloadScoDocuement - dolmscommit is called");
    final String[][] scoElements = doFinalPreUpdate(scoElementsPreUpdate, false);
    final Vector objectives = new Vector();
    final Vector interactions = new Vector();
    int objectivesCount = 0;
    int interactionsCount = 0;

    for (int i = 0; i < scoElements.length; i++) {
      if (scoElements[i][0].startsWith("cmi.objectives")) {
        if (scoElements[i][0].equals("cmi.objectives._count")) {
          objectivesCount = Integer.parseInt(scoElements[i][1]);
        } else {
          objectives.add(scoElements[i]);
        }
      } else if (scoElements[i][0].startsWith("cmi.interactions")) {
        if (scoElements[i][0].equals("cmi.interactions._count")) {
          interactionsCount = Integer.parseInt(scoElements[i][1]);
        } else {
          interactions.add(scoElements[i]);
        }
      } else {
        final Element itemToChange = getElement(getDocument().getRootElement(), scoElements[i][0]);
        if (itemToChange != null) {
          itemToChange.setText(scoElements[i][1]);
        }
      }
    }
    // update the objectives
    final String[][] objectivesArray = new String[objectives.size()][2];
    objectives.copyInto(objectivesArray);
    if (objectivesCount > 0) {
      dealWithSavingObjectives(objectivesCount, objectivesArray);
    }
    objectives.clear();
    // update the interactions
    final String[][] interactionsArray = new String[interactions.size()][2];
    interactions.copyInto(interactionsArray);
    if (interactionsCount > 0) {
      dealWithSavingInteractions(interactionsCount, interactionsArray);
    }
    interactions.clear();
    // finally commit this back to disk
    try {
      saveDocument();
    } catch (final IOException ex) {
      throw new OLATRuntimeException(this.getClass(), "Error: could not save sco model:", ex);
    }
  }
Exemplo n.º 5
1
  public static InformalArgument_c[] getManyMSG_IAsOnR1013(
      MessageArgument_c[] targets, ClassQueryInterface_c test, boolean loadComponent) {

    if (targets == null || targets.length == 0 || targets[0] == null)
      return new InformalArgument_c[0];

    ModelRoot modelRoot = targets[0].getModelRoot();

    InstanceList instances = modelRoot.getInstanceList(InformalArgument_c.class);

    Vector matches = new Vector();
    for (int i = 0; i < targets.length; i++) {
      InformalArgument_c source =
          (InformalArgument_c) targets[i].backPointer_IsSubtypeInformalArgumentIsSubtype_R1013;
      if (source != null && (test == null || test.evaluate(source))) {
        matches.add(source);
      }
    }
    if (matches.size() > 0) {
      InformalArgument_c[] ret_set = new InformalArgument_c[matches.size()];
      matches.copyInto(ret_set);
      return ret_set;
    } else {
      return new InformalArgument_c[0];
    }
  }
Exemplo n.º 6
1
  public static ComponentInComponent_c[] getManyCN_CICsOnR4202(
      Component_c target, ClassQueryInterface_c test, boolean loadComponent) {
    if (target == null) return new ComponentInComponent_c[0];

    ModelRoot modelRoot = target.getModelRoot();
    Vector matches = new Vector();
    synchronized (target.backPointer_CanNestComponentInComponentCanNest_R4202) {
      for (int i = 0; i < target.backPointer_CanNestComponentInComponentCanNest_R4202.size(); ++i) {
        ComponentInComponent_c source =
            (ComponentInComponent_c)
                target.backPointer_CanNestComponentInComponentCanNest_R4202.get(i);
        if (source != null && (test == null || test.evaluate(source))) {

          matches.add(source);
        }
      }
    }

    if (matches.size() > 0) {
      ComponentInComponent_c[] ret_set = new ComponentInComponent_c[matches.size()];
      matches.copyInto(ret_set);
      return ret_set;
    } else {
      return new ComponentInComponent_c[0];
    }
  }
Exemplo n.º 7
0
  public static ComponentInComponent_c[] getManyCN_CICsOnR4202(
      Component_c[] targets, ClassQueryInterface_c test, boolean loadComponent) {

    if (targets == null || targets.length == 0 || targets[0] == null)
      return new ComponentInComponent_c[0];

    ModelRoot modelRoot = targets[0].getModelRoot();

    InstanceList instances = modelRoot.getInstanceList(ComponentInComponent_c.class);

    Vector matches = new Vector();
    for (int i = 0; i < targets.length; i++) {
      synchronized (targets[i].backPointer_CanNestComponentInComponentCanNest_R4202) {
        for (int j = 0;
            j < targets[i].backPointer_CanNestComponentInComponentCanNest_R4202.size();
            ++j) {
          ComponentInComponent_c source =
              (ComponentInComponent_c)
                  targets[i].backPointer_CanNestComponentInComponentCanNest_R4202.get(j);
          if (source != null && (test == null || test.evaluate(source))) {
            matches.add(source);
          }
        }
      }
    }
    if (matches.size() > 0) {
      ComponentInComponent_c[] ret_set = new ComponentInComponent_c[matches.size()];
      matches.copyInto(ret_set);
      return ret_set;
    } else {
      return new ComponentInComponent_c[0];
    }
  }
Exemplo n.º 8
0
  public static DataTypeInPackage_c[] getManyS_DIPsOnR39(
      DataType_c[] targets, ClassQueryInterface_c test, boolean loadComponent) {

    if (targets == null || targets.length == 0 || targets[0] == null)
      return new DataTypeInPackage_c[0];

    ModelRoot modelRoot = targets[0].getModelRoot();

    InstanceList instances = modelRoot.getInstanceList(DataTypeInPackage_c.class);

    Vector matches = new Vector();
    for (int i = 0; i < targets.length; i++) {
      synchronized (targets[i].backPointer_IsContainedInDataTypeInPackageIsContainedIn_R39) {
        for (int j = 0;
            j < targets[i].backPointer_IsContainedInDataTypeInPackageIsContainedIn_R39.size();
            ++j) {
          DataTypeInPackage_c source =
              (DataTypeInPackage_c)
                  targets[i].backPointer_IsContainedInDataTypeInPackageIsContainedIn_R39.get(j);
          if (source != null && (test == null || test.evaluate(source))) {
            matches.add(source);
          }
        }
      }
    }
    if (matches.size() > 0) {
      DataTypeInPackage_c[] ret_set = new DataTypeInPackage_c[matches.size()];
      matches.copyInto(ret_set);
      return ret_set;
    } else {
      return new DataTypeInPackage_c[0];
    }
  }
Exemplo n.º 9
0
  /**
   * Sort the given Vector of {@Link com.compendium.meeting.MeetingAgendaItem MeetingAgendaItem}
   * objects by thier agenda position numbers.
   *
   * @param Vector items the vector of {@Link com.compendium.meeting.MeetingAgendaItem
   *     MeetingAgendaItem} objects to sort.
   * @return a Vector of the sorted objects.
   */
  public Vector sortAgenda(Vector items) {

    if (items.size() <= 0) {
      return items;
    }

    Vector sortedVector = new Vector();
    Object[] sa = new Object[items.size()];
    items.copyInto(sa);
    List l = Arrays.asList(sa);

    Collections.sort(
        l,
        new Comparator() {
          public int compare(Object o1, Object o2) {

            MeetingAgendaItem item = (MeetingAgendaItem) o1;
            float number = item.getNumber();
            Float f1 = new Float(number);

            MeetingAgendaItem item2 = (MeetingAgendaItem) o2;
            float number2 = item2.getNumber();
            Float f2 = new Float(number2);

            return (f1.compareTo(f2));
          }
        });

    // add sorted elements from list to vector
    for (Iterator it = l.iterator(); it.hasNext(); ) {
      sortedVector.addElement(it.next());
    }

    return sortedVector;
  }
Exemplo n.º 10
0
 public Tag[] select(String path, Tag mapping) {
   Vector<Object> v = new Vector<Object>();
   select(path, v, mapping);
   Tag[] result = new Tag[v.size()];
   v.copyInto(result);
   return result;
 }
  private void fetchPrimaryKeys() {

    Vector temp = new Vector(20);

    try {
      if (cConn == null) {
        return;
      }

      if (dbmeta == null) {
        dbmeta = cConn.getMetaData();
      }

      ResultSet colList = dbmeta.getPrimaryKeys(null, null, tableName);

      while (colList.next()) {
        temp.addElement(colList.getString("COLUMN_NAME"));
      }

      colList.close();
    } catch (SQLException e) {
      ZaurusEditor.printStatus("SQL Exception: " + e.getMessage());
    }

    primaryKeys = new String[temp.size()];

    temp.copyInto(primaryKeys);

    pkColIndex = new int[primaryKeys.length];

    for (int i = 0; i < primaryKeys.length; i++) {
      pkColIndex[i] = this.getColIndex(primaryKeys[i]);
    } // end of for (int i=0; i<primaryKeys.length; i++)
  }
  public static DescriptionQuery_c[] getManySQU_DEsOnR9600(
      Query_c[] targets, ClassQueryInterface_c test, boolean loadComponent) {

    if (targets == null || targets.length == 0 || targets[0] == null)
      return new DescriptionQuery_c[0];

    ModelRoot modelRoot = targets[0].getModelRoot();

    InstanceList instances = modelRoot.getInstanceList(DescriptionQuery_c.class);

    Vector matches = new Vector();
    for (int i = 0; i < targets.length; i++) {
      DescriptionQuery_c source =
          (DescriptionQuery_c) targets[i].backPointer_IsSubtypeDescriptionQueryIsSubtype_R9600;
      if (source != null && (test == null || test.evaluate(source))) {
        matches.add(source);
      }
    }
    if (matches.size() > 0) {
      DescriptionQuery_c[] ret_set = new DescriptionQuery_c[matches.size()];
      matches.copyInto(ret_set);
      return ret_set;
    } else {
      return new DescriptionQuery_c[0];
    }
  }
Exemplo n.º 13
0
    public ErrorEntry(String path, String messageProp, Object[] args) {
      this.path = path;

      String message = jEdit.getProperty(messageProp, args);
      if (message == null) message = "Undefined property: " + messageProp;

      Log.log(Log.ERROR, this, path + ":");
      Log.log(Log.ERROR, this, message);

      Vector tokenizedMessage = new Vector();
      int lastIndex = -1;
      for (int i = 0; i < message.length(); i++) {
        if (message.charAt(i) == '\n') {
          tokenizedMessage.addElement(message.substring(lastIndex + 1, i));
          lastIndex = i;
        }
      }

      if (lastIndex != message.length()) {
        tokenizedMessage.addElement(message.substring(lastIndex + 1));
      }

      messages = new String[tokenizedMessage.size()];
      tokenizedMessage.copyInto(messages);
    }
  public static ComponentResultSet_c[] getManyPE_CRSsOnR8007(
      Component_c target, ClassQueryInterface_c test, boolean loadComponent) {
    if (target == null) return new ComponentResultSet_c[0];

    ModelRoot modelRoot = target.getModelRoot();
    Vector matches = new Vector();
    synchronized (target.backPointer_HoldsComponentResultSetHolds_R8007) {
      for (int i = 0; i < target.backPointer_HoldsComponentResultSetHolds_R8007.size(); ++i) {
        ComponentResultSet_c source =
            (ComponentResultSet_c) target.backPointer_HoldsComponentResultSetHolds_R8007.get(i);
        if (source != null && (test == null || test.evaluate(source))) {

          matches.add(source);
        }
      }
    }

    if (matches.size() > 0) {
      ComponentResultSet_c[] ret_set = new ComponentResultSet_c[matches.size()];
      matches.copyInto(ret_set);
      return ret_set;
    } else {
      return new ComponentResultSet_c[0];
    }
  }
Exemplo n.º 15
0
  public static final void fireEvent(GenericEvent e, Method m, Vector listeners)
      throws PropertyVetoException {
    Object[] snapshot = null;

    synchronized (listeners) {
      snapshot = new Object[listeners.size()];
      listeners.copyInto(snapshot);
    }

    // leighd 04/14/99 - modified for event debugging
    if (gDebugEvents) Engine.debugLog("Event : " + e.toString());

    Object params[] = new Object[] {e};

    for (int i = 0; i < snapshot.length; i++) {
      if ((e instanceof Consumable) && ((Consumable) e).isConsumed()) {
        // leighd 04/14/99
        // note that we don't catch the consumption of the
        // event until we've passed through the loop again,
        // so we reference i-1
        if (gDebugEvents) Engine.debugLog("Consumed By : " + snapshot[i - 1]);
        return;
      }
      try {
        m.invoke(snapshot[i], params);
      } catch (IllegalAccessException iae) {
        iae.printStackTrace();
      } catch (InvocationTargetException ite) {
        Throwable t = ite.getTargetException();
        if (t instanceof PropertyVetoException) throw ((PropertyVetoException) t);
        else t.printStackTrace();
      }
    }
  }
Exemplo n.º 16
0
  public void load(String resName, int width, int height) throws IOException {
    Image resImage = ImageList.loadImage(resName);
    if (null == resImage) {
      return;
    }
    int imgHeight = resImage.getHeight();
    int imgWidth = resImage.getWidth();

    if (width == -1) {
      width = Math.min(imgHeight, imgWidth);
    }
    if (height == -1) {
      height = imgHeight;
    }

    this.width = width;
    this.height = height;

    Vector<Icon> tmpIcons = new Vector<Icon>();
    for (int y = 0; y < imgHeight; y += height) {
      for (int x = 0; x < imgWidth; x += width) {
        Icon icon = new Icon(resImage, x, y, width, height);
        tmpIcons.addElement(icon);
      }
    }
    icons = new Icon[tmpIcons.size()];
    tmpIcons.copyInto(icons);
  }
Exemplo n.º 17
0
  /**
   * This will populate the imageInfo hashtable with the ImageInfo object, referenced by label name
   * and populate the imageTable hashtable with Image objects referenced by the RMS record Id
   *
   * @throws PersistenceMechanismException
   */
  public MediaData[] loadMediaDataFromRMS(String recordName)
      throws PersistenceMechanismException, InvalidImageDataException {
    Vector mediaVector = new Vector();

    try {
      String infoStoreName = info_label + recordName;
      RecordStore infoStore = RecordStore.openRecordStore(infoStoreName, false);
      RecordEnumeration isEnum = infoStore.enumerateRecords(null, null, false);

      while (isEnum.hasNextElement()) {
        // Get next record
        int currentId = isEnum.nextRecordId();
        byte[] data = infoStore.getRecord(currentId);

        // Convert the data from a byte array into our ImageData
        // (metadata) object
        MediaData iiObject = getMediaFromBytes(data);

        // Add the info to the metadata hashtable
        String label = iiObject.getMediaLabel();
        mediaVector.addElement(iiObject);
        getMediaInfoTable().put(label, iiObject);
      }
      infoStore.closeRecordStore();

    } catch (RecordStoreException rse) {
      throw new PersistenceMechanismException(rse);
    }

    // Re-copy the contents into a smaller array
    MediaData[] labelArray = new MediaData[mediaVector.size()];
    mediaVector.copyInto(labelArray);
    return labelArray;
  }
  /**
   * Get the names of the header-fields set in this profile.
   *
   * @return headers set in this profile
   */
  public String[] getHeaderNames() {
    if (headers == null) return new String[0];

    String[] s = new String[headers.size()];
    headers.copyInto(s);
    return s;
  }
Exemplo n.º 19
0
  /** This */
  private String[] getCompileOptionsAsArray() {
    Vector options = new Vector();

    options.addElement(binary ? "-binary" : "-nobinary");
    options.addElement(comments ? "-comments" : "-nocomments");
    options.addElement(compile ? "-compile" : "-nocompile");
    options.addElement(compact ? "-compact" : "-nocompact");
    options.addElement(console ? "-console" : "-noconsole");
    options.addElement(crossref ? "-crossref" : "-nocrossref");
    options.addElement(decimal ? "-decimal" : "-nodecimal");
    options.addElement(diag ? "-diag" : "-nodiag");
    options.addElement(explicit ? "-explicit" : "-noexplicit");
    options.addElement(format ? "-format" : "-noformat");
    options.addElement(keep ? "-keep" : "-nokeep");
    options.addElement(logo ? "-logo" : "-nologo");
    options.addElement(replace ? "-replace" : "-noreplace");
    options.addElement(savelog ? "-savelog" : "-nosavelog");
    options.addElement(sourcedir ? "-sourcedir" : "-nosourcedir");
    options.addElement(strictargs ? "-strictargs" : "-nostrictargs");
    options.addElement(strictassign ? "-strictassign" : "-nostrictassign");
    options.addElement(strictcase ? "-strictcase" : "-nostrictcase");
    options.addElement(strictimport ? "-strictimport" : "-nostrictimport");
    options.addElement(strictprops ? "-strictprops" : "-nostrictprops");
    options.addElement(strictsignal ? "-strictsignal" : "-nostrictsignal");
    options.addElement(symbols ? "-symbols" : "-nosymbols");
    options.addElement(time ? "-time" : "-notime");
    options.addElement("-" + trace);
    options.addElement(utf8 ? "-utf8" : "-noutf8");
    options.addElement("-" + verbose);

    String[] results = new String[options.size()];

    options.copyInto(results);
    return results;
  }
Exemplo n.º 20
0
  public String[] dir() throws KettleJobException {
    String[] fileList = null;

    try {
      java.util.Vector<?> v = c.ls(".");
      java.util.Vector<String> o = new java.util.Vector<String>();
      if (v != null) {
        for (int i = 0; i < v.size(); i++) {
          Object obj = v.elementAt(i);
          if (obj != null && obj instanceof com.jcraft.jsch.ChannelSftp.LsEntry) {
            LsEntry lse = (com.jcraft.jsch.ChannelSftp.LsEntry) obj;
            if (!lse.getAttrs().isDir()) {
              o.add(lse.getFilename());
            }
          }
        }
      }
      if (o.size() > 0) {
        fileList = new String[o.size()];
        o.copyInto(fileList);
      }
    } catch (SftpException e) {
      throw new KettleJobException(e);
    }

    return fileList;
  }
Exemplo n.º 21
0
  /**
   * Read a list of space-separated "flag_extension" sequences and return the list as a array of
   * Strings. An empty list is returned as null. This is an IMAP-ism, and perhaps this method should
   * moved into the IMAP layer.
   */
  public String[] readSimpleList() {
    skipSpaces();

    if (buffer[index] != '(') // not what we expected
    return null;
    index++; // skip '('

    Vector v = new Vector();
    int start;
    for (start = index; buffer[index] != ')'; index++) {
      if (buffer[index] == ' ') { // got one item
        v.addElement(ASCIIUtility.toString(buffer, start, index));
        start = index + 1; // index gets incremented at the top
      }
    }
    if (index > start) // get the last item
    v.addElement(ASCIIUtility.toString(buffer, start, index));
    index++; // skip ')'

    int size = v.size();
    if (size > 0) {
      String[] s = new String[size];
      v.copyInto(s);
      return s;
    } else // empty list
    return null;
  }
  public static TransientValueReference_c[] getManyV_TVLsOnR805(
      Variable_c target, ClassQueryInterface_c test, boolean loadComponent) {
    if (target == null) return new TransientValueReference_c[0];

    ModelRoot modelRoot = target.getModelRoot();
    Vector matches = new Vector();
    synchronized (target.backPointer_TransientValueReference_R805) {
      for (int i = 0; i < target.backPointer_TransientValueReference_R805.size(); ++i) {
        TransientValueReference_c source =
            (TransientValueReference_c) target.backPointer_TransientValueReference_R805.get(i);
        if (source != null && (test == null || test.evaluate(source))) {

          matches.add(source);
        }
      }
    }

    if (matches.size() > 0) {
      TransientValueReference_c[] ret_set = new TransientValueReference_c[matches.size()];
      matches.copyInto(ret_set);
      return ret_set;
    } else {
      return new TransientValueReference_c[0];
    }
  }
Exemplo n.º 23
0
 /** Reads uids from 'uids' file during conversion of midlets from old java to OMJ. */
 private void readUidsFromFile(InstallBall aBall) {
   if (!aBall.iConversionInstallation) {
     return;
   }
   String uidsFilename = aBall.iConversionRoot + "uids";
   if (FileUtils.exists(uidsFilename)) {
     Log.log("Reading uids file: " + uidsFilename);
     Vector v = new Vector();
     InputStream is = null;
     try {
       is = FileUtils.getInputStream(uidsFilename);
       while (is.available() > 0) {
         v.addElement(readUid(is));
       }
     } catch (IOException ioe) {
       InstallerException.internalError("Error while reading uids file: " + uidsFilename, ioe);
     } finally {
       if (is != null) {
         try {
           is.close();
           is = null;
         } catch (IOException ioe) {
           Log.logWarning("Closing InputStream failed", ioe);
         }
       }
     }
     iUidsFromFile = new Uid[v.size()];
     v.copyInto(iUidsFromFile);
     for (int i = 0; i < iUidsFromFile.length; i++) {
       Log.log("Read uid[" + i + "]: " + iUidsFromFile[i]);
     }
   } else {
     InstallerException.internalError("No uids file: " + uidsFilename);
   }
 }
  /**
   * Get the items set in this profile.
   *
   * @return items set in this profile
   */
  public Item[] getItems() {
    if (specials == null) return new Item[0];

    Item[] s = new Item[specials.size()];
    specials.copyInto(s);
    return s;
  }
Exemplo n.º 25
0
  /**
   * Called once to load collection handler information for the various collection handlers (Java
   * 1.1, Java 1.2) based on the configuration file.
   */
  private static synchronized void loadInfo() {
    if (_info == null) {
      Vector allInfo;
      Info[] info;
      StringTokenizer tokenizer;
      Class infoClass;
      Method method;

      allInfo = new Vector();
      LocalConfiguration config = LocalConfiguration.getInstance();
      tokenizer =
          new StringTokenizer(
              config.getProperty("org.exolab.castor.mapping.collections", ""), ", ");
      while (tokenizer.hasMoreTokens()) {
        try {
          if (CollectionHandlers.class.getClassLoader() != null)
            infoClass = CollectionHandlers.class.getClassLoader().loadClass(tokenizer.nextToken());
          else infoClass = Class.forName(tokenizer.nextToken());
          method = infoClass.getMethod("getCollectionHandlersInfo", (Class[]) null);
          info = (Info[]) method.invoke(null, (Object[]) null);
          for (int i = 0; i < info.length; ++i) allInfo.addElement(info[i]);
        } catch (Exception except) {
          // System.err.println( "CollectionHandlers: " + except.toString() );
        }
      }
      _info = new Info[allInfo.size()];
      allInfo.copyInto(_info);
    }
  }
Exemplo n.º 26
0
  public static ElementInMove_c[] getManyGD_EIMsOnR25(
      GraphicalElement_c[] targets, ClassQueryInterface_c test, boolean loadComponent) {

    if (targets == null || targets.length == 0 || targets[0] == null) return new ElementInMove_c[0];

    ModelRoot modelRoot = targets[0].getModelRoot();

    InstanceList instances = modelRoot.getInstanceList(ElementInMove_c.class);

    Vector matches = new Vector();
    for (int i = 0; i < targets.length; i++) {
      synchronized (targets[i].backPointer_IsMovingInElementInMoveIsMovingIn_R25) {
        for (int j = 0;
            j < targets[i].backPointer_IsMovingInElementInMoveIsMovingIn_R25.size();
            ++j) {
          ElementInMove_c source =
              (ElementInMove_c) targets[i].backPointer_IsMovingInElementInMoveIsMovingIn_R25.get(j);
          if (source != null && (test == null || test.evaluate(source))) {
            matches.add(source);
          }
        }
      }
    }
    if (matches.size() > 0) {
      ElementInMove_c[] ret_set = new ElementInMove_c[matches.size()];
      matches.copyInto(ret_set);
      return ret_set;
    } else {
      return new ElementInMove_c[0];
    }
  }
Exemplo n.º 27
0
  public static DataTypeInPackage_c[] getManyS_DIPsOnR39(
      DataTypePackage_c target, ClassQueryInterface_c test, boolean loadComponent) {
    if (target == null) return new DataTypeInPackage_c[0];

    ModelRoot modelRoot = target.getModelRoot();
    Vector matches = new Vector();
    synchronized (target.backPointer_ContainsDataTypeInPackageContains_R39) {
      for (int i = 0; i < target.backPointer_ContainsDataTypeInPackageContains_R39.size(); ++i) {
        DataTypeInPackage_c source =
            (DataTypeInPackage_c) target.backPointer_ContainsDataTypeInPackageContains_R39.get(i);
        if (source != null && (test == null || test.evaluate(source))) {

          matches.add(source);
        }
      }
    }

    if (matches.size() > 0) {
      DataTypeInPackage_c[] ret_set = new DataTypeInPackage_c[matches.size()];
      matches.copyInto(ret_set);
      return ret_set;
    } else {
      return new DataTypeInPackage_c[0];
    }
  }
Exemplo n.º 28
0
  public static AssignToMember_c[] getManyACT_AIsOnR603(
      Statement_c[] targets, ClassQueryInterface_c test, boolean loadComponent) {

    if (targets == null || targets.length == 0 || targets[0] == null)
      return new AssignToMember_c[0];

    ModelRoot modelRoot = targets[0].getModelRoot();

    InstanceList instances = modelRoot.getInstanceList(AssignToMember_c.class);

    Vector matches = new Vector();
    for (int i = 0; i < targets.length; i++) {
      AssignToMember_c source =
          (AssignToMember_c) targets[i].backPointer_IsSubtypeAssignToMemberIsSubtype_R603;
      if (source != null && (test == null || test.evaluate(source))) {
        matches.add(source);
      }
    }
    if (matches.size() > 0) {
      AssignToMember_c[] ret_set = new AssignToMember_c[matches.size()];
      matches.copyInto(ret_set);
      return ret_set;
    } else {
      return new AssignToMember_c[0];
    }
  }
  public static TransientValueReference_c[] getManyV_TVLsOnR801(
      Value_c[] targets, ClassQueryInterface_c test, boolean loadComponent) {

    if (targets == null || targets.length == 0 || targets[0] == null)
      return new TransientValueReference_c[0];

    ModelRoot modelRoot = targets[0].getModelRoot();

    InstanceList instances = modelRoot.getInstanceList(TransientValueReference_c.class);

    Vector matches = new Vector();
    for (int i = 0; i < targets.length; i++) {
      TransientValueReference_c source =
          (TransientValueReference_c)
              targets[i].backPointer_IsSubtypeTransientValueReferenceIsSubtype_R801;
      if (source != null && (test == null || test.evaluate(source))) {
        matches.add(source);
      }
    }
    if (matches.size() > 0) {
      TransientValueReference_c[] ret_set = new TransientValueReference_c[matches.size()];
      matches.copyInto(ret_set);
      return ret_set;
    } else {
      return new TransientValueReference_c[0];
    }
  }
  public static InstanceStateMachine_c[] getManySM_ISMsOnR518(
      ModelClass_c[] targets, ClassQueryInterface_c test, boolean loadComponent) {

    if (targets == null || targets.length == 0 || targets[0] == null)
      return new InstanceStateMachine_c[0];

    ModelRoot modelRoot = targets[0].getModelRoot();
    if (loadComponent) {
      // Containment Relation
      PersistableModelComponent[] pmcs = new PersistableModelComponent[targets.length];
      for (int i = 0; i < targets.length; i++) {
        pmcs[i] = targets[i].getPersistableComponent();
      }
      PersistenceManager.ensureAllChildInstancesLoaded(
          pmcs, modelRoot, InstanceStateMachine_c.class);
    }

    InstanceList instances = modelRoot.getInstanceList(InstanceStateMachine_c.class);

    Vector matches = new Vector();
    for (int i = 0; i < targets.length; i++) {
      InstanceStateMachine_c source =
          (InstanceStateMachine_c) targets[i].backPointer_InstanceStateMachine_R518;
      if (source != null && (test == null || test.evaluate(source))) {
        matches.add(source);
      }
    }
    if (matches.size() > 0) {
      InstanceStateMachine_c[] ret_set = new InstanceStateMachine_c[matches.size()];
      matches.copyInto(ret_set);
      return ret_set;
    } else {
      return new InstanceStateMachine_c[0];
    }
  }