Prompt:
/**
 *
Converts the character to a Character.

For ASCII 7 bit characters, this uses a cache that will return the same Character object each time.

 CharUtils.toCharacterObject(' ')  = ' ' CharUtils.toCharacterObject('A')  = 'A'

 * @param ch  the character to convert
 * @return a Character of the specified character
 */
public static Character toCharacterObject(final char ch){

public static Character toCharacterObject(final char ch){
  if (ch < CharUtils.CHAR_ARRAY.length) {
    return CharUtils.CHAR_ARRAY[ch];
  }
  return new Character(ch);
}


Prompt:
/**
 *
Checks whether the character is ASCII 7 bit alphabetic upper case.

 CharUtils.isAsciiAlphaUpper('a')  = false CharUtils.isAsciiAlphaUpper('A')  = true CharUtils.isAsciiAlphaUpper('3')  = false CharUtils.isAsciiAlphaUpper('-')  = false CharUtils.isAsciiAlphaUpper('\n') = false CharUtils.isAsciiAlphaUpper('©') = false

 * @param ch  the character to check
 * @return true if between 65 and 90 inclusive
 */
public static boolean isAsciiAlphaUpper(final char ch){

public static boolean isAsciiAlphaUpper(final char ch){
  return ch >= 'A' && ch <= 'Z';
}


Prompt:
/**
 * Returns  {@link Filter#NEUTRAL} is there is no string match.
 */
public int decide(LoggingEvent event){

public int decide(LoggingEvent event){
  String msg=event.getRenderedMessage();
  if (msg == null || stringToMatch == null)   return Filter.NEUTRAL;
  if (msg.indexOf(stringToMatch) == -1) {
    return Filter.NEUTRAL;
  }
 else {
    if (acceptOnMatch) {
      return Filter.ACCEPT;
    }
 else {
      return Filter.DENY;
    }
  }
}


Prompt:
/**
 * Ascertain if a template variable is a member of this template.
 * @param name name The template variable.
 * @return true if the template variable is a member of the template, otherwisefalse.
 */
public final boolean isTemplateVariablePresent(String name){

public final boolean isTemplateVariablePresent(String name){
  for (  String s : templateVariables) {
    if (s.equals(name))     return true;
  }
  return false;
}


Prompt:
/**
 * Puts all of the writable properties from the given BeanMap into this BeanMap. Read-only and Write-only properties will be ignored.
 * @param map  the BeanMap whose properties to put
 */
public void putAllWriteable(BeanMap map){

public void putAllWriteable(BeanMap map){
  Iterator<String> readableKeys=map.readMethods.keySet().iterator();
  while (readableKeys.hasNext()) {
    String key=readableKeys.next();
    if (getWriteMethod(key) != null) {
      this.put(key,map.get(key));
    }
  }
}


Prompt:
/**
 * Gets a String's length or 0 if the String is null.
 * @param str a String or null
 * @return String length or 0 if the String is null.
 * @since 2.4
 */
public static int length(final String str){

public static int length(final String str){
  return str == null ? 0 : str.length();
}


Prompt:
/**
 * Is this a hex digit?
 */
private static boolean isHex(final char c){

private static boolean isHex(final char c){
  return ('0' <= c && c <= '9') || ('a' <= c && c <= 'f') || ('A' <= c && c <= 'F');
}


Prompt:
/**
 * Decoding a string to a string follow the Base64 regular.
 */
public static String base64Decode(final String s){

public static String base64Decode(final String s){
  byte[] b=Base64.base64DecodeToArray(s);
  if (b == null) {
    return null;
  }
  if (b.length == 0) {
    return "";
  }
  return new String(b,StandardCharsets.UTF_8);
}


Prompt:
/**
 *
Checks whether two arrays are the same length, treating null arrays as length 0.

 * @param array1 the first array, may be null
 * @param array2 the second array, may be null
 * @return true if length of arrays matches, treatingnull as an empty array
 */
public static boolean isSameLength(final double[] array1,final double[] array2){

public static boolean isSameLength(final double[] array1,final double[] array2){
  if (array1 == null && array2 != null && array2.length > 0 || array2 == null && array1 != null && array1.length > 0 || array1 != null && array2 != null && array1.length != array2.length) {
    return false;
  }
  return true;
}


Prompt:
/**
 * Retrieve an instance of  {@link Meteor} based on the {@link HttpServletRequest}.
 * @param r {@link HttpServletRequest}
 * @return a {@link Meteor} or null if not found
 */
public static Meteor lookup(HttpServletRequest r){

public static Meteor lookup(HttpServletRequest r){
  Object o=r.getAttribute(METEOR);
  return o == null ? null : Meteor.class.isAssignableFrom(o.getClass()) ? (Meteor)o : null;
}


Prompt:
/**
 * Split a String at the first occurrence of the delimiter. Does not include the delimiter in the result.
 * @param toSplit the string to split
 * @param delimiter to split the string up with
 * @return a two element array with index 0 being before the delimiter, andindex 1 being after the delimiter (neither element includes the delimiter); or null if the delimiter wasn't found in the given input String
 */
public static String[] split(String toSplit,String delimiter){

public static String[] split(String toSplit,String delimiter){
  if (!hasLength(toSplit) || !hasLength(delimiter)) {
    return null;
  }
  int offset=toSplit.indexOf(delimiter);
  if (offset < 0) {
    return null;
  }
  String beforeDelimiter=toSplit.substring(0,offset);
  String afterDelimiter=toSplit.substring(offset + delimiter.length());
  return new String[]{beforeDelimiter,afterDelimiter};
}


Prompt:
/**
 * Computes the global separator list of the  {@code graph}. More precisely, for every edge $e$ in the $G = (V, E)$ computes list of minimal separators $S_e$ in the neighborhood of $e$ and then concatenates these lists. Note: the result may contain duplicates
 * @return the list of minimal separators of every edge $e$ in the inspected graph
 */
private List<Pair<List<Pair<Integer,Integer>>,E>> computeGlobalSeparatorList(){

private List<Pair<List<Pair<Integer,Integer>>,E>> computeGlobalSeparatorList(){
  List<Pair<List<Pair<Integer,Integer>>,E>> globalSeparatorList=new ArrayList<>();
  for (  E edge : graph.edgeSet()) {
    V source=graph.getEdgeSource(edge);
    V target=graph.getEdgeTarget(edge);
    if (source != target) {
      List<Set<V>> edgeSeparators=findSeparators(graph,edge);
      globalSeparatorList.addAll(reformatSeparatorList(edgeSeparators,edge));
    }
  }
  return globalSeparatorList;
}


Prompt:
/**
 *
Clones an array returning a typecast result and handling null.

This method returns null for a null input array.

 * @param array  the array to clone, may be null
 * @return the cloned array, null if null input
 */
public static char[] clone(final char[] array){

public static char[] clone(final char[] array){
  if (array == null) {
    return null;
  }
  return array.clone();
}


Prompt:
/**
 * Add the specified files in reverse order.
 */
private void addReverse(final File[] files){

private void addReverse(final File[] files){
  if (files == null)   return;
  for (int i=files.length - 1; i >= 0; --i) {
    stack.add(files[i]);
  }
}


Prompt:
/**
 * Selects a the specified row in the specified JTable and scrolls the specified JScrollpane to the newly selected row. More importantly, the call to repaint() delayed long enough to have the table properly paint the newly selected row which may be offscre
 * @param table should belong to the specified JScrollPane
 */
public static void selectRow(int row,JTable table,JScrollPane pane){

public static void selectRow(int row,JTable table,JScrollPane pane){
  if (table == null || pane == null) {
    return;
  }
  if (contains(row,table.getModel()) == false) {
    return;
  }
  moveAdjustable(row * table.getRowHeight(),pane.getVerticalScrollBar());
  selectRow(row,table.getSelectionModel());
  repaintLater(table);
}


Prompt:
/**
 * Puts an int into this byte vector. The byte vector is automatically enlarged if necessary.
 * @param intValue an int.
 * @return this byte vector.
 */
public ByteVector putInt(final int intValue){

public ByteVector putInt(final int intValue){
  int currentLength=length;
  if (currentLength + 4 > data.length) {
    enlarge(4);
  }
  byte[] currentData=data;
  currentData[currentLength++]=(byte)(intValue >>> 24);
  currentData[currentLength++]=(byte)(intValue >>> 16);
  currentData[currentLength++]=(byte)(intValue >>> 8);
  currentData[currentLength++]=(byte)intValue;
  length=currentLength;
  return this;
}


Prompt:
/**
 * Compares count first bytes in the arrays a and b.
 * @param a     The first array to compare.
 * @param b     The second array to compare.
 * @param count How many bytes should be compared.
 * @return true if count first bytes in arraysa and b are equal.
 */
public static boolean arrayequals(byte[] a,byte[] b,int count){

public static boolean arrayequals(byte[] a,byte[] b,int count){
  for (int i=0; i < count; i++) {
    if (a[i] != b[i]) {
      return false;
    }
  }
  return true;
}


Prompt:
/**
 * Abbreviate name.
 * @param buf buffer to append abbreviation.
 * @param nameStart start of name to abbreviate.
 */
public void abbreviate(final int nameStart,final StringBuffer buf){

public void abbreviate(final int nameStart,final StringBuffer buf){
  int i=count;
  for (int pos=buf.indexOf(".",nameStart); pos != -1; pos=buf.indexOf(".",pos + 1)) {
    if (--i == 0) {
      buf.delete(nameStart,pos + 1);
      break;
    }
  }
}


Prompt:
/**
 * Resolves the first bound for the  {@code typeVariable}, returning  {@code Unknown.class} if nonecan be resolved.
 */
public static Type resolveBound(TypeVariable<?> typeVariable){

public static Type resolveBound(TypeVariable<?> typeVariable){
  Type[] bounds=typeVariable.getBounds();
  if (bounds.length == 0)   return Unknown.class;
  Type bound=bounds[0];
  if (bound instanceof TypeVariable)   bound=resolveBound((TypeVariable<?>)bound);
  return bound == Object.class ? Unknown.class : bound;
}


Prompt:
/**
 * Check whether the subgraph of graph induced by the given vertices is complete, i.e. a clique.
 * @param graph the graph.
 * @param vertices the vertices to induce the subgraph from.
 * @return true if the induced subgraph is a clique.
 */
private static <V,E>boolean isClique(Graph<V,E> graph,Set<V> vertices){

private static <V,E>boolean isClique(Graph<V,E> graph,Set<V> vertices){
  for (  V v1 : vertices) {
    for (    V v2 : vertices) {
      if (!v1.equals(v2) && (graph.getEdge(v1,v2) == null)) {
        return false;
      }
    }
  }
  return true;
}


Prompt:
/**
 * Finds a maximum lower bound for every key.
 * @param keys list of keys.
 * @return the computed key lower bounds.
 */
private List<Integer> computeLowerBounds(List<K> keys){

private List<Integer> computeLowerBounds(List<K> keys){
  List<Integer> keyLowerBounds=new ArrayList<>(keys.size());
  for (  K key : keys) {
    int lowerBound=0;
    for (    Function<K,Integer> lowerBoundFunction : lowerBounds) {
      lowerBound=Math.max(lowerBound,lowerBoundFunction.apply(key));
    }
    keyLowerBounds.add(lowerBound);
  }
  return keyLowerBounds;
}


Prompt:
/**
 * Pops as many abstract types from the output frame stack as described by the given descriptor.
 * @param descriptor a type or method descriptor (in which case its argument types are popped).
 */
private void pop(final String descriptor){

private void pop(final String descriptor){
  char firstDescriptorChar=descriptor.charAt(0);
  if (firstDescriptorChar == '(') {
    pop((Type.getArgumentsAndReturnSizes(descriptor) >> 2) - 1);
  }
 else   if (firstDescriptorChar == 'J' || firstDescriptorChar == 'D') {
    pop(2);
  }
 else {
    pop(1);
  }
}


Prompt:
/**
 *
Checks whether the character is ASCII 7 bit.

 CharUtils.isAscii('a')  = true CharUtils.isAscii('A')  = true CharUtils.isAscii('3')  = true CharUtils.isAscii('-')  = true CharUtils.isAscii('\n') = true CharUtils.isAscii('©') = false

 * @param ch  the character to check
 * @return true if less than 128
 */
public static boolean isAscii(final char ch){

public static boolean isAscii(final char ch){
  return ch < 128;
}


Prompt:
/**
 * Finds a minimum lower bound for every key.
 * @param keys a list of keys.
 * @return the computed key upper bound.
 */
private List<Integer> computeUpperBounds(List<K> keys){

private List<Integer> computeUpperBounds(List<K> keys){
  List<Integer> keyUpperBounds=new ArrayList<>(keys.size());
  for (  K key : keys) {
    int upperBound=Integer.MAX_VALUE;
    for (    Function<K,Integer> upperBoundFunction : upperBounds) {
      upperBound=Math.min(upperBound,upperBoundFunction.apply(key));
    }
    keyUpperBounds.add(upperBound);
  }
  return keyUpperBounds;
}


Prompt:
/**
 * Encodes a string with template parameters names present, specifically the characters '{' and '}' will be percent-encoded.
 * @param s the string with zero or more template parameters names
 * @return the string with encoded template parameters names.
 */
public static String encodeTemplateNames(String s){

public static String encodeTemplateNames(String s){
  int i=s.indexOf('{');
  if (i != -1)   s=s.replace("{","%7B");
  i=s.indexOf('}');
  if (i != -1)   s=s.replace("}","%7D");
  return s;
}


Prompt:
/**
 * Compare two points for equality using tolerance 1e-9.
 * @param p1 the first point
 * @param p2 the second point
 * @return whether the two points are equal or not
 */
public static boolean equals(Point2D p1,Point2D p2){

public static boolean equals(Point2D p1,Point2D p2){
  int xEquals=TOLERANCE_DOUBLE_COMPARATOR.compare(p1.getX(),p2.getX());
  if (xEquals != 0) {
    return false;
  }
  return TOLERANCE_DOUBLE_COMPARATOR.compare(p1.getY(),p2.getY()) == 0;
}


Prompt:
/**
 * Add a  {@link AtmosphereResourceEventListener}.
 * @param e an instance of AtmosphereResourceEventListener
 */
@Override public AtmosphereResource addEventListener(AtmosphereResourceEventListener e){

@Override public AtmosphereResource addEventListener(AtmosphereResourceEventListener e){
  if (listeners.contains(e))   return this;
  listeners.add(e);
  return this;
}


Prompt:
/**
 * Apply the given relative path to the given path, assuming standard Java folder separation (i.e. "/" separators).
 * @param path the path to start from (usually a full file path)
 * @param relativePath the relative path to apply(relative to the full file path above)
 * @return the full file path that results from applying the relative path
 */
public static String applyRelativePath(String path,String relativePath){

public static String applyRelativePath(String path,String relativePath){
  int separatorIndex=path.lastIndexOf(FOLDER_SEPARATOR);
  if (separatorIndex != -1) {
    String newPath=path.substring(0,separatorIndex);
    if (!relativePath.startsWith(FOLDER_SEPARATOR)) {
      newPath+=FOLDER_SEPARATOR;
    }
    return newPath + relativePath;
  }
 else {
    return relativePath;
  }
}


Prompt:
/**
 * Finds the first index within a String, handling null. This method uses  {@link String#indexOf(String)}.
 */
public static int indexOf(String str,String searchStr){

public static int indexOf(String str,String searchStr){
  if (str == null || searchStr == null) {
    return StringUtils.INDEX_NOT_FOUND;
  }
  return str.indexOf(searchStr);
}


Prompt:
/**
 * Returns a new array of Strings without null elements. Internal method used to normalize exclude lists (arrays and collections). Note that  {@link Arrays#sort(Object[])} will throw an {@link NullPointerException}if an array element is null.
 * @param array The array to check
 * @return The given array or a new array without null.
 */
static String[] toNoNullStringArray(Object[] array){

static String[] toNoNullStringArray(Object[] array){
  ArrayList<String> list=new ArrayList<String>(array.length);
  for (int i=0; i < array.length; i++) {
    Object e=array[i];
    if (e != null) {
      list.add(e.toString());
    }
  }
  return (String[])list.toArray(ArrayUtils.EMPTY_STRING_ARRAY);
}


Prompt:
/**
 * Returns the index of the last extension separator character, which is a dot. <p> This method also checks that there is no directory separator after the last dot. To do this it uses  {@link #indexOfLastSeparator(String)} which willhandle a file in either Unix or Windows format. <p> The output will be the same irrespective of the machine that the code is running on.
 * @param filename  the filename to find the last path separator in, null returns -1
 * @return the index of the last separator character, or -1 if thereis no such character
 */
public static int indexOfExtension(String filename){

public static int indexOfExtension(String filename){
  if (filename == null) {
    return -1;
  }
  int extensionPos=filename.lastIndexOf(EXTENSION_SEPARATOR);
  int lastSeparator=indexOfLastSeparator(filename);
  return lastSeparator > extensionPos ? -1 : extensionPos;
}


Prompt:
/**
 * @param timestamp        of current time
 * @param expiredThreshold represents the duration between last update time and the time point removing from cache.
 * @return true means this metrics should be removed from cache.
 */
public boolean isExpired(long timestamp,long expiredThreshold){

public boolean isExpired(long timestamp,long expiredThreshold){
  return timestamp - lastUpdateTimestamp > expiredThreshold;
}


Prompt:
/**
 * Returns an edge connecting previously returned node with node, which will be returned next. If either of the mentioned nodes is virtual, the edge will be incident to its real counterpart.
 * @return an edge from the current node to the next node
 */
Edge edgeToNext(){

Edge edgeToNext(){
  Edge edge=prev.embedded.getFirst();
  Node target=toExistingNode(current);
  Node source=toExistingNode(prev);
  if (edge.getOpposite(source) == target) {
    return edge;
  }
 else {
    return prev.embedded.getLast();
  }
}


Prompt:
/**
 * Returns  {@code true} if the given string matches the given substring at the given index, {@code false} otherwise.
 * @param str the original string (or StringBuilder)
 * @param index the index in the original string to start matching against
 * @param substring the substring to match at the given index
 * @return {@code true} if the given string matches the given substring at the given index, {@code false} otherwise.
 */
public static boolean substringMatch(CharSequence str,int index,CharSequence substring){

public static boolean substringMatch(CharSequence str,int index,CharSequence substring){
  for (int j=0; j < substring.length(); j++) {
    int i=index + j;
    if (i >= str.length() || str.charAt(i) != substring.charAt(j)) {
      return false;
    }
  }
  return true;
}


Prompt:
/**
 * Handles a log event.  For this appender, that means writing the message to each connected client.
 */
protected void append(LoggingEvent event){

protected void append(LoggingEvent event){
  if (sh != null) {
    sh.send(layout.format(event));
    if (layout.ignoresThrowable()) {
      String[] s=event.getThrowableStrRep();
      if (s != null) {
        StringBuffer buf=new StringBuffer();
        for (int i=0; i < s.length; i++) {
          buf.append(s[i]);
          buf.append("\r\n");
        }
        sh.send(buf.toString());
      }
    }
  }
}


Prompt:
/**
 *
Converts the character to a String that contains the one character.

For ASCII 7 bit characters, this uses a cache that will return the same String object each time.

 CharUtils.toString(' ')  = " " CharUtils.toString('A')  = "A"

 * @param ch  the character to convert
 * @return a String containing the one specified character
 */
public static String toString(final char ch){

public static String toString(final char ch){
  if (ch < 128) {
    return CharUtils.CHAR_STRING_ARRAY[ch];
  }
  return new String(new char[]{ch});
}


Prompt:
/**
 * Check if this field have been packed into a length-delimited field. If so, update internal state to reflect that packed fields are being read.
 * @throws IOException
 */
private void checkIfPackedField() throws IOException {

private void checkIfPackedField() throws IOException {
  if (packedLimit == 0 && WireFormat.getTagWireType(lastTag) == WIRETYPE_LENGTH_DELIMITED) {
    final int length=readRawVarint32();
    if (length < 0)     throw ProtobufException.negativeSize();
    this.packedLimit=getTotalBytesRead() + length;
  }
}


Prompt:
/**
 * Attempt to read a field tag, returning zero if we have reached EOF. Protocol message parsers use this to read tags, since a protocol message may legally end wherever a tag occurs, and zero is not a valid tag number.
 */
public int readTag() throws IOException {

public int readTag() throws IOException {
  if (!buffer.hasRemaining()) {
    lastTag=0;
    return 0;
  }
  final int tag=readRawVarint32();
  if (tag >>> TAG_TYPE_BITS == 0) {
    throw ProtobufException.invalidTag();
  }
  lastTag=tag;
  return tag;
}


Prompt:
/**
 * Puts two bytes into this byte vector. The byte vector is automatically enlarged if necessary.
 * @param byteValue1 a byte.
 * @param byteValue2 another byte.
 * @return this byte vector.
 */
final ByteVector put11(final int byteValue1,final int byteValue2){

final ByteVector put11(final int byteValue1,final int byteValue2){
  int currentLength=length;
  if (currentLength + 2 > data.length) {
    enlarge(2);
  }
  byte[] currentData=data;
  currentData[currentLength++]=(byte)byteValue1;
  currentData[currentLength++]=(byte)byteValue2;
  length=currentLength;
  return this;
}


Prompt:
/**
 * Build the 'Content-Range' HTTP Header value.
 * @return 'Content-Range' value
 */
private String buildContentRange(){

private String buildContentRange(){
  Integer limit=drc.getLimit() == null ? getDefaultNumberPagination() - 1 : drc.getLimit();
  Integer offset=drc.getOffset() == null ? 0 : drc.getOffset();
  Long count=drc.getCount() == null ? 0 : drc.getCount();
  return offset + "-" + (limit.equals(0) ? count - 1 : limit)+ "/"+ count;
}


Prompt:
/**
 * load thread snapshots in appointing time range
 */
public static List<ThreadSnapshot> parseFromFileWithTimeRange(File file,List<ProfileAnalyzeTimeRange> timeRanges) throws IOException {

public static List<ThreadSnapshot> parseFromFileWithTimeRange(File file,List<ProfileAnalyzeTimeRange> timeRanges) throws IOException {
  try (final FileInputStream fileInputStream=new FileInputStream(file)){
    ThreadSnapshot snapshot;
    final ArrayList<ThreadSnapshot> data=new ArrayList<>();
    while ((snapshot=ThreadSnapshot.parseDelimitedFrom(fileInputStream)) != null) {
      ThreadSnapshot finalSnapshot=snapshot;
      if (timeRanges.stream().filter(t -> finalSnapshot.getTime() >= t.getStart() && finalSnapshot.getTime() <= t.getEnd()).findFirst().isPresent()) {
        data.add(snapshot);
      }
    }
    return data;
  }
 }