Package erjang

Examples of erjang.EObject


    if ((status & EDriverTask.ERTS_PORT_SFLG_LINEBUF_IO) != 0) {
      throw new NotImplemented();
    }
   

    EObject out;
   
    if (buf == null || !buf.hasRemaining()) {
      out = ERT.NIL;
    } else if (task.send_binary_data) {
      out = EBinary.make(buf);
View Full Code Here


   * @param fileRespOkHeader
   * @param binp
   * @throws Pausable
   */
  protected void driver_output_binary(byte[] header, ByteBuffer binp) throws Pausable {
    EObject out = EBinary.make(binp);
    if (header.length > 0) {
      out = new EBinList(header, out);
    }

    task.output_from_driver(out);
View Full Code Here

  @Override
  protected void insert_one(final ETuple value) {
    in_tx(new WithMap<Object>() {
      @Override
      protected Object run(IPersistentMap map) {
        EObject key = get_key(value);
        IPersistentMap new_map = map.assoc(key, value);
        set(new_map);
        return null;
      }
    });
View Full Code Here

  @Override
  protected ESeq lookup(EObject key) {
    ESeq res = ERT.NIL;
   
    // no need to run in_tx if we're only reading
    EObject val = (EObject) deref().valAt(key);
    if (val != null) {
      return res.cons(val);
    } else {
      return res;
    }
View Full Code Here

  }
 
  @Override
  protected EAtom member(EObject key) {
    // no need to run in_tx if we're only reading
    EObject val = (EObject) deref().valAt(key);
    if (val != null) {
      return ERT.TRUE;
    } else {
      return ERT.FALSE;
    }
View Full Code Here

  protected boolean insert_new_many(final ESeq values) {
    // Input verification outside of transaction:
    for (ESeq seq = values; !seq.isNil(); seq = seq.tail()) {
      ETuple value = seq.head().testTuple();
      if (value == null) throw ERT.badarg(values);
      EObject key = get_key(value);
    }

    return in_tx(new WithMap<Boolean>() {
      @Override
      protected Boolean run(IPersistentMap map) {
        for (ESeq seq = values; !seq.isNil(); seq = seq.tail()) {
          ETuple value = seq.head().testTuple();
          EObject key = get_key(value);
          if (map.containsKey(key)) {
            return false;
          }
        }
 
        for (ESeq seq = values; !seq.isNil(); seq = seq.tail()) {
          ETuple value = seq.head().testTuple();
          EObject key = get_key(value);
          map = map.assoc(key, value);
        }
 
        set(map);
        return true;
View Full Code Here

  });
}

  @Override
  protected boolean insert_new_one(final ETuple value) {
    final EObject key = get_key(value);
    if (!deref().containsKey(key)) {
      return in_tx(new WithMap<Boolean>() {
        @Override
        protected Boolean run(IPersistentMap map) {
          if (!map.containsKey(key)) {
View Full Code Here

  @Override
  public ESeq match(EPattern matcher) {   
    IPersistentMap map = deref();
    ESeq res = ERT.NIL;
   
    EObject key = matcher.getKey(keypos1);
    if (key == null) {
      res = matcher.match(res, (Map<EObject, ETuple>) map);
      if (ordered) res = res.reverse();
    } else {
      ETuple candidate = (ETuple) map.valAt(key);
View Full Code Here

  @Override
  public ESeq match_object(EPattern matcher) {   
    IPersistentMap map = deref();
    ESeq res = ERT.NIL;
   
    EObject key = matcher.getKey(keypos1);
    if (key == null) {
      res = matcher.match_members(res, (Map<EObject, ETuple>) map);
      if (ordered) res = res.reverse();
    } else {
      ETuple candidate = (ETuple) map.valAt(key);
View Full Code Here

    in_tx(new WithMap<Object>() {

      @Override
      protected Object run(IPersistentMap map) {
     
        EObject key = get_key(obj);
       
        IMapEntry candidateEntry = map.entryAt(key);
        if (candidateEntry == null) return null;
        EObject candidate = (EObject)candidateEntry.val();
        if (candidate != null && obj.equalsExactly(candidate)) {
          try {
            map = map.without(key);
            set(map);
          } catch (Exception e) {
View Full Code Here

TOP

Related Classes of erjang.EObject

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.