java_evaluation_benchmarks / codereval_java.jsonl
minhhien0811's picture
Add files using upload-large-folder tool
be69841 verified
{"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 <code>String.trim()</code> 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 * <p>Checks whether two arrays are the same length, treating <code>null</code> arrays as length <code>0</code>.</p>\n * @param array1 the first array, may be <code>null</code>\n * @param array2 the second array, may be <code>null</code>\n * @return <code>true</code> if length of arrays matches, treating<code>null</code> 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 * <p>Converts an array of object Booleans to primitives.</p> <p>This method returns <code>null</code> for a <code>null</code> input array.</p>\n * @param array a <code>Boolean</code> array, may be <code>null</code>\n * @return a <code>boolean</code> array, <code>null</code> if null array input\n * @throws NullPointerException if array content is <code>null</code>\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 * <p>Gets the <code>toString</code> of an <code>Object</code> returning an empty string (\"\") if <code>null</code> input.</p> <pre> ObjectUtils.toString(null) = \"\" ObjectUtils.toString(\"\") = \"\" ObjectUtils.toString(\"bat\") = \"bat\" ObjectUtils.toString(Boolean.TRUE) = \"true\" </pre>\n * @see StringUtils#defaultString(String)\n * @see String#valueOf(Object)\n * @param obj the Object to <code>toString</code>, may be null\n * @return the passed in Object's toString, or nullStr if <code>null</code> 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 <code>array</code> is <code>null</code>, 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 TreeNode<T> rotateRight(TreeNode<T> node){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "private TreeNode<T> rotateRight(TreeNode<T> node){\n TreeNode<T> left=node.left;\n left.parent=null;\n node.setLeftChild(left.right);\n left.setRightChild(node);\n node.updateHeightAndSubtreeSize();\n left.updateHeightAndSubtreeSize();\n return left;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767441a6d9265ec017cc1"}}
{"sample_uid": "codereval_java::6367667f1a6d9265ec01745c", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Add all the jar files in a dir to the classpath, represented as a Vector of URLs.\n */\n@SuppressWarnings(\"unchecked\") public static void addToClassPath(Vector<URL> cpV,String dir){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "@SuppressWarnings(\"unchecked\") public static void addToClassPath(Vector<URL> cpV,String dir){\n try {\n String cpComp[]=getFilesByExt(dir,\".jar\");\n if (cpComp != null) {\n int jarCount=cpComp.length;\n for (int i=0; i < jarCount; i++) {\n URL url=getURL(dir,cpComp[i]);\n if (url != null) cpV.addElement(url);\n }\n }\n }\n catch ( Exception ex) {\n logger.debug(\"failed to add urls to classpath\",ex);\n }\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "6367667f1a6d9265ec01745c"}}
{"sample_uid": "codereval_java::6367677e1a6d9265ec01830f", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Produces a formatted string as specified by the conversion pattern.\n */\npublic String format(LoggingEvent event){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public String format(LoggingEvent event){\n if (sbuf.capacity() > MAX_CAPACITY) {\n sbuf=new StringBuffer(BUF_SIZE);\n }\n else {\n sbuf.setLength(0);\n }\n PatternConverter c=head;\n while (c != null) {\n c.format(sbuf,event);\n c=c.next;\n }\n return sbuf.toString();\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "6367677e1a6d9265ec01830f"}}
{"sample_uid": "codereval_java::636767031a6d9265ec0178dd", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Retrieve the content length of the request.\n * @return The content length of the request.\n * @since 1.3\n */\npublic long contentLength(){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public long contentLength(){\n long size;\n try {\n size=Long.parseLong(request.getHeader(FileUpload.CONTENT_LENGTH));\n }\n catch ( NumberFormatException e) {\n size=request.getContentLength();\n }\n return size;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767031a6d9265ec0178dd"}}
{"sample_uid": "codereval_java::636766f11a6d9265ec017658", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Returns the index of the last directory separator character. <p> This method will handle a file in either Unix or Windows format. The position of the last forward or backslash is returned. <p> 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 <code>null</code>. 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 <code>b.length</code> 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 * <p>Converts a Boolean to a boolean handling <code>null</code> by returning <code>false</code>.</p> <pre> BooleanUtils.toBoolean(Boolean.TRUE) = true BooleanUtils.toBoolean(Boolean.FALSE) = false BooleanUtils.toBoolean(null) = false </pre>\n * @param bool the boolean to convert\n * @return <code>true</code> or <code>false</code>, <code>null</code> returns <code>false</code>\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 <V,E>IsomorphicGraphMapping<V,E> identity(Graph<V,E> graph){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public static <V,E>IsomorphicGraphMapping<V,E> identity(Graph<V,E> graph){\n Map<V,V> fMap=CollectionUtil.newHashMapWithExpectedSize(graph.vertexSet().size());\n Map<V,V> bMap=CollectionUtil.newHashMapWithExpectedSize(graph.vertexSet().size());\n for ( V v : graph.vertexSet()) {\n fMap.put(v,v);\n bMap.put(v,v);\n }\n return new IsomorphicGraphMapping<>(fMap,bMap,graph,graph);\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "6367675f1a6d9265ec0180d3"}}
{"sample_uid": "codereval_java::636766fe1a6d9265ec017833", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Schedules a file to be deleted when JVM exits. If file is directory delete it and all sub-directories.\n * @param file file or directory to delete, must not be {@code null}\n * @throws NullPointerException if the file is {@code null}\n * @throws IOException in case deletion is unsuccessful\n */\npublic static void forceDeleteOnExit(File file) throws IOException {", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public static void forceDeleteOnExit(File file) throws IOException {\n if (file.isDirectory()) {\n deleteDirectoryOnExit(file);\n }\n else {\n file.deleteOnExit();\n }\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636766fe1a6d9265ec017833"}}
{"sample_uid": "codereval_java::636767791a6d9265ec018257", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Add a log record message to be displayed in the LogTable. This method is thread-safe as it posts requests to the SwingThread rather than processing directly.\n */\npublic void addMessage(final LogRecord lr){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public void addMessage(final LogRecord lr){\n if (_isDisposed == true) {\n return;\n }\n SwingUtilities.invokeLater(new Runnable(){\n public void run(){\n _categoryExplorerTree.getExplorerModel().addLogRecord(lr);\n _table.getFilteredLogTableModel().addLogRecord(lr);\n updateStatusLabel();\n }\n }\n);\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767791a6d9265ec018257"}}
{"sample_uid": "codereval_java::636767641a6d9265ec01817d", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Construct a complete bipartite graph\n */\n@Override public void generateGraph(Graph<V,E> target,Map<String,V> resultMap){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "@Override public void generateGraph(Graph<V,E> target,Map<String,V> resultMap){\n for (int i=0; i < sizeA; i++) {\n partitionA.add(target.addVertex());\n }\n for (int i=0; i < sizeB; i++) {\n partitionB.add(target.addVertex());\n }\n for ( V u : partitionA) {\n for ( V v : partitionB) {\n target.addEdge(u,v);\n }\n }\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767641a6d9265ec01817d"}}
{"sample_uid": "codereval_java::636766ff1a6d9265ec017851", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Searches for a byte of specified value in the <code>buffer</code>, starting at the specified <code>position</code>.\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 the<code>buffer</code>, or <code>-1</code> 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 <T>int writeDelimitedTo(OutputStream out,T message,Schema<T> schema,LinkedBuffer buffer) throws IOException {", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public static <T>int writeDelimitedTo(OutputStream out,T message,Schema<T> schema,LinkedBuffer buffer) throws IOException {\n if (buffer.start != buffer.offset) throw new IllegalArgumentException(\"Buffer previously used and had not been reset.\");\n final ProtobufOutput output=new ProtobufOutput(buffer);\n schema.writeTo(output,message);\n final int size=output.getSize();\n ProtobufOutput.writeRawVarInt32Bytes(out,size);\n final int msgSize=LinkedBuffer.writeTo(out,buffer);\n assert size == msgSize;\n return size;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767a41a6d9265ec018582"}}
{"sample_uid": "codereval_java::636767001a6d9265ec01787e", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * <p> Gets the String built by this builder. </p>\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 Map<String,Object> properties=mappings.getProperties();\n Map<String,Object> diffProperties=structures.get(tableName).diffFields(new Fields(mappings));\n return Mappings.builder().type(ElasticSearchClient.TYPE).properties(diffProperties).build();\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767de1a6d9265ec018706"}}
{"sample_uid": "codereval_java::636767dd1a6d9265ec0186e5", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Add a new target channels.\n */\npublic void addNewTarget(Channels channels,IConsumer consumer){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public void addNewTarget(Channels channels,IConsumer consumer){\n Group group=new Group(channels,consumer);\n ArrayList<Group> newList=new ArrayList<Group>();\n for ( Group target : consumeTargets) {\n newList.add(target);\n }\n newList.add(group);\n consumeTargets=newList;\n size+=channels.size();\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767dd1a6d9265ec0186e5"}}
{"sample_uid": "codereval_java::636767871a6d9265ec01846d", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Creates the directory where the MRU file list will be written. The \"lf5\" directory is created in the Documents and Settings directory on Windows 2000 machines and where ever the user.home variable points on all other platforms.\n */\npublic static void createConfigurationDirectory(){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public static void createConfigurationDirectory(){\n String home=System.getProperty(\"user.home\");\n String sep=System.getProperty(\"file.separator\");\n File f=new File(home + sep + \"lf5\");\n if (!f.exists()) {\n try {\n f.mkdir();\n }\n catch ( SecurityException e) {\n e.printStackTrace();\n }\n }\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767871a6d9265ec01846d"}}
{"sample_uid": "codereval_java::636766f81a6d9265ec01775b", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Reads a signed long 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>\n * @param offset the start offset of the value to be read in this {@link ClassReader}.\n * @return the read value.\n */\npublic long readLong(final int offset){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public long readLong(final int offset){\n long l1=readInt(offset);\n long l0=readInt(offset + 4) & 0xFFFFFFFFL;\n return (l1 << 32) | l0;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636766f81a6d9265ec01775b"}}
{"sample_uid": "codereval_java::636767a51a6d9265ec01859d", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Returns true if the contents of the internal array and the provided array match.\n */\npublic boolean equals(final byte[] data,int offset,final int len){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public boolean equals(final byte[] data,int offset,final int len){\n final byte[] bytes=this.bytes;\n if (len != bytes.length) return false;\n for (int i=0; i < len; ) {\n if (bytes[i++] != data[offset++]) {\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": "636767a51a6d9265ec01859d"}}
{"sample_uid": "codereval_java::6367670b1a6d9265ec0179ff", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * <p>Defensive programming technique to change a <code>null</code> reference to an empty one.</p> <p>This method returns an empty array for a <code>null</code> input array.</p> <p>As a memory optimizing technique an empty array passed in will be overridden with the empty <code>public static</code> references in this class.</p>\n * @param array the array to check for <code>null</code> or empty\n * @return the same array, <code>public static</code> empty array if <code>null</code> 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 * <p>Defensive programming technique to change a <code>null</code> reference to an empty one.</p> <p>This method returns an empty array for a <code>null</code> input array.</p> <p>As a memory optimizing technique an empty array passed in will be overridden with the empty <code>public static</code> references in this class.</p>\n * @param array the array to check for <code>null</code> or empty\n * @return the same array, <code>public static</code> empty array if <code>null</code> 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 <b>silently dropped</b>. 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 List<TimeRange> buildTimeRanges(long start,long end){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "protected List<TimeRange> buildTimeRanges(long start,long end){\n if (start >= end) {\n return null;\n }\n end+=1;\n final List<TimeRange> timeRanges=new ArrayList<>();\n do {\n long batchEnd=Math.min(start + FETCH_DATA_DURATION,end);\n timeRanges.add(new TimeRange(start,batchEnd));\n start=batchEnd;\n }\n while (start < end);\n return timeRanges;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767df1a6d9265ec018744"}}
{"sample_uid": "codereval_java::636767031a6d9265ec0178e6", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * <p>Converts an array of object Bytes to primitives.</p> <p>This method returns <code>null</code> for a <code>null</code> input array.</p>\n * @param array a <code>Byte</code> array, may be <code>null</code>\n * @return a <code>byte</code> array, <code>null</code> if null array input\n * @throws NullPointerException if array content is <code>null</code>\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. <p> Works like {@link Arrays#asList(Object)}, but handles null arrays.\n * @return a list backed by the array.\n */\npublic static <T>List<T> asList(T[] a){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public static <T>List<T> asList(T[] a){\n if (a == null) return Collections.emptyList();\n return Arrays.asList(a);\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636766f01a6d9265ec017639"}}
{"sample_uid": "codereval_java::6367672d1a6d9265ec017c74", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Removes a value from the set. Returns true if the set contained the specified element. \n */\npublic boolean remove(int val){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public boolean remove(int val){\n if (map.containsKey(val)) {\n map.remove(val);\n values.remove(values.indexOf(val));\n return true;\n }\n return false;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "6367672d1a6d9265ec017c74"}}
{"sample_uid": "codereval_java::6367676b1a6d9265ec0181df", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Returns {@code true} if the given string starts with the specified case-insensitive prefix, {@code false} otherwise.\n * @param str the String to check\n * @param prefix the prefix to look for\n * @return {@code true} if the given string starts with the specified case-insensitive prefix, {@code false} otherwise.\n * @see java.lang.String#startsWith\n */\npublic static boolean startsWithIgnoreCase(String str,String prefix){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public static boolean startsWithIgnoreCase(String str,String prefix){\n if (str == null || prefix == null) {\n return false;\n }\n if (str.startsWith(prefix)) {\n return true;\n }\n if (str.length() < prefix.length()) {\n return false;\n }\n String lcStr=str.substring(0,prefix.length()).toLowerCase();\n String lcPrefix=prefix.toLowerCase();\n return lcStr.equals(lcPrefix);\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "6367676b1a6d9265ec0181df"}}
{"sample_uid": "codereval_java::6367674b1a6d9265ec017dc0", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Compute all vertices that have positive degree by iterating over the edges on purpose. This keeps the complexity to $O(m)$ where $m$ is the number of edges.\n * @return set of vertices with positive degree\n */\nprivate Set<V> initVisibleVertices(){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "private Set<V> initVisibleVertices(){\n Set<V> visibleVertex=new HashSet<>();\n for ( E e : graph.edgeSet()) {\n V s=graph.getEdgeSource(e);\n V t=graph.getEdgeTarget(e);\n if (!s.equals(t)) {\n visibleVertex.add(s);\n visibleVertex.add(t);\n }\n }\n return visibleVertex;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "6367674b1a6d9265ec017dc0"}}
{"sample_uid": "codereval_java::636767001a6d9265ec017873", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * <p>Reverses a String as per {@link StringBuilder#reverse()}.</p> <p>A <code>null</code> String returns <code>null</code>.</p> <pre> StringUtils.reverse(null) = null StringUtils.reverse(\"\") = \"\" StringUtils.reverse(\"bat\") = \"tab\" </pre>\n * @param str the String to reverse, may be null\n * @return the reversed String, <code>null</code> 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 Enumeration<String> e=request.getAttributeNames();\n String s;\n while (e.hasMoreElements()) {\n s=e.nextElement();\n b.localAttributes.put(s,attributeWithoutException(request,s));\n }\n return b.request(request).build();\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636766821a6d9265ec0174d2"}}
{"sample_uid": "codereval_java::636767ab1a6d9265ec01867b", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Writes the utf8-encoded bytes from the string into the {@link LinkedBuffer}.\n */\npublic static LinkedBuffer writeUTF8(final CharSequence str,final WriteSession session,final LinkedBuffer lb){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public static LinkedBuffer writeUTF8(final CharSequence str,final WriteSession session,final LinkedBuffer lb){\n final int len=str.length();\n if (len == 0) return lb;\n return lb.offset + len > lb.buffer.length ? writeUTF8(str,0,len,lb.buffer,lb.offset,lb.buffer.length,session,lb) : writeUTF8(str,0,len,session,lb);\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767ab1a6d9265ec01867b"}}
{"sample_uid": "codereval_java::6367675c1a6d9265ec01805b", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Removes this edge from both doubly linked lists of tree edges.\n */\npublic void removeFromTreeEdgeList(){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public void removeFromTreeEdgeList(){\n for (int dir=0; dir < 2; dir++) {\n if (prev[dir] != null) {\n prev[dir].next[dir]=next[dir];\n }\n else {\n head[1 - dir].first[dir]=next[dir];\n }\n if (next[dir] != null) {\n next[dir].prev[dir]=prev[dir];\n }\n }\n head[0]=head[1]=null;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "6367675c1a6d9265ec01805b"}}
{"sample_uid": "codereval_java::636767791a6d9265ec01826d", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Find the value corresponding to <code>key</code> in <code>props</code>. 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 * <p>Append to the <code>toString</code> the detail of an <code>int</code> array.</p>\n * @param buffer the <code>StringBuffer</code> to populate\n * @param fieldName the field name, typically not used as already appended\n * @param array the array to add to the <code>toString</code>,not <code>null</code>\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 * <p>Checks whether the <code>String</code> contains only digit characters.</p> <p><code>Null</code> and empty String will return <code>false</code>.</p>\n * @param str the <code>String</code> to check\n * @return <code>true</code> 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 * <p>Check if a String ends with a specified suffix (optionally case insensitive).</p>\n * @see String#endsWith(String)\n * @param str the String to check, may be null\n * @param suffix the suffix to find, may be null\n * @param ignoreCase inidicates whether the compare should ignore case(case insensitive) or not.\n * @return <code>true</code> if the String starts with the prefix orboth <code>null</code>\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 List<PathSegmentImpl> decodePath(URI u,boolean decode){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public static List<PathSegmentImpl> decodePath(URI u,boolean decode){\n String rawPath=u.getRawPath();\n if (rawPath != null && rawPath.length() > 0 && rawPath.charAt(0) == '/') {\n rawPath=rawPath.substring(1);\n }\n return decodePath(rawPath,decode);\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "6367667f1a6d9265ec01745d"}}
{"sample_uid": "codereval_java::636766f11a6d9265ec017651", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * <p>Defensive programming technique to change a <code>null</code> reference to an empty one.</p> <p>This method returns an empty array for a <code>null</code> input array.</p> <p>As a memory optimizing technique an empty array passed in will be overridden with the empty <code>public static</code> references in this class.</p>\n * @param array the array to check for <code>null</code> or empty\n * @return the same array, <code>public static</code> empty array if <code>null</code> 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. <p>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 <code>null</code>.\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 <code>null</code>.\n * @param clazz Class for which to return a registered Converter\n * @return The registered {@link Converter} or <code>null</code> 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 * <p>Defensive programming technique to change a <code>null</code> reference to an empty one.</p> <p>This method returns an empty array for a <code>null</code> input array.</p> <p>As a memory optimizing technique an empty array passed in will be overridden with the empty <code>public static</code> references in this class.</p>\n * @param array the array to check for <code>null</code> or empty\n * @return the same array, <code>public static</code> empty array if <code>null</code> 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 <code>len</code> bytes from the specified byte array starting at offset <code>off</code> 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 <V>void swap(V[] arr,int i,int j){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public static final <V>void swap(V[] arr,int i,int j){\n V tmp=arr[j];\n arr[j]=arr[i];\n arr[i]=tmp;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767551a6d9265ec017f3f"}}
{"sample_uid": "codereval_java::636766ae1a6d9265ec0175dc", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Check if the actual response is a Partial Content (HTTP 206 code)\n * @return is partial content or not\n */\npublic Boolean isPartialContentResponse(){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public Boolean isPartialContentResponse(){\n Integer limit=drc.getLimit() == null ? 0 : drc.getLimit();\n Long count=drc.getCount() == null ? 0 : drc.getCount();\n return !((limit + 1) >= count);\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636766ae1a6d9265ec0175dc"}}
{"sample_uid": "codereval_java::636766f01a6d9265ec01762e", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * <p>Checks if an array of primitive doubles is empty or <code>null</code>.</p>\n * @param array the array to test\n * @return <code>true</code> if the array is empty or <code>null</code>\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 Pair<V,V> vertexPair=new Pair<>(sourceVertex,targetVertex);\n Set<E> edgeSet=touchingVerticesToEdgeMap.get(vertexPair);\n if (edgeSet != null) edgeSet.add(e);\n else {\n edgeSet=edgeSetFactory.createEdgeSet(sourceVertex);\n edgeSet.add(e);\n touchingVerticesToEdgeMap.put(vertexPair,edgeSet);\n }\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767601a6d9265ec0180fd"}}
{"sample_uid": "codereval_java::636766821a6d9265ec0174c9", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Returns the class path of the current JVM instance as an array of {@link File} objects.\n */\nprivate static File[] classPath(){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "private static File[] classPath(){\n final String[] fileNames=System.getProperty(\"java.class.path\").split(File.pathSeparator);\n final File[] files=new File[fileNames.length];\n for (int i=0; i < files.length; ++i) {\n files[i]=new File(fileNames[i]);\n }\n return files;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636766821a6d9265ec0174c9"}}
{"sample_uid": "codereval_java::636767041a6d9265ec0178f8", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * This method creates a copy of the provided array, and ensures that all the strings in the newly created array contain only lower-case letters. <p> 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<Box2D,Box2D> splitAlongXAxis(Box2D box){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public static Pair<Box2D,Box2D> splitAlongXAxis(Box2D box){\n double newWidth=box.getWidth() / 2d;\n double height=box.getHeight();\n return Pair.of(Box2D.of(box.getMinX(),box.getMinY(),newWidth,height),Box2D.of(box.getMinX() + newWidth,box.getMinY(),newWidth,height));\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767521a6d9265ec017ecc"}}
{"sample_uid": "codereval_java::636766a91a6d9265ec0175c1", "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": "636766a91a6d9265ec0175c1"}}
{"sample_uid": "codereval_java::636767781a6d9265ec018238", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Returns <code>true</code> if the specified appender is in the list of attached appenders, <code>false</code> 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 * <p>Checks if a <code>Boolean</code> value is <i>not</i> <code>true</code>, handling <code>null</code> by returning <code>true</code>.</p> <pre> BooleanUtils.isNotTrue(Boolean.TRUE) = false BooleanUtils.isNotTrue(Boolean.FALSE) = true BooleanUtils.isNotTrue(null) = true </pre>\n * @param bool the boolean to check, null returns <code>true</code>\n * @return <code>true</code> 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 Supplier<String> createStringSupplier(int start){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "@SuppressWarnings(\"unchecked\") public static Supplier<String> createStringSupplier(int start){\n int[] container=new int[]{start};\n return (Supplier<String> & Serializable)() -> String.valueOf(container[0]++);\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "6367675c1a6d9265ec018058"}}
{"sample_uid": "codereval_java::6367677b1a6d9265ec0182bd", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Formats a logging event to a writer.\n * @param event logging event to be formatted.\n */\npublic String format(final LoggingEvent event){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public String format(final LoggingEvent event){\n StringBuffer buf=new StringBuffer();\n for (PatternConverter c=head; c != null; c=c.next) {\n c.format(buf,event);\n }\n return buf.toString();\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "6367677b1a6d9265ec0182bd"}}
{"sample_uid": "codereval_java::636766ff1a6d9265ec017842", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * <p>Converts an array of object Doubles to primitives.</p> <p>This method returns <code>null</code> for a <code>null</code> input array.</p>\n * @param array a <code>Double</code> array, may be <code>null</code>\n * @return a <code>double</code> array, <code>null</code> if null array input\n * @throws NullPointerException if array content is <code>null</code>\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 * <p>Convert the input object into a java.lang.Character.</p>\n * @param type Data type to which this value should be converted.\n * @param value The input value to be converted.\n * @return The converted value.\n * @throws Exception if conversion cannot be performed successfully\n * @since 1.8.0\n */\n@Override protected Object convertToType(final Class<?> type,final Object value) throws Exception {", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "@Override protected Object convertToType(final Class<?> type,final Object value) throws Exception {\n String string=value.toString();\n if (string.length() == 0) {\n return BeanUtils.getDefaultValue(type);\n }\n else {\n return string.charAt(0);\n }\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767021a6d9265ec0178bf"}}
{"sample_uid": "codereval_java::6367670b1a6d9265ec017a0f", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Case in-sensitive Checks if the String contains any character in the given set of string. \n */\npublic static boolean containsAnyIgnoreCase(String str,List<String> searchStrArray){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public static boolean containsAnyIgnoreCase(String str,List<String> searchStrArray){\n if (StringUtils.isEmpty(str) || searchStrArray == null || searchStrArray.isEmpty()) {\n return false;\n }\n for ( String item : searchStrArray) {\n if (containsIgnoreCase(str,item)) {\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": "6367670b1a6d9265ec017a0f"}}
{"sample_uid": "codereval_java::636766a81a6d9265ec01758e", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * 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>).\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 * <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>\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 '<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.\n * @param source the source Collection\n * @param candidates the candidates to search for\n * @return the first present object, or <code>null</code> 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 Map<String,Object> buildContent(JsonObject jsonObject){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "private Map<String,Object> buildContent(JsonObject jsonObject){\n Map<String,Object> content=new HashMap<>();\n content.put(\"msg_type\",jsonObject.get(\"msg_type\").getAsString());\n if (jsonObject.get(\"ats\") != null) {\n String ats=jsonObject.get(\"ats\").getAsString();\n String text=jsonObject.get(\"content\").getAsJsonObject().get(\"text\").getAsString();\n List<String> collect=Arrays.stream(ats.split(\",\")).map(String::trim).collect(Collectors.toList());\n for ( String userId : collect) {\n text+=\"<at user_id=\\\"\" + userId + \"\\\"></at>\";\n }\n jsonObject.get(\"content\").getAsJsonObject().addProperty(\"text\",text);\n }\n content.put(\"content\",jsonObject.get(\"content\").getAsJsonObject());\n return content;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767e01a6d9265ec018755"}}
{"sample_uid": "codereval_java::6367667f1a6d9265ec017458", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Remove an {@link AtmosphereHandler}.\n * @param mapping the mapping used when invoking {@link #addAtmosphereHandler(String,AtmosphereHandler)};\n * @return true if removed\n */\npublic AtmosphereFramework removeAtmosphereHandler(String mapping){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public AtmosphereFramework removeAtmosphereHandler(String mapping){\n if (mapping.endsWith(\"/\")) {\n mapping+=mappingRegex;\n }\n atmosphereHandlers.remove(mapping);\n return this;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "6367667f1a6d9265ec017458"}}
{"sample_uid": "codereval_java::636767a21a6d9265ec018517", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Returns a single byte array containg all the contents written to the buffer(s).\n */\npublic final byte[] toByteArray(){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public final byte[] toByteArray(){\n LinkedBuffer node=head;\n int offset=0, len;\n final byte[] buf=new byte[size];\n do {\n if ((len=node.offset - node.start) > 0) {\n System.arraycopy(node.buffer,node.start,buf,offset,len);\n offset+=len;\n }\n }\n while ((node=node.next) != null);\n return buf;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767a21a6d9265ec018517"}}
{"sample_uid": "codereval_java::6367667d1a6d9265ec017401", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * <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>\n * @param str the <code>String</code> to unescape, may be null\n * @return a new unescaped <code>String</code>, <code>null</code> 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 ListNode<E> previousNode(){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "@Override public ListNode<E> previousNode(){\n checkForComodification();\n if (!hasPrevious()) {\n throw new NoSuchElementException();\n }\n last=next=next.prev;\n nextIndex--;\n return last;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767501a6d9265ec017e86"}}
{"sample_uid": "codereval_java::636766f21a6d9265ec017667", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * 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>\n * @param offset the start offset of the value to be read in this {@link ClassReader}.\n * @return the read value.\n */\npublic short readShort(final int offset){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public short readShort(final int offset){\n byte[] classBuffer=classFileBuffer;\n return (short)(((classBuffer[offset] & 0xFF) << 8) | (classBuffer[offset + 1] & 0xFF));\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636766f21a6d9265ec017667"}}
{"sample_uid": "codereval_java::636767031a6d9265ec0178ef", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * 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.\n * @param array The array to copy, must not be <code>null</code>.\n * @param newArrayComponentType If <code>array</code> is <code>null</code>, 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 Set<V> intersection(Set<V> set1,Set<V> set2){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "private Set<V> intersection(Set<V> set1,Set<V> set2){\n Set<V> a;\n Set<V> b;\n if (set1.size() <= set2.size()) {\n a=set1;\n b=set2;\n }\n else {\n a=set2;\n b=set1;\n }\n return a.stream().filter(b::contains).collect(Collectors.toSet());\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767611a6d9265ec018116"}}
{"sample_uid": "codereval_java::636766f71a6d9265ec017730", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * 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>.\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 * <p>Utility method for {@link #createNumber(String)}.</p> <p>Returns <code>true</code> if s is <code>null</code>.</p>\n * @param s the String to check\n * @return if it is all zeros or <code>null</code>\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(List<KeyStringValuePair> properties){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "private JsonObject convertProperties(List<KeyStringValuePair> properties){\n final JsonObject result=new JsonObject();\n for ( KeyStringValuePair kv : properties) {\n result.addProperty(kv.getKey(),kv.getValue());\n }\n return result;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767e01a6d9265ec018764"}}
{"sample_uid": "codereval_java::6367677e1a6d9265ec018314", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Removes any inactive nodes from the Category tree.\n */\nprotected int removeUnusedNodes(){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "protected int removeUnusedNodes(){\n int count=0;\n CategoryNode root=_categoryModel.getRootCategoryNode();\n Enumeration enumeration=root.depthFirstEnumeration();\n while (enumeration.hasMoreElements()) {\n CategoryNode node=(CategoryNode)enumeration.nextElement();\n if (node.isLeaf() && node.getNumberOfContainedRecords() == 0 && node.getParent() != null) {\n _categoryModel.removeNodeFromParent(node);\n count++;\n }\n }\n return count;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "6367677e1a6d9265ec018314"}}
{"sample_uid": "codereval_java::636766ff1a6d9265ec017853", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * 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.\n * @param bytecodeOffset a bytecode offset in a method.\n * @param labels the already created labels, indexed by their offset. If a label already existsfor bytecodeOffset this method must not create a new one. Otherwise it must store the new label in this array.\n * @return a non null Label, which must be equal to labels[bytecodeOffset].\n */\nprotected Label readLabel(final int bytecodeOffset,final Label[] labels){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "protected Label readLabel(final int bytecodeOffset,final Label[] labels){\n if (labels[bytecodeOffset] == null) {\n labels[bytecodeOffset]=new Label();\n }\n return labels[bytecodeOffset];\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636766ff1a6d9265ec017853"}}
{"sample_uid": "codereval_java::6367677d1a6d9265ec0182fd", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * 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. \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<Node> predicate,Node start,Node stop,int dir){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "private OuterFaceCirculator selectOnOuterFace(Predicate<Node> predicate,Node start,Node stop,int dir){\n OuterFaceCirculator circulator=start.iterator(dir);\n Node current=circulator.next();\n while (current != stop && !predicate.test(current)) {\n current=circulator.next();\n }\n return circulator;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767511a6d9265ec017eb6"}}
{"sample_uid": "codereval_java::636767841a6d9265ec0183e8", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Add an <code>event</code> 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)}. <p> <b>Note for Java 7 and later:</b> 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 (<code>null</code> if the passed-inEnumeration was <code>null</code>)\n */\npublic static String[] toStringArray(Enumeration<String> enumeration){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public static String[] toStringArray(Enumeration<String> enumeration){\n if (enumeration == null) {\n return null;\n }\n List<String> list=java.util.Collections.list(enumeration);\n return list.toArray(new String[list.size()]);\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767691a6d9265ec0181ae"}}
{"sample_uid": "codereval_java::636766a91a6d9265ec0175ae", "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": "636766a91a6d9265ec0175ae"}}
{"sample_uid": "codereval_java::636766f11a6d9265ec01764f", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Returns the values for the BeanMap.\n * @return values for the BeanMap. The returned collection is not modifiable.\n */\npublic Collection<Object> values(){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public Collection<Object> values(){\n ArrayList<Object> answer=new ArrayList<>(readMethods.size());\n for (Iterator<Object> iter=valueIterator(); iter.hasNext(); ) {\n answer.add(iter.next());\n }\n return Collections.unmodifiableList(answer);\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636766f11a6d9265ec01764f"}}
{"sample_uid": "codereval_java::636766f81a6d9265ec017758", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Returns a hash code value for this type.\n * @return a hash code value for this type.\n */\n@Override public int hashCode(){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "@Override public int hashCode(){\n int hashCode=13 * (sort == INTERNAL ? OBJECT : sort);\n if (sort >= ARRAY) {\n for (int i=valueBegin, end=valueEnd; i < end; i++) {\n hashCode=17 * (hashCode + valueBuffer.charAt(i));\n }\n }\n return hashCode;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636766f81a6d9265ec017758"}}
{"sample_uid": "codereval_java::6367676c1a6d9265ec01820b", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Delete any character in a given String.\n * @param inString the original String\n * @param charsToDelete a set of characters to delete.E.g. \"az\\n\" will delete 'a's, 'z's and new lines.\n * @return the resulting String\n */\npublic static String deleteAny(String inString,String charsToDelete){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public static String deleteAny(String inString,String charsToDelete){\n if (!hasLength(inString) || !hasLength(charsToDelete)) {\n return inString;\n }\n StringBuilder sb=new StringBuilder();\n for (int i=0; i < inString.length(); i++) {\n char c=inString.charAt(i);\n if (charsToDelete.indexOf(c) == -1) {\n sb.append(c);\n }\n }\n return sb.toString();\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "6367676c1a6d9265ec01820b"}}
{"sample_uid": "codereval_java::636766861a6d9265ec01755a", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Match a URI against the pattern.\n * @param uri the uri to match against the template.\n * @return the match result, otherwise null if no match occurs.\n */\npublic final MatchResult match(CharSequence uri){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public final MatchResult match(CharSequence uri){\n if (uri == null || uri.length() == 0) return (regexPattern == null) ? EMPTY_STRING_MATCH_RESULT : null;\n else if (regexPattern == null) return null;\n Matcher m=regexPattern.matcher(uri);\n if (!m.matches()) return null;\n return (groupIndexes.length > 0) ? new GroupIndexMatchResult(m) : m;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636766861a6d9265ec01755a"}}
{"sample_uid": "codereval_java::636766f91a6d9265ec01777d", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * @param b An ASCII encoded character 0-9 a-f A-F\n * @return The byte value of the character 0-16.\n */\npublic static byte convertHexDigit(byte b){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public static byte convertHexDigit(byte b){\n if ((b >= '0') && (b <= '9')) return (byte)(b - '0');\n if ((b >= 'a') && (b <= 'f')) return (byte)(b - 'a' + 10);\n if ((b >= 'A') && (b <= 'F')) return (byte)(b - 'A' + 10);\n throw new IllegalArgumentException(\"!hex:\" + Integer.toHexString(0xff & b));\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636766f91a6d9265ec01777d"}}
{"sample_uid": "codereval_java::636766801a6d9265ec017477", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Add the specified files in reverse order.\n */\nprivate void addReverse(final InputStream[] files){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "private void addReverse(final InputStream[] files){\n for (int i=files.length - 1; i >= 0; --i) {\n stack.add(files[i]);\n }\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636766801a6d9265ec017477"}}
{"sample_uid": "codereval_java::636767de1a6d9265ec01871e", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * @param modelName model name of the entity\n * @throws IllegalStateException if sharding key indices are not continuous\n */\nprivate void check(String modelName) throws IllegalStateException {", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "private void check(String modelName) throws IllegalStateException {\n for (int i=0; i < keys.size(); i++) {\n final ModelColumn modelColumn=keys.get(i);\n if (modelColumn == null) {\n throw new IllegalStateException(\"Sharding key index=\" + i + \" is missing in \"+ modelName);\n }\n }\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767de1a6d9265ec01871e"}}
{"sample_uid": "codereval_java::636766f81a6d9265ec01774b", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Reads a byte from the <code>buffer</code>, and refills it as necessary.\n * @return The next byte from the input stream.\n * @throws IOException if there is no more data available.\n */\npublic byte readByte() throws IOException {", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public byte readByte() throws IOException {\n if (head == tail) {\n head=0;\n tail=input.read(buffer,head,bufSize);\n if (tail == -1) {\n throw new IOException(\"No more data is available\");\n }\n }\n return buffer[head++];\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636766f81a6d9265ec01774b"}}
{"sample_uid": "codereval_java::636766851a6d9265ec017515", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Automatically suspend the {@link AtmosphereResource} based on {@link AtmosphereResource.TRANSPORT} value.\n * @param r a {@link AtmosphereResource}\n * @return {@link Action#CONTINUE}\n */\n@Override public Action inspect(AtmosphereResource r){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "@Override public Action inspect(AtmosphereResource r){\nswitch (r.transport()) {\ncase JSONP:\ncase AJAX:\ncase LONG_POLLING:\n r.resumeOnBroadcast(true);\n break;\ndefault :\nbreak;\n}\nreturn Action.CONTINUE;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636766851a6d9265ec017515"}}
{"sample_uid": "codereval_java::636767611a6d9265ec018106", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Compute the sum of the weights entering a vertex\n * @param v the vertex\n * @return the sum of the weights entering a vertex\n */\npublic double vertexWeight(Set<V> v){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public double vertexWeight(Set<V> v){\n double wsum=0.0;\n for ( DefaultWeightedEdge e : workingGraph.edgesOf(v)) {\n wsum+=workingGraph.getEdgeWeight(e);\n }\n return wsum;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767611a6d9265ec018106"}}
{"sample_uid": "codereval_java::636767841a6d9265ec0183f2", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * @see Comparator \n */\npublic int compare(Object aObj1,Object aObj2){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public int compare(Object aObj1,Object aObj2){\n if ((aObj1 == null) && (aObj2 == null)) {\n return 0;\n }\n else if (aObj1 == null) {\n return -1;\n }\n else if (aObj2 == null) {\n return 1;\n }\n final EventDetails le1=(EventDetails)aObj1;\n final EventDetails le2=(EventDetails)aObj2;\n if (le1.getTimeStamp() < le2.getTimeStamp()) {\n return 1;\n }\n return -1;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767841a6d9265ec0183f2"}}
{"sample_uid": "codereval_java::636767861a6d9265ec01844c", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Remove the appender with the name passed as parameter form the list of appenders. \n */\npublic void removeAppender(String name){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public void removeAppender(String name){\n if (name == null || appenderList == null) return;\n int size=appenderList.size();\n for (int i=0; i < size; i++) {\n if (name.equals(((Appender)appenderList.elementAt(i)).getName())) {\n appenderList.removeElementAt(i);\n break;\n }\n }\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767861a6d9265ec01844c"}}
{"sample_uid": "codereval_java::636767781a6d9265ec018242", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Call the <code>doAppend</code> method on all attached appenders. \n */\npublic int appendLoopOnAppenders(LoggingEvent event){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public int appendLoopOnAppenders(LoggingEvent event){\n int size=0;\n Appender appender;\n if (appenderList != null) {\n size=appenderList.size();\n for (int i=0; i < size; i++) {\n appender=(Appender)appenderList.elementAt(i);\n appender.doAppend(event);\n }\n }\n return size;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767781a6d9265ec018242"}}
{"sample_uid": "codereval_java::6367670c1a6d9265ec017a2a", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * <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>\n * @param array a <code>Integer</code> array, may be <code>null</code>\n * @return an <code>int</code> array, <code>null</code> if null array input\n * @throws NullPointerException if array content is <code>null</code>\n */\npublic static int[] toPrimitive(final Integer[] array){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public static int[] toPrimitive(final Integer[] array){\n if (array == null) {\n return null;\n }\n else if (array.length == 0) {\n return ArrayUtils.EMPTY_INT_ARRAY;\n }\n final int[] result=new int[array.length];\n for (int i=0; i < array.length; i++) {\n result[i]=array[i].intValue();\n }\n return result;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "6367670c1a6d9265ec017a2a"}}
{"sample_uid": "codereval_java::636767041a6d9265ec017911", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * <p> Registers the given object. Used by the reflection methods to avoid infinite loops. </p>\n * @param value The object to register.\n */\nstatic void register(Object value){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "static void register(Object value){\n if (value != null) {\n Map m=getRegistry();\n if (m == null) {\n m=new WeakHashMap();\n REGISTRY.set(m);\n }\n m.put(value,null);\n }\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767041a6d9265ec017911"}}
{"sample_uid": "codereval_java::636767511a6d9265ec017eb0", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Get the number of non-zero entries of a row.\n * @param row the row\n * @return the number of non-zero entries of a row\n */\npublic int nonZeros(int row){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public int nonZeros(int row){\n assert row >= 0 && row < rowOffsets.length;\n return rowOffsets[row + 1] - rowOffsets[row];\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767511a6d9265ec017eb0"}}
{"sample_uid": "codereval_java::6367676c1a6d9265ec018223", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * 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.\n * @param collection the Collection to check\n * @param element the element to look for\n * @return <code>true</code> if found, <code>false</code> else\n */\npublic static boolean containsInstance(Collection collection,Object element){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public static boolean containsInstance(Collection collection,Object element){\n if (collection != null) {\n for ( Object candidate : collection) {\n if (candidate == element) {\n return true;\n }\n }\n }\n return false;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "6367676c1a6d9265ec018223"}}
{"sample_uid": "codereval_java::636766fa1a6d9265ec01779d", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * <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>\n * @param ch the character to check\n * @return true if less than 32 or equals 127\n */\npublic static boolean isAsciiControl(final char ch){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public static boolean isAsciiControl(final char ch){\n return ch < 32 || ch == 127;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636766fa1a6d9265ec01779d"}}
{"sample_uid": "codereval_java::6367670b1a6d9265ec0179f2", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Return <code>true</code> if this map contains a mapping for the specified key.\n * @param key the key to be searched for\n * @return true if the map contains the key\n */\n@Override public boolean containsKey(final Object key){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "@Override public boolean containsKey(final Object key){\n if (this.fast) {\n return this.map.containsKey(key);\n }\n else {\nsynchronized (this.map) {\n return this.map.containsKey(key);\n }\n }\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "6367670b1a6d9265ec0179f2"}}
{"sample_uid": "codereval_java::636766fa1a6d9265ec017796", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * <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>\n * @param array a <code>boolean</code> array\n * @return a <code>Boolean</code> array, <code>null</code> if null array input\n */\npublic static Boolean[] toObject(final boolean[] array){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public static Boolean[] toObject(final boolean[] array){\n if (array == null) {\n return null;\n }\n else if (array.length == 0) {\n return ArrayUtils.EMPTY_BOOLEAN_OBJECT_ARRAY;\n }\n final Boolean[] result=new Boolean[array.length];\n for (int i=0; i < array.length; i++) {\n result[i]=array[i] ? Boolean.TRUE : Boolean.FALSE;\n }\n return result;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636766fa1a6d9265ec017796"}}
{"sample_uid": "codereval_java::636767aa1a6d9265ec01864a", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Copies bytes to a {@code byte[]}.\n */\npublic byte[] toByteArray(){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public byte[] toByteArray(){\n final int size=bytes.length;\n final byte[] copy=new byte[size];\n System.arraycopy(bytes,0,copy,0,size);\n return copy;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767aa1a6d9265ec01864a"}}
{"sample_uid": "codereval_java::636767561a6d9265ec017f7c", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Transform from a Set representation to a graph path.\n * @param tour a set containing the edges of the tour\n * @param graph the graph\n * @return a graph path\n */\nprotected GraphPath<V,E> edgeSetToTour(Set<E> tour,Graph<V,E> graph){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "protected GraphPath<V,E> edgeSetToTour(Set<E> tour,Graph<V,E> graph){\n List<V> vertices=new ArrayList<>(tour.size() + 1);\n MaskSubgraph<V,E> tourGraph=new MaskSubgraph<>(graph,v -> false,e -> !tour.contains(e));\n new DepthFirstIterator<>(tourGraph).forEachRemaining(vertices::add);\n return vertexListToTour(vertices,graph);\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767561a6d9265ec017f7c"}}
{"sample_uid": "codereval_java::6367670a1a6d9265ec0179f1", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * <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>\n * @param array a <code>short</code> array\n * @return a <code>Short</code> array, <code>null</code> if null array input\n */\npublic static Short[] toObject(final short[] array){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public static Short[] toObject(final short[] array){\n if (array == null) {\n return null;\n }\n else if (array.length == 0) {\n return ArrayUtils.EMPTY_SHORT_OBJECT_ARRAY;\n }\n final Short[] result=new Short[array.length];\n for (int i=0; i < array.length; i++) {\n result[i]=new Short(array[i]);\n }\n return result;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "6367670a1a6d9265ec0179f1"}}
{"sample_uid": "codereval_java::636766fe1a6d9265ec017823", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Adds a CONSTANT_NameAndType_info to the constant pool of this symbol table. Does nothing if the constant pool already contains a similar item.\n * @param name a field or method name.\n * @param descriptor a field or method descriptor.\n * @return a new or already existing Symbol with the given value.\n */\nint addConstantNameAndType(final String name,final String descriptor){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "int addConstantNameAndType(final String name,final String descriptor){\n final int tag=Symbol.CONSTANT_NAME_AND_TYPE_TAG;\n int hashCode=hash(tag,name,descriptor);\n Entry entry=get(hashCode);\n while (entry != null) {\n if (entry.tag == tag && entry.hashCode == hashCode && entry.name.equals(name) && entry.value.equals(descriptor)) {\n return entry.index;\n }\n entry=entry.next;\n }\n constantPool.put122(tag,addConstantUtf8(name),addConstantUtf8(descriptor));\n return put(new Entry(constantPoolCount++,tag,name,descriptor,hashCode)).index;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636766fe1a6d9265ec017823"}}
{"sample_uid": "codereval_java::636767461a6d9265ec017d17", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Unescape a string DOT identifier.\n * @param input the input\n * @return the unescaped output\n */\nprivate String unescapeId(String input){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "private String unescapeId(String input){\n final char quote='\"';\n if (input.charAt(0) != quote || input.charAt(input.length() - 1) != quote) {\n return input;\n }\n String noQuotes=input.subSequence(1,input.length() - 1).toString();\n String unescaped=unescapeId.translate(noQuotes);\n return unescaped;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767461a6d9265ec017d17"}}
{"sample_uid": "codereval_java::6367676c1a6d9265ec018204", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Concatenate the given String arrays into one, with overlapping array elements included twice. <p>The order of elements in the original arrays is preserved.\n * @param array1 the first array (can be <code>null</code>)\n * @param array2 the second array (can be <code>null</code>)\n * @return the new array (<code>null</code> if both given arrays were <code>null</code>)\n */\npublic static String[] concatenateStringArrays(String[] array1,String[] array2){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public static String[] concatenateStringArrays(String[] array1,String[] array2){\n if (Objects.isEmpty(array1)) {\n return array2;\n }\n if (Objects.isEmpty(array2)) {\n return array1;\n }\n String[] newArr=new String[array1.length + array2.length];\n System.arraycopy(array1,0,newArr,0,array1.length);\n System.arraycopy(array2,0,newArr,array1.length,array2.length);\n return newArr;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "6367676c1a6d9265ec018204"}}
{"sample_uid": "codereval_java::636767641a6d9265ec018190", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * 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.\n * @param bucketsByLabel the buckets vertices are stored in\n * @param labels the labels of the vertices\n * @param minLabel the minimum value of the non-empty bucket\n */\nprivate void reload(List<Set<Integer>> bucketsByLabel,List<Integer> labels,int minLabel){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "private void reload(List<Set<Integer>> bucketsByLabel,List<Integer> labels,int minLabel){\n if (minLabel != 0 && minLabel < bucketsByLabel.size()) {\n Set<Integer> bucket=bucketsByLabel.get(minLabel);\n for ( Integer vertex : bucket) {\n labels.set(vertex,0);\n bucketsByLabel.get(0).add(vertex);\n }\n bucket.clear();\n }\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767641a6d9265ec018190"}}
{"sample_uid": "codereval_java::6367676a1a6d9265ec0181d4", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Append the given String to the given String array, returning a new array consisting of the input array contents plus the given String.\n * @param array the array to append to (can be <code>null</code>)\n * @param str the String to append\n * @return the new array (never <code>null</code>)\n */\npublic static String[] addStringToArray(String[] array,String str){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public static String[] addStringToArray(String[] array,String str){\n if (Objects.isEmpty(array)) {\n return new String[]{str};\n }\n String[] newArr=new String[array.length + 1];\n System.arraycopy(array,0,newArr,0,array.length);\n newArr[array.length]=str;\n return newArr;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "6367676a1a6d9265ec0181d4"}}
{"sample_uid": "codereval_java::6367676b1a6d9265ec0181dd", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Returns the number of occurrences the substring {@code sub} appears in string {@code str}.\n * @param str string to search in. Return 0 if this is null.\n * @param sub string to search for. Return 0 if this is null.\n * @return the number of occurrences the substring {@code sub} appears in string {@code str}.\n */\npublic static int countOccurrencesOf(String str,String sub){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public static int countOccurrencesOf(String str,String sub){\n if (str == null || sub == null || str.length() == 0 || sub.length() == 0) {\n return 0;\n }\n int count=0;\n int pos=0;\n int idx;\n while ((idx=str.indexOf(sub,pos)) != -1) {\n ++count;\n pos=idx + sub.length();\n }\n return count;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "6367676b1a6d9265ec0181dd"}}
{"sample_uid": "codereval_java::636766811a6d9265ec017499", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * <p> Checks in the specified list if there is at least one instance of the given {@link AtmosphereInterceptor interceptor} implementation class.</p>\n * @param interceptorList the interceptors\n * @param c the interceptor class\n * @return {@code false} if an instance of the class already exists in the list, {@code true} otherwise\n */\nprivate boolean checkDuplicate(final List<AtmosphereInterceptor> interceptorList,Class<? extends AtmosphereInterceptor> c){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "private boolean checkDuplicate(final List<AtmosphereInterceptor> interceptorList,Class<? extends AtmosphereInterceptor> c){\n for ( final AtmosphereInterceptor i : interceptorList) {\n if (i.getClass().equals(c)) {\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": "636766811a6d9265ec017499"}}
{"sample_uid": "codereval_java::636766fe1a6d9265ec017821", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * <p>Append to the <code>toString</code> the detail of a <code>byte</code> array.</p>\n * @param buffer the <code>StringBuffer</code> to populate\n * @param fieldName the field name, typically not used as already appended\n * @param array the array to add to the <code>toString</code>,not <code>null</code>\n */\nprotected void appendDetail(StringBuffer buffer,String fieldName,byte[] array){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "protected void appendDetail(StringBuffer buffer,String fieldName,byte[] 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": "636766fe1a6d9265ec017821"}}
{"sample_uid": "codereval_java::636767561a6d9265ec017f63", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Checks whether there exist unvisited vertices.\n * @return true if there exist unvisited vertices.\n */\n@Override public boolean hasNext(){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "@Override public boolean hasNext(){\n if (current != null) {\n return true;\n }\n current=advance();\n if (current != null && nListeners != 0) {\n fireVertexTraversed(createVertexTraversalEvent(current));\n }\n return current != null;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767561a6d9265ec017f63"}}
{"sample_uid": "codereval_java::636766a81a6d9265ec017586", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Pops the given number of abstract types from the output frame stack.\n * @param elements the number of abstract types that must be popped.\n */\nprivate void pop(final int elements){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "private void pop(final int elements){\n if (outputStackTop >= elements) {\n outputStackTop-=elements;\n }\n else {\n outputStackStart-=elements - outputStackTop;\n outputStackTop=0;\n }\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636766a81a6d9265ec017586"}}
{"sample_uid": "codereval_java::636767e11a6d9265ec018795", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * @return true if the bucket is same.\n */\npublic boolean isCompatible(DataTable dataset){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public boolean isCompatible(DataTable dataset){\n final List<String> sortedKeys=dataset.sortedKeys(new HeatMap.KeyComparator(true));\n long[] existedBuckets=new long[sortedKeys.size()];\n for (int i=0; i < sortedKeys.size(); i++) {\n String key=sortedKeys.get(i);\n if (key.equals(Bucket.INFINITE_NEGATIVE)) {\n existedBuckets[i]=Long.MIN_VALUE;\n }\n else {\n if (key.contains(\":\")) {\n key=StringUtils.substringAfterLast(key,\":\");\n }\n existedBuckets[i]=Long.parseLong(key);\n }\n }\n return Arrays.equals(buckets,existedBuckets);\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767e11a6d9265ec018795"}}
{"sample_uid": "codereval_java::636767791a6d9265ec018263", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Find class given class name.\n * @param className class name, may not be null.\n * @return class, will not be null.\n * @throws ClassNotFoundException thrown if class can not be found.\n */\nprivate Class findClass(final String className) throws ClassNotFoundException {", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "private Class findClass(final String className) throws ClassNotFoundException {\n try {\n return Thread.currentThread().getContextClassLoader().loadClass(className);\n }\n catch ( ClassNotFoundException e) {\n try {\n return Class.forName(className);\n }\n catch ( ClassNotFoundException e1) {\n return getClass().getClassLoader().loadClass(className);\n }\n }\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767791a6d9265ec018263"}}
{"sample_uid": "codereval_java::636767611a6d9265ec018112", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * {@inheritDoc}\n */\n@Override protected V provideNextVertex(){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "@Override protected V provideNextVertex(){\n V v=super.provideNextVertex();\n for (int i=path.size() - 1; i >= 0; --i) {\n if (graph.containsEdge(path.get(i),v)) {\n break;\n }\n path.remove(i);\n }\n path.add(v);\n return v;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767611a6d9265ec018112"}}
{"sample_uid": "codereval_java::636767131a6d9265ec017b23", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Adds a source line number corresponding to this label.\n * @param lineNumber a source line number (which should be strictly positive).\n */\nfinal void addLineNumber(final int lineNumber){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "final void addLineNumber(final int lineNumber){\n if (this.lineNumber == 0) {\n this.lineNumber=(short)lineNumber;\n }\n else {\n if (otherLineNumbers == null) {\n otherLineNumbers=new int[LINE_NUMBERS_CAPACITY_INCREMENT];\n }\n int otherLineNumberIndex=++otherLineNumbers[0];\n if (otherLineNumberIndex >= otherLineNumbers.length) {\n int[] newLineNumbers=new int[otherLineNumbers.length + LINE_NUMBERS_CAPACITY_INCREMENT];\n System.arraycopy(otherLineNumbers,0,newLineNumbers,0,otherLineNumbers.length);\n otherLineNumbers=newLineNumbers;\n }\n otherLineNumbers[otherLineNumberIndex]=lineNumber;\n }\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767131a6d9265ec017b23"}}
{"sample_uid": "codereval_java::6367675a1a6d9265ec018010", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Removes this bucket from the data structure.\n */\nvoid removeSelf(){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "void removeSelf(){\n if (next != null) {\n next.prev=prev;\n }\n if (prev != null) {\n prev.next=next;\n }\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "6367675a1a6d9265ec018010"}}
{"sample_uid": "codereval_java::636767dd1a6d9265ec0186f3", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Keep the same name replacement as {@link ColumnName#overrideName(String,String)}\n * @param oldName to be replaced.\n * @param newName to use in the storage level.\n */\npublic void overrideName(String oldName,String newName){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public void overrideName(String oldName,String newName){\n for (int i=0; i < columns.length; i++) {\n if (columns[i].equals(oldName)) {\n columns[i]=newName;\n }\n }\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767dd1a6d9265ec0186f3"}}
{"sample_uid": "codereval_java::636767631a6d9265ec018171", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Remove the non null {@code node} from the list. \n */\nprivate boolean unlink(ListNodeImpl<E> node){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "private boolean unlink(ListNodeImpl<E> node){\n ListNodeImpl<E> prev=node.prev;\n ListNodeImpl<E> next=node.next;\n if (removeListNode(node)) {\n if (size == 0) {\n head=null;\n }\n else {\n link(prev,next);\n if (head == node) {\n head=next;\n }\n }\n return true;\n }\n return false;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767631a6d9265ec018171"}}
{"sample_uid": "codereval_java::636767de1a6d9265ec018726", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * build current profiles segment snapshot search sequence ranges\n */\npublic List<SequenceRange> buildSequenceRanges(){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public List<SequenceRange> buildSequenceRanges(){\n ArrayList<SequenceRange> ranges=new ArrayList<>();\n do {\n int batchMax=Math.min(minSequence + SEQUENCE_RANGE_BATCH_SIZE,maxSequence);\n ranges.add(new SequenceRange(minSequence,batchMax));\n minSequence=batchMax;\n }\n while (minSequence < maxSequence);\n return ranges;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767de1a6d9265ec018726"}}
{"sample_uid": "codereval_java::6367667c1a6d9265ec0173f7", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * True is the body is a byte array\n * @return True is the body is a byte array\n */\npublic boolean hasBytes(){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public boolean hasBytes(){\n return dataBytes != null;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "6367667c1a6d9265ec0173f7"}}
{"sample_uid": "codereval_java::6367676c1a6d9265ec018220", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Strip the filename extension from the given path, e.g. \"mypath/myfile.txt\" -&gt; \"mypath/myfile\".\n * @param path the file path (may be <code>null</code>)\n * @return the path with stripped filename extension,or <code>null</code> if none\n */\npublic static String stripFilenameExtension(String path){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public static String stripFilenameExtension(String path){\n if (path == null) {\n return null;\n }\n int extIndex=path.lastIndexOf(EXTENSION_SEPARATOR);\n if (extIndex == -1) {\n return path;\n }\n int folderIndex=path.lastIndexOf(FOLDER_SEPARATOR);\n if (folderIndex > extIndex) {\n return path;\n }\n return path.substring(0,extIndex);\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "6367676c1a6d9265ec018220"}}
{"sample_uid": "codereval_java::636766fe1a6d9265ec017838", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * <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>\n * @param array a <code>Character</code> array, may be <code>null</code>\n * @return a <code>char</code> array, <code>null</code> if null array input\n * @throws NullPointerException if array content is <code>null</code>\n */\npublic static char[] toPrimitive(final Character[] array){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public static char[] toPrimitive(final Character[] array){\n if (array == null) {\n return null;\n }\n else if (array.length == 0) {\n return ArrayUtils.EMPTY_CHAR_ARRAY;\n }\n final char[] result=new char[array.length];\n for (int i=0; i < array.length; i++) {\n result[i]=array[i].charValue();\n }\n return result;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636766fe1a6d9265ec017838"}}
{"sample_uid": "codereval_java::636766fa1a6d9265ec01779c", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Parses out a token until any of the given terminators is encountered.\n * @param terminators the array of terminating characters. Any of these characters when encountered signify the end of the token\n * @return the token\n */\nprivate String parseToken(final char[] terminators){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "private String parseToken(final char[] terminators){\n char ch;\n i1=pos;\n i2=pos;\n while (hasChar()) {\n ch=chars[pos];\n if (isOneOf(ch,terminators)) {\n break;\n }\n i2++;\n pos++;\n }\n return getToken(false);\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636766fa1a6d9265ec01779c"}}
{"sample_uid": "codereval_java::636767691a6d9265ec0181a7", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Trim all occurrences of the supplied leading character from the given String.\n * @param str the String to check\n * @param leadingCharacter the leading character to be trimmed\n * @return the trimmed String\n */\npublic static String trimLeadingCharacter(String str,char leadingCharacter){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public static String trimLeadingCharacter(String str,char leadingCharacter){\n if (!hasLength(str)) {\n return str;\n }\n StringBuilder sb=new StringBuilder(str);\n while (sb.length() > 0 && sb.charAt(0) == leadingCharacter) {\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": "636767691a6d9265ec0181a7"}}
{"sample_uid": "codereval_java::636767041a6d9265ec01790f", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * <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>\n * @param array an <code>int</code> array\n * @return an <code>Integer</code> array, <code>null</code> if null array input\n */\npublic static Integer[] toObject(final int[] array){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public static Integer[] toObject(final int[] array){\n if (array == null) {\n return null;\n }\n else if (array.length == 0) {\n return ArrayUtils.EMPTY_INTEGER_OBJECT_ARRAY;\n }\n final Integer[] result=new Integer[array.length];\n for (int i=0; i < array.length; i++) {\n result[i]=new Integer(array[i]);\n }\n return result;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767041a6d9265ec01790f"}}
{"sample_uid": "codereval_java::636766fa1a6d9265ec0177a4", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * <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>\n * @param array a <code>double</code> array\n * @return a <code>Double</code> array, <code>null</code> if null array input\n */\npublic static Double[] toObject(final double[] array){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public static Double[] toObject(final double[] array){\n if (array == null) {\n return null;\n }\n else if (array.length == 0) {\n return ArrayUtils.EMPTY_DOUBLE_OBJECT_ARRAY;\n }\n final Double[] result=new Double[array.length];\n for (int i=0; i < array.length; i++) {\n result[i]=new Double(array[i]);\n }\n return result;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636766fa1a6d9265ec0177a4"}}
{"sample_uid": "codereval_java::636767461a6d9265ec017d0e", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Computes a suffix sum of the {@code bounds}. Returns computed suffix sum and the sum of all elements in the {@code bounds list}.\n * @param bounds list of integers.\n * @return computed pair of suffix sum list and a sum of all elements.\n */\nprivate Pair<List<Integer>,Long> computeSuffixSum(List<Integer> bounds){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "private Pair<List<Integer>,Long> computeSuffixSum(List<Integer> bounds){\n List<Integer> suffixSum=new ArrayList<>(Collections.nCopies(bounds.size(),0));\n long sum=0;\n for (int i=bounds.size() - 1; i >= 0; i--) {\n suffixSum.set(i,(int)Math.min(Integer.MAX_VALUE,sum));\n sum+=bounds.get(i);\n }\n return Pair.of(suffixSum,sum);\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767461a6d9265ec017d0e"}}
{"sample_uid": "codereval_java::636767491a6d9265ec017d90", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Reverses the order of the elements in the specified range within the given array.\n * @param < V > the type of elements in the array\n * @param arr the array\n * @param from the index of the first element (inclusive) inside the range to reverse\n * @param to the index of the last element (inclusive) inside the range to reverse\n */\npublic static final <V>void reverse(V[] arr,int from,int to){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public static final <V>void reverse(V[] arr,int from,int to){\n for (int i=from, j=to; i < j; ++i, --j) {\n swap(arr,i,j);\n }\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767491a6d9265ec017d90"}}
{"sample_uid": "codereval_java::6367674a1a6d9265ec017da9", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * 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)}.\n */\nprivate void moveAllListNodes(DoublyLinkedList<E> list){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "private void moveAllListNodes(DoublyLinkedList<E> list){\n for (ListNodeIteratorImpl it=list.new ListNodeIteratorImpl(0); it.hasNext(); ) {\n ListNodeImpl<E> node=it.nextNode();\n assert node.list == list;\n node.list=this;\n }\n size+=list.size;\n list.size=0;\n modCount++;\n list.modCount++;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "6367674a1a6d9265ec017da9"}}
{"sample_uid": "codereval_java::636767151a6d9265ec017b6b", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * <p>Check if a String starts with a specified prefix (optionally case insensitive).</p>\n * @see String#startsWith(String)\n * @param str the String to check, may be null\n * @param prefix the prefix to find, may be null\n * @param ignoreCase inidicates whether the compare should ignore case(case insensitive) or not.\n * @return <code>true</code> if the String starts with the prefix orboth <code>null</code>\n */\nprivate static boolean startsWith(final String str,final String prefix,final boolean ignoreCase){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "private static boolean startsWith(final String str,final String prefix,final boolean ignoreCase){\n if (str == null || prefix == null) {\n return str == null && prefix == null;\n }\n if (prefix.length() > str.length()) {\n return false;\n }\n return str.regionMatches(ignoreCase,0,prefix,0,prefix.length());\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767151a6d9265ec017b6b"}}
{"sample_uid": "codereval_java::636766fe1a6d9265ec01781c", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * <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>\n * @param ch the character to convert\n * @return a Character of the specified character\n */\npublic static Character toCharacterObject(final char ch){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public static Character toCharacterObject(final char ch){\n if (ch < CharUtils.CHAR_ARRAY.length) {\n return CharUtils.CHAR_ARRAY[ch];\n }\n return new Character(ch);\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636766fe1a6d9265ec01781c"}}
{"sample_uid": "codereval_java::636766fb1a6d9265ec0177c1", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * <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.isAsciiAlphaUpper('&copy;') = false </pre>\n * @param ch the character to check\n * @return true if between 65 and 90 inclusive\n */\npublic static boolean isAsciiAlphaUpper(final char ch){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public static boolean isAsciiAlphaUpper(final char ch){\n return ch >= 'A' && ch <= 'Z';\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636766fb1a6d9265ec0177c1"}}
{"sample_uid": "codereval_java::636767781a6d9265ec018250", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Returns {@link Filter#NEUTRAL} is there is no string match.\n */\npublic int decide(LoggingEvent event){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public int decide(LoggingEvent event){\n String msg=event.getRenderedMessage();\n if (msg == null || stringToMatch == null) return Filter.NEUTRAL;\n if (msg.indexOf(stringToMatch) == -1) {\n return Filter.NEUTRAL;\n }\n else {\n if (acceptOnMatch) {\n return Filter.ACCEPT;\n }\n else {\n return Filter.DENY;\n }\n }\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767781a6d9265ec018250"}}
{"sample_uid": "codereval_java::636766861a6d9265ec017553", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Ascertain if a template variable is a member of this template.\n * @param name name The template variable.\n * @return true if the template variable is a member of the template, otherwisefalse.\n */\npublic final boolean isTemplateVariablePresent(String name){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public final boolean isTemplateVariablePresent(String name){\n for ( String s : templateVariables) {\n if (s.equals(name)) return true;\n }\n return false;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636766861a6d9265ec017553"}}
{"sample_uid": "codereval_java::636767071a6d9265ec017962", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Puts all of the writable properties from the given BeanMap into this BeanMap. Read-only and Write-only properties will be ignored.\n * @param map the BeanMap whose properties to put\n */\npublic void putAllWriteable(BeanMap map){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public void putAllWriteable(BeanMap map){\n Iterator<String> readableKeys=map.readMethods.keySet().iterator();\n while (readableKeys.hasNext()) {\n String key=readableKeys.next();\n if (getWriteMethod(key) != null) {\n this.put(key,map.get(key));\n }\n }\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767071a6d9265ec017962"}}
{"sample_uid": "codereval_java::6367670a1a6d9265ec0179d9", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Gets a String's length or <code>0</code> if the String is <code>null</code>.\n * @param str a String or <code>null</code>\n * @return String length or <code>0</code> if the String is <code>null</code>.\n * @since 2.4\n */\npublic static int length(final String str){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public static int length(final String str){\n return str == null ? 0 : str.length();\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "6367670a1a6d9265ec0179d9"}}
{"sample_uid": "codereval_java::636767ab1a6d9265ec018676", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Is this a hex digit?\n */\nprivate static boolean isHex(final char c){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "private static boolean isHex(final char c){\n return ('0' <= c && c <= '9') || ('a' <= c && c <= 'f') || ('A' <= c && c <= 'F');\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767ab1a6d9265ec018676"}}
{"sample_uid": "codereval_java::636766f81a6d9265ec017748", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Decoding a string to a string follow the Base64 regular. \n */\npublic static String base64Decode(final String s){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public static String base64Decode(final String s){\n byte[] b=Base64.base64DecodeToArray(s);\n if (b == null) {\n return null;\n }\n if (b.length == 0) {\n return \"\";\n }\n return new String(b,StandardCharsets.UTF_8);\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636766f81a6d9265ec017748"}}
{"sample_uid": "codereval_java::636766f11a6d9265ec017663", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * <p>Checks whether two arrays are the same length, treating <code>null</code> arrays as length <code>0</code>.</p>\n * @param array1 the first array, may be <code>null</code>\n * @param array2 the second array, may be <code>null</code>\n * @return <code>true</code> if length of arrays matches, treating<code>null</code> as an empty array\n */\npublic static boolean isSameLength(final double[] array1,final double[] array2){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public static boolean isSameLength(final double[] array1,final double[] 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": "636766f11a6d9265ec017663"}}
{"sample_uid": "codereval_java::6367667d1a6d9265ec0173ff", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Retrieve an instance of {@link Meteor} based on the {@link HttpServletRequest}.\n * @param r {@link HttpServletRequest}\n * @return a {@link Meteor} or null if not found\n */\npublic static Meteor lookup(HttpServletRequest r){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public static Meteor lookup(HttpServletRequest r){\n Object o=r.getAttribute(METEOR);\n return o == null ? null : Meteor.class.isAssignableFrom(o.getClass()) ? (Meteor)o : null;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "6367667d1a6d9265ec0173ff"}}
{"sample_uid": "codereval_java::636767691a6d9265ec0181a6", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Split a String at the first occurrence of the delimiter. Does not include the delimiter in the result.\n * @param toSplit the string to split\n * @param delimiter to split the string up with\n * @return a two element array with index 0 being before the delimiter, andindex 1 being after the delimiter (neither element includes the delimiter); or <code>null</code> if the delimiter wasn't found in the given input String\n */\npublic static String[] split(String toSplit,String delimiter){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public static String[] split(String toSplit,String delimiter){\n if (!hasLength(toSplit) || !hasLength(delimiter)) {\n return null;\n }\n int offset=toSplit.indexOf(delimiter);\n if (offset < 0) {\n return null;\n }\n String beforeDelimiter=toSplit.substring(0,offset);\n String afterDelimiter=toSplit.substring(offset + delimiter.length());\n return new String[]{beforeDelimiter,afterDelimiter};\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767691a6d9265ec0181a6"}}
{"sample_uid": "codereval_java::636767601a6d9265ec0180e2", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Computes the global separator list of the {@code graph}. More precisely, for every edge $e$ in the $G = (V, E)$ computes list of minimal separators $S_e$ in the neighborhood of $e$ and then concatenates these lists. Note: the result may contain duplicates\n * @return the list of minimal separators of every edge $e$ in the inspected graph\n */\nprivate List<Pair<List<Pair<Integer,Integer>>,E>> computeGlobalSeparatorList(){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "private List<Pair<List<Pair<Integer,Integer>>,E>> computeGlobalSeparatorList(){\n List<Pair<List<Pair<Integer,Integer>>,E>> globalSeparatorList=new ArrayList<>();\n for ( E edge : graph.edgeSet()) {\n V source=graph.getEdgeSource(edge);\n V target=graph.getEdgeTarget(edge);\n if (source != target) {\n List<Set<V>> edgeSeparators=findSeparators(graph,edge);\n globalSeparatorList.addAll(reformatSeparatorList(edgeSeparators,edge));\n }\n }\n return globalSeparatorList;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767601a6d9265ec0180e2"}}
{"sample_uid": "codereval_java::636766f31a6d9265ec01768f", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * <p>Clones an array returning a typecast result and handling <code>null</code>.</p> <p>This method returns <code>null</code> for a <code>null</code> input array.</p>\n * @param array the array to clone, may be <code>null</code>\n * @return the cloned array, <code>null</code> if <code>null</code> input\n */\npublic static char[] clone(final char[] array){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public static char[] clone(final char[] array){\n if (array == null) {\n return null;\n }\n return array.clone();\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636766f31a6d9265ec01768f"}}
{"sample_uid": "codereval_java::636766831a6d9265ec0174eb", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Add the specified files in reverse order.\n */\nprivate void addReverse(final File[] files){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "private void addReverse(final File[] files){\n if (files == null) return;\n for (int i=files.length - 1; i >= 0; --i) {\n stack.add(files[i]);\n }\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636766831a6d9265ec0174eb"}}
{"sample_uid": "codereval_java::636767841a6d9265ec0183ff", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Selects a the specified row in the specified JTable and scrolls the specified JScrollpane to the newly selected row. More importantly, the call to repaint() delayed long enough to have the table properly paint the newly selected row which may be offscre\n * @param table should belong to the specified JScrollPane\n */\npublic static void selectRow(int row,JTable table,JScrollPane pane){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public static void selectRow(int row,JTable table,JScrollPane pane){\n if (table == null || pane == null) {\n return;\n }\n if (contains(row,table.getModel()) == false) {\n return;\n }\n moveAdjustable(row * table.getRowHeight(),pane.getVerticalScrollBar());\n selectRow(row,table.getSelectionModel());\n repaintLater(table);\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767841a6d9265ec0183ff"}}
{"sample_uid": "codereval_java::636766a81a6d9265ec017596", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Puts an int into this byte vector. The byte vector is automatically enlarged if necessary.\n * @param intValue an int.\n * @return this byte vector.\n */\npublic ByteVector putInt(final int intValue){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public ByteVector putInt(final int intValue){\n int currentLength=length;\n if (currentLength + 4 > data.length) {\n enlarge(4);\n }\n byte[] currentData=data;\n currentData[currentLength++]=(byte)(intValue >>> 24);\n currentData[currentLength++]=(byte)(intValue >>> 16);\n currentData[currentLength++]=(byte)(intValue >>> 8);\n currentData[currentLength++]=(byte)intValue;\n length=currentLength;\n return this;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636766a81a6d9265ec017596"}}
{"sample_uid": "codereval_java::636766fd1a6d9265ec017814", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Compares <code>count</code> first bytes in the arrays <code>a</code> and <code>b</code>.\n * @param a The first array to compare.\n * @param b The second array to compare.\n * @param count How many bytes should be compared.\n * @return <code>true</code> if <code>count</code> first bytes in arrays<code>a</code> and <code>b</code> are equal.\n */\npublic static boolean arrayequals(byte[] a,byte[] b,int count){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public static boolean arrayequals(byte[] a,byte[] b,int count){\n for (int i=0; i < count; i++) {\n if (a[i] != b[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": "636766fd1a6d9265ec017814"}}
{"sample_uid": "codereval_java::636767861a6d9265ec018440", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Abbreviate name.\n * @param buf buffer to append abbreviation.\n * @param nameStart start of name to abbreviate.\n */\npublic void abbreviate(final int nameStart,final StringBuffer buf){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public void abbreviate(final int nameStart,final StringBuffer buf){\n int i=count;\n for (int pos=buf.indexOf(\".\",nameStart); pos != -1; pos=buf.indexOf(\".\",pos + 1)) {\n if (--i == 0) {\n buf.delete(nameStart,pos + 1);\n break;\n }\n }\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767861a6d9265ec018440"}}
{"sample_uid": "codereval_java::6367667d1a6d9265ec01741d", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Resolves the first bound for the {@code typeVariable}, returning {@code Unknown.class} if nonecan be resolved.\n */\npublic static Type resolveBound(TypeVariable<?> typeVariable){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public static Type resolveBound(TypeVariable<?> typeVariable){\n Type[] bounds=typeVariable.getBounds();\n if (bounds.length == 0) return Unknown.class;\n Type bound=bounds[0];\n if (bound instanceof TypeVariable) bound=resolveBound((TypeVariable<?>)bound);\n return bound == Object.class ? Unknown.class : bound;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "6367667d1a6d9265ec01741d"}}
{"sample_uid": "codereval_java::6367675f1a6d9265ec0180cf", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Check whether the subgraph of <code>graph</code> induced by the given <code>vertices</code> is complete, i.e. a clique.\n * @param graph the graph.\n * @param vertices the vertices to induce the subgraph from.\n * @return true if the induced subgraph is a clique.\n */\nprivate static <V,E>boolean isClique(Graph<V,E> graph,Set<V> vertices){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "private static <V,E>boolean isClique(Graph<V,E> graph,Set<V> vertices){\n for ( V v1 : vertices) {\n for ( V v2 : vertices) {\n if (!v1.equals(v2) && (graph.getEdge(v1,v2) == null)) {\n return false;\n }\n }\n }\n return true;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "6367675f1a6d9265ec0180cf"}}
{"sample_uid": "codereval_java::636767431a6d9265ec017c88", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Finds a maximum lower bound for every key.\n * @param keys list of keys.\n * @return the computed key lower bounds.\n */\nprivate List<Integer> computeLowerBounds(List<K> keys){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "private List<Integer> computeLowerBounds(List<K> keys){\n List<Integer> keyLowerBounds=new ArrayList<>(keys.size());\n for ( K key : keys) {\n int lowerBound=0;\n for ( Function<K,Integer> lowerBoundFunction : lowerBounds) {\n lowerBound=Math.max(lowerBound,lowerBoundFunction.apply(key));\n }\n keyLowerBounds.add(lowerBound);\n }\n return keyLowerBounds;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767431a6d9265ec017c88"}}
{"sample_uid": "codereval_java::636766a91a6d9265ec0175c4", "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": "636766a91a6d9265ec0175c4"}}
{"sample_uid": "codereval_java::636766fb1a6d9265ec0177c3", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * <p>Checks whether the character is ASCII 7 bit.</p> <pre> CharUtils.isAscii('a') = true CharUtils.isAscii('A') = true CharUtils.isAscii('3') = true CharUtils.isAscii('-') = true CharUtils.isAscii('\\n') = true CharUtils.isAscii('&copy;') = false </pre>\n * @param ch the character to check\n * @return true if less than 128\n */\npublic static boolean isAscii(final char ch){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public static boolean isAscii(final char ch){\n return ch < 128;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636766fb1a6d9265ec0177c3"}}
{"sample_uid": "codereval_java::636767581a6d9265ec017fb4", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Finds a minimum lower bound for every key.\n * @param keys a list of keys.\n * @return the computed key upper bound.\n */\nprivate List<Integer> computeUpperBounds(List<K> keys){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "private List<Integer> computeUpperBounds(List<K> keys){\n List<Integer> keyUpperBounds=new ArrayList<>(keys.size());\n for ( K key : keys) {\n int upperBound=Integer.MAX_VALUE;\n for ( Function<K,Integer> upperBoundFunction : upperBounds) {\n upperBound=Math.min(upperBound,upperBoundFunction.apply(key));\n }\n keyUpperBounds.add(upperBound);\n }\n return keyUpperBounds;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767581a6d9265ec017fb4"}}
{"sample_uid": "codereval_java::636766801a6d9265ec017487", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Encodes a string with template parameters names present, specifically the characters '{' and '}' will be percent-encoded.\n * @param s the string with zero or more template parameters names\n * @return the string with encoded template parameters names.\n */\npublic static String encodeTemplateNames(String s){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public static String encodeTemplateNames(String s){\n int i=s.indexOf('{');\n if (i != -1) s=s.replace(\"{\",\"%7B\");\n i=s.indexOf('}');\n if (i != -1) s=s.replace(\"}\",\"%7D\");\n return s;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636766801a6d9265ec017487"}}
{"sample_uid": "codereval_java::636767531a6d9265ec017ef1", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Compare two points for equality using tolerance 1e-9.\n * @param p1 the first point\n * @param p2 the second point\n * @return whether the two points are equal or not\n */\npublic static boolean equals(Point2D p1,Point2D p2){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public static boolean equals(Point2D p1,Point2D p2){\n int xEquals=TOLERANCE_DOUBLE_COMPARATOR.compare(p1.getX(),p2.getX());\n if (xEquals != 0) {\n return false;\n }\n return TOLERANCE_DOUBLE_COMPARATOR.compare(p1.getY(),p2.getY()) == 0;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767531a6d9265ec017ef1"}}
{"sample_uid": "codereval_java::6367667c1a6d9265ec0173fb", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Add a {@link AtmosphereResourceEventListener}.\n * @param e an instance of AtmosphereResourceEventListener\n */\n@Override public AtmosphereResource addEventListener(AtmosphereResourceEventListener e){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "@Override public AtmosphereResource addEventListener(AtmosphereResourceEventListener e){\n if (listeners.contains(e)) return this;\n listeners.add(e);\n return this;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "6367667c1a6d9265ec0173fb"}}
{"sample_uid": "codereval_java::636767691a6d9265ec0181ac", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Apply the given relative path to the given path, assuming standard Java folder separation (i.e. \"/\" separators).\n * @param path the path to start from (usually a full file path)\n * @param relativePath the relative path to apply(relative to the full file path above)\n * @return the full file path that results from applying the relative path\n */\npublic static String applyRelativePath(String path,String relativePath){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public static String applyRelativePath(String path,String relativePath){\n int separatorIndex=path.lastIndexOf(FOLDER_SEPARATOR);\n if (separatorIndex != -1) {\n String newPath=path.substring(0,separatorIndex);\n if (!relativePath.startsWith(FOLDER_SEPARATOR)) {\n newPath+=FOLDER_SEPARATOR;\n }\n return newPath + relativePath;\n }\n else {\n return relativePath;\n }\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767691a6d9265ec0181ac"}}
{"sample_uid": "codereval_java::636767021a6d9265ec0178bc", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Finds the first index within a String, handling <code>null</code>. This method uses {@link String#indexOf(String)}. \n */\npublic static int indexOf(String str,String searchStr){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public static int indexOf(String str,String searchStr){\n if (str == null || searchStr == null) {\n return StringUtils.INDEX_NOT_FOUND;\n }\n return str.indexOf(searchStr);\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767021a6d9265ec0178bc"}}
{"sample_uid": "codereval_java::636766fc1a6d9265ec0177ef", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Returns a new array of Strings without null elements. Internal method used to normalize exclude lists (arrays and collections). Note that {@link Arrays#sort(Object[])} will throw an {@link NullPointerException}if an array element is <code>null</code>.\n * @param array The array to check\n * @return The given array or a new array without null.\n */\nstatic String[] toNoNullStringArray(Object[] array){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "static String[] toNoNullStringArray(Object[] array){\n ArrayList<String> list=new ArrayList<String>(array.length);\n for (int i=0; i < array.length; i++) {\n Object e=array[i];\n if (e != null) {\n list.add(e.toString());\n }\n }\n return (String[])list.toArray(ArrayUtils.EMPTY_STRING_ARRAY);\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636766fc1a6d9265ec0177ef"}}
{"sample_uid": "codereval_java::636767061a6d9265ec01794a", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Returns the index of the last extension separator character, which is a dot. <p> This method also checks that there is no directory separator after the last dot. To do this it uses {@link #indexOfLastSeparator(String)} which willhandle a file in either Unix or Windows format. <p> The output will be the same irrespective of the machine that the code is running on.\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 indexOfExtension(String filename){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public static int indexOfExtension(String filename){\n if (filename == null) {\n return -1;\n }\n int extensionPos=filename.lastIndexOf(EXTENSION_SEPARATOR);\n int lastSeparator=indexOfLastSeparator(filename);\n return lastSeparator > extensionPos ? -1 : extensionPos;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767061a6d9265ec01794a"}}
{"sample_uid": "codereval_java::636767dd1a6d9265ec0186de", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * @param timestamp of current time\n * @param expiredThreshold represents the duration between last update time and the time point removing from cache.\n * @return true means this metrics should be removed from cache.\n */\npublic boolean isExpired(long timestamp,long expiredThreshold){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public boolean isExpired(long timestamp,long expiredThreshold){\n return timestamp - lastUpdateTimestamp > expiredThreshold;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767dd1a6d9265ec0186de"}}
{"sample_uid": "codereval_java::6367675d1a6d9265ec018082", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Returns an edge connecting previously returned node with node, which will be returned next. If either of the mentioned nodes is virtual, the edge will be incident to its real counterpart.\n * @return an edge from the current node to the next node\n */\nEdge edgeToNext(){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "Edge edgeToNext(){\n Edge edge=prev.embedded.getFirst();\n Node target=toExistingNode(current);\n Node source=toExistingNode(prev);\n if (edge.getOpposite(source) == target) {\n return edge;\n }\n else {\n return prev.embedded.getLast();\n }\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "6367675d1a6d9265ec018082"}}
{"sample_uid": "codereval_java::6367676b1a6d9265ec0181e9", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Returns {@code true} if the given string matches the given substring at the given index, {@code false} otherwise.\n * @param str the original string (or StringBuilder)\n * @param index the index in the original string to start matching against\n * @param substring the substring to match at the given index\n * @return {@code true} if the given string matches the given substring at the given index, {@code false} otherwise.\n */\npublic static boolean substringMatch(CharSequence str,int index,CharSequence substring){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public static boolean substringMatch(CharSequence str,int index,CharSequence substring){\n for (int j=0; j < substring.length(); j++) {\n int i=index + j;\n if (i >= str.length() || str.charAt(i) != substring.charAt(j)) {\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": "6367676b1a6d9265ec0181e9"}}
{"sample_uid": "codereval_java::636767781a6d9265ec01823e", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Handles a log event. For this appender, that means writing the message to each connected client. \n */\nprotected void append(LoggingEvent event){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "protected void append(LoggingEvent event){\n if (sh != null) {\n sh.send(layout.format(event));\n if (layout.ignoresThrowable()) {\n String[] s=event.getThrowableStrRep();\n if (s != null) {\n StringBuffer buf=new StringBuffer();\n for (int i=0; i < s.length; i++) {\n buf.append(s[i]);\n buf.append(\"\\r\\n\");\n }\n sh.send(buf.toString());\n }\n }\n }\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767781a6d9265ec01823e"}}
{"sample_uid": "codereval_java::6367670b1a6d9265ec017a05", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * <p>Converts the character to a String that contains the one character.</p> <p>For ASCII 7 bit characters, this uses a cache that will return the same String object each time.</p> <pre> CharUtils.toString(' ') = \" \" CharUtils.toString('A') = \"A\" </pre>\n * @param ch the character to convert\n * @return a String containing the one specified character\n */\npublic static String toString(final char ch){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public static String toString(final char ch){\n if (ch < 128) {\n return CharUtils.CHAR_STRING_ARRAY[ch];\n }\n return new String(new char[]{ch});\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "6367670b1a6d9265ec017a05"}}
{"sample_uid": "codereval_java::636767a31a6d9265ec01854f", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Check if this field have been packed into a length-delimited field. If so, update internal state to reflect that packed fields are being read.\n * @throws IOException\n */\nprivate void checkIfPackedField() throws IOException {", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "private void checkIfPackedField() throws IOException {\n if (packedLimit == 0 && WireFormat.getTagWireType(lastTag) == WIRETYPE_LENGTH_DELIMITED) {\n final int length=readRawVarint32();\n if (length < 0) throw ProtobufException.negativeSize();\n this.packedLimit=getTotalBytesRead() + length;\n }\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767a31a6d9265ec01854f"}}
{"sample_uid": "codereval_java::636767a81a6d9265ec0185fc", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Attempt to read a field tag, returning zero if we have reached EOF. Protocol message parsers use this to read tags, since a protocol message may legally end wherever a tag occurs, and zero is not a valid tag number.\n */\npublic int readTag() throws IOException {", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public int readTag() throws IOException {\n if (!buffer.hasRemaining()) {\n lastTag=0;\n return 0;\n }\n final int tag=readRawVarint32();\n if (tag >>> TAG_TYPE_BITS == 0) {\n throw ProtobufException.invalidTag();\n }\n lastTag=tag;\n return tag;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767a81a6d9265ec0185fc"}}
{"sample_uid": "codereval_java::636766a81a6d9265ec017595", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Puts two bytes into this byte vector. The byte vector is automatically enlarged if necessary.\n * @param byteValue1 a byte.\n * @param byteValue2 another byte.\n * @return this byte vector.\n */\nfinal ByteVector put11(final int byteValue1,final int byteValue2){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "final ByteVector put11(final int byteValue1,final int byteValue2){\n int currentLength=length;\n if (currentLength + 2 > data.length) {\n enlarge(2);\n }\n byte[] currentData=data;\n currentData[currentLength++]=(byte)byteValue1;\n currentData[currentLength++]=(byte)byteValue2;\n length=currentLength;\n return this;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636766a81a6d9265ec017595"}}
{"sample_uid": "codereval_java::636766ae1a6d9265ec0175d8", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * Build the 'Content-Range' HTTP Header value.\n * @return 'Content-Range' value\n */\nprivate String buildContentRange(){", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "private String buildContentRange(){\n Integer limit=drc.getLimit() == null ? getDefaultNumberPagination() - 1 : drc.getLimit();\n Integer offset=drc.getOffset() == null ? 0 : drc.getOffset();\n Long count=drc.getCount() == null ? 0 : drc.getCount();\n return offset + \"-\" + (limit.equals(0) ? count - 1 : limit)+ \"/\"+ count;\n}\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636766ae1a6d9265ec0175d8"}}
{"sample_uid": "codereval_java::636767e11a6d9265ec018790", "benchmark_id": "codereval_java", "family": "code_generation_ref", "language": "java", "prompt": "/** \n * load thread snapshots in appointing time range\n */\npublic static List<ThreadSnapshot> parseFromFileWithTimeRange(File file,List<ProfileAnalyzeTimeRange> timeRanges) throws IOException {", "context": {"source_dataset": "vitaleantonio/codereval-java", "split": "train"}, "reference": "public static List<ThreadSnapshot> parseFromFileWithTimeRange(File file,List<ProfileAnalyzeTimeRange> timeRanges) throws IOException {\n try (final FileInputStream fileInputStream=new FileInputStream(file)){\n ThreadSnapshot snapshot;\n final ArrayList<ThreadSnapshot> data=new ArrayList<>();\n while ((snapshot=ThreadSnapshot.parseDelimitedFrom(fileInputStream)) != null) {\n ThreadSnapshot finalSnapshot=snapshot;\n if (timeRanges.stream().filter(t -> finalSnapshot.getTime() >= t.getStart() && finalSnapshot.getTime() <= t.getEnd()).findFirst().isPresent()) {\n data.add(snapshot);\n }\n }\n return data;\n }\n }\n", "tests": {}, "repo_meta": {}, "metric_protocol": {"type": "reference_text", "family": "code_generation_ref"}, "raw_metadata": {"id": "636767e11a6d9265ec018790"}}