Package java.util

Examples of java.util.LinkedList$Cell


        if (proj == null) {
            return null;
        }

        List asrps = getASRPDirs();
        List currentBestASRPs = new LinkedList();
        double bestScaleDiff = Double.MAX_VALUE;
        Iterator it;
        ASRPDirectory current;

        for (it = asrps.iterator(); it.hasNext();) {
            try {
                current = (ASRPDirectory) it.next();
            } catch (ClassCastException cce) {
                Debug.message("asrp",
                        "ASRPDirectoryHandler.getImagesForProjection:  ASRP directory list contains something other than ASRPDirectory objects");
                continue;
            }

            if (current.isOnMap(proj) && current.validScale(proj)) {
                // Need to check to see if the ASRP Directory is the
                // best fit for the current projection scale, since
                // it's on the map and within the scale limits.

                double scaleDiff = Math.abs(proj.getXPixConstant()
                        - current.arv);

                if (scaleDiff < bestScaleDiff) {
                    if (Debug.debugging("asrp")) {
                        Debug.output("ASRPDirHandler: SETTING new diff ("
                                + scaleDiff + ") adding ASRPDirectory "
                                + current.dir);
                    }
                    bestScaleDiff = scaleDiff;
                    currentBestASRPs.clear();
                    currentBestASRPs.add(current);
                } else if (scaleDiff == bestScaleDiff) {
                    if (Debug.debugging("asrp")) {
                        Debug.output("ASRPDirHandler: USING current diff ("
                                + scaleDiff + ") adding ASRPDirectory "
                                + current.dir);
                    }
                    currentBestASRPs.add(current);
                }
            }
        }

        // OK, now currentBestASRPs should contain the ASRPDirectories
        // that best fit the current projection. If its empty, we
        // just return an empty list.
        for (it = currentBestASRPs.iterator(); it.hasNext();) {
            current = (ASRPDirectory) it.next();
            if (Debug.debugging("asrp")) {
                Debug.output("ASRPDirHandler: getting images from "
                        + current.dir);
            }
View Full Code Here


        getASRPDirs().clear();
    }

    public List getASRPDirs() {
        if (asrpDirs == null) {
            asrpDirs = new LinkedList();
        }
        return asrpDirs;
    }
View Full Code Here

        if (Debug.debugging("dted")) {
            Debug.output("DTEDAdmin: Checking for directory " + dtedDir);
        }

        LinkedList frames = null;

        if (true/* (new File(dtedDir)).exists() */) { // not
            level_ = level;
            ullat_ = ullat;
            ullon_ = ullon;
View Full Code Here

        int leftx = (int) Math.floor(ullon_);
        int rightx = (int) Math.ceil(lrlon_);
        int bottomy = (int) Math.floor(lrlat_);
        int topy = (int) Math.ceil(ullat_);

        LinkedList frames = new LinkedList();

        locator = new DTEDLocator(dtedDir);
        locator.organize();

        for (int hor = leftx; hor < rightx; hor++) {
            for (int ver = bottomy; ver < topy; ver++) {
                for (lev = 0; lev < MAXLEVELS; lev++) {
                    dothisone = false;
                    switch (equal_) {
                    case DTED_LARGER_LEVELS:
                        if (lev > level_)
                            dothisone = true;
                        break;
                    case DTED_SMALLER_LEVELS:
                        if (lev < level_)
                            dothisone = true;
                        break;
                    case DTED_NOTEQUAL_LEVELS:
                        if (lev != level_)
                            dothisone = true;
                        break;
                    case DTED_EQUAL_LEVELS:
                    default:
                        if (lev == level_)
                            dothisone = true;
                        break;
                    }

                    if (dothisone) {
                        File file = locator.get(ver, hor, lev);

                        if (file != null) {
                            if (Debug.debugging("dted")) {
                                Debug.output("DTEDAdmin adding "
                                        + file.getAbsolutePath() + " to list");
                            }
                            frames.add(file);
                        }
                    }
                }
            }
        }
View Full Code Here

     */
    public Queue() {
        ////////////////////////Modified by Ben/////////////////////////
        /* In order to implement synchronized access */
        //q = new LinkedList();
        q = Collections.synchronizedList(new LinkedList());
        ///////////////////////////////////////////////////////////////
    }
View Full Code Here

  public void setCreationDate(JDCConnection oConn, Date dtCreated) throws SQLException {
    if (null==dtCreated) dtCreated = new Date();
    PreparedStatement oStmt = null;
    DBTable oTbl = getTable(oConn);
    LinkedList oList = oTbl.getPrimaryKey();
    ListIterator oIter;
    String sSQL = "UPDATE "+oTbl.getName()+" SET "+DB.dt_created+"=? WHERE 1=1";
    oIter = oList.listIterator();
    while (oIter.hasNext())
      sSQL += " AND " + oIter.next() + "=?";
    try {
    oStmt = oConn.prepareStatement(sSQL, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
    oStmt.setTimestamp(1, new Timestamp(dtCreated.getTime()));
    int p=1;
    oIter = oList.listIterator();
    while (oIter.hasNext())
      oStmt.setObject(++p, get(oIter.next()));
    oStmt.executeUpdate();
    oStmt.close();
    oStmt=null;
View Full Code Here

   * @param      inStream     the input stream.
   * @exception  IOException  if an error occurred when reading from the
   *                          input stream.
   */
  public synchronized void load(InputStream inStream) throws IOException {
    _infoList = new LinkedList();
        masterPropertiesList = new ArrayList();
    BufferedReader in =
      new BufferedReader(new InputStreamReader(inStream, "8859_1"));

    while (true) {
View Full Code Here

    {0};
    // position in the actual byte array, ignored during string parsing
    for (int i = 0; i < fieldSpecs.getLength(); i++)
    { // Loop over all fields and group references
      Element fieldSpec = (Element) fieldSpecs.item(i);
      LinkedList fields = new LinkedList();
      // For the result of field parsing (multiple fields in case of a
      // group)
      if (fieldSpec.getNodeName().equals("Field"))

        // a single field
        stringPos = parseField(interfaceContent, stringPos, line,
            lineEnd, linePos, doc, fields, fieldSpec);

      else if (fieldSpec.getNodeName().equals("Group"))

        // a field group
        stringPos = parseGroup(interfaceContent, stringPos, line,
            lineEnd, linePos, doc, fields, fieldSpec);

      // Now append the result to the record node.
      for (int j = 0; j < fields.size(); j++)
        parent.appendChild((Node) fields.get(j));
    } // for (int i=0; i<fieldSpecs.getLength(); i++)
    return stringPos;
  }
View Full Code Here

          groupRef.getAttribute("Name"), groupsSpec).getChildNodes();
      // fields in the group
      for (int i = 0; i < fieldSpecs.getLength(); i++)
      { // Loop over all group fields
        Element fieldSpec = (Element) fieldSpecs.item(i);
        LinkedList field = new LinkedList();
        // For the result of field parsing (list for call by reference)

        // the single field
        stringPos = parseField(interfaceContent, stringPos, line,
            lineEnd, linePos, doc, field, fieldSpec);

        if (field.size() == 1)
          fields.add(field.get(0));
      } // for (int i=0; i<fieldSpecs.getLength(); i++)
    } // try
    catch (ClassCastException e)
    {
      throw new XException(Constants.LOCATION_INTERN,
View Full Code Here

    } // else (recIdentMethod.equals("TypeIdentifier"))

    String[] recordTypeNames = new String[numOfRecordTypes];
    // Storing the names for consistency check gainst the record type
    // specification section.
    LinkedList typeIds = new LinkedList();
    LinkedList typeIdIntervals = new LinkedList();
    // Record type identifier may be single values or intervals.
    // They are stored to check their unique reference to a record type.
    int recordTypesCount = recordTypes.getLength();
    // the number of record types in the current record group or at all
    // (wihtout grouping) - at least if no bad nodes are included in a
    // errorprone specification
    int recordTypesBefore = 0;
    // number of record type declarations checked in other record groups
    // before - used as offset to datermine the position in the record type
    // array
    while (recordGroup != null)
    { // loop over record groups
      // - only one loop if <recOrder>!="Structured" because of missing
      // record groups
      for (int i = 0; i < recordTypesCount; i++)
      { // Loop over all record type declarations of the record group
        Node rType = recordTypes.item(i);

        // Extension if no DTD validating
        if (rType.getNodeType() != Node.ELEMENT_NODE
            || !rType.getNodeName().equals("RecordType"))
        {
          List params = new Vector();
          params.add(rType.getNodeName());
          throw new XException(Constants.LOCATION_INTERN,
              Constants.LAYER_PROTOCOL,
              Constants.PACKAGE_PROTOCOL_RECORDS, "15", params);
        }
        // Check the consistency of this single record type declaration.
        // If its occurrence depends on values in the prececeeding
        // record
        // the information about this value is stored in
        // <dependenceOnPredecessor>.
        String[] dependenceOnPredecessor = checkRecordTypeDeclaration(
            rType, recordTypesCount, recordTypesBefore + i,
            recIdentMethod, recOrder, recordTypeNames, typeIds,
            typeIdIntervals, existanceIndicators);

        if (existanceIndicators != null
            && dependenceOnPredecessor != null)
        { // Existance records are expected in general and an
          // existance
          // indicator is defined for the last cheched record type.
          // To ensure that the identification via existance
          // indicators
          // is possible, the information about them is analysed the
          // other
          // way round. Originally the information was attached as
          // <dependenceOnPredecessor> to the dependent record type.
          // Now it will be attached as <existanceIndicators> to its
          // possible predecessors.
          String occurrences = ((Element) recordTypes.item(i))
              .getAttribute("Occurrences");
          // Cardinality of the record type.
          boolean isOptional = CardinalityStrings
              .isCardinalityInterval(occurrences, true)
              && CardinalityStrings.getCardinalityLow(
                  occurrences, true) == 0;
          for (int j = i - 1; j > -1 && isOptional; j++)
          { // Backwards loop to the beginning of the record types
            // starting at the predecessor of the examined record
            // type.
            // As long as a record type is optional, its predecessor
            // is
            // added to the list of possible predecessors for the
            // originally
            // checked record type.
            // Stops at the first record type because this one may
            // not be optional.

            // Now information attached to the predecessor.
            if (existanceIndicators[j] == null)
            { // The predecessor does not yet have identified
              // successor
              // which depend on an existnace indicator.
              existanceIndicators[j] = new TreeMap();
              existanceIndicators[j].put(
                  dependenceOnPredecessor[0],
                  dependenceOnPredecessor[1]);
            } // then (existanceIndicators[j]==null)
            else
            { // The predecessor already has information about
              // successors.
              // Existance indicator value for the existance
              // indicator
              // field stated in the examined record type, but
              // used for
              // another record type !?
              String value = (String) existanceIndicators[j]
                  .get(dependenceOnPredecessor[0]);
              if (value != null)
                // Existance indicator values in the same field
                // for different record types.
                if (value.length() != dependenceOnPredecessor[1]
                    .length())
                {
                  throw new XException(
                      Constants.LOCATION_INTERN,
                      Constants.LAYER_PROTOCOL,
                      Constants.PACKAGE_PROTOCOL_RECORDS,
                      "16");
                }
                else
                  // No other use of the existance indicator
                  // field yet.
                  // Store the new value.
                  existanceIndicators[j].put(
                      dependenceOnPredecessor[0],
                      dependenceOnPredecessor[1]);
            } // else (existanceIndicators[j]==null)
            occurrences = ((Element) recordTypes.item(j))
                .getAttribute("Occurrences");
            // Cardinality of the last checked record type
            isOptional = CardinalityStrings.isCardinalityInterval(
                occurrences, true)
                && CardinalityStrings.getCardinalityLow(
                    occurrences, true) == 0;
          } // for (int j=i-1; j>-1 && isOptional; j++)
        } // if (existanceIndicators!=null &&
        // dependenceOnPredecessor!=null)
      } // for (int i=0; i<recordTypes.getLength(); i++)

      recordTypesBefore += recordTypesCount;
      // Correct the number of checked record types in the so far
      // examined record groups

      if (recordGroup.getNodeName().equals("RecordGroup"))
      { // record groups really present
        recordGroup = recordGroup.getNextSibling();
        // Choose next record group
        if (recordGroup != null)
        { // there is a next record group
          recordTypes = recordGroup.getChildNodes();
          recordTypesCount = recordTypes.getLength();
          // Next check the record types in the new group
        } // if (recordGroup != null)
      } // if (recordGroup.getNodeName().equals("RecordGroup"))
      else
        // no real record group loop but record declarations directly
        // in lines section, terminate loop by setting ...
        recordGroup = null;
    } // while (recordGroup!=null) - record group loop

    // Check record type names for uniqueness.
    for (int i = 0; i < recordTypeNames.length; i++)
      for (int j = i + 1; j < recordTypeNames.length; j++)
        if (recordTypeNames[i].equals(recordTypeNames[j]))
        {
          throw new XException(Constants.LOCATION_INTERN,
              Constants.LAYER_PROTOCOL,
              Constants.PACKAGE_PROTOCOL_RECORDS, "17");
        }
    // Checks on the type identifier
    // First check their length
    // If the record type identification is not done by type identifiers,
    // the two type id lists are empty.
    int identifierLength = 0;
    if (typeIds.size() > 0)
      // Some single value id's
      identifierLength = ((String) typeIds.get(0)).length();
    else if (typeIdIntervals.size() > 0)
      // No single value id but some id intervals
      identifierLength = ((String[]) typeIdIntervals.get(0))[0].length();
    // All id's must have the same length.
    // First the single value id's
    for (int i = 1; i < typeIds.size(); i++)
      if (((String) typeIds.get(0)).length() != identifierLength)
      {
        throw new XException(Constants.LOCATION_INTERN,
            Constants.LAYER_PROTOCOL,
            Constants.PACKAGE_PROTOCOL_RECORDS, "18");
      }
    // Second the id intervals
    for (int i = 1; i < typeIdIntervals.size(); i++)
      // Attention: two values!
      if (((String[]) typeIdIntervals.get(0))[0].length() != identifierLength
          || ((String[]) typeIdIntervals.get(0))[1].length() != identifierLength)
      {
        throw new XException(Constants.LOCATION_INTERN,
            Constants.LAYER_PROTOCOL,
            Constants.PACKAGE_PROTOCOL_RECORDS, "18");
      }
View Full Code Here

TOP

Related Classes of java.util.LinkedList$Cell

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.