code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { private void removeTransactionSession(String xferId, String sessionId) { List<String> sessions = transactionSessions.get(xferId); if(sessions != null){ final boolean removal = sessions.remove(sessionId); if (removal) { ascpCount--; } } } }
public class class_name { private void removeTransactionSession(String xferId, String sessionId) { List<String> sessions = transactionSessions.get(xferId); if(sessions != null){ final boolean removal = sessions.remove(sessionId); if (removal) { ascpCount--; // depends on control dependency: [if], data = [none] } } } }
public class class_name { private void printNewLine(PrintWriter writer, LineSeparator lineSeparator) { if(null == lineSeparator) { //默认换行符 writer.println(); }else { //自定义换行符 writer.print(lineSeparator.getValue()); } } }
public class class_name { private void printNewLine(PrintWriter writer, LineSeparator lineSeparator) { if(null == lineSeparator) { //默认换行符 writer.println(); // depends on control dependency: [if], data = [none] }else { //自定义换行符 writer.print(lineSeparator.getValue()); // depends on control dependency: [if], data = [none] } } }
public class class_name { protected double calcDistTSAndPattern(double[] ts, double[] pValue) { double INF = 10000000000000000000f; double bestDist = INF; int patternLen = pValue.length; int lastStartP = ts.length - pValue.length + 1; if (lastStartP < 1) return bestDist; Random rand = new Random(); int startP = rand.nextInt((lastStartP - 1 - 0) + 1); double[] slidingWindow = new double[patternLen]; System.arraycopy(ts, startP, slidingWindow, 0, patternLen); bestDist = eculideanDistNorm(pValue, slidingWindow); for (int i = 0; i < lastStartP; i++) { System.arraycopy(ts, i, slidingWindow, 0, patternLen); double tempDist = eculideanDistNormEAbandon(pValue, slidingWindow, bestDist); if (tempDist < bestDist) { bestDist = tempDist; } } return bestDist; } }
public class class_name { protected double calcDistTSAndPattern(double[] ts, double[] pValue) { double INF = 10000000000000000000f; double bestDist = INF; int patternLen = pValue.length; int lastStartP = ts.length - pValue.length + 1; if (lastStartP < 1) return bestDist; Random rand = new Random(); int startP = rand.nextInt((lastStartP - 1 - 0) + 1); double[] slidingWindow = new double[patternLen]; System.arraycopy(ts, startP, slidingWindow, 0, patternLen); bestDist = eculideanDistNorm(pValue, slidingWindow); for (int i = 0; i < lastStartP; i++) { System.arraycopy(ts, i, slidingWindow, 0, patternLen); // depends on control dependency: [for], data = [i] double tempDist = eculideanDistNormEAbandon(pValue, slidingWindow, bestDist); if (tempDist < bestDist) { bestDist = tempDist; // depends on control dependency: [if], data = [none] } } return bestDist; } }
public class class_name { public static ChannelFramework getFramework() { final CHFWBundle chfw = getCHFWBundle(); if (null == chfw) { return ChannelFrameworkFactory.getChannelFramework(); } return chfw.getFramework(); } }
public class class_name { public static ChannelFramework getFramework() { final CHFWBundle chfw = getCHFWBundle(); if (null == chfw) { return ChannelFrameworkFactory.getChannelFramework(); // depends on control dependency: [if], data = [none] } return chfw.getFramework(); } }
public class class_name { public static int enc_lag3( /* output: Return index of encoding */ int T0, /* input : Pitch delay */ int T0_frac, /* input : Fractional pitch delay */ IntegerPointer T0_min, /* in/out: Minimum search delay */ IntegerPointer T0_max, /* in/out: Maximum search delay */ int pit_min, /* input : Minimum pitch delay */ int pit_max, /* input : Maximum pitch delay */ int pit_flag /* input : Flag for 1st subframe */ ) { int index; if (pit_flag == 0) /* if 1st subframe */ { /* encode pitch delay (with fraction) */ if (T0 <= 85) index = T0*3 - 58 + T0_frac; else index = T0 + 112; /* find T0_min and T0_max for second subframe */ T0_min.value = T0 - 5; if (T0_min.value < pit_min) T0_min.value = pit_min; T0_max.value = T0_min.value + 9; if (T0_max.value > pit_max) { T0_max.value = pit_max; T0_min.value = T0_max.value - 9; } } else /* second subframe */ { index = T0 - T0_min.value; index = index*3 + 2 + T0_frac; } return index; } }
public class class_name { public static int enc_lag3( /* output: Return index of encoding */ int T0, /* input : Pitch delay */ int T0_frac, /* input : Fractional pitch delay */ IntegerPointer T0_min, /* in/out: Minimum search delay */ IntegerPointer T0_max, /* in/out: Maximum search delay */ int pit_min, /* input : Minimum pitch delay */ int pit_max, /* input : Maximum pitch delay */ int pit_flag /* input : Flag for 1st subframe */ ) { int index; if (pit_flag == 0) /* if 1st subframe */ { /* encode pitch delay (with fraction) */ if (T0 <= 85) index = T0*3 - 58 + T0_frac; else index = T0 + 112; /* find T0_min and T0_max for second subframe */ T0_min.value = T0 - 5; // depends on control dependency: [if], data = [none] if (T0_min.value < pit_min) T0_min.value = pit_min; T0_max.value = T0_min.value + 9; // depends on control dependency: [if], data = [none] if (T0_max.value > pit_max) { T0_max.value = pit_max; // depends on control dependency: [if], data = [none] T0_min.value = T0_max.value - 9; // depends on control dependency: [if], data = [none] } } else /* second subframe */ { index = T0 - T0_min.value; // depends on control dependency: [if], data = [none] index = index*3 + 2 + T0_frac; // depends on control dependency: [if], data = [none] } return index; } }
public class class_name { public boolean validateTLSA(URL url) throws ValidSelfSignedCertException { TLSARecord tlsaRecord = getTLSARecord(url); if(tlsaRecord == null) { return false; } List<Certificate> certs = getUrlCerts(url); if(certs == null || certs.size() == 0) { return false; } // Get Cert Matching Selector and Matching Type Fields Certificate matchingCert = getMatchingCert(tlsaRecord, certs); if (matchingCert == null) { return false; } // Check for single cert / self-signed and validate switch(tlsaRecord.getCertificateUsage()) { case TLSARecord.CertificateUsage.CA_CONSTRAINT: if(isValidCertChain(matchingCert, certs) && matchingCert != certs.get(0)) { return true; } break; case TLSARecord.CertificateUsage.SERVICE_CERTIFICATE_CONSTRAINT: if(isValidCertChain(matchingCert, certs) && matchingCert == certs.get(0)) { return true; } break; case TLSARecord.CertificateUsage.TRUST_ANCHOR_ASSERTION: if(isValidCertChain(certs.get(0), certs) && matchingCert == certs.get(certs.size() - 1)) { throw new ValidSelfSignedCertException(matchingCert); } break; case TLSARecord.CertificateUsage.DOMAIN_ISSUED_CERTIFICATE: // We've found a matching cert that does not require PKIX Chain Validation [RFC6698] throw new ValidSelfSignedCertException(matchingCert); } return false; } }
public class class_name { public boolean validateTLSA(URL url) throws ValidSelfSignedCertException { TLSARecord tlsaRecord = getTLSARecord(url); if(tlsaRecord == null) { return false; } List<Certificate> certs = getUrlCerts(url); if(certs == null || certs.size() == 0) { return false; } // Get Cert Matching Selector and Matching Type Fields Certificate matchingCert = getMatchingCert(tlsaRecord, certs); if (matchingCert == null) { return false; } // Check for single cert / self-signed and validate switch(tlsaRecord.getCertificateUsage()) { case TLSARecord.CertificateUsage.CA_CONSTRAINT: if(isValidCertChain(matchingCert, certs) && matchingCert != certs.get(0)) { return true; // depends on control dependency: [if], data = [none] } break; case TLSARecord.CertificateUsage.SERVICE_CERTIFICATE_CONSTRAINT: if(isValidCertChain(matchingCert, certs) && matchingCert == certs.get(0)) { return true; } break; case TLSARecord.CertificateUsage.TRUST_ANCHOR_ASSERTION: if(isValidCertChain(certs.get(0), certs) && matchingCert == certs.get(certs.size() - 1)) { throw new ValidSelfSignedCertException(matchingCert); } break; case TLSARecord.CertificateUsage.DOMAIN_ISSUED_CERTIFICATE: // We've found a matching cert that does not require PKIX Chain Validation [RFC6698] throw new ValidSelfSignedCertException(matchingCert); } return false; } }
public class class_name { public BidiWrappingText unicodeWrappingText(@Nullable Dir dir, String str, boolean isHtml) { if (dir == null) { dir = estimateDirection(str, isHtml); } StringBuilder beforeText = new StringBuilder(); StringBuilder afterText = new StringBuilder(); if (dir != Dir.NEUTRAL && dir != contextDir) { beforeText.append(dir == Dir.RTL ? BidiUtils.Format.RLE : BidiUtils.Format.LRE); afterText.append(BidiUtils.Format.PDF); } afterText.append(markAfter(dir, str, isHtml)); return BidiWrappingText.create(beforeText.toString(), afterText.toString()); } }
public class class_name { public BidiWrappingText unicodeWrappingText(@Nullable Dir dir, String str, boolean isHtml) { if (dir == null) { dir = estimateDirection(str, isHtml); // depends on control dependency: [if], data = [none] } StringBuilder beforeText = new StringBuilder(); StringBuilder afterText = new StringBuilder(); if (dir != Dir.NEUTRAL && dir != contextDir) { beforeText.append(dir == Dir.RTL ? BidiUtils.Format.RLE : BidiUtils.Format.LRE); // depends on control dependency: [if], data = [(dir] afterText.append(BidiUtils.Format.PDF); // depends on control dependency: [if], data = [none] } afterText.append(markAfter(dir, str, isHtml)); return BidiWrappingText.create(beforeText.toString(), afterText.toString()); } }
public class class_name { @Pure public DoubleProperty depthProperty() { if (this.depth == null) { this.depth = new ReadOnlyDoubleWrapper(this, MathFXAttributeNames.DEPTH); this.depth.bind(Bindings.subtract(maxZProperty(), minZProperty())); } return this.depth; } }
public class class_name { @Pure public DoubleProperty depthProperty() { if (this.depth == null) { this.depth = new ReadOnlyDoubleWrapper(this, MathFXAttributeNames.DEPTH); // depends on control dependency: [if], data = [none] this.depth.bind(Bindings.subtract(maxZProperty(), minZProperty())); // depends on control dependency: [if], data = [none] } return this.depth; } }
public class class_name { static private void populateCache() { if (cacheIsPopulated) { return; } cacheIsPopulated = true; /* Schema: * * units{ * duration{ * day{ * one{"{0} ден"} * other{"{0} дена"} * } */ // Load the unit types. Use English, since we know that that is a superset. ICUResourceBundle rb1 = (ICUResourceBundle) UResourceBundle.getBundleInstance( ICUData.ICU_UNIT_BASE_NAME, "en"); rb1.getAllItemsWithFallback("units", new MeasureUnitSink()); // Load the currencies ICUResourceBundle rb2 = (ICUResourceBundle) UResourceBundle.getBundleInstance( ICUData.ICU_BASE_NAME, "currencyNumericCodes", ICUResourceBundle.ICU_DATA_CLASS_LOADER); rb2.getAllItemsWithFallback("codeMap", new CurrencyNumericCodeSink()); } }
public class class_name { static private void populateCache() { if (cacheIsPopulated) { return; // depends on control dependency: [if], data = [none] } cacheIsPopulated = true; /* Schema: * * units{ * duration{ * day{ * one{"{0} ден"} * other{"{0} дена"} * } */ // Load the unit types. Use English, since we know that that is a superset. ICUResourceBundle rb1 = (ICUResourceBundle) UResourceBundle.getBundleInstance( ICUData.ICU_UNIT_BASE_NAME, "en"); rb1.getAllItemsWithFallback("units", new MeasureUnitSink()); // Load the currencies ICUResourceBundle rb2 = (ICUResourceBundle) UResourceBundle.getBundleInstance( ICUData.ICU_BASE_NAME, "currencyNumericCodes", ICUResourceBundle.ICU_DATA_CLASS_LOADER); rb2.getAllItemsWithFallback("codeMap", new CurrencyNumericCodeSink()); } }
public class class_name { public static boolean isAnyEmpty(final CharSequence... css) { if (ArrayUtils.isEmpty(css)) { return false; } for (final CharSequence cs : css){ if (isEmpty(cs)) { return true; } } return false; } }
public class class_name { public static boolean isAnyEmpty(final CharSequence... css) { if (ArrayUtils.isEmpty(css)) { return false; // depends on control dependency: [if], data = [none] } for (final CharSequence cs : css){ if (isEmpty(cs)) { return true; // depends on control dependency: [if], data = [none] } } return false; } }
public class class_name { public static Atom[] findLinkage(final Group group1, final Group group2, String nameOfAtomOnGroup1, String nameOfAtomOnGroup2, double bondLengthTolerance) { Atom[] ret = new Atom[2]; ret[0] = group1.getAtom(nameOfAtomOnGroup1); ret[1] = group2.getAtom(nameOfAtomOnGroup2); if (ret[0]==null || ret[1]==null) { return null; } Atom a1 = ret[0]; Atom a2 = ret[1]; boolean hasBond = a1.hasBond(a2); if ( hasBond ) { return ret; } // is it a metal ? if ( a1.getElement().isMetal() || a2.getElement().isMetal()){ MetalBondDistance defined = getMetalDistanceCutoff(a1.getElement().name(),a2.getElement().name()); if ( defined != null) { if (hasMetalBond(a1, a2, defined)) return ret; else return null; } } // not a metal double distance = Calc.getDistance(a1, a2); float radiusOfAtom1 = ret[0].getElement().getCovalentRadius(); float radiusOfAtom2 = ret[1].getElement().getCovalentRadius(); if (Math.abs(distance - radiusOfAtom1 - radiusOfAtom2) > bondLengthTolerance) { return null; } return ret; } }
public class class_name { public static Atom[] findLinkage(final Group group1, final Group group2, String nameOfAtomOnGroup1, String nameOfAtomOnGroup2, double bondLengthTolerance) { Atom[] ret = new Atom[2]; ret[0] = group1.getAtom(nameOfAtomOnGroup1); ret[1] = group2.getAtom(nameOfAtomOnGroup2); if (ret[0]==null || ret[1]==null) { return null; // depends on control dependency: [if], data = [none] } Atom a1 = ret[0]; Atom a2 = ret[1]; boolean hasBond = a1.hasBond(a2); if ( hasBond ) { return ret; // depends on control dependency: [if], data = [none] } // is it a metal ? if ( a1.getElement().isMetal() || a2.getElement().isMetal()){ MetalBondDistance defined = getMetalDistanceCutoff(a1.getElement().name(),a2.getElement().name()); if ( defined != null) { if (hasMetalBond(a1, a2, defined)) return ret; else return null; } } // not a metal double distance = Calc.getDistance(a1, a2); float radiusOfAtom1 = ret[0].getElement().getCovalentRadius(); float radiusOfAtom2 = ret[1].getElement().getCovalentRadius(); if (Math.abs(distance - radiusOfAtom1 - radiusOfAtom2) > bondLengthTolerance) { return null; // depends on control dependency: [if], data = [none] } return ret; } }
public class class_name { private static String hexFormat(int trgt) { String s = Integer.toHexString(trgt); int sz = s.length(); if (sz == 8) { return s; } int fill = 8 - sz; StringBuilder buf = new StringBuilder(); for (int i = 0; i < fill; ++i) { // add leading zeros buf.append('0'); } buf.append(s); return buf.toString(); } }
public class class_name { private static String hexFormat(int trgt) { String s = Integer.toHexString(trgt); int sz = s.length(); if (sz == 8) { return s; // depends on control dependency: [if], data = [none] } int fill = 8 - sz; StringBuilder buf = new StringBuilder(); for (int i = 0; i < fill; ++i) { // add leading zeros buf.append('0'); // depends on control dependency: [for], data = [none] } buf.append(s); return buf.toString(); } }
public class class_name { @Override public void setProfileImportExportCache( Cache<Tuple<String, String>, UserProfile> profileCache) { if (profileCache == null) { profileCacheHolder.remove(); } else { profileCacheHolder.set(profileCache); } } }
public class class_name { @Override public void setProfileImportExportCache( Cache<Tuple<String, String>, UserProfile> profileCache) { if (profileCache == null) { profileCacheHolder.remove(); // depends on control dependency: [if], data = [none] } else { profileCacheHolder.set(profileCache); // depends on control dependency: [if], data = [(profileCache] } } }
public class class_name { private final boolean matchPattern(byte[][] patterns, int bufferIndex) { boolean match = false; for (byte[] pattern : patterns) { int index = 0; match = true; for (byte b : pattern) { if (b != m_buffer[bufferIndex + index]) { match = false; break; } ++index; } if (match) { break; } } return match; } }
public class class_name { private final boolean matchPattern(byte[][] patterns, int bufferIndex) { boolean match = false; for (byte[] pattern : patterns) { int index = 0; match = true; // depends on control dependency: [for], data = [none] for (byte b : pattern) { if (b != m_buffer[bufferIndex + index]) { match = false; // depends on control dependency: [if], data = [none] break; } ++index; // depends on control dependency: [for], data = [none] } if (match) { break; } } return match; } }
public class class_name { @Override public void stop() { synchronized (this.lifecycleMonitor) { if (isRunning()) { log.info("stop: Stopping ConnectorManager"); try { connector.stop(); } finally { running = false; } } } } }
public class class_name { @Override public void stop() { synchronized (this.lifecycleMonitor) { if (isRunning()) { log.info("stop: Stopping ConnectorManager"); // depends on control dependency: [if], data = [none] try { connector.stop(); // depends on control dependency: [try], data = [none] } finally { running = false; } } } } }
public class class_name { public static void wipePSinplace(ByteBuffer _in, Collection<ByteBuffer> spsList, Collection<ByteBuffer> ppsList) { ByteBuffer dup = _in.duplicate(); while (dup.hasRemaining()) { ByteBuffer buf = H264Utils.nextNALUnit(dup); if (buf == null) break; NALUnit nu = NALUnit.read(buf); if (nu.type == NALUnitType.PPS) { if (ppsList != null) ppsList.add(NIOUtils.duplicate(buf)); _in.position(dup.position()); } else if (nu.type == NALUnitType.SPS) { if (spsList != null) spsList.add(NIOUtils.duplicate(buf)); _in.position(dup.position()); } else if (nu.type == NALUnitType.IDR_SLICE || nu.type == NALUnitType.NON_IDR_SLICE) break; } } }
public class class_name { public static void wipePSinplace(ByteBuffer _in, Collection<ByteBuffer> spsList, Collection<ByteBuffer> ppsList) { ByteBuffer dup = _in.duplicate(); while (dup.hasRemaining()) { ByteBuffer buf = H264Utils.nextNALUnit(dup); if (buf == null) break; NALUnit nu = NALUnit.read(buf); if (nu.type == NALUnitType.PPS) { if (ppsList != null) ppsList.add(NIOUtils.duplicate(buf)); _in.position(dup.position()); // depends on control dependency: [if], data = [none] } else if (nu.type == NALUnitType.SPS) { if (spsList != null) spsList.add(NIOUtils.duplicate(buf)); _in.position(dup.position()); // depends on control dependency: [if], data = [none] } else if (nu.type == NALUnitType.IDR_SLICE || nu.type == NALUnitType.NON_IDR_SLICE) break; } } }
public class class_name { private static String buildOverloadParameterString(Class<?> parameterType) { String name = "_"; int arrayDimensions = 0; while (parameterType.isArray()) { arrayDimensions++; parameterType = parameterType.getComponentType(); } // arrays start with org_omg_boxedRMI_ if (arrayDimensions > 0) { name += "_org_omg_boxedRMI"; } // IDLEntity types must be prefixed with org_omg_boxedIDL_ if (IDLEntity.class.isAssignableFrom(parameterType)) { name += "_org_omg_boxedIDL"; } // add package... some types have special mappings in corba String packageName = specialTypePackages.get(parameterType.getName()); if (packageName == null) { packageName = getPackageName(parameterType.getName()); } if (packageName.length() > 0) { name += "_" + packageName; } // arrays now contain a dimension indicator if (arrayDimensions > 0) { name += "_" + "seq" + arrayDimensions; } // add the class name String className = specialTypeNames.get(parameterType.getName()); if (className == null) { className = buildClassName(parameterType); } name += "_" + className; return name; } }
public class class_name { private static String buildOverloadParameterString(Class<?> parameterType) { String name = "_"; int arrayDimensions = 0; while (parameterType.isArray()) { arrayDimensions++; // depends on control dependency: [while], data = [none] parameterType = parameterType.getComponentType(); // depends on control dependency: [while], data = [none] } // arrays start with org_omg_boxedRMI_ if (arrayDimensions > 0) { name += "_org_omg_boxedRMI"; // depends on control dependency: [if], data = [none] } // IDLEntity types must be prefixed with org_omg_boxedIDL_ if (IDLEntity.class.isAssignableFrom(parameterType)) { name += "_org_omg_boxedIDL"; // depends on control dependency: [if], data = [none] } // add package... some types have special mappings in corba String packageName = specialTypePackages.get(parameterType.getName()); if (packageName == null) { packageName = getPackageName(parameterType.getName()); // depends on control dependency: [if], data = [none] } if (packageName.length() > 0) { name += "_" + packageName; // depends on control dependency: [if], data = [none] } // arrays now contain a dimension indicator if (arrayDimensions > 0) { name += "_" + "seq" + arrayDimensions; // depends on control dependency: [if], data = [none] } // add the class name String className = specialTypeNames.get(parameterType.getName()); if (className == null) { className = buildClassName(parameterType); // depends on control dependency: [if], data = [none] } name += "_" + className; return name; } }
public class class_name { public static Optional<Capabilities> importFromResource(ResourceModel resourceModel, Context context) { Object resource = resourceModel.getResource(); try { @SuppressWarnings("unchecked") HashMap<String, Boolean> hashMap = (HashMap<String, Boolean>) resource; return Optional.of(constructCapabilites(hashMap, context)); } catch (ClassCastException e) { return Optional.empty(); } } }
public class class_name { public static Optional<Capabilities> importFromResource(ResourceModel resourceModel, Context context) { Object resource = resourceModel.getResource(); try { @SuppressWarnings("unchecked") HashMap<String, Boolean> hashMap = (HashMap<String, Boolean>) resource; return Optional.of(constructCapabilites(hashMap, context)); // depends on control dependency: [try], data = [none] } catch (ClassCastException e) { return Optional.empty(); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static synchronized AsyncTaskManager getAsyncTaskManager() throws JMSException { if (asyncTaskManager == null) { int threadPoolMinSize = getSettings().getIntProperty(FFMQCoreSettings.ASYNC_TASK_MANAGER_DELIVERY_THREAD_POOL_MINSIZE,0); int threadPoolMaxIdle = getSettings().getIntProperty(FFMQCoreSettings.ASYNC_TASK_MANAGER_DELIVERY_THREAD_POOL_MAXIDLE,5); int threadPoolMaxSize = getSettings().getIntProperty(FFMQCoreSettings.ASYNC_TASK_MANAGER_DELIVERY_THREAD_POOL_MAXSIZE,10); asyncTaskManager = new AsyncTaskManager("AsyncTaskManager-client-delivery", threadPoolMinSize, threadPoolMaxIdle, threadPoolMaxSize); } return asyncTaskManager; } }
public class class_name { public static synchronized AsyncTaskManager getAsyncTaskManager() throws JMSException { if (asyncTaskManager == null) { int threadPoolMinSize = getSettings().getIntProperty(FFMQCoreSettings.ASYNC_TASK_MANAGER_DELIVERY_THREAD_POOL_MINSIZE,0); int threadPoolMaxIdle = getSettings().getIntProperty(FFMQCoreSettings.ASYNC_TASK_MANAGER_DELIVERY_THREAD_POOL_MAXIDLE,5); int threadPoolMaxSize = getSettings().getIntProperty(FFMQCoreSettings.ASYNC_TASK_MANAGER_DELIVERY_THREAD_POOL_MAXSIZE,10); asyncTaskManager = new AsyncTaskManager("AsyncTaskManager-client-delivery", threadPoolMinSize, threadPoolMaxIdle, threadPoolMaxSize); // depends on control dependency: [if], data = [none] } return asyncTaskManager; } }
public class class_name { @Override public void upgradeFromPreviousVersion(OpenImmoDocument doc) { doc.setDocumentVersion(OpenImmoVersion.V1_2_4); if (doc instanceof OpenImmoTransferDocument) { try { this.upgradeAnzahlBalkonTerrassenElements(doc.getDocument()); } catch (Exception ex) { LOGGER.error("Can't upgrade <anzahl_balkon_terrassen> elements!"); LOGGER.error("> " + ex.getLocalizedMessage(), ex); } try { this.upgradeAnhangElements(doc.getDocument()); } catch (Exception ex) { LOGGER.error("Can't upgrade <anhang> elements!"); LOGGER.error("> " + ex.getLocalizedMessage(), ex); } try { this.upgradeSonstigeElements(doc.getDocument()); } catch (Exception ex) { LOGGER.error("Can't upgrade <sonstige> elements!"); LOGGER.error("> " + ex.getLocalizedMessage(), ex); } } } }
public class class_name { @Override public void upgradeFromPreviousVersion(OpenImmoDocument doc) { doc.setDocumentVersion(OpenImmoVersion.V1_2_4); if (doc instanceof OpenImmoTransferDocument) { try { this.upgradeAnzahlBalkonTerrassenElements(doc.getDocument()); // depends on control dependency: [try], data = [none] } catch (Exception ex) { LOGGER.error("Can't upgrade <anzahl_balkon_terrassen> elements!"); LOGGER.error("> " + ex.getLocalizedMessage(), ex); } try { this.upgradeAnhangElements(doc.getDocument()); } catch (Exception ex) { LOGGER.error("Can't upgrade <anhang> elements!"); LOGGER.error("> " + ex.getLocalizedMessage(), ex); } // depends on control dependency: [catch], data = [none] try { this.upgradeSonstigeElements(doc.getDocument()); // depends on control dependency: [try], data = [none] } catch (Exception ex) { LOGGER.error("Can't upgrade <sonstige> elements!"); LOGGER.error("> " + ex.getLocalizedMessage(), ex); } // depends on control dependency: [catch], data = [none] } } }
public class class_name { public void close() throws IOException, InterruptedException { for(OutputContext outputContext : this.outputContexts.values()) { outputContext.recordWriter.close(outputContext.taskAttemptContext); outputContext.outputCommitter.commitTask(outputContext.taskAttemptContext); // This is a trick for Hadoop 2.0 where there is extra business logic in commitJob() JobContext jContext; try { jContext = JobContextFactory.get(outputContext.taskAttemptContext.getConfiguration(), new JobID()); } catch(Exception e) { throw new IOException(e); } try { Class cl = Class.forName(OutputCommitter.class.getName()); Method method = cl.getMethod("commitJob", Class.forName(JobContext.class.getName())); if(method != null) { method.invoke(outputContext.outputCommitter, jContext); } } catch(Exception e) { // Hadoop 2.0 : do nothing // we need to call commitJob as a trick, but the trick itself may throw an IOException. // it doesn't mean that something went wrong. // If there was something really wrong it would have failed before. } outputContext.outputCommitter.cleanupJob(outputContext.jobContext); } } }
public class class_name { public void close() throws IOException, InterruptedException { for(OutputContext outputContext : this.outputContexts.values()) { outputContext.recordWriter.close(outputContext.taskAttemptContext); outputContext.outputCommitter.commitTask(outputContext.taskAttemptContext); // This is a trick for Hadoop 2.0 where there is extra business logic in commitJob() JobContext jContext; try { jContext = JobContextFactory.get(outputContext.taskAttemptContext.getConfiguration(), new JobID()); } catch(Exception e) { throw new IOException(e); } try { Class cl = Class.forName(OutputCommitter.class.getName()); Method method = cl.getMethod("commitJob", Class.forName(JobContext.class.getName())); if(method != null) { method.invoke(outputContext.outputCommitter, jContext); // depends on control dependency: [if], data = [none] } } catch(Exception e) { // Hadoop 2.0 : do nothing // we need to call commitJob as a trick, but the trick itself may throw an IOException. // it doesn't mean that something went wrong. // If there was something really wrong it would have failed before. } outputContext.outputCommitter.cleanupJob(outputContext.jobContext); } } }
public class class_name { public final ProtoParser.service_block_return service_block(Proto proto, Message message) throws RecognitionException { ProtoParser.service_block_return retval = new ProtoParser.service_block_return(); retval.start = input.LT(1); Object root_0 = null; Token SERVICE137=null; Token ID138=null; Token LEFTCURLY139=null; Token RIGHTCURLY141=null; Token SEMICOLON142=null; ProtoParser.service_body_return service_body140 = null; Object SERVICE137_tree=null; Object ID138_tree=null; Object LEFTCURLY139_tree=null; Object RIGHTCURLY141_tree=null; Object SEMICOLON142_tree=null; Service service = null; try { // com/dyuproject/protostuff/parser/ProtoParser.g:562:5: ( SERVICE ID LEFTCURLY ( service_body[proto, service] )+ RIGHTCURLY ( ( SEMICOLON )? ) ) // com/dyuproject/protostuff/parser/ProtoParser.g:562:9: SERVICE ID LEFTCURLY ( service_body[proto, service] )+ RIGHTCURLY ( ( SEMICOLON )? ) { root_0 = (Object)adaptor.nil(); SERVICE137=(Token)match(input,SERVICE,FOLLOW_SERVICE_in_service_block2270); if (state.failed) return retval; if ( state.backtracking==0 ) { SERVICE137_tree = (Object)adaptor.create(SERVICE137); adaptor.addChild(root_0, SERVICE137_tree); } ID138=(Token)match(input,ID,FOLLOW_ID_in_service_block2272); if (state.failed) return retval; if ( state.backtracking==0 ) { ID138_tree = (Object)adaptor.create(ID138); adaptor.addChild(root_0, ID138_tree); } if ( state.backtracking==0 ) { service = new Service((ID138!=null?ID138.getText():null), message, proto); proto.addAnnotationsTo(service); } LEFTCURLY139=(Token)match(input,LEFTCURLY,FOLLOW_LEFTCURLY_in_service_block2276); if (state.failed) return retval; if ( state.backtracking==0 ) { LEFTCURLY139_tree = (Object)adaptor.create(LEFTCURLY139); adaptor.addChild(root_0, LEFTCURLY139_tree); } // com/dyuproject/protostuff/parser/ProtoParser.g:566:9: ( service_body[proto, service] )+ int cnt27=0; loop27: do { int alt27=2; switch ( input.LA(1) ) { case AT: case OPTION: case RPC: { alt27=1; } break; } switch (alt27) { case 1 : // com/dyuproject/protostuff/parser/ProtoParser.g:566:10: service_body[proto, service] { pushFollow(FOLLOW_service_body_in_service_block2287); service_body140=service_body(proto, service); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) adaptor.addChild(root_0, service_body140.getTree()); } break; default : if ( cnt27 >= 1 ) break loop27; if (state.backtracking>0) {state.failed=true; return retval;} EarlyExitException eee = new EarlyExitException(27, input); throw eee; } cnt27++; } while (true); RIGHTCURLY141=(Token)match(input,RIGHTCURLY,FOLLOW_RIGHTCURLY_in_service_block2292); if (state.failed) return retval; if ( state.backtracking==0 ) { RIGHTCURLY141_tree = (Object)adaptor.create(RIGHTCURLY141); adaptor.addChild(root_0, RIGHTCURLY141_tree); } // com/dyuproject/protostuff/parser/ProtoParser.g:566:52: ( ( SEMICOLON )? ) // com/dyuproject/protostuff/parser/ProtoParser.g:566:53: ( SEMICOLON )? { // com/dyuproject/protostuff/parser/ProtoParser.g:566:53: ( SEMICOLON )? int alt28=2; switch ( input.LA(1) ) { case SEMICOLON: { alt28=1; } break; } switch (alt28) { case 1 : // com/dyuproject/protostuff/parser/ProtoParser.g:566:53: SEMICOLON { SEMICOLON142=(Token)match(input,SEMICOLON,FOLLOW_SEMICOLON_in_service_block2295); if (state.failed) return retval; if ( state.backtracking==0 ) { SEMICOLON142_tree = (Object)adaptor.create(SEMICOLON142); adaptor.addChild(root_0, SEMICOLON142_tree); } } break; } } if ( state.backtracking==0 ) { if(service.rpcMethods.isEmpty()) throw new IllegalStateException("Empty Service block: " + service.getName()); if(!proto.annotations.isEmpty()) throw new IllegalStateException("Misplaced annotations: " + proto.annotations); } } retval.stop = input.LT(-1); if ( state.backtracking==0 ) { retval.tree = (Object)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (Object)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { } return retval; } }
public class class_name { public final ProtoParser.service_block_return service_block(Proto proto, Message message) throws RecognitionException { ProtoParser.service_block_return retval = new ProtoParser.service_block_return(); retval.start = input.LT(1); Object root_0 = null; Token SERVICE137=null; Token ID138=null; Token LEFTCURLY139=null; Token RIGHTCURLY141=null; Token SEMICOLON142=null; ProtoParser.service_body_return service_body140 = null; Object SERVICE137_tree=null; Object ID138_tree=null; Object LEFTCURLY139_tree=null; Object RIGHTCURLY141_tree=null; Object SEMICOLON142_tree=null; Service service = null; try { // com/dyuproject/protostuff/parser/ProtoParser.g:562:5: ( SERVICE ID LEFTCURLY ( service_body[proto, service] )+ RIGHTCURLY ( ( SEMICOLON )? ) ) // com/dyuproject/protostuff/parser/ProtoParser.g:562:9: SERVICE ID LEFTCURLY ( service_body[proto, service] )+ RIGHTCURLY ( ( SEMICOLON )? ) { root_0 = (Object)adaptor.nil(); SERVICE137=(Token)match(input,SERVICE,FOLLOW_SERVICE_in_service_block2270); if (state.failed) return retval; if ( state.backtracking==0 ) { SERVICE137_tree = (Object)adaptor.create(SERVICE137); // depends on control dependency: [if], data = [none] adaptor.addChild(root_0, SERVICE137_tree); // depends on control dependency: [if], data = [none] } ID138=(Token)match(input,ID,FOLLOW_ID_in_service_block2272); if (state.failed) return retval; if ( state.backtracking==0 ) { ID138_tree = (Object)adaptor.create(ID138); // depends on control dependency: [if], data = [none] adaptor.addChild(root_0, ID138_tree); // depends on control dependency: [if], data = [none] } if ( state.backtracking==0 ) { service = new Service((ID138!=null?ID138.getText():null), message, proto); // depends on control dependency: [if], data = [none] proto.addAnnotationsTo(service); // depends on control dependency: [if], data = [none] } LEFTCURLY139=(Token)match(input,LEFTCURLY,FOLLOW_LEFTCURLY_in_service_block2276); if (state.failed) return retval; if ( state.backtracking==0 ) { LEFTCURLY139_tree = (Object)adaptor.create(LEFTCURLY139); // depends on control dependency: [if], data = [none] adaptor.addChild(root_0, LEFTCURLY139_tree); // depends on control dependency: [if], data = [none] } // com/dyuproject/protostuff/parser/ProtoParser.g:566:9: ( service_body[proto, service] )+ int cnt27=0; loop27: do { int alt27=2; switch ( input.LA(1) ) { case AT: case OPTION: case RPC: { alt27=1; } break; } switch (alt27) { case 1 : // com/dyuproject/protostuff/parser/ProtoParser.g:566:10: service_body[proto, service] { pushFollow(FOLLOW_service_body_in_service_block2287); service_body140=service_body(proto, service); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) adaptor.addChild(root_0, service_body140.getTree()); } break; default : if ( cnt27 >= 1 ) break loop27; if (state.backtracking>0) {state.failed=true; return retval;} // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none] EarlyExitException eee = new EarlyExitException(27, input); throw eee; } cnt27++; } while (true); RIGHTCURLY141=(Token)match(input,RIGHTCURLY,FOLLOW_RIGHTCURLY_in_service_block2292); if (state.failed) return retval; if ( state.backtracking==0 ) { RIGHTCURLY141_tree = (Object)adaptor.create(RIGHTCURLY141); adaptor.addChild(root_0, RIGHTCURLY141_tree); } // com/dyuproject/protostuff/parser/ProtoParser.g:566:52: ( ( SEMICOLON )? ) // com/dyuproject/protostuff/parser/ProtoParser.g:566:53: ( SEMICOLON )? { // com/dyuproject/protostuff/parser/ProtoParser.g:566:53: ( SEMICOLON )? int alt28=2; switch ( input.LA(1) ) { case SEMICOLON: { alt28=1; } break; } switch (alt28) { case 1 : // com/dyuproject/protostuff/parser/ProtoParser.g:566:53: SEMICOLON { SEMICOLON142=(Token)match(input,SEMICOLON,FOLLOW_SEMICOLON_in_service_block2295); if (state.failed) return retval; if ( state.backtracking==0 ) { SEMICOLON142_tree = (Object)adaptor.create(SEMICOLON142); adaptor.addChild(root_0, SEMICOLON142_tree); } } break; } } if ( state.backtracking==0 ) { if(service.rpcMethods.isEmpty()) throw new IllegalStateException("Empty Service block: " + service.getName()); if(!proto.annotations.isEmpty()) throw new IllegalStateException("Misplaced annotations: " + proto.annotations); } } retval.stop = input.LT(-1); if ( state.backtracking==0 ) { retval.tree = (Object)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (Object)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { } return retval; } }
public class class_name { protected <T extends Serializable> void postSerializer(T serializableObject, Map<String, Object> objReferences) { for(Field field : ReflectionMethods.getAllFields(new LinkedList<>(), serializableObject.getClass())) { String fieldName = field.getName(); Object ref = objReferences.remove(fieldName); if(ref != null) { //if a reference is found in the map field.setAccessible(true); try { //restore the reference in the object field.set(serializableObject, ref); } catch (IllegalAccessException ex) { throw new RuntimeException(ex); } } } } }
public class class_name { protected <T extends Serializable> void postSerializer(T serializableObject, Map<String, Object> objReferences) { for(Field field : ReflectionMethods.getAllFields(new LinkedList<>(), serializableObject.getClass())) { String fieldName = field.getName(); Object ref = objReferences.remove(fieldName); if(ref != null) { //if a reference is found in the map field.setAccessible(true); // depends on control dependency: [if], data = [none] try { //restore the reference in the object field.set(serializableObject, ref); // depends on control dependency: [try], data = [none] } catch (IllegalAccessException ex) { throw new RuntimeException(ex); } // depends on control dependency: [catch], data = [none] } } } }
public class class_name { public LocaleEncodingMappingListType<WebFragmentType<T>> getOrCreateLocaleEncodingMappingList() { List<Node> nodeList = childNode.get("locale-encoding-mapping-list"); if (nodeList != null && nodeList.size() > 0) { return new LocaleEncodingMappingListTypeImpl<WebFragmentType<T>>(this, "locale-encoding-mapping-list", childNode, nodeList.get(0)); } return createLocaleEncodingMappingList(); } }
public class class_name { public LocaleEncodingMappingListType<WebFragmentType<T>> getOrCreateLocaleEncodingMappingList() { List<Node> nodeList = childNode.get("locale-encoding-mapping-list"); if (nodeList != null && nodeList.size() > 0) { return new LocaleEncodingMappingListTypeImpl<WebFragmentType<T>>(this, "locale-encoding-mapping-list", childNode, nodeList.get(0)); // depends on control dependency: [if], data = [none] } return createLocaleEncodingMappingList(); } }
public class class_name { private void addChangeSets(Build build, JSONObject buildJson) { JSONObject changeSet = (JSONObject) buildJson.get("changes"); // Map<String, String> revisionToUrl = new HashMap<>(); // // Build a map of revision to module (scm url). This is not always // // provided by the Bamboo API, but we can use it if available. // for (Object revision : getJsonArray(changeSet, "revisions")) { // JSONObject json = (JSONObject) revision; // revisionToUrl.put(json.get("revision").toString(), getString(json, "module")); // } for (Object item : getJsonArray(changeSet, "change")) { JSONObject jsonItem = (JSONObject) item; SCM scm = new SCM(); scm.setScmAuthor(getString(jsonItem, "author")); scm.setScmCommitLog(getString(jsonItem, "comment")); scm.setScmCommitTimestamp(getCommitTimestamp(jsonItem)); scm.setScmRevisionNumber(getRevision(jsonItem)); scm.setScmUrl(getString(jsonItem,"commitUrl")); scm.setNumberOfChanges(getJsonArray((JSONObject)jsonItem.get("files"), "file").size()); build.getSourceChangeSet().add(scm); } } }
public class class_name { private void addChangeSets(Build build, JSONObject buildJson) { JSONObject changeSet = (JSONObject) buildJson.get("changes"); // Map<String, String> revisionToUrl = new HashMap<>(); // // Build a map of revision to module (scm url). This is not always // // provided by the Bamboo API, but we can use it if available. // for (Object revision : getJsonArray(changeSet, "revisions")) { // JSONObject json = (JSONObject) revision; // revisionToUrl.put(json.get("revision").toString(), getString(json, "module")); // } for (Object item : getJsonArray(changeSet, "change")) { JSONObject jsonItem = (JSONObject) item; SCM scm = new SCM(); scm.setScmAuthor(getString(jsonItem, "author")); // depends on control dependency: [for], data = [none] scm.setScmCommitLog(getString(jsonItem, "comment")); // depends on control dependency: [for], data = [none] scm.setScmCommitTimestamp(getCommitTimestamp(jsonItem)); // depends on control dependency: [for], data = [none] scm.setScmRevisionNumber(getRevision(jsonItem)); // depends on control dependency: [for], data = [none] scm.setScmUrl(getString(jsonItem,"commitUrl")); // depends on control dependency: [for], data = [none] scm.setNumberOfChanges(getJsonArray((JSONObject)jsonItem.get("files"), "file").size()); // depends on control dependency: [for], data = [none] build.getSourceChangeSet().add(scm); // depends on control dependency: [for], data = [none] } } }
public class class_name { private List<String> _readRecord() throws IOException { while (true) { int c = reader.read(); if (c < 0) { return null; } else if (!Character.isWhitespace(c)) { if (commentStart != null && commentStart.indexOf(c) >= 0) { while (c != '\n') { c = reader.read(); if (c < 0) { return null; } } } else { reader.unread(c); break; } } } List<String> values = new ArrayList<>(); String value = readField(); values.add(value); while (value != null) { int c = reader.read(); if (c == SEPARATOR) { value = readField(); values.add(value); } else if (c < 0 || c == '\n') { value = null; } } return values; } }
public class class_name { private List<String> _readRecord() throws IOException { while (true) { int c = reader.read(); if (c < 0) { return null; // depends on control dependency: [if], data = [none] } else if (!Character.isWhitespace(c)) { if (commentStart != null && commentStart.indexOf(c) >= 0) { while (c != '\n') { c = reader.read(); // depends on control dependency: [while], data = [none] if (c < 0) { return null; // depends on control dependency: [if], data = [none] } } } else { reader.unread(c); // depends on control dependency: [if], data = [none] break; } } } List<String> values = new ArrayList<>(); String value = readField(); values.add(value); while (value != null) { int c = reader.read(); if (c == SEPARATOR) { value = readField(); values.add(value); } else if (c < 0 || c == '\n') { value = null; } } return values; } }
public class class_name { @FFDCIgnore(IllegalArgumentException.class) private LdapSearchScope evaluateCallerSearchScope(boolean immediateOnly) { try { return elHelper.processLdapSearchScope("callerSearchScopeExpression", this.idStoreDefinition.callerSearchScopeExpression(), this.idStoreDefinition.callerSearchScope(), immediateOnly); } catch (IllegalArgumentException e) { if (TraceComponent.isAnyTracingEnabled() && tc.isWarningEnabled()) { Tr.warning(tc, "JAVAEESEC_WARNING_IDSTORE_CONFIG", new Object[] { "callerSearchScope/callerSearchScopeExpression", "LdapSearchScope.SUBTREE" }); } return LdapSearchScope.SUBTREE; /* Default value from spec. */ } } }
public class class_name { @FFDCIgnore(IllegalArgumentException.class) private LdapSearchScope evaluateCallerSearchScope(boolean immediateOnly) { try { return elHelper.processLdapSearchScope("callerSearchScopeExpression", this.idStoreDefinition.callerSearchScopeExpression(), this.idStoreDefinition.callerSearchScope(), immediateOnly); // depends on control dependency: [try], data = [none] } catch (IllegalArgumentException e) { if (TraceComponent.isAnyTracingEnabled() && tc.isWarningEnabled()) { Tr.warning(tc, "JAVAEESEC_WARNING_IDSTORE_CONFIG", new Object[] { "callerSearchScope/callerSearchScopeExpression", "LdapSearchScope.SUBTREE" }); // depends on control dependency: [if], data = [none] } return LdapSearchScope.SUBTREE; /* Default value from spec. */ } // depends on control dependency: [catch], data = [none] } }
public class class_name { @Override public void removeByUuid_C(String uuid, long companyId) { for (CPDefinitionOptionValueRel cpDefinitionOptionValueRel : findByUuid_C( uuid, companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(cpDefinitionOptionValueRel); } } }
public class class_name { @Override public void removeByUuid_C(String uuid, long companyId) { for (CPDefinitionOptionValueRel cpDefinitionOptionValueRel : findByUuid_C( uuid, companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(cpDefinitionOptionValueRel); // depends on control dependency: [for], data = [cpDefinitionOptionValueRel] } } }
public class class_name { public void init() { turnOff(); // initialization command(setDisplayClock((byte) 0, (byte) 8)); command(setMultiplexRatio(size.height)); command(setDisplayOffset(0)); // no offset command(setDisplayStartLine(0)); // line #0 command(setMemoryAddressingMode(MemoryAddressingMode.HORIZONTAL)); command(setHorizontalFlip(false)); command(setVerticalFlip(false)); if (vccState == VCC.EXTERNAL) { command(setChargePump(false)); } else { command(setChargePump(true)); } int contrast = 0; boolean sequentialPins = true; boolean leftRightPinsRemap = false; if (size == Size.SSD1306_128_32) { contrast = 0x8F; } else if (size == Size.SSD1306_128_64) { if (vccState == VCC.EXTERNAL) { contrast = 0x9F; } else { contrast = 0xCF; } sequentialPins = false; } else if (size == Size.SSD1306_96_16) { if (vccState == VCC.EXTERNAL) { contrast = 0x10; } else { contrast = 0xAF; } } command(setCOMPinsConfig(sequentialPins, leftRightPinsRemap)); command(setContrast((byte) contrast)); if (vccState == VCC.EXTERNAL) { command(setPrechargePeriod((byte) 2, (byte) 2)); } else { command(setPrechargePeriod((byte) 1, (byte) 15)); } command(setVcomhDeselectLevel((byte) 3)); command(DISPLAY_RESUME); command(setDisplayInverse(false)); stopScrolling(); display(); // synchronize canvas with display's internal buffer turnOn(); } }
public class class_name { public void init() { turnOff(); // initialization command(setDisplayClock((byte) 0, (byte) 8)); command(setMultiplexRatio(size.height)); command(setDisplayOffset(0)); // no offset command(setDisplayStartLine(0)); // line #0 command(setMemoryAddressingMode(MemoryAddressingMode.HORIZONTAL)); command(setHorizontalFlip(false)); command(setVerticalFlip(false)); if (vccState == VCC.EXTERNAL) { command(setChargePump(false)); // depends on control dependency: [if], data = [none] } else { command(setChargePump(true)); // depends on control dependency: [if], data = [none] } int contrast = 0; boolean sequentialPins = true; boolean leftRightPinsRemap = false; if (size == Size.SSD1306_128_32) { contrast = 0x8F; // depends on control dependency: [if], data = [none] } else if (size == Size.SSD1306_128_64) { if (vccState == VCC.EXTERNAL) { contrast = 0x9F; // depends on control dependency: [if], data = [none] } else { contrast = 0xCF; // depends on control dependency: [if], data = [none] } sequentialPins = false; // depends on control dependency: [if], data = [none] } else if (size == Size.SSD1306_96_16) { if (vccState == VCC.EXTERNAL) { contrast = 0x10; // depends on control dependency: [if], data = [none] } else { contrast = 0xAF; // depends on control dependency: [if], data = [none] } } command(setCOMPinsConfig(sequentialPins, leftRightPinsRemap)); command(setContrast((byte) contrast)); if (vccState == VCC.EXTERNAL) { command(setPrechargePeriod((byte) 2, (byte) 2)); // depends on control dependency: [if], data = [none] } else { command(setPrechargePeriod((byte) 1, (byte) 15)); // depends on control dependency: [if], data = [none] } command(setVcomhDeselectLevel((byte) 3)); command(DISPLAY_RESUME); command(setDisplayInverse(false)); stopScrolling(); display(); // synchronize canvas with display's internal buffer turnOn(); } }
public class class_name { @Override public void reset() { updatesLock.writeLock().lock(); if (storage != null) { storage.assign(0.0f); } if (updates != null) updates.assign(0.0f); updatesLock.writeLock().unlock(); } }
public class class_name { @Override public void reset() { updatesLock.writeLock().lock(); if (storage != null) { storage.assign(0.0f); // depends on control dependency: [if], data = [none] } if (updates != null) updates.assign(0.0f); updatesLock.writeLock().unlock(); } }
public class class_name { public void search() { if (layer != null) { // First we try to get the list of criteria: List<SearchCriterion> criteria = getSearchCriteria(); if (criteria != null && !criteria.isEmpty()) { SearchFeatureRequest request = new SearchFeatureRequest(); String value = (String) logicalOperatorRadio.getValue(); if (value.equals(I18nProvider.getSearch().radioOperatorAnd())) { request.setBooleanOperator("AND"); } else { request.setBooleanOperator("OR"); } request.setCriteria(criteria.toArray(new SearchCriterion[criteria.size()])); request.setCrs(mapModel.getCrs()); request.setLayerId(layer.getServerLayerId()); request.setMax(maximumResultSize); request.setFilter(layer.getFilter()); request.setFeatureIncludes(GwtCommandDispatcher.getInstance().getLazyFeatureIncludesSelect()); GwtCommand command = new GwtCommand(SearchFeatureRequest.COMMAND); command.setCommandRequest(request); GwtCommandDispatcher.getInstance().execute(command, new AbstractCommandCallback<SearchFeatureResponse>() { public void execute(SearchFeatureResponse response) { List<Feature> features = new ArrayList<Feature>(); for (org.geomajas.layer.feature.Feature dtoFeature : response.getFeatures()) { Feature feature = new Feature(dtoFeature, layer); layer.getFeatureStore().addFeature(feature); features.add(feature); } SearchEvent event = new SearchEvent(layer, features); FeatureSearch.this.fireEvent(event); } }); } } } }
public class class_name { public void search() { if (layer != null) { // First we try to get the list of criteria: List<SearchCriterion> criteria = getSearchCriteria(); if (criteria != null && !criteria.isEmpty()) { SearchFeatureRequest request = new SearchFeatureRequest(); String value = (String) logicalOperatorRadio.getValue(); if (value.equals(I18nProvider.getSearch().radioOperatorAnd())) { request.setBooleanOperator("AND"); // depends on control dependency: [if], data = [none] } else { request.setBooleanOperator("OR"); // depends on control dependency: [if], data = [none] } request.setCriteria(criteria.toArray(new SearchCriterion[criteria.size()])); // depends on control dependency: [if], data = [(criteria] request.setCrs(mapModel.getCrs()); // depends on control dependency: [if], data = [none] request.setLayerId(layer.getServerLayerId()); // depends on control dependency: [if], data = [none] request.setMax(maximumResultSize); // depends on control dependency: [if], data = [none] request.setFilter(layer.getFilter()); // depends on control dependency: [if], data = [none] request.setFeatureIncludes(GwtCommandDispatcher.getInstance().getLazyFeatureIncludesSelect()); // depends on control dependency: [if], data = [none] GwtCommand command = new GwtCommand(SearchFeatureRequest.COMMAND); command.setCommandRequest(request); // depends on control dependency: [if], data = [none] GwtCommandDispatcher.getInstance().execute(command, new AbstractCommandCallback<SearchFeatureResponse>() { public void execute(SearchFeatureResponse response) { List<Feature> features = new ArrayList<Feature>(); for (org.geomajas.layer.feature.Feature dtoFeature : response.getFeatures()) { Feature feature = new Feature(dtoFeature, layer); layer.getFeatureStore().addFeature(feature); // depends on control dependency: [for], data = [none] features.add(feature); // depends on control dependency: [for], data = [none] } SearchEvent event = new SearchEvent(layer, features); FeatureSearch.this.fireEvent(event); } }); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public void close() throws CGateException { if (!connected) return; synchronized (ping_connections) { try { sendCommand("quit").toArray(); } catch (Exception e) {} try { command_connection.stop(); event_connection.stop(); status_change_connection.stop(); } catch (Exception e) { throw new CGateException(e); } finally { clearCache(); connected = false; ping_connections.notify(); } } } }
public class class_name { public void close() throws CGateException { if (!connected) return; synchronized (ping_connections) { try { sendCommand("quit").toArray(); // depends on control dependency: [try], data = [none] } catch (Exception e) {} // depends on control dependency: [catch], data = [none] try { command_connection.stop(); // depends on control dependency: [try], data = [none] event_connection.stop(); // depends on control dependency: [try], data = [none] status_change_connection.stop(); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new CGateException(e); } // depends on control dependency: [catch], data = [none] finally { clearCache(); connected = false; ping_connections.notify(); } } } }
public class class_name { @GuardedBy("evictionLock") void evictFromMain(int candidates) { int victimQueue = PROBATION; Node<K, V> victim = accessOrderProbationDeque().peekFirst(); Node<K, V> candidate = accessOrderProbationDeque().peekLast(); while (weightedSize() > maximum()) { // Stop trying to evict candidates and always prefer the victim if (candidates == 0) { candidate = null; } // Try evicting from the protected and window queues if ((candidate == null) && (victim == null)) { if (victimQueue == PROBATION) { victim = accessOrderProtectedDeque().peekFirst(); victimQueue = PROTECTED; continue; } else if (victimQueue == PROTECTED) { victim = accessOrderWindowDeque().peekFirst(); victimQueue = WINDOW; continue; } // The pending operations will adjust the size to reflect the correct weight break; } // Skip over entries with zero weight if ((victim != null) && (victim.getPolicyWeight() == 0)) { victim = victim.getNextInAccessOrder(); continue; } else if ((candidate != null) && (candidate.getPolicyWeight() == 0)) { candidate = candidate.getPreviousInAccessOrder(); candidates--; continue; } // Evict immediately if only one of the entries is present if (victim == null) { @SuppressWarnings("NullAway") Node<K, V> previous = candidate.getPreviousInAccessOrder(); Node<K, V> evict = candidate; candidate = previous; candidates--; evictEntry(evict, RemovalCause.SIZE, 0L); continue; } else if (candidate == null) { Node<K, V> evict = victim; victim = victim.getNextInAccessOrder(); evictEntry(evict, RemovalCause.SIZE, 0L); continue; } // Evict immediately if an entry was collected K victimKey = victim.getKey(); K candidateKey = candidate.getKey(); if (victimKey == null) { @NonNull Node<K, V> evict = victim; victim = victim.getNextInAccessOrder(); evictEntry(evict, RemovalCause.COLLECTED, 0L); continue; } else if (candidateKey == null) { candidates--; @NonNull Node<K, V> evict = candidate; candidate = candidate.getPreviousInAccessOrder(); evictEntry(evict, RemovalCause.COLLECTED, 0L); continue; } // Evict immediately if the candidate's weight exceeds the maximum if (candidate.getPolicyWeight() > maximum()) { candidates--; Node<K, V> evict = candidate; candidate = candidate.getPreviousInAccessOrder(); evictEntry(evict, RemovalCause.SIZE, 0L); continue; } // Evict the entry with the lowest frequency candidates--; if (admit(candidateKey, victimKey)) { Node<K, V> evict = victim; victim = victim.getNextInAccessOrder(); evictEntry(evict, RemovalCause.SIZE, 0L); candidate = candidate.getPreviousInAccessOrder(); } else { Node<K, V> evict = candidate; candidate = candidate.getPreviousInAccessOrder(); evictEntry(evict, RemovalCause.SIZE, 0L); } } } }
public class class_name { @GuardedBy("evictionLock") void evictFromMain(int candidates) { int victimQueue = PROBATION; Node<K, V> victim = accessOrderProbationDeque().peekFirst(); Node<K, V> candidate = accessOrderProbationDeque().peekLast(); while (weightedSize() > maximum()) { // Stop trying to evict candidates and always prefer the victim if (candidates == 0) { candidate = null; // depends on control dependency: [if], data = [none] } // Try evicting from the protected and window queues if ((candidate == null) && (victim == null)) { if (victimQueue == PROBATION) { victim = accessOrderProtectedDeque().peekFirst(); // depends on control dependency: [if], data = [none] victimQueue = PROTECTED; // depends on control dependency: [if], data = [none] continue; } else if (victimQueue == PROTECTED) { victim = accessOrderWindowDeque().peekFirst(); // depends on control dependency: [if], data = [none] victimQueue = WINDOW; // depends on control dependency: [if], data = [none] continue; } // The pending operations will adjust the size to reflect the correct weight break; } // Skip over entries with zero weight if ((victim != null) && (victim.getPolicyWeight() == 0)) { victim = victim.getNextInAccessOrder(); // depends on control dependency: [if], data = [none] continue; } else if ((candidate != null) && (candidate.getPolicyWeight() == 0)) { candidate = candidate.getPreviousInAccessOrder(); // depends on control dependency: [if], data = [none] candidates--; // depends on control dependency: [if], data = [none] continue; } // Evict immediately if only one of the entries is present if (victim == null) { @SuppressWarnings("NullAway") Node<K, V> previous = candidate.getPreviousInAccessOrder(); Node<K, V> evict = candidate; candidate = previous; // depends on control dependency: [if], data = [none] candidates--; // depends on control dependency: [if], data = [none] evictEntry(evict, RemovalCause.SIZE, 0L); // depends on control dependency: [if], data = [none] continue; } else if (candidate == null) { Node<K, V> evict = victim; victim = victim.getNextInAccessOrder(); // depends on control dependency: [if], data = [none] evictEntry(evict, RemovalCause.SIZE, 0L); // depends on control dependency: [if], data = [none] continue; } // Evict immediately if an entry was collected K victimKey = victim.getKey(); K candidateKey = candidate.getKey(); if (victimKey == null) { @NonNull Node<K, V> evict = victim; victim = victim.getNextInAccessOrder(); // depends on control dependency: [if], data = [none] evictEntry(evict, RemovalCause.COLLECTED, 0L); // depends on control dependency: [if], data = [none] continue; } else if (candidateKey == null) { candidates--; // depends on control dependency: [if], data = [none] @NonNull Node<K, V> evict = candidate; candidate = candidate.getPreviousInAccessOrder(); // depends on control dependency: [if], data = [none] evictEntry(evict, RemovalCause.COLLECTED, 0L); // depends on control dependency: [if], data = [none] continue; } // Evict immediately if the candidate's weight exceeds the maximum if (candidate.getPolicyWeight() > maximum()) { candidates--; // depends on control dependency: [if], data = [none] Node<K, V> evict = candidate; candidate = candidate.getPreviousInAccessOrder(); // depends on control dependency: [if], data = [none] evictEntry(evict, RemovalCause.SIZE, 0L); // depends on control dependency: [if], data = [none] continue; } // Evict the entry with the lowest frequency candidates--; // depends on control dependency: [while], data = [none] if (admit(candidateKey, victimKey)) { Node<K, V> evict = victim; victim = victim.getNextInAccessOrder(); // depends on control dependency: [if], data = [none] evictEntry(evict, RemovalCause.SIZE, 0L); // depends on control dependency: [if], data = [none] candidate = candidate.getPreviousInAccessOrder(); // depends on control dependency: [if], data = [none] } else { Node<K, V> evict = candidate; candidate = candidate.getPreviousInAccessOrder(); // depends on control dependency: [if], data = [none] evictEntry(evict, RemovalCause.SIZE, 0L); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public void toStringRep(String indent, Map<String, String> nss, XNAppender out, Consumer<? super XRepresentationRecord> callback) { Map<String, String> nss0 = new HashMap<>(nss); out.append(indent); if (callback != null) { callback.accept(new XRepresentationRecord(XRepresentationState.START_ELEMENT, this, out.length())); } out.append("<"); Pair<String, String> pf = createPrefix(nss0, namespace, prefix); String prefix = pf.first; if (prefix != null && prefix.length() > 0) { out.append(prefix).append(":"); } out.append(name); if (pf.second != null) { out.append(pf.second); } if (attributes.size() > 0) { for (XAttributeName an : attributes.keySet()) { Pair<String, String> pfa = createPrefix(nss0, an.namespace, an.prefix); out.append(" "); if (pfa.first != null && pfa.first.length() > 0) { out.append(pfa.first).append(":"); } out.append(an.name).append("='").append(sanitize(attributes.get(an))).append("'"); if (pfa.second != null) { out.append(pfa.second); } } } if (children.size() == 0) { if (content == null || content.isEmpty()) { out.append("/>"); } else { out.append(">"); if (callback != null) { callback.accept(new XRepresentationRecord(XRepresentationState.START_TEXT, this, out.length())); } String s = sanitize(content); out.append(s); if (callback != null) { callback.accept(new XRepresentationRecord(XRepresentationState.END_TEXT, this, out.length())); } if (s.endsWith("\n")) { out.append(indent); } out.append("</"); if (prefix != null && prefix.length() > 0) { out.append(prefix).append(":"); } out.append(name); out.append(">"); } } else { if (content == null || content.isEmpty()) { out.append(String.format(">%n")); } else { out.append(">"); if (callback != null) { callback.accept(new XRepresentationRecord(XRepresentationState.START_TEXT, this, out.length())); } out.append(sanitize(content)); if (callback != null) { callback.accept(new XRepresentationRecord(XRepresentationState.END_TEXT, this, out.length())); } out.append(String.format("%n")); } for (XNElement e : children) { e.toStringRep(indent + " ", nss0, out, callback); } out.append(indent).append("</"); if (prefix != null && prefix.length() > 0) { out.append(prefix).append(":"); } out.append(name); out.append(">"); } if (callback != null) { callback.accept(new XRepresentationRecord(XRepresentationState.END_ELEMENT, this, out.length())); } out.append(String.format("%n")); } }
public class class_name { public void toStringRep(String indent, Map<String, String> nss, XNAppender out, Consumer<? super XRepresentationRecord> callback) { Map<String, String> nss0 = new HashMap<>(nss); out.append(indent); if (callback != null) { callback.accept(new XRepresentationRecord(XRepresentationState.START_ELEMENT, this, out.length())); // depends on control dependency: [if], data = [none] } out.append("<"); Pair<String, String> pf = createPrefix(nss0, namespace, prefix); String prefix = pf.first; if (prefix != null && prefix.length() > 0) { out.append(prefix).append(":"); // depends on control dependency: [if], data = [(prefix] } out.append(name); if (pf.second != null) { out.append(pf.second); // depends on control dependency: [if], data = [(pf.second] } if (attributes.size() > 0) { for (XAttributeName an : attributes.keySet()) { Pair<String, String> pfa = createPrefix(nss0, an.namespace, an.prefix); out.append(" "); // depends on control dependency: [for], data = [none] if (pfa.first != null && pfa.first.length() > 0) { out.append(pfa.first).append(":"); // depends on control dependency: [if], data = [(pfa.first] } out.append(an.name).append("='").append(sanitize(attributes.get(an))).append("'"); // depends on control dependency: [for], data = [an] if (pfa.second != null) { out.append(pfa.second); // depends on control dependency: [if], data = [(pfa.second] } } } if (children.size() == 0) { if (content == null || content.isEmpty()) { out.append("/>"); // depends on control dependency: [if], data = [none] } else { out.append(">"); // depends on control dependency: [if], data = [none] if (callback != null) { callback.accept(new XRepresentationRecord(XRepresentationState.START_TEXT, this, out.length())); // depends on control dependency: [if], data = [none] } String s = sanitize(content); out.append(s); // depends on control dependency: [if], data = [none] if (callback != null) { callback.accept(new XRepresentationRecord(XRepresentationState.END_TEXT, this, out.length())); // depends on control dependency: [if], data = [none] } if (s.endsWith("\n")) { out.append(indent); // depends on control dependency: [if], data = [none] } out.append("</"); // depends on control dependency: [if], data = [none] if (prefix != null && prefix.length() > 0) { out.append(prefix).append(":"); // depends on control dependency: [if], data = [(prefix] } out.append(name); // depends on control dependency: [if], data = [none] out.append(">"); // depends on control dependency: [if], data = [none] } } else { if (content == null || content.isEmpty()) { out.append(String.format(">%n")); // depends on control dependency: [if], data = [none] } else { out.append(">"); // depends on control dependency: [if], data = [none] if (callback != null) { callback.accept(new XRepresentationRecord(XRepresentationState.START_TEXT, this, out.length())); // depends on control dependency: [if], data = [none] } out.append(sanitize(content)); // depends on control dependency: [if], data = [(content] if (callback != null) { callback.accept(new XRepresentationRecord(XRepresentationState.END_TEXT, this, out.length())); // depends on control dependency: [if], data = [none] } out.append(String.format("%n")); // depends on control dependency: [if], data = [none] } for (XNElement e : children) { e.toStringRep(indent + " ", nss0, out, callback); // depends on control dependency: [for], data = [e] } out.append(indent).append("</"); // depends on control dependency: [if], data = [none] if (prefix != null && prefix.length() > 0) { out.append(prefix).append(":"); // depends on control dependency: [if], data = [(prefix] } out.append(name); // depends on control dependency: [if], data = [none] out.append(">"); // depends on control dependency: [if], data = [none] } if (callback != null) { callback.accept(new XRepresentationRecord(XRepresentationState.END_ELEMENT, this, out.length())); // depends on control dependency: [if], data = [none] } out.append(String.format("%n")); } }
public class class_name { public GetIntentResult withSlots(Slot... slots) { if (this.slots == null) { setSlots(new java.util.ArrayList<Slot>(slots.length)); } for (Slot ele : slots) { this.slots.add(ele); } return this; } }
public class class_name { public GetIntentResult withSlots(Slot... slots) { if (this.slots == null) { setSlots(new java.util.ArrayList<Slot>(slots.length)); // depends on control dependency: [if], data = [none] } for (Slot ele : slots) { this.slots.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public static double klDivergence(double[] p, double[] q) { if (p.length != q.length) { throw new IllegalStateException("The length of p and q must be the same."); } double delta = 1e-8; if (!Multinomials.isMultinomial(p, delta)) { throw new IllegalStateException("p is not a multinomial"); } if (!Multinomials.isMultinomial(q, delta)) { throw new IllegalStateException("q is not a multinomial"); } double kl = 0.0; for (int i=0; i<p.length; i++) { if (p[i] == 0.0 || q[i] == 0.0) { continue; } kl += p[i] * FastMath.log(p[i] / q[i]); } return kl; } }
public class class_name { public static double klDivergence(double[] p, double[] q) { if (p.length != q.length) { throw new IllegalStateException("The length of p and q must be the same."); } double delta = 1e-8; if (!Multinomials.isMultinomial(p, delta)) { throw new IllegalStateException("p is not a multinomial"); } if (!Multinomials.isMultinomial(q, delta)) { throw new IllegalStateException("q is not a multinomial"); } double kl = 0.0; for (int i=0; i<p.length; i++) { if (p[i] == 0.0 || q[i] == 0.0) { continue; } kl += p[i] * FastMath.log(p[i] / q[i]); // depends on control dependency: [for], data = [i] } return kl; } }
public class class_name { public static <T extends AbstractConfiguration> T findConfiguration(Class<?> klass) { // Look for static methods first List<Method> methods = findStaticMethodsAnnotatedWith(klass, TestServerConfiguration.class); List<Field> fields = findStaticFieldsAnnotatedWith(klass, TestServerConfiguration.class); int nbOfConfigurations = methods.size() + fields.size(); if (nbOfConfigurations > 1) { failBecauseOfDuplicateConfiguration(klass, methods, fields); } if (!methods.isEmpty()) { return invoke(methods.get(0)); } // Then, look for static field if (!fields.isEmpty()) { return getter(fields.get(0)); } return null; } }
public class class_name { public static <T extends AbstractConfiguration> T findConfiguration(Class<?> klass) { // Look for static methods first List<Method> methods = findStaticMethodsAnnotatedWith(klass, TestServerConfiguration.class); List<Field> fields = findStaticFieldsAnnotatedWith(klass, TestServerConfiguration.class); int nbOfConfigurations = methods.size() + fields.size(); if (nbOfConfigurations > 1) { failBecauseOfDuplicateConfiguration(klass, methods, fields); // depends on control dependency: [if], data = [none] } if (!methods.isEmpty()) { return invoke(methods.get(0)); // depends on control dependency: [if], data = [none] } // Then, look for static field if (!fields.isEmpty()) { return getter(fields.get(0)); // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { public static AnchorSize getAnchorSize(final Sheet sheet1, final FacesCell fcell, final Cell cell, final ClientAnchor anchor) { if (!(sheet1 instanceof XSSFSheet)) { return null; } double picWidth = 0.0; double picHeight = 0.0; int left = anchor.getDx1() / org.apache.poi.util.Units.EMU_PER_PIXEL; int top = (int) ((double) anchor.getDy1() / org.apache.poi.util.Units.EMU_PER_PIXEL / WebSheetUtility.PICTURE_HEIGHT_ADJUST); int right = anchor.getDx2() / org.apache.poi.util.Units.EMU_PER_PIXEL; int bottom = (int) ((double) anchor.getDy2() / org.apache.poi.util.Units.EMU_PER_PIXEL / WebSheetUtility.PICTURE_HEIGHT_ADJUST); double cellWidth = 0.0; double cellHeight = 0.0; if ((cell != null) && (fcell != null)) { for (int col = cell.getColumnIndex(); col < cell .getColumnIndex() + fcell.getColspan(); col++) { cellWidth += sheet1.getColumnWidthInPixels(col); } double lastCellWidth = sheet1.getColumnWidthInPixels( cell.getColumnIndex() + fcell.getColspan() - 1); for (int rowIndex = cell.getRowIndex(); rowIndex < cell .getRowIndex() + fcell.getRowspan(); rowIndex++) { cellHeight += WebSheetUtility.pointsToPixels( sheet1.getRow(rowIndex).getHeightInPoints()); } double lastCellHeight = WebSheetUtility.pointsToPixels(sheet1 .getRow(cell.getRowIndex() + fcell.getRowspan() - 1) .getHeightInPoints()); picWidth = cellWidth - lastCellWidth + right - left; picHeight = cellHeight - lastCellHeight + bottom - top; } else { for (short col = anchor.getCol1(); col < anchor .getCol2(); col++) { picWidth += sheet1.getColumnWidthInPixels(col); } for (int rowindex = anchor.getRow1(); rowindex < anchor .getRow2(); rowindex++) { Row row = sheet1.getRow(rowindex); if (row != null) { picHeight += WebSheetUtility .pointsToPixels(row.getHeightInPoints()); } } } return new AnchorSize(left, top, (int) picWidth, (int) picHeight, cellWidth, cellHeight); } }
public class class_name { public static AnchorSize getAnchorSize(final Sheet sheet1, final FacesCell fcell, final Cell cell, final ClientAnchor anchor) { if (!(sheet1 instanceof XSSFSheet)) { return null; // depends on control dependency: [if], data = [none] } double picWidth = 0.0; double picHeight = 0.0; int left = anchor.getDx1() / org.apache.poi.util.Units.EMU_PER_PIXEL; int top = (int) ((double) anchor.getDy1() / org.apache.poi.util.Units.EMU_PER_PIXEL / WebSheetUtility.PICTURE_HEIGHT_ADJUST); int right = anchor.getDx2() / org.apache.poi.util.Units.EMU_PER_PIXEL; int bottom = (int) ((double) anchor.getDy2() / org.apache.poi.util.Units.EMU_PER_PIXEL / WebSheetUtility.PICTURE_HEIGHT_ADJUST); double cellWidth = 0.0; double cellHeight = 0.0; if ((cell != null) && (fcell != null)) { for (int col = cell.getColumnIndex(); col < cell .getColumnIndex() + fcell.getColspan(); col++) { cellWidth += sheet1.getColumnWidthInPixels(col); // depends on control dependency: [for], data = [col] } double lastCellWidth = sheet1.getColumnWidthInPixels( cell.getColumnIndex() + fcell.getColspan() - 1); for (int rowIndex = cell.getRowIndex(); rowIndex < cell .getRowIndex() + fcell.getRowspan(); rowIndex++) { cellHeight += WebSheetUtility.pointsToPixels( sheet1.getRow(rowIndex).getHeightInPoints()); // depends on control dependency: [for], data = [none] } double lastCellHeight = WebSheetUtility.pointsToPixels(sheet1 .getRow(cell.getRowIndex() + fcell.getRowspan() - 1) .getHeightInPoints()); picWidth = cellWidth - lastCellWidth + right - left; // depends on control dependency: [if], data = [none] picHeight = cellHeight - lastCellHeight + bottom - top; // depends on control dependency: [if], data = [none] } else { for (short col = anchor.getCol1(); col < anchor .getCol2(); col++) { picWidth += sheet1.getColumnWidthInPixels(col); // depends on control dependency: [for], data = [col] } for (int rowindex = anchor.getRow1(); rowindex < anchor .getRow2(); rowindex++) { Row row = sheet1.getRow(rowindex); if (row != null) { picHeight += WebSheetUtility .pointsToPixels(row.getHeightInPoints()); // depends on control dependency: [if], data = [none] } } } return new AnchorSize(left, top, (int) picWidth, (int) picHeight, cellWidth, cellHeight); } }
public class class_name { public EClass getIfcRelProjectsElement() { if (ifcRelProjectsElementEClass == null) { ifcRelProjectsElementEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI) .getEClassifiers().get(479); } return ifcRelProjectsElementEClass; } }
public class class_name { public EClass getIfcRelProjectsElement() { if (ifcRelProjectsElementEClass == null) { ifcRelProjectsElementEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI) .getEClassifiers().get(479); // depends on control dependency: [if], data = [none] } return ifcRelProjectsElementEClass; } }
public class class_name { public String getType(int i) { if (i < 0 || i >= types.size()) { return null; } return types.get(i); } }
public class class_name { public String getType(int i) { if (i < 0 || i >= types.size()) { return null; // depends on control dependency: [if], data = [none] } return types.get(i); } }
public class class_name { @SuppressWarnings("unchecked") public static <T> T newInstance(Class<T> classToInstantiate) { int modifiers = classToInstantiate.getModifiers(); final Object object; if (Modifier.isInterface(modifiers)) { object = Proxy.newProxyInstance(WhiteboxImpl.class.getClassLoader(), new Class<?>[]{classToInstantiate}, new InvocationHandler() { @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { return TypeUtils.getDefaultValue(method.getReturnType()); } }); } else if (classToInstantiate.isArray()) { object = Array.newInstance(classToInstantiate.getComponentType(), 0); } else if (Modifier.isAbstract(modifiers)) { throw new IllegalArgumentException( "Cannot instantiate an abstract class. Please use the ConcreteClassGenerator in PowerMock support to generate a concrete class first."); } else { Objenesis objenesis = new ObjenesisStd(); ObjectInstantiator thingyInstantiator = objenesis.getInstantiatorOf(classToInstantiate); object = thingyInstantiator.newInstance(); } return (T) object; } }
public class class_name { @SuppressWarnings("unchecked") public static <T> T newInstance(Class<T> classToInstantiate) { int modifiers = classToInstantiate.getModifiers(); final Object object; if (Modifier.isInterface(modifiers)) { object = Proxy.newProxyInstance(WhiteboxImpl.class.getClassLoader(), new Class<?>[]{classToInstantiate}, new InvocationHandler() { @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { return TypeUtils.getDefaultValue(method.getReturnType()); } }); // depends on control dependency: [if], data = [none] } else if (classToInstantiate.isArray()) { object = Array.newInstance(classToInstantiate.getComponentType(), 0); // depends on control dependency: [if], data = [none] } else if (Modifier.isAbstract(modifiers)) { throw new IllegalArgumentException( "Cannot instantiate an abstract class. Please use the ConcreteClassGenerator in PowerMock support to generate a concrete class first."); } else { Objenesis objenesis = new ObjenesisStd(); ObjectInstantiator thingyInstantiator = objenesis.getInstantiatorOf(classToInstantiate); object = thingyInstantiator.newInstance(); // depends on control dependency: [if], data = [none] } return (T) object; } }
public class class_name { private void populateValuesOfSwModule() { if (baseSwModuleId == null) { return; } editSwModule = Boolean.TRUE; softwareModuleManagement.get(baseSwModuleId).ifPresent(swModule -> { nameTextField.setValue(swModule.getName()); versionTextField.setValue(swModule.getVersion()); vendorTextField.setValue(swModule.getVendor()); descTextArea.setValue(swModule.getDescription()); softwareModuleType = new LabelBuilder().name(swModule.getType().getName()) .caption(i18n.getMessage(UIMessageIdProvider.CAPTION_ARTIFACT_SOFTWARE_MODULE_TYPE)).buildLabel(); }); } }
public class class_name { private void populateValuesOfSwModule() { if (baseSwModuleId == null) { return; // depends on control dependency: [if], data = [none] } editSwModule = Boolean.TRUE; softwareModuleManagement.get(baseSwModuleId).ifPresent(swModule -> { nameTextField.setValue(swModule.getName()); versionTextField.setValue(swModule.getVersion()); vendorTextField.setValue(swModule.getVendor()); descTextArea.setValue(swModule.getDescription()); softwareModuleType = new LabelBuilder().name(swModule.getType().getName()) .caption(i18n.getMessage(UIMessageIdProvider.CAPTION_ARTIFACT_SOFTWARE_MODULE_TYPE)).buildLabel(); }); } }
public class class_name { public static boolean isFloatNoExponent(String str) { int len = str.length(); if (len == 0) { return false; } // skip first char if sign char char c = str.charAt(0); int i = ((c == '-') || (c == '+')) ? 1 : 0; // is it only a sign? if (i >= len) { return false; } boolean decimalPointFound = false; do { c = str.charAt(i); if (c == '.') { // is this a second dot? if (decimalPointFound) { return false; } decimalPointFound = true; } else if (!Character.isDigit(c)) { return false; } i++; } while (i < len); return true; } }
public class class_name { public static boolean isFloatNoExponent(String str) { int len = str.length(); if (len == 0) { return false; // depends on control dependency: [if], data = [none] } // skip first char if sign char char c = str.charAt(0); int i = ((c == '-') || (c == '+')) ? 1 : 0; // is it only a sign? if (i >= len) { return false; // depends on control dependency: [if], data = [none] } boolean decimalPointFound = false; do { c = str.charAt(i); if (c == '.') { // is this a second dot? if (decimalPointFound) { return false; // depends on control dependency: [if], data = [none] } decimalPointFound = true; // depends on control dependency: [if], data = [none] } else if (!Character.isDigit(c)) { return false; // depends on control dependency: [if], data = [none] } i++; } while (i < len); return true; } }
public class class_name { public DescribeHsmClientCertificatesResult withHsmClientCertificates(HsmClientCertificate... hsmClientCertificates) { if (this.hsmClientCertificates == null) { setHsmClientCertificates(new com.amazonaws.internal.SdkInternalList<HsmClientCertificate>(hsmClientCertificates.length)); } for (HsmClientCertificate ele : hsmClientCertificates) { this.hsmClientCertificates.add(ele); } return this; } }
public class class_name { public DescribeHsmClientCertificatesResult withHsmClientCertificates(HsmClientCertificate... hsmClientCertificates) { if (this.hsmClientCertificates == null) { setHsmClientCertificates(new com.amazonaws.internal.SdkInternalList<HsmClientCertificate>(hsmClientCertificates.length)); // depends on control dependency: [if], data = [none] } for (HsmClientCertificate ele : hsmClientCertificates) { this.hsmClientCertificates.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public SyncToolConfig processCommandLine(String[] args) { SyncToolConfig config = null; try { config = processConfigFileOptions(args); } catch (ParseException e) { printHelp(e.getMessage()); } return config; } }
public class class_name { public SyncToolConfig processCommandLine(String[] args) { SyncToolConfig config = null; try { config = processConfigFileOptions(args); // depends on control dependency: [try], data = [none] } catch (ParseException e) { printHelp(e.getMessage()); } // depends on control dependency: [catch], data = [none] return config; } }
public class class_name { @Override protected String toStringInternal(final boolean useSimpleNames) { final StringBuilder buf = new StringBuilder(); buf.append( useSimpleNames ? elementTypeSignature.toStringWithSimpleNames() : elementTypeSignature.toString()); for (int i = 0; i < numDims; i++) { buf.append("[]"); } return buf.toString(); } }
public class class_name { @Override protected String toStringInternal(final boolean useSimpleNames) { final StringBuilder buf = new StringBuilder(); buf.append( useSimpleNames ? elementTypeSignature.toStringWithSimpleNames() : elementTypeSignature.toString()); for (int i = 0; i < numDims; i++) { buf.append("[]"); // depends on control dependency: [for], data = [none] } return buf.toString(); } }
public class class_name { public void marshall(StreamSummary streamSummary, ProtocolMarshaller protocolMarshaller) { if (streamSummary == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(streamSummary.getStreamId(), STREAMID_BINDING); protocolMarshaller.marshall(streamSummary.getStreamArn(), STREAMARN_BINDING); protocolMarshaller.marshall(streamSummary.getStreamVersion(), STREAMVERSION_BINDING); protocolMarshaller.marshall(streamSummary.getDescription(), DESCRIPTION_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(StreamSummary streamSummary, ProtocolMarshaller protocolMarshaller) { if (streamSummary == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(streamSummary.getStreamId(), STREAMID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(streamSummary.getStreamArn(), STREAMARN_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(streamSummary.getStreamVersion(), STREAMVERSION_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(streamSummary.getDescription(), DESCRIPTION_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 { private Object writeMap(SerIterator itemIterator) { if (itemIterator.size() == 0) { return new LinkedHashMap<>(); } // if key type is known and convertible use short key format, else use full bean format if (settings.getConverter().isConvertible(itemIterator.keyType())) { return writeMapSimple(itemIterator); } else { return writeMapComplex(itemIterator); } } }
public class class_name { private Object writeMap(SerIterator itemIterator) { if (itemIterator.size() == 0) { return new LinkedHashMap<>(); // depends on control dependency: [if], data = [none] } // if key type is known and convertible use short key format, else use full bean format if (settings.getConverter().isConvertible(itemIterator.keyType())) { return writeMapSimple(itemIterator); // depends on control dependency: [if], data = [none] } else { return writeMapComplex(itemIterator); // depends on control dependency: [if], data = [none] } } }
public class class_name { @SuppressWarnings("unused") // called in SoyFileParser.jj public static final String calculateFullCalleeName( Identifier ident, SoyFileHeaderInfo header, ErrorReporter errorReporter) { String name = ident.identifier(); switch (ident.type()) { case DOT_IDENT: // Case 1: Source callee name is partial. return header.getNamespace() + name; case DOTTED_IDENT: // Case 2: Source callee name is a proper dotted ident, which might start with an alias. return header.resolveAlias(name); case SINGLE_IDENT: // Case 3: Source callee name is a single ident (not dotted). if (header.hasAlias(name)) { // Case 3a: This callee collides with a namespace alias, which likely means the alias // incorrectly references a template. errorReporter.report(ident.location(), CALL_COLLIDES_WITH_NAMESPACE_ALIAS, name); } else { // Case 3b: The callee name needs a namespace. errorReporter.report(ident.location(), MISSING_CALLEE_NAMESPACE, name); } return name; } throw new AssertionError(ident.type()); } }
public class class_name { @SuppressWarnings("unused") // called in SoyFileParser.jj public static final String calculateFullCalleeName( Identifier ident, SoyFileHeaderInfo header, ErrorReporter errorReporter) { String name = ident.identifier(); switch (ident.type()) { case DOT_IDENT: // Case 1: Source callee name is partial. return header.getNamespace() + name; case DOTTED_IDENT: // Case 2: Source callee name is a proper dotted ident, which might start with an alias. return header.resolveAlias(name); case SINGLE_IDENT: // Case 3: Source callee name is a single ident (not dotted). if (header.hasAlias(name)) { // Case 3a: This callee collides with a namespace alias, which likely means the alias // incorrectly references a template. errorReporter.report(ident.location(), CALL_COLLIDES_WITH_NAMESPACE_ALIAS, name); // depends on control dependency: [if], data = [none] } else { // Case 3b: The callee name needs a namespace. errorReporter.report(ident.location(), MISSING_CALLEE_NAMESPACE, name); // depends on control dependency: [if], data = [none] } return name; } throw new AssertionError(ident.type()); } }
public class class_name { public void closeAndRemoveWebSocket(String chargingStationIdentifier, @Nullable WebSocket webSocket) { if (webSocket != null && webSocket.isOpen()) { // received a web socket, close it no matter what webSocket.close(); } WebSocketWrapper existingWrapper = sockets.get(chargingStationIdentifier); if (existingWrapper == null) { LOG.info("Could not find websocket to remove for {}.", chargingStationIdentifier); return; } if (webSocket == null || webSocket.equals(existingWrapper.getWebSocket())) { if (existingWrapper.isOpen()) { LOG.info("Websocket to remove was not closed for {}. Closing now and removing websocket...", chargingStationIdentifier); existingWrapper.close(); } WebSocketWrapper removedSocket = sockets.remove(chargingStationIdentifier); // if the caller passed a web socket then only remove the web socket if it equals the passed web socket if (webSocket != null && !webSocket.equals(removedSocket.getWebSocket())) { // some other thread beat us to it (other thread added a new web socket to the set while we were in this method) // we removed the new socket, we put it back and act like nothing happened... sockets.put(chargingStationIdentifier, removedSocket); } } } }
public class class_name { public void closeAndRemoveWebSocket(String chargingStationIdentifier, @Nullable WebSocket webSocket) { if (webSocket != null && webSocket.isOpen()) { // received a web socket, close it no matter what webSocket.close(); // depends on control dependency: [if], data = [none] } WebSocketWrapper existingWrapper = sockets.get(chargingStationIdentifier); if (existingWrapper == null) { LOG.info("Could not find websocket to remove for {}.", chargingStationIdentifier); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } if (webSocket == null || webSocket.equals(existingWrapper.getWebSocket())) { if (existingWrapper.isOpen()) { LOG.info("Websocket to remove was not closed for {}. Closing now and removing websocket...", chargingStationIdentifier); // depends on control dependency: [if], data = [none] existingWrapper.close(); // depends on control dependency: [if], data = [none] } WebSocketWrapper removedSocket = sockets.remove(chargingStationIdentifier); // if the caller passed a web socket then only remove the web socket if it equals the passed web socket if (webSocket != null && !webSocket.equals(removedSocket.getWebSocket())) { // some other thread beat us to it (other thread added a new web socket to the set while we were in this method) // we removed the new socket, we put it back and act like nothing happened... sockets.put(chargingStationIdentifier, removedSocket); // depends on control dependency: [if], data = [none] } } } }
public class class_name { private Component prepareDateFacets(CmsSolrResultList solrResultList, CmsSearchResultWrapper resultWrapper) { RangeFacet<?, ?> dateFacets = resultWrapper.getRangeFacet().get(CmsListManager.FIELD_DATE_FACET_NAME); I_CmsSearchControllerFacetRange facetController = resultWrapper.getController().getRangeFacets().getRangeFacetController().get( CmsListManager.FIELD_DATE_FACET_NAME); if ((dateFacets != null) && (dateFacets.getCounts().size() > 0)) { GridLayout dateLayout = new GridLayout(); dateLayout.setWidth("100%"); dateLayout.setColumns(6); String currentYear = null; int row = -2; for (final RangeFacet.Count value : dateFacets.getCounts()) { String[] dateParts = value.getValue().split("-"); if (!dateParts[0].equals(currentYear)) { row += 2; dateLayout.setRows(row + 2); currentYear = dateParts[0]; Label year = new Label(currentYear); year.addStyleName(OpenCmsTheme.PADDING_HORIZONTAL); dateLayout.addComponent(year, 0, row, 5, row); row++; } int month = Integer.parseInt(dateParts[1]) - 1; Button date = new Button(CmsListManager.MONTHS[month] + " (" + value.getCount() + ")"); date.addStyleName(ValoTheme.BUTTON_TINY); date.addStyleName(ValoTheme.BUTTON_BORDERLESS); Boolean selected = facetController.getState().getIsChecked().get(value.getValue()); if ((selected != null) && selected.booleanValue()) { date.addStyleName(SELECTED_STYLE); } date.addClickListener(new ClickListener() { private static final long serialVersionUID = 1L; public void buttonClick(ClickEvent event) { if (isSelected(event.getComponent())) { resetFacetsAndSearch(); } else { selectRangeFacet(CmsListManager.FIELD_DATE_FACET_NAME, value.getValue()); } } }); int targetColumn; int targetRow; if (month < 6) { targetColumn = month; targetRow = row; } else { targetColumn = month - 6; targetRow = row + 1; dateLayout.setRows(row + 2); } dateLayout.addComponent(date, targetColumn, targetRow); } Panel datePanel = new Panel(CmsVaadinUtils.getMessageText(Messages.GUI_LISTMANAGER_FACET_DATE_0)); datePanel.setContent(dateLayout); return datePanel; } else { return null; } } }
public class class_name { private Component prepareDateFacets(CmsSolrResultList solrResultList, CmsSearchResultWrapper resultWrapper) { RangeFacet<?, ?> dateFacets = resultWrapper.getRangeFacet().get(CmsListManager.FIELD_DATE_FACET_NAME); I_CmsSearchControllerFacetRange facetController = resultWrapper.getController().getRangeFacets().getRangeFacetController().get( CmsListManager.FIELD_DATE_FACET_NAME); if ((dateFacets != null) && (dateFacets.getCounts().size() > 0)) { GridLayout dateLayout = new GridLayout(); dateLayout.setWidth("100%"); // depends on control dependency: [if], data = [none] dateLayout.setColumns(6); // depends on control dependency: [if], data = [none] String currentYear = null; int row = -2; for (final RangeFacet.Count value : dateFacets.getCounts()) { String[] dateParts = value.getValue().split("-"); if (!dateParts[0].equals(currentYear)) { row += 2; // depends on control dependency: [if], data = [none] dateLayout.setRows(row + 2); // depends on control dependency: [if], data = [none] currentYear = dateParts[0]; // depends on control dependency: [if], data = [none] Label year = new Label(currentYear); year.addStyleName(OpenCmsTheme.PADDING_HORIZONTAL); // depends on control dependency: [if], data = [none] dateLayout.addComponent(year, 0, row, 5, row); // depends on control dependency: [if], data = [none] row++; // depends on control dependency: [if], data = [none] } int month = Integer.parseInt(dateParts[1]) - 1; Button date = new Button(CmsListManager.MONTHS[month] + " (" + value.getCount() + ")"); date.addStyleName(ValoTheme.BUTTON_TINY); date.addStyleName(ValoTheme.BUTTON_BORDERLESS); Boolean selected = facetController.getState().getIsChecked().get(value.getValue()); if ((selected != null) && selected.booleanValue()) { date.addStyleName(SELECTED_STYLE); } date.addClickListener(new ClickListener() { private static final long serialVersionUID = 1L; public void buttonClick(ClickEvent event) { if (isSelected(event.getComponent())) { resetFacetsAndSearch(); // depends on control dependency: [if], data = [none] } else { selectRangeFacet(CmsListManager.FIELD_DATE_FACET_NAME, value.getValue()); // depends on control dependency: [if], data = [none] } } }); int targetColumn; int targetRow; if (month < 6) { targetColumn = month; targetRow = row; } else { targetColumn = month - 6; targetRow = row + 1; // depends on control dependency: [for], data = [none] dateLayout.setRows(row + 2); // depends on control dependency: [for], data = [none] } dateLayout.addComponent(date, targetColumn, targetRow); // depends on control dependency: [if], data = [none] } Panel datePanel = new Panel(CmsVaadinUtils.getMessageText(Messages.GUI_LISTMANAGER_FACET_DATE_0)); datePanel.setContent(dateLayout); return datePanel; } else { return null; } } }
public class class_name { private Boolean termin(Long channelId, final TerminType type) throws Exception { Channel channel = ArbitrateConfigUtils.getChannelByChannelId(channelId); List<Pipeline> pipelines = channel.getPipelines(); List<Future<Boolean>> futures = new ArrayList<Future<Boolean>>(); for (final Pipeline pipeline : pipelines) { futures.add(arbitrateExecutor.submit(new Callable<Boolean>() { public Boolean call() { TerminEventData data = new TerminEventData(); data.setPipelineId(pipeline.getId()); data.setType(type); data.setCode("channel"); data.setDesc(type.toString()); return errorTerminProcess.process(data); // 处理关闭 } })); } boolean result = false; Exception exception = null; int index = 0; for (Future<Boolean> future : futures) { try { result |= future.get(); // 进行处理 } catch (InterruptedException e) { // ignore Thread.currentThread().interrupt(); } catch (ExecutionException e) { sendWarningMessage(pipelines.get(index).getId(), e); exception = e; } index++; } if (exception != null) { throw exception; } else { return result; } } }
public class class_name { private Boolean termin(Long channelId, final TerminType type) throws Exception { Channel channel = ArbitrateConfigUtils.getChannelByChannelId(channelId); List<Pipeline> pipelines = channel.getPipelines(); List<Future<Boolean>> futures = new ArrayList<Future<Boolean>>(); for (final Pipeline pipeline : pipelines) { futures.add(arbitrateExecutor.submit(new Callable<Boolean>() { public Boolean call() { TerminEventData data = new TerminEventData(); data.setPipelineId(pipeline.getId()); data.setType(type); data.setCode("channel"); data.setDesc(type.toString()); return errorTerminProcess.process(data); // 处理关闭 } })); } boolean result = false; Exception exception = null; int index = 0; for (Future<Boolean> future : futures) { try { result |= future.get(); // 进行处理 // depends on control dependency: [try], data = [none] } catch (InterruptedException e) { // ignore Thread.currentThread().interrupt(); } catch (ExecutionException e) { // depends on control dependency: [catch], data = [none] sendWarningMessage(pipelines.get(index).getId(), e); exception = e; } // depends on control dependency: [catch], data = [none] index++; } if (exception != null) { throw exception; } else { return result; } } }
public class class_name { public PolygonOptions toPolygon(Polygon polygon) { PolygonOptions polygonOptions = new PolygonOptions(); List<LineString> rings = polygon.getRings(); if (!rings.isEmpty()) { Double z = null; // Add the polygon points LineString polygonLineString = rings.get(0); // Try to simplify the number of points in the polygon ring List<Point> points = simplifyPoints(polygonLineString.getPoints()); for (Point point : points) { LatLng latLng = toLatLng(point); polygonOptions.add(latLng); if (point.hasZ()) { z = (z == null) ? point.getZ() : Math.max(z, point.getZ()); } } // Add the holes for (int i = 1; i < rings.size(); i++) { LineString hole = rings.get(i); // Try to simplify the number of points in the polygon hole List<Point> holePoints = simplifyPoints(hole.getPoints()); List<LatLng> holeLatLngs = new ArrayList<LatLng>(); for (Point point : holePoints) { LatLng latLng = toLatLng(point); holeLatLngs.add(latLng); if (point.hasZ()) { z = (z == null) ? point.getZ() : Math.max(z, point.getZ()); } } polygonOptions.addHole(holeLatLngs); } if (polygon.hasZ() && z != null) { polygonOptions.zIndex(z.floatValue()); } } return polygonOptions; } }
public class class_name { public PolygonOptions toPolygon(Polygon polygon) { PolygonOptions polygonOptions = new PolygonOptions(); List<LineString> rings = polygon.getRings(); if (!rings.isEmpty()) { Double z = null; // Add the polygon points LineString polygonLineString = rings.get(0); // Try to simplify the number of points in the polygon ring List<Point> points = simplifyPoints(polygonLineString.getPoints()); for (Point point : points) { LatLng latLng = toLatLng(point); polygonOptions.add(latLng); // depends on control dependency: [for], data = [none] if (point.hasZ()) { z = (z == null) ? point.getZ() : Math.max(z, point.getZ()); // depends on control dependency: [if], data = [none] } } // Add the holes for (int i = 1; i < rings.size(); i++) { LineString hole = rings.get(i); // Try to simplify the number of points in the polygon hole List<Point> holePoints = simplifyPoints(hole.getPoints()); List<LatLng> holeLatLngs = new ArrayList<LatLng>(); for (Point point : holePoints) { LatLng latLng = toLatLng(point); holeLatLngs.add(latLng); // depends on control dependency: [for], data = [none] if (point.hasZ()) { z = (z == null) ? point.getZ() : Math.max(z, point.getZ()); // depends on control dependency: [if], data = [none] } } polygonOptions.addHole(holeLatLngs); // depends on control dependency: [for], data = [none] } if (polygon.hasZ() && z != null) { polygonOptions.zIndex(z.floatValue()); // depends on control dependency: [if], data = [none] } } return polygonOptions; } }
public class class_name { protected boolean updateState() { if (!overrideKeyboardInput) { return false; // Let the class do the default thing. } // Update movement: mTicksSinceLastVelocityChange++; if (mTicksSinceLastVelocityChange <= mInertiaTicks) { mVelocity += (mTargetVelocity - mVelocity) * ((float)mTicksSinceLastVelocityChange/(float)mInertiaTicks); } else { mVelocity = mTargetVelocity; } this.overrideMovement.moveForward = mVelocity; // This code comes from the Minecraft MovementInput superclass - needed so as not to give the bot an unfair // advantage when sneaking! if (this.overrideMovement.sneak) { this.overrideMovement.moveStrafe = (float)((double)this.overrideMovement.moveStrafe * 0.3D); this.overrideMovement.moveForward = (float)((double)this.overrideMovement.moveForward * 0.3D); } updateYawAndPitch(); return true; } }
public class class_name { protected boolean updateState() { if (!overrideKeyboardInput) { return false; // Let the class do the default thing. // depends on control dependency: [if], data = [none] } // Update movement: mTicksSinceLastVelocityChange++; if (mTicksSinceLastVelocityChange <= mInertiaTicks) { mVelocity += (mTargetVelocity - mVelocity) * ((float)mTicksSinceLastVelocityChange/(float)mInertiaTicks); // depends on control dependency: [if], data = [none] } else { mVelocity = mTargetVelocity; // depends on control dependency: [if], data = [none] } this.overrideMovement.moveForward = mVelocity; // This code comes from the Minecraft MovementInput superclass - needed so as not to give the bot an unfair // advantage when sneaking! if (this.overrideMovement.sneak) { this.overrideMovement.moveStrafe = (float)((double)this.overrideMovement.moveStrafe * 0.3D); // depends on control dependency: [if], data = [none] this.overrideMovement.moveForward = (float)((double)this.overrideMovement.moveForward * 0.3D); // depends on control dependency: [if], data = [none] } updateYawAndPitch(); return true; } }
public class class_name { private void addSwatchToRow(TableRow row, View swatch, int rowNumber) { if (rowNumber % 2 == 0) { row.addView(swatch); } else { row.addView(swatch, 0); } } }
public class class_name { private void addSwatchToRow(TableRow row, View swatch, int rowNumber) { if (rowNumber % 2 == 0) { row.addView(swatch); // depends on control dependency: [if], data = [none] } else { row.addView(swatch, 0); // depends on control dependency: [if], data = [0)] } } }
public class class_name { @Override public CloseableReference<Bitmap> decodeFromEncodedImageWithColorSpace( final EncodedImage encodedImage, Bitmap.Config bitmapConfig, @Nullable Rect regionToDecode, @Nullable final ColorSpace colorSpace) { BitmapFactory.Options options = getBitmapFactoryOptions( encodedImage.getSampleSize(), bitmapConfig); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { OreoUtils.setColorSpace(options, colorSpace); } CloseableReference<PooledByteBuffer> bytesRef = encodedImage.getByteBufferRef(); Preconditions.checkNotNull(bytesRef); try { Bitmap bitmap = decodeByteArrayAsPurgeable(bytesRef, options); return pinBitmap(bitmap); } finally { CloseableReference.closeSafely(bytesRef); } } }
public class class_name { @Override public CloseableReference<Bitmap> decodeFromEncodedImageWithColorSpace( final EncodedImage encodedImage, Bitmap.Config bitmapConfig, @Nullable Rect regionToDecode, @Nullable final ColorSpace colorSpace) { BitmapFactory.Options options = getBitmapFactoryOptions( encodedImage.getSampleSize(), bitmapConfig); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { OreoUtils.setColorSpace(options, colorSpace); // depends on control dependency: [if], data = [none] } CloseableReference<PooledByteBuffer> bytesRef = encodedImage.getByteBufferRef(); Preconditions.checkNotNull(bytesRef); try { Bitmap bitmap = decodeByteArrayAsPurgeable(bytesRef, options); return pinBitmap(bitmap); // depends on control dependency: [try], data = [none] } finally { CloseableReference.closeSafely(bytesRef); } } }
public class class_name { @Deprecated public TraceMethod entry(String methodSignature) { synchronized (this.syncObject) { out().printIndentln("ENTRY--" + methodSignature + "--" + Thread.currentThread().getName() + "[" + Thread.currentThread().getId() + "]"); } TraceMethod traceMethod = null; try { traceMethod = new TraceMethod(methodSignature); if (!this.threadMap.push(traceMethod)) traceMethod = null; } catch (AbstractThreadMap.RuntimeException ex) { logMessage(LogLevel.SEVERE, "Stacksize is exceeded. Tracing is off.", this.getClass(), "entry()"); } return traceMethod; } }
public class class_name { @Deprecated public TraceMethod entry(String methodSignature) { synchronized (this.syncObject) { out().printIndentln("ENTRY--" + methodSignature + "--" + Thread.currentThread().getName() + "[" + Thread.currentThread().getId() + "]"); } TraceMethod traceMethod = null; try { traceMethod = new TraceMethod(methodSignature); // depends on control dependency: [try], data = [none] if (!this.threadMap.push(traceMethod)) traceMethod = null; } catch (AbstractThreadMap.RuntimeException ex) { logMessage(LogLevel.SEVERE, "Stacksize is exceeded. Tracing is off.", this.getClass(), "entry()"); } // depends on control dependency: [catch], data = [none] return traceMethod; } }
public class class_name { @Override public final boolean isValid(final String pvalue, final ConstraintValidatorContext pcontext) { if (StringUtils.isEmpty(pvalue)) { return true; } if (pvalue.length() > LENGTH_CREDIT_CARDNUMBER) { // credit card number is to long, but that's handled by size annotation return true; } return CHECK_CREDIT_CARD.isValid(pvalue); } }
public class class_name { @Override public final boolean isValid(final String pvalue, final ConstraintValidatorContext pcontext) { if (StringUtils.isEmpty(pvalue)) { return true; // depends on control dependency: [if], data = [none] } if (pvalue.length() > LENGTH_CREDIT_CARDNUMBER) { // credit card number is to long, but that's handled by size annotation return true; // depends on control dependency: [if], data = [none] } return CHECK_CREDIT_CARD.isValid(pvalue); } }
public class class_name { private static void updateLocalConfiguration(final JavaSparkContext sparkContext, final Configuration configuration) { /* * While we could enumerate over the entire SparkConfiguration and copy into the Thread * Local properties of the Spark Context this could cause adverse effects with future * versions of Spark. Since the api for setting multiple local properties at once is * restricted as private, we will only set those properties we know can effect SparkGraphComputer * Execution rather than applying the entire configuration. */ final String[] validPropertyNames = { "spark.job.description", "spark.jobGroup.id", "spark.job.interruptOnCancel", "spark.scheduler.pool" }; for (String propertyName : validPropertyNames) { String propertyValue = configuration.get(propertyName); if (propertyValue != null) { LOGGER.info("Setting Thread Local SparkContext Property - " + propertyName + " : " + propertyValue); sparkContext.setLocalProperty(propertyName, configuration.get(propertyName)); } } } }
public class class_name { private static void updateLocalConfiguration(final JavaSparkContext sparkContext, final Configuration configuration) { /* * While we could enumerate over the entire SparkConfiguration and copy into the Thread * Local properties of the Spark Context this could cause adverse effects with future * versions of Spark. Since the api for setting multiple local properties at once is * restricted as private, we will only set those properties we know can effect SparkGraphComputer * Execution rather than applying the entire configuration. */ final String[] validPropertyNames = { "spark.job.description", "spark.jobGroup.id", "spark.job.interruptOnCancel", "spark.scheduler.pool" }; for (String propertyName : validPropertyNames) { String propertyValue = configuration.get(propertyName); if (propertyValue != null) { LOGGER.info("Setting Thread Local SparkContext Property - " + propertyName + " : " + propertyValue); // depends on control dependency: [if], data = [none] sparkContext.setLocalProperty(propertyName, configuration.get(propertyName)); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public void registerDereferencedListener( final Provider.DereferenceListener onProviderFreedListener) { if (uiThreadRunner.isOnUiThread()) { graph.registerDereferencedListener(onProviderFreedListener); } else { uiThreadRunner.post(new Runnable() { @Override public void run() { graph.registerDereferencedListener(onProviderFreedListener); } }); } } }
public class class_name { public void registerDereferencedListener( final Provider.DereferenceListener onProviderFreedListener) { if (uiThreadRunner.isOnUiThread()) { graph.registerDereferencedListener(onProviderFreedListener); // depends on control dependency: [if], data = [none] } else { uiThreadRunner.post(new Runnable() { @Override public void run() { graph.registerDereferencedListener(onProviderFreedListener); } }); // depends on control dependency: [if], data = [none] } } }
public class class_name { public Collection<H> lowerDescendants( BitSet key ) { List<H> vals = new LinkedList<H>(); int l = key.length(); if ( l == 0 || line.isEmpty() ) { return new ArrayList( getSortedMembers() ); } int n = line.lastKey().length(); if ( l > n ) { return vals; } BitSet start = new BitSet( n ); BitSet end = new BitSet( n ); start.or( key ); start.set( l - 1 ); end.set( n ); for ( J val : line.subMap( start, end ).values() ) { BitSet x = val.getBitMask(); if ( superset( x, key ) >= 0 ) { vals.add( val.getValue() ); } } start.clear( l - 1 ); return vals; } }
public class class_name { public Collection<H> lowerDescendants( BitSet key ) { List<H> vals = new LinkedList<H>(); int l = key.length(); if ( l == 0 || line.isEmpty() ) { return new ArrayList( getSortedMembers() ); // depends on control dependency: [if], data = [none] } int n = line.lastKey().length(); if ( l > n ) { return vals; } // depends on control dependency: [if], data = [none] BitSet start = new BitSet( n ); BitSet end = new BitSet( n ); start.or( key ); start.set( l - 1 ); end.set( n ); for ( J val : line.subMap( start, end ).values() ) { BitSet x = val.getBitMask(); if ( superset( x, key ) >= 0 ) { vals.add( val.getValue() ); // depends on control dependency: [if], data = [none] } } start.clear( l - 1 ); return vals; } }
public class class_name { @Override protected Query makeQuery(Token lower, Token upper, boolean includeLower, boolean includeUpper) { Long start = lower == null ? null : (Long) lower.getTokenValue(); Long stop = upper == null ? null : (Long) upper.getTokenValue(); if (lower != null && lower.isMinimum()) { start = null; } if (upper != null && upper.isMinimum()) { stop = null; } if (start == null && stop == null) { return null; } return NumericRangeQuery.newLongRange(FIELD_NAME, start, stop, includeLower, includeUpper); } }
public class class_name { @Override protected Query makeQuery(Token lower, Token upper, boolean includeLower, boolean includeUpper) { Long start = lower == null ? null : (Long) lower.getTokenValue(); Long stop = upper == null ? null : (Long) upper.getTokenValue(); if (lower != null && lower.isMinimum()) { start = null; // depends on control dependency: [if], data = [none] } if (upper != null && upper.isMinimum()) { stop = null; // depends on control dependency: [if], data = [none] } if (start == null && stop == null) { return null; // depends on control dependency: [if], data = [none] } return NumericRangeQuery.newLongRange(FIELD_NAME, start, stop, includeLower, includeUpper); } }
public class class_name { private void clear(IntSet segments, boolean keepSegments) { for (Iterator<K> keyIterator = entries.keySet().iterator(); keyIterator.hasNext(); ) { K key = keyIterator.next(); int keySegment = getSegmentForKey(key); if (keepSegments != segments.contains(keySegment)) { keyIterator.remove(); } } } }
public class class_name { private void clear(IntSet segments, boolean keepSegments) { for (Iterator<K> keyIterator = entries.keySet().iterator(); keyIterator.hasNext(); ) { K key = keyIterator.next(); int keySegment = getSegmentForKey(key); if (keepSegments != segments.contains(keySegment)) { keyIterator.remove(); // depends on control dependency: [if], data = [none] } } } }
public class class_name { @Override protected LessLockingUniversalPgSQLQueue createQueueInstance(final QueueSpec spec) { LessLockingUniversalPgSQLQueue queue = new LessLockingUniversalPgSQLQueue(); queue.setFifo(defaultFifo); Boolean fifo = spec.getField(SPEC_FIELD_FIFO, Boolean.class); if (fifo != null) { queue.setFifo(fifo.booleanValue()); } return queue; } }
public class class_name { @Override protected LessLockingUniversalPgSQLQueue createQueueInstance(final QueueSpec spec) { LessLockingUniversalPgSQLQueue queue = new LessLockingUniversalPgSQLQueue(); queue.setFifo(defaultFifo); Boolean fifo = spec.getField(SPEC_FIELD_FIFO, Boolean.class); if (fifo != null) { queue.setFifo(fifo.booleanValue()); // depends on control dependency: [if], data = [(fifo] } return queue; } }
public class class_name { public EntityBeanType<EnterpriseBeansType<T>> getOrCreateEntity() { List<Node> nodeList = childNode.get("entity"); if (nodeList != null && nodeList.size() > 0) { return new EntityBeanTypeImpl<EnterpriseBeansType<T>>(this, "entity", childNode, nodeList.get(0)); } return createEntity(); } }
public class class_name { public EntityBeanType<EnterpriseBeansType<T>> getOrCreateEntity() { List<Node> nodeList = childNode.get("entity"); if (nodeList != null && nodeList.size() > 0) { return new EntityBeanTypeImpl<EnterpriseBeansType<T>>(this, "entity", childNode, nodeList.get(0)); // depends on control dependency: [if], data = [none] } return createEntity(); } }
public class class_name { public UpdateDescription merge(@Nullable final UpdateDescription otherDescription) { if (otherDescription != null) { for (final Map.Entry<String, BsonValue> entry : this.updatedFields.entrySet()) { if (otherDescription.removedFields.contains(entry.getKey())) { this.updatedFields.remove(entry.getKey()); } } for (final String removedField : this.removedFields) { if (otherDescription.updatedFields.containsKey(removedField)) { this.removedFields.remove(removedField); } } this.removedFields.addAll(otherDescription.removedFields); this.updatedFields.putAll(otherDescription.updatedFields); } return this; } }
public class class_name { public UpdateDescription merge(@Nullable final UpdateDescription otherDescription) { if (otherDescription != null) { for (final Map.Entry<String, BsonValue> entry : this.updatedFields.entrySet()) { if (otherDescription.removedFields.contains(entry.getKey())) { this.updatedFields.remove(entry.getKey()); // depends on control dependency: [if], data = [none] } } for (final String removedField : this.removedFields) { if (otherDescription.updatedFields.containsKey(removedField)) { this.removedFields.remove(removedField); // depends on control dependency: [if], data = [none] } } this.removedFields.addAll(otherDescription.removedFields); // depends on control dependency: [if], data = [(otherDescription] this.updatedFields.putAll(otherDescription.updatedFields); // depends on control dependency: [if], data = [(otherDescription] } return this; } }
public class class_name { @Override public WebSphereBeanDeploymentArchive getBeanDeploymentArchive(Class<?> beanClass) { // Note this method looks for BDA containing a **bean** of the given class // We think this is the correct behavior for the weld CDI11Deployment interfaces for (WebSphereBeanDeploymentArchive bda : deploymentDBAs.values()) { if (bda.containsBeanClass(beanClass)) { return bda; } } return null; } }
public class class_name { @Override public WebSphereBeanDeploymentArchive getBeanDeploymentArchive(Class<?> beanClass) { // Note this method looks for BDA containing a **bean** of the given class // We think this is the correct behavior for the weld CDI11Deployment interfaces for (WebSphereBeanDeploymentArchive bda : deploymentDBAs.values()) { if (bda.containsBeanClass(beanClass)) { return bda; // depends on control dependency: [if], data = [none] } } return null; } }
public class class_name { @Override public void showErrors(List<EditorError> errors) { if (errorHandler != null) { if (errors == null || errors.isEmpty()) { errorHandler.clearErrors(); return; } errorHandler.showErrors(errors); } } }
public class class_name { @Override public void showErrors(List<EditorError> errors) { if (errorHandler != null) { if (errors == null || errors.isEmpty()) { errorHandler.clearErrors(); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } errorHandler.showErrors(errors); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void setLocalMatrix(int boneindex, Matrix4f mtx) { Bone bone = mBones[boneindex]; int parentid = mSkeleton.getParentBoneIndex(boneindex); bone.LocalMatrix.set(mtx); bone.Changed = Bone.LOCAL_ROT; if (parentid < 0) { bone.WorldMatrix.set(bone.LocalMatrix); } else { mNeedSync = true; } if (sDebug) { Log.d("BONE", "setLocalMatrix: %s %s", mSkeleton.getBoneName(boneindex), bone.toString()); } } }
public class class_name { public void setLocalMatrix(int boneindex, Matrix4f mtx) { Bone bone = mBones[boneindex]; int parentid = mSkeleton.getParentBoneIndex(boneindex); bone.LocalMatrix.set(mtx); bone.Changed = Bone.LOCAL_ROT; if (parentid < 0) { bone.WorldMatrix.set(bone.LocalMatrix); // depends on control dependency: [if], data = [none] } else { mNeedSync = true; // depends on control dependency: [if], data = [none] } if (sDebug) { Log.d("BONE", "setLocalMatrix: %s %s", mSkeleton.getBoneName(boneindex), bone.toString()); // depends on control dependency: [if], data = [none] } } }
public class class_name { public BsonDocument toUpdateDocument() { final List<BsonElement> unsets = new ArrayList<>(); for (final String removedField : this.removedFields) { unsets.add(new BsonElement(removedField, new BsonBoolean(true))); } final BsonDocument updateDocument = new BsonDocument(); if (this.updatedFields.size() > 0) { updateDocument.append("$set", this.updatedFields); } if (unsets.size() > 0) { updateDocument.append("$unset", new BsonDocument(unsets)); } return updateDocument; } }
public class class_name { public BsonDocument toUpdateDocument() { final List<BsonElement> unsets = new ArrayList<>(); for (final String removedField : this.removedFields) { unsets.add(new BsonElement(removedField, new BsonBoolean(true))); // depends on control dependency: [for], data = [removedField] } final BsonDocument updateDocument = new BsonDocument(); if (this.updatedFields.size() > 0) { updateDocument.append("$set", this.updatedFields); // depends on control dependency: [if], data = [none] } if (unsets.size() > 0) { updateDocument.append("$unset", new BsonDocument(unsets)); // depends on control dependency: [if], data = [none] } return updateDocument; } }
public class class_name { protected void sendMessage(CmsUUID toUserId, String message, boolean hasErrors) { CmsDbContext dbc = m_dbContextFactory.getDbContext(); try { CmsUser toUser = m_driverManager.readUser(dbc, toUserId); CmsUserSettings settings = new CmsUserSettings(toUser); if (settings.getShowPublishNotification() || hasErrors) { // only show message if publish notification is enabled or the message shows an error OpenCms.getSessionManager().sendBroadcast(null, message, toUser); } } catch (CmsException e) { dbc.rollback(); LOG.error(e.getLocalizedMessage(), e); } finally { dbc.clear(); } } }
public class class_name { protected void sendMessage(CmsUUID toUserId, String message, boolean hasErrors) { CmsDbContext dbc = m_dbContextFactory.getDbContext(); try { CmsUser toUser = m_driverManager.readUser(dbc, toUserId); CmsUserSettings settings = new CmsUserSettings(toUser); if (settings.getShowPublishNotification() || hasErrors) { // only show message if publish notification is enabled or the message shows an error OpenCms.getSessionManager().sendBroadcast(null, message, toUser); // depends on control dependency: [if], data = [none] } } catch (CmsException e) { dbc.rollback(); LOG.error(e.getLocalizedMessage(), e); } finally { // depends on control dependency: [catch], data = [none] dbc.clear(); } } }
public class class_name { private void checkReturnValue(Decl.FunctionOrMethod d, Environment last) { if (d.match(Modifier.Native.class) == null && last != FlowTypeUtils.BOTTOM && d.getReturns().size() != 0) { // In this case, code reaches the end of the function or method and, // furthermore, that this requires a return value. To get here means // that there was no explicit return statement given on at least one // execution path. syntaxError(d, MISSING_RETURN_STATEMENT); } } }
public class class_name { private void checkReturnValue(Decl.FunctionOrMethod d, Environment last) { if (d.match(Modifier.Native.class) == null && last != FlowTypeUtils.BOTTOM && d.getReturns().size() != 0) { // In this case, code reaches the end of the function or method and, // furthermore, that this requires a return value. To get here means // that there was no explicit return statement given on at least one // execution path. syntaxError(d, MISSING_RETURN_STATEMENT); // depends on control dependency: [if], data = [none] } } }
public class class_name { static String getFieldNameByGetter(Method getter, boolean forceCamelCase) { String getterName = getter.getName(); String fieldNameWithUpperCamelCase = ""; if ( getterName.startsWith("get") ) { fieldNameWithUpperCamelCase = getterName.substring("get".length()); } else if ( getterName.startsWith("is") ) { fieldNameWithUpperCamelCase = getterName.substring("is".length()); } if (fieldNameWithUpperCamelCase.length() == 0) { throw new DynamoDBMappingException( "Getter must begin with 'get' or 'is', and the field name must contain at least one character."); } if (forceCamelCase) { // Lowercase the first letter of the name return StringUtils.lowerCase(fieldNameWithUpperCamelCase.substring(0, 1)) + fieldNameWithUpperCamelCase.substring(1); } else { return fieldNameWithUpperCamelCase; } } }
public class class_name { static String getFieldNameByGetter(Method getter, boolean forceCamelCase) { String getterName = getter.getName(); String fieldNameWithUpperCamelCase = ""; if ( getterName.startsWith("get") ) { fieldNameWithUpperCamelCase = getterName.substring("get".length()); // depends on control dependency: [if], data = [none] } else if ( getterName.startsWith("is") ) { fieldNameWithUpperCamelCase = getterName.substring("is".length()); // depends on control dependency: [if], data = [none] } if (fieldNameWithUpperCamelCase.length() == 0) { throw new DynamoDBMappingException( "Getter must begin with 'get' or 'is', and the field name must contain at least one character."); } if (forceCamelCase) { // Lowercase the first letter of the name return StringUtils.lowerCase(fieldNameWithUpperCamelCase.substring(0, 1)) + fieldNameWithUpperCamelCase.substring(1); // depends on control dependency: [if], data = [none] } else { return fieldNameWithUpperCamelCase; // depends on control dependency: [if], data = [none] } } }
public class class_name { public static void printHelp(final Options options) { Collection<Option> c = options.getOptions(); System.out.println("Command line options are:"); int longestLongOption = 0; for (Option op : c) { if (op.getLongOpt().length() > longestLongOption) { longestLongOption = op.getLongOpt().length(); } } longestLongOption += 2; String spaces = StringUtils.repeat(" ", longestLongOption); for (Option op : c) { System.out.print("\t-" + op.getOpt() + " --" + op.getLongOpt()); if (op.getLongOpt().length() < spaces.length()) { System.out.print(spaces.substring(op.getLongOpt().length())); } else { System.out.print(" "); } System.out.println(op.getDescription()); } } }
public class class_name { public static void printHelp(final Options options) { Collection<Option> c = options.getOptions(); System.out.println("Command line options are:"); int longestLongOption = 0; for (Option op : c) { if (op.getLongOpt().length() > longestLongOption) { longestLongOption = op.getLongOpt().length(); // depends on control dependency: [if], data = [none] } } longestLongOption += 2; String spaces = StringUtils.repeat(" ", longestLongOption); for (Option op : c) { System.out.print("\t-" + op.getOpt() + " --" + op.getLongOpt()); // depends on control dependency: [for], data = [op] if (op.getLongOpt().length() < spaces.length()) { System.out.print(spaces.substring(op.getLongOpt().length())); // depends on control dependency: [if], data = [(op.getLongOpt().length()] } else { System.out.print(" "); // depends on control dependency: [if], data = [none] } System.out.println(op.getDescription()); // depends on control dependency: [for], data = [op] } } }
public class class_name { private Object invoke(String methodName, Object returnValueIfNonExistent, Class<?>[] paramTypes, Object[] params) throws DocletInvokeException { Method meth; try { meth = docletClass.getMethod(methodName, paramTypes); } catch (NoSuchMethodException exc) { if (returnValueIfNonExistent == null) { messager.error(Messager.NOPOS, "main.doclet_method_not_found", docletClassName, methodName); throw new DocletInvokeException(); } else { return returnValueIfNonExistent; } } catch (SecurityException exc) { messager.error(Messager.NOPOS, "main.doclet_method_not_accessible", docletClassName, methodName); throw new DocletInvokeException(); } if (!Modifier.isStatic(meth.getModifiers())) { messager.error(Messager.NOPOS, "main.doclet_method_must_be_static", docletClassName, methodName); throw new DocletInvokeException(); } ClassLoader savedCCL = Thread.currentThread().getContextClassLoader(); try { if (appClassLoader != null) // will be null if doclet class provided via API Thread.currentThread().setContextClassLoader(appClassLoader); return meth.invoke(null , params); } catch (IllegalArgumentException exc) { messager.error(Messager.NOPOS, "main.internal_error_exception_thrown", docletClassName, methodName, exc.toString()); throw new DocletInvokeException(); } catch (IllegalAccessException exc) { messager.error(Messager.NOPOS, "main.doclet_method_not_accessible", docletClassName, methodName); throw new DocletInvokeException(); } catch (NullPointerException exc) { messager.error(Messager.NOPOS, "main.internal_error_exception_thrown", docletClassName, methodName, exc.toString()); throw new DocletInvokeException(); } catch (InvocationTargetException exc) { Throwable err = exc.getTargetException(); if (apiMode) throw new ClientCodeException(err); if (err instanceof java.lang.OutOfMemoryError) { messager.error(Messager.NOPOS, "main.out.of.memory"); } else { messager.error(Messager.NOPOS, "main.exception_thrown", docletClassName, methodName, exc.toString()); exc.getTargetException().printStackTrace(); } throw new DocletInvokeException(); } finally { Thread.currentThread().setContextClassLoader(savedCCL); } } }
public class class_name { private Object invoke(String methodName, Object returnValueIfNonExistent, Class<?>[] paramTypes, Object[] params) throws DocletInvokeException { Method meth; try { meth = docletClass.getMethod(methodName, paramTypes); } catch (NoSuchMethodException exc) { if (returnValueIfNonExistent == null) { messager.error(Messager.NOPOS, "main.doclet_method_not_found", docletClassName, methodName); // depends on control dependency: [if], data = [none] throw new DocletInvokeException(); } else { return returnValueIfNonExistent; // depends on control dependency: [if], data = [none] } } catch (SecurityException exc) { messager.error(Messager.NOPOS, "main.doclet_method_not_accessible", docletClassName, methodName); throw new DocletInvokeException(); } if (!Modifier.isStatic(meth.getModifiers())) { messager.error(Messager.NOPOS, "main.doclet_method_must_be_static", docletClassName, methodName); throw new DocletInvokeException(); } ClassLoader savedCCL = Thread.currentThread().getContextClassLoader(); try { if (appClassLoader != null) // will be null if doclet class provided via API Thread.currentThread().setContextClassLoader(appClassLoader); return meth.invoke(null , params); } catch (IllegalArgumentException exc) { messager.error(Messager.NOPOS, "main.internal_error_exception_thrown", docletClassName, methodName, exc.toString()); throw new DocletInvokeException(); } catch (IllegalAccessException exc) { messager.error(Messager.NOPOS, "main.doclet_method_not_accessible", docletClassName, methodName); throw new DocletInvokeException(); } catch (NullPointerException exc) { messager.error(Messager.NOPOS, "main.internal_error_exception_thrown", docletClassName, methodName, exc.toString()); throw new DocletInvokeException(); } catch (InvocationTargetException exc) { Throwable err = exc.getTargetException(); if (apiMode) throw new ClientCodeException(err); if (err instanceof java.lang.OutOfMemoryError) { messager.error(Messager.NOPOS, "main.out.of.memory"); // depends on control dependency: [if], data = [none] } else { messager.error(Messager.NOPOS, "main.exception_thrown", docletClassName, methodName, exc.toString()); // depends on control dependency: [if], data = [none] exc.getTargetException().printStackTrace(); // depends on control dependency: [if], data = [none] } throw new DocletInvokeException(); } finally { Thread.currentThread().setContextClassLoader(savedCCL); } } }
public class class_name { private static String[] readSqlStatements(URL url) { try { char buffer[] = new char[256]; StringBuilder result = new StringBuilder(); InputStreamReader reader = new InputStreamReader(url.openStream(), "UTF-8"); while (true) { int count = reader.read(buffer); if (count < 0) { break; } result.append(buffer, 0, count); } return result.toString().split(";"); } catch (IOException ex) { throw new RuntimeException("Cannot read " + url, ex); } } }
public class class_name { private static String[] readSqlStatements(URL url) { try { char buffer[] = new char[256]; StringBuilder result = new StringBuilder(); InputStreamReader reader = new InputStreamReader(url.openStream(), "UTF-8"); while (true) { int count = reader.read(buffer); if (count < 0) { break; } result.append(buffer, 0, count); // depends on control dependency: [while], data = [none] } return result.toString().split(";"); // depends on control dependency: [try], data = [none] } catch (IOException ex) { throw new RuntimeException("Cannot read " + url, ex); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public Object getObject(int key) { if (key < 0) Kit.codeBug(); if (values != null) { int index = findIndex(key); if (0 <= index) { return values[index]; } } return null; } }
public class class_name { public Object getObject(int key) { if (key < 0) Kit.codeBug(); if (values != null) { int index = findIndex(key); if (0 <= index) { return values[index]; // depends on control dependency: [if], data = [none] } } return null; } }
public class class_name { public List<CmsXmlSitemapUrlBean> generateSitemapBeans() throws CmsException { String baseSitePath = m_siteGuestCms.getRequestContext().removeSiteRoot(m_baseFolderRootPath); initializeFileData(baseSitePath); for (CmsResource resource : getDirectPages()) { String sitePath = m_siteGuestCms.getSitePath(resource); List<CmsProperty> propertyList = m_siteGuestCms.readPropertyObjects(resource, true); String onlineLink = OpenCms.getLinkManager().getOnlineLink(m_siteGuestCms, sitePath); boolean isContainerPage = CmsResourceTypeXmlContainerPage.isContainerPage(resource); long dateModified = resource.getDateLastModified(); if (isContainerPage) { if (m_computeContainerPageDates) { dateModified = computeContainerPageModificationDate(resource); } else { dateModified = -1; } } CmsXmlSitemapUrlBean urlBean = new CmsXmlSitemapUrlBean( replaceServerUri(onlineLink), dateModified, getChangeFrequency(propertyList), getPriority(propertyList)); urlBean.setOriginalResource(resource); addResult(urlBean, 3); if (isContainerPage) { Locale locale = getLocale(resource, propertyList); addDetailLinks(resource, locale); } } for (CmsUUID aliasStructureId : m_pageAliasesBelowBaseFolderByStructureId.keySet()) { addAliasLinks(aliasStructureId); } List<CmsXmlSitemapUrlBean> result = new ArrayList<CmsXmlSitemapUrlBean>(); for (ResultEntry resultEntry : m_resultMap.values()) { result.add(resultEntry.getUrlBean()); } return result; } }
public class class_name { public List<CmsXmlSitemapUrlBean> generateSitemapBeans() throws CmsException { String baseSitePath = m_siteGuestCms.getRequestContext().removeSiteRoot(m_baseFolderRootPath); initializeFileData(baseSitePath); for (CmsResource resource : getDirectPages()) { String sitePath = m_siteGuestCms.getSitePath(resource); List<CmsProperty> propertyList = m_siteGuestCms.readPropertyObjects(resource, true); String onlineLink = OpenCms.getLinkManager().getOnlineLink(m_siteGuestCms, sitePath); boolean isContainerPage = CmsResourceTypeXmlContainerPage.isContainerPage(resource); long dateModified = resource.getDateLastModified(); if (isContainerPage) { if (m_computeContainerPageDates) { dateModified = computeContainerPageModificationDate(resource); // depends on control dependency: [if], data = [none] } else { dateModified = -1; // depends on control dependency: [if], data = [none] } } CmsXmlSitemapUrlBean urlBean = new CmsXmlSitemapUrlBean( replaceServerUri(onlineLink), dateModified, getChangeFrequency(propertyList), getPriority(propertyList)); urlBean.setOriginalResource(resource); addResult(urlBean, 3); if (isContainerPage) { Locale locale = getLocale(resource, propertyList); addDetailLinks(resource, locale); // depends on control dependency: [if], data = [none] } } for (CmsUUID aliasStructureId : m_pageAliasesBelowBaseFolderByStructureId.keySet()) { addAliasLinks(aliasStructureId); } List<CmsXmlSitemapUrlBean> result = new ArrayList<CmsXmlSitemapUrlBean>(); for (ResultEntry resultEntry : m_resultMap.values()) { result.add(resultEntry.getUrlBean()); } return result; } }
public class class_name { private void internalSearchNext( DeleteStack stack, int v1, int x1) { SearchComparator comp = searchComparator(SearchComparator.GT); _s = 0; _p = null; _eof = true; _current1.setVersion(v1); SearchNode sn = searchNode(); Object q = _index.iteratorFind(_dstack, comp, _last1.key(), sn); if (q != null) { _current1.setLocation(sn.foundNode(), sn.foundIndex()); _current1.setLocation(sn.key(), v1, x1); _s = NodeStack.VISIT_RIGHT; _p = sn.foundNode(); _eof = false; } } }
public class class_name { private void internalSearchNext( DeleteStack stack, int v1, int x1) { SearchComparator comp = searchComparator(SearchComparator.GT); _s = 0; _p = null; _eof = true; _current1.setVersion(v1); SearchNode sn = searchNode(); Object q = _index.iteratorFind(_dstack, comp, _last1.key(), sn); if (q != null) { _current1.setLocation(sn.foundNode(), sn.foundIndex()); // depends on control dependency: [if], data = [none] _current1.setLocation(sn.key(), v1, x1); // depends on control dependency: [if], data = [none] _s = NodeStack.VISIT_RIGHT; // depends on control dependency: [if], data = [none] _p = sn.foundNode(); // depends on control dependency: [if], data = [none] _eof = false; // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override @SuppressWarnings("unchecked") public StandardRule<T> using(String... factNames) { List<String> factNameList = Stream.of(factNames) .filter(name -> _factType.isInstance(_facts.getValue(name))) .collect(Collectors.toList()); if (_factNameMap.containsKey((getThen()).size())) { List<String> existingFactNames = _factNameMap.get((getThen()).size()); existingFactNames.addAll(factNameList); return this; } _factNameMap.put((getThen()).size(), factNameList); return this; } }
public class class_name { @Override @SuppressWarnings("unchecked") public StandardRule<T> using(String... factNames) { List<String> factNameList = Stream.of(factNames) .filter(name -> _factType.isInstance(_facts.getValue(name))) .collect(Collectors.toList()); if (_factNameMap.containsKey((getThen()).size())) { List<String> existingFactNames = _factNameMap.get((getThen()).size()); existingFactNames.addAll(factNameList); // depends on control dependency: [if], data = [none] return this; // depends on control dependency: [if], data = [none] } _factNameMap.put((getThen()).size(), factNameList); return this; } }
public class class_name { @Override public synchronized void onNext(final RuntimeStart runtimeStart) { LOG.log(Level.FINEST, "HttpRuntimeStartHandler: {0}", runtimeStart); try { httpServer.start(); LOG.log(Level.FINEST, "HttpRuntimeStartHandler complete."); } catch (final Exception e) { LOG.log(Level.SEVERE, "HttpRuntimeStartHandler cannot start the Server. {0}", e); throw new RuntimeException("HttpRuntimeStartHandler cannot start the Server.", e); } } }
public class class_name { @Override public synchronized void onNext(final RuntimeStart runtimeStart) { LOG.log(Level.FINEST, "HttpRuntimeStartHandler: {0}", runtimeStart); try { httpServer.start(); // depends on control dependency: [try], data = [none] LOG.log(Level.FINEST, "HttpRuntimeStartHandler complete."); // depends on control dependency: [try], data = [none] } catch (final Exception e) { LOG.log(Level.SEVERE, "HttpRuntimeStartHandler cannot start the Server. {0}", e); throw new RuntimeException("HttpRuntimeStartHandler cannot start the Server.", e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void marshall(PutScalingPolicyRequest putScalingPolicyRequest, ProtocolMarshaller protocolMarshaller) { if (putScalingPolicyRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(putScalingPolicyRequest.getPolicyName(), POLICYNAME_BINDING); protocolMarshaller.marshall(putScalingPolicyRequest.getServiceNamespace(), SERVICENAMESPACE_BINDING); protocolMarshaller.marshall(putScalingPolicyRequest.getResourceId(), RESOURCEID_BINDING); protocolMarshaller.marshall(putScalingPolicyRequest.getScalableDimension(), SCALABLEDIMENSION_BINDING); protocolMarshaller.marshall(putScalingPolicyRequest.getPolicyType(), POLICYTYPE_BINDING); protocolMarshaller.marshall(putScalingPolicyRequest.getStepScalingPolicyConfiguration(), STEPSCALINGPOLICYCONFIGURATION_BINDING); protocolMarshaller .marshall(putScalingPolicyRequest.getTargetTrackingScalingPolicyConfiguration(), TARGETTRACKINGSCALINGPOLICYCONFIGURATION_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(PutScalingPolicyRequest putScalingPolicyRequest, ProtocolMarshaller protocolMarshaller) { if (putScalingPolicyRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(putScalingPolicyRequest.getPolicyName(), POLICYNAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(putScalingPolicyRequest.getServiceNamespace(), SERVICENAMESPACE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(putScalingPolicyRequest.getResourceId(), RESOURCEID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(putScalingPolicyRequest.getScalableDimension(), SCALABLEDIMENSION_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(putScalingPolicyRequest.getPolicyType(), POLICYTYPE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(putScalingPolicyRequest.getStepScalingPolicyConfiguration(), STEPSCALINGPOLICYCONFIGURATION_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller .marshall(putScalingPolicyRequest.getTargetTrackingScalingPolicyConfiguration(), TARGETTRACKINGSCALINGPOLICYCONFIGURATION_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 void parseReferences(ArrayList<String> name) { String foreignTable = parseIdentifier(); Token token = scanToken(); ArrayList<String> foreignColumns = new ArrayList<String>(); if (token == Token.LPAREN) { _token = token; foreignColumns = parseColumnNames(); } else { _token = token; } } }
public class class_name { public void parseReferences(ArrayList<String> name) { String foreignTable = parseIdentifier(); Token token = scanToken(); ArrayList<String> foreignColumns = new ArrayList<String>(); if (token == Token.LPAREN) { _token = token; // depends on control dependency: [if], data = [none] foreignColumns = parseColumnNames(); // depends on control dependency: [if], data = [none] } else { _token = token; // depends on control dependency: [if], data = [none] } } }
public class class_name { public JsonObject toJson() { final JsonObjectBuilder builder = Json.createObjectBuilder(); builder.add(EL_DATA_TYPE, dataType); builder.add(EL_DATA_CONTENT_TYPE, dataContentTypeStr); if (meta == null) { return builder.build(); } builder.add(EL_META_TYPE, metaType); builder.add(EL_META_CONTENT_TYPE, metaContentTypeStr); if (meta instanceof JsonObject) { final JsonObject jo = (JsonObject) meta; return builder.add(metaType, jo).build(); } if (meta instanceof ToJsonCapable) { final ToJsonCapable tjc = (ToJsonCapable) meta; return builder.add(metaType, tjc.toJson()).build(); } if (meta instanceof Base64Data) { final Base64Data base64data = (Base64Data) meta; return builder.add(metaType, base64data.getEncoded()).build(); } throw new IllegalStateException("Unknown meta object type: " + meta.getClass()); } }
public class class_name { public JsonObject toJson() { final JsonObjectBuilder builder = Json.createObjectBuilder(); builder.add(EL_DATA_TYPE, dataType); builder.add(EL_DATA_CONTENT_TYPE, dataContentTypeStr); if (meta == null) { return builder.build(); // depends on control dependency: [if], data = [none] } builder.add(EL_META_TYPE, metaType); builder.add(EL_META_CONTENT_TYPE, metaContentTypeStr); if (meta instanceof JsonObject) { final JsonObject jo = (JsonObject) meta; return builder.add(metaType, jo).build(); // depends on control dependency: [if], data = [none] } if (meta instanceof ToJsonCapable) { final ToJsonCapable tjc = (ToJsonCapable) meta; return builder.add(metaType, tjc.toJson()).build(); // depends on control dependency: [if], data = [none] } if (meta instanceof Base64Data) { final Base64Data base64data = (Base64Data) meta; return builder.add(metaType, base64data.getEncoded()).build(); // depends on control dependency: [if], data = [none] } throw new IllegalStateException("Unknown meta object type: " + meta.getClass()); } }
public class class_name { @SuppressWarnings("unchecked") public void setSpellCheckerClass(String className) { try { Class<?> clazz = ClassLoading.forName(className, this); if (SpellChecker.class.isAssignableFrom(clazz)) { spellCheckerClass = (Class<? extends SpellChecker>)clazz; } else { log.warn("Invalid value for spellCheckerClass, {} " + "does not implement SpellChecker interface.", className); } } catch (ClassNotFoundException e) { log.warn("Invalid value for spellCheckerClass," + " class {} not found.", className); } } }
public class class_name { @SuppressWarnings("unchecked") public void setSpellCheckerClass(String className) { try { Class<?> clazz = ClassLoading.forName(className, this); if (SpellChecker.class.isAssignableFrom(clazz)) { spellCheckerClass = (Class<? extends SpellChecker>)clazz; // depends on control dependency: [if], data = [none] } else { log.warn("Invalid value for spellCheckerClass, {} " + "does not implement SpellChecker interface.", className); // depends on control dependency: [if], data = [none] } } catch (ClassNotFoundException e) { log.warn("Invalid value for spellCheckerClass," + " class {} not found.", className); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private JSType getJSType(Node n) { JSType jsType = n.getJSType(); if (jsType == null) { // TODO(nicksantos): This branch indicates a compiler bug, not worthy of // halting the compilation but we should log this and analyze to track // down why it happens. This is not critical and will be resolved over // time as the type checker is extended. return getNativeType(UNKNOWN_TYPE); } else { return jsType; } } }
public class class_name { private JSType getJSType(Node n) { JSType jsType = n.getJSType(); if (jsType == null) { // TODO(nicksantos): This branch indicates a compiler bug, not worthy of // halting the compilation but we should log this and analyze to track // down why it happens. This is not critical and will be resolved over // time as the type checker is extended. return getNativeType(UNKNOWN_TYPE); // depends on control dependency: [if], data = [none] } else { return jsType; // depends on control dependency: [if], data = [none] } } }
public class class_name { private opendap.dap.Attribute getAliasAttribute(AttributeTable att, Vector aNames) throws MalformedAliasException, UnresolvedAliasException { // Get the first node name form the vector. String aName = (String) aNames.get(0); // Get the list of child nodes from the AttributeTable Enumeration e = att.getNames(); while (e.hasMoreElements()) { // Get an Attribute String atName = (String) e.nextElement(); opendap.dap.Attribute a = att.getAttribute(atName); // Get the Attributes name and Normalize it. String normName = opendap.dap.DDS.normalize(a.getEncodedName()); // Are they the same? if (normName.equals(aName)) { // Make sure this reference doesn't pass through an Alias. if (a.isAlias()) { throw new MalformedAliasException("Aliases may NOT point to other aliases"); } //dump the name from the list of names. aNames.remove(0); // Are there more? if (aNames.size() == 0) { //No! We found it! return (a); } else if (a.isContainer()) { // Is this Attribute a container (it better be) try { // Recursively search for the rest of the name vector in the container. return (getAliasAttribute(a.getContainer(), aNames)); } catch (NoSuchAttributeException nsae) { throw new MalformedAliasException("Attribute " + a.getEncodedName() + " is not an attribute container. (AttributeTable) " + " It may not contain the attribute: " + aName); } } else { // Dead-end, through an exception! throw new MalformedAliasException("Attribute " + a.getEncodedName() + " is not an attribute container. (AttributeTable) " + " It may not contain the attribute: " + aName); } } } // Nothing Matched, so this search failed. throw new UnresolvedAliasException("The alias `" + currentAlias.getEncodedName() + "` references the attribute: `" + aName + "` which cannot be found."); } }
public class class_name { private opendap.dap.Attribute getAliasAttribute(AttributeTable att, Vector aNames) throws MalformedAliasException, UnresolvedAliasException { // Get the first node name form the vector. String aName = (String) aNames.get(0); // Get the list of child nodes from the AttributeTable Enumeration e = att.getNames(); while (e.hasMoreElements()) { // Get an Attribute String atName = (String) e.nextElement(); opendap.dap.Attribute a = att.getAttribute(atName); // Get the Attributes name and Normalize it. String normName = opendap.dap.DDS.normalize(a.getEncodedName()); // Are they the same? if (normName.equals(aName)) { // Make sure this reference doesn't pass through an Alias. if (a.isAlias()) { throw new MalformedAliasException("Aliases may NOT point to other aliases"); } //dump the name from the list of names. aNames.remove(0); // Are there more? if (aNames.size() == 0) { //No! We found it! return (a); // depends on control dependency: [if], data = [none] } else if (a.isContainer()) { // Is this Attribute a container (it better be) try { // Recursively search for the rest of the name vector in the container. return (getAliasAttribute(a.getContainer(), aNames)); // depends on control dependency: [try], data = [none] } catch (NoSuchAttributeException nsae) { throw new MalformedAliasException("Attribute " + a.getEncodedName() + " is not an attribute container. (AttributeTable) " + " It may not contain the attribute: " + aName); } // depends on control dependency: [catch], data = [none] } else { // Dead-end, through an exception! throw new MalformedAliasException("Attribute " + a.getEncodedName() + " is not an attribute container. (AttributeTable) " + " It may not contain the attribute: " + aName); } } } // Nothing Matched, so this search failed. throw new UnresolvedAliasException("The alias `" + currentAlias.getEncodedName() + "` references the attribute: `" + aName + "` which cannot be found."); } }
public class class_name { static void setFieldValue(DBObject document, Object entityObject, Attribute column, boolean isLob) { Object value = null; if (document != null) { value = isLob ? ((DBObject) document.get("metadata")).get(((AbstractAttribute) column).getJPAColumnName()) : document.get(((AbstractAttribute) column).getJPAColumnName()); } if (value != null) { Class javaType = column.getJavaType(); try { switch (AttributeType.getType(javaType)) { case MAP: PropertyAccessorHelper.set(entityObject, (Field) column.getJavaMember(), ((BasicDBObject) value).toMap()); break; case SET: List collectionValues = Arrays.asList(((BasicDBList) value).toArray()); PropertyAccessorHelper.set(entityObject, (Field) column.getJavaMember(), new HashSet(collectionValues)); break; case LIST: PropertyAccessorHelper.set(entityObject, (Field) column.getJavaMember(), Arrays.asList(((BasicDBList) value).toArray())); break; case POINT: BasicDBList list = (BasicDBList) value; Object xObj = list.get(0); Object yObj = list.get(1); if (xObj != null && yObj != null) { try { double x = Double.parseDouble(xObj.toString()); double y = Double.parseDouble(yObj.toString()); Point point = new Point(x, y); PropertyAccessorHelper.set(entityObject, (Field) column.getJavaMember(), point); } catch (NumberFormatException e) { log.error( "Error while reading geolocation data for column {} ; Reason - possible corrupt data, Caused by : .", column, e); throw new EntityReaderException("Error while reading geolocation data for column " + column + "; Reason - possible corrupt data.", e); } } break; case ENUM: EnumAccessor accessor = new EnumAccessor(); value = accessor.fromString(javaType, value.toString()); PropertyAccessorHelper.set(entityObject, (Field) column.getJavaMember(), value); break; case PRIMITIVE: value = MongoDBUtils.populateValue(value, value.getClass()); value = MongoDBUtils.getTranslatedObject(value, value.getClass(), javaType); PropertyAccessorHelper.set(entityObject, (Field) column.getJavaMember(), value); break; } } catch (PropertyAccessException paex) { log.error("Error while setting column {} value, caused by : .", ((AbstractAttribute) column).getJPAColumnName(), paex); throw new PersistenceException(paex); } } } }
public class class_name { static void setFieldValue(DBObject document, Object entityObject, Attribute column, boolean isLob) { Object value = null; if (document != null) { value = isLob ? ((DBObject) document.get("metadata")).get(((AbstractAttribute) column).getJPAColumnName()) : document.get(((AbstractAttribute) column).getJPAColumnName()); // depends on control dependency: [if], data = [none] } if (value != null) { Class javaType = column.getJavaType(); try { switch (AttributeType.getType(javaType)) { case MAP: PropertyAccessorHelper.set(entityObject, (Field) column.getJavaMember(), ((BasicDBObject) value).toMap()); break; case SET: List collectionValues = Arrays.asList(((BasicDBList) value).toArray()); PropertyAccessorHelper.set(entityObject, (Field) column.getJavaMember(), new HashSet(collectionValues)); break; case LIST: PropertyAccessorHelper.set(entityObject, (Field) column.getJavaMember(), Arrays.asList(((BasicDBList) value).toArray())); break; case POINT: BasicDBList list = (BasicDBList) value; Object xObj = list.get(0); Object yObj = list.get(1); if (xObj != null && yObj != null) { try { double x = Double.parseDouble(xObj.toString()); double y = Double.parseDouble(yObj.toString()); Point point = new Point(x, y); PropertyAccessorHelper.set(entityObject, (Field) column.getJavaMember(), point); // depends on control dependency: [try], data = [none] } catch (NumberFormatException e) { log.error( "Error while reading geolocation data for column {} ; Reason - possible corrupt data, Caused by : .", column, e); throw new EntityReaderException("Error while reading geolocation data for column " + column + "; Reason - possible corrupt data.", e); } // depends on control dependency: [catch], data = [none] } break; case ENUM: EnumAccessor accessor = new EnumAccessor(); value = accessor.fromString(javaType, value.toString()); PropertyAccessorHelper.set(entityObject, (Field) column.getJavaMember(), value); break; case PRIMITIVE: value = MongoDBUtils.populateValue(value, value.getClass()); value = MongoDBUtils.getTranslatedObject(value, value.getClass(), javaType); PropertyAccessorHelper.set(entityObject, (Field) column.getJavaMember(), value); break; } } catch (PropertyAccessException paex) { log.error("Error while setting column {} value, caused by : .", ((AbstractAttribute) column).getJPAColumnName(), paex); throw new PersistenceException(paex); } // depends on control dependency: [catch], data = [none] } } }
public class class_name { public boolean replace(JsonElement e1, JsonElement e2) { int index = indexOf(e1); if(index>=0) { set(index, e2); return true; } else { return false; } } }
public class class_name { public boolean replace(JsonElement e1, JsonElement e2) { int index = indexOf(e1); if(index>=0) { set(index, e2); // depends on control dependency: [if], data = [(index] return true; // depends on control dependency: [if], data = [none] } else { return false; // depends on control dependency: [if], data = [none] } } }
public class class_name { private static <L> Map<Name, TypeSet<ResourceType<L>>> buildTypeMapForConstructor( Collection<ResourceType<L>> allTypes) { TypeSetBuilder<ResourceType<L>> bldr = TypeSet.<ResourceType<L>> builder(); bldr.enabled(true); bldr.name(new Name("all")); for (ResourceType<L> type : allTypes) { bldr.type(type); } TypeSet<ResourceType<L>> typeSet = bldr.build(); return Collections.singletonMap(typeSet.getName(), typeSet); } }
public class class_name { private static <L> Map<Name, TypeSet<ResourceType<L>>> buildTypeMapForConstructor( Collection<ResourceType<L>> allTypes) { TypeSetBuilder<ResourceType<L>> bldr = TypeSet.<ResourceType<L>> builder(); bldr.enabled(true); bldr.name(new Name("all")); for (ResourceType<L> type : allTypes) { bldr.type(type); // depends on control dependency: [for], data = [type] } TypeSet<ResourceType<L>> typeSet = bldr.build(); return Collections.singletonMap(typeSet.getName(), typeSet); } }
public class class_name { public static void filters(Filter filter, Filter... additionalFilters) { Validate.notNull(filter, "Filter cannot be null"); RestAssured.filters.add(filter); if (additionalFilters != null) { Collections.addAll(RestAssured.filters, additionalFilters); } } }
public class class_name { public static void filters(Filter filter, Filter... additionalFilters) { Validate.notNull(filter, "Filter cannot be null"); RestAssured.filters.add(filter); if (additionalFilters != null) { Collections.addAll(RestAssured.filters, additionalFilters); // depends on control dependency: [if], data = [none] } } }
public class class_name { Dimension getNetcdfStrlenDim(DODSVariable v) { AttributeTable table = das.getAttributeTableN(v.getFullName()); // LOOK this probably doesnt work for nested variables if (table == null) return null; opendap.dap.Attribute dodsAtt = table.getAttribute("DODS"); if (dodsAtt == null) return null; AttributeTable dodsTable = dodsAtt.getContainerN(); if (dodsTable == null) return null; opendap.dap.Attribute att = dodsTable.getAttribute("strlen"); if (att == null) return null; String strlen = att.getValueAtN(0); opendap.dap.Attribute att2 = dodsTable.getAttribute("dimName"); String dimName = (att2 == null) ? null : att2.getValueAtN(0); if (debugCharArray) System.out.println(v.getFullName() + " has strlen= " + strlen + " dimName= " + dimName); int dimLength; try { dimLength = Integer.parseInt(strlen); } catch (NumberFormatException e) { logger.warn("DODSNetcdfFile " + location + " var = " + v.getFullName() + " error on strlen attribute = " + strlen); return null; } if (dimLength <= 0) return null; // LOOK what about unlimited ?? return new Dimension(dimName, dimLength, dimName != null); } }
public class class_name { Dimension getNetcdfStrlenDim(DODSVariable v) { AttributeTable table = das.getAttributeTableN(v.getFullName()); // LOOK this probably doesnt work for nested variables if (table == null) return null; opendap.dap.Attribute dodsAtt = table.getAttribute("DODS"); if (dodsAtt == null) return null; AttributeTable dodsTable = dodsAtt.getContainerN(); if (dodsTable == null) return null; opendap.dap.Attribute att = dodsTable.getAttribute("strlen"); if (att == null) return null; String strlen = att.getValueAtN(0); opendap.dap.Attribute att2 = dodsTable.getAttribute("dimName"); String dimName = (att2 == null) ? null : att2.getValueAtN(0); if (debugCharArray) System.out.println(v.getFullName() + " has strlen= " + strlen + " dimName= " + dimName); int dimLength; try { dimLength = Integer.parseInt(strlen); // depends on control dependency: [try], data = [none] } catch (NumberFormatException e) { logger.warn("DODSNetcdfFile " + location + " var = " + v.getFullName() + " error on strlen attribute = " + strlen); return null; } // depends on control dependency: [catch], data = [none] if (dimLength <= 0) return null; // LOOK what about unlimited ?? return new Dimension(dimName, dimLength, dimName != null); } }
public class class_name { public static String getCharsetFromContentType(String type) { init(); if (type == null) { return null; } int semi = type.indexOf(";"); if (semi == -1) { return null; } String afterSemi = type.substring(semi + 1); int charsetLocation = afterSemi.indexOf("charset="); if (charsetLocation == -1) { return null; } return afterSemi.substring(charsetLocation + 8).trim(); } }
public class class_name { public static String getCharsetFromContentType(String type) { init(); if (type == null) { return null; // depends on control dependency: [if], data = [none] } int semi = type.indexOf(";"); if (semi == -1) { return null; // depends on control dependency: [if], data = [none] } String afterSemi = type.substring(semi + 1); int charsetLocation = afterSemi.indexOf("charset="); if (charsetLocation == -1) { return null; // depends on control dependency: [if], data = [none] } return afterSemi.substring(charsetLocation + 8).trim(); } }
public class class_name { public static Set<String> process(CopyResourcesMojo copyResourcesMojo, Set<String> excludes, Set<String> files) { copyResourcesMojo.getLog().debug("Start exclude."); if (excludes == null || files == null) { return files; } Set<String> retval = new HashSet<String>(); AntPathMatcher antPathMatcher = new AntPathMatcher(); for (String pattern : excludes) { copyResourcesMojo.getLog().debug( "Process exclude with pattern : '" + pattern + "'."); for (String path : files) { boolean match = antPathMatcher.match(pattern, FileUtils.normalizePath(path)); copyResourcesMojo.getLog().debug( "Test pattern on file : '" + path + "', result is : '" + match + "'."); if (!match) { retval.add(path); } } } return retval; } }
public class class_name { public static Set<String> process(CopyResourcesMojo copyResourcesMojo, Set<String> excludes, Set<String> files) { copyResourcesMojo.getLog().debug("Start exclude."); if (excludes == null || files == null) { return files; // depends on control dependency: [if], data = [none] } Set<String> retval = new HashSet<String>(); AntPathMatcher antPathMatcher = new AntPathMatcher(); for (String pattern : excludes) { copyResourcesMojo.getLog().debug( "Process exclude with pattern : '" + pattern + "'."); // depends on control dependency: [for], data = [none] for (String path : files) { boolean match = antPathMatcher.match(pattern, FileUtils.normalizePath(path)); copyResourcesMojo.getLog().debug( "Test pattern on file : '" + path + "', result is : '" + match + "'."); // depends on control dependency: [for], data = [none] if (!match) { retval.add(path); // depends on control dependency: [if], data = [none] } } } return retval; } }
public class class_name { public static final Date parseDateTime(String value) { Date result = null; try { if (value != null && !value.isEmpty()) { result = DATE_TIME_FORMAT.get().parse(value); } } catch (ParseException ex) { // Ignore } return result; } }
public class class_name { public static final Date parseDateTime(String value) { Date result = null; try { if (value != null && !value.isEmpty()) { result = DATE_TIME_FORMAT.get().parse(value); // depends on control dependency: [if], data = [(value] } } catch (ParseException ex) { // Ignore } // depends on control dependency: [catch], data = [none] return result; } }
public class class_name { public List<String> introspect() { List<String> rc = new LinkedList<String>(); String prefix = getClass().getSimpleName() + "@" + hashCode() + ": "; rc.add(prefix + "closed=" + this.closed); rc.add(prefix + "processClose=" + this.processClose); rc.add(prefix + "checkCancel=" + this.checkCancel); rc.add(prefix + "tcpChannel=" + this.tcpChannel); rc.add(prefix + "socket=" + this.socket); if (null != this.socket) { rc.add(prefix + "remoteAddr=" + this.socket.getInetAddress()); rc.add(prefix + "remotePort=" + this.socket.getPort()); rc.add(prefix + "localAddr=" + this.socket.getLocalAddress()); rc.add(prefix + "localPort=" + this.socket.getLocalPort()); } rc.add(prefix + "channel=" + this.channel); return rc; } }
public class class_name { public List<String> introspect() { List<String> rc = new LinkedList<String>(); String prefix = getClass().getSimpleName() + "@" + hashCode() + ": "; rc.add(prefix + "closed=" + this.closed); rc.add(prefix + "processClose=" + this.processClose); rc.add(prefix + "checkCancel=" + this.checkCancel); rc.add(prefix + "tcpChannel=" + this.tcpChannel); rc.add(prefix + "socket=" + this.socket); if (null != this.socket) { rc.add(prefix + "remoteAddr=" + this.socket.getInetAddress()); // depends on control dependency: [if], data = [none] rc.add(prefix + "remotePort=" + this.socket.getPort()); // depends on control dependency: [if], data = [none] rc.add(prefix + "localAddr=" + this.socket.getLocalAddress()); // depends on control dependency: [if], data = [none] rc.add(prefix + "localPort=" + this.socket.getLocalPort()); // depends on control dependency: [if], data = [none] } rc.add(prefix + "channel=" + this.channel); return rc; } }
public class class_name { void genCode(String name, ArrayList<JFile> ilist, ArrayList<JRecord> rlist, String destDir, ArrayList<String> options) throws IOException { name = new File(destDir, (new File(name)).getName()).getAbsolutePath(); FileWriter cc = new FileWriter(name+".cc"); try { FileWriter hh = new FileWriter(name+".hh"); try { String fileName = (new File(name)).getName(); hh.write("#ifndef __"+fileName.toUpperCase().replace('.','_')+"__\n"); hh.write("#define __"+fileName.toUpperCase().replace('.','_')+"__\n"); hh.write("#include \"recordio.hh\"\n"); hh.write("#include \"recordTypeInfo.hh\"\n"); for (Iterator<JFile> iter = ilist.iterator(); iter.hasNext();) { hh.write("#include \""+iter.next().getName()+".hh\"\n"); } cc.write("#include \""+fileName+".hh\"\n"); cc.write("#include \"utils.hh\"\n"); for (Iterator<JRecord> iter = rlist.iterator(); iter.hasNext();) { iter.next().genCppCode(hh, cc, options); } hh.write("#endif //"+fileName.toUpperCase().replace('.','_')+"__\n"); } finally { hh.close(); } } finally { cc.close(); } } }
public class class_name { void genCode(String name, ArrayList<JFile> ilist, ArrayList<JRecord> rlist, String destDir, ArrayList<String> options) throws IOException { name = new File(destDir, (new File(name)).getName()).getAbsolutePath(); FileWriter cc = new FileWriter(name+".cc"); try { FileWriter hh = new FileWriter(name+".hh"); try { String fileName = (new File(name)).getName(); hh.write("#ifndef __"+fileName.toUpperCase().replace('.','_')+"__\n"); // depends on control dependency: [try], data = [none] hh.write("#define __"+fileName.toUpperCase().replace('.','_')+"__\n"); // depends on control dependency: [try], data = [none] hh.write("#include \"recordio.hh\"\n"); // depends on control dependency: [try], data = [none] hh.write("#include \"recordTypeInfo.hh\"\n"); // depends on control dependency: [try], data = [none] for (Iterator<JFile> iter = ilist.iterator(); iter.hasNext();) { hh.write("#include \""+iter.next().getName()+".hh\"\n"); // depends on control dependency: [for], data = [iter] } cc.write("#include \""+fileName+".hh\"\n"); // depends on control dependency: [try], data = [none] cc.write("#include \"utils.hh\"\n"); // depends on control dependency: [try], data = [none] for (Iterator<JRecord> iter = rlist.iterator(); iter.hasNext();) { iter.next().genCppCode(hh, cc, options); // depends on control dependency: [for], data = [iter] } hh.write("#endif //"+fileName.toUpperCase().replace('.','_')+"__\n"); } finally { hh.close(); // depends on control dependency: [try], data = [none] } } finally { cc.close(); } } }
public class class_name { private boolean checkPlTaxNumber(final String ptaxNumber) { final int checkSum = ptaxNumber.charAt(ptaxNumber.length() - 1) - '0'; int calculatedCheckSum; if (StringUtils.length(ptaxNumber) == 11) { // PESEL final int sum = (ptaxNumber.charAt(0) - '0') * 1 // + (ptaxNumber.charAt(1) - '0') * 3 // + (ptaxNumber.charAt(2) - '0') * 7 // + (ptaxNumber.charAt(3) - '0') * 9 // + (ptaxNumber.charAt(4) - '0') * 1 // + (ptaxNumber.charAt(5) - '0') * 3 // + (ptaxNumber.charAt(6) - '0') * 7 // + (ptaxNumber.charAt(7) - '0') * 9 // + (ptaxNumber.charAt(8) - '0') * 1 // + (ptaxNumber.charAt(9) - '0') * 3; calculatedCheckSum = sum % 10; if (calculatedCheckSum != 0) { calculatedCheckSum = 10 - sum % 10; } } else { // NIP final int sum = (ptaxNumber.charAt(0) - '0') * 6 // + (ptaxNumber.charAt(1) - '0') * 5 // + (ptaxNumber.charAt(2) - '0') * 7 // + (ptaxNumber.charAt(3) - '0') * 2 // + (ptaxNumber.charAt(4) - '0') * 3 // + (ptaxNumber.charAt(5) - '0') * 4 // + (ptaxNumber.charAt(6) - '0') * 5 // + (ptaxNumber.charAt(7) - '0') * 6 // + (ptaxNumber.charAt(8) - '0') * 7; calculatedCheckSum = sum % MODULO_11; } return checkSum == calculatedCheckSum; } }
public class class_name { private boolean checkPlTaxNumber(final String ptaxNumber) { final int checkSum = ptaxNumber.charAt(ptaxNumber.length() - 1) - '0'; int calculatedCheckSum; if (StringUtils.length(ptaxNumber) == 11) { // PESEL final int sum = (ptaxNumber.charAt(0) - '0') * 1 // + (ptaxNumber.charAt(1) - '0') * 3 // + (ptaxNumber.charAt(2) - '0') * 7 // + (ptaxNumber.charAt(3) - '0') * 9 // + (ptaxNumber.charAt(4) - '0') * 1 // + (ptaxNumber.charAt(5) - '0') * 3 // + (ptaxNumber.charAt(6) - '0') * 7 // + (ptaxNumber.charAt(7) - '0') * 9 // + (ptaxNumber.charAt(8) - '0') * 1 // + (ptaxNumber.charAt(9) - '0') * 3; calculatedCheckSum = sum % 10; // depends on control dependency: [if], data = [none] if (calculatedCheckSum != 0) { calculatedCheckSum = 10 - sum % 10; // depends on control dependency: [if], data = [none] } } else { // NIP final int sum = (ptaxNumber.charAt(0) - '0') * 6 // + (ptaxNumber.charAt(1) - '0') * 5 // + (ptaxNumber.charAt(2) - '0') * 7 // + (ptaxNumber.charAt(3) - '0') * 2 // + (ptaxNumber.charAt(4) - '0') * 3 // + (ptaxNumber.charAt(5) - '0') * 4 // + (ptaxNumber.charAt(6) - '0') * 5 // + (ptaxNumber.charAt(7) - '0') * 6 // + (ptaxNumber.charAt(8) - '0') * 7; calculatedCheckSum = sum % MODULO_11; // depends on control dependency: [if], data = [none] } return checkSum == calculatedCheckSum; } }
public class class_name { public List<Set<K>> kmeans(int nclusters) { Cluster<K> cluster = new Cluster<K>(); for (Document<K> document : documents_.values()) { cluster.add_document(document); } cluster.section(nclusters); refine_clusters(cluster.sectioned_clusters()); List<Cluster<K>> clusters_ = new ArrayList<Cluster<K>>(nclusters); for (Cluster<K> s : cluster.sectioned_clusters()) { s.refresh(); clusters_.add(s); } return toResult(clusters_); } }
public class class_name { public List<Set<K>> kmeans(int nclusters) { Cluster<K> cluster = new Cluster<K>(); for (Document<K> document : documents_.values()) { cluster.add_document(document); // depends on control dependency: [for], data = [document] } cluster.section(nclusters); refine_clusters(cluster.sectioned_clusters()); List<Cluster<K>> clusters_ = new ArrayList<Cluster<K>>(nclusters); for (Cluster<K> s : cluster.sectioned_clusters()) { s.refresh(); // depends on control dependency: [for], data = [s] clusters_.add(s); // depends on control dependency: [for], data = [s] } return toResult(clusters_); } }
public class class_name { private static List<CharSequence> splitHeader(CharSequence header) { final StringBuilder builder = new StringBuilder(header.length()); final List<CharSequence> protocols = new ArrayList<CharSequence>(4); for (int i = 0; i < header.length(); ++i) { char c = header.charAt(i); if (Character.isWhitespace(c)) { // Don't include any whitespace. continue; } if (c == ',') { // Add the string and reset the builder for the next protocol. protocols.add(builder.toString()); builder.setLength(0); } else { builder.append(c); } } // Add the last protocol if (builder.length() > 0) { protocols.add(builder.toString()); } return protocols; } }
public class class_name { private static List<CharSequence> splitHeader(CharSequence header) { final StringBuilder builder = new StringBuilder(header.length()); final List<CharSequence> protocols = new ArrayList<CharSequence>(4); for (int i = 0; i < header.length(); ++i) { char c = header.charAt(i); if (Character.isWhitespace(c)) { // Don't include any whitespace. continue; } if (c == ',') { // Add the string and reset the builder for the next protocol. protocols.add(builder.toString()); // depends on control dependency: [if], data = [none] builder.setLength(0); // depends on control dependency: [if], data = [none] } else { builder.append(c); // depends on control dependency: [if], data = [(c] } } // Add the last protocol if (builder.length() > 0) { protocols.add(builder.toString()); // depends on control dependency: [if], data = [none] } return protocols; } }