php.runtime.Memory.isNotNull()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(10.8k)|赞(0)|评价(0)|浏览(115)

本文整理了Java中php.runtime.Memory.isNotNull()方法的一些代码示例,展示了Memory.isNotNull()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Memory.isNotNull()方法的具体详情如下:
包路径:php.runtime.Memory
类名称:Memory
方法名:isNotNull

Memory.isNotNull介绍

暂无

代码示例

代码示例来源:origin: jphp-group/jphp

public Memory applyTypeHinting(Environment env, Memory value, boolean strict) {
  if (typeChecker != null) {
    return typeChecker.apply(
        env, value, nullable || (defaultValue != null && defaultValue.isNotNull()), strict
    );
  }
  return null;
}

代码示例来源:origin: jphp-group/jphp

@Signature({
    @Arg(value = "value", optional = @Optional("null"))
})
public static Memory uuid(Environment env, Memory... args) {
  Memory value = args[0];
  String s;
  if (value.isNotNull()) {
    s = UUID.fromString(value.toString()).toString();
  } else {
    s = UUID.randomUUID().toString();
  }
  return StringMemory.valueOf(s);
}

代码示例来源:origin: jphp-group/jphp

@Signature
public static void setErr(Environment env, @Arg(typeClass = "php\\io\\Stream", nullable = true) Memory stream, Memory encoding)
    throws UnsupportedEncodingException {
  if (stream.isNull()) {
    System.setErr(null);
  } else {
    if (encoding.isNotNull()) {
      System.setErr(new PrintStream(Stream.getOutputStream(env, stream), true, encoding.toString()));
    } else {
      System.setErr(new PrintStream(Stream.getOutputStream(env, stream), true));
    }
  }
}

代码示例来源:origin: jphp-group/jphp

@Signature
public static void setOut(Environment env, @Arg(typeClass = "php\\io\\Stream", nullable = true) Memory stream, Memory encoding)
    throws UnsupportedEncodingException {
  if (stream.isNull()) {
    System.setOut(null);
  } else {
    if (encoding.isNotNull()) {
      System.setOut(new PrintStream(Stream.getOutputStream(env, stream), true, encoding.toString()));
    } else {
      System.setOut(new PrintStream(Stream.getOutputStream(env, stream), true));
    }
  }
}

代码示例来源:origin: jphp-group/jphp

@Signature
public void reset(File file, Memory fileName, Memory contentType) {
  this.file = file;
  this.fileName = fileName.isNull() ? file.getName() : fileName.toString();
  this.contentType = contentType.isNotNull() ? "application/octet-stream" : contentType.toString();
}

代码示例来源:origin: jphp-group/jphp

public static Memory fgets(Environment env, TraceInfo trace, Memory stream, Memory length) {
  if (stream.instanceOf(Stream.CLASS_NAME)) {
    InputStream in = Stream.getInputStream(env, stream);
    if (in != null) {
      int read;
      StringBuilder sb = new StringBuilder();
      try {
        while ((read = in.read()) != -1) {
          if (length.isNotNull() && sb.length() >= length.toInteger()) {
            break;
          }
          if (read == '\n' || read == '\r') {
            break;
          }
          sb.append((char) read);
        }
        return StringMemory.valueOf(sb.toString());
      } catch (IOException e) {
        env.warning(trace, "fgets(): " + e.getMessage());
        return Memory.FALSE;
      }
    }
  }
  env.warning(trace, "fgets(): unable to get from a non-stream");
  return Memory.FALSE;
}

代码示例来源:origin: jphp-group/jphp

@Signature
public PMarkdownOptions addSuperscriptExtension(@Arg(type = HintType.ARRAY) @Optional("null") Memory options) {
  parserExtensions.add(SuperscriptExtension.create());
  Memory htmlOpen = options.valueOfIndex("htmlOpen");
  if (htmlOpen.isNotNull()) {
    this.options.set(SuperscriptExtension.SUPERSCRIPT_STYLE_HTML_OPEN, htmlOpen.toString());
  }
  Memory htmlClose = options.valueOfIndex("htmlClose");
  if (htmlOpen.isNotNull()) {
    this.options.set(SuperscriptExtension.SUPERSCRIPT_STYLE_HTML_CLOSE, htmlClose.toString());
  }
  return this;
}

代码示例来源:origin: jphp-group/jphp

