id
stringlengths
21
23
content
stringlengths
1.65k
252k
codereval_java_data_101
/** * <p>Convert the input object into a java.lang.Character.</p> * @param type Data type to which this value should be converted. * @param value The input value to be converted. * @return The converted value. * @throws Exception if conversion cannot be performed successfully * @since 1.8.0 */ @Override prote...
codereval_java_data_102
/** * Case in-sensitive Checks if the String contains any character in the given set of string. */ public static boolean containsAnyIgnoreCase(String str,List<String> searchStrArray){ if (StringUtils.isEmpty(str) || searchStrArray == null || searchStrArray.isEmpty()) { return false; } for ( String item...
codereval_java_data_103
/** * Returns a prime number which is <code>&gt;= desiredCapacity</code> and very close to <code>desiredCapacity</code> (within 11% if <code>desiredCapacity &gt;= 1000</code>). * @param desiredCapacity the capacity desired by the user. * @return the capacity which should be used for a hashtable. */ public static...
codereval_java_data_104
/** * <p>Converts the Character to a char handling <code>null</code>.</p> <pre> CharUtils.toChar(null, 'X') = 'X' CharUtils.toChar(' ', 'X') = ' ' CharUtils.toChar('A', 'X') = 'A' </pre> * @param ch the character to convert * @param defaultValue the value to use if the Character is null * @return the char val...
codereval_java_data_105
/** * Return the first element in '<code>candidates</code>' that is contained in '<code>source</code>'. If no element in '<code>candidates</code>' is present in '<code>source</code>' returns <code>null</code>. Iteration order is {@link Collection} implementation specific. * @param source the source Collection * @pa...
codereval_java_data_106
/** * Trim trailing whitespace from the given String. * @param str the String to check * @return the trimmed String * @see java.lang.Character#isWhitespace */ public static String trimTrailingWhitespace(String str){ if (!hasLength(str)) { return str; } StringBuilder sb=new StringBuilder(str); while ...
codereval_java_data_107
/** * initialize config, such as check dist path */ public void init(){ File dist=new File(analyzeResultDist); if (!dist.exists()) { dist.mkdirs(); return; } if (dist.isFile()) { throw new IllegalArgumentException(analyzeResultDist + " must be a directory"); } } /* * Licensed to the Apache...
codereval_java_data_108
/** * Read a {@code string} field value from the stream. */ @Override public String readString() throws IOException { final int size=readRawVarint32(); if (size <= (bufferSize - bufferPos) && size > 0) { final String result=STRING.deser(buffer,bufferPos,size); bufferPos+=size; return result; } ...
codereval_java_data_109
/** * Interpret a character as a digit (in any base up to 36) and return the numeric value. This is like {@code Character.digit()} but we don't accept non-ASCII digits. */ private static int digitValue(final char c){ if ('0' <= c && c <= '9') { return c - '0'; } else if ('a' <= c && c <= 'z') { retu...
codereval_java_data_110
/** * build content,if it has ats someone set the ats */ private Map<String,Object> buildContent(JsonObject jsonObject){ Map<String,Object> content=new HashMap<>(); content.put("msg_type",jsonObject.get("msg_type").getAsString()); if (jsonObject.get("ats") != null) { String ats=jsonObject.get("ats").getA...
codereval_java_data_111
/** * Remove an {@link AtmosphereHandler}. * @param mapping the mapping used when invoking {@link #addAtmosphereHandler(String,AtmosphereHandler)}; * @return true if removed */ public AtmosphereFramework removeAtmosphereHandler(String mapping){ if (mapping.endsWith("/")) { mapping+=mappingRegex; } atm...
codereval_java_data_112
/** * Returns a single byte array containg all the contents written to the buffer(s). */ public final byte[] toByteArray(){ LinkedBuffer node=head; int offset=0, len; final byte[] buf=new byte[size]; do { if ((len=node.offset - node.start) > 0) { System.arraycopy(node.buffer,node.start,buf,offset...
codereval_java_data_113
/** * <p>Unescapes any Java literals found in the <code>String</code>. For example, it will turn a sequence of <code>'\'</code> and <code>'n'</code> into a newline character, unless the <code>'\'</code> is preceded by another <code>'\'</code>.</p> * @param str the <code>String</code> to unescape, may be null * @ret...
codereval_java_data_114
/** * Translate a MIME standard character set name into the Java equivalent. * @param charset The MIME standard name. * @return The Java equivalent for this name. */ private static String javaCharset(String charset){ if (charset == null) { return null; } String mappedCharset=MIME2JAVA.get(charset.toLow...
codereval_java_data_115
/** * Turn the given Object into a String with single quotes if it is a String; keeping the Object as-is else. * @param obj the input Object (e.g. "myString") * @return the quoted String (e.g. "'myString'"),or the input object as-is if not a String */ public static Object quoteIfString(Object obj){ return (obj...
codereval_java_data_116
/** * {@inheritDoc} */ @Override public ListNode<E> previousNode(){ checkForComodification(); if (!hasPrevious()) { throw new NoSuchElementException(); } last=next=next.prev; nextIndex--; return last; } /* * (C) Copyright 2018-2021, by Timofey Chudakov and Contributors. * * JGraphT : a free Ja...
codereval_java_data_117
/** * Reads a signed short value in this {@link ClassReader}. <i>This method is intended for {@link Attribute} sub classes, and is normally not needed by class generators or adapters.</i> * @param offset the start offset of the value to be read in this {@link ClassReader}. * @return the read value. */ public s...
codereval_java_data_118
/** * Returns a copy of the given array of size 1 greater than the argument. The last value of the array is left to the default value. * @param array The array to copy, must not be <code>null</code>. * @param newArrayComponentType If <code>array</code> is <code>null</code>, create asize 1 array of this type. * @re...
codereval_java_data_119
/** * Computes floor($\log_2 (n)$) $+ 1$ */ private int computeBinaryLog(int n){ assert n >= 0; int result=0; while (n > 0) { n>>=1; ++result; } return result; } /* * (C) Copyright 2007-2021, by Vinayak R Borkar and Contributors. * * JGraphT : a free Java graph-theory library * * See the C...
codereval_java_data_120
/** * Efficient way to compute the intersection between two sets * @param set1 set $1$ * @param set2 set $2$ * @return intersection of set $1$ and $2$ */ private Set<V> intersection(Set<V> set1,Set<V> set2){ Set<V> a; Set<V> b; if (set1.size() <= set2.size()) { a=set1; b=set2; } else { a=se...
codereval_java_data_121
/** * Converts the given Collection into an array of Strings. The returned array does not contain <code>null</code> entries. Note that {@link Arrays#sort(Object[])} will throw an {@link NullPointerException} if an array element is <code>null</code>. * @param collection The collection to convert * @return A new arr...
codereval_java_data_122
/** * <p>Utility method for {@link #createNumber(String)}.</p> <p>Returns <code>true</code> if s is <code>null</code>.</p> * @param s the String to check * @return if it is all zeros or <code>null</code> */ private static boolean isAllZeros(String s){ if (s == null) { return true; } for (int i=s.lengt...
codereval_java_data_123
/** * Invoke the {@link BroadcastFilter} * @param msg * @return */ protected Object filter(Object msg){ BroadcastAction a=bc.filter(msg); if (a.action() == BroadcastAction.ACTION.ABORT || msg == null) return null; else return a.message(); } /* * Copyright 2008-2022 Async-IO.org * * Licensed under ...
codereval_java_data_124
/** * Convert process properties to source data */ private JsonObject convertProperties(List<KeyStringValuePair> properties){ final JsonObject result=new JsonObject(); for ( KeyStringValuePair kv : properties) { result.addProperty(kv.getKey(),kv.getValue()); } return result; } /* * Licensed to the ...
codereval_java_data_125
/** * Removes any inactive nodes from the Category tree. */ protected int removeUnusedNodes(){ int count=0; CategoryNode root=_categoryModel.getRootCategoryNode(); Enumeration enumeration=root.depthFirstEnumeration(); while (enumeration.hasMoreElements()) { CategoryNode node=(CategoryNode)enumeration.n...
codereval_java_data_126
/** * Returns the label corresponding to the given bytecode offset. The default implementation of this method creates a label for the given offset if it has not been already created. * @param bytecodeOffset a bytecode offset in a method. * @param labels the already created labels, indexed by their offset. If a labe...
codereval_java_data_127
/** * If <code>value</code> is "true", then <code>true</code> is returned. If <code>value</code> is "false", then <code>true</code> is returned. Otherwise, <code>default</code> is returned. <p>Case of value is unimportant. */ public static boolean toBoolean(String value,boolean dEfault){ if (value == null) r...
codereval_java_data_128
/** * Trim leading whitespace from the given String. * @param str the String to check * @return the trimmed String * @see java.lang.Character#isWhitespace */ public static String trimLeadingWhitespace(String str){ if (!hasLength(str)) { return str; } StringBuilder sb=new StringBuilder(str); while (s...
codereval_java_data_129
/** * Reads a CONSTANT_Utf8 constant pool entry in {@link #classFileBuffer}. * @param constantPoolEntryIndex the index of a CONSTANT_Utf8 entry in the class's constant pooltable. * @param charBuffer the buffer to be used to read the string. This buffer must be sufficientlylarge. It is not automatically resized. *...
codereval_java_data_130
/** * Helper to decode half of a hexadecimal number from a string. * @param c The ASCII character of the hexadecimal number to decode.Must be in the range {@code [0-9a-fA-F]}. * @return The hexadecimal value represented in the ASCII charactergiven, or {@link Character#MAX_VALUE} if the character is invalid. */ ...
codereval_java_data_131
/** * Object to String ,when null object then null else return toString(); */ public static String toString(Object object){ return (object == null) ? null : object.toString(); } /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file dis...
codereval_java_data_132
/** * Calculate the factorial of $n$. * @param n the input number * @return the factorial */ public static long factorial(int n){ long multi=1; for (int i=1; i <= n; i++) { multi=multi * i; } return multi; } /* * (C) Copyright 2005-2021, by Assaf Lehr and Contributors. * * JGraphT : a free Java ...
codereval_java_data_133
/** * Either finds and returns a circulator to the node on the boundary of the component, which satisfies the {@code predicate} or returns a circulator to the {@code stop} node. * @param predicate the condition the desired node should satisfy * @param start the node to start the search from * @param stop the node...
codereval_java_data_134
/** * Add an <code>event</code> as the last event in the buffer. */ public void add(LoggingEvent event){ ea[last]=event; if (++last == maxSize) last=0; if (numElems < maxSize) numElems++; else if (++first == maxSize) first=0; } /* * Licensed to the Apache Software Foundation (ASF) under one or mo...
codereval_java_data_135
/** * Compares the two specified {@code long} values. The sign of the value returned is the same as that of{@code ((Long) a).compareTo(b)}. <p> <b>Note for Java 7 and later:</b> this method should be treated as deprecated; use the equivalent {@link Long#compare} method instead. * @param a the first {@code long} to...
codereval_java_data_136
/** * Copy the given Enumeration into a String array. The Enumeration must contain String elements only. * @param enumeration the Enumeration to copy * @return the String array (<code>null</code> if the passed-inEnumeration was <code>null</code>) */ public static String[] toStringArray(Enumeration<String> enumer...
codereval_java_data_137
/** * Puts an array of bytes into this byte vector. The byte vector is automatically enlarged if necessary. * @param byteArrayValue an array of bytes. May be {@literal null} to put {@code byteLength} nullbytes into this byte vector. * @param byteOffset index of the first byte of byteArrayValue that must be copi...
codereval_java_data_138
/** * Returns the values for the BeanMap. * @return values for the BeanMap. The returned collection is not modifiable. */ public Collection<Object> values(){ ArrayList<Object> answer=new ArrayList<>(readMethods.size()); for (Iterator<Object> iter=valueIterator(); iter.hasNext(); ) { answer.add(iter.next()...
codereval_java_data_139
/** * Returns a hash code value for this type. * @return a hash code value for this type. */ @Override public int hashCode(){ int hashCode=13 * (sort == INTERNAL ? OBJECT : sort); if (sort >= ARRAY) { for (int i=valueBegin, end=valueEnd; i < end; i++) { hashCode=17 * (hashCode + valueBuffer.charAt(i...
codereval_java_data_140
/** * Delete any character in a given String. * @param inString the original String * @param charsToDelete a set of characters to delete.E.g. "az\n" will delete 'a's, 'z's and new lines. * @return the resulting String */ public static String deleteAny(String inString,String charsToDelete){ if (!hasLength(inSt...
codereval_java_data_141
/** * Match a URI against the pattern. * @param uri the uri to match against the template. * @return the match result, otherwise null if no match occurs. */ public final MatchResult match(CharSequence uri){ if (uri == null || uri.length() == 0) return (regexPattern == null) ? EMPTY_STRING_MATCH_RESULT : null...
codereval_java_data_142
/** * @param b An ASCII encoded character 0-9 a-f A-F * @return The byte value of the character 0-16. */ public static byte convertHexDigit(byte b){ if ((b >= '0') && (b <= '9')) return (byte)(b - '0'); if ((b >= 'a') && (b <= 'f')) return (byte)(b - 'a' + 10); if ((b >= 'A') && (b <= 'F')) return (by...
codereval_java_data_143
/** * Add the specified files in reverse order. */ private void addReverse(final InputStream[] files){ for (int i=files.length - 1; i >= 0; --i) { stack.add(files[i]); } } package org.atmosphere.util.annotation;/* * Copyright 2008-2022 Async-IO.org * * Licensed under the Apache License, Version 2.0 (t...
codereval_java_data_144
/** * @param modelName model name of the entity * @throws IllegalStateException if sharding key indices are not continuous */ private void check(String modelName) throws IllegalStateException { for (int i=0; i < keys.size(); i++) { final ModelColumn modelColumn=keys.get(i); if (modelColumn == null) { ...
codereval_java_data_145
/** * Reads a byte from the <code>buffer</code>, and refills it as necessary. * @return The next byte from the input stream. * @throws IOException if there is no more data available. */ public byte readByte() throws IOException { if (head == tail) { head=0; tail=input.read(buffer,head,bufSize); if ...
codereval_java_data_146
/** * Automatically suspend the {@link AtmosphereResource} based on {@link AtmosphereResource.TRANSPORT} value. * @param r a {@link AtmosphereResource} * @return {@link Action#CONTINUE} */ @Override public Action inspect(AtmosphereResource r){ switch (r.transport()) { case JSONP: case AJAX: case LONG_POLLING: ...
codereval_java_data_147
/** * Compute the sum of the weights entering a vertex * @param v the vertex * @return the sum of the weights entering a vertex */ public double vertexWeight(Set<V> v){ double wsum=0.0; for ( DefaultWeightedEdge e : workingGraph.edgesOf(v)) { wsum+=workingGraph.getEdgeWeight(e); } return wsum; } /...
codereval_java_data_148
/** * @see Comparator */ public int compare(Object aObj1,Object aObj2){ if ((aObj1 == null) && (aObj2 == null)) { return 0; } else if (aObj1 == null) { return -1; } else if (aObj2 == null) { return 1; } final EventDetails le1=(EventDetails)aObj1; final EventDetails le2=(EventDetails)...
codereval_java_data_149
/** * Remove the appender with the name passed as parameter form the list of appenders. */ public void removeAppender(String name){ if (name == null || appenderList == null) return; int size=appenderList.size(); for (int i=0; i < size; i++) { if (name.equals(((Appender)appenderList.elementAt(i)).getN...
codereval_java_data_150
/** * Call the <code>doAppend</code> method on all attached appenders. */ public int appendLoopOnAppenders(LoggingEvent event){ int size=0; Appender appender; if (appenderList != null) { size=appenderList.size(); for (int i=0; i < size; i++) { appender=(Appender)appenderList.elementAt(i); ...
codereval_java_data_151
/** * <p>Converts an array of object Integers to primitives.</p> <p>This method returns <code>null</code> for a <code>null</code> input array.</p> * @param array a <code>Integer</code> array, may be <code>null</code> * @return an <code>int</code> array, <code>null</code> if null array input * @throws NullPointerE...
codereval_java_data_152
/** * <p> Registers the given object. Used by the reflection methods to avoid infinite loops. </p> * @param value The object to register. */ static void register(Object value){ if (value != null) { Map m=getRegistry(); if (m == null) { m=new WeakHashMap(); REGISTRY.set(m); } m.put(va...
codereval_java_data_153
/** * Get the number of non-zero entries of a row. * @param row the row * @return the number of non-zero entries of a row */ public int nonZeros(int row){ assert row >= 0 && row < rowOffsets.length; return rowOffsets[row + 1] - rowOffsets[row]; } /* * (C) Copyright 2019-2021, by Dimitrios Michail and Cont...
codereval_java_data_154
/** * Check whether the given Collection contains the given element instance. <p>Enforces the given instance to be present, rather than returning <code>true</code> for an equal element as well. * @param collection the Collection to check * @param element the element to look for * @return <code>true</code> if found...
codereval_java_data_155
/** * <p>Checks whether the character is ASCII 7 bit control.</p> <pre> CharUtils.isAsciiControl('a') = false CharUtils.isAsciiControl('A') = false CharUtils.isAsciiControl('3') = false CharUtils.isAsciiControl('-') = false CharUtils.isAsciiControl('\n') = true CharUtils.isAsciiControl('&copy;') = false </pre> *...
codereval_java_data_156
/** * Return <code>true</code> if this map contains a mapping for the specified key. * @param key the key to be searched for * @return true if the map contains the key */ @Override public boolean containsKey(final Object key){ if (this.fast) { return this.map.containsKey(key); } else { synchronized (th...
codereval_java_data_157
/** * <p>Converts an array of primitive booleans to objects.</p> <p>This method returns <code>null</code> for a <code>null</code> input array.</p> * @param array a <code>boolean</code> array * @return a <code>Boolean</code> array, <code>null</code> if null array input */ public static Boolean[] toObject(final b...
codereval_java_data_158
/** * Copies bytes to a {@code byte[]}. */ public byte[] toByteArray(){ final int size=bytes.length; final byte[] copy=new byte[size]; System.arraycopy(bytes,0,copy,0,size); return copy; } //======================================================================== //Copyright 2007-2009 David Yu dyuprojec...
codereval_java_data_159
/** * Transform from a Set representation to a graph path. * @param tour a set containing the edges of the tour * @param graph the graph * @return a graph path */ protected GraphPath<V,E> edgeSetToTour(Set<E> tour,Graph<V,E> graph){ List<V> vertices=new ArrayList<>(tour.size() + 1); MaskSubgraph<V,E> tourGr...
codereval_java_data_160
/** * <p>Converts an array of primitive shorts to objects.</p> <p>This method returns <code>null</code> for a <code>null</code> input array.</p> * @param array a <code>short</code> array * @return a <code>Short</code> array, <code>null</code> if null array input */ public static Short[] toObject(final short[] a...
codereval_java_data_161
/** * Adds a CONSTANT_NameAndType_info to the constant pool of this symbol table. Does nothing if the constant pool already contains a similar item. * @param name a field or method name. * @param descriptor a field or method descriptor. * @return a new or already existing Symbol with the given value. */ int add...
codereval_java_data_162
/** * Unescape a string DOT identifier. * @param input the input * @return the unescaped output */ private String unescapeId(String input){ final char quote='"'; if (input.charAt(0) != quote || input.charAt(input.length() - 1) != quote) { return input; } String noQuotes=input.subSequence(1,input.leng...
codereval_java_data_163
/** * Concatenate the given String arrays into one, with overlapping array elements included twice. <p>The order of elements in the original arrays is preserved. * @param array1 the first array (can be <code>null</code>) * @param array2 the second array (can be <code>null</code>) * @return the new array (<code>nul...
codereval_java_data_164
/** * Moves all vertices from the bucket with label {@code minLabel} to the bucket with label 0.Clears the bucket with label {@code minLabel}. Updates the labeling accordingly. * @param bucketsByLabel the buckets vertices are stored in * @param labels the labels of the vertices * @param minLabel the minimum valu...
codereval_java_data_165
/** * Append the given String to the given String array, returning a new array consisting of the input array contents plus the given String. * @param array the array to append to (can be <code>null</code>) * @param str the String to append * @return the new array (never <code>null</code>) */ public static Strin...
codereval_java_data_166
/** * Returns the number of occurrences the substring {@code sub} appears in string {@code str}. * @param str string to search in. Return 0 if this is null. * @param sub string to search for. Return 0 if this is null. * @return the number of occurrences the substring {@code sub} appears in string {@code str}. */...
codereval_java_data_167
/** * <p> Checks in the specified list if there is at least one instance of the given {@link AtmosphereInterceptor interceptor} implementation class.</p> * @param interceptorList the interceptors * @param c the interceptor class * @return {@code false} if an instance of the class already exists in th...
codereval_java_data_168
/** * <p>Append to the <code>toString</code> the detail of a <code>byte</code> array.</p> * @param buffer the <code>StringBuffer</code> to populate * @param fieldName the field name, typically not used as already appended * @param array the array to add to the <code>toString</code>,not <code>null</code> */ p...
codereval_java_data_169
/** * Checks whether there exist unvisited vertices. * @return true if there exist unvisited vertices. */ @Override public boolean hasNext(){ if (current != null) { return true; } current=advance(); if (current != null && nListeners != 0) { fireVertexTraversed(createVertexTraversalEvent(current));...
codereval_java_data_170
/** * Pops the given number of abstract types from the output frame stack. * @param elements the number of abstract types that must be popped. */ private void pop(final int elements){ if (outputStackTop >= elements) { outputStackTop-=elements; } else { outputStackStart-=elements - outputStackTop; ...
codereval_java_data_171
/** * @return true if the bucket is same. */ public boolean isCompatible(DataTable dataset){ final List<String> sortedKeys=dataset.sortedKeys(new HeatMap.KeyComparator(true)); long[] existedBuckets=new long[sortedKeys.size()]; for (int i=0; i < sortedKeys.size(); i++) { String key=sortedKeys.get(i); ...
codereval_java_data_172
/** * Find class given class name. * @param className class name, may not be null. * @return class, will not be null. * @throws ClassNotFoundException thrown if class can not be found. */ private Class findClass(final String className) throws ClassNotFoundException { try { return Thread.currentThread().ge...
codereval_java_data_173
/** * {@inheritDoc} */ @Override protected V provideNextVertex(){ V v=super.provideNextVertex(); for (int i=path.size() - 1; i >= 0; --i) { if (graph.containsEdge(path.get(i),v)) { break; } path.remove(i); } path.add(v); return v; } /* * (C) Copyright 2004-2021, by John V Sichi and C...
codereval_java_data_174
/** * Adds a source line number corresponding to this label. * @param lineNumber a source line number (which should be strictly positive). */ final void addLineNumber(final int lineNumber){ if (this.lineNumber == 0) { this.lineNumber=(short)lineNumber; } else { if (otherLineNumbers == null) { o...
codereval_java_data_175
/** * Removes this bucket from the data structure. */ void removeSelf(){ if (next != null) { next.prev=prev; } if (prev != null) { prev.next=next; } } /* * (C) Copyright 2018-2021, by Timofey Chudakov and Contributors. * * JGraphT : a free Java graph-theory library * * See the CONTRIBUTORS.m...
codereval_java_data_176
/** * Keep the same name replacement as {@link ColumnName#overrideName(String,String)} * @param oldName to be replaced. * @param newName to use in the storage level. */ public void overrideName(String oldName,String newName){ for (int i=0; i < columns.length; i++) { if (columns[i].equals(oldName)) { ...
codereval_java_data_177
/** * Remove the non null {@code node} from the list. */ private boolean unlink(ListNodeImpl<E> node){ ListNodeImpl<E> prev=node.prev; ListNodeImpl<E> next=node.next; if (removeListNode(node)) { if (size == 0) { head=null; } else { link(prev,next); if (head == node) { hea...
codereval_java_data_178
/** * build current profiles segment snapshot search sequence ranges */ public List<SequenceRange> buildSequenceRanges(){ ArrayList<SequenceRange> ranges=new ArrayList<>(); do { int batchMax=Math.min(minSequence + SEQUENCE_RANGE_BATCH_SIZE,maxSequence); ranges.add(new SequenceRange(minSequence,batchMax...
codereval_java_data_179
/** * True is the body is a byte array * @return True is the body is a byte array */ public boolean hasBytes(){ return dataBytes != null; } /* * Copyright 2008-2022 Async-IO.org * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the Li...
codereval_java_data_180
/** * Strip the filename extension from the given path, e.g. "mypath/myfile.txt" -&gt; "mypath/myfile". * @param path the file path (may be <code>null</code>) * @return the path with stripped filename extension,or <code>null</code> if none */ public static String stripFilenameExtension(String path){ if (path =...
codereval_java_data_181
/** * <p>Converts an array of object Characters to primitives.</p> <p>This method returns <code>null</code> for a <code>null</code> input array.</p> * @param array a <code>Character</code> array, may be <code>null</code> * @return a <code>char</code> array, <code>null</code> if null array input * @throws NullPoin...
codereval_java_data_182
/** * Parses out a token until any of the given terminators is encountered. * @param terminators the array of terminating characters. Any of these characters when encountered signify the end of the token * @return the token */ private String parseToken(final char[] terminators){ char ch; i1=pos; i2=pos; ...
codereval_java_data_183
/** * Trim all occurrences of the supplied leading character from the given String. * @param str the String to check * @param leadingCharacter the leading character to be trimmed * @return the trimmed String */ public static String trimLeadingCharacter(String str,char leadingCharacter){ if (!hasLength(str)) {...
codereval_java_data_184
/** * <p>Converts an array of primitive ints to objects.</p> <p>This method returns <code>null</code> for a <code>null</code> input array.</p> * @param array an <code>int</code> array * @return an <code>Integer</code> array, <code>null</code> if null array input */ public static Integer[] toObject(final int[] a...
codereval_java_data_185
/** * <p>Converts an array of primitive doubles to objects.</p> <p>This method returns <code>null</code> for a <code>null</code> input array.</p> * @param array a <code>double</code> array * @return a <code>Double</code> array, <code>null</code> if null array input */ public static Double[] toObject(final doubl...
codereval_java_data_186
/** * Computes a suffix sum of the {@code bounds}. Returns computed suffix sum and the sum of all elements in the {@code bounds list}. * @param bounds list of integers. * @return computed pair of suffix sum list and a sum of all elements. */ private Pair<List<Integer>,Long> computeSuffixSum(List<Integer> bound...
codereval_java_data_187
/** * Reverses the order of the elements in the specified range within the given array. * @param < V > the type of elements in the array * @param arr the array * @param from the index of the first element (inclusive) inside the range to reverse * @param to the index of the last element (inclusive) inside the rang...
codereval_java_data_188
/** * Atomically moves all {@link ListNode ListNodes} from {@code list} to this list as if eachnode was removed with {@link #removeListNode(ListNodeImpl)} from {@code list} andsubsequently added to this list by {@link #addListNode(ListNodeImpl)}. */ private void moveAllListNodes(DoublyLinkedList<E> list){ for...
codereval_java_data_189
/** * <p>Check if a String starts with a specified prefix (optionally case insensitive).</p> * @see String#startsWith(String) * @param str the String to check, may be null * @param prefix the prefix to find, may be null * @param ignoreCase inidicates whether the compare should ignore case(case insensitive) or no...
codereval_java_data_190
/** * <p>Converts the character to a Character.</p> <p>For ASCII 7 bit characters, this uses a cache that will return the same Character object each time.</p> <pre> CharUtils.toCharacterObject(' ') = ' ' CharUtils.toCharacterObject('A') = 'A' </pre> * @param ch the character to convert * @return a Character of t...
codereval_java_data_191
/** * <p>Checks whether the character is ASCII 7 bit alphabetic upper case.</p> <pre> CharUtils.isAsciiAlphaUpper('a') = false CharUtils.isAsciiAlphaUpper('A') = true CharUtils.isAsciiAlphaUpper('3') = false CharUtils.isAsciiAlphaUpper('-') = false CharUtils.isAsciiAlphaUpper('\n') = false CharUtils.isAsciiAlphaU...
codereval_java_data_192
/** * Returns {@link Filter#NEUTRAL} is there is no string match. */ 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 (acceptO...
codereval_java_data_193
/** * 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){ for ( String s : templateVariables) { if (s.eq...
codereval_java_data_194
/** * 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){ Iterator<String> readableKeys=map.readMethods.keySet().iterator(); while (read...
codereval_java_data_195
/** * Gets a String's length or <code>0</code> if the String is <code>null</code>. * @param str a String or <code>null</code> * @return String length or <code>0</code> if the String is <code>null</code>. * @since 2.4 */ public static int length(final String str){ return str == null ? 0 : str.length(); } /* ...
codereval_java_data_196
/** * Is this a hex digit? */ private static boolean isHex(final char c){ return ('0' <= c && c <= '9') || ('a' <= c && c <= 'f') || ('A' <= c && c <= 'F'); } //======================================================================== //Copyright 2007-2009 David Yu dyuproject@gmail.com //-----------------------...
codereval_java_data_197
/** * Decoding a string to a string follow the Base64 regular. */ 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); } /* * Copyright 2008-2...
codereval_java_data_198
/** * <p>Checks whether two arrays are the same length, treating <code>null</code> arrays as length <code>0</code>.</p> * @param array1 the first array, may be <code>null</code> * @param array2 the second array, may be <code>null</code> * @return <code>true</code> if length of arrays matches, treating<code>null</c...
codereval_java_data_199
/** * 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){ Object o=r.getAttribute(METEOR); return o == null ? null : Meteor.class.isAssignab...
codereval_java_data_200
/** * 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 eleme...