{"sample_uid": "codereval_java::6367676d1a6d9265ec018229", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Trim the elements of the given String array, calling String.trim() on each of them.\n * @param array the original String array\n * @return the resulting array (of the same size) with trimmed elements\n */\npublic static String[] trimArrayElements(String[] array){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public static String[] trimArrayElements(String[] array){\n if (Objects.isEmpty(array)) {\n return new String[0];\n }\n String[] result=new String[array.length];\n for (int i=0; i < array.length; i++) {\n String element=array[i];\n result[i]=(element != null ? element.trim() : null);\n }\n return result;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "6367676d1a6d9265ec018229"}}
{"sample_uid": "codereval_java::6367670b1a6d9265ec017a00", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n *
Checks whether two arrays are the same length, treating null arrays as length 0.
null\n * @param array2 the second array, may be null\n * @return true if length of arrays matches, treatingnull as an empty array\n */\npublic static boolean isSameLength(final byte[] array1,final byte[] array2){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public static boolean isSameLength(final byte[] array1,final byte[] array2){\n if (array1 == null && array2 != null && array2.length > 0 || array2 == null && array1 != null && array1.length > 0 || array1 != null && array2 != null && array1.length != array2.length) {\n return false;\n }\n return true;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "6367670b1a6d9265ec017a00"}}
{"sample_uid": "codereval_java::636766a91a6d9265ec0175c2", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Pops an abstract type from the output frame stack and returns its value.\n * @return the abstract type that has been popped from the output frame stack.\n */\nprivate int pop(){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "private int pop(){\n if (outputStackTop > 0) {\n return outputStack[--outputStackTop];\n }\n else {\n return STACK_KIND | -(--outputStackStart);\n }\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636766a91a6d9265ec0175c2"}}
{"sample_uid": "codereval_java::636767081a6d9265ec017989", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Converts an array of object Booleans to primitives.
This method returns null for a null input array.
Boolean array, may be null\n * @return a boolean array, null if null array input\n * @throws NullPointerException if array content is null\n */\npublic static boolean[] toPrimitive(final Boolean[] array){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public static boolean[] toPrimitive(final Boolean[] array){\n if (array == null) {\n return null;\n }\n else if (array.length == 0) {\n return ArrayUtils.EMPTY_BOOLEAN_ARRAY;\n }\n final boolean[] result=new boolean[array.length];\n for (int i=0; i < array.length; i++) {\n result[i]=array[i].booleanValue();\n }\n return result;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767081a6d9265ec017989"}}
{"sample_uid": "codereval_java::6367672d1a6d9265ec017c73", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Returns true if the message should be printed in the given timestamp, otherwise returns false. If this method returns false, the message will not be printed. The timestamp is in seconds granularity. \n */\npublic boolean shouldPrintMessage(int timestamp,String message){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public boolean shouldPrintMessage(int timestamp,String message){\n if (messages.containsKey(message)) {\n if (timestamp - messages.get(message) >= 10) {\n messages.put(message,timestamp);\n return true;\n }\n else {\n return false;\n }\n }\n else {\n messages.put(message,timestamp);\n return true;\n }\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "6367672d1a6d9265ec017c73"}}
{"sample_uid": "codereval_java::636766f81a6d9265ec01775c", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Gets the toString of an Object returning an empty string (\"\") if null input.
ObjectUtils.toString(null) = \"\" ObjectUtils.toString(\"\") = \"\" ObjectUtils.toString(\"bat\") = \"bat\" ObjectUtils.toString(Boolean.TRUE) = \"true\"\n * @see StringUtils#defaultString(String)\n * @see String#valueOf(Object)\n * @param obj the Object to
toString, may be null\n * @return the passed in Object's toString, or nullStr if null input\n * @since 2.0\n */\npublic static String toString(Object obj){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public static String toString(Object obj){\n return obj == null ? \"\" : obj.toString();\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636766f81a6d9265ec01775c"}}
{"sample_uid": "codereval_java::6367667f1a6d9265ec017457", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Decodes octets to characters using the UTF-8 decoding and appends the characters to a StringBuffer.\n * @return the index to the next unchecked character in the string to decode\n */\nprivate static int decodeOctets(int i,ByteBuffer bb,StringBuilder sb){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "private static int decodeOctets(int i,ByteBuffer bb,StringBuilder sb){\n if (bb.limit() == 1 && (bb.get(0) & 0xFF) < 0x80) {\n sb.append((char)bb.get(0));\n return i + 2;\n }\n else {\n CharBuffer cb=UTF_8_CHARSET.decode(bb);\n sb.append(cb);\n return i + bb.limit() * 3 - 1;\n }\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "6367667f1a6d9265ec017457"}}
{"sample_uid": "codereval_java::636766aa1a6d9265ec0175ce", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Starts the visit of a new stack map frame, stored in {@link #currentFrame}.\n * @param offset the bytecode offset of the instruction to which the frame corresponds.\n * @param numLocal the number of local variables in the frame.\n * @param numStack the number of stack elements in the frame.\n * @return the index of the next element to be written in this frame.\n */\nint visitFrameStart(final int offset,final int numLocal,final int numStack){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "int visitFrameStart(final int offset,final int numLocal,final int numStack){\n int frameLength=3 + numLocal + numStack;\n if (currentFrame == null || currentFrame.length < frameLength) {\n currentFrame=new int[frameLength];\n }\n currentFrame[0]=offset;\n currentFrame[1]=numLocal;\n currentFrame[2]=numStack;\n return 3;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636766aa1a6d9265ec0175ce"}}
{"sample_uid": "codereval_java::636767191a6d9265ec017c0f", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Enlarges this byte vector so that it can receive 'size' more bytes.\n * @param size number of additional bytes that this byte vector should be able to receive.\n */\nprivate void enlarge(final int size){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "private void enlarge(final int size){\n int doubleCapacity=2 * data.length;\n int minimalCapacity=length + size;\n byte[] newData=new byte[doubleCapacity > minimalCapacity ? doubleCapacity : minimalCapacity];\n System.arraycopy(data,0,newData,0,length);\n data=newData;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767191a6d9265ec017c0f"}}
{"sample_uid": "codereval_java::636767821a6d9265ec0183a0", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Delete's the specified file if it exists \n */\nprotected static void deleteFile(String fileName){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "protected static void deleteFile(String fileName){\n File file=new File(fileName);\n if (file.exists()) {\n file.delete();\n }\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767821a6d9265ec0183a0"}}
{"sample_uid": "codereval_java::636767691a6d9265ec0181aa", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Return a hash code based on the contents of the specified array. If array is null, this method returns 0.\n * @param array the long array to obtain a hashcode\n * @return the long array's hashcode, which could be 0 if the array is null.\n */\npublic static int nullSafeHashCode(long[] array){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public static int nullSafeHashCode(long[] array){\n if (array == null) {\n return 0;\n }\n int hash=INITIAL_HASH;\n int arraySize=array.length;\n for (int i=0; i < arraySize; i++) {\n hash=MULTIPLIER * hash + hashCode(array[i]);\n }\n return hash;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767691a6d9265ec0181aa"}}
{"sample_uid": "codereval_java::636767441a6d9265ec017cc1", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Performs a right node rotation.\n * @param node a node to rotate\n * @return a new parent of the {@code node}\n */\nprivate TreeNodeThis method will handle a file in either Unix or Windows format. The position of the last forward or backslash is returned.
The output will be the same irrespective of the machine that the code is running on.\n * @param filename the filename to find the last path separator in, null returns -1\n * @return the index of the last separator character, or -1 if thereis no such character\n */\npublic static int indexOfLastSeparator(String filename){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public static int indexOfLastSeparator(String filename){\n if (filename == null) {\n return -1;\n }\n int lastUnixPos=filename.lastIndexOf(UNIX_SEPARATOR);\n int lastWindowsPos=filename.lastIndexOf(WINDOWS_SEPARATOR);\n return Math.max(lastUnixPos,lastWindowsPos);\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636766f11a6d9265ec017658"}}
{"sample_uid": "codereval_java::636767121a6d9265ec017b0a", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Skips bytes until the end of the current line.\n * @param headerPart The headers, which are being parsed.\n * @param end Index of the last byte, which has yet been processed.\n * @return Index of the \\r\\n sequence, which indicates end of line.\n */\nprivate int parseEndOfLine(String headerPart,int end){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "private int parseEndOfLine(String headerPart,int end){\n int index=end;\n for (; ; ) {\n int offset=headerPart.indexOf('\\r',index);\n if (offset == -1 || offset + 1 >= headerPart.length()) {\n throw new IllegalStateException(\"Expected headers to be terminated by an empty line.\");\n }\n if (headerPart.charAt(offset + 1) == '\\n') {\n return offset;\n }\n index=offset + 1;\n }\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767121a6d9265ec017b0a"}}
{"sample_uid": "codereval_java::636766f61a6d9265ec017701", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Finds the last index within a String, handling null. This method uses {@link String#lastIndexOf(String)}. \n */\npublic static int lastIndexOf(String str,String searchStr){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public static int lastIndexOf(String str,String searchStr){\n if (StringUtils.isEmpty(str)) {\n return StringUtils.INDEX_NOT_FOUND;\n }\n return str.lastIndexOf(searchStr);\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636766f61a6d9265ec017701"}}
{"sample_uid": "codereval_java::6367670b1a6d9265ec0179fe", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Writes b.length bytes from the specified byte array to this output stream.\n * @param b The array of bytes to be written.\n * @exception IOException if an error occurs.\n */\n@Override public void write(byte b[]) throws IOException {", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "@Override public void write(byte b[]) throws IOException {\n checkThreshold(b.length);\n getStream().write(b);\n written+=b.length;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "6367670b1a6d9265ec0179fe"}}
{"sample_uid": "codereval_java::636767df1a6d9265ec01873c", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * @return the row id\n */\npublic String id(String entityId){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public String id(String entityId){\n if (entityId == null) {\n return String.valueOf(point);\n }\n else {\n return point + Const.ID_CONNECTOR + entityId;\n }\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767df1a6d9265ec01873c"}}
{"sample_uid": "codereval_java::636766f91a6d9265ec01777f", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n *
Converts a Boolean to a boolean handling null by returning false.
BooleanUtils.toBoolean(Boolean.TRUE) = true BooleanUtils.toBoolean(Boolean.FALSE) = false BooleanUtils.toBoolean(null) = false\n * @param bool the boolean to convert\n * @return
true or false, null returns false\n */\npublic static boolean toBoolean(Boolean bool){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public static boolean toBoolean(Boolean bool){\n if (bool == null) {\n return false;\n }\n return bool.booleanValue() ? true : false;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636766f91a6d9265ec01777f"}}
{"sample_uid": "codereval_java::6367675f1a6d9265ec0180d3", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Computes an identity automorphism (i.e. a self-mapping of a graph in which each vertex also maps to itself).\n * @param graph the input graph\n * @param < V > the graph vertex type\n * @param < E > the graph edge type\n * @return a mapping from graph to graph\n */\npublic static buffer, starting at the specified position.\n * @param value The value to find.\n * @param pos The starting position for searching.\n * @return The position of byte found, counting from beginning of thebuffer, or -1 if not found.\n */\nprotected int findByte(byte value,int pos){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "protected int findByte(byte value,int pos){\n for (int i=pos; i < tail; i++) {\n if (buffer[i] == value) {\n return i;\n }\n }\n return -1;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636766ff1a6d9265ec017851"}}
{"sample_uid": "codereval_java::636767a41a6d9265ec018582", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Serializes the {@code message}, prefixed with its length, into an {@link OutputStream}.\n * @return the size of the message\n */\npublic static Gets the String built by this builder.
\n * @return the built string\n */\npublic String toString(){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public String toString(){\n if (this.getObject() == null) {\n return this.getStyle().getNullText();\n }\n Class> clazz=this.getObject().getClass();\n this.appendFieldsIn(clazz);\n while (clazz.getSuperclass() != null && clazz != this.getUpToClass()) {\n clazz=clazz.getSuperclass();\n this.appendFieldsIn(clazz);\n }\n return super.toString();\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767001a6d9265ec01787e"}} {"sample_uid": "codereval_java::636767781a6d9265ec01823d", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * This method does actual writing\n */\nprotected void subAppend(LoggingEvent event){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "protected void subAppend(LoggingEvent event){\n try {\n File tmp=File.createTempFile(prefix,suffix,dir);\n Writer out=new BufferedWriter(new FileWriter(tmp));\n out.write(event.message);\n out.close();\n }\n catch ( Exception e) {\n errorHandler.error(\"Error during creation of temporary File!\",e,1);\n }\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767781a6d9265ec01823d"}} {"sample_uid": "codereval_java::636766ef1a6d9265ec01761a", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Adds a type in the type table of this symbol table. Does nothing if the type table already contains a similar type.\n * @param value an internal class name.\n * @return the index of a new or already existing type Symbol with the given value.\n */\nint addType(final String value){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "int addType(final String value){\n int hashCode=hash(Symbol.TYPE_TAG,value);\n Entry entry=get(hashCode);\n while (entry != null) {\n if (entry.tag == Symbol.TYPE_TAG && entry.hashCode == hashCode && entry.value.equals(value)) {\n return entry.index;\n }\n entry=entry.next;\n }\n return addTypeInternal(new Entry(typeCount,Symbol.TYPE_TAG,value,hashCode));\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636766ef1a6d9265ec01761a"}} {"sample_uid": "codereval_java::636766821a6d9265ec0174b6", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Resolves the arguments for the {@code genericType} using the type variable information for the{@code targetType}. Returns {@code null} if {@code genericType} is not parameterized or ifarguments cannot be resolved.\n */\npublic static Class>[] resolveArguments(Type genericType,Class> targetType){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public static Class>[] resolveArguments(Type genericType,Class> targetType){\n Class>[] result=null;\n if (genericType instanceof ParameterizedType) {\n ParameterizedType paramType=(ParameterizedType)genericType;\n Type[] arguments=paramType.getActualTypeArguments();\n result=new Class[arguments.length];\n for (int i=0; i < arguments.length; i++) result[i]=resolveClass(arguments[i],targetType);\n }\n else if (genericType instanceof TypeVariable) {\n result=new Class[1];\n result[0]=resolveClass(genericType,targetType);\n }\n return result;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636766821a6d9265ec0174b6"}} {"sample_uid": "codereval_java::636767e11a6d9265ec018781", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Accept the data into the cache and merge with the existing value. This method is not thread safe, should avoid concurrency calling.\n * @param data to be added potentially.\n */\n@Override public void accept(final METRICS data){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "@Override public void accept(final METRICS data){\n final String id=data.id();\n final METRICS existed=buffer.get(id);\n if (existed == null) {\n buffer.put(id,data);\n }\n else {\n final boolean isAbandoned=!existed.combine(data);\n if (isAbandoned) {\n buffer.remove(id);\n }\n }\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767e11a6d9265ec018781"}} {"sample_uid": "codereval_java::636767531a6d9265ec017efb", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Inserts this bucket in the data structure before the {@code bucket}.\n * @param bucket the bucket, that will be the next to this bucket.\n */\nvoid insertBefore(Bucket bucket){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "void insertBefore(Bucket bucket){\n this.next=bucket;\n if (bucket != null) {\n this.prev=bucket.prev;\n if (bucket.prev != null) {\n bucket.prev.next=this;\n }\n bucket.prev=this;\n }\n else {\n this.prev=null;\n }\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767531a6d9265ec017efb"}} {"sample_uid": "codereval_java::636766f11a6d9265ec017641", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * @see InputStream#available() \n */\n@Override public int available() throws IOException {", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "@Override public int available() throws IOException {\n return this.index < this.length ? this.length - this.index : this.length >= 0 && this.reader.ready() ? 1 : 0;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636766f11a6d9265ec017641"}} {"sample_uid": "codereval_java::636767de1a6d9265ec018706", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Returns mappings with fields that not exist in the input mappings. The input mappings should be history mapping from current index. Do not return _source config to avoid current index update conflict.\n */\npublic Mappings diffStructure(String tableName,Mappings mappings){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public Mappings diffStructure(String tableName,Mappings mappings){\n if (!structures.containsKey(tableName)) {\n return new Mappings();\n }\n MapDefensive programming technique to change a null reference to an empty one.
This method returns an empty array for a null input array.
As a memory optimizing technique an empty array passed in will be overridden with the empty public static references in this class.
null or empty\n * @return the same array, public static empty array if null or empty input\n * @since 2.5\n */\npublic static Byte[] nullToEmpty(final Byte[] array){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public static Byte[] nullToEmpty(final Byte[] array){\n if (array == null || array.length == 0) {\n return ArrayUtils.EMPTY_BYTE_OBJECT_ARRAY;\n }\n return array;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "6367670b1a6d9265ec0179ff"}}
{"sample_uid": "codereval_java::6367677f1a6d9265ec018347", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * sends a message to each of the clients in telnet-friendly output. \n */\npublic synchronized void send(final String message){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public synchronized void send(final String message){\n Iterator ce=connections.iterator();\n for (Iterator e=writers.iterator(); e.hasNext(); ) {\n ce.next();\n PrintWriter writer=(PrintWriter)e.next();\n writer.print(message);\n if (writer.checkError()) {\n ce.remove();\n e.remove();\n }\n }\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "6367677f1a6d9265ec018347"}}
{"sample_uid": "codereval_java::6367670a1a6d9265ec0179e8", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Defensive programming technique to change a null reference to an empty one.
This method returns an empty array for a null input array.
As a memory optimizing technique an empty array passed in will be overridden with the empty public static references in this class.
null or empty\n * @return the same array, public static empty array if null or empty input\n * @since 2.5\n */\npublic static Boolean[] nullToEmpty(final Boolean[] array){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public static Boolean[] nullToEmpty(final Boolean[] array){\n if (array == null || array.length == 0) {\n return ArrayUtils.EMPTY_BOOLEAN_OBJECT_ARRAY;\n }\n return array;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "6367670a1a6d9265ec0179e8"}}
{"sample_uid": "codereval_java::6367677f1a6d9265ec01834b", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Place a {@link LoggingEvent} in the buffer. If the buffer is fullthen the event is silently dropped. It is the caller's responsability to make sure that the buffer has free space. \n */\npublic void put(LoggingEvent o){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public void put(LoggingEvent o){\n if (numElements != maxSize) {\n buf[next]=o;\n if (++next == maxSize) {\n next=0;\n }\n numElements++;\n }\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "6367677f1a6d9265ec01834b"}}
{"sample_uid": "codereval_java::636767df1a6d9265ec018744", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Split time ranges to insure the start time and end time is small then {@link #FETCH_DATA_DURATION}\n */\nprotected ListConverts an array of object Bytes to primitives.
This method returns null for a null input array.
Byte array, may be null\n * @return a byte array, null if null array input\n * @throws NullPointerException if array content is null\n */\npublic static byte[] toPrimitive(final Byte[] array){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public static byte[] toPrimitive(final Byte[] array){\n if (array == null) {\n return null;\n }\n else if (array.length == 0) {\n return ArrayUtils.EMPTY_BYTE_ARRAY;\n }\n final byte[] result=new byte[array.length];\n for (int i=0; i < array.length; i++) {\n result[i]=array[i].byteValue();\n }\n return result;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767031a6d9265ec0178e6"}}
{"sample_uid": "codereval_java::636767dc1a6d9265ec0186be", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Follow the dayStep to re-format the time bucket literal long value. Such as, in dayStep == 11, 20000105 re-formatted time bucket is 20000101, 20000115 re-formatted time bucket is 20000112, 20000123 re-formatted time bucket is 20000123\n */\nstatic long compressTimeBucket(long timeBucket,int dayStep){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "static long compressTimeBucket(long timeBucket,int dayStep){\n if (dayStep > 1) {\n DateTime time=TIME_BUCKET_FORMATTER.parseDateTime(\"\" + timeBucket);\n int days=Days.daysBetween(DAY_ONE,time).getDays();\n int groupBucketOffset=days % dayStep;\n return Long.parseLong(time.minusDays(groupBucketOffset).toString(TIME_BUCKET_FORMATTER));\n }\n else {\n return timeBucket;\n }\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767dc1a6d9265ec0186be"}}
{"sample_uid": "codereval_java::636767a41a6d9265ec01856c", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Computes the size of the utf8 string beginning at the specified {@code index} with the specified {@code length}.\n */\npublic static int computeUTF8Size(final CharSequence str,final int index,final int len){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public static int computeUTF8Size(final CharSequence str,final int index,final int len){\n int size=len;\n for (int i=index; i < len; i++) {\n final char c=str.charAt(i);\n if (c < 0x0080) continue;\n if (c < 0x0800) size++;\n else size+=2;\n }\n return size;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767a41a6d9265ec01856c"}}
{"sample_uid": "codereval_java::636766f01a6d9265ec017639", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Array to List. Works like {@link Arrays#asList(Object)}, but handles null arrays.\n * @return a list backed by the array.\n */\npublic static Reverses a String as per {@link StringBuilder#reverse()}. A Append to the Checks whether the Check if a String ends with a specified suffix (optionally case insensitive). Defensive programming technique to change a This method returns an empty array for a As a memory optimizing technique an empty array passed in will be overridden with the empty The returned value is the value that was pushed last. If no context is available, then the empty string \"\" is returned.\n * @return String The innermost diagnostic context.\n */\npublic static String peek(){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public static String peek(){\n Stack stack=getCurrentStack();\n if (stack != null && !stack.isEmpty()) return ((DiagnosticContext)stack.peek()).message;\n else return \"\";\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767831a6d9265ec0183c9"}}
{"sample_uid": "codereval_java::636767de1a6d9265ec01871c", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Accumulate the value with existing value in the same given key.\n */\npublic void valueAccumulation(String key,Long value){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public void valueAccumulation(String key,Long value){\n Long element=data.get(key);\n if (element == null) {\n element=value;\n }\n else {\n element+=value;\n }\n data.put(key,element);\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767de1a6d9265ec01871c"}}
{"sample_uid": "codereval_java::636766811a6d9265ec017496", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Return the next {@link java.io.File} object or {@code null} if no more files areavailable.\n */\npublic InputStream next() throws IOException {", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public InputStream next() throws IOException {\n if (stack.isEmpty()) {\n current=null;\n return null;\n }\n else {\n current=stack.removeLast();\n return current;\n }\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636766811a6d9265ec017496"}}
{"sample_uid": "codereval_java::6367677e1a6d9265ec01832e", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Check if the named logger exists in the hierarchy. If so return its reference, otherwise returns Defensive programming technique to change a This method returns an empty array for a As a memory optimizing technique an empty array passed in will be overridden with the empty Checks if an array of primitive doubles is empty or Using this method to copy string arrays means that changes to the src array do not modify the dst array.\n */\nprivate static String[] copyStrings(final String[] src){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "private static String[] copyStrings(final String[] src){\n String[] dst=new String[src.length];\n for (int i=0; i < src.length; ++i) {\n dst[i]=src[i].toLowerCase();\n }\n return dst;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767041a6d9265ec0178f8"}}
{"sample_uid": "codereval_java::636767521a6d9265ec017ecc", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Split a box along the x axis into two equal boxes.\n * @param box the box to split\n * @return a pair with the two resulting boxes\n */\npublic static Pair Checks if a Converts an array of object Doubles to primitives. This method returns Convert the input object into a java.lang.Character. Converts the Character to a char handling Unescapes any Java literals found in the Utility method for {@link #createNumber(String)}. Returns Case of value is unimportant. \n */\npublic static boolean toBoolean(String value,boolean dEfault){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public static boolean toBoolean(String value,boolean dEfault){\n if (value == null) return dEfault;\n String trimmedVal=value.trim();\n if (\"true\".equalsIgnoreCase(trimmedVal)) return true;\n if (\"false\".equalsIgnoreCase(trimmedVal)) return false;\n return dEfault;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "6367677d1a6d9265ec0182fd"}}
{"sample_uid": "codereval_java::6367676a1a6d9265ec0181cd", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Trim leading whitespace from the given String.\n * @param str the String to check\n * @return the trimmed String\n * @see java.lang.Character#isWhitespace\n */\npublic static String trimLeadingWhitespace(String str){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public static String trimLeadingWhitespace(String str){\n if (!hasLength(str)) {\n return str;\n }\n StringBuilder sb=new StringBuilder(str);\n while (sb.length() > 0 && Character.isWhitespace(sb.charAt(0))) {\n sb.deleteCharAt(0);\n }\n return sb.toString();\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "6367676a1a6d9265ec0181cd"}}
{"sample_uid": "codereval_java::636766fe1a6d9265ec01782a", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Reads a CONSTANT_Utf8 constant pool entry in {@link #classFileBuffer}.\n * @param constantPoolEntryIndex the index of a CONSTANT_Utf8 entry in the class's constant pooltable.\n * @param charBuffer the buffer to be used to read the string. This buffer must be sufficientlylarge. It is not automatically resized.\n * @return the String corresponding to the specified CONSTANT_Utf8 entry.\n */\nfinal String readUtf(final int constantPoolEntryIndex,final char[] charBuffer){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "final String readUtf(final int constantPoolEntryIndex,final char[] charBuffer){\n String value=constantUtf8Values[constantPoolEntryIndex];\n if (value != null) {\n return value;\n }\n int cpInfoOffset=cpInfoOffsets[constantPoolEntryIndex];\n return constantUtf8Values[constantPoolEntryIndex]=readUtf(cpInfoOffset + 2,readUnsignedShort(cpInfoOffset),charBuffer);\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636766fe1a6d9265ec01782a"}}
{"sample_uid": "codereval_java::636766851a6d9265ec01751b", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Helper to decode half of a hexadecimal number from a string.\n * @param c The ASCII character of the hexadecimal number to decode.Must be in the range {@code [0-9a-fA-F]}.\n * @return The hexadecimal value represented in the ASCII charactergiven, or {@link Character#MAX_VALUE} if the character is invalid.\n */\nprivate static char decodeHexNibble(final char c){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "private static char decodeHexNibble(final char c){\n if ('0' <= c && c <= '9') {\n return (char)(c - '0');\n }\n else if ('a' <= c && c <= 'f') {\n return (char)(c - 'a' + 10);\n }\n else if ('A' <= c && c <= 'F') {\n return (char)(c - 'A' + 10);\n }\n else {\n return Character.MAX_VALUE;\n }\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636766851a6d9265ec01751b"}}
{"sample_uid": "codereval_java::636766f21a6d9265ec01767d", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Object to String ,when null object then null else return toString(); \n */\npublic static String toString(Object object){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public static String toString(Object object){\n return (object == null) ? null : object.toString();\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636766f21a6d9265ec01767d"}}
{"sample_uid": "codereval_java::636767581a6d9265ec017fc4", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Calculate the factorial of $n$.\n * @param n the input number\n * @return the factorial\n */\npublic static long factorial(int n){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public static long factorial(int n){\n long multi=1;\n for (int i=1; i <= n; i++) {\n multi=multi * i;\n }\n return multi;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767581a6d9265ec017fc4"}}
{"sample_uid": "codereval_java::636767511a6d9265ec017eb6", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * 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.\n * @param predicate the condition the desired node should satisfy\n * @param start the node to start the search from\n * @param stop the node to end the search with\n * @param dir the direction to start the traversal in\n * @return a circulator to the node satisfying the {@code predicate} or to the {@code stop} node\n */\nprivate OuterFaceCirculator selectOnOuterFace(Predicate Note for Java 7 and later: this method should be treated as deprecated; use the equivalent {@link Long#compare} method instead.\n * @param a the first {@code long} to compare\n * @param b the second {@code long} to compare\n * @return a negative value if {@code a} is less than {@code b}; a positive value if {@code a} is greater than{@code b}; or zero if they are equal\n */\nprivate static int compareSigned(long a,long b){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "private static int compareSigned(long a,long b){\n return (a < b) ? -1 : ((a > b) ? 1 : 0);\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767a41a6d9265ec01857e"}}
{"sample_uid": "codereval_java::636767691a6d9265ec0181ae", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Copy the given Enumeration into a String array. The Enumeration must contain String elements only.\n * @param enumeration the Enumeration to copy\n * @return the String array (null String returns null. StringUtils.reverse(null) = null StringUtils.reverse(\"\") = \"\" StringUtils.reverse(\"bat\") = \"tab\"
\n * @param str the String to reverse, may be null\n * @return the reversed String, null if null String input\n */\npublic static String reverse(final String str){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public static String reverse(final String str){\n if (str == null) {\n return null;\n }\n return new StringBuilder(str).reverse().toString();\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767001a6d9265ec017873"}}
{"sample_uid": "codereval_java::636766ff1a6d9265ec01783b", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Gets a substring from the specified String avoiding exceptions. \n */\npublic static String sub(String str,int start,int end){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public static String sub(String str,int start,int end){\n return StringUtils.substring(str,start,end);\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636766ff1a6d9265ec01783b"}}
{"sample_uid": "codereval_java::6367671a1a6d9265ec017c15", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Puts an array of bytes into this byte vector. The byte vector is automatically enlarged if necessary.\n * @param byteArrayValue an array of bytes. May be {@literal null} to put {@code byteLength} nullbytes into this byte vector.\n * @param byteOffset index of the first byte of byteArrayValue that must be copied.\n * @param byteLength number of bytes of byteArrayValue that must be copied.\n * @return this byte vector.\n */\npublic ByteVector putByteArray(final byte[] byteArrayValue,final int byteOffset,final int byteLength){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public ByteVector putByteArray(final byte[] byteArrayValue,final int byteOffset,final int byteLength){\n if (length + byteLength > data.length) {\n enlarge(byteLength);\n }\n if (byteArrayValue != null) {\n System.arraycopy(byteArrayValue,byteOffset,data,length,byteLength);\n }\n length+=byteLength;\n return this;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "6367671a1a6d9265ec017c15"}}
{"sample_uid": "codereval_java::636766821a6d9265ec0174d2", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Wrap an {@link HttpServletRequest}.\n * @param request {@link HttpServletRequest}\n * @return an {@link AtmosphereRequest}\n */\npublic static AtmosphereRequest wrap(HttpServletRequest request){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public static AtmosphereRequest wrap(HttpServletRequest request){\n if (AtmosphereRequestImpl.class.isAssignableFrom(request.getClass())) {\n return (AtmosphereRequestImpl)request;\n }\n Builder b=new Builder();\n Enumerationkey in props. Then perform variable substitution on the found value.\n */\npublic static String findAndSubst(String key,Properties props){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public static String findAndSubst(String key,Properties props){\n String value=props.getProperty(key);\n if (value == null) return null;\n try {\n return substVars(value,props);\n }\n catch ( IllegalArgumentException e) {\n LogLog.error(\"Bad option value [\" + value + \"].\",e);\n return value;\n }\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767791a6d9265ec01826d"}}
{"sample_uid": "codereval_java::636767001a6d9265ec01787f", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * toString the detail of an int array.StringBuffer to populate\n * @param fieldName the field name, typically not used as already appended\n * @param array the array to add to the toString,not null\n */\nprotected void appendDetail(StringBuffer buffer,String fieldName,int[] array){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "protected void appendDetail(StringBuffer buffer,String fieldName,int[] array){\n buffer.append(arrayStart);\n for (int i=0; i < array.length; i++) {\n if (i > 0) {\n buffer.append(arraySeparator);\n }\n appendDetail(buffer,fieldName,array[i]);\n }\n buffer.append(arrayEnd);\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767001a6d9265ec01787f"}}
{"sample_uid": "codereval_java::636766fe1a6d9265ec017834", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Session ID. \n */\npublic static String sessionId(){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public static String sessionId(){\n HttpSession httpSession=servletSession();\n if (httpSession == null) {\n return null;\n }\n return httpSession.getId();\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636766fe1a6d9265ec017834"}}
{"sample_uid": "codereval_java::636766ff1a6d9265ec01784b", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * String contains only digit characters.Null and empty String will return false.String to check\n * @return true if str contains only unicode numeric\n */\npublic static boolean isDigits(String str){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public static boolean isDigits(String str){\n if ((str == null) || (str.length() == 0)) {\n return false;\n }\n for (int i=0; i < str.length(); i++) {\n if (!Character.isDigit(str.charAt(i))) {\n return false;\n }\n }\n return true;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636766ff1a6d9265ec01784b"}}
{"sample_uid": "codereval_java::636766fc1a6d9265ec0177da", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Determine whether a parameter name ends at the current position, that is, whether the given character qualifies as a separator. \n */\nprivate static boolean isParameterSeparator(final char c){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "private static boolean isParameterSeparator(final char c){\n if (Character.isWhitespace(c)) {\n return true;\n }\n for ( char separator : PARAMETER_SEPARATORS) {\n if (c == separator) {\n return true;\n }\n }\n return false;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636766fc1a6d9265ec0177da"}}
{"sample_uid": "codereval_java::6367670c1a6d9265ec017a35", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * true if the String starts with the prefix orboth null\n */\nprivate static boolean endsWith(final String str,final String suffix,final boolean ignoreCase){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "private static boolean endsWith(final String str,final String suffix,final boolean ignoreCase){\n if (str == null || suffix == null) {\n return str == null && suffix == null;\n }\n if (suffix.length() > str.length()) {\n return false;\n }\n int strOffset=str.length() - suffix.length();\n return str.regionMatches(ignoreCase,strOffset,suffix,0,suffix.length());\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "6367670c1a6d9265ec017a35"}}
{"sample_uid": "codereval_java::6367667f1a6d9265ec01745d", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Decode the path component of a URI as path segments.\n * @param u the URI. If the path component is an absolute path componentthen the leading '/' is ignored and is not considered a delimiator of a path segment.\n * @param decode true if the path segments of the path componentshould be in decoded form.\n * @return the list of path segments.\n */\npublic static Listnull reference to an empty one.null input array.public static references in this class.null or empty\n * @return the same array, public static empty array if null or empty input\n * @since 2.5\n */\npublic static Character[] nullToEmpty(final Character[] array){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public static Character[] nullToEmpty(final Character[] array){\n if (array == null || array.length == 0) {\n return ArrayUtils.EMPTY_CHARACTER_OBJECT_ARRAY;\n }\n return array;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636766f11a6d9265ec017651"}}
{"sample_uid": "codereval_java::636767821a6d9265ec0183ab", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * @return true if getThrown().toString() is a non-empty string.\n */\npublic boolean hasThrown(){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public boolean hasThrown(){\n Throwable thrown=getThrown();\n if (thrown == null) {\n return false;\n }\n String thrownString=thrown.toString();\n return thrownString != null && thrownString.trim().length() != 0;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767821a6d9265ec0183ab"}}
{"sample_uid": "codereval_java::636767831a6d9265ec0183c9", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Looks at the last diagnostic context at the top of this NDC without removing it. null.\n * @param name The name of the logger to search for.\n */\npublic Logger exists(String name){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public Logger exists(String name){\n Object o=ht.get(new CategoryKey(name));\n if (o instanceof Logger) {\n return (Logger)o;\n }\n else {\n return null;\n }\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "6367677e1a6d9265ec01832e"}}
{"sample_uid": "codereval_java::6367670a1a6d9265ec0179e7", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Look up and return any registered {@link Converter} for the specifieddestination class; if there is no registered Converter, return null.\n * @param clazz Class for which to return a registered Converter\n * @return The registered {@link Converter} or null if not found\n */\npublic Converter lookup(final Class> clazz){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public Converter lookup(final Class> clazz){\n Converter conv=(Converter)this.converters.get(clazz);\n if (conv != null) {\n return conv;\n }\n for ( Object regType : this.converters.keySet()) {\n if (((Class>)regType).isAssignableFrom(clazz)) {\n return (Converter)this.converters.get(regType);\n }\n }\n return null;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "6367670a1a6d9265ec0179e7"}}
{"sample_uid": "codereval_java::636767a41a6d9265ec018572", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Read a raw Varint from the stream.\n */\npublic long readRawVarint64() throws IOException {", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public long readRawVarint64() throws IOException {\n int shift=0;\n long result=0;\n while (shift < 64) {\n final byte b=readRawByte();\n result|=(long)(b & 0x7F) << shift;\n if ((b & 0x80) == 0) {\n return result;\n }\n shift+=7;\n }\n throw ProtobufException.malformedVarint();\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767a41a6d9265ec018572"}}
{"sample_uid": "codereval_java::636767021a6d9265ec0178bb", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * null reference to an empty one.null input array.public static references in this class.null or empty\n * @return the same array, public static empty array if null or empty input\n * @since 2.5\n */\npublic static Double[] nullToEmpty(final Double[] array){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public static Double[] nullToEmpty(final Double[] array){\n if (array == null || array.length == 0) {\n return ArrayUtils.EMPTY_DOUBLE_OBJECT_ARRAY;\n }\n return array;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767021a6d9265ec0178bb"}}
{"sample_uid": "codereval_java::636767021a6d9265ec0178b2", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Pops as many abstract types from the output frame stack as described by the given descriptor.\n * @param descriptor a type or method descriptor (in which case its argument types are popped).\n */\nprivate void pop(final String descriptor){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "private void pop(final String descriptor){\n char firstDescriptorChar=descriptor.charAt(0);\n if (firstDescriptorChar == '(') {\n pop((Type.getArgumentsAndReturnSizes(descriptor) >> 2) - 1);\n }\n else if (firstDescriptorChar == 'J' || firstDescriptorChar == 'D') {\n pop(2);\n }\n else {\n pop(1);\n }\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767021a6d9265ec0178b2"}}
{"sample_uid": "codereval_java::636766f91a6d9265ec01776e", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Writes len bytes from the specified byte array starting at offset off to this byte array output stream.\n * @param b the data.\n * @param off the start offset in the data.\n * @param len the number of bytes to write.\n */\n@Override public void write(final byte b[],final int off,final int len) throws IOException {", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "@Override public void write(final byte b[],final int off,final int len) throws IOException {\n if (off < 0 || off > b.length || len < 0 || off + len > b.length || off + len < 0) {\n throw new IndexOutOfBoundsException();\n }\n else if (len == 0) {\n return;\n }\n if (this.count + len > this.buf.length) {\n this.encodePendingBytes(false);\n }\n System.arraycopy(b,off,this.buf,this.count,len);\n this.count+=len;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636766f91a6d9265ec01776e"}}
{"sample_uid": "codereval_java::636767551a6d9265ec017f3f", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Swaps the two elements at the specified indices in the given array.\n * @param < V > the type of elements in the array\n * @param arr the array\n * @param i the index of the first element\n * @param j the index of the second element\n */\npublic static final null.true if the array is empty or null\n * @since 2.1\n */\npublic static boolean isEmpty(final double[] array){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public static boolean isEmpty(final double[] array){\n return array == null || array.length == 0;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636766f01a6d9265ec01762e"}}
{"sample_uid": "codereval_java::6367667e1a6d9265ec01743a", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * The last time, in milliseconds, a write operation occurred.\n * @return this\n */\npublic long lastWriteTimeStampInMilliseconds(){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public long lastWriteTimeStampInMilliseconds(){\n return lastWrite == -1 ? System.currentTimeMillis() : lastWrite;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "6367667e1a6d9265ec01743a"}}
{"sample_uid": "codereval_java::636767601a6d9265ec0180fd", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Add an edge to the index.\n * @param sourceVertex the source vertex\n * @param targetVertex the target vertex\n * @param e the edge\n */\nprotected void addToIndex(V sourceVertex,V targetVertex,E e){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "protected void addToIndex(V sourceVertex,V targetVertex,E e){\n Pairtrue if the specified appender is in the list of attached appenders, false otherwise.\n * @since 1.2 \n */\npublic boolean isAttached(Appender appender){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public boolean isAttached(Appender appender){\n if (appenderList == null || appender == null) return false;\n int size=appenderList.size();\n Appender a;\n for (int i=0; i < size; i++) {\n a=(Appender)appenderList.elementAt(i);\n if (a == appender) return true;\n }\n return false;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767781a6d9265ec018238"}}
{"sample_uid": "codereval_java::6367674a1a6d9265ec017dab", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Compares two floating point values. Returns 0 if they are equal, -1 if {@literal o1 < o2}, 1 otherwise\n * @param o1 the first value\n * @param o2 the second value\n * @return 0 if they are equal, -1 if {@literal o1 < o2}, 1 otherwise\n */\n@Override public int compare(Double o1,Double o2){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "@Override public int compare(Double o1,Double o2){\n if (Math.abs(o1 - o2) < epsilon) {\n return 0;\n }\n else {\n return Double.compare(o1,o2);\n }\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "6367674a1a6d9265ec017dab"}}
{"sample_uid": "codereval_java::6367672d1a6d9265ec017c78", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Inserts a value to the set. Returns true if the set did not already contain the specified element. \n */\npublic boolean insert(int val){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public boolean insert(int val){\n if (!map.containsKey(val)) {\n map.put(val,val);\n values.add(val);\n return true;\n }\n else {\n return false;\n }\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "6367672d1a6d9265ec017c78"}}
{"sample_uid": "codereval_java::636767dc1a6d9265ec0186c6", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Returns ture when the input fields have already been stored in the properties.\n */\nprivate boolean containsAllFields(Fields fields){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "private boolean containsAllFields(Fields fields){\n if (this.properties.size() < fields.properties.size()) {\n return false;\n }\n boolean isContains=fields.properties.entrySet().stream().allMatch(item -> Objects.equals(properties.get(item.getKey()),item.getValue()));\n if (!isContains) {\n return false;\n }\n return fields.source.getExcludes().containsAll(this.source.getExcludes());\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767dc1a6d9265ec0186c6"}}
{"sample_uid": "codereval_java::636766821a6d9265ec0174bf", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Reverse of Introspector.decapitalize\n */\npublic static String capitalize(String name){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public static String capitalize(String name){\n if (name == null || name.length() == 0) {\n return name;\n }\n char chars[]=name.toCharArray();\n chars[0]=Character.toUpperCase(chars[0]);\n return new String(chars);\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636766821a6d9265ec0174bf"}}
{"sample_uid": "codereval_java::636767aa1a6d9265ec01865a", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Writes the contents of the {@link LinkedBuffer} into the {@link DataOutput}.\n * @return the total content size of the buffer.\n */\npublic static int writeTo(final DataOutput out,LinkedBuffer node) throws IOException {", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public static int writeTo(final DataOutput out,LinkedBuffer node) throws IOException {\n int contentSize=0, len;\n do {\n if ((len=node.offset - node.start) > 0) {\n out.write(node.buffer,node.start,len);\n contentSize+=len;\n }\n }\n while ((node=node.next) != null);\n return contentSize;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767aa1a6d9265ec01865a"}}
{"sample_uid": "codereval_java::636766f21a6d9265ec017677", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Boolean value is not true, handling null by returning true. BooleanUtils.isNotTrue(Boolean.TRUE) = false BooleanUtils.isNotTrue(Boolean.FALSE) = true BooleanUtils.isNotTrue(null) = true
\n * @param bool the boolean to check, null returns true\n * @return true if the input is null or false\n * @since 2.3\n */\npublic static boolean isNotTrue(Boolean bool){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public static boolean isNotTrue(Boolean bool){\n return !isTrue(bool);\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636766f21a6d9265ec017677"}}
{"sample_uid": "codereval_java::6367674f1a6d9265ec017e74", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Returns a textual representation of the queue.\n * @return a textual representation of the queue.\n */\npublic String toString(){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public String toString(){\n StringBuilder s=new StringBuilder();\n for (int j=i; j < n; j++) s.append(vs[j]).append(\" \");\n return s.toString();\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "6367674f1a6d9265ec017e74"}}
{"sample_uid": "codereval_java::6367675c1a6d9265ec018058", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Create a string supplier which returns unique strings. The returns strings are simply integers starting from start.\n * @param start where to start the sequence\n * @return a string supplier\n */\n@SuppressWarnings(\"unchecked\") public static Suppliernull for a null input array.Double array, may be null\n * @return a double array, null if null array input\n * @throws NullPointerException if array content is null\n */\npublic static double[] toPrimitive(final Double[] array){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public static double[] toPrimitive(final Double[] array){\n if (array == null) {\n return null;\n }\n else if (array.length == 0) {\n return ArrayUtils.EMPTY_DOUBLE_ARRAY;\n }\n final double[] result=new double[array.length];\n for (int i=0; i < array.length; i++) {\n result[i]=array[i].doubleValue();\n }\n return result;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636766ff1a6d9265ec017842"}}
{"sample_uid": "codereval_java::636766fa1a6d9265ec0177a9", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Adds an abstract type to the list of types on which a constructor is invoked in the basic block.\n * @param abstractType an abstract type on a which a constructor is invoked.\n */\nprivate void addInitializedType(final int abstractType){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "private void addInitializedType(final int abstractType){\n if (initializations == null) {\n initializations=new int[2];\n }\n int initializationsLength=initializations.length;\n if (initializationCount >= initializationsLength) {\n int[] newInitializations=new int[Math.max(initializationCount + 1,2 * initializationsLength)];\n System.arraycopy(initializations,0,newInitializations,0,initializationsLength);\n initializations=newInitializations;\n }\n initializations[initializationCount++]=abstractType;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636766fa1a6d9265ec0177a9"}}
{"sample_uid": "codereval_java::6367670a1a6d9265ec0179dc", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Puts some abstract types of {@link #currentFrame} in {@link #stackMapTableEntries} , using theJVMS verification_type_info format used in StackMapTable attributes.\n * @param start index of the first type in {@link #currentFrame} to write.\n * @param end index of last type in {@link #currentFrame} to write (exclusive).\n */\nprivate void putAbstractTypes(final int start,final int end){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "private void putAbstractTypes(final int start,final int end){\n for (int i=start; i < end; ++i) {\n Frame.putAbstractType(symbolTable,currentFrame[i],stackMapTableEntries);\n }\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "6367670a1a6d9265ec0179dc"}}
{"sample_uid": "codereval_java::636766801a6d9265ec017482", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Clear and fill the buffer of this {@code ClassFileBuffer} with thesupplied byte stream. The read pointer is reset to the start of the byte array.\n */\npublic void readFrom(final InputStream in) throws IOException {", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public void readFrom(final InputStream in) throws IOException {\n pointer=0;\n size=0;\n int n;\n do {\n n=in.read(buffer,size,buffer.length - size);\n if (n > 0) {\n size+=n;\n }\n resizeIfNeeded();\n }\n while (n >= 0);\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636766801a6d9265ec017482"}}
{"sample_uid": "codereval_java::6367670a1a6d9265ec0179d8", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * @see OutputStream#write(byte[]) \n */\n@Override public void write(final byte[] b) throws IOException {", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "@Override public void write(final byte[] b) throws IOException {\n if (this.encoding == null) {\n this.writer.write(new String(b));\n }\n else {\n this.writer.write(new String(b,this.encoding));\n }\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "6367670a1a6d9265ec0179d8"}}
{"sample_uid": "codereval_java::636766a81a6d9265ec01757b", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Serialize to JSON {@link String}\n * @param features features to be enabled in serialization\n * @return JSON {@link String}\n */\n@SuppressWarnings(\"unchecked\") public String toString(JSONWriter.Feature... features){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "@SuppressWarnings(\"unchecked\") public String toString(JSONWriter.Feature... features){\n try (JSONWriter writer=JSONWriter.of(features)){\n if ((writer.context.features & NONE_DIRECT_FEATURES) == 0) {\n writer.write(this);\n }\n else {\n writer.setRootObject(this);\n if (arrayWriter == null) {\n arrayWriter=writer.getObjectWriter(JSONArray.class,JSONArray.class);\n }\n arrayWriter.write(writer,this,null,null,0);\n }\n return writer.toString();\n }\n }\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636766a81a6d9265ec01757b"}}
{"sample_uid": "codereval_java::636767021a6d9265ec0178bf", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * >= desiredCapacity and very close to desiredCapacity (within 11% if desiredCapacity >= 1000).\n * @param desiredCapacity the capacity desired by the user.\n * @return the capacity which should be used for a hashtable.\n */\npublic static int nextPrime(int desiredCapacity){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public static int nextPrime(int desiredCapacity){\n if (desiredCapacity >= largestPrime) {\n return largestPrime;\n }\n int i=Arrays.binarySearch(primeCapacities,desiredCapacity);\n if (i < 0) {\n i=-i - 1;\n }\n return primeCapacities[i];\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636766a81a6d9265ec01758e"}}
{"sample_uid": "codereval_java::6367670a1a6d9265ec0179cf", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * null. CharUtils.toChar(null, 'X') = 'X' CharUtils.toChar(' ', 'X') = ' ' CharUtils.toChar('A', 'X') = 'A' \n * @param ch the character to convert\n * @param defaultValue the value to use if the Character is null\n * @return the char value of the Character or the default if null\n */\npublic static char toChar(final Character ch,final char defaultValue){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public static char toChar(final Character ch,final char defaultValue){\n if (ch == null) {\n return defaultValue;\n }\n return ch.charValue();\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "6367670a1a6d9265ec0179cf"}}
{"sample_uid": "codereval_java::6367676b1a6d9265ec0181e2", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Return the first element in 'candidates' that is contained in 'source'. If no element in 'candidates' is present in 'source' returns null. Iteration order is {@link Collection} implementation specific.\n * @param source the source Collection\n * @param candidates the candidates to search for\n * @return the first present object, or null if not found\n */\npublic static Object findFirstMatch(Collection source,Collection candidates){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public static Object findFirstMatch(Collection source,Collection candidates){\n if (isEmpty(source) || isEmpty(candidates)) {\n return null;\n }\n for ( Object candidate : candidates) {\n if (source.contains(candidate)) {\n return candidate;\n }\n }\n return null;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "6367676b1a6d9265ec0181e2"}}
{"sample_uid": "codereval_java::6367676b1a6d9265ec0181ee", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Trim trailing whitespace from the given String.\n * @param str the String to check\n * @return the trimmed String\n * @see java.lang.Character#isWhitespace\n */\npublic static String trimTrailingWhitespace(String str){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public static String trimTrailingWhitespace(String str){\n if (!hasLength(str)) {\n return str;\n }\n StringBuilder sb=new StringBuilder(str);\n while (sb.length() > 0 && Character.isWhitespace(sb.charAt(sb.length() - 1))) {\n sb.deleteCharAt(sb.length() - 1);\n }\n return sb.toString();\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "6367676b1a6d9265ec0181ee"}}
{"sample_uid": "codereval_java::636767dc1a6d9265ec0186cb", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * initialize config, such as check dist path\n */\npublic void init(){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public void init(){\n File dist=new File(analyzeResultDist);\n if (!dist.exists()) {\n dist.mkdirs();\n return;\n }\n if (dist.isFile()) {\n throw new IllegalArgumentException(analyzeResultDist + \" must be a directory\");\n }\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767dc1a6d9265ec0186cb"}}
{"sample_uid": "codereval_java::636767a31a6d9265ec018552", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Read a {@code string} field value from the stream.\n */\n@Override public String readString() throws IOException {", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "@Override public String readString() throws IOException {\n final int size=readRawVarint32();\n if (size <= (bufferSize - bufferPos) && size > 0) {\n final String result=STRING.deser(buffer,bufferPos,size);\n bufferPos+=size;\n return result;\n }\n else {\n return STRING.deser(readRawBytes(size));\n }\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767a31a6d9265ec018552"}}
{"sample_uid": "codereval_java::636767a61a6d9265ec0185b7", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * 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.\n */\nprivate static int digitValue(final char c){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "private static int digitValue(final char c){\n if ('0' <= c && c <= '9') {\n return c - '0';\n }\n else if ('a' <= c && c <= 'z') {\n return c - 'a' + 10;\n }\n else {\n return c - 'A' + 10;\n }\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767a61a6d9265ec0185b7"}}
{"sample_uid": "codereval_java::636767e01a6d9265ec018755", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * build content,if it has ats someone set the ats\n */\nprivate MapString. For example, it will turn a sequence of '\\' and 'n' into a newline character, unless the '\\' is preceded by another '\\'.String to unescape, may be null\n * @return a new unescaped String, null if null string input\n */\npublic static String unescapeJava(String str) throws Exception {", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public static String unescapeJava(String str) throws Exception {\n if (str == null) {\n return null;\n }\n StringWriter writer=new StringWriter(str.length());\n unescapeJava(writer,str);\n return writer.toString();\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "6367667d1a6d9265ec017401"}}
{"sample_uid": "codereval_java::636766f01a6d9265ec01763e", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Translate a MIME standard character set name into the Java equivalent.\n * @param charset The MIME standard name.\n * @return The Java equivalent for this name.\n */\nprivate static String javaCharset(String charset){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "private static String javaCharset(String charset){\n if (charset == null) {\n return null;\n }\n String mappedCharset=MIME2JAVA.get(charset.toLowerCase(Locale.ENGLISH));\n if (mappedCharset == null) {\n return charset;\n }\n return mappedCharset;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636766f01a6d9265ec01763e"}}
{"sample_uid": "codereval_java::6367676a1a6d9265ec0181bf", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Turn the given Object into a String with single quotes if it is a String; keeping the Object as-is else.\n * @param obj the input Object (e.g. \"myString\")\n * @return the quoted String (e.g. \"'myString'\"),or the input object as-is if not a String\n */\npublic static Object quoteIfString(Object obj){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public static Object quoteIfString(Object obj){\n return (obj instanceof String ? quote((String)obj) : obj);\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "6367676a1a6d9265ec0181bf"}}
{"sample_uid": "codereval_java::636767501a6d9265ec017e86", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * {@inheritDoc}\n */\n@Override public ListNodenull.\n * @param newArrayComponentType If array is null, create asize 1 array of this type.\n * @return A new copy of the array of size 1 greater than the input.\n */\nprivate static Object copyArrayGrow1(final Object array,final Class> newArrayComponentType){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "private static Object copyArrayGrow1(final Object array,final Class> newArrayComponentType){\n if (array != null) {\n int arrayLength=Array.getLength(array);\n Object newArray=Array.newInstance(array.getClass().getComponentType(),arrayLength + 1);\n System.arraycopy(array,0,newArray,0,arrayLength);\n return newArray;\n }\n return Array.newInstance(newArrayComponentType,1);\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767031a6d9265ec0178ef"}}
{"sample_uid": "codereval_java::636767431a6d9265ec017c8d", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Computes floor($\\log_2 (n)$) $+ 1$\n */\nprivate int computeBinaryLog(int n){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "private int computeBinaryLog(int n){\n assert n >= 0;\n int result=0;\n while (n > 0) {\n n>>=1;\n ++result;\n }\n return result;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767431a6d9265ec017c8d"}}
{"sample_uid": "codereval_java::636767611a6d9265ec018116", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Efficient way to compute the intersection between two sets\n * @param set1 set $1$\n * @param set2 set $2$\n * @return intersection of set $1$ and $2$\n */\nprivate Setnull entries. Note that {@link Arrays#sort(Object[])} will throw an {@link NullPointerException} if an array element is null.\n * @param collection The collection to convert\n * @return A new array of Strings.\n */\nstatic String[] toNoNullStringArray(Collection> collection){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "static String[] toNoNullStringArray(Collection> collection){\n if (collection == null) {\n return ArrayUtils.EMPTY_STRING_ARRAY;\n }\n return toNoNullStringArray(collection.toArray());\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636766f71a6d9265ec017730"}}
{"sample_uid": "codereval_java::636767081a6d9265ec0179a2", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * true if s is null.null\n */\nprivate static boolean isAllZeros(String s){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "private static boolean isAllZeros(String s){\n if (s == null) {\n return true;\n }\n for (int i=s.length() - 1; i >= 0; i--) {\n if (s.charAt(i) != '0') {\n return false;\n }\n }\n return s.length() > 0;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767081a6d9265ec0179a2"}}
{"sample_uid": "codereval_java::636766821a6d9265ec0174b3", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Invoke the {@link BroadcastFilter}\n * @param msg\n * @return\n */\nprotected Object filter(Object msg){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "protected Object filter(Object msg){\n BroadcastAction a=bc.filter(msg);\n if (a.action() == BroadcastAction.ACTION.ABORT || msg == null) return null;\n else return a.message();\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636766821a6d9265ec0174b3"}}
{"sample_uid": "codereval_java::636767e01a6d9265ec018764", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Convert process properties to source data\n */\nprivate JsonObject convertProperties(Listvalue is \"true\", then true is returned. If value is \"false\", then true is returned. Otherwise, default is returned. event as the last event in the buffer.\n */\npublic void add(LoggingEvent event){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public void add(LoggingEvent event){\n ea[last]=event;\n if (++last == maxSize) last=0;\n if (numElems < maxSize) numElems++;\n else if (++first == maxSize) first=0;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767841a6d9265ec0183e8"}}
{"sample_uid": "codereval_java::636767a41a6d9265ec01857e", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Compares the two specified {@code long} values. The sign of the value returned is the same as that of{@code ((Long) a).compareTo(b)}. null if the passed-inEnumeration was null)\n */\npublic static String[] toStringArray(Enumeration