Ejemplo n.º 1
0
  public Datatype getItem(int position) {

    synchronized (m_synchronizer) {
      if (isInRange(0, m_size - 1, position)) {

        int direction = position - m_currentIndex;

        if (direction != 0) {
          direction = direction / Math.abs(direction);

          do {

            m_currentIndex += direction;

            if (direction > 0) {
              m_current = m_current.getNext();
            } else {
              m_current = m_current.getPrevious();
            }

          } while (m_currentIndex != position);
        }

        return m_current;
      }
    }

    return null;
  }
Ejemplo n.º 2
0
 public void attribute(NameSpec nameSpec, Datatype datatype, AttributeDefault attributeDefault)
     throws Exception {
   w.startElement("attribute");
   nameSpec.accept(this);
   datatype.accept(this);
   attributeDefault.accept(this);
   w.endElement();
 }
Ejemplo n.º 3
0
 @Override
 public State clone() {
   try {
     super.clone();
   } catch (CloneNotSupportedException e) {
     Log.error(THIS_CLASS, e);
   }
   return new State().set(this);
 }
Ejemplo n.º 4
0
  /*!*/
  public void end() {

    synchronized (m_synchronizer) {
      checkNull(m_template);

      Datatype tmpl = m_template.clone();
      checkNull(tmpl);

      m_size++;
      m_template.setPrevious(tmpl);

      if (m_previous == null) {
        m_current = tmpl;
        m_currentIndex = 0;
      } else {
        m_previous.setNext(tmpl);
      }

      m_previous = tmpl;
    }
  }
Ejemplo n.º 5
0
  public void call() throws MPJException {
    int rank = this.comm.rank();
    int size = this.comm.size();

    if (root < 0 || root >= size) {
      throw new MPJException("root rank " + root + " is invalid.");
    }

    if (rank == root) {
      this.comm.localcopy2types(
          sendbuf,
          sendoffset,
          sendcount,
          sendtype,
          recvbuf,
          recvoffset + (rank * this.recvcount * recvtype.extent()),
          recvcount,
          recvtype);

      // this.comm.send(this.sendbuf, this.sendoffset, this.sendcount,
      // this.sendtype, root, this.tag);

      // Object recv = null;
      // int position = 0;
      for (int i = 0; i < size; i++) {

        if (i != rank)
          this.comm.recv(
              recvbuf,
              this.recvoffset + (i * this.recvcount * recvtype.extent()),
              this.recvcount,
              this.recvtype,
              i,
              this.tag);
      }

    } else {
      this.comm.send(this.sendbuf, this.sendoffset, this.sendcount, this.sendtype, root, this.tag);
    }
  }
Ejemplo n.º 6
0
 private void appendColumn(BaseColumn column, boolean includeName, boolean includeType) {
   if (includeName) {
     append(SQLStringVisitor.escapeSinglePart(column.getName()));
   }
   if (includeType) {
     Datatype datatype = column.getDatatype();
     String runtimeTypeName = column.getRuntimeType();
     if (datatype != null) {
       runtimeTypeName = datatype.getRuntimeTypeName();
     }
     if (includeName) {
       append(SPACE);
     }
     append(runtimeTypeName);
     if (LENGTH_DATATYPES.contains(runtimeTypeName)) {
       if (column.getLength() != 0
           && (datatype == null || column.getLength() != datatype.getLength())) {
         append(LPAREN).append(column.getLength()).append(RPAREN);
       }
     } else if (PRECISION_DATATYPES.contains(runtimeTypeName)
         && !column.isDefaultPrecisionScale()) {
       append(LPAREN).append(column.getPrecision());
       if (column.getScale() != 0) {
         append(COMMA).append(column.getScale());
       }
       append(RPAREN);
     }
     if (datatype != null) {
       for (int dims = column.getArrayDimensions(); dims > 0; dims--) {
         append(Tokens.LSBRACE).append(Tokens.RSBRACE);
       }
     }
     if (column.getNullType() == NullType.No_Nulls) {
       append(SPACE).append(NOT_NULL);
     }
   }
 }
 @Override
 public boolean isCompatibleTo(Datatype type) {
   return type.isCompatibleToInteger();
 }
 public void checkValid() throws DatatypeException {
   baseType.checkValid(buffer.toString(), context);
 }
 public boolean isValid() {
   return baseType.isValid(buffer.toString(), context);
 }
Ejemplo n.º 10
0
 public void datatypeDef(String name, Datatype datatype) throws Exception {
   w.startElement("datatype");
   w.attribute("name", name);
   datatype.accept(this);
   w.endElement();
 }
Ejemplo n.º 11
0
 public void addDatatype(Datatype datatype) {
   if (!this.datatypes.containsKey(datatype.getName())) {
     this.datatypes.put(datatype.getName(), datatype);
   }
 }