code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { @Deprecated public TimeUnitFormat setLocale(ULocale locale) { if (locale != this.locale){ mf = mf.withLocale(locale); // Needed for getLocale(ULocale.VALID_LOCALE) setLocale(locale, locale); this.locale = locale; isReady = false; } return this; } }
public class class_name { @Deprecated public TimeUnitFormat setLocale(ULocale locale) { if (locale != this.locale){ mf = mf.withLocale(locale); // depends on control dependency: [if], data = [(locale] // Needed for getLocale(ULocale.VALID_LOCALE) setLocale(locale, locale); // depends on control dependency: [if], data = [(locale] this.locale = locale; // depends on control dependency: [if], data = [none] isReady = false; // depends on control dependency: [if], data = [none] } return this; } }
public class class_name { public String getText() { StringBuilder text = new StringBuilder(); Token t = firstToken; while ( t!=null ) { text.append(t.image); if ( !t.image.equals(".") ) text.append(" "); if ( t==lastToken || t.image.equals("{") || t.image.equals(";") ) break; t=t.next; } return text.toString(); } }
public class class_name { public String getText() { StringBuilder text = new StringBuilder(); Token t = firstToken; while ( t!=null ) { text.append(t.image); // depends on control dependency: [while], data = [none] if ( !t.image.equals(".") ) text.append(" "); if ( t==lastToken || t.image.equals("{") || t.image.equals(";") ) break; t=t.next; // depends on control dependency: [while], data = [none] } return text.toString(); } }
public class class_name { private static void initializeOptimisticLock() { try { if (System.getProperty(NonOptimisticLock.class.getName()) == null) { new OptimisticLockStamped(); optimisticLockImplementation = OptimisticLockStamped.class; return; } } catch (NoClassDefFoundError ignore) { } optimisticLockImplementation = NonOptimisticLock.class; } }
public class class_name { private static void initializeOptimisticLock() { try { if (System.getProperty(NonOptimisticLock.class.getName()) == null) { new OptimisticLockStamped(); // depends on control dependency: [if], data = [none] optimisticLockImplementation = OptimisticLockStamped.class; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } } catch (NoClassDefFoundError ignore) { } // depends on control dependency: [catch], data = [none] optimisticLockImplementation = NonOptimisticLock.class; } }
public class class_name { public void handle(String pathInContext, String pathParams, HttpRequest request, HttpResponse response) throws HttpException, IOException { // exempt error pages // TODO This probably should be more general? if (request.getAttribute("javax.servlet.error.status_code") != null) return; try { String ip = request.getRemoteAddr(); boolean authorized = checkIP(ip); if (!authorized) { // The IP is NOT allowed response.sendError(HttpResponse.__403_Forbidden); request.setHandled(true); return; } else { // The IP is allowed return; } } catch (Exception ex) { System.out.println(ex); response.sendError(HttpResponse.__500_Internal_Server_Error); request.setHandled(true); } } }
public class class_name { public void handle(String pathInContext, String pathParams, HttpRequest request, HttpResponse response) throws HttpException, IOException { // exempt error pages // TODO This probably should be more general? if (request.getAttribute("javax.servlet.error.status_code") != null) return; try { String ip = request.getRemoteAddr(); boolean authorized = checkIP(ip); if (!authorized) { // The IP is NOT allowed response.sendError(HttpResponse.__403_Forbidden); // depends on control dependency: [if], data = [none] request.setHandled(true); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } else { // The IP is allowed return; // depends on control dependency: [if], data = [none] } } catch (Exception ex) { System.out.println(ex); response.sendError(HttpResponse.__500_Internal_Server_Error); request.setHandled(true); } } }
public class class_name { public SslContextBuilder trustManager(InputStream trustCertCollectionInputStream) { try { return trustManager(SslContext.toX509Certificates(trustCertCollectionInputStream)); } catch (Exception e) { throw new IllegalArgumentException("Input stream does not contain valid certificates.", e); } } }
public class class_name { public SslContextBuilder trustManager(InputStream trustCertCollectionInputStream) { try { return trustManager(SslContext.toX509Certificates(trustCertCollectionInputStream)); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new IllegalArgumentException("Input stream does not contain valid certificates.", e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private void openNewPartFile(Path bucketPath, BucketState<T> bucketState) throws Exception { closeCurrentPartFile(bucketState); if (!fs.exists(bucketPath)) { try { if (fs.mkdirs(bucketPath)) { LOG.debug("Created new bucket directory: {}", bucketPath); } } catch (IOException e) { throw new RuntimeException("Could not create new bucket path.", e); } } // The following loop tries different partCounter values in ascending order until it reaches the minimum // that is not yet used. This works since there is only one parallel subtask that tries names with this // subtask id. Otherwise we would run into concurrency issues here. This is aligned with the way we now // clean the base directory in case of rescaling. int subtaskIndex = getRuntimeContext().getIndexOfThisSubtask(); Path partPath = assemblePartPath(bucketPath, subtaskIndex, bucketState.partCounter); while (fs.exists(partPath) || fs.exists(getPendingPathFor(partPath)) || fs.exists(getInProgressPathFor(partPath))) { bucketState.partCounter++; partPath = assemblePartPath(bucketPath, subtaskIndex, bucketState.partCounter); } // Record the creation time of the bucket bucketState.creationTime = processingTimeService.getCurrentProcessingTime(); // increase, so we don't have to check for this name next time bucketState.partCounter++; LOG.debug("Next part path is {}", partPath.toString()); bucketState.currentFile = partPath.toString(); Path inProgressPath = getInProgressPathFor(partPath); if (bucketState.writer == null) { bucketState.writer = writerTemplate.duplicate(); if (bucketState.writer == null) { throw new UnsupportedOperationException( "Could not duplicate writer. " + "Class '" + writerTemplate.getClass().getCanonicalName() + "' must implement the 'Writer.duplicate()' method." ); } } bucketState.writer.open(fs, inProgressPath); bucketState.isWriterOpen = true; } }
public class class_name { private void openNewPartFile(Path bucketPath, BucketState<T> bucketState) throws Exception { closeCurrentPartFile(bucketState); if (!fs.exists(bucketPath)) { try { if (fs.mkdirs(bucketPath)) { LOG.debug("Created new bucket directory: {}", bucketPath); // depends on control dependency: [if], data = [none] } } catch (IOException e) { throw new RuntimeException("Could not create new bucket path.", e); } // depends on control dependency: [catch], data = [none] } // The following loop tries different partCounter values in ascending order until it reaches the minimum // that is not yet used. This works since there is only one parallel subtask that tries names with this // subtask id. Otherwise we would run into concurrency issues here. This is aligned with the way we now // clean the base directory in case of rescaling. int subtaskIndex = getRuntimeContext().getIndexOfThisSubtask(); Path partPath = assemblePartPath(bucketPath, subtaskIndex, bucketState.partCounter); while (fs.exists(partPath) || fs.exists(getPendingPathFor(partPath)) || fs.exists(getInProgressPathFor(partPath))) { bucketState.partCounter++; partPath = assemblePartPath(bucketPath, subtaskIndex, bucketState.partCounter); } // Record the creation time of the bucket bucketState.creationTime = processingTimeService.getCurrentProcessingTime(); // increase, so we don't have to check for this name next time bucketState.partCounter++; LOG.debug("Next part path is {}", partPath.toString()); bucketState.currentFile = partPath.toString(); Path inProgressPath = getInProgressPathFor(partPath); if (bucketState.writer == null) { bucketState.writer = writerTemplate.duplicate(); if (bucketState.writer == null) { throw new UnsupportedOperationException( "Could not duplicate writer. " + "Class '" + writerTemplate.getClass().getCanonicalName() + "' must implement the 'Writer.duplicate()' method." ); } } bucketState.writer.open(fs, inProgressPath); bucketState.isWriterOpen = true; } }
public class class_name { public void updateLowestMessagePriority(short messagePriority) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "updateLowestMessagePriority", messagePriority); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Joined resource:", joinedResource); if (joinedResource != null) { joinedResource.updateLowestMessagePriority(messagePriority); } else { super.updateLowestMessagePriority(messagePriority); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "updateLowestMessagePriority"); } }
public class class_name { public void updateLowestMessagePriority(short messagePriority) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "updateLowestMessagePriority", messagePriority); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Joined resource:", joinedResource); if (joinedResource != null) { joinedResource.updateLowestMessagePriority(messagePriority); // depends on control dependency: [if], data = [none] } else { super.updateLowestMessagePriority(messagePriority); // depends on control dependency: [if], data = [none] } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "updateLowestMessagePriority"); } }
public class class_name { public List<FeatureInterface<AbstractSequence<C>, C>> getFeatures(int bioSequencePosition) { ArrayList<FeatureInterface<AbstractSequence<C>, C>> featureHits = new ArrayList<FeatureInterface<AbstractSequence<C>, C>>(); if (features != null) { for (FeatureInterface<AbstractSequence<C>, C> feature : features) { if (bioSequencePosition >= feature.getLocations().getStart().getPosition() && bioSequencePosition <= feature.getLocations().getEnd().getPosition()) { featureHits.add(feature); } } } return featureHits; } }
public class class_name { public List<FeatureInterface<AbstractSequence<C>, C>> getFeatures(int bioSequencePosition) { ArrayList<FeatureInterface<AbstractSequence<C>, C>> featureHits = new ArrayList<FeatureInterface<AbstractSequence<C>, C>>(); if (features != null) { for (FeatureInterface<AbstractSequence<C>, C> feature : features) { if (bioSequencePosition >= feature.getLocations().getStart().getPosition() && bioSequencePosition <= feature.getLocations().getEnd().getPosition()) { featureHits.add(feature); // depends on control dependency: [if], data = [none] } } } return featureHits; } }
public class class_name { protected String changeCase(String originalString, String mode) { String targetString = originalString; // mode is case insensitive, allow upper for example CaseFormatMode changeCaseMode = CaseFormatMode.get(mode.toUpperCase()); if (changeCaseMode != null) { switch (changeCaseMode) { case LOWER_CAMEL_CASE: targetString = camelFormat(originalString, false); break; case UPPER_CAMEL_CASE: targetString = camelFormat(originalString, true); break; case SNAKE_CASE: case LOWER_UNDERSCORE: targetString = caseFormatWithDelimiter(originalString, UNDERSCORE, false, true); break; case KEBAB_CASE: case LISP_CASE: case SPINAL_CASE: case LOWER_HYPHEN: targetString = caseFormatWithDelimiter(originalString, HYPHEN_MINUS, false, true); break; case TRAIN_CASE: targetString = caseFormatWithDelimiter(originalString, HYPHEN_MINUS, true, false); break; case UPPER_UNDERSCORE: targetString = caseFormatWithDelimiter(originalString, UNDERSCORE, true, false); break; default: // default not doing nothing to originalString } } else { LOGGER.error("Unknown mode {}, returning {} unchanged", mode, targetString); } return targetString; } }
public class class_name { protected String changeCase(String originalString, String mode) { String targetString = originalString; // mode is case insensitive, allow upper for example CaseFormatMode changeCaseMode = CaseFormatMode.get(mode.toUpperCase()); if (changeCaseMode != null) { switch (changeCaseMode) { case LOWER_CAMEL_CASE: targetString = camelFormat(originalString, false); break; case UPPER_CAMEL_CASE: targetString = camelFormat(originalString, true); break; case SNAKE_CASE: case LOWER_UNDERSCORE: targetString = caseFormatWithDelimiter(originalString, UNDERSCORE, false, true); break; case KEBAB_CASE: case LISP_CASE: case SPINAL_CASE: case LOWER_HYPHEN: targetString = caseFormatWithDelimiter(originalString, HYPHEN_MINUS, false, true); break; case TRAIN_CASE: targetString = caseFormatWithDelimiter(originalString, HYPHEN_MINUS, true, false); break; case UPPER_UNDERSCORE: targetString = caseFormatWithDelimiter(originalString, UNDERSCORE, true, false); break; default: // default not doing nothing to originalString } } else { LOGGER.error("Unknown mode {}, returning {} unchanged", mode, targetString); // depends on control dependency: [if], data = [none] } return targetString; } }
public class class_name { private void calcNormalMatchPrices(int pos, int posState, int avail, int anyMatchPrice, int startLen) { // If the longest match is so long that it would not fit into // the opts array, shorten the matches. if (matches.len[matches.count - 1] > avail) { matches.count = 0; while (matches.len[matches.count] < avail) ++matches.count; matches.len[matches.count++] = avail; } if (matches.len[matches.count - 1] < startLen) return; while (optEnd < optCur + matches.len[matches.count - 1]) opts[++optEnd].reset(); int normalMatchPrice = getNormalMatchPrice(anyMatchPrice, opts[optCur].state); int match = 0; while (startLen > matches.len[match]) ++match; for (int len = startLen; ; ++len) { int dist = matches.dist[match]; // Calculate the price of a match of len bytes from the nearest // possible distance. int matchAndLenPrice = getMatchAndLenPrice(normalMatchPrice, dist, len, posState); if (matchAndLenPrice < opts[optCur + len].price) opts[optCur + len].set1(matchAndLenPrice, optCur, dist + REPS); if (len != matches.len[match]) continue; // Try match + literal + rep0. First get the length of the rep0. int len2Limit = Math.min(niceLen, avail - len - 1); int len2 = lz.getMatchLen(len + 1, dist, len2Limit); if (len2 >= MATCH_LEN_MIN) { nextState.set(opts[optCur].state); nextState.updateMatch(); // Literal int curByte = lz.getByte(len, 0); int matchByte = lz.getByte(0); // lz.getByte(len, len) int prevByte = lz.getByte(len, 1); int price = matchAndLenPrice + literalEncoder.getPrice(curByte, matchByte, prevByte, pos + len, nextState); nextState.updateLiteral(); // Rep0 int nextPosState = (pos + len + 1) & posMask; price += getLongRepAndLenPrice(0, len2, nextState, nextPosState); int i = optCur + len + 1 + len2; while (optEnd < i) opts[++optEnd].reset(); if (price < opts[i].price) opts[i].set3(price, optCur, dist + REPS, len, 0); } if (++match == matches.count) break; } } }
public class class_name { private void calcNormalMatchPrices(int pos, int posState, int avail, int anyMatchPrice, int startLen) { // If the longest match is so long that it would not fit into // the opts array, shorten the matches. if (matches.len[matches.count - 1] > avail) { matches.count = 0; // depends on control dependency: [if], data = [none] while (matches.len[matches.count] < avail) ++matches.count; matches.len[matches.count++] = avail; // depends on control dependency: [if], data = [none] } if (matches.len[matches.count - 1] < startLen) return; while (optEnd < optCur + matches.len[matches.count - 1]) opts[++optEnd].reset(); int normalMatchPrice = getNormalMatchPrice(anyMatchPrice, opts[optCur].state); int match = 0; while (startLen > matches.len[match]) ++match; for (int len = startLen; ; ++len) { int dist = matches.dist[match]; // Calculate the price of a match of len bytes from the nearest // possible distance. int matchAndLenPrice = getMatchAndLenPrice(normalMatchPrice, dist, len, posState); if (matchAndLenPrice < opts[optCur + len].price) opts[optCur + len].set1(matchAndLenPrice, optCur, dist + REPS); if (len != matches.len[match]) continue; // Try match + literal + rep0. First get the length of the rep0. int len2Limit = Math.min(niceLen, avail - len - 1); int len2 = lz.getMatchLen(len + 1, dist, len2Limit); if (len2 >= MATCH_LEN_MIN) { nextState.set(opts[optCur].state); // depends on control dependency: [if], data = [none] nextState.updateMatch(); // depends on control dependency: [if], data = [none] // Literal int curByte = lz.getByte(len, 0); int matchByte = lz.getByte(0); // lz.getByte(len, len) int prevByte = lz.getByte(len, 1); int price = matchAndLenPrice + literalEncoder.getPrice(curByte, matchByte, prevByte, pos + len, nextState); nextState.updateLiteral(); // depends on control dependency: [if], data = [none] // Rep0 int nextPosState = (pos + len + 1) & posMask; price += getLongRepAndLenPrice(0, len2, nextState, nextPosState); // depends on control dependency: [if], data = [none] int i = optCur + len + 1 + len2; while (optEnd < i) opts[++optEnd].reset(); if (price < opts[i].price) opts[i].set3(price, optCur, dist + REPS, len, 0); } if (++match == matches.count) break; } } }
public class class_name { private boolean uidAlreadyUsed(String category, String projectName, String uid) { if (uid == null) { return false; } else { for (File versionDirectory : getUidFilesForProject(category, projectName)) { String uidRead = readUid(new File(versionDirectory, "latest")); if (uidRead != null && !uidRead.isEmpty()) { if (uidRead.equals(uid)) { return true; } } } return false; } } }
public class class_name { private boolean uidAlreadyUsed(String category, String projectName, String uid) { if (uid == null) { return false; // depends on control dependency: [if], data = [none] } else { for (File versionDirectory : getUidFilesForProject(category, projectName)) { String uidRead = readUid(new File(versionDirectory, "latest")); if (uidRead != null && !uidRead.isEmpty()) { if (uidRead.equals(uid)) { return true; // depends on control dependency: [if], data = [none] } } } return false; // depends on control dependency: [if], data = [none] } } }
public class class_name { private void readOkPacket(Buffer buffer, Results results) { buffer.skipByte(); //fieldCount final long updateCount = buffer.getLengthEncodedNumeric(); final long insertId = buffer.getLengthEncodedNumeric(); serverStatus = buffer.readShort(); hasWarnings = (buffer.readShort() > 0); if ((serverStatus & ServerStatus.SERVER_SESSION_STATE_CHANGED) != 0) { handleStateChange(buffer, results); } results.addStats(updateCount, insertId, hasMoreResults()); } }
public class class_name { private void readOkPacket(Buffer buffer, Results results) { buffer.skipByte(); //fieldCount final long updateCount = buffer.getLengthEncodedNumeric(); final long insertId = buffer.getLengthEncodedNumeric(); serverStatus = buffer.readShort(); hasWarnings = (buffer.readShort() > 0); if ((serverStatus & ServerStatus.SERVER_SESSION_STATE_CHANGED) != 0) { handleStateChange(buffer, results); // depends on control dependency: [if], data = [none] } results.addStats(updateCount, insertId, hasMoreResults()); } }
public class class_name { protected <E> void siftDown(final List<E> elements, final int startIndex, final int endIndex) { int rootIndex = startIndex; while ((rootIndex * 2 + 1) <= endIndex) { int swapIndex = rootIndex; int leftChildIndex = (rootIndex * 2 + 1); int rightChildIndex = (leftChildIndex + 1); if (getOrderBy().compare(elements.get(swapIndex), elements.get(leftChildIndex)) < 0) { swapIndex = leftChildIndex; } if (rightChildIndex <= endIndex && getOrderBy().compare(elements.get(swapIndex), elements.get(rightChildIndex)) < 0) { swapIndex = rightChildIndex; } if (swapIndex != rootIndex) { swap(elements, rootIndex, swapIndex); rootIndex = swapIndex; } else { return; } } } }
public class class_name { protected <E> void siftDown(final List<E> elements, final int startIndex, final int endIndex) { int rootIndex = startIndex; while ((rootIndex * 2 + 1) <= endIndex) { int swapIndex = rootIndex; int leftChildIndex = (rootIndex * 2 + 1); int rightChildIndex = (leftChildIndex + 1); if (getOrderBy().compare(elements.get(swapIndex), elements.get(leftChildIndex)) < 0) { swapIndex = leftChildIndex; // depends on control dependency: [if], data = [none] } if (rightChildIndex <= endIndex && getOrderBy().compare(elements.get(swapIndex), elements.get(rightChildIndex)) < 0) { swapIndex = rightChildIndex; // depends on control dependency: [if], data = [none] } if (swapIndex != rootIndex) { swap(elements, rootIndex, swapIndex); // depends on control dependency: [if], data = [none] rootIndex = swapIndex; // depends on control dependency: [if], data = [none] } else { return; // depends on control dependency: [if], data = [none] } } } }
public class class_name { public ElementValuePair[] elementValues() { List<Pair<MethodSymbol,Attribute>> vals = annotation.values; ElementValuePair res[] = new ElementValuePair[vals.length()]; int i = 0; for (Pair<MethodSymbol,Attribute> val : vals) { res[i++] = new ElementValuePairImpl(env, val.fst, val.snd); } return res; } }
public class class_name { public ElementValuePair[] elementValues() { List<Pair<MethodSymbol,Attribute>> vals = annotation.values; ElementValuePair res[] = new ElementValuePair[vals.length()]; int i = 0; for (Pair<MethodSymbol,Attribute> val : vals) { res[i++] = new ElementValuePairImpl(env, val.fst, val.snd); // depends on control dependency: [for], data = [val] } return res; } }
public class class_name { private Properties loadMessages(String fileOrUrl) { URL url = ClasspathUtils.locateOnClasspath(fileOrUrl); if (url != null) { try (InputStreamReader reader = new InputStreamReader(url.openStream(), StandardCharsets.UTF_8)) { Properties messages = new Properties(); messages.load(reader); return messages; } catch (IOException e) { log.error("Failed to load {}", fileOrUrl, e); } } return null; } }
public class class_name { private Properties loadMessages(String fileOrUrl) { URL url = ClasspathUtils.locateOnClasspath(fileOrUrl); if (url != null) { try (InputStreamReader reader = new InputStreamReader(url.openStream(), StandardCharsets.UTF_8)) { Properties messages = new Properties(); messages.load(reader); // depends on control dependency: [if], data = [none] return messages; // depends on control dependency: [if], data = [none] } catch (IOException e) { log.error("Failed to load {}", fileOrUrl, e); } } return null; } }
public class class_name { public void markTransactionError() { final boolean isTracingEnabled = TraceComponent.isAnyTracingEnabled(); if (isTracingEnabled && tc.isDebugEnabled()) { Tr.debug(this, tc, "TransactionError occurred on MCWrapper:" + toString()); } _transactionErrorOccurred = true; } }
public class class_name { public void markTransactionError() { final boolean isTracingEnabled = TraceComponent.isAnyTracingEnabled(); if (isTracingEnabled && tc.isDebugEnabled()) { Tr.debug(this, tc, "TransactionError occurred on MCWrapper:" + toString()); // depends on control dependency: [if], data = [none] } _transactionErrorOccurred = true; } }
public class class_name { public int doSetData(Object objData, boolean bDisplayOption, int moveMode) { if (objData instanceof String) if (((String)objData).length() > 3) if (((String)objData).substring(0, 4).equalsIgnoreCase("THE ")) { objData = ((String)objData).substring(4); } return super.doSetData(objData, bDisplayOption, moveMode); } }
public class class_name { public int doSetData(Object objData, boolean bDisplayOption, int moveMode) { if (objData instanceof String) if (((String)objData).length() > 3) if (((String)objData).substring(0, 4).equalsIgnoreCase("THE ")) { objData = ((String)objData).substring(4); // depends on control dependency: [if], data = [none] } return super.doSetData(objData, bDisplayOption, moveMode); } }
public class class_name { private synchronized boolean isIncluded(String _clazzName) { if (includes.size() > 0) { for (String include : includes) { if (_clazzName.startsWith(include)) { return true; } } } // if we dont have a list, we include nothing (to prevent circular classloader dependencies) return false; } }
public class class_name { private synchronized boolean isIncluded(String _clazzName) { if (includes.size() > 0) { for (String include : includes) { if (_clazzName.startsWith(include)) { return true; // depends on control dependency: [if], data = [none] } } } // if we dont have a list, we include nothing (to prevent circular classloader dependencies) return false; } }
public class class_name { private Component buildWholeFileDiffView(CmsObject cms, CmsFile file1, CmsFile file2) { String encoding = "UTF-8"; try { CmsXmlContent content1 = CmsXmlContentFactory.unmarshal(cms, file1); encoding = content1.getEncoding(); } catch (CmsException e) { String rootPath = file1.getRootPath(); LOG.error( "Could not unmarshal file " + rootPath + " for determining encoding: " + e.getLocalizedMessage(), e); } String text1 = decode(file1.getContents(), encoding); String text2 = decode(file2.getContents(), encoding); CmsTextDiffPanel diffPanel = new CmsTextDiffPanel(text1, text2, false, true); return diffPanel; } }
public class class_name { private Component buildWholeFileDiffView(CmsObject cms, CmsFile file1, CmsFile file2) { String encoding = "UTF-8"; try { CmsXmlContent content1 = CmsXmlContentFactory.unmarshal(cms, file1); encoding = content1.getEncoding(); // depends on control dependency: [try], data = [none] } catch (CmsException e) { String rootPath = file1.getRootPath(); LOG.error( "Could not unmarshal file " + rootPath + " for determining encoding: " + e.getLocalizedMessage(), e); } // depends on control dependency: [catch], data = [none] String text1 = decode(file1.getContents(), encoding); String text2 = decode(file2.getContents(), encoding); CmsTextDiffPanel diffPanel = new CmsTextDiffPanel(text1, text2, false, true); return diffPanel; } }
public class class_name { public static String encodeRealNumberRange(int number, int maxNumDigits, int offsetValue) { long offsetNumber = number + offsetValue; String longString = Long.toString(offsetNumber); int numZeroes = maxNumDigits - longString.length(); StringBuffer strBuffer = new StringBuffer(numZeroes + longString.length()); for (int i = 0; i < numZeroes; i++) { strBuffer.insert(i, '0'); } strBuffer.append(longString); return strBuffer.toString(); } }
public class class_name { public static String encodeRealNumberRange(int number, int maxNumDigits, int offsetValue) { long offsetNumber = number + offsetValue; String longString = Long.toString(offsetNumber); int numZeroes = maxNumDigits - longString.length(); StringBuffer strBuffer = new StringBuffer(numZeroes + longString.length()); for (int i = 0; i < numZeroes; i++) { strBuffer.insert(i, '0'); // depends on control dependency: [for], data = [i] } strBuffer.append(longString); return strBuffer.toString(); } }
public class class_name { @Override protected FullHttpResponse newHandshakeResponse(FullHttpRequest req, HttpHeaders headers) { FullHttpResponse res = new DefaultFullHttpResponse(HTTP_1_1, HttpResponseStatus.SWITCHING_PROTOCOLS); if (headers != null) { res.headers().add(headers); } CharSequence key = req.headers().get(HttpHeaderNames.SEC_WEBSOCKET_KEY); if (key == null) { throw new WebSocketHandshakeException("not a WebSocket request: missing key"); } String acceptSeed = key + WEBSOCKET_08_ACCEPT_GUID; byte[] sha1 = WebSocketUtil.sha1(acceptSeed.getBytes(CharsetUtil.US_ASCII)); String accept = WebSocketUtil.base64(sha1); if (logger.isDebugEnabled()) { logger.debug("WebSocket version 08 server handshake key: {}, response: {}", key, accept); } res.headers().add(HttpHeaderNames.UPGRADE, HttpHeaderValues.WEBSOCKET); res.headers().add(HttpHeaderNames.CONNECTION, HttpHeaderValues.UPGRADE); res.headers().add(HttpHeaderNames.SEC_WEBSOCKET_ACCEPT, accept); String subprotocols = req.headers().get(HttpHeaderNames.SEC_WEBSOCKET_PROTOCOL); if (subprotocols != null) { String selectedSubprotocol = selectSubprotocol(subprotocols); if (selectedSubprotocol == null) { if (logger.isDebugEnabled()) { logger.debug("Requested subprotocol(s) not supported: {}", subprotocols); } } else { res.headers().add(HttpHeaderNames.SEC_WEBSOCKET_PROTOCOL, selectedSubprotocol); } } return res; } }
public class class_name { @Override protected FullHttpResponse newHandshakeResponse(FullHttpRequest req, HttpHeaders headers) { FullHttpResponse res = new DefaultFullHttpResponse(HTTP_1_1, HttpResponseStatus.SWITCHING_PROTOCOLS); if (headers != null) { res.headers().add(headers); // depends on control dependency: [if], data = [(headers] } CharSequence key = req.headers().get(HttpHeaderNames.SEC_WEBSOCKET_KEY); if (key == null) { throw new WebSocketHandshakeException("not a WebSocket request: missing key"); } String acceptSeed = key + WEBSOCKET_08_ACCEPT_GUID; byte[] sha1 = WebSocketUtil.sha1(acceptSeed.getBytes(CharsetUtil.US_ASCII)); String accept = WebSocketUtil.base64(sha1); if (logger.isDebugEnabled()) { logger.debug("WebSocket version 08 server handshake key: {}, response: {}", key, accept); // depends on control dependency: [if], data = [none] } res.headers().add(HttpHeaderNames.UPGRADE, HttpHeaderValues.WEBSOCKET); res.headers().add(HttpHeaderNames.CONNECTION, HttpHeaderValues.UPGRADE); res.headers().add(HttpHeaderNames.SEC_WEBSOCKET_ACCEPT, accept); String subprotocols = req.headers().get(HttpHeaderNames.SEC_WEBSOCKET_PROTOCOL); if (subprotocols != null) { String selectedSubprotocol = selectSubprotocol(subprotocols); if (selectedSubprotocol == null) { if (logger.isDebugEnabled()) { logger.debug("Requested subprotocol(s) not supported: {}", subprotocols); // depends on control dependency: [if], data = [none] } } else { res.headers().add(HttpHeaderNames.SEC_WEBSOCKET_PROTOCOL, selectedSubprotocol); // depends on control dependency: [if], data = [none] } } return res; } }
public class class_name { private ProductDescriptor getSwapProductDescriptor(Element trade) { InterestRateSwapLegProductDescriptor legReceiver = null; InterestRateSwapLegProductDescriptor legPayer = null; NodeList legs = trade.getElementsByTagName("swapStream"); for(int legIndex = 0; legIndex < legs.getLength(); legIndex++) { Element leg = (Element) legs.item(legIndex); boolean isPayer = leg.getElementsByTagName("payerPartyReference").item(0).getAttributes().getNamedItem("href").getNodeValue().equals(homePartyId); if(isPayer) { legPayer = getSwapLegProductDescriptor(leg); } else { legReceiver = getSwapLegProductDescriptor(leg); } } return new InterestRateSwapProductDescriptor(legReceiver, legPayer); } }
public class class_name { private ProductDescriptor getSwapProductDescriptor(Element trade) { InterestRateSwapLegProductDescriptor legReceiver = null; InterestRateSwapLegProductDescriptor legPayer = null; NodeList legs = trade.getElementsByTagName("swapStream"); for(int legIndex = 0; legIndex < legs.getLength(); legIndex++) { Element leg = (Element) legs.item(legIndex); boolean isPayer = leg.getElementsByTagName("payerPartyReference").item(0).getAttributes().getNamedItem("href").getNodeValue().equals(homePartyId); if(isPayer) { legPayer = getSwapLegProductDescriptor(leg); // depends on control dependency: [if], data = [none] } else { legReceiver = getSwapLegProductDescriptor(leg); // depends on control dependency: [if], data = [none] } } return new InterestRateSwapProductDescriptor(legReceiver, legPayer); } }
public class class_name { public boolean isLoadedDataSuccessfullyRecently() { final Integer timeSinceLastError = getSecondsSinceLastFailedLoad(); final Integer timeSinceLastSuccess = getSecondsSinceLastLoad(); if (timeSinceLastSuccess == null) { return false; // never loaded data, so must be FAIL } if (timeSinceLastError == null) { return true; // no errors ever, so must be OKAY } return lastLoadWasSuccessful; } }
public class class_name { public boolean isLoadedDataSuccessfullyRecently() { final Integer timeSinceLastError = getSecondsSinceLastFailedLoad(); final Integer timeSinceLastSuccess = getSecondsSinceLastLoad(); if (timeSinceLastSuccess == null) { return false; // never loaded data, so must be FAIL // depends on control dependency: [if], data = [none] } if (timeSinceLastError == null) { return true; // no errors ever, so must be OKAY // depends on control dependency: [if], data = [none] } return lastLoadWasSuccessful; } }
public class class_name { public static Double getMinX(Geometry geom) { if (geom != null) { return geom.getEnvelopeInternal().getMinX(); } else { return null; } } }
public class class_name { public static Double getMinX(Geometry geom) { if (geom != null) { return geom.getEnvelopeInternal().getMinX(); // depends on control dependency: [if], data = [none] } else { return null; // depends on control dependency: [if], data = [none] } } }
public class class_name { public static BaseResult addvoicetorecofortext(String accessToken, String voiceId, String lang, URI uri) { HttpPost httpPost = new HttpPost(BASE_URI + "/cgi-bin/media/voice/addvoicetorecofortext"); CloseableHttpClient tempHttpClient = HttpClients.createDefault(); try { HttpEntity entity = tempHttpClient.execute(RequestBuilder.get().setUri(uri).build()).getEntity(); HttpEntity reqEntity = MultipartEntityBuilder.create() .addBinaryBody("media", EntityUtils.toByteArray(entity), ContentType.get(entity), "temp." + MediaType.voice_mp3.fileSuffix()) .addTextBody(PARAM_ACCESS_TOKEN, API.accessToken(accessToken)) .addTextBody("format", MediaType.voice_mp3.fileSuffix()) .addTextBody("voice_id", voiceId) .addTextBody("lang", lang == null || lang.isEmpty() ? "zh_CN" : lang) .build(); httpPost.setEntity(reqEntity); return LocalHttpClient.executeJsonResult(httpPost, BaseResult.class); } catch (UnsupportedCharsetException | ParseException | IOException e) { logger.error("", e); throw new RuntimeException(e); } finally { try { tempHttpClient.close(); } catch (IOException e) { logger.error("", e); } } } }
public class class_name { public static BaseResult addvoicetorecofortext(String accessToken, String voiceId, String lang, URI uri) { HttpPost httpPost = new HttpPost(BASE_URI + "/cgi-bin/media/voice/addvoicetorecofortext"); CloseableHttpClient tempHttpClient = HttpClients.createDefault(); try { HttpEntity entity = tempHttpClient.execute(RequestBuilder.get().setUri(uri).build()).getEntity(); HttpEntity reqEntity = MultipartEntityBuilder.create() .addBinaryBody("media", EntityUtils.toByteArray(entity), ContentType.get(entity), "temp." + MediaType.voice_mp3.fileSuffix()) .addTextBody(PARAM_ACCESS_TOKEN, API.accessToken(accessToken)) .addTextBody("format", MediaType.voice_mp3.fileSuffix()) .addTextBody("voice_id", voiceId) .addTextBody("lang", lang == null || lang.isEmpty() ? "zh_CN" : lang) .build(); httpPost.setEntity(reqEntity); // depends on control dependency: [try], data = [none] return LocalHttpClient.executeJsonResult(httpPost, BaseResult.class); // depends on control dependency: [try], data = [none] } catch (UnsupportedCharsetException | ParseException | IOException e) { logger.error("", e); throw new RuntimeException(e); } finally { // depends on control dependency: [catch], data = [none] try { tempHttpClient.close(); // depends on control dependency: [try], data = [none] } catch (IOException e) { logger.error("", e); } // depends on control dependency: [catch], data = [none] } } }
public class class_name { public static Point getPointWithWickedChartsId(final Options options, final int wickedChartsId) { for (Series<?> series : options.getSeries()) { for (Object object : series.getData()) { if (!(object instanceof Point)) { break; } else { Point point = (Point) object; if (point.getWickedChartsId() == wickedChartsId) { return point; } } } } return null; } }
public class class_name { public static Point getPointWithWickedChartsId(final Options options, final int wickedChartsId) { for (Series<?> series : options.getSeries()) { for (Object object : series.getData()) { if (!(object instanceof Point)) { break; } else { Point point = (Point) object; if (point.getWickedChartsId() == wickedChartsId) { return point; // depends on control dependency: [if], data = [none] } } } } return null; } }
public class class_name { public static base_responses delete(nitro_service client, String filename[]) throws Exception { base_responses result = null; if (filename != null && filename.length > 0) { systembackup deleteresources[] = new systembackup[filename.length]; for (int i=0;i<filename.length;i++){ deleteresources[i] = new systembackup(); deleteresources[i].filename = filename[i]; } result = delete_bulk_request(client, deleteresources); } return result; } }
public class class_name { public static base_responses delete(nitro_service client, String filename[]) throws Exception { base_responses result = null; if (filename != null && filename.length > 0) { systembackup deleteresources[] = new systembackup[filename.length]; for (int i=0;i<filename.length;i++){ deleteresources[i] = new systembackup(); // depends on control dependency: [for], data = [i] deleteresources[i].filename = filename[i]; // depends on control dependency: [for], data = [i] } result = delete_bulk_request(client, deleteresources); } return result; } }
public class class_name { public EClass getIfcLightSourceGoniometric() { if (ifcLightSourceGoniometricEClass == null) { ifcLightSourceGoniometricEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI) .getEClassifiers().get(296); } return ifcLightSourceGoniometricEClass; } }
public class class_name { public EClass getIfcLightSourceGoniometric() { if (ifcLightSourceGoniometricEClass == null) { ifcLightSourceGoniometricEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI) .getEClassifiers().get(296); // depends on control dependency: [if], data = [none] } return ifcLightSourceGoniometricEClass; } }
public class class_name { public InetAddress getInetAddress(){ if(remoteIP == null){ try{ remoteIP = InetAddress.getByName(remoteHost); }catch(UnknownHostException e){ return null; } } return remoteIP; } }
public class class_name { public InetAddress getInetAddress(){ if(remoteIP == null){ try{ remoteIP = InetAddress.getByName(remoteHost); // depends on control dependency: [try], data = [none] }catch(UnknownHostException e){ return null; } // depends on control dependency: [catch], data = [none] } return remoteIP; } }
public class class_name { @Pure public int computeCrossings( int crossings, int x0, int y0, int z0, int x1, int y1, int z1) { int numCrosses = Segment3ai.computeCrossingsFromRect(crossings, this.bounds.getMinX(), this.bounds.getMinY(), this.bounds.getMinZ(), this.bounds.getMaxX(), this.bounds.getMaxY(), this.bounds.getMaxZ(), x0, y0, z0, x1, y1, z1); if (numCrosses == GeomConstants.SHAPE_INTERSECTS) { // The segment is intersecting the bounds of the shadow path. // We must consider the shape of shadow path now. final PathShadowData data = new PathShadowData( this.bounds.getMaxX(), this.bounds.getMinY(), this.bounds.getMaxY()); computeCrossings1( this.path.getPathIterator(this.path.getGeomFactory().getSplineApproximationRatio()), x0, y0, z0, x1, y1, z1, false, this.path.getWindingRule(), this.path.getGeomFactory(), data); numCrosses = data.getCrossings(); final int mask = this.path.getWindingRule() == PathWindingRule.NON_ZERO ? -1 : 2; if (numCrosses == GeomConstants.SHAPE_INTERSECTS || (numCrosses & mask) != 0) { // The given line is intersecting the path shape return GeomConstants.SHAPE_INTERSECTS; } // There is no intersection with the shadow path's shape. int inc = 0; if (data.isHasX4ymin() && data.getX4ymin() >= data.getXmin4ymin()) { ++inc; } if (data.isHasX4ymax() && data.getX4ymax() >= data.getXmin4ymax()) { ++inc; } if (y0 < y1) { numCrosses += inc; } else { numCrosses -= inc; } // Apply the previously computed crossings numCrosses += crossings; } return numCrosses; } }
public class class_name { @Pure public int computeCrossings( int crossings, int x0, int y0, int z0, int x1, int y1, int z1) { int numCrosses = Segment3ai.computeCrossingsFromRect(crossings, this.bounds.getMinX(), this.bounds.getMinY(), this.bounds.getMinZ(), this.bounds.getMaxX(), this.bounds.getMaxY(), this.bounds.getMaxZ(), x0, y0, z0, x1, y1, z1); if (numCrosses == GeomConstants.SHAPE_INTERSECTS) { // The segment is intersecting the bounds of the shadow path. // We must consider the shape of shadow path now. final PathShadowData data = new PathShadowData( this.bounds.getMaxX(), this.bounds.getMinY(), this.bounds.getMaxY()); computeCrossings1( this.path.getPathIterator(this.path.getGeomFactory().getSplineApproximationRatio()), x0, y0, z0, x1, y1, z1, false, this.path.getWindingRule(), this.path.getGeomFactory(), data); // depends on control dependency: [if], data = [none] numCrosses = data.getCrossings(); // depends on control dependency: [if], data = [none] final int mask = this.path.getWindingRule() == PathWindingRule.NON_ZERO ? -1 : 2; if (numCrosses == GeomConstants.SHAPE_INTERSECTS || (numCrosses & mask) != 0) { // The given line is intersecting the path shape return GeomConstants.SHAPE_INTERSECTS; // depends on control dependency: [if], data = [none] } // There is no intersection with the shadow path's shape. int inc = 0; if (data.isHasX4ymin() && data.getX4ymin() >= data.getXmin4ymin()) { ++inc; // depends on control dependency: [if], data = [none] } if (data.isHasX4ymax() && data.getX4ymax() >= data.getXmin4ymax()) { ++inc; // depends on control dependency: [if], data = [none] } if (y0 < y1) { numCrosses += inc; // depends on control dependency: [if], data = [none] } else { numCrosses -= inc; // depends on control dependency: [if], data = [none] } // Apply the previously computed crossings numCrosses += crossings; // depends on control dependency: [if], data = [none] } return numCrosses; } }
public class class_name { public void marshall(ListDeviceInstancesRequest listDeviceInstancesRequest, ProtocolMarshaller protocolMarshaller) { if (listDeviceInstancesRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(listDeviceInstancesRequest.getMaxResults(), MAXRESULTS_BINDING); protocolMarshaller.marshall(listDeviceInstancesRequest.getNextToken(), NEXTTOKEN_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(ListDeviceInstancesRequest listDeviceInstancesRequest, ProtocolMarshaller protocolMarshaller) { if (listDeviceInstancesRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(listDeviceInstancesRequest.getMaxResults(), MAXRESULTS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(listDeviceInstancesRequest.getNextToken(), NEXTTOKEN_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public GetExclusionsPreviewResult withExclusionPreviews(ExclusionPreview... exclusionPreviews) { if (this.exclusionPreviews == null) { setExclusionPreviews(new java.util.ArrayList<ExclusionPreview>(exclusionPreviews.length)); } for (ExclusionPreview ele : exclusionPreviews) { this.exclusionPreviews.add(ele); } return this; } }
public class class_name { public GetExclusionsPreviewResult withExclusionPreviews(ExclusionPreview... exclusionPreviews) { if (this.exclusionPreviews == null) { setExclusionPreviews(new java.util.ArrayList<ExclusionPreview>(exclusionPreviews.length)); // depends on control dependency: [if], data = [none] } for (ExclusionPreview ele : exclusionPreviews) { this.exclusionPreviews.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public void addNewAttributeValueToEntity(int referenceIndex) { // make sure not to add more values than allowed int maxOccurrence = getEntityType().getAttributeMaxOccurrence(m_attributeName); CmsEntityAttribute attribute = m_entity.getAttribute(m_attributeName); boolean mayHaveMore = ((attribute == null) || (attribute.getValueCount() < maxOccurrence)); if (mayHaveMore) { if (getAttributeType().isSimpleType()) { String defaultValue = m_widgetService.getDefaultAttributeValue( m_attributeName, getSimplePath(referenceIndex + 1)); if ((attribute == null) || (attribute.getValueCount() == (referenceIndex + 1))) { m_entity.addAttributeValue(m_attributeName, defaultValue); } else { m_entity.insertAttributeValue(m_attributeName, defaultValue, referenceIndex + 1); m_widgetService.addChangedOrderPath(getSimplePath(-1)); } } else { CmsEntity value = m_entityBackEnd.createEntity(null, m_attributeType.getId()); if ((attribute == null) || (attribute.getValueCount() == (referenceIndex + 1))) { m_entity.addAttributeValue(m_attributeName, value); } else { m_entity.insertAttributeValue(m_attributeName, value, referenceIndex + 1); m_widgetService.addChangedOrderPath(getSimplePath(-1)); } insertHandlers(referenceIndex + 1); } } } }
public class class_name { public void addNewAttributeValueToEntity(int referenceIndex) { // make sure not to add more values than allowed int maxOccurrence = getEntityType().getAttributeMaxOccurrence(m_attributeName); CmsEntityAttribute attribute = m_entity.getAttribute(m_attributeName); boolean mayHaveMore = ((attribute == null) || (attribute.getValueCount() < maxOccurrence)); if (mayHaveMore) { if (getAttributeType().isSimpleType()) { String defaultValue = m_widgetService.getDefaultAttributeValue( m_attributeName, getSimplePath(referenceIndex + 1)); if ((attribute == null) || (attribute.getValueCount() == (referenceIndex + 1))) { m_entity.addAttributeValue(m_attributeName, defaultValue); // depends on control dependency: [if], data = [none] } else { m_entity.insertAttributeValue(m_attributeName, defaultValue, referenceIndex + 1); // depends on control dependency: [if], data = [none] m_widgetService.addChangedOrderPath(getSimplePath(-1)); // depends on control dependency: [if], data = [none] } } else { CmsEntity value = m_entityBackEnd.createEntity(null, m_attributeType.getId()); if ((attribute == null) || (attribute.getValueCount() == (referenceIndex + 1))) { m_entity.addAttributeValue(m_attributeName, value); // depends on control dependency: [if], data = [none] } else { m_entity.insertAttributeValue(m_attributeName, value, referenceIndex + 1); // depends on control dependency: [if], data = [none] m_widgetService.addChangedOrderPath(getSimplePath(-1)); // depends on control dependency: [if], data = [none] } insertHandlers(referenceIndex + 1); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public OJBLock atomicGetOrCreateLock(Object resourceId, Object isolationId) { synchronized(globalLocks) { MultiLevelLock lock = getLock(resourceId); if(lock == null) { lock = createLock(resourceId, isolationId); } return (OJBLock) lock; } } }
public class class_name { public OJBLock atomicGetOrCreateLock(Object resourceId, Object isolationId) { synchronized(globalLocks) { MultiLevelLock lock = getLock(resourceId); if(lock == null) { lock = createLock(resourceId, isolationId); // depends on control dependency: [if], data = [none] } return (OJBLock) lock; } } }
public class class_name { protected void markRRSLocalTransactionWrapperInUse() throws ResourceException { final boolean isTracingEnabled = TraceComponent.isAnyTracingEnabled(); if (isTracingEnabled && tc.isEntryEnabled()) { Tr.entry(this, tc, "markRRSLocalTransactionWrapperInUse"); } if (state == STATE_ACTIVE_INUSE) { state = STATE_TRAN_WRAPPER_INUSE; tranWrapperInUse = RRSLOCALTXWRAPPER; } else { // state not STATE_ACTIVE_INUSE if (state != STATE_TRAN_WRAPPER_INUSE) { IllegalStateException e = new IllegalStateException("getRRSLocalTransactionWrapper: illegal state exception. State = " + getStateString() + " MCW = " + mcWrapperObject_hexString); Object[] parms = new Object[] { "getRRSLocalTransactionWrapper", e }; Tr.error(tc, "ILLEGAL_STATE_EXCEPTION_J2CA0079", parms); throw e; } else { // state is STATE_TRAN_WRAPPER_INUSE if (tranWrapperInUse == NONE) { tranWrapperInUse = RRSLOCALTXWRAPPER; } else { //tranWrapperInUse is NOT NONE if (tranWrapperInUse != RRSLOCALTXWRAPPER) { // Need RAS and Trace here. IllegalStateException e = new IllegalStateException("getRRSLocalTransactionWrapper: illegal transaction state exception. State = " + getTranWrapperString()); Object[] parms = new Object[] { "getRRSLocalTransactionWrapper", e }; Tr.error(tc, "ILLEGAL_STATE_EXCEPTION_J2CA0079", parms); throw e; } } } } if (isTracingEnabled && tc.isEntryEnabled()) { Tr.exit(this, tc, "markRRSLocalTransactionWrapperInUse"); } return; } }
public class class_name { protected void markRRSLocalTransactionWrapperInUse() throws ResourceException { final boolean isTracingEnabled = TraceComponent.isAnyTracingEnabled(); if (isTracingEnabled && tc.isEntryEnabled()) { Tr.entry(this, tc, "markRRSLocalTransactionWrapperInUse"); } if (state == STATE_ACTIVE_INUSE) { state = STATE_TRAN_WRAPPER_INUSE; tranWrapperInUse = RRSLOCALTXWRAPPER; } else { // state not STATE_ACTIVE_INUSE if (state != STATE_TRAN_WRAPPER_INUSE) { IllegalStateException e = new IllegalStateException("getRRSLocalTransactionWrapper: illegal state exception. State = " + getStateString() + " MCW = " + mcWrapperObject_hexString); Object[] parms = new Object[] { "getRRSLocalTransactionWrapper", e }; Tr.error(tc, "ILLEGAL_STATE_EXCEPTION_J2CA0079", parms); // depends on control dependency: [if], data = [none] throw e; } else { // state is STATE_TRAN_WRAPPER_INUSE if (tranWrapperInUse == NONE) { tranWrapperInUse = RRSLOCALTXWRAPPER; // depends on control dependency: [if], data = [none] } else { //tranWrapperInUse is NOT NONE if (tranWrapperInUse != RRSLOCALTXWRAPPER) { // Need RAS and Trace here. IllegalStateException e = new IllegalStateException("getRRSLocalTransactionWrapper: illegal transaction state exception. State = " + getTranWrapperString()); Object[] parms = new Object[] { "getRRSLocalTransactionWrapper", e }; Tr.error(tc, "ILLEGAL_STATE_EXCEPTION_J2CA0079", parms); // depends on control dependency: [if], data = [none] throw e; } } } } if (isTracingEnabled && tc.isEntryEnabled()) { Tr.exit(this, tc, "markRRSLocalTransactionWrapperInUse"); } return; } }
public class class_name { private void deleteDurableSubscription( boolean callProxyCode) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "deleteDurableSubscription", new Object[] { new Boolean(callProxyCode) }); HashMap durableSubsTable = _destinationManager.getDurableSubscriptionsTable(); synchronized (durableSubsTable) { // Get the consumerDispatcher from the durable subscriptions table ConsumerDispatcher consumerDispatcher = (ConsumerDispatcher) durableSubsTable.get( _subState.getSubscriberID()); //If entire topicspace has been deleted, the subscription will have already //been removed. if (consumerDispatcher != null) { // Check if the subscription from the durable subscriptions table is this // subscription. Its possible that the topicspace this subscription was on // was deleted and a new subscription with the same id has been added into // the table if (consumerDispatcher.dispatcherStateEquals(_subState)) { // Remove consumerDispatcher from durable subscriptions table durableSubsTable.remove(_subState.getSubscriberID()); // Delete consumerDispatcher ( implicit remove from matchspace) try { // Don't need to send the proxy delete event message // just need to reset the memory to the stat consumerDispatcher.deleteConsumerDispatcher( callProxyCode); } catch (SIException e) { FFDCFilter.processException( e, "com.ibm.ws.sib.processor.impl.store.itemstreams.DurableSubscriptionItemStream.deleteDurableSubscription", "1:626:1.95", this); SibTr.exception(tc, e); // Could not delete consumer dispatcher if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "deleteDurableSubscription", e); } } } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "deleteDurableSubscription"); } }
public class class_name { private void deleteDurableSubscription( boolean callProxyCode) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "deleteDurableSubscription", new Object[] { new Boolean(callProxyCode) }); HashMap durableSubsTable = _destinationManager.getDurableSubscriptionsTable(); synchronized (durableSubsTable) { // Get the consumerDispatcher from the durable subscriptions table ConsumerDispatcher consumerDispatcher = (ConsumerDispatcher) durableSubsTable.get( _subState.getSubscriberID()); //If entire topicspace has been deleted, the subscription will have already //been removed. if (consumerDispatcher != null) { // Check if the subscription from the durable subscriptions table is this // subscription. Its possible that the topicspace this subscription was on // was deleted and a new subscription with the same id has been added into // the table if (consumerDispatcher.dispatcherStateEquals(_subState)) { // Remove consumerDispatcher from durable subscriptions table durableSubsTable.remove(_subState.getSubscriberID()); // depends on control dependency: [if], data = [none] // Delete consumerDispatcher ( implicit remove from matchspace) try { // Don't need to send the proxy delete event message // just need to reset the memory to the stat consumerDispatcher.deleteConsumerDispatcher( callProxyCode); // depends on control dependency: [try], data = [none] } catch (SIException e) { FFDCFilter.processException( e, "com.ibm.ws.sib.processor.impl.store.itemstreams.DurableSubscriptionItemStream.deleteDurableSubscription", "1:626:1.95", this); SibTr.exception(tc, e); // Could not delete consumer dispatcher if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "deleteDurableSubscription", e); } // depends on control dependency: [catch], data = [none] } } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "deleteDurableSubscription"); } }
public class class_name { private boolean tryRelease(long c, WorkQueue v, long inc) { int sp = (int)c, vs = (sp + SS_SEQ) & ~INACTIVE; Thread p; if (v != null && v.scanState == sp) { // v is at top of stack long nc = (UC_MASK & (c + inc)) | (SP_MASK & v.stackPred); if (U.compareAndSwapLong(this, CTL, c, nc)) { v.scanState = vs; if ((p = v.parker) != null) U.unpark(p); return true; } } return false; } }
public class class_name { private boolean tryRelease(long c, WorkQueue v, long inc) { int sp = (int)c, vs = (sp + SS_SEQ) & ~INACTIVE; Thread p; if (v != null && v.scanState == sp) { // v is at top of stack long nc = (UC_MASK & (c + inc)) | (SP_MASK & v.stackPred); if (U.compareAndSwapLong(this, CTL, c, nc)) { v.scanState = vs; // depends on control dependency: [if], data = [none] if ((p = v.parker) != null) U.unpark(p); return true; // depends on control dependency: [if], data = [none] } } return false; } }
public class class_name { protected void onUnknownDocType(AppendingStringBuffer response) { IRequestablePage responsePage = getResponsePage(); String detectionString = getFirstCharacters(response, 128); if (responsePage != null) { log.info("No or unknown DOCTYPE detected for page {}: {}", responsePage.getClass().getName(), detectionString); } else { log.info("No or unknown DOCTYPE detected: {}", detectionString); } } }
public class class_name { protected void onUnknownDocType(AppendingStringBuffer response) { IRequestablePage responsePage = getResponsePage(); String detectionString = getFirstCharacters(response, 128); if (responsePage != null) { log.info("No or unknown DOCTYPE detected for page {}: {}", responsePage.getClass().getName(), detectionString); // depends on control dependency: [if], data = [none] } else { log.info("No or unknown DOCTYPE detected: {}", detectionString); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void marshall(ConditionCheck conditionCheck, ProtocolMarshaller protocolMarshaller) { if (conditionCheck == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(conditionCheck.getKey(), KEY_BINDING); protocolMarshaller.marshall(conditionCheck.getTableName(), TABLENAME_BINDING); protocolMarshaller.marshall(conditionCheck.getConditionExpression(), CONDITIONEXPRESSION_BINDING); protocolMarshaller.marshall(conditionCheck.getExpressionAttributeNames(), EXPRESSIONATTRIBUTENAMES_BINDING); protocolMarshaller.marshall(conditionCheck.getExpressionAttributeValues(), EXPRESSIONATTRIBUTEVALUES_BINDING); protocolMarshaller.marshall(conditionCheck.getReturnValuesOnConditionCheckFailure(), RETURNVALUESONCONDITIONCHECKFAILURE_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(ConditionCheck conditionCheck, ProtocolMarshaller protocolMarshaller) { if (conditionCheck == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(conditionCheck.getKey(), KEY_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(conditionCheck.getTableName(), TABLENAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(conditionCheck.getConditionExpression(), CONDITIONEXPRESSION_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(conditionCheck.getExpressionAttributeNames(), EXPRESSIONATTRIBUTENAMES_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(conditionCheck.getExpressionAttributeValues(), EXPRESSIONATTRIBUTEVALUES_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(conditionCheck.getReturnValuesOnConditionCheckFailure(), RETURNVALUESONCONDITIONCHECKFAILURE_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public <T> T to(Class<T> targetType) { if (targetType == String.class) { return (T) value; } try { final String methodName; final Class type; if (targetType.isPrimitive()) { final String typeName = targetType.getSimpleName(); methodName = "parse" + typeName.substring(0, 1).toUpperCase() + typeName.substring(1); type = PRIMITIVE_TO_OBJECT_TYPE_MAP.get(targetType); } else { methodName = "valueOf"; type = targetType; } return (T) type.getMethod(methodName, String.class).invoke(null, value); } catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) { throw new RuntimeException("Could not convert value '" + value + "' to type " + targetType.getName(), e); } } }
public class class_name { public <T> T to(Class<T> targetType) { if (targetType == String.class) { return (T) value; // depends on control dependency: [if], data = [none] } try { final String methodName; final Class type; if (targetType.isPrimitive()) { final String typeName = targetType.getSimpleName(); methodName = "parse" + typeName.substring(0, 1).toUpperCase() + typeName.substring(1); // depends on control dependency: [if], data = [none] type = PRIMITIVE_TO_OBJECT_TYPE_MAP.get(targetType); // depends on control dependency: [if], data = [none] } else { methodName = "valueOf"; // depends on control dependency: [if], data = [none] type = targetType; // depends on control dependency: [if], data = [none] } return (T) type.getMethod(methodName, String.class).invoke(null, value); // depends on control dependency: [try], data = [none] } catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) { throw new RuntimeException("Could not convert value '" + value + "' to type " + targetType.getName(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void printscopes(Scope s) { while (s != null) { if (s.owner != null) System.err.print(s.owner + ": "); for (Scope.Entry e = s.elems; e != null; e = e.sibling) { if ((e.sym.flags() & ABSTRACT) != 0) System.err.print("abstract "); System.err.print(e.sym + " "); } System.err.println(); s = s.next; } } }
public class class_name { public void printscopes(Scope s) { while (s != null) { if (s.owner != null) System.err.print(s.owner + ": "); for (Scope.Entry e = s.elems; e != null; e = e.sibling) { if ((e.sym.flags() & ABSTRACT) != 0) System.err.print("abstract "); System.err.print(e.sym + " "); // depends on control dependency: [for], data = [e] } System.err.println(); // depends on control dependency: [while], data = [none] s = s.next; // depends on control dependency: [while], data = [none] } } }
public class class_name { public void deliver(final byte[] message) { synchronized (this.heartBeatManager) { if (this.currentStatus.isNotRunning()) { LOG.log(Level.WARNING, "Trying to send a message to a task that is in state: {0}. Ignoring.", this.currentStatus.getState()); } else { try { this.deliverMessageToTask(message); } catch (final TaskMessageHandlerFailure taskMessageHandlerFailure) { LOG.log(Level.WARNING, "Exception while executing task close handler.", taskMessageHandlerFailure.getCause()); this.currentStatus.setException(taskMessageHandlerFailure.getCause()); } } } } }
public class class_name { public void deliver(final byte[] message) { synchronized (this.heartBeatManager) { if (this.currentStatus.isNotRunning()) { LOG.log(Level.WARNING, "Trying to send a message to a task that is in state: {0}. Ignoring.", this.currentStatus.getState()); // depends on control dependency: [if], data = [none] } else { try { this.deliverMessageToTask(message); // depends on control dependency: [try], data = [none] } catch (final TaskMessageHandlerFailure taskMessageHandlerFailure) { LOG.log(Level.WARNING, "Exception while executing task close handler.", taskMessageHandlerFailure.getCause()); this.currentStatus.setException(taskMessageHandlerFailure.getCause()); } // depends on control dependency: [catch], data = [none] } } } }
public class class_name { private Map<String, Item> getKeyItemMap() { Map<String, Item> ret = new HashMap<String, Item>(); for (Object itemId : m_container.getItemIds()) { ret.put( m_container.getItem(itemId).getItemProperty(TableProperty.KEY).getValue().toString(), m_container.getItem(itemId)); } return ret; } }
public class class_name { private Map<String, Item> getKeyItemMap() { Map<String, Item> ret = new HashMap<String, Item>(); for (Object itemId : m_container.getItemIds()) { ret.put( m_container.getItem(itemId).getItemProperty(TableProperty.KEY).getValue().toString(), m_container.getItem(itemId)); // depends on control dependency: [for], data = [none] } return ret; } }
public class class_name { public static String byteRegexToString(final String regexp) { final StringBuilder buf = new StringBuilder(); for (int i = 0; i < regexp.length(); i++) { if (i > 0 && regexp.charAt(i - 1) == 'Q') { if (regexp.charAt(i - 3) == '*') { // tagk byte[] tagk = new byte[TSDB.tagk_width()]; for (int x = 0; x < TSDB.tagk_width(); x++) { tagk[x] = (byte)regexp.charAt(i + x); } i += TSDB.tagk_width(); buf.append(Arrays.toString(tagk)); } else { // tagv byte[] tagv = new byte[TSDB.tagv_width()]; for (int x = 0; x < TSDB.tagv_width(); x++) { tagv[x] = (byte)regexp.charAt(i + x); } i += TSDB.tagv_width(); buf.append(Arrays.toString(tagv)); } } else { buf.append(regexp.charAt(i)); } } return buf.toString(); } }
public class class_name { public static String byteRegexToString(final String regexp) { final StringBuilder buf = new StringBuilder(); for (int i = 0; i < regexp.length(); i++) { if (i > 0 && regexp.charAt(i - 1) == 'Q') { if (regexp.charAt(i - 3) == '*') { // tagk byte[] tagk = new byte[TSDB.tagk_width()]; for (int x = 0; x < TSDB.tagk_width(); x++) { tagk[x] = (byte)regexp.charAt(i + x); // depends on control dependency: [for], data = [x] } i += TSDB.tagk_width(); // depends on control dependency: [if], data = [none] buf.append(Arrays.toString(tagk)); // depends on control dependency: [if], data = [none] } else { // tagv byte[] tagv = new byte[TSDB.tagv_width()]; for (int x = 0; x < TSDB.tagv_width(); x++) { tagv[x] = (byte)regexp.charAt(i + x); // depends on control dependency: [for], data = [x] } i += TSDB.tagv_width(); // depends on control dependency: [if], data = [none] buf.append(Arrays.toString(tagv)); // depends on control dependency: [if], data = [none] } } else { buf.append(regexp.charAt(i)); // depends on control dependency: [if], data = [none] } } return buf.toString(); } }
public class class_name { protected final void prepareAdd() { if (currentPageBuilder.isFull()) { valueBlocksRetainedSizeInBytes += currentPageBuilder.getRetainedSizeInBytes(); sumPositions.add(totalPositions); currentPageBuilder = currentPageBuilder.newPageBuilderLike(); values.add(currentPageBuilder); verify(values.size() <= MAX_NUM_BLOCKS); } long currentGroupId = getGroupId(); short insertedBlockIndex = (short) (values.size() - 1); int insertedPosition = currentPageBuilder.getPositionCount(); if (totalPositions == capacity) { capacity *= 1.5; nextBlockIndex.ensureCapacity(capacity); nextPosition.ensureCapacity(capacity); } if (isEmpty()) { // new linked list, set up the header pointer headBlockIndex.set(currentGroupId, insertedBlockIndex); headPosition.set(currentGroupId, insertedPosition); } else { // existing linked list, link the new entry to the tail long absoluteTailAddress = toAbsolutePosition(tailBlockIndex.get(currentGroupId), tailPosition.get(currentGroupId)); nextBlockIndex.set(absoluteTailAddress, insertedBlockIndex); nextPosition.set(absoluteTailAddress, insertedPosition); } tailBlockIndex.set(currentGroupId, insertedBlockIndex); tailPosition.set(currentGroupId, insertedPosition); groupEntryCount.increment(currentGroupId); currentPageBuilder.declarePosition(); totalPositions++; } }
public class class_name { protected final void prepareAdd() { if (currentPageBuilder.isFull()) { valueBlocksRetainedSizeInBytes += currentPageBuilder.getRetainedSizeInBytes(); // depends on control dependency: [if], data = [none] sumPositions.add(totalPositions); // depends on control dependency: [if], data = [none] currentPageBuilder = currentPageBuilder.newPageBuilderLike(); // depends on control dependency: [if], data = [none] values.add(currentPageBuilder); // depends on control dependency: [if], data = [none] verify(values.size() <= MAX_NUM_BLOCKS); // depends on control dependency: [if], data = [none] } long currentGroupId = getGroupId(); short insertedBlockIndex = (short) (values.size() - 1); int insertedPosition = currentPageBuilder.getPositionCount(); if (totalPositions == capacity) { capacity *= 1.5; // depends on control dependency: [if], data = [none] nextBlockIndex.ensureCapacity(capacity); // depends on control dependency: [if], data = [capacity)] nextPosition.ensureCapacity(capacity); // depends on control dependency: [if], data = [capacity)] } if (isEmpty()) { // new linked list, set up the header pointer headBlockIndex.set(currentGroupId, insertedBlockIndex); // depends on control dependency: [if], data = [none] headPosition.set(currentGroupId, insertedPosition); // depends on control dependency: [if], data = [none] } else { // existing linked list, link the new entry to the tail long absoluteTailAddress = toAbsolutePosition(tailBlockIndex.get(currentGroupId), tailPosition.get(currentGroupId)); nextBlockIndex.set(absoluteTailAddress, insertedBlockIndex); // depends on control dependency: [if], data = [none] nextPosition.set(absoluteTailAddress, insertedPosition); // depends on control dependency: [if], data = [none] } tailBlockIndex.set(currentGroupId, insertedBlockIndex); tailPosition.set(currentGroupId, insertedPosition); groupEntryCount.increment(currentGroupId); currentPageBuilder.declarePosition(); totalPositions++; } }
public class class_name { public <R, RK> List<R> fetch(Collection<DBRef<R, RK>> collection, DBObject fields) { Map<JacksonCollectionKey, List<Object>> collectionsToIds = new HashMap<JacksonCollectionKey, List<Object>>(); for (DBRef<R, RK> ref : collection) { if (ref instanceof FetchableDBRef) { JacksonCollectionKey key = ((FetchableDBRef) ref).getCollectionKey(); List<Object> ids = collectionsToIds.get(key); if (ids == null) { ids = new ArrayList<Object>(); collectionsToIds.put(key, ids); } ids.add(getReferenceCollection(key).convertToDbId(ref.getId())); } } List<R> results = new ArrayList<R>(); for (Map.Entry<JacksonCollectionKey, List<Object>> entry : collectionsToIds.entrySet()) { for (R result : this.<R, RK>getReferenceCollection(entry.getKey()).find( new QueryBuilder().put("_id").in(entry.getValue()).get(), fields)) { results.add(result); } } return results; } }
public class class_name { public <R, RK> List<R> fetch(Collection<DBRef<R, RK>> collection, DBObject fields) { Map<JacksonCollectionKey, List<Object>> collectionsToIds = new HashMap<JacksonCollectionKey, List<Object>>(); for (DBRef<R, RK> ref : collection) { if (ref instanceof FetchableDBRef) { JacksonCollectionKey key = ((FetchableDBRef) ref).getCollectionKey(); List<Object> ids = collectionsToIds.get(key); if (ids == null) { ids = new ArrayList<Object>(); // depends on control dependency: [if], data = [none] collectionsToIds.put(key, ids); // depends on control dependency: [if], data = [none] } ids.add(getReferenceCollection(key).convertToDbId(ref.getId())); // depends on control dependency: [if], data = [none] } } List<R> results = new ArrayList<R>(); for (Map.Entry<JacksonCollectionKey, List<Object>> entry : collectionsToIds.entrySet()) { for (R result : this.<R, RK>getReferenceCollection(entry.getKey()).find( new QueryBuilder().put("_id").in(entry.getValue()).get(), fields)) { results.add(result); // depends on control dependency: [for], data = [result] } } return results; } }
public class class_name { public void marshall(DescribeMaintenanceWindowsForTargetRequest describeMaintenanceWindowsForTargetRequest, ProtocolMarshaller protocolMarshaller) { if (describeMaintenanceWindowsForTargetRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(describeMaintenanceWindowsForTargetRequest.getTargets(), TARGETS_BINDING); protocolMarshaller.marshall(describeMaintenanceWindowsForTargetRequest.getResourceType(), RESOURCETYPE_BINDING); protocolMarshaller.marshall(describeMaintenanceWindowsForTargetRequest.getMaxResults(), MAXRESULTS_BINDING); protocolMarshaller.marshall(describeMaintenanceWindowsForTargetRequest.getNextToken(), NEXTTOKEN_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(DescribeMaintenanceWindowsForTargetRequest describeMaintenanceWindowsForTargetRequest, ProtocolMarshaller protocolMarshaller) { if (describeMaintenanceWindowsForTargetRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(describeMaintenanceWindowsForTargetRequest.getTargets(), TARGETS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(describeMaintenanceWindowsForTargetRequest.getResourceType(), RESOURCETYPE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(describeMaintenanceWindowsForTargetRequest.getMaxResults(), MAXRESULTS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(describeMaintenanceWindowsForTargetRequest.getNextToken(), NEXTTOKEN_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { @Override public EClass getIfcStructuralLoad() { if (ifcStructuralLoadEClass == null) { ifcStructuralLoadEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI) .getEClassifiers().get(640); } return ifcStructuralLoadEClass; } }
public class class_name { @Override public EClass getIfcStructuralLoad() { if (ifcStructuralLoadEClass == null) { ifcStructuralLoadEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI) .getEClassifiers().get(640); // depends on control dependency: [if], data = [none] } return ifcStructuralLoadEClass; } }
public class class_name { public void setB2buaHelper(MobicentsB2BUAHelper helperImpl) { logger.debug("setting B2BUAHelper"); SipApplicationSession applicationSession = getApplicationSession(); if (this.isValid && applicationSession.isValid()) { applicationSession.setAttribute(B2buaHelperImpl.B2BUA_ATT_NAME, helperImpl); logger.debug("B2BUAHelper set"); } } }
public class class_name { public void setB2buaHelper(MobicentsB2BUAHelper helperImpl) { logger.debug("setting B2BUAHelper"); SipApplicationSession applicationSession = getApplicationSession(); if (this.isValid && applicationSession.isValid()) { applicationSession.setAttribute(B2buaHelperImpl.B2BUA_ATT_NAME, helperImpl); // depends on control dependency: [if], data = [none] logger.debug("B2BUAHelper set"); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static <A, E extends Evictable> EvictionPolicyEvaluator<A, E> getEvictionPolicyEvaluator( EvictionConfiguration evictionConfig, ClassLoader classLoader) { checkNotNull(evictionConfig); EvictionPolicyComparator evictionPolicyComparator; String evictionPolicyComparatorClassName = evictionConfig.getComparatorClassName(); if (!isNullOrEmpty(evictionPolicyComparatorClassName)) { try { evictionPolicyComparator = ClassLoaderUtil.newInstance(classLoader, evictionPolicyComparatorClassName); } catch (Exception e) { throw rethrow(e); } } else { EvictionPolicyComparator comparator = evictionConfig.getComparator(); if (comparator != null) { evictionPolicyComparator = comparator; } else { evictionPolicyComparator = createEvictionPolicyComparator(evictionConfig.getEvictionPolicy()); } } return new EvictionPolicyEvaluator<A, E>(evictionPolicyComparator); } }
public class class_name { public static <A, E extends Evictable> EvictionPolicyEvaluator<A, E> getEvictionPolicyEvaluator( EvictionConfiguration evictionConfig, ClassLoader classLoader) { checkNotNull(evictionConfig); EvictionPolicyComparator evictionPolicyComparator; String evictionPolicyComparatorClassName = evictionConfig.getComparatorClassName(); if (!isNullOrEmpty(evictionPolicyComparatorClassName)) { try { evictionPolicyComparator = ClassLoaderUtil.newInstance(classLoader, evictionPolicyComparatorClassName); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw rethrow(e); } // depends on control dependency: [catch], data = [none] } else { EvictionPolicyComparator comparator = evictionConfig.getComparator(); if (comparator != null) { evictionPolicyComparator = comparator; // depends on control dependency: [if], data = [none] } else { evictionPolicyComparator = createEvictionPolicyComparator(evictionConfig.getEvictionPolicy()); // depends on control dependency: [if], data = [none] } } return new EvictionPolicyEvaluator<A, E>(evictionPolicyComparator); } }
public class class_name { public static String[] getSpecs() { if (specs == null) { final File gccParent = CUtil.getExecutableLocation(GccCCompiler.CMD_PREFIX + "gcc.exe"); if (gccParent != null) { // // build a relative path like // ../lib/gcc-lib/i686-pc-cygwin/2.95.3-5/specs // // // resolve it relative to the location of gcc.exe // final String relativePath = "../lib/gcc-lib/" + getMachine() + '/' + getVersion() + "/specs"; final File specsFile = new File(gccParent, relativePath); // // found the specs file // try { // // read the lines in the file // final BufferedReader reader = new BufferedReader(new FileReader(specsFile)); final Vector<String> lines = new Vector<>(100); String line = reader.readLine(); while (line != null) { lines.addElement(line); line = reader.readLine(); } specs = new String[lines.size()]; lines.copyInto(specs); } catch (final IOException ex) { } } } if (specs == null) { specs = new String[0]; } return specs; } }
public class class_name { public static String[] getSpecs() { if (specs == null) { final File gccParent = CUtil.getExecutableLocation(GccCCompiler.CMD_PREFIX + "gcc.exe"); if (gccParent != null) { // // build a relative path like // ../lib/gcc-lib/i686-pc-cygwin/2.95.3-5/specs // // // resolve it relative to the location of gcc.exe // final String relativePath = "../lib/gcc-lib/" + getMachine() + '/' + getVersion() + "/specs"; final File specsFile = new File(gccParent, relativePath); // // found the specs file // try { // // read the lines in the file // final BufferedReader reader = new BufferedReader(new FileReader(specsFile)); final Vector<String> lines = new Vector<>(100); String line = reader.readLine(); while (line != null) { lines.addElement(line); // depends on control dependency: [while], data = [(line] line = reader.readLine(); // depends on control dependency: [while], data = [none] } specs = new String[lines.size()]; // depends on control dependency: [try], data = [none] lines.copyInto(specs); // depends on control dependency: [try], data = [none] } catch (final IOException ex) { } // depends on control dependency: [catch], data = [none] } } if (specs == null) { specs = new String[0]; } return specs; } }
public class class_name { protected void validate(File file, ValidationOptions option){ if(!file.exists()){ this.errors.addError("file <{}> does not exist in file system", file.getAbsolutePath()); } else if(!file.isFile()){ this.errors.addError("file <{}> is not a file", file.getAbsolutePath()); } if(file.isHidden()){ this.errors.addError("file <{}> is a hidden file", file.getAbsolutePath()); } else{ switch(option){ case AS_SOURCE: if(!file.canRead()){ this.errors.addError("file <{}> is not readable", file.getAbsolutePath()); } break; case AS_SOURCE_AND_TARGET: if(!file.canRead()){ this.errors.addError("file <{}> is not readable", file.getAbsolutePath()); } if(!file.canWrite()){ this.errors.addError("file <{}> is not writable", file.getAbsolutePath()); } break; case AS_TARGET: if(!file.canWrite()){ this.errors.addError("file <{}> is not writable", file.getAbsolutePath()); } break; } } } }
public class class_name { protected void validate(File file, ValidationOptions option){ if(!file.exists()){ this.errors.addError("file <{}> does not exist in file system", file.getAbsolutePath()); // depends on control dependency: [if], data = [none] } else if(!file.isFile()){ this.errors.addError("file <{}> is not a file", file.getAbsolutePath()); // depends on control dependency: [if], data = [none] } if(file.isHidden()){ this.errors.addError("file <{}> is a hidden file", file.getAbsolutePath()); // depends on control dependency: [if], data = [none] } else{ switch(option){ case AS_SOURCE: if(!file.canRead()){ this.errors.addError("file <{}> is not readable", file.getAbsolutePath()); // depends on control dependency: [if], data = [none] } break; case AS_SOURCE_AND_TARGET: if(!file.canRead()){ this.errors.addError("file <{}> is not readable", file.getAbsolutePath()); // depends on control dependency: [if], data = [none] } if(!file.canWrite()){ this.errors.addError("file <{}> is not writable", file.getAbsolutePath()); // depends on control dependency: [if], data = [none] } break; case AS_TARGET: if(!file.canWrite()){ this.errors.addError("file <{}> is not writable", file.getAbsolutePath()); // depends on control dependency: [if], data = [none] } break; } } } }
public class class_name { public PdfBoolean getAsBoolean(PdfName key) { PdfBoolean bool = null; PdfObject orig = getDirectObject(key); if (orig != null && orig.isBoolean()) { bool = (PdfBoolean)orig; } return bool; } }
public class class_name { public PdfBoolean getAsBoolean(PdfName key) { PdfBoolean bool = null; PdfObject orig = getDirectObject(key); if (orig != null && orig.isBoolean()) { bool = (PdfBoolean)orig; // depends on control dependency: [if], data = [none] } return bool; } }
public class class_name { public static File[] getPathFromEnvironment(final String envVariable, final String delim) { // OS/4000 does not support the env command. if (System.getProperty("os.name").equals("OS/400")) { return new File[] {}; } final Vector osEnv = Execute.getProcEnvironment(); final String match = envVariable.concat("="); for (final Enumeration e = osEnv.elements(); e.hasMoreElements();) { final String entry = ((String) e.nextElement()).trim(); if (entry.length() > match.length()) { final String entryFrag = entry.substring(0, match.length()); if (entryFrag.equalsIgnoreCase(match)) { final String path = entry.substring(match.length()); return parsePath(path, delim); } } } final File[] noPath = new File[0]; return noPath; } }
public class class_name { public static File[] getPathFromEnvironment(final String envVariable, final String delim) { // OS/4000 does not support the env command. if (System.getProperty("os.name").equals("OS/400")) { return new File[] {}; // depends on control dependency: [if], data = [none] } final Vector osEnv = Execute.getProcEnvironment(); final String match = envVariable.concat("="); for (final Enumeration e = osEnv.elements(); e.hasMoreElements();) { final String entry = ((String) e.nextElement()).trim(); if (entry.length() > match.length()) { final String entryFrag = entry.substring(0, match.length()); if (entryFrag.equalsIgnoreCase(match)) { final String path = entry.substring(match.length()); return parsePath(path, delim); // depends on control dependency: [if], data = [none] } } } final File[] noPath = new File[0]; return noPath; } }
public class class_name { private void recurse(Bundle bundle, String path, IResourceVisitor visitor, String relPathName) throws IOException { Enumeration<?> entries = bundle.findEntries(path, "*", false); //$NON-NLS-1$ if (entries != null) { while (entries.hasMoreElements()) { URL child = (URL)entries.nextElement(); String childPath = child.getPath(); String temp = childPath; if (temp.endsWith("/")) { //$NON-NLS-1$ temp = temp.substring(0, temp.length()-1); } int idx = temp.lastIndexOf("/"); //$NON-NLS-1$ String childName = temp.substring(idx+1); String relPath = relPathName + (relPathName.length() == 0 ? "" : "/") //$NON-NLS-1$ //$NON-NLS-2$ + childName; boolean result = visitor.visitResource( new VisitorResource(child, relPath), relPath); if (result && child.getPath().endsWith("/")) { //$NON-NLS-1$ recurse(bundle, childPath, visitor, relPath); } } } } }
public class class_name { private void recurse(Bundle bundle, String path, IResourceVisitor visitor, String relPathName) throws IOException { Enumeration<?> entries = bundle.findEntries(path, "*", false); //$NON-NLS-1$ if (entries != null) { while (entries.hasMoreElements()) { URL child = (URL)entries.nextElement(); String childPath = child.getPath(); String temp = childPath; if (temp.endsWith("/")) { //$NON-NLS-1$ temp = temp.substring(0, temp.length()-1); // depends on control dependency: [if], data = [none] } int idx = temp.lastIndexOf("/"); //$NON-NLS-1$ String childName = temp.substring(idx+1); String relPath = relPathName + (relPathName.length() == 0 ? "" : "/") //$NON-NLS-1$ //$NON-NLS-2$ + childName; boolean result = visitor.visitResource( new VisitorResource(child, relPath), relPath); if (result && child.getPath().endsWith("/")) { //$NON-NLS-1$ recurse(bundle, childPath, visitor, relPath); // depends on control dependency: [if], data = [none] } } } } }
public class class_name { @Override public void apply(Object target) { /* * Note that all runners that are Orderable are also Sortable (because * Orderable extends Sortable). Sorting is more efficient than ordering, * so we override the parent behavior so we sort instead. */ if (target instanceof Sortable) { Sortable sortable = (Sortable) target; sortable.sort(this); } } }
public class class_name { @Override public void apply(Object target) { /* * Note that all runners that are Orderable are also Sortable (because * Orderable extends Sortable). Sorting is more efficient than ordering, * so we override the parent behavior so we sort instead. */ if (target instanceof Sortable) { Sortable sortable = (Sortable) target; sortable.sort(this); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public void setApplicationContext(ApplicationContext applicationContext) { if (context == null) { synchronized (ApplicationContextHolder.class) { if (context == null) { ApplicationContextHolder.context = applicationContext; } } } } }
public class class_name { @Override public void setApplicationContext(ApplicationContext applicationContext) { if (context == null) { synchronized (ApplicationContextHolder.class) { // depends on control dependency: [if], data = [none] if (context == null) { ApplicationContextHolder.context = applicationContext; // depends on control dependency: [if], data = [none] } } } } }
public class class_name { @Override protected void handleEvents(final String EVENT_TYPE) { super.handleEvents(EVENT_TYPE); if ("VISIBILITY".equals(EVENT_TYPE)) { Helper.enableNode(titleText, !tile.getTitle().isEmpty()); Helper.enableNode(text, tile.isTextVisible()); } else if ("RECALC".equals(EVENT_TYPE)) { matrix.setColsAndRows(tile.getMatrixSize()); resize(); } } }
public class class_name { @Override protected void handleEvents(final String EVENT_TYPE) { super.handleEvents(EVENT_TYPE); if ("VISIBILITY".equals(EVENT_TYPE)) { Helper.enableNode(titleText, !tile.getTitle().isEmpty()); // depends on control dependency: [if], data = [none] Helper.enableNode(text, tile.isTextVisible()); // depends on control dependency: [if], data = [none] } else if ("RECALC".equals(EVENT_TYPE)) { matrix.setColsAndRows(tile.getMatrixSize()); // depends on control dependency: [if], data = [none] resize(); // depends on control dependency: [if], data = [none] } } }
public class class_name { private boolean isInPaths(final CmsResource resource) { boolean result = false; String resourcePath = getCms().getSitePath(resource); for (String path : m_paths) { if (resourcePath.startsWith(path)) { result = true; break; } } return result; } }
public class class_name { private boolean isInPaths(final CmsResource resource) { boolean result = false; String resourcePath = getCms().getSitePath(resource); for (String path : m_paths) { if (resourcePath.startsWith(path)) { result = true; // depends on control dependency: [if], data = [none] break; } } return result; } }
public class class_name { private Vector<Vector<HashMap<FuzzyAllenIntervalConstraint.Type, Double>>> simplify(Vector<Vector<HashMap<FuzzyAllenIntervalConstraint.Type, Double>>> frelations) { int numVars = getNumVars(); for (int i = 0; i < numVars; i++) { for (int j = 0; j < numVars; j++) { if (i != j) { //Variable from = this.getVariables()[i]; //Variable to = this.getVariables()[j]; Variable from = getSubVariable()[i]; Variable to = getSubVariable()[j]; FuzzyAllenIntervalConstraint direct = (FuzzyAllenIntervalConstraint) this.getConstraintNetwork().getConstraint(from, to); FuzzyAllenIntervalConstraint inverse = (FuzzyAllenIntervalConstraint) this.getConstraintNetwork().getConstraint(to, from); if (direct != null && inverse != null) { //System.out.println("DOING " + direct + "\nPLUS " + inverse); HashMap<FuzzyAllenIntervalConstraint.Type, Double> inversePossibilities = inverse.getInversePossibilities(); updateRelation(frelations.get(i).get(j), inversePossibilities); } } } } return frelations; } }
public class class_name { private Vector<Vector<HashMap<FuzzyAllenIntervalConstraint.Type, Double>>> simplify(Vector<Vector<HashMap<FuzzyAllenIntervalConstraint.Type, Double>>> frelations) { int numVars = getNumVars(); for (int i = 0; i < numVars; i++) { for (int j = 0; j < numVars; j++) { if (i != j) { //Variable from = this.getVariables()[i]; //Variable to = this.getVariables()[j]; Variable from = getSubVariable()[i]; Variable to = getSubVariable()[j]; FuzzyAllenIntervalConstraint direct = (FuzzyAllenIntervalConstraint) this.getConstraintNetwork().getConstraint(from, to); FuzzyAllenIntervalConstraint inverse = (FuzzyAllenIntervalConstraint) this.getConstraintNetwork().getConstraint(to, from); if (direct != null && inverse != null) { //System.out.println("DOING " + direct + "\nPLUS " + inverse); HashMap<FuzzyAllenIntervalConstraint.Type, Double> inversePossibilities = inverse.getInversePossibilities(); updateRelation(frelations.get(i).get(j), inversePossibilities); // depends on control dependency: [if], data = [none] } } } } return frelations; } }
public class class_name { public boolean isDupOrd(final AbsAxis ax) { AbsAxis axis = ax; while (axis instanceof FilterAxis) { axis = ((FilterAxis)axis).getAxis(); } if (axis instanceof UnionAxis) { mOrd = mOrd.updateOrdUnion(); mDup = mDup.updateUnion(); } else if (axis instanceof ChildAxis) { mOrd = mOrd.updateOrdChild(); mDup = mDup.updateDupChild(); } else if (axis instanceof ParentAxis) { mOrd = mOrd.updateOrdParent(); mDup = mDup.updateDupParent(); } else if (axis instanceof DescendantAxis) { mOrd = mOrd.updateOrdDesc(); mDup = mDup.updateDupDesc(); } else if (axis instanceof AncestorAxis) { mOrd = mOrd.updateOrdAncestor(); mDup = mDup.updateDupAncestor(); } else if (axis instanceof FollowingAxis || axis instanceof PrecedingAxis) { mOrd = mOrd.updateOrdFollPre(); mDup = mDup.updateDupFollPre(); } else if (axis instanceof FollowingSiblingAxis || axis instanceof PrecedingSiblingAxis) { mOrd = mOrd.updateOrdFollPreSib(); mDup = mDup.updateDupFollPreSib(); } return !DupState.nodup; } }
public class class_name { public boolean isDupOrd(final AbsAxis ax) { AbsAxis axis = ax; while (axis instanceof FilterAxis) { axis = ((FilterAxis)axis).getAxis(); // depends on control dependency: [while], data = [none] } if (axis instanceof UnionAxis) { mOrd = mOrd.updateOrdUnion(); // depends on control dependency: [if], data = [none] mDup = mDup.updateUnion(); // depends on control dependency: [if], data = [none] } else if (axis instanceof ChildAxis) { mOrd = mOrd.updateOrdChild(); // depends on control dependency: [if], data = [none] mDup = mDup.updateDupChild(); // depends on control dependency: [if], data = [none] } else if (axis instanceof ParentAxis) { mOrd = mOrd.updateOrdParent(); // depends on control dependency: [if], data = [none] mDup = mDup.updateDupParent(); // depends on control dependency: [if], data = [none] } else if (axis instanceof DescendantAxis) { mOrd = mOrd.updateOrdDesc(); // depends on control dependency: [if], data = [none] mDup = mDup.updateDupDesc(); // depends on control dependency: [if], data = [none] } else if (axis instanceof AncestorAxis) { mOrd = mOrd.updateOrdAncestor(); // depends on control dependency: [if], data = [none] mDup = mDup.updateDupAncestor(); // depends on control dependency: [if], data = [none] } else if (axis instanceof FollowingAxis || axis instanceof PrecedingAxis) { mOrd = mOrd.updateOrdFollPre(); // depends on control dependency: [if], data = [none] mDup = mDup.updateDupFollPre(); // depends on control dependency: [if], data = [none] } else if (axis instanceof FollowingSiblingAxis || axis instanceof PrecedingSiblingAxis) { mOrd = mOrd.updateOrdFollPreSib(); // depends on control dependency: [if], data = [none] mDup = mDup.updateDupFollPreSib(); // depends on control dependency: [if], data = [none] } return !DupState.nodup; } }
public class class_name { public static String getFindBugsEnginePluginLocation() { // findbugs.home should be set to the directory the plugin is // installed in. URL u = plugin.getBundle().getEntry("/"); try { URL bundleRoot = FileLocator.resolve(u); String path = bundleRoot.getPath(); if (FindBugsBuilder.DEBUG) { System.out.println("Pluginpath: " + path); //$NON-NLS-1$ } if (path.endsWith("/eclipsePlugin/")) { File f = new File(path); f = f.getParentFile(); f = new File(f, "findbugs"); path = f.getPath() + "/"; } return path; } catch (IOException e) { FindbugsPlugin.getDefault().logException(e, "IO Exception locating engine plugin"); } return null; } }
public class class_name { public static String getFindBugsEnginePluginLocation() { // findbugs.home should be set to the directory the plugin is // installed in. URL u = plugin.getBundle().getEntry("/"); try { URL bundleRoot = FileLocator.resolve(u); String path = bundleRoot.getPath(); if (FindBugsBuilder.DEBUG) { System.out.println("Pluginpath: " + path); //$NON-NLS-1$ // depends on control dependency: [if], data = [none] } if (path.endsWith("/eclipsePlugin/")) { File f = new File(path); f = f.getParentFile(); // depends on control dependency: [if], data = [none] f = new File(f, "findbugs"); // depends on control dependency: [if], data = [none] path = f.getPath() + "/"; // depends on control dependency: [if], data = [none] } return path; // depends on control dependency: [try], data = [none] } catch (IOException e) { FindbugsPlugin.getDefault().logException(e, "IO Exception locating engine plugin"); } // depends on control dependency: [catch], data = [none] return null; } }
public class class_name { public void enforceExtents() { if( x1 < x0 ) { int tmp = x1; x1 = x0; x0 = tmp; } if( y1 < y0 ) { int tmp = y1; y1 = y0; y0 = tmp; } } }
public class class_name { public void enforceExtents() { if( x1 < x0 ) { int tmp = x1; x1 = x0; // depends on control dependency: [if], data = [none] x0 = tmp; // depends on control dependency: [if], data = [none] } if( y1 < y0 ) { int tmp = y1; y1 = y0; // depends on control dependency: [if], data = [none] y0 = tmp; // depends on control dependency: [if], data = [none] } } }
public class class_name { protected void addMainWidget(Widget widget) { assert m_mainWidget == null; assert m_listItemWidget == null; if (widget instanceof CmsListItemWidget) { m_listItemWidget = (CmsListItemWidget)widget; } m_mainWidget = widget; } }
public class class_name { protected void addMainWidget(Widget widget) { assert m_mainWidget == null; assert m_listItemWidget == null; if (widget instanceof CmsListItemWidget) { m_listItemWidget = (CmsListItemWidget)widget; // depends on control dependency: [if], data = [none] } m_mainWidget = widget; } }
public class class_name { private void applyPattern(RuleCharacterIterator chars, SymbolTable symbols, Appendable rebuiltPat, int options) { // Syntax characters: [ ] ^ - & { } // Recognized special forms for chars, sets: c-c s-s s&s int opts = RuleCharacterIterator.PARSE_VARIABLES | RuleCharacterIterator.PARSE_ESCAPES; if ((options & IGNORE_SPACE) != 0) { opts |= RuleCharacterIterator.SKIP_WHITESPACE; } StringBuilder patBuf = new StringBuilder(), buf = null; boolean usePat = false; UnicodeSet scratch = null; Object backup = null; // mode: 0=before [, 1=between [...], 2=after ] // lastItem: 0=none, 1=char, 2=set int lastItem = LAST0_START, lastChar = 0, mode = MODE0_NONE; char op = 0; boolean invert = false; clear(); String lastString = null; while (mode != MODE2_OUTBRACKET && !chars.atEnd()) { //Eclipse stated the following is "dead code" /* if (false) { // Debugging assertion if (!((lastItem == 0 && op == 0) || (lastItem == 1 && (op == 0 || op == '-')) || (lastItem == 2 && (op == 0 || op == '-' || op == '&')))) { throw new IllegalArgumentException(); } }*/ int c = 0; boolean literal = false; UnicodeSet nested = null; // -------- Check for property pattern // setMode: 0=none, 1=unicodeset, 2=propertypat, 3=preparsed int setMode = SETMODE0_NONE; if (resemblesPropertyPattern(chars, opts)) { setMode = SETMODE2_PROPERTYPAT; } // -------- Parse '[' of opening delimiter OR nested set. // If there is a nested set, use `setMode' to define how // the set should be parsed. If the '[' is part of the // opening delimiter for this pattern, parse special // strings "[", "[^", "[-", and "[^-". Check for stand-in // characters representing a nested set in the symbol // table. else { // Prepare to backup if necessary backup = chars.getPos(backup); c = chars.next(opts); literal = chars.isEscaped(); if (c == '[' && !literal) { if (mode == MODE1_INBRACKET) { chars.setPos(backup); // backup setMode = SETMODE1_UNICODESET; } else { // Handle opening '[' delimiter mode = MODE1_INBRACKET; patBuf.append('['); backup = chars.getPos(backup); // prepare to backup c = chars.next(opts); literal = chars.isEscaped(); if (c == '^' && !literal) { invert = true; patBuf.append('^'); backup = chars.getPos(backup); // prepare to backup c = chars.next(opts); literal = chars.isEscaped(); } // Fall through to handle special leading '-'; // otherwise restart loop for nested [], \p{}, etc. if (c == '-') { literal = true; // Fall through to handle literal '-' below } else { chars.setPos(backup); // backup continue; } } } else if (symbols != null) { UnicodeMatcher m = symbols.lookupMatcher(c); // may be null if (m != null) { try { nested = (UnicodeSet) m; setMode = SETMODE3_PREPARSED; } catch (ClassCastException e) { syntaxError(chars, "Syntax error"); } } } } // -------- Handle a nested set. This either is inline in // the pattern or represented by a stand-in that has // previously been parsed and was looked up in the symbol // table. if (setMode != SETMODE0_NONE) { if (lastItem == LAST1_RANGE) { if (op != 0) { syntaxError(chars, "Char expected after operator"); } add_unchecked(lastChar, lastChar); _appendToPat(patBuf, lastChar, false); lastItem = LAST0_START; op = 0; } if (op == '-' || op == '&') { patBuf.append(op); } if (nested == null) { if (scratch == null) scratch = new UnicodeSet(); nested = scratch; } switch (setMode) { case SETMODE1_UNICODESET: nested.applyPattern(chars, symbols, patBuf, options); break; case SETMODE2_PROPERTYPAT: chars.skipIgnored(opts); nested.applyPropertyPattern(chars, patBuf, symbols); break; case SETMODE3_PREPARSED: // `nested' already parsed nested._toPattern(patBuf, false); break; } usePat = true; if (mode == MODE0_NONE) { // Entire pattern is a category; leave parse loop set(nested); mode = MODE2_OUTBRACKET; break; } switch (op) { case '-': removeAll(nested); break; case '&': retainAll(nested); break; case 0: addAll(nested); break; } op = 0; lastItem = LAST2_SET; continue; } if (mode == MODE0_NONE) { syntaxError(chars, "Missing '['"); } // -------- Parse special (syntax) characters. If the // current character is not special, or if it is escaped, // then fall through and handle it below. if (!literal) { switch (c) { case ']': if (lastItem == LAST1_RANGE) { add_unchecked(lastChar, lastChar); _appendToPat(patBuf, lastChar, false); } // Treat final trailing '-' as a literal if (op == '-') { add_unchecked(op, op); patBuf.append(op); } else if (op == '&') { syntaxError(chars, "Trailing '&'"); } patBuf.append(']'); mode = MODE2_OUTBRACKET; continue; case '-': if (op == 0) { if (lastItem != LAST0_START) { op = (char) c; continue; } else if (lastString != null) { op = (char) c; continue; } else { // Treat final trailing '-' as a literal add_unchecked(c, c); c = chars.next(opts); literal = chars.isEscaped(); if (c == ']' && !literal) { patBuf.append("-]"); mode = MODE2_OUTBRACKET; continue; } } } syntaxError(chars, "'-' not after char, string, or set"); break; case '&': if (lastItem == LAST2_SET && op == 0) { op = (char) c; continue; } syntaxError(chars, "'&' not after set"); break; case '^': syntaxError(chars, "'^' not after '['"); break; case '{': if (op != 0 && op != '-') { syntaxError(chars, "Missing operand after operator"); } if (lastItem == LAST1_RANGE) { add_unchecked(lastChar, lastChar); _appendToPat(patBuf, lastChar, false); } lastItem = LAST0_START; if (buf == null) { buf = new StringBuilder(); } else { buf.setLength(0); } boolean ok = false; while (!chars.atEnd()) { c = chars.next(opts); literal = chars.isEscaped(); if (c == '}' && !literal) { ok = true; break; } appendCodePoint(buf, c); } if (buf.length() < 1 || !ok) { syntaxError(chars, "Invalid multicharacter string"); } // We have new string. Add it to set and continue; // we don't need to drop through to the further // processing String curString = buf.toString(); if (op == '-') { int lastSingle = CharSequences.getSingleCodePoint(lastString == null ? "" : lastString); int curSingle = CharSequences.getSingleCodePoint(curString); if (lastSingle != Integer.MAX_VALUE && curSingle != Integer.MAX_VALUE) { add(lastSingle,curSingle); } else { try { StringRange.expand(lastString, curString, true, strings); } catch (Exception e) { syntaxError(chars, e.getMessage()); } } lastString = null; op = 0; } else { add(curString); lastString = curString; } patBuf.append('{'); _appendToPat(patBuf, curString, false); patBuf.append('}'); continue; case SymbolTable.SYMBOL_REF: // symbols nosymbols // [a-$] error error (ambiguous) // [a$] anchor anchor // [a-$x] var "x"* literal '$' // [a-$.] error literal '$' // *We won't get here in the case of var "x" backup = chars.getPos(backup); c = chars.next(opts); literal = chars.isEscaped(); boolean anchor = (c == ']' && !literal); if (symbols == null && !anchor) { c = SymbolTable.SYMBOL_REF; chars.setPos(backup); break; // literal '$' } if (anchor && op == 0) { if (lastItem == LAST1_RANGE) { add_unchecked(lastChar, lastChar); _appendToPat(patBuf, lastChar, false); } add_unchecked(UnicodeMatcher.ETHER); usePat = true; patBuf.append(SymbolTable.SYMBOL_REF).append(']'); mode = MODE2_OUTBRACKET; continue; } syntaxError(chars, "Unquoted '$'"); break; default: break; } } // -------- Parse literal characters. This includes both // escaped chars ("\u4E01") and non-syntax characters // ("a"). switch (lastItem) { case LAST0_START: if (op == '-' && lastString != null) { syntaxError(chars, "Invalid range"); } lastItem = LAST1_RANGE; lastChar = c; lastString = null; break; case LAST1_RANGE: if (op == '-') { if (lastString != null) { syntaxError(chars, "Invalid range"); } if (lastChar >= c) { // Don't allow redundant (a-a) or empty (b-a) ranges; // these are most likely typos. syntaxError(chars, "Invalid range"); } add_unchecked(lastChar, c); _appendToPat(patBuf, lastChar, false); patBuf.append(op); _appendToPat(patBuf, c, false); lastItem = LAST0_START; op = 0; } else { add_unchecked(lastChar, lastChar); _appendToPat(patBuf, lastChar, false); lastChar = c; } break; case LAST2_SET: if (op != 0) { syntaxError(chars, "Set expected after operator"); } lastChar = c; lastItem = LAST1_RANGE; break; } } if (mode != MODE2_OUTBRACKET) { syntaxError(chars, "Missing ']'"); } chars.skipIgnored(opts); /** * Handle global flags (invert, case insensitivity). If this * pattern should be compiled case-insensitive, then we need * to close over case BEFORE COMPLEMENTING. This makes * patterns like /[^abc]/i work. */ if ((options & CASE) != 0) { closeOver(CASE); } if (invert) { complement(); } // Use the rebuilt pattern (pat) only if necessary. Prefer the // generated pattern. if (usePat) { append(rebuiltPat, patBuf.toString()); } else { appendNewPattern(rebuiltPat, false, true); } } }
public class class_name { private void applyPattern(RuleCharacterIterator chars, SymbolTable symbols, Appendable rebuiltPat, int options) { // Syntax characters: [ ] ^ - & { } // Recognized special forms for chars, sets: c-c s-s s&s int opts = RuleCharacterIterator.PARSE_VARIABLES | RuleCharacterIterator.PARSE_ESCAPES; if ((options & IGNORE_SPACE) != 0) { opts |= RuleCharacterIterator.SKIP_WHITESPACE; // depends on control dependency: [if], data = [none] } StringBuilder patBuf = new StringBuilder(), buf = null; boolean usePat = false; UnicodeSet scratch = null; Object backup = null; // mode: 0=before [, 1=between [...], 2=after ] // lastItem: 0=none, 1=char, 2=set int lastItem = LAST0_START, lastChar = 0, mode = MODE0_NONE; char op = 0; boolean invert = false; clear(); String lastString = null; while (mode != MODE2_OUTBRACKET && !chars.atEnd()) { //Eclipse stated the following is "dead code" /* if (false) { // Debugging assertion if (!((lastItem == 0 && op == 0) || (lastItem == 1 && (op == 0 || op == '-')) || (lastItem == 2 && (op == 0 || op == '-' || op == '&')))) { throw new IllegalArgumentException(); } }*/ int c = 0; boolean literal = false; UnicodeSet nested = null; // -------- Check for property pattern // setMode: 0=none, 1=unicodeset, 2=propertypat, 3=preparsed int setMode = SETMODE0_NONE; if (resemblesPropertyPattern(chars, opts)) { setMode = SETMODE2_PROPERTYPAT; // depends on control dependency: [if], data = [none] } // -------- Parse '[' of opening delimiter OR nested set. // If there is a nested set, use `setMode' to define how // the set should be parsed. If the '[' is part of the // opening delimiter for this pattern, parse special // strings "[", "[^", "[-", and "[^-". Check for stand-in // characters representing a nested set in the symbol // table. else { // Prepare to backup if necessary backup = chars.getPos(backup); // depends on control dependency: [if], data = [none] c = chars.next(opts); // depends on control dependency: [if], data = [none] literal = chars.isEscaped(); // depends on control dependency: [if], data = [none] if (c == '[' && !literal) { if (mode == MODE1_INBRACKET) { chars.setPos(backup); // backup // depends on control dependency: [if], data = [none] setMode = SETMODE1_UNICODESET; // depends on control dependency: [if], data = [none] } else { // Handle opening '[' delimiter mode = MODE1_INBRACKET; // depends on control dependency: [if], data = [none] patBuf.append('['); // depends on control dependency: [if], data = [none] backup = chars.getPos(backup); // prepare to backup // depends on control dependency: [if], data = [none] c = chars.next(opts); // depends on control dependency: [if], data = [none] literal = chars.isEscaped(); // depends on control dependency: [if], data = [none] if (c == '^' && !literal) { invert = true; // depends on control dependency: [if], data = [none] patBuf.append('^'); // depends on control dependency: [if], data = [none] backup = chars.getPos(backup); // prepare to backup // depends on control dependency: [if], data = [none] c = chars.next(opts); // depends on control dependency: [if], data = [none] literal = chars.isEscaped(); // depends on control dependency: [if], data = [none] } // Fall through to handle special leading '-'; // otherwise restart loop for nested [], \p{}, etc. if (c == '-') { literal = true; // depends on control dependency: [if], data = [none] // Fall through to handle literal '-' below } else { chars.setPos(backup); // backup // depends on control dependency: [if], data = [none] continue; } } } else if (symbols != null) { UnicodeMatcher m = symbols.lookupMatcher(c); // may be null if (m != null) { try { nested = (UnicodeSet) m; // depends on control dependency: [try], data = [none] setMode = SETMODE3_PREPARSED; // depends on control dependency: [try], data = [none] } catch (ClassCastException e) { syntaxError(chars, "Syntax error"); } // depends on control dependency: [catch], data = [none] } } } // -------- Handle a nested set. This either is inline in // the pattern or represented by a stand-in that has // previously been parsed and was looked up in the symbol // table. if (setMode != SETMODE0_NONE) { if (lastItem == LAST1_RANGE) { if (op != 0) { syntaxError(chars, "Char expected after operator"); // depends on control dependency: [if], data = [none] } add_unchecked(lastChar, lastChar); // depends on control dependency: [if], data = [none] _appendToPat(patBuf, lastChar, false); // depends on control dependency: [if], data = [none] lastItem = LAST0_START; // depends on control dependency: [if], data = [none] op = 0; // depends on control dependency: [if], data = [none] } if (op == '-' || op == '&') { patBuf.append(op); // depends on control dependency: [if], data = [(op] } if (nested == null) { if (scratch == null) scratch = new UnicodeSet(); nested = scratch; // depends on control dependency: [if], data = [none] } switch (setMode) { case SETMODE1_UNICODESET: nested.applyPattern(chars, symbols, patBuf, options); break; case SETMODE2_PROPERTYPAT: chars.skipIgnored(opts); nested.applyPropertyPattern(chars, patBuf, symbols); break; case SETMODE3_PREPARSED: // `nested' already parsed nested._toPattern(patBuf, false); break; } usePat = true; // depends on control dependency: [if], data = [none] if (mode == MODE0_NONE) { // Entire pattern is a category; leave parse loop set(nested); // depends on control dependency: [if], data = [none] mode = MODE2_OUTBRACKET; // depends on control dependency: [if], data = [none] break; } switch (op) { case '-': removeAll(nested); break; case '&': retainAll(nested); break; case 0: addAll(nested); break; } op = 0; // depends on control dependency: [if], data = [none] lastItem = LAST2_SET; // depends on control dependency: [if], data = [none] continue; } if (mode == MODE0_NONE) { syntaxError(chars, "Missing '['"); // depends on control dependency: [if], data = [none] } // -------- Parse special (syntax) characters. If the // current character is not special, or if it is escaped, // then fall through and handle it below. if (!literal) { switch (c) { case ']': if (lastItem == LAST1_RANGE) { add_unchecked(lastChar, lastChar); // depends on control dependency: [if], data = [none] _appendToPat(patBuf, lastChar, false); // depends on control dependency: [if], data = [none] } // Treat final trailing '-' as a literal if (op == '-') { add_unchecked(op, op); // depends on control dependency: [if], data = [(op] patBuf.append(op); // depends on control dependency: [if], data = [(op] } else if (op == '&') { syntaxError(chars, "Trailing '&'"); // depends on control dependency: [if], data = [none] } patBuf.append(']'); mode = MODE2_OUTBRACKET; continue; case '-': if (op == 0) { if (lastItem != LAST0_START) { op = (char) c; // depends on control dependency: [if], data = [none] continue; } else if (lastString != null) { op = (char) c; // depends on control dependency: [if], data = [none] continue; } else { // Treat final trailing '-' as a literal add_unchecked(c, c); // depends on control dependency: [if], data = [none] c = chars.next(opts); // depends on control dependency: [if], data = [none] literal = chars.isEscaped(); // depends on control dependency: [if], data = [none] if (c == ']' && !literal) { patBuf.append("-]"); // depends on control dependency: [if], data = [none] mode = MODE2_OUTBRACKET; // depends on control dependency: [if], data = [none] continue; } } } syntaxError(chars, "'-' not after char, string, or set"); break; case '&': if (lastItem == LAST2_SET && op == 0) { op = (char) c; continue; } syntaxError(chars, "'&' not after set"); break; case '^': syntaxError(chars, "'^' not after '['"); break; case '{': if (op != 0 && op != '-') { syntaxError(chars, "Missing operand after operator"); } if (lastItem == LAST1_RANGE) { add_unchecked(lastChar, lastChar); _appendToPat(patBuf, lastChar, false); } lastItem = LAST0_START; if (buf == null) { buf = new StringBuilder(); } else { buf.setLength(0); } boolean ok = false; while (!chars.atEnd()) { c = chars.next(opts); literal = chars.isEscaped(); if (c == '}' && !literal) { ok = true; break; } appendCodePoint(buf, c); } if (buf.length() < 1 || !ok) { syntaxError(chars, "Invalid multicharacter string"); } // We have new string. Add it to set and continue; // we don't need to drop through to the further // processing String curString = buf.toString(); if (op == '-') { int lastSingle = CharSequences.getSingleCodePoint(lastString == null ? "" : lastString); int curSingle = CharSequences.getSingleCodePoint(curString); if (lastSingle != Integer.MAX_VALUE && curSingle != Integer.MAX_VALUE) { add(lastSingle,curSingle); } else { try { StringRange.expand(lastString, curString, true, strings); } catch (Exception e) { syntaxError(chars, e.getMessage()); } } lastString = null; op = 0; } else { add(curString); lastString = curString; } patBuf.append('{'); _appendToPat(patBuf, curString, false); patBuf.append('}'); continue; case SymbolTable.SYMBOL_REF: // symbols nosymbols // [a-$] error error (ambiguous) // [a$] anchor anchor // [a-$x] var "x"* literal '$' // [a-$.] error literal '$' // *We won't get here in the case of var "x" backup = chars.getPos(backup); c = chars.next(opts); literal = chars.isEscaped(); boolean anchor = (c == ']' && !literal); if (symbols == null && !anchor) { c = SymbolTable.SYMBOL_REF; chars.setPos(backup); break; // literal '$' } if (anchor && op == 0) { if (lastItem == LAST1_RANGE) { add_unchecked(lastChar, lastChar); _appendToPat(patBuf, lastChar, false); } add_unchecked(UnicodeMatcher.ETHER); usePat = true; patBuf.append(SymbolTable.SYMBOL_REF).append(']'); mode = MODE2_OUTBRACKET; continue; } syntaxError(chars, "Unquoted '$'"); break; default: break; } } // -------- Parse literal characters. This includes both // escaped chars ("\u4E01") and non-syntax characters // ("a"). switch (lastItem) { case LAST0_START: if (op == '-' && lastString != null) { syntaxError(chars, "Invalid range"); } lastItem = LAST1_RANGE; lastChar = c; lastString = null; break; case LAST1_RANGE: if (op == '-') { if (lastString != null) { syntaxError(chars, "Invalid range"); } if (lastChar >= c) { // Don't allow redundant (a-a) or empty (b-a) ranges; // these are most likely typos. syntaxError(chars, "Invalid range"); } add_unchecked(lastChar, c); _appendToPat(patBuf, lastChar, false); patBuf.append(op); _appendToPat(patBuf, c, false); lastItem = LAST0_START; op = 0; } else { add_unchecked(lastChar, lastChar); _appendToPat(patBuf, lastChar, false); lastChar = c; } break; case LAST2_SET: if (op != 0) { syntaxError(chars, "Set expected after operator"); } lastChar = c; lastItem = LAST1_RANGE; break; } } if (mode != MODE2_OUTBRACKET) { syntaxError(chars, "Missing ']'"); } chars.skipIgnored(opts); /** * Handle global flags (invert, case insensitivity). If this * pattern should be compiled case-insensitive, then we need * to close over case BEFORE COMPLEMENTING. This makes * patterns like /[^abc]/i work. */ if ((options & CASE) != 0) { closeOver(CASE); } if (invert) { complement(); } // Use the rebuilt pattern (pat) only if necessary. Prefer the // generated pattern. if (usePat) { append(rebuiltPat, patBuf.toString()); } else { appendNewPattern(rebuiltPat, false, true); } } }
public class class_name { public void start() { synchronized (_lock) { // Stop previously set timer _timer.purge(); // Set a new timer TimerTask task = new TimerTask() { @Override public void run() { try { _task.notify("pip-commons-timer", new Parameters()); } catch (Exception ex) { // Ignore or better log! } } }; _timer.scheduleAtFixedRate(task, _delay, _interval); // Set started flag _started = true; } } }
public class class_name { public void start() { synchronized (_lock) { // Stop previously set timer _timer.purge(); // Set a new timer TimerTask task = new TimerTask() { @Override public void run() { try { _task.notify("pip-commons-timer", new Parameters()); // depends on control dependency: [try], data = [none] } catch (Exception ex) { // Ignore or better log! } // depends on control dependency: [catch], data = [none] } }; _timer.scheduleAtFixedRate(task, _delay, _interval); // Set started flag _started = true; } } }
public class class_name { @ManagedAttribute() public List<String> getEffectiveProperties() { final List<String> properties = new LinkedList<String>(); for (final String key : myProperties.stringPropertyNames()) { properties.add(key + "=" + myProperties.get(key)); } return properties; } }
public class class_name { @ManagedAttribute() public List<String> getEffectiveProperties() { final List<String> properties = new LinkedList<String>(); for (final String key : myProperties.stringPropertyNames()) { properties.add(key + "=" + myProperties.get(key)); // depends on control dependency: [for], data = [key] } return properties; } }
public class class_name { public synchronized void addMember(BalancerMember member) { if (member.getBalancerName().equals(name)) { logger.info("Adding balancer member '{}' to balancer '{}'", member.getName(), name); members.add(member); } } }
public class class_name { public synchronized void addMember(BalancerMember member) { if (member.getBalancerName().equals(name)) { logger.info("Adding balancer member '{}' to balancer '{}'", member.getName(), name); // depends on control dependency: [if], data = [none] members.add(member); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static Policy readPolicy(CmsObject cms, String sitePath) { try { CmsFile policyFile = cms.readFile(sitePath); ByteArrayInputStream input = new ByteArrayInputStream(policyFile.getContents()); // we use the deprecated method here because it is the only way to load // a policy directly from the VFS. Policy policy = Policy.getInstance(input); return policy; } catch (CmsException e) { LOG.error("Could not read Antisamy policy file"); LOG.error(e.getLocalizedMessage(), e); return null; } catch (PolicyException e) { LOG.error("Invalid Antisamy policy read from " + sitePath); LOG.error(e.getLocalizedMessage(), e); return null; } } }
public class class_name { public static Policy readPolicy(CmsObject cms, String sitePath) { try { CmsFile policyFile = cms.readFile(sitePath); ByteArrayInputStream input = new ByteArrayInputStream(policyFile.getContents()); // we use the deprecated method here because it is the only way to load // a policy directly from the VFS. Policy policy = Policy.getInstance(input); return policy; // depends on control dependency: [try], data = [none] } catch (CmsException e) { LOG.error("Could not read Antisamy policy file"); LOG.error(e.getLocalizedMessage(), e); return null; } catch (PolicyException e) { // depends on control dependency: [catch], data = [none] LOG.error("Invalid Antisamy policy read from " + sitePath); LOG.error(e.getLocalizedMessage(), e); return null; } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static <T> void setInjectorInstance(Class<T> injectorClass, T injectorInstance) { if (injectorInstance == null){ injectorsMap.remove(injectorClass); } injectorsMap.put(injectorClass, injectorInstance); } }
public class class_name { public static <T> void setInjectorInstance(Class<T> injectorClass, T injectorInstance) { if (injectorInstance == null){ injectorsMap.remove(injectorClass); // depends on control dependency: [if], data = [none] } injectorsMap.put(injectorClass, injectorInstance); } }
public class class_name { public void changePropStatStatus(String oldStatus, String newStatus, String responseDescription) { Assert.isNotNull(oldStatus); Assert.isNotNull(newStatus); Element firstHref = getFirstChild(root, "href"); //$NON-NLS-1$ Assert.isTrue(firstHref == null || getNextSibling(firstHref, new String[] {"href", "status"}) == null); //$NON-NLS-1$ //$NON-NLS-2$ Element propstat = getFirstChild(root, "propstat"); //$NON-NLS-1$ while (propstat != null) { String status = getChildText(propstat, "status", true); //$NON-NLS-1$ if (oldStatus.equals(status)) { setChild(propstat, "status", newStatus, PropStat.childNames, true); //$NON-NLS-1$ if (responseDescription == null) { Element responsedescription = getLastChild(propstat, "responsedescription"); //$NON-NLS-1$ if (responsedescription != null) propstat.removeChild(responsedescription); } else setChild(propstat, "responsedescription", //$NON-NLS-1$ responseDescription, PropStat.childNames, false); } propstat = getTwin(propstat, true); } } }
public class class_name { public void changePropStatStatus(String oldStatus, String newStatus, String responseDescription) { Assert.isNotNull(oldStatus); Assert.isNotNull(newStatus); Element firstHref = getFirstChild(root, "href"); //$NON-NLS-1$ Assert.isTrue(firstHref == null || getNextSibling(firstHref, new String[] {"href", "status"}) == null); //$NON-NLS-1$ //$NON-NLS-2$ Element propstat = getFirstChild(root, "propstat"); //$NON-NLS-1$ while (propstat != null) { String status = getChildText(propstat, "status", true); //$NON-NLS-1$ if (oldStatus.equals(status)) { setChild(propstat, "status", newStatus, PropStat.childNames, true); //$NON-NLS-1$ // depends on control dependency: [if], data = [none] if (responseDescription == null) { Element responsedescription = getLastChild(propstat, "responsedescription"); //$NON-NLS-1$ if (responsedescription != null) propstat.removeChild(responsedescription); } else setChild(propstat, "responsedescription", //$NON-NLS-1$ responseDescription, PropStat.childNames, false); } propstat = getTwin(propstat, true); // depends on control dependency: [while], data = [(propstat] } } }
public class class_name { private void search(int v, long prev, long curr) { state[v] = curr; // store the state before we visited v curr = setBit(curr, v); // include v in our current state (state[v] is unmodified) visited |= curr; // mark v as visited (or being visited) // neighbors of v for (int w : g[v]) { // w has been visited or is partially visited further up stack if (visited(w)) { // if w is in our prev state we have a cycle of size >2. // we don't check out current state as this will always // include w - they are adjacent if (isBitSet(prev, w)) { numCycles++; // xor the state when we last visited 'w' with our current // state. this set is all the vertices we visited since then // and are all in a cycle add(state[w] ^ curr); } } else { // recursively call for the unvisited neighbor w search(w, state[v], curr); } } } }
public class class_name { private void search(int v, long prev, long curr) { state[v] = curr; // store the state before we visited v curr = setBit(curr, v); // include v in our current state (state[v] is unmodified) visited |= curr; // mark v as visited (or being visited) // neighbors of v for (int w : g[v]) { // w has been visited or is partially visited further up stack if (visited(w)) { // if w is in our prev state we have a cycle of size >2. // we don't check out current state as this will always // include w - they are adjacent if (isBitSet(prev, w)) { numCycles++; // depends on control dependency: [if], data = [none] // xor the state when we last visited 'w' with our current // state. this set is all the vertices we visited since then // and are all in a cycle add(state[w] ^ curr); // depends on control dependency: [if], data = [none] } } else { // recursively call for the unvisited neighbor w search(w, state[v], curr); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public synchronized void shutdown() { if (!isActive) { return; } log.info("Shutting down the default async job executor [{}].", getClass().getName()); if (timerJobRunnable != null) { timerJobRunnable.stop(); } if (asyncJobsDueRunnable != null) { asyncJobsDueRunnable.stop(); } if (resetExpiredJobsRunnable != null) { resetExpiredJobsRunnable.stop(); } stopResetExpiredJobsThread(); stopTimerAcquisitionThread(); stopJobAcquisitionThread(); stopExecutingAsyncJobs(); timerJobRunnable = null; asyncJobsDueRunnable = null; resetExpiredJobsRunnable = null; isActive = false; } }
public class class_name { public synchronized void shutdown() { if (!isActive) { return; // depends on control dependency: [if], data = [none] } log.info("Shutting down the default async job executor [{}].", getClass().getName()); if (timerJobRunnable != null) { timerJobRunnable.stop(); // depends on control dependency: [if], data = [none] } if (asyncJobsDueRunnable != null) { asyncJobsDueRunnable.stop(); // depends on control dependency: [if], data = [none] } if (resetExpiredJobsRunnable != null) { resetExpiredJobsRunnable.stop(); // depends on control dependency: [if], data = [none] } stopResetExpiredJobsThread(); stopTimerAcquisitionThread(); stopJobAcquisitionThread(); stopExecutingAsyncJobs(); timerJobRunnable = null; asyncJobsDueRunnable = null; resetExpiredJobsRunnable = null; isActive = false; } }
public class class_name { static String getObjectLitKeyName(Node key) { Node keyNode = getObjectLitKeyNode(key); if (keyNode != null) { return keyNode.getString(); } throw new IllegalStateException("Unexpected node type: " + key); } }
public class class_name { static String getObjectLitKeyName(Node key) { Node keyNode = getObjectLitKeyNode(key); if (keyNode != null) { return keyNode.getString(); // depends on control dependency: [if], data = [none] } throw new IllegalStateException("Unexpected node type: " + key); } }
public class class_name { @Override public void draw(Canvas canvas) { if (getPicture() != null) { Rect bounds = getBounds(); canvas.save(); // draw picture to fit bounds! canvas.drawPicture(getPicture(), bounds); canvas.restore(); } } }
public class class_name { @Override public void draw(Canvas canvas) { if (getPicture() != null) { Rect bounds = getBounds(); canvas.save(); // depends on control dependency: [if], data = [none] // draw picture to fit bounds! canvas.drawPicture(getPicture(), bounds); // depends on control dependency: [if], data = [(getPicture()] canvas.restore(); // depends on control dependency: [if], data = [none] } } }
public class class_name { private void processBlock(List<GenericCriteria> list, byte[] block) { if (block != null) { if (MPPUtility.getShort(block, 0) > 0x3E6) { addCriteria(list, block); } else { switch (block[0]) { case (byte) 0x0B: { processBlock(list, getChildBlock(block)); break; } case (byte) 0x06: { processBlock(list, getListNextBlock(block)); break; } case (byte) 0xED: // EQUALS { addCriteria(list, block); break; } case (byte) 0x19: // AND case (byte) 0x1B: { addBlock(list, block, TestOperator.AND); break; } case (byte) 0x1A: // OR case (byte) 0x1C: { addBlock(list, block, TestOperator.OR); break; } } } } } }
public class class_name { private void processBlock(List<GenericCriteria> list, byte[] block) { if (block != null) { if (MPPUtility.getShort(block, 0) > 0x3E6) { addCriteria(list, block); // depends on control dependency: [if], data = [none] } else { switch (block[0]) { case (byte) 0x0B: { processBlock(list, getChildBlock(block)); break; } case (byte) 0x06: { // depends on control dependency: [if], data = [none] processBlock(list, getListNextBlock(block)); // depends on control dependency: [if], data = [none] break; } case (byte) 0xED: // EQUALS { addCriteria(list, block); // depends on control dependency: [if], data = [none] break; } case (byte) 0x19: // AND case (byte) 0x1B: { addBlock(list, block, TestOperator.AND); break; } case (byte) 0x1A: // OR case (byte) 0x1C: { addBlock(list, block, TestOperator.OR); break; } } } } } }
public class class_name { public GetMetricDataResult withMetricDataResults(MetricDataResult... metricDataResults) { if (this.metricDataResults == null) { setMetricDataResults(new com.amazonaws.internal.SdkInternalList<MetricDataResult>(metricDataResults.length)); } for (MetricDataResult ele : metricDataResults) { this.metricDataResults.add(ele); } return this; } }
public class class_name { public GetMetricDataResult withMetricDataResults(MetricDataResult... metricDataResults) { if (this.metricDataResults == null) { setMetricDataResults(new com.amazonaws.internal.SdkInternalList<MetricDataResult>(metricDataResults.length)); // depends on control dependency: [if], data = [none] } for (MetricDataResult ele : metricDataResults) { this.metricDataResults.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { @VisibleForTesting static boolean isGreaterThanOrEqualTo(Version first, Version second) { if ((first.getMajor() > second.getMajor()) || (first.getMajor() == second.getMajor() && first.getMinor() >= second.getMinor())) { return true; } return false; } }
public class class_name { @VisibleForTesting static boolean isGreaterThanOrEqualTo(Version first, Version second) { if ((first.getMajor() > second.getMajor()) || (first.getMajor() == second.getMajor() && first.getMinor() >= second.getMinor())) { return true; // depends on control dependency: [if], data = [none] } return false; } }
public class class_name { public void setDnsTtlSuccessfulQueries(int ttl) { if (dnsTtlSuccessfulQueries == ttl) { return; } dnsTtlSuccessfulQueries = ttl; getConfig().setProperty(DNS_TTL_SUCCESSFUL_QUERIES_KEY, ttl); } }
public class class_name { public void setDnsTtlSuccessfulQueries(int ttl) { if (dnsTtlSuccessfulQueries == ttl) { return; // depends on control dependency: [if], data = [none] } dnsTtlSuccessfulQueries = ttl; getConfig().setProperty(DNS_TTL_SUCCESSFUL_QUERIES_KEY, ttl); } }
public class class_name { public DescribeConfigurationSetRequest withConfigurationSetAttributeNames(String... configurationSetAttributeNames) { if (this.configurationSetAttributeNames == null) { setConfigurationSetAttributeNames(new com.amazonaws.internal.SdkInternalList<String>(configurationSetAttributeNames.length)); } for (String ele : configurationSetAttributeNames) { this.configurationSetAttributeNames.add(ele); } return this; } }
public class class_name { public DescribeConfigurationSetRequest withConfigurationSetAttributeNames(String... configurationSetAttributeNames) { if (this.configurationSetAttributeNames == null) { setConfigurationSetAttributeNames(new com.amazonaws.internal.SdkInternalList<String>(configurationSetAttributeNames.length)); // depends on control dependency: [if], data = [none] } for (String ele : configurationSetAttributeNames) { this.configurationSetAttributeNames.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { @Override protected void initializeGraph() { super.initializeGraph(); mData = new ArrayList<>(); mValuePaint = new Paint(mLegendPaint); if(this.isInEditMode()) { addBar(new BarModel(2.3f)); addBar(new BarModel(2.f)); addBar(new BarModel(3.3f)); addBar(new BarModel(1.1f)); addBar(new BarModel(2.7f)); addBar(new BarModel(2.3f)); addBar(new BarModel(2.f)); addBar(new BarModel(3.3f)); addBar(new BarModel(1.1f)); addBar(new BarModel(2.7f)); } } }
public class class_name { @Override protected void initializeGraph() { super.initializeGraph(); mData = new ArrayList<>(); mValuePaint = new Paint(mLegendPaint); if(this.isInEditMode()) { addBar(new BarModel(2.3f)); // depends on control dependency: [if], data = [none] addBar(new BarModel(2.f)); // depends on control dependency: [if], data = [none] addBar(new BarModel(3.3f)); // depends on control dependency: [if], data = [none] addBar(new BarModel(1.1f)); // depends on control dependency: [if], data = [none] addBar(new BarModel(2.7f)); // depends on control dependency: [if], data = [none] addBar(new BarModel(2.3f)); // depends on control dependency: [if], data = [none] addBar(new BarModel(2.f)); // depends on control dependency: [if], data = [none] addBar(new BarModel(3.3f)); // depends on control dependency: [if], data = [none] addBar(new BarModel(1.1f)); // depends on control dependency: [if], data = [none] addBar(new BarModel(2.7f)); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public ShardedRedisCounterFactory init() { if (jedisPool == null) { jedisPool = newJedisPool(redisHostsAndPorts, redisPassword); myOwnJedisPool = true; } super.init(); return this; } }
public class class_name { @Override public ShardedRedisCounterFactory init() { if (jedisPool == null) { jedisPool = newJedisPool(redisHostsAndPorts, redisPassword); // depends on control dependency: [if], data = [none] myOwnJedisPool = true; // depends on control dependency: [if], data = [none] } super.init(); return this; } }
public class class_name { public EClass getIfcDiscreteAccessory() { if (ifcDiscreteAccessoryEClass == null) { ifcDiscreteAccessoryEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI) .getEClassifiers().get(155); } return ifcDiscreteAccessoryEClass; } }
public class class_name { public EClass getIfcDiscreteAccessory() { if (ifcDiscreteAccessoryEClass == null) { ifcDiscreteAccessoryEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI) .getEClassifiers().get(155); // depends on control dependency: [if], data = [none] } return ifcDiscreteAccessoryEClass; } }
public class class_name { ReferenceEntry<K, V> getEntry(@Nullable Object key) { // does not impact recency ordering if (key == null) { return null; } int hash = hash(key); return segmentFor(hash).getEntry(key, hash); } }
public class class_name { ReferenceEntry<K, V> getEntry(@Nullable Object key) { // does not impact recency ordering if (key == null) { return null; // depends on control dependency: [if], data = [none] } int hash = hash(key); return segmentFor(hash).getEntry(key, hash); } }
public class class_name { @Command(name = "QueryWizardClassProperty", inTypeDesc = "Class name", outTypeDesc = "Class property list (name - description and default value)") public String[] queryClassProp(final String className) throws DevFailed { xlogger.entry(); final List<String> names = new ArrayList<String>(); for (final DeviceClassBuilder deviceClass : classList) { if (deviceClass.getClassName().equalsIgnoreCase(className)) { final List<DeviceImpl> devices = deviceClass.getDeviceImplList(); if (devices.size() > 0) { final DeviceImpl dev = devices.get(0); final List<ClassPropertyImpl> props = dev.getClassPropertyList(); for (final ClassPropertyImpl prop : props) { names.add(prop.getName()); names.add(prop.getDescription()); names.add("");// default value } } break; } } xlogger.exit(); return names.toArray(new String[names.size()]); } }
public class class_name { @Command(name = "QueryWizardClassProperty", inTypeDesc = "Class name", outTypeDesc = "Class property list (name - description and default value)") public String[] queryClassProp(final String className) throws DevFailed { xlogger.entry(); final List<String> names = new ArrayList<String>(); for (final DeviceClassBuilder deviceClass : classList) { if (deviceClass.getClassName().equalsIgnoreCase(className)) { final List<DeviceImpl> devices = deviceClass.getDeviceImplList(); if (devices.size() > 0) { final DeviceImpl dev = devices.get(0); final List<ClassPropertyImpl> props = dev.getClassPropertyList(); for (final ClassPropertyImpl prop : props) { names.add(prop.getName()); // depends on control dependency: [for], data = [prop] names.add(prop.getDescription()); // depends on control dependency: [for], data = [prop] names.add("");// default value // depends on control dependency: [for], data = [none] } } break; } } xlogger.exit(); return names.toArray(new String[names.size()]); } }
public class class_name { private static int[][] translate(Map<String, Integer> symbol, Map<String, Integer> suffix, String[] o) { int[][] seq = new int[o.length][2]; for (int i = 0; i < o.length; i++) { Integer index = symbol.get(o[i]); if (index != null) { seq[i][0] = index; } else { seq[i][0] = 0; } index = null; if (o[i].length() > 2) { index = suffix.get(o[i].substring(o[i].length() - 2)); } if (index != null) { seq[i][1] = index; } else { seq[i][1] = -1; } } return seq; } }
public class class_name { private static int[][] translate(Map<String, Integer> symbol, Map<String, Integer> suffix, String[] o) { int[][] seq = new int[o.length][2]; for (int i = 0; i < o.length; i++) { Integer index = symbol.get(o[i]); if (index != null) { seq[i][0] = index; // depends on control dependency: [if], data = [none] } else { seq[i][0] = 0; // depends on control dependency: [if], data = [none] } index = null; // depends on control dependency: [for], data = [none] if (o[i].length() > 2) { index = suffix.get(o[i].substring(o[i].length() - 2)); // depends on control dependency: [if], data = [(o[i].length()] } if (index != null) { seq[i][1] = index; // depends on control dependency: [if], data = [none] } else { seq[i][1] = -1; // depends on control dependency: [if], data = [none] } } return seq; } }
public class class_name { private void readCalendar(Gantt gantt) { Gantt.Calendar ganttCalendar = gantt.getCalendar(); m_projectFile.getProjectProperties().setWeekStartDay(ganttCalendar.getWeekStart()); ProjectCalendar calendar = m_projectFile.addCalendar(); calendar.setName("Standard"); m_projectFile.setDefaultCalendar(calendar); String workingDays = ganttCalendar.getWorkDays(); calendar.setWorkingDay(Day.SUNDAY, workingDays.charAt(0) == '1'); calendar.setWorkingDay(Day.MONDAY, workingDays.charAt(1) == '1'); calendar.setWorkingDay(Day.TUESDAY, workingDays.charAt(2) == '1'); calendar.setWorkingDay(Day.WEDNESDAY, workingDays.charAt(3) == '1'); calendar.setWorkingDay(Day.THURSDAY, workingDays.charAt(4) == '1'); calendar.setWorkingDay(Day.FRIDAY, workingDays.charAt(5) == '1'); calendar.setWorkingDay(Day.SATURDAY, workingDays.charAt(6) == '1'); for (int i = 1; i <= 7; i++) { Day day = Day.getInstance(i); ProjectCalendarHours hours = calendar.addCalendarHours(day); if (calendar.isWorkingDay(day)) { hours.addRange(ProjectCalendarWeek.DEFAULT_WORKING_MORNING); hours.addRange(ProjectCalendarWeek.DEFAULT_WORKING_AFTERNOON); } } for (Gantt.Holidays.Holiday holiday : gantt.getHolidays().getHoliday()) { ProjectCalendarException exception = calendar.addCalendarException(holiday.getDate(), holiday.getDate()); exception.setName(holiday.getContent()); } } }
public class class_name { private void readCalendar(Gantt gantt) { Gantt.Calendar ganttCalendar = gantt.getCalendar(); m_projectFile.getProjectProperties().setWeekStartDay(ganttCalendar.getWeekStart()); ProjectCalendar calendar = m_projectFile.addCalendar(); calendar.setName("Standard"); m_projectFile.setDefaultCalendar(calendar); String workingDays = ganttCalendar.getWorkDays(); calendar.setWorkingDay(Day.SUNDAY, workingDays.charAt(0) == '1'); calendar.setWorkingDay(Day.MONDAY, workingDays.charAt(1) == '1'); calendar.setWorkingDay(Day.TUESDAY, workingDays.charAt(2) == '1'); calendar.setWorkingDay(Day.WEDNESDAY, workingDays.charAt(3) == '1'); calendar.setWorkingDay(Day.THURSDAY, workingDays.charAt(4) == '1'); calendar.setWorkingDay(Day.FRIDAY, workingDays.charAt(5) == '1'); calendar.setWorkingDay(Day.SATURDAY, workingDays.charAt(6) == '1'); for (int i = 1; i <= 7; i++) { Day day = Day.getInstance(i); ProjectCalendarHours hours = calendar.addCalendarHours(day); if (calendar.isWorkingDay(day)) { hours.addRange(ProjectCalendarWeek.DEFAULT_WORKING_MORNING); // depends on control dependency: [if], data = [none] hours.addRange(ProjectCalendarWeek.DEFAULT_WORKING_AFTERNOON); // depends on control dependency: [if], data = [none] } } for (Gantt.Holidays.Holiday holiday : gantt.getHolidays().getHoliday()) { ProjectCalendarException exception = calendar.addCalendarException(holiday.getDate(), holiday.getDate()); exception.setName(holiday.getContent()); // depends on control dependency: [for], data = [holiday] } } }
public class class_name { public EClass getBandImage() { if (bandImageEClass == null) { bandImageEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(391); } return bandImageEClass; } }
public class class_name { public EClass getBandImage() { if (bandImageEClass == null) { bandImageEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(391); // depends on control dependency: [if], data = [none] } return bandImageEClass; } }
public class class_name { public static void startup(final String _bootstrapPath, final String _bootstrapFile) throws StartupException { // evaluate bootstrap path final File bsPath; if (_bootstrapPath != null) { bsPath = new File(_bootstrapPath); } else { final String envPath = System.getenv(StartupDatabaseConnection.ENV_PATH); if (envPath != null) { bsPath = new File(envPath); } else { bsPath = new File(System.getProperty("user.home"), StartupDatabaseConnection.DEFAULT_BOOTSTRAP_PATH); } } // evaluate bootstrap file final String bsFile; File bootstrap = null; if (_bootstrapFile != null) { bsFile = _bootstrapFile; } else { final String envFile = System.getenv(StartupDatabaseConnection.ENV_FILE); if (envFile != null) { bsFile = envFile; } else { bsFile = StartupDatabaseConnection.DEFAULT_BOOTSTRAP_FILE; } } bootstrap = new File(bsFile); if (bootstrap == null || !bootstrap.exists()) { bootstrap = new File(bsPath, bsFile); } // read bootstrap file final Properties props = new Properties(); try { props.loadFromXML(new FileInputStream(bootstrap)); } catch (final FileNotFoundException e) { throw new StartupException("bootstrap file " + bootstrap + " not found", e); } catch (final IOException e) { throw new StartupException("bootstrap file " + bootstrap + " could not be read", e); } // and startup final Map<String, String> eFapsProps; if (props.containsKey(StartupDatabaseConnection.PROP_CONFIGPROP)) { eFapsProps = StartupDatabaseConnection.convertToMap(props .getProperty(StartupDatabaseConnection.PROP_CONFIGPROP)); } else { eFapsProps = new HashMap<>(); } StartupDatabaseConnection.startup(props.getProperty(StartupDatabaseConnection.PROP_DBTYPE_CLASS), props.getProperty(StartupDatabaseConnection.PROP_DBFACTORY_CLASS), props.getProperty(StartupDatabaseConnection.PROP_DBCONNECTION), props.getProperty(StartupDatabaseConnection.PROP_TM_CLASS), null, eFapsProps); } }
public class class_name { public static void startup(final String _bootstrapPath, final String _bootstrapFile) throws StartupException { // evaluate bootstrap path final File bsPath; if (_bootstrapPath != null) { bsPath = new File(_bootstrapPath); } else { final String envPath = System.getenv(StartupDatabaseConnection.ENV_PATH); if (envPath != null) { bsPath = new File(envPath); // depends on control dependency: [if], data = [(envPath] } else { bsPath = new File(System.getProperty("user.home"), StartupDatabaseConnection.DEFAULT_BOOTSTRAP_PATH); // depends on control dependency: [if], data = [none] } } // evaluate bootstrap file final String bsFile; File bootstrap = null; if (_bootstrapFile != null) { bsFile = _bootstrapFile; } else { final String envFile = System.getenv(StartupDatabaseConnection.ENV_FILE); if (envFile != null) { bsFile = envFile; } else { bsFile = StartupDatabaseConnection.DEFAULT_BOOTSTRAP_FILE; } } bootstrap = new File(bsFile); if (bootstrap == null || !bootstrap.exists()) { bootstrap = new File(bsPath, bsFile); } // read bootstrap file final Properties props = new Properties(); try { props.loadFromXML(new FileInputStream(bootstrap)); } catch (final FileNotFoundException e) { throw new StartupException("bootstrap file " + bootstrap + " not found", e); } catch (final IOException e) { throw new StartupException("bootstrap file " + bootstrap + " could not be read", e); } // and startup final Map<String, String> eFapsProps; if (props.containsKey(StartupDatabaseConnection.PROP_CONFIGPROP)) { eFapsProps = StartupDatabaseConnection.convertToMap(props .getProperty(StartupDatabaseConnection.PROP_CONFIGPROP)); } else { eFapsProps = new HashMap<>(); } StartupDatabaseConnection.startup(props.getProperty(StartupDatabaseConnection.PROP_DBTYPE_CLASS), props.getProperty(StartupDatabaseConnection.PROP_DBFACTORY_CLASS), props.getProperty(StartupDatabaseConnection.PROP_DBCONNECTION), props.getProperty(StartupDatabaseConnection.PROP_TM_CLASS), null, eFapsProps); } }
public class class_name { private boolean isTopLevel(PositionalContext context) { Term term = context.getTerm(); if (term.getSymbolKey() == null) { return false; } Boolean isTopLevel = (Boolean) symbolTable.get(term.getSymbolKey(), SymbolTableKeys.SYMKEY_TOP_LEVEL_FUNCTOR); return (isTopLevel == null) ? false : isTopLevel; } }
public class class_name { private boolean isTopLevel(PositionalContext context) { Term term = context.getTerm(); if (term.getSymbolKey() == null) { return false; // depends on control dependency: [if], data = [none] } Boolean isTopLevel = (Boolean) symbolTable.get(term.getSymbolKey(), SymbolTableKeys.SYMKEY_TOP_LEVEL_FUNCTOR); return (isTopLevel == null) ? false : isTopLevel; } }
public class class_name { public UfsManager.UfsClient getUfsClient(long mountId) { try { return mUfsManager.get(mountId); } catch (NotFoundException | UnavailableException e) { LOG.warn("failed to get ufsclient for mountid {}, exception {}", mountId, e); } return null; } }
public class class_name { public UfsManager.UfsClient getUfsClient(long mountId) { try { return mUfsManager.get(mountId); // depends on control dependency: [try], data = [none] } catch (NotFoundException | UnavailableException e) { LOG.warn("failed to get ufsclient for mountid {}, exception {}", mountId, e); } // depends on control dependency: [catch], data = [none] return null; } }
public class class_name { public void marshall(PendingLogs pendingLogs, ProtocolMarshaller protocolMarshaller) { if (pendingLogs == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(pendingLogs.getAudit(), AUDIT_BINDING); protocolMarshaller.marshall(pendingLogs.getGeneral(), GENERAL_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(PendingLogs pendingLogs, ProtocolMarshaller protocolMarshaller) { if (pendingLogs == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(pendingLogs.getAudit(), AUDIT_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(pendingLogs.getGeneral(), GENERAL_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static String toInlineImage(@javax.annotation.Nonnull final LabeledObject<BufferedImage> img) { @javax.annotation.Nonnull final ByteArrayOutputStream b = new ByteArrayOutputStream(); try { ImageIO.write(img.data, "PNG", b); } catch (@javax.annotation.Nonnull final RuntimeException e) { throw e; } catch (@javax.annotation.Nonnull final Exception e) { throw new RuntimeException(e); } final byte[] byteArray = b.toByteArray(); final String encode = Base64.getEncoder().encodeToString(byteArray); return "<img src=\"data:image/png;base64," + encode + "\" alt=\"" + img.label + "\" />"; } }
public class class_name { public static String toInlineImage(@javax.annotation.Nonnull final LabeledObject<BufferedImage> img) { @javax.annotation.Nonnull final ByteArrayOutputStream b = new ByteArrayOutputStream(); try { ImageIO.write(img.data, "PNG", b); // depends on control dependency: [try], data = [none] } catch (@javax.annotation.Nonnull final RuntimeException e) { throw e; } catch (@javax.annotation.Nonnull final Exception e) { // depends on control dependency: [catch], data = [none] throw new RuntimeException(e); } // depends on control dependency: [catch], data = [none] final byte[] byteArray = b.toByteArray(); final String encode = Base64.getEncoder().encodeToString(byteArray); return "<img src=\"data:image/png;base64," + encode + "\" alt=\"" + img.label + "\" />"; } }
public class class_name { @Override public ServiceRegistration<?> registerService(String clazz, Object service, Dictionary<String, ?> properties) { MockServiceReference<Object> serviceReference = new MockServiceReference<Object>(getBundle(), properties); if (serviceRegistrations.get(clazz) == null) { serviceRegistrations.put(clazz, new ArrayList<ServiceReference<?>>()); } serviceRegistrations.get(clazz).add(serviceReference); serviceImplementations.put(serviceReference, service); notifyListenersAboutNewService(clazz, serviceReference); return new MockServiceRegistration<Object>(this, serviceReference); } }
public class class_name { @Override public ServiceRegistration<?> registerService(String clazz, Object service, Dictionary<String, ?> properties) { MockServiceReference<Object> serviceReference = new MockServiceReference<Object>(getBundle(), properties); if (serviceRegistrations.get(clazz) == null) { serviceRegistrations.put(clazz, new ArrayList<ServiceReference<?>>()); } // depends on control dependency: [if], data = [none] serviceRegistrations.get(clazz).add(serviceReference); serviceImplementations.put(serviceReference, service); notifyListenersAboutNewService(clazz, serviceReference); return new MockServiceRegistration<Object>(this, serviceReference); } }
public class class_name { public void optimizeCriteria( List<QueryCriteria> criteriaList ) { // we don't expect subqueries with task variable criteria Set<QueryCriteria> optimizedCriteria = Collections.newSetFromMap(new IdentityHashMap<QueryCriteria, Boolean>(1)); boolean endOfListNotYetReached = true; while( endOfListNotYetReached ) { Set<QueryCriteria> taskVarCriteria = Collections.newSetFromMap(new IdentityHashMap<QueryCriteria, Boolean>(2)); boolean endOfListReached = true; for( QueryCriteria criteria : criteriaList ) { if( ! criteria.isFirst() && criteria.isUnion() ) { if( taskVarCriteria.size() > 1 ) { endOfListReached = false; break; } taskVarCriteria.clear(); } // if group, recurse if( criteria.isGroupCriteria() ) { if( optimizedCriteria.add(criteria) ) { optimizeCriteria(criteria.getCriteria()); } continue; } String listId = criteria.getListId(); if( listId.equals(TASK_VARIABLE_NAME_ID_LIST) || listId.equals(TASK_VARIABLE_VALUE_ID_LIST) ) { taskVarCriteria.add(criteria); } } if( endOfListReached ) { endOfListNotYetReached = false; } if( taskVarCriteria.size() > 1 ) { Iterator<QueryCriteria> criteriaIter = criteriaList.iterator(); QueryCriteria combinedTaskVarCriteria = null; while( criteriaIter.hasNext() ) { QueryCriteria criteria = criteriaIter.next(); if( taskVarCriteria.contains(criteria) ) { if( combinedTaskVarCriteria == null ) { combinedTaskVarCriteria = criteria; criteria = new QueryCriteria(criteria); // combined criteria replaces the original, and thus: // 1. KEEPS the original union flag! // 2. KEEPS the original first flag! combinedTaskVarCriteria.setListId(TASK_VARIABLE_COMBINED_ID); combinedTaskVarCriteria.setType(QueryCriteriaType.NORMAL); combinedTaskVarCriteria.getValues().clear(); combinedTaskVarCriteria.getDateValues().clear(); // processed as a normal, even though it's group combinedTaskVarCriteria.addCriteria(criteria); } else { combinedTaskVarCriteria.addCriteria(criteria); criteriaIter.remove(); } } if( combinedTaskVarCriteria != null && criteria.isUnion() ) { break; } } } } } }
public class class_name { public void optimizeCriteria( List<QueryCriteria> criteriaList ) { // we don't expect subqueries with task variable criteria Set<QueryCriteria> optimizedCriteria = Collections.newSetFromMap(new IdentityHashMap<QueryCriteria, Boolean>(1)); boolean endOfListNotYetReached = true; while( endOfListNotYetReached ) { Set<QueryCriteria> taskVarCriteria = Collections.newSetFromMap(new IdentityHashMap<QueryCriteria, Boolean>(2)); boolean endOfListReached = true; for( QueryCriteria criteria : criteriaList ) { if( ! criteria.isFirst() && criteria.isUnion() ) { if( taskVarCriteria.size() > 1 ) { endOfListReached = false; // depends on control dependency: [if], data = [none] break; } taskVarCriteria.clear(); // depends on control dependency: [if], data = [none] } // if group, recurse if( criteria.isGroupCriteria() ) { if( optimizedCriteria.add(criteria) ) { optimizeCriteria(criteria.getCriteria()); // depends on control dependency: [if], data = [none] } continue; } String listId = criteria.getListId(); if( listId.equals(TASK_VARIABLE_NAME_ID_LIST) || listId.equals(TASK_VARIABLE_VALUE_ID_LIST) ) { taskVarCriteria.add(criteria); // depends on control dependency: [if], data = [none] } } if( endOfListReached ) { endOfListNotYetReached = false; // depends on control dependency: [if], data = [none] } if( taskVarCriteria.size() > 1 ) { Iterator<QueryCriteria> criteriaIter = criteriaList.iterator(); QueryCriteria combinedTaskVarCriteria = null; while( criteriaIter.hasNext() ) { QueryCriteria criteria = criteriaIter.next(); if( taskVarCriteria.contains(criteria) ) { if( combinedTaskVarCriteria == null ) { combinedTaskVarCriteria = criteria; // depends on control dependency: [if], data = [none] criteria = new QueryCriteria(criteria); // depends on control dependency: [if], data = [none] // combined criteria replaces the original, and thus: // 1. KEEPS the original union flag! // 2. KEEPS the original first flag! combinedTaskVarCriteria.setListId(TASK_VARIABLE_COMBINED_ID); // depends on control dependency: [if], data = [none] combinedTaskVarCriteria.setType(QueryCriteriaType.NORMAL); // depends on control dependency: [if], data = [none] combinedTaskVarCriteria.getValues().clear(); // depends on control dependency: [if], data = [none] combinedTaskVarCriteria.getDateValues().clear(); // depends on control dependency: [if], data = [none] // processed as a normal, even though it's group combinedTaskVarCriteria.addCriteria(criteria); // depends on control dependency: [if], data = [none] } else { combinedTaskVarCriteria.addCriteria(criteria); // depends on control dependency: [if], data = [none] criteriaIter.remove(); // depends on control dependency: [if], data = [none] } } if( combinedTaskVarCriteria != null && criteria.isUnion() ) { break; } } } } } }
public class class_name { protected int[] parseTime(CharSequenceScanner scanner) { int hour = read2Digits(scanner); boolean colon = scanner.expect(':'); int minute = read2Digits(scanner); int second = 0; if (minute == -1) { if (!colon) { minute = 0; } } else { colon = scanner.expect(':'); second = read2Digits(scanner); if ((second == -1) && (!colon)) { second = 0; } if (((hour < 0) || (hour > 23)) || ((minute < 0) || (minute > 59)) || ((second < 0) || (second > 59))) { throw new IllegalDateFormatException(scanner.getOriginalString()); } } return new int[] { hour, minute, second }; } }
public class class_name { protected int[] parseTime(CharSequenceScanner scanner) { int hour = read2Digits(scanner); boolean colon = scanner.expect(':'); int minute = read2Digits(scanner); int second = 0; if (minute == -1) { if (!colon) { minute = 0; // depends on control dependency: [if], data = [none] } } else { colon = scanner.expect(':'); // depends on control dependency: [if], data = [none] second = read2Digits(scanner); // depends on control dependency: [if], data = [none] if ((second == -1) && (!colon)) { second = 0; // depends on control dependency: [if], data = [none] } if (((hour < 0) || (hour > 23)) || ((minute < 0) || (minute > 59)) || ((second < 0) || (second > 59))) { throw new IllegalDateFormatException(scanner.getOriginalString()); } } return new int[] { hour, minute, second }; } }
public class class_name { public synchronized void addListener(Object l) { if (!listeners.contains(l)) { listeners.add(l); hasListeners = true; } else logger.warn("ListenerManager.addListener already has Listener " + l); } }
public class class_name { public synchronized void addListener(Object l) { if (!listeners.contains(l)) { listeners.add(l); // depends on control dependency: [if], data = [none] hasListeners = true; // depends on control dependency: [if], data = [none] } else logger.warn("ListenerManager.addListener already has Listener " + l); } }
public class class_name { public static boolean isNull(byte[] key, int length) { if (key == null) { return true; } for (int i = 0; i < Math.min(key.length, length); i++) { if (key[i] != 0) { return false; } } return true; } }
public class class_name { public static boolean isNull(byte[] key, int length) { if (key == null) { return true; // depends on control dependency: [if], data = [none] } for (int i = 0; i < Math.min(key.length, length); i++) { if (key[i] != 0) { return false; // depends on control dependency: [if], data = [none] } } return true; } }
public class class_name { public static IShape createTransformedShape (Transform t, IShape src) { if (src == null) { return null; } if (src instanceof Path) { return ((Path)src).createTransformedShape(t); } PathIterator path = src.pathIterator(t); Path dst = new Path(path.windingRule()); dst.append(path, false); return dst; } }
public class class_name { public static IShape createTransformedShape (Transform t, IShape src) { if (src == null) { return null; // depends on control dependency: [if], data = [none] } if (src instanceof Path) { return ((Path)src).createTransformedShape(t); // depends on control dependency: [if], data = [none] } PathIterator path = src.pathIterator(t); Path dst = new Path(path.windingRule()); dst.append(path, false); return dst; } }
public class class_name { private IntegerVector getSemanticVector(String word) { IntegerVector v = wordToMeaning.get(word); if (v == null) { // lock on the word in case multiple threads attempt to add it at // once synchronized(this) { // recheck in case another thread added it while we were waiting // for the lock v = wordToMeaning.get(word); if (v == null) { v = (useSparseSemantics) ? new CompactSparseIntegerVector(vectorLength) : new DenseIntVector(vectorLength); wordToMeaning.put(word, v); } } } return v; } }
public class class_name { private IntegerVector getSemanticVector(String word) { IntegerVector v = wordToMeaning.get(word); if (v == null) { // lock on the word in case multiple threads attempt to add it at // once synchronized(this) { // depends on control dependency: [if], data = [none] // recheck in case another thread added it while we were waiting // for the lock v = wordToMeaning.get(word); if (v == null) { v = (useSparseSemantics) ? new CompactSparseIntegerVector(vectorLength) : new DenseIntVector(vectorLength); // depends on control dependency: [if], data = [none] wordToMeaning.put(word, v); // depends on control dependency: [if], data = [none] } } } return v; } }