id
stringlengths
21
23
content
stringlengths
1.65k
252k
codereval_java_data_201
/** * Computes the global separator list of the {@code graph}. More precisely, for every edge $e$ in the $G = (V, E)$ computes list of minimal separators $S_e$ in the neighborhood of $e$ and then concatenates these lists. Note: the result may contain duplicates * @return the list of minimal separators of every edge...
codereval_java_data_202
/** * <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> * @param array the array to clone, may be <code>null</code> * @return the cloned array, <code>null</code> if <code>null</code> input */ publi...
codereval_java_data_203
/** * Add the specified files in reverse order. */ private void addReverse(final File[] files){ if (files == null) return; for (int i=files.length - 1; i >= 0; --i) { stack.add(files[i]); } } /* * Copyright 2008-2022 Async-IO.org * * Licensed under the Apache License, Version 2.0 (the "License"); ...
codereval_java_data_204
/** * Selects a the specified row in the specified JTable and scrolls the specified JScrollpane to the newly selected row. More importantly, the call to repaint() delayed long enough to have the table properly paint the newly selected row which may be offscre * @param table should belong to the specified JScrollPane...
codereval_java_data_205
/** * Puts an int into this byte vector. The byte vector is automatically enlarged if necessary. * @param intValue an int. * @return this byte vector. */ public ByteVector putInt(final int intValue){ int currentLength=length; if (currentLength + 4 > data.length) { enlarge(4); } byte[] currentData=dat...
codereval_java_data_206
/** * Compares <code>count</code> first bytes in the arrays <code>a</code> and <code>b</code>. * @param a The first array to compare. * @param b The second array to compare. * @param count How many bytes should be compared. * @return <code>true</code> if <code>count</code> first bytes in arrays<code>a</co...
codereval_java_data_207
/** * Abbreviate name. * @param buf buffer to append abbreviation. * @param nameStart start of name to abbreviate. */ public void abbreviate(final int nameStart,final StringBuffer buf){ int i=count; for (int pos=buf.indexOf(".",nameStart); pos != -1; pos=buf.indexOf(".",pos + 1)) { if (--i == 0) { ...
codereval_java_data_208
/** * Resolves the first bound for the {@code typeVariable}, returning {@code Unknown.class} if nonecan be resolved. */ public static Type resolveBound(TypeVariable<?> typeVariable){ Type[] bounds=typeVariable.getBounds(); if (bounds.length == 0) return Unknown.class; Type bound=bounds[0]; if (bound in...
codereval_java_data_209
/** * Check whether the subgraph of <code>graph</code> induced by the given <code>vertices</code> is complete, i.e. a clique. * @param graph the graph. * @param vertices the vertices to induce the subgraph from. * @return true if the induced subgraph is a clique. */ private static <V,E>boolean isClique(Graph<V,...
codereval_java_data_210
/** * Finds a maximum lower bound for every key. * @param keys list of keys. * @return the computed key lower bounds. */ private List<Integer> computeLowerBounds(List<K> keys){ List<Integer> keyLowerBounds=new ArrayList<>(keys.size()); for ( K key : keys) { int lowerBound=0; for ( Function<K,Inte...
codereval_java_data_211
/** * Pops as many abstract types from the output frame stack as described by the given descriptor. * @param descriptor a type or method descriptor (in which case its argument types are popped). */ private void pop(final String descriptor){ char firstDescriptorChar=descriptor.charAt(0); if (firstDescriptorCha...
codereval_java_data_212
/** * <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> * @param ch the character to check * @return true if ...
codereval_java_data_213
/** * Finds a minimum lower bound for every key. * @param keys a list of keys. * @return the computed key upper bound. */ private List<Integer> computeUpperBounds(List<K> keys){ List<Integer> keyUpperBounds=new ArrayList<>(keys.size()); for ( K key : keys) { int upperBound=Integer.MAX_VALUE; for ( ...
codereval_java_data_214
/** * Encodes a string with template parameters names present, specifically the characters '{' and '}' will be percent-encoded. * @param s the string with zero or more template parameters names * @return the string with encoded template parameters names. */ public static String encodeTemplateNames(String s){ i...
codereval_java_data_215
/** * Compare two points for equality using tolerance 1e-9. * @param p1 the first point * @param p2 the second point * @return whether the two points are equal or not */ public static boolean equals(Point2D p1,Point2D p2){ int xEquals=TOLERANCE_DOUBLE_COMPARATOR.compare(p1.getX(),p2.getX()); if (xEquals != ...
codereval_java_data_216
/** * Add a {@link AtmosphereResourceEventListener}. * @param e an instance of AtmosphereResourceEventListener */ @Override public AtmosphereResource addEventListener(AtmosphereResourceEventListener e){ if (listeners.contains(e)) return this; listeners.add(e); return this; } /* * Copyright 2008-2022 A...
codereval_java_data_217
/** * Apply the given relative path to the given path, assuming standard Java folder separation (i.e. "/" separators). * @param path the path to start from (usually a full file path) * @param relativePath the relative path to apply(relative to the full file path above) * @return the full file path that results fro...
codereval_java_data_218
/** * Finds the first index within a String, handling <code>null</code>. This method uses {@link String#indexOf(String)}. */ public static int indexOf(String str,String searchStr){ if (str == null || searchStr == null) { return StringUtils.INDEX_NOT_FOUND; } return str.indexOf(searchStr); } /* * Cop...
codereval_java_data_219
/** * 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>. * @param array The array to check * @return The given arr...
codereval_java_data_220
/** * 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 ir...
codereval_java_data_221
/** * @param timestamp of current time * @param expiredThreshold represents the duration between last update time and the time point removing from cache. * @return true means this metrics should be removed from cache. */ public boolean isExpired(long timestamp,long expiredThreshold){ return timestamp - ...
codereval_java_data_222
/** * Returns an edge connecting previously returned node with node, which will be returned next. If either of the mentioned nodes is virtual, the edge will be incident to its real counterpart. * @return an edge from the current node to the next node */ Edge edgeToNext(){ Edge edge=prev.embedded.getFirst(); N...
codereval_java_data_223
/** * Returns {@code true} if the given string matches the given substring at the given index, {@code false} otherwise. * @param str the original string (or StringBuilder) * @param index the index in the original string to start matching against * @param substring the substring to match at the given index * @ret...
codereval_java_data_224
/** * Handles a log event. For this appender, that means writing the message to each connected client. */ protected void append(LoggingEvent event){ if (sh != null) { sh.send(layout.format(event)); if (layout.ignoresThrowable()) { String[] s=event.getThrowableStrRep(); if (s != null) { ...
codereval_java_data_225
/** * <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> * @param ch the character to convert * @return a String...
codereval_java_data_226
/** * Check if this field have been packed into a length-delimited field. If so, update internal state to reflect that packed fields are being read. * @throws IOException */ private void checkIfPackedField() throws IOException { if (packedLimit == 0 && WireFormat.getTagWireType(lastTag) == WIRETYPE_LENGTH_DELIM...
codereval_java_data_227
/** * Attempt to read a field tag, returning zero if we have reached EOF. Protocol message parsers use this to read tags, since a protocol message may legally end wherever a tag occurs, and zero is not a valid tag number. */ public int readTag() throws IOException { if (!buffer.hasRemaining()) { lastTag=0; ...
codereval_java_data_228
/** * Puts two bytes into this byte vector. The byte vector is automatically enlarged if necessary. * @param byteValue1 a byte. * @param byteValue2 another byte. * @return this byte vector. */ final ByteVector put11(final int byteValue1,final int byteValue2){ int currentLength=length; if (currentLength + 2 ...
codereval_java_data_229
/** * Build the 'Content-Range' HTTP Header value. * @return 'Content-Range' value */ private String buildContentRange(){ Integer limit=drc.getLimit() == null ? getDefaultNumberPagination() - 1 : drc.getLimit(); Integer offset=drc.getOffset() == null ? 0 : drc.getOffset(); Long count=drc.getCount() == null ...
codereval_java_data_230
/** * load thread snapshots in appointing time range */ public static List<ThreadSnapshot> parseFromFileWithTimeRange(File file,List<ProfileAnalyzeTimeRange> timeRanges) throws IOException { try (final FileInputStream fileInputStream=new FileInputStream(file)){ ThreadSnapshot snapshot; final ArrayList<Th...