@Signature
public PMarkdownOptions addSubscriptExtension(@Arg(type = HintType.ARRAY) @Optional("null") Memory options) {
  parserExtensions.add(SubscriptExtension.create());
  Memory htmlOpen = options.valueOfIndex("htmlOpen");
  if (htmlOpen.isNotNull()) {
    this.options.set(SubscriptExtension.SUBSCRIPT_STYLE_HTML_OPEN, htmlOpen.toString());
  }
  Memory htmlClose = options.valueOfIndex("htmlClose");
  if (htmlOpen.isNotNull()) {
    this.options.set(SubscriptExtension.SUBSCRIPT_STYLE_HTML_CLOSE, htmlClose.toString());
  }
  return this;
}

代码示例来源:origin: jphp-group/jphp

@Override
  @Signature({@Arg(value = "content", optional = @Optional("null")), @Arg(value = "mode", optional = @Optional("r"))})
  public Memory __construct(Environment env, Memory... args) throws IOException {
    super.__construct(env, new StringMemory("memory"), args[1]);

    if (args[0].isNotNull()) {
      write(env, args[0], Memory.NULL);
      seek(env, Memory.CONST_INT_0);
    }

    return Memory.NULL;
  }
}

代码示例来源:origin: jphp-group/jphp

@Override
  public boolean call(File pathname, int depth) {
    if (progress != null) {
      Memory ret = progress.callAny(pathname, depth);
      if (ret.isNotNull() && ret.toValue() != Memory.FALSE) {
        result.add(ret.toImmutable());
      }
    } else {
      result.add(new FileObject(env, pathname));
    }
    return true;
  }
}, maxDepth);

代码示例来源:origin: jphp-group/jphp

@Signature
public Memory branchList(ArrayMemory settings) throws GitAPIException {
  ListBranchCommand command = getWrappedObject().branchList();
  if (settings != null) {
    Memory listMode = settings.valueOfIndex("listMode");
    if (listMode.isNotNull()) {
      command.setListMode(ListBranchCommand.ListMode.valueOf(listMode.toString()));
    }
    Memory contains = settings.valueOfIndex("contains");
    if (contains.isNotNull()) {
      command.setContains(contains.toString());
    }
  }
  return GitUtils.valueOfRefs(command.call());
}

代码示例来源:origin: jphp-group/jphp

@Signature
public Memory reflog(Memory ref) throws GitAPIException {
  ReflogCommand command = getWrappedObject().reflog();
  if (ref.isNotNull()) {
    command.setRef(ref.toString());
  }
  Collection<ReflogEntry> call = command.call();
  return GitUtils.valueOfReflogEntries(call);
}

代码示例来源:origin: jphp-group/jphp

@Signature
public Memory stashCreate(ArrayMemory settings) throws GitAPIException {
  StashCreateCommand command = getWrappedObject().stashCreate();
  if (settings != null) {
    command.setIncludeUntracked(settings.valueOfIndex("includeUntracked").toBoolean());
    Memory indexMessage = settings.valueOfIndex("indexMessage");
    if (indexMessage.isNotNull()) {
      command.setIndexMessage(indexMessage.toString());
    }
    Memory ref = settings.valueOfIndex("ref");
    if (ref.isNotNull()) {
      command.setRef(ref.toString());
    }
    Memory workingDirectoryMessage = settings.valueOfIndex("workingDirectoryMessage");
    if (workingDirectoryMessage.isNotNull()) {
      command.setWorkingDirectoryMessage(workingDirectoryMessage.toString());
    }
  }
  return GitUtils.valueOf(command.call());
}

代码示例来源:origin: jphp-group/jphp

@Signature
public Memory branchRename(String newName, Memory oldName) throws GitAPIException {
  RenameBranchCommand command = getWrappedObject().branchRename();
  command.setNewName(newName);
  if (oldName.isNotNull()) {
    command.setOldName(oldName.toString());
  }
  return GitUtils.valueOf(command.call());
}

代码示例来源:origin: jphp-group/jphp

@Signature
public Memory diff(ArrayMemory settings) throws GitAPIException {
  DiffCommand command = getWrappedObject().diff();
  if (settings != null) {
    command.setCached(settings.valueOfIndex("cached").toBoolean());
    Memory contextLines = settings.valueOfIndex("contextLines");
    if (contextLines.isNotNull()) {
      command.setContextLines(contextLines.toInteger());
    }
    Memory destPrefix = settings.valueOfIndex("destPrefix");
    if (destPrefix.isNotNull()) {
      command.setDestinationPrefix(destPrefix.toString());
    }
    Memory sourcePrefix = settings.valueOfIndex("sourcePrefix");
    if (sourcePrefix.isNotNull()) {
      command.setSourcePrefix(sourcePrefix.toString());
    }
    command.setShowNameAndStatusOnly(settings.valueOfIndex("showNameAndStatusOnly").toBoolean());
    Memory pathFilter = settings.valueOfIndex("pathFilter");
    if (pathFilter.isNotNull()) {
      command.setPathFilter(PathFilter.create(pathFilter.toString()));
    }
  }
  List<DiffEntry> call = command.call();
  return GitUtils.valueOfDiffEntries(call);
}

代码示例来源:origin: jphp-group/jphp

@Signature
public Memory branchCreate(String name, ArrayMemory settings) throws GitAPIException {
  CreateBranchCommand command = getWrappedObject().branchCreate();
  command.setName(name);
  if (settings != null && settings.isNotNull()) {
    Memory startPoint = settings.valueOfIndex("startPoint");
    if (startPoint.isNotNull()) {
      command.setStartPoint(startPoint.toString());
    }
    command.setForce(settings.valueOfIndex("force").toBoolean());
    Memory upstreamMode = settings.valueOfIndex("upstreamMode");
    if (upstreamMode.isNotNull()) {
      command.setUpstreamMode(CreateBranchCommand.SetupUpstreamMode.valueOf(upstreamMode.toString()));
    }
  }
  return GitUtils.valueOf(command.call());
}

代码示例来源:origin: jphp-group/jphp

@Signature
public Memory stashDrop(ArrayMemory settings) throws GitAPIException {
  StashDropCommand command = getWrappedObject().stashDrop();
  if (settings != null) {
    command.setAll(settings.valueOfIndex("all").toBoolean());
    Memory stashRef = settings.valueOfIndex("stashRef");
    if (stashRef.isNotNull()) {
      command.setStashRef(stashRef.toInteger());
    }
  }
  return GitUtils.valueOf(command.call());
}

代码示例来源:origin: jphp-group/jphp

@Signature
public Memory reset(Environment env, ArrayMemory settings) throws GitAPIException {
  ResetCommand reset = getWrappedObject().reset();
  Memory mode = settings.valueOfIndex("mode");
  if (mode.isNotNull()) {
    reset.setMode(ResetCommand.ResetType.valueOf(mode.toString()));
  }
  Memory ref = settings.valueOfIndex("ref");
  if (ref.isNotNull()) {
    reset.setRef(ref.toString());
  }
  reset.disableRefLog(settings.valueOfIndex("disableRefLog").toBoolean());
  Memory paths = settings.valueOfIndex("paths");
  if (paths.isNotNull()) {
    ForeachIterator iterator = paths.getNewIterator(env);
    if (iterator != null) {
      while (iterator.next()) {
        reset.addPath(iterator.getValue().toString());
      }
    } else {
      reset.addPath(paths.toString());
    }
  }
  Ref call = reset.call();
  return GitUtils.valueOf(call);
}

代码示例来源:origin: jphp-group/jphp

@Signature
public Memory stashApply(ArrayMemory settings) throws GitAPIException {
  StashApplyCommand command = getWrappedObject().stashApply();
  if (settings != null) {
    command.setApplyIndex(settings.valueOfIndex("applyIndex").toBoolean());
    command.setApplyUntracked(settings.valueOfIndex("applyUntracked").toBoolean());
    Memory stashRef = settings.valueOfIndex("stashRef");
    if (stashRef.isNotNull()) {
      command.setStashRef(stashRef.toString());
    }
    Memory strategy = settings.valueOfIndex("strategy");
    if (strategy.isNotNull()) {
      command.setStrategy(MergeStrategy.get(strategy.toString()));
    }
  }
  return GitUtils.valueOf(command.call());
}

代码示例来源:origin: jphp-group/jphp

@Signature
public Memory merge(String[] refs, ArrayMemory settings) throws IOException, GitAPIException {
  MergeCommand command = getWrappedObject().merge();
  for (String ref : refs) {
    Repository repository = getWrappedObject().getRepository();
    ObjectId objectId = repository.resolve(ref);
    command.include(objectId);
  }
  if (settings != null) {
    command.setCommit(settings.valueOfIndex("commit").toBoolean());
    command.setMessage(settings.valueOfIndex("message").toString());
    command.setSquash(settings.valueOfIndex("squash").toBoolean());
    Memory fastForward = settings.valueOfIndex("fastForward");
    
    if (fastForward.isNumber()) {
      command.setFastForward(MergeCommand.FastForwardMode.valueOf(fastForward.toString()));
    }
    Memory strategy = settings.valueOfIndex("strategy");
    if (strategy.isNotNull()) {
      command.setStrategy(MergeStrategy.get(strategy.toString()));
    }
  }
  MergeResult call = command.call();
  return GitUtils.valueOf(call);
}

相关文章