code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { public void marshall(DescribeApplicationRequest describeApplicationRequest, ProtocolMarshaller protocolMarshaller) { if (describeApplicationRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(describeApplicationRequest.getApplicationName(), APPLICATIONNAME_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(DescribeApplicationRequest describeApplicationRequest, ProtocolMarshaller protocolMarshaller) { if (describeApplicationRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(describeApplicationRequest.getApplicationName(), APPLICATIONNAME_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 Jid getPresenceMapKey(Jid user) { Jid key = user; if (!contains(user)) { key = user.asEntityBareJidIfPossible(); } return key; } }
public class class_name { private Jid getPresenceMapKey(Jid user) { Jid key = user; if (!contains(user)) { key = user.asEntityBareJidIfPossible(); // depends on control dependency: [if], data = [none] } return key; } }
public class class_name { private void showLookup(int n) { for (int i=0; i<n; i++) { System.out.println( result.get(i) ); } } }
public class class_name { private void showLookup(int n) { for (int i=0; i<n; i++) { System.out.println( result.get(i) ); // depends on control dependency: [for], data = [i] } } }
public class class_name { public void alias(final @NonNull String newId, final @Nullable Options options) { assertNotShutdown(); if (isNullOrEmpty(newId)) { throw new IllegalArgumentException("newId must not be null or empty."); } analyticsExecutor.submit( new Runnable() { @Override public void run() { final Options finalOptions; if (options == null) { finalOptions = defaultOptions; } else { finalOptions = options; } AliasPayload.Builder builder = new AliasPayload.Builder() .userId(newId) .previousId(analyticsContext.traits().currentId()); fillAndEnqueue(builder, finalOptions); } }); } }
public class class_name { public void alias(final @NonNull String newId, final @Nullable Options options) { assertNotShutdown(); if (isNullOrEmpty(newId)) { throw new IllegalArgumentException("newId must not be null or empty."); } analyticsExecutor.submit( new Runnable() { @Override public void run() { final Options finalOptions; if (options == null) { finalOptions = defaultOptions; // depends on control dependency: [if], data = [none] } else { finalOptions = options; // depends on control dependency: [if], data = [none] } AliasPayload.Builder builder = new AliasPayload.Builder() .userId(newId) .previousId(analyticsContext.traits().currentId()); fillAndEnqueue(builder, finalOptions); } }); } }
public class class_name { protected <T, C> T processExecuteGroup(String name, C criteria, T result, Connection conn) throws CpoException { CallableStatement cstmt = null; CpoClass criteriaClass; T returnObject = null; Logger localLogger = criteria == null ? logger : LoggerFactory.getLogger(criteria.getClass()); JdbcCallableStatementFactory jcsf = null; if (criteria == null || result == null) { throw new CpoException("NULL Object passed into executeObject"); } try { criteriaClass = metaDescriptor.getMetaClass(criteria); List<CpoFunction> functions = criteriaClass.getFunctionGroup(JdbcCpoAdapter.EXECUTE_GROUP, name).getFunctions(); localLogger.info("===================processExecuteGroup (" + name + ") Count<" + functions.size() + ">========================="); try { returnObject = (T) result.getClass().newInstance(); } catch (IllegalAccessException iae) { throw new CpoException("Unable to access the constructor of the Return Object", iae); } catch (InstantiationException iae) { throw new CpoException("Unable to instantiate Return Object", iae); } // Loop through the queries and process each one for (CpoFunction function : functions) { localLogger.debug("Executing Call:" + criteriaClass.getName() + ":" + name); jcsf = new JdbcCallableStatementFactory(conn, this, function, criteria); cstmt = jcsf.getCallableStatement(); cstmt.execute(); jcsf.release(); localLogger.debug("Processing Call:" + criteriaClass.getName() + ":" + name); // Add Code here to go through the arguments, find record sets, // and process them // Process the non-record set out params and make it the first // object in the collection // Loop through the OUT Parameters and set them in the result // object int j = 1; for (CpoArgument cpoArgument : jcsf.getOutArguments()) { JdbcCpoArgument jdbcArgument = (JdbcCpoArgument) cpoArgument; if (jdbcArgument.isOutParameter()) { JdbcCpoAttribute jdbcAttribute = jdbcArgument.getAttribute(); jdbcAttribute.invokeSetter(returnObject, new CallableStatementCpoData(cstmt, jdbcAttribute, j)); } j++; } cstmt.close(); } } catch (Throwable t) { String msg = "ProcessExecuteGroup(String name, Object criteria, Object result, Connection conn) failed. SQL="; localLogger.error(msg, t); throw new CpoException(msg, t); } finally { statementClose(cstmt); if (jcsf != null) { jcsf.release(); } } return returnObject; } }
public class class_name { protected <T, C> T processExecuteGroup(String name, C criteria, T result, Connection conn) throws CpoException { CallableStatement cstmt = null; CpoClass criteriaClass; T returnObject = null; Logger localLogger = criteria == null ? logger : LoggerFactory.getLogger(criteria.getClass()); JdbcCallableStatementFactory jcsf = null; if (criteria == null || result == null) { throw new CpoException("NULL Object passed into executeObject"); } try { criteriaClass = metaDescriptor.getMetaClass(criteria); List<CpoFunction> functions = criteriaClass.getFunctionGroup(JdbcCpoAdapter.EXECUTE_GROUP, name).getFunctions(); localLogger.info("===================processExecuteGroup (" + name + ") Count<" + functions.size() + ">========================="); try { returnObject = (T) result.getClass().newInstance(); // depends on control dependency: [try], data = [none] } catch (IllegalAccessException iae) { throw new CpoException("Unable to access the constructor of the Return Object", iae); } catch (InstantiationException iae) { // depends on control dependency: [catch], data = [none] throw new CpoException("Unable to instantiate Return Object", iae); } // depends on control dependency: [catch], data = [none] // Loop through the queries and process each one for (CpoFunction function : functions) { localLogger.debug("Executing Call:" + criteriaClass.getName() + ":" + name); // depends on control dependency: [for], data = [none] jcsf = new JdbcCallableStatementFactory(conn, this, function, criteria); // depends on control dependency: [for], data = [function] cstmt = jcsf.getCallableStatement(); // depends on control dependency: [for], data = [none] cstmt.execute(); // depends on control dependency: [for], data = [none] jcsf.release(); // depends on control dependency: [for], data = [none] localLogger.debug("Processing Call:" + criteriaClass.getName() + ":" + name); // depends on control dependency: [for], data = [none] // Add Code here to go through the arguments, find record sets, // and process them // Process the non-record set out params and make it the first // object in the collection // Loop through the OUT Parameters and set them in the result // object int j = 1; for (CpoArgument cpoArgument : jcsf.getOutArguments()) { JdbcCpoArgument jdbcArgument = (JdbcCpoArgument) cpoArgument; if (jdbcArgument.isOutParameter()) { JdbcCpoAttribute jdbcAttribute = jdbcArgument.getAttribute(); jdbcAttribute.invokeSetter(returnObject, new CallableStatementCpoData(cstmt, jdbcAttribute, j)); // depends on control dependency: [if], data = [none] } j++; // depends on control dependency: [for], data = [none] } cstmt.close(); // depends on control dependency: [for], data = [none] } } catch (Throwable t) { String msg = "ProcessExecuteGroup(String name, Object criteria, Object result, Connection conn) failed. SQL="; localLogger.error(msg, t); throw new CpoException(msg, t); } finally { statementClose(cstmt); if (jcsf != null) { jcsf.release(); // depends on control dependency: [if], data = [none] } } return returnObject; } }
public class class_name { private void addPostParams(final Request request) { if (friendlyName != null) { request.addPostParam("FriendlyName", friendlyName); } if (eventCallbackUrl != null) { request.addPostParam("EventCallbackUrl", eventCallbackUrl.toString()); } if (eventsFilter != null) { request.addPostParam("EventsFilter", eventsFilter); } if (multiTaskEnabled != null) { request.addPostParam("MultiTaskEnabled", multiTaskEnabled.toString()); } if (template != null) { request.addPostParam("Template", template); } if (prioritizeQueueOrder != null) { request.addPostParam("PrioritizeQueueOrder", prioritizeQueueOrder.toString()); } } }
public class class_name { private void addPostParams(final Request request) { if (friendlyName != null) { request.addPostParam("FriendlyName", friendlyName); // depends on control dependency: [if], data = [none] } if (eventCallbackUrl != null) { request.addPostParam("EventCallbackUrl", eventCallbackUrl.toString()); // depends on control dependency: [if], data = [none] } if (eventsFilter != null) { request.addPostParam("EventsFilter", eventsFilter); // depends on control dependency: [if], data = [none] } if (multiTaskEnabled != null) { request.addPostParam("MultiTaskEnabled", multiTaskEnabled.toString()); // depends on control dependency: [if], data = [none] } if (template != null) { request.addPostParam("Template", template); // depends on control dependency: [if], data = [none] } if (prioritizeQueueOrder != null) { request.addPostParam("PrioritizeQueueOrder", prioritizeQueueOrder.toString()); // depends on control dependency: [if], data = [none] } } }
public class class_name { public boolean[] setEnableListeners(boolean bEnable) { int iCount = 0; FieldListener fieldBehavior = this.getListener(); while (fieldBehavior != null) { fieldBehavior = (FieldListener)fieldBehavior.getNextListener(); iCount++; } boolean[] rgbEnabled = null; if (iCount == 0) rgbEnabled = EMPTY_RG_BOOLEAN; else rgbEnabled = new boolean[iCount]; int iIndex = 0; fieldBehavior = this.getListener(); while (fieldBehavior != null) { rgbEnabled[iIndex] = fieldBehavior.isEnabledListener(); fieldBehavior.setEnabledListener(bEnable); fieldBehavior = (FieldListener)fieldBehavior.getNextListener(); iIndex++; } return rgbEnabled; } }
public class class_name { public boolean[] setEnableListeners(boolean bEnable) { int iCount = 0; FieldListener fieldBehavior = this.getListener(); while (fieldBehavior != null) { fieldBehavior = (FieldListener)fieldBehavior.getNextListener(); // depends on control dependency: [while], data = [none] iCount++; // depends on control dependency: [while], data = [none] } boolean[] rgbEnabled = null; if (iCount == 0) rgbEnabled = EMPTY_RG_BOOLEAN; else rgbEnabled = new boolean[iCount]; int iIndex = 0; fieldBehavior = this.getListener(); while (fieldBehavior != null) { rgbEnabled[iIndex] = fieldBehavior.isEnabledListener(); // depends on control dependency: [while], data = [none] fieldBehavior.setEnabledListener(bEnable); // depends on control dependency: [while], data = [none] fieldBehavior = (FieldListener)fieldBehavior.getNextListener(); // depends on control dependency: [while], data = [none] iIndex++; // depends on control dependency: [while], data = [none] } return rgbEnabled; } }
public class class_name { public Vector2f intersect(Line other, boolean limit) { Vector2f temp = new Vector2f(); if (!intersect(other, limit, temp)) { return null; } return temp; } }
public class class_name { public Vector2f intersect(Line other, boolean limit) { Vector2f temp = new Vector2f(); if (!intersect(other, limit, temp)) { return null; // depends on control dependency: [if], data = [none] } return temp; } }
public class class_name { public static IntegerVector addUnmodified(IntegerVector vector1, IntegerVector vector2) { if (vector2.length() != vector1.length()) throw new IllegalArgumentException( "Vectors of different sizes cannot be added"); IntegerVector finalVector = Vectors.copyOf(vector1); // If vector is a sparse vector, simply get the non zero values and // add them to this instance. if (vector2 instanceof SparseVector) addSparseValues(finalVector, vector2); else if (vector2 instanceof TernaryVector) addTernaryValues(finalVector, (TernaryVector)vector2); else { // Otherwise, inspect all values of vector, and only add the non // zero values. int length = vector2.length(); for (int i = 0; i < length; ++i) { int value = vector2.get(i); finalVector.add(i, value); } } return finalVector; } }
public class class_name { public static IntegerVector addUnmodified(IntegerVector vector1, IntegerVector vector2) { if (vector2.length() != vector1.length()) throw new IllegalArgumentException( "Vectors of different sizes cannot be added"); IntegerVector finalVector = Vectors.copyOf(vector1); // If vector is a sparse vector, simply get the non zero values and // add them to this instance. if (vector2 instanceof SparseVector) addSparseValues(finalVector, vector2); else if (vector2 instanceof TernaryVector) addTernaryValues(finalVector, (TernaryVector)vector2); else { // Otherwise, inspect all values of vector, and only add the non // zero values. int length = vector2.length(); for (int i = 0; i < length; ++i) { int value = vector2.get(i); finalVector.add(i, value); // depends on control dependency: [for], data = [i] } } return finalVector; } }
public class class_name { public void addListener(MetricRegistryListener listener) { listeners.add(listener); for (Map.Entry<MetricName, Metric> entry : metrics.entrySet()) { notifyListenerOfAddedMetric(listener, entry.getValue(), entry.getKey()); } } }
public class class_name { public void addListener(MetricRegistryListener listener) { listeners.add(listener); for (Map.Entry<MetricName, Metric> entry : metrics.entrySet()) { notifyListenerOfAddedMetric(listener, entry.getValue(), entry.getKey()); // depends on control dependency: [for], data = [entry] } } }
public class class_name { public synchronized void close() { if(closed) return; // recursive calls ok closed = true; // mark as closed to prevent recursive calls if(methodstream != null) { try { this.methodstream.close(); // May recursr } catch (IOException ioe) {/*failure is ok*/} this.methodstream = null; } // Force release underlying connection back to the connection manager if(this.lastresponse != null) { if(false) { try { try { // Attempt to keep connection alive by consuming its remaining content EntityUtils.consume(this.lastresponse.getEntity()); } finally { HttpClientUtils.closeQuietly(this.lastresponse); // Paranoia } } catch (IOException ignore) {/*ignore*/} } else HttpClientUtils.closeQuietly(this.lastresponse); this.lastresponse = null; } if(session != null) { session.removeMethod(this); if(localsession) { session.close(); session = null; } } this.lastrequest = null; } }
public class class_name { public synchronized void close() { if(closed) return; // recursive calls ok closed = true; // mark as closed to prevent recursive calls if(methodstream != null) { try { this.methodstream.close(); // May recursr // depends on control dependency: [try], data = [none] } catch (IOException ioe) {/*failure is ok*/} // depends on control dependency: [catch], data = [none] this.methodstream = null; // depends on control dependency: [if], data = [none] } // Force release underlying connection back to the connection manager if(this.lastresponse != null) { if(false) { try { try { // Attempt to keep connection alive by consuming its remaining content EntityUtils.consume(this.lastresponse.getEntity()); // depends on control dependency: [try], data = [none] } finally { HttpClientUtils.closeQuietly(this.lastresponse); // Paranoia } } catch (IOException ignore) {/*ignore*/} // depends on control dependency: [catch], data = [none] } else HttpClientUtils.closeQuietly(this.lastresponse); this.lastresponse = null; // depends on control dependency: [if], data = [none] } if(session != null) { session.removeMethod(this); // depends on control dependency: [if], data = [none] if(localsession) { session.close(); // depends on control dependency: [if], data = [none] session = null; // depends on control dependency: [if], data = [none] } } this.lastrequest = null; } }
public class class_name { private String[] createLabels(final String id, final Object[] keys) { String[] messages = new String[keys.length]; for (int i = 0; i < messages.length; ++i) { messages[i] = getApplicationConfig().messageResolver().getMessage(id, keys[i] == null ? "null" : keys[i].toString(), "label"); } return messages; } }
public class class_name { private String[] createLabels(final String id, final Object[] keys) { String[] messages = new String[keys.length]; for (int i = 0; i < messages.length; ++i) { messages[i] = getApplicationConfig().messageResolver().getMessage(id, keys[i] == null ? "null" : keys[i].toString(), "label"); // depends on control dependency: [for], data = [i] } return messages; } }
public class class_name { public void marshall(Update update, ProtocolMarshaller protocolMarshaller) { if (update == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(update.getKey(), KEY_BINDING); protocolMarshaller.marshall(update.getUpdateExpression(), UPDATEEXPRESSION_BINDING); protocolMarshaller.marshall(update.getTableName(), TABLENAME_BINDING); protocolMarshaller.marshall(update.getConditionExpression(), CONDITIONEXPRESSION_BINDING); protocolMarshaller.marshall(update.getExpressionAttributeNames(), EXPRESSIONATTRIBUTENAMES_BINDING); protocolMarshaller.marshall(update.getExpressionAttributeValues(), EXPRESSIONATTRIBUTEVALUES_BINDING); protocolMarshaller.marshall(update.getReturnValuesOnConditionCheckFailure(), RETURNVALUESONCONDITIONCHECKFAILURE_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(Update update, ProtocolMarshaller protocolMarshaller) { if (update == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(update.getKey(), KEY_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(update.getUpdateExpression(), UPDATEEXPRESSION_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(update.getTableName(), TABLENAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(update.getConditionExpression(), CONDITIONEXPRESSION_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(update.getExpressionAttributeNames(), EXPRESSIONATTRIBUTENAMES_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(update.getExpressionAttributeValues(), EXPRESSIONATTRIBUTEVALUES_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(update.getReturnValuesOnConditionCheckFailure(), RETURNVALUESONCONDITIONCHECKFAILURE_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public long getContentLength() { try { return getInternalResponse().body().contentLength(); } catch (NullPointerException e){ logger.error("Failed to get the response content length from " + getRequestURL() + ". Error: " + e.getMessage()); return 0; } } }
public class class_name { public long getContentLength() { try { return getInternalResponse().body().contentLength(); // depends on control dependency: [try], data = [none] } catch (NullPointerException e){ logger.error("Failed to get the response content length from " + getRequestURL() + ". Error: " + e.getMessage()); return 0; } // depends on control dependency: [catch], data = [none] } }
public class class_name { private void readWeekDay(ProjectCalendar mpxjCalendar, WeekDay day) { if (day.isIsDayWorking()) { ProjectCalendarHours hours = mpxjCalendar.addCalendarHours(day.getDay()); for (Document.Calendars.Calendar.WeekDays.WeekDay.TimePeriods.TimePeriod period : day.getTimePeriods().getTimePeriod()) { hours.addRange(new DateRange(period.getFrom(), period.getTo())); } } } }
public class class_name { private void readWeekDay(ProjectCalendar mpxjCalendar, WeekDay day) { if (day.isIsDayWorking()) { ProjectCalendarHours hours = mpxjCalendar.addCalendarHours(day.getDay()); for (Document.Calendars.Calendar.WeekDays.WeekDay.TimePeriods.TimePeriod period : day.getTimePeriods().getTimePeriod()) { hours.addRange(new DateRange(period.getFrom(), period.getTo())); // depends on control dependency: [for], data = [period] } } } }
public class class_name { public void clear() { iMinPrintedDigits = 1; iPrintZeroSetting = PRINT_ZERO_RARELY_LAST; iMaxParsedDigits = 10; iRejectSignedValues = false; iPrefix = null; if (iElementPairs == null) { iElementPairs = new ArrayList<Object>(); } else { iElementPairs.clear(); } iNotPrinter = false; iNotParser = false; iFieldFormatters = new FieldFormatter[10]; } }
public class class_name { public void clear() { iMinPrintedDigits = 1; iPrintZeroSetting = PRINT_ZERO_RARELY_LAST; iMaxParsedDigits = 10; iRejectSignedValues = false; iPrefix = null; if (iElementPairs == null) { iElementPairs = new ArrayList<Object>(); // depends on control dependency: [if], data = [none] } else { iElementPairs.clear(); // depends on control dependency: [if], data = [none] } iNotPrinter = false; iNotParser = false; iFieldFormatters = new FieldFormatter[10]; } }
public class class_name { void updateHost() { try { _cachedLocalHostName.set(_wrappedHostResolver.getLocalHostName()); } catch (final UnknownHostException e) { LOGGER.warn("Unable to resolve host", e); } } }
public class class_name { void updateHost() { try { _cachedLocalHostName.set(_wrappedHostResolver.getLocalHostName()); // depends on control dependency: [try], data = [none] } catch (final UnknownHostException e) { LOGGER.warn("Unable to resolve host", e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private void parseClass(byte[] bytes) { try { this.classbytes = bytes; this.ptr = 0; int magic = readInt(); // magic 0xCAFEBABE if (magic != 0xCAFEBABE) { throw new IllegalStateException("not bytecode, magic was 0x" + Integer.toString(magic, 16)); } ptr += 4; // skip minor and major versions cpsize = readUnsignedShort(); if (DEBUG) { System.out.println("Constant Pool Size =" + cpsize); } cpdata = new Object[cpsize]; type = new int[cpsize]; for (int cpentry = 1; cpentry < cpsize; cpentry++) { boolean wasDoubleSlotItem = processConstantPoolEntry(cpentry); if (wasDoubleSlotItem) { cpentry++; } } ptr += 2; // access flags int thisclassname = readUnsignedShort(); int classindex = ((Integer) cpdata[thisclassname]); slashedclassname = accessUtf8(classindex); } catch (Exception e) { throw new IllegalStateException("Unexpected problem processing bytes for class", e); } } }
public class class_name { private void parseClass(byte[] bytes) { try { this.classbytes = bytes; // depends on control dependency: [try], data = [none] this.ptr = 0; // depends on control dependency: [try], data = [none] int magic = readInt(); // magic 0xCAFEBABE if (magic != 0xCAFEBABE) { throw new IllegalStateException("not bytecode, magic was 0x" + Integer.toString(magic, 16)); } ptr += 4; // skip minor and major versions // depends on control dependency: [try], data = [none] cpsize = readUnsignedShort(); // depends on control dependency: [try], data = [none] if (DEBUG) { System.out.println("Constant Pool Size =" + cpsize); // depends on control dependency: [if], data = [none] } cpdata = new Object[cpsize]; // depends on control dependency: [try], data = [none] type = new int[cpsize]; // depends on control dependency: [try], data = [none] for (int cpentry = 1; cpentry < cpsize; cpentry++) { boolean wasDoubleSlotItem = processConstantPoolEntry(cpentry); if (wasDoubleSlotItem) { cpentry++; // depends on control dependency: [if], data = [none] } } ptr += 2; // access flags // depends on control dependency: [try], data = [none] int thisclassname = readUnsignedShort(); int classindex = ((Integer) cpdata[thisclassname]); slashedclassname = accessUtf8(classindex); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new IllegalStateException("Unexpected problem processing bytes for class", e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static String normalizeEntityName(String possibleEntityString) { if (possibleEntityString == null) { return null; } if ("/".equals(possibleEntityString)) { return "/"; } final StringBuilder result = new StringBuilder(); if (possibleEntityString.contains("/")) { final String[] names = StringUtils.split(possibleEntityString, "/"); for (String possibleEntityName : names) { // CAUTION: this cache might grow to a very large size, as it // contains all normalized mappings for every possible // property key / entity name that is ever called. String normalizedType = normalizedEntityNameCache.get(possibleEntityName); if (normalizedType == null) { normalizedType = StringUtils.capitalize(CaseHelper.toUpperCamelCase(stem(possibleEntityName))); } result.append(normalizedType).append("/"); } return StringUtils.removeEnd(result.toString(), "/"); } else { // CAUTION: this cache might grow to a very large size, as it // contains all normalized mappings for every possible // property key / entity name that is ever called. String normalizedType = normalizedEntityNameCache.get(possibleEntityString); if (normalizedType == null) { normalizedType = StringUtils.capitalize(CaseHelper.toUpperCamelCase(stem(possibleEntityString))); } return normalizedType; } } }
public class class_name { public static String normalizeEntityName(String possibleEntityString) { if (possibleEntityString == null) { return null; // depends on control dependency: [if], data = [none] } if ("/".equals(possibleEntityString)) { return "/"; // depends on control dependency: [if], data = [none] } final StringBuilder result = new StringBuilder(); if (possibleEntityString.contains("/")) { final String[] names = StringUtils.split(possibleEntityString, "/"); for (String possibleEntityName : names) { // CAUTION: this cache might grow to a very large size, as it // contains all normalized mappings for every possible // property key / entity name that is ever called. String normalizedType = normalizedEntityNameCache.get(possibleEntityName); if (normalizedType == null) { normalizedType = StringUtils.capitalize(CaseHelper.toUpperCamelCase(stem(possibleEntityName))); // depends on control dependency: [if], data = [none] } result.append(normalizedType).append("/"); // depends on control dependency: [for], data = [none] } return StringUtils.removeEnd(result.toString(), "/"); // depends on control dependency: [if], data = [none] } else { // CAUTION: this cache might grow to a very large size, as it // contains all normalized mappings for every possible // property key / entity name that is ever called. String normalizedType = normalizedEntityNameCache.get(possibleEntityString); if (normalizedType == null) { normalizedType = StringUtils.capitalize(CaseHelper.toUpperCamelCase(stem(possibleEntityString))); // depends on control dependency: [if], data = [none] } return normalizedType; // depends on control dependency: [if], data = [none] } } }
public class class_name { private int checkLink(final StringBuilder out, final String in, final int start, final MarkToken token) { boolean isAbbrev = false; int pos = start + (token == MarkToken.LINK ? 1 : 2); final StringBuilder temp = new StringBuilder(); temp.setLength(0); pos = Utils.readMdLinkId(temp, in, pos); if (pos < start) { return -1; } final String name = temp.toString(); String link = null, comment = null; final int oldPos = pos++; pos = Utils.skipSpaces(in, pos); if (pos < start) { final LinkRef lr = this.linkRefs.get(name.toLowerCase()); if (lr != null) { isAbbrev = lr.isAbbrev; link = lr.link; comment = lr.title; pos = oldPos; } else { return -1; } } else if (in.charAt(pos) == '(') { pos++; pos = Utils.skipSpaces(in, pos); if (pos < start) { return -1; } temp.setLength(0); final boolean useLt = in.charAt(pos) == '<'; pos = useLt ? Utils.readUntil(temp, in, pos + 1, '>') : Utils.readMdLink(temp, in, pos); if (pos < start) { return -1; } if (useLt) { pos++; } link = temp.toString(); if (in.charAt(pos) == ' ') { pos = Utils.skipSpaces(in, pos); if (pos > start && in.charAt(pos) == '"') { pos++; temp.setLength(0); pos = Utils.readUntil(temp, in, pos, '"'); if (pos < start) { return -1; } comment = temp.toString(); pos++; pos = Utils.skipSpaces(in, pos); if (pos == -1) { return -1; } } } if (in.charAt(pos) != ')') { return -1; } } else if (in.charAt(pos) == '[') { pos++; temp.setLength(0); pos = Utils.readRawUntil(temp, in, pos, ']'); if (pos < start) { return -1; } final String id = temp.length() > 0 ? temp.toString() : name; final LinkRef lr = this.linkRefs.get(id.toLowerCase()); if (lr != null) { link = lr.link; comment = lr.title; } } else { final LinkRef lr = this.linkRefs.get(name.toLowerCase()); if (lr != null) { isAbbrev = lr.isAbbrev; link = lr.link; comment = lr.title; pos = oldPos; } else { return -1; } } if (link == null) { return -1; } if (token == MarkToken.LINK) { if (isAbbrev && comment != null) { if (!this.useExtensions) { return -1; } out.append("<abbr title=\""); Utils.appendValue(out, comment, 0, comment.length()); out.append("\">"); this.recursiveEmitLine(out, name, 0, MarkToken.NONE); out.append("</abbr>"); } else { this.config.decorator.openLink(out); out.append(" href=\""); Utils.appendValue(out, link, 0, link.length()); out.append('"'); if (comment != null) { out.append(" title=\""); Utils.appendValue(out, comment, 0, comment.length()); out.append('"'); } out.append('>'); this.recursiveEmitLine(out, name, 0, MarkToken.NONE); this.config.decorator.closeLink(out); } } else { this.config.decorator.openImage(out); out.append(" src=\""); Utils.appendValue(out, link, 0, link.length()); out.append("\" alt=\""); Utils.appendValue(out, name, 0, name.length()); out.append('"'); if (comment != null) { out.append(" title=\""); Utils.appendValue(out, comment, 0, comment.length()); out.append('"'); } this.config.decorator.closeImage(out); } return pos; } }
public class class_name { private int checkLink(final StringBuilder out, final String in, final int start, final MarkToken token) { boolean isAbbrev = false; int pos = start + (token == MarkToken.LINK ? 1 : 2); final StringBuilder temp = new StringBuilder(); temp.setLength(0); pos = Utils.readMdLinkId(temp, in, pos); if (pos < start) { return -1; // depends on control dependency: [if], data = [none] } final String name = temp.toString(); String link = null, comment = null; final int oldPos = pos++; pos = Utils.skipSpaces(in, pos); if (pos < start) { final LinkRef lr = this.linkRefs.get(name.toLowerCase()); if (lr != null) { isAbbrev = lr.isAbbrev; // depends on control dependency: [if], data = [none] link = lr.link; // depends on control dependency: [if], data = [none] comment = lr.title; // depends on control dependency: [if], data = [none] pos = oldPos; // depends on control dependency: [if], data = [none] } else { return -1; // depends on control dependency: [if], data = [none] } } else if (in.charAt(pos) == '(') { pos++; // depends on control dependency: [if], data = [none] pos = Utils.skipSpaces(in, pos); // depends on control dependency: [if], data = [none] if (pos < start) { return -1; // depends on control dependency: [if], data = [none] } temp.setLength(0); // depends on control dependency: [if], data = [none] final boolean useLt = in.charAt(pos) == '<'; pos = useLt ? Utils.readUntil(temp, in, pos + 1, '>') : Utils.readMdLink(temp, in, pos); // depends on control dependency: [if], data = [none] if (pos < start) { return -1; // depends on control dependency: [if], data = [none] } if (useLt) { pos++; // depends on control dependency: [if], data = [none] } link = temp.toString(); // depends on control dependency: [if], data = [none] if (in.charAt(pos) == ' ') { pos = Utils.skipSpaces(in, pos); // depends on control dependency: [if], data = [none] if (pos > start && in.charAt(pos) == '"') { pos++; // depends on control dependency: [if], data = [none] temp.setLength(0); // depends on control dependency: [if], data = [none] pos = Utils.readUntil(temp, in, pos, '"'); // depends on control dependency: [if], data = ['"')] if (pos < start) { return -1; // depends on control dependency: [if], data = [none] } comment = temp.toString(); // depends on control dependency: [if], data = [none] pos++; // depends on control dependency: [if], data = [none] pos = Utils.skipSpaces(in, pos); // depends on control dependency: [if], data = [none] if (pos == -1) { return -1; // depends on control dependency: [if], data = [none] } } } if (in.charAt(pos) != ')') { return -1; // depends on control dependency: [if], data = [none] } } else if (in.charAt(pos) == '[') { pos++; // depends on control dependency: [if], data = [none] temp.setLength(0); // depends on control dependency: [if], data = [none] pos = Utils.readRawUntil(temp, in, pos, ']'); // depends on control dependency: [if], data = [none] if (pos < start) { return -1; // depends on control dependency: [if], data = [none] } final String id = temp.length() > 0 ? temp.toString() : name; final LinkRef lr = this.linkRefs.get(id.toLowerCase()); if (lr != null) { link = lr.link; // depends on control dependency: [if], data = [none] comment = lr.title; // depends on control dependency: [if], data = [none] } } else { final LinkRef lr = this.linkRefs.get(name.toLowerCase()); if (lr != null) { isAbbrev = lr.isAbbrev; // depends on control dependency: [if], data = [none] link = lr.link; // depends on control dependency: [if], data = [none] comment = lr.title; // depends on control dependency: [if], data = [none] pos = oldPos; // depends on control dependency: [if], data = [none] } else { return -1; // depends on control dependency: [if], data = [none] } } if (link == null) { return -1; // depends on control dependency: [if], data = [none] } if (token == MarkToken.LINK) { if (isAbbrev && comment != null) { if (!this.useExtensions) { return -1; // depends on control dependency: [if], data = [none] } out.append("<abbr title=\""); // depends on control dependency: [if], data = [none] Utils.appendValue(out, comment, 0, comment.length()); // depends on control dependency: [if], data = [none] out.append("\">"); // depends on control dependency: [if], data = [none] this.recursiveEmitLine(out, name, 0, MarkToken.NONE); // depends on control dependency: [if], data = [none] out.append("</abbr>"); // depends on control dependency: [if], data = [none] } else { this.config.decorator.openLink(out); // depends on control dependency: [if], data = [none] out.append(" href=\""); // depends on control dependency: [if], data = [none] Utils.appendValue(out, link, 0, link.length()); // depends on control dependency: [if], data = [none] out.append('"'); // depends on control dependency: [if], data = [none] if (comment != null) { out.append(" title=\""); // depends on control dependency: [if], data = [none] Utils.appendValue(out, comment, 0, comment.length()); // depends on control dependency: [if], data = [none] out.append('"'); // depends on control dependency: [if], data = [none] } out.append('>'); // depends on control dependency: [if], data = [none] this.recursiveEmitLine(out, name, 0, MarkToken.NONE); // depends on control dependency: [if], data = [none] this.config.decorator.closeLink(out); // depends on control dependency: [if], data = [none] } } else { this.config.decorator.openImage(out); // depends on control dependency: [if], data = [none] out.append(" src=\""); // depends on control dependency: [if], data = [none] Utils.appendValue(out, link, 0, link.length()); // depends on control dependency: [if], data = [none] out.append("\" alt=\""); // depends on control dependency: [if], data = [none] Utils.appendValue(out, name, 0, name.length()); // depends on control dependency: [if], data = [none] out.append('"'); // depends on control dependency: [if], data = [none] if (comment != null) { out.append(" title=\""); // depends on control dependency: [if], data = [none] Utils.appendValue(out, comment, 0, comment.length()); // depends on control dependency: [if], data = [none] out.append('"'); // depends on control dependency: [if], data = [none] } this.config.decorator.closeImage(out); // depends on control dependency: [if], data = [none] } return pos; } }
public class class_name { public List<Widget> getAll() { List<Widget> all = new ArrayList<Widget>(); Iterator<Widget> it = m_buttonPanelLeft.iterator(); while (it.hasNext()) { all.add(it.next()); } it = m_buttonPanelRight.iterator(); while (it.hasNext()) { all.add(it.next()); } return all; } }
public class class_name { public List<Widget> getAll() { List<Widget> all = new ArrayList<Widget>(); Iterator<Widget> it = m_buttonPanelLeft.iterator(); while (it.hasNext()) { all.add(it.next()); // depends on control dependency: [while], data = [none] } it = m_buttonPanelRight.iterator(); while (it.hasNext()) { all.add(it.next()); // depends on control dependency: [while], data = [none] } return all; } }
public class class_name { public static byte[] encodeToByte(String s) { try { return encodeToByte(s.getBytes(ENCODING), false); } catch (UnsupportedEncodingException ignore) { return null; } } }
public class class_name { public static byte[] encodeToByte(String s) { try { return encodeToByte(s.getBytes(ENCODING), false); // depends on control dependency: [try], data = [none] } catch (UnsupportedEncodingException ignore) { return null; } // depends on control dependency: [catch], data = [none] } }
public class class_name { public Packet putLong(long l, ByteOrder order) { var buffer = HEAP_BUFFER_POOL.take(Long.BYTES); var array = buffer.putLong(order == ByteOrder.LITTLE_ENDIAN ? Long.reverseBytes(l) : l).array(); try { return enqueue(Arrays.copyOfRange(array, 0, Long.BYTES)); } finally { HEAP_BUFFER_POOL.give(buffer); } } }
public class class_name { public Packet putLong(long l, ByteOrder order) { var buffer = HEAP_BUFFER_POOL.take(Long.BYTES); var array = buffer.putLong(order == ByteOrder.LITTLE_ENDIAN ? Long.reverseBytes(l) : l).array(); try { return enqueue(Arrays.copyOfRange(array, 0, Long.BYTES)); // depends on control dependency: [try], data = [none] } finally { HEAP_BUFFER_POOL.give(buffer); } } }
public class class_name { public static void writeResults(final String name, final Object output) { Writer writer = null; try { writer = new BufferedWriter( new OutputStreamWriter( new FileOutputStream(name + ".json"), "utf-8")); writer.write(output.toString()); } catch (IOException ignored) { } finally { try {writer.close();} catch (Exception ignored) {} } } }
public class class_name { public static void writeResults(final String name, final Object output) { Writer writer = null; try { writer = new BufferedWriter( new OutputStreamWriter( new FileOutputStream(name + ".json"), "utf-8")); // depends on control dependency: [try], data = [none] writer.write(output.toString()); // depends on control dependency: [try], data = [none] } catch (IOException ignored) { } finally { // depends on control dependency: [catch], data = [none] try {writer.close();} // depends on control dependency: [try], data = [none] catch (Exception ignored) {} // depends on control dependency: [catch], data = [none] } } }
public class class_name { public boolean add(T item) { ListNode<T> node = new ListNode<>(item); synchronized (this.lock) { if (this.tail == null) { // List is currently empty. this.head = node; } else { if (item.getSequenceNumber() <= this.tail.item.getSequenceNumber()) { // Item to be added is not in order - reject it. return false; } this.tail.next = node; } this.tail = node; } return true; } }
public class class_name { public boolean add(T item) { ListNode<T> node = new ListNode<>(item); synchronized (this.lock) { if (this.tail == null) { // List is currently empty. this.head = node; // depends on control dependency: [if], data = [none] } else { if (item.getSequenceNumber() <= this.tail.item.getSequenceNumber()) { // Item to be added is not in order - reject it. return false; // depends on control dependency: [if], data = [none] } this.tail.next = node; // depends on control dependency: [if], data = [none] } this.tail = node; } return true; } }
public class class_name { public static Uri notifyChange(Uri uri, long id, boolean notify) { Builder builder = uri.buildUpon(); if (id > 0) { ContentUris.appendId(builder, id); } return builder.appendQueryParameter(NOTIFY_CHANGE, notify ? "1" : "0").build(); } }
public class class_name { public static Uri notifyChange(Uri uri, long id, boolean notify) { Builder builder = uri.buildUpon(); if (id > 0) { ContentUris.appendId(builder, id); // depends on control dependency: [if], data = [none] } return builder.appendQueryParameter(NOTIFY_CHANGE, notify ? "1" : "0").build(); } }
public class class_name { @Override public boolean existSql(final String sqlPath) { if (!cache) { return sqlLoader.existSql(sqlPath); } else { return sqlMap.get(sqlPath.replace(".", "/")) != null; } } }
public class class_name { @Override public boolean existSql(final String sqlPath) { if (!cache) { return sqlLoader.existSql(sqlPath); // depends on control dependency: [if], data = [none] } else { return sqlMap.get(sqlPath.replace(".", "/")) != null; // depends on control dependency: [if], data = [none] } } }
public class class_name { protected String replaceDisits(final String value) { if(value.equals("0")) { return numMap[0]; } // 4桁ごとに、分割する。 final int length = value.length(); final List<String> split4 = new ArrayList<>(); for(int i=0; i < length; i=i+4) { // 下の桁から切り出す int end = length -i; int start; if(i + 4 < length) { start = end - 4; } else { start = 0; } String item = value.substring(start, end); split4.add(item); } // 4桁ごとに変換を行う。 final List<String> digits = new ArrayList<>(); for(int i=0; i < split4.size(); i++) { String item = split4.get(i); item = replace4Digits(item) + digits10Map[i]; digits.add(item); } /* * 文字列に直す。 * ・桁数が逆順になっているので、戻し結合する。 */ Collections.reverse(digits); StringBuilder sb = new StringBuilder(); for(String item : digits) { sb.append(item); } return sb.toString(); } }
public class class_name { protected String replaceDisits(final String value) { if(value.equals("0")) { return numMap[0]; // depends on control dependency: [if], data = [none] } // 4桁ごとに、分割する。 final int length = value.length(); final List<String> split4 = new ArrayList<>(); for(int i=0; i < length; i=i+4) { // 下の桁から切り出す int end = length -i; int start; if(i + 4 < length) { start = end - 4; // depends on control dependency: [if], data = [none] } else { start = 0; // depends on control dependency: [if], data = [none] } String item = value.substring(start, end); split4.add(item); // depends on control dependency: [for], data = [none] } // 4桁ごとに変換を行う。 final List<String> digits = new ArrayList<>(); for(int i=0; i < split4.size(); i++) { String item = split4.get(i); item = replace4Digits(item) + digits10Map[i]; // depends on control dependency: [for], data = [i] digits.add(item); // depends on control dependency: [for], data = [none] } /* * 文字列に直す。 * ・桁数が逆順になっているので、戻し結合する。 */ Collections.reverse(digits); StringBuilder sb = new StringBuilder(); for(String item : digits) { sb.append(item); // depends on control dependency: [for], data = [item] } return sb.toString(); } }
public class class_name { public BioCLocation getTotalLocation() { checkArgument(getLocationCount() > 0, "No location added"); RangeSet<Integer> rangeSet = TreeRangeSet.create(); for (BioCLocation location : getLocations()) { rangeSet.add( Range.closedOpen(location.getOffset(), location.getOffset() + location.getLength())); } Range<Integer> totalSpan = rangeSet.span(); return new BioCLocation(totalSpan.lowerEndpoint(), totalSpan.upperEndpoint() - totalSpan.lowerEndpoint()); } }
public class class_name { public BioCLocation getTotalLocation() { checkArgument(getLocationCount() > 0, "No location added"); RangeSet<Integer> rangeSet = TreeRangeSet.create(); for (BioCLocation location : getLocations()) { rangeSet.add( Range.closedOpen(location.getOffset(), location.getOffset() + location.getLength())); // depends on control dependency: [for], data = [none] } Range<Integer> totalSpan = rangeSet.span(); return new BioCLocation(totalSpan.lowerEndpoint(), totalSpan.upperEndpoint() - totalSpan.lowerEndpoint()); } }
public class class_name { private static Object unwrap(Object object) { if (object instanceof Reflector) { return ((Reflector) object).get(); } return object; } }
public class class_name { private static Object unwrap(Object object) { if (object instanceof Reflector) { return ((Reflector) object).get(); // depends on control dependency: [if], data = [none] } return object; } }
public class class_name { public static void main(String[] argvs) { List<String[]> sentences = new ArrayList<>(); List<PennTreebankPOS[]> labels = new ArrayList<>(); load("D:\\sourceforge\\corpora\\PennTreebank\\PennTreebank2\\TAGGED\\POS\\WSJ", sentences, labels); load("D:\\sourceforge\\corpora\\PennTreebank\\PennTreebank2\\TAGGED\\POS\\BROWN", sentences, labels); String[][] x = sentences.toArray(new String[sentences.size()][]); PennTreebankPOS[][] y = labels.toArray(new PennTreebankPOS[labels.size()][]); HMMPOSTagger tagger = HMMPOSTagger.learn(x, y); try { FileOutputStream fos = new FileOutputStream("hmmpostagger.model"); ObjectOutputStream oos = new ObjectOutputStream(fos); oos.writeObject(tagger); oos.flush(); oos.close(); } catch (Exception ex) { logger.error("Failed to save HMM POS model", ex); } } }
public class class_name { public static void main(String[] argvs) { List<String[]> sentences = new ArrayList<>(); List<PennTreebankPOS[]> labels = new ArrayList<>(); load("D:\\sourceforge\\corpora\\PennTreebank\\PennTreebank2\\TAGGED\\POS\\WSJ", sentences, labels); load("D:\\sourceforge\\corpora\\PennTreebank\\PennTreebank2\\TAGGED\\POS\\BROWN", sentences, labels); String[][] x = sentences.toArray(new String[sentences.size()][]); PennTreebankPOS[][] y = labels.toArray(new PennTreebankPOS[labels.size()][]); HMMPOSTagger tagger = HMMPOSTagger.learn(x, y); try { FileOutputStream fos = new FileOutputStream("hmmpostagger.model"); ObjectOutputStream oos = new ObjectOutputStream(fos); oos.writeObject(tagger); // depends on control dependency: [try], data = [none] oos.flush(); // depends on control dependency: [try], data = [none] oos.close(); // depends on control dependency: [try], data = [none] } catch (Exception ex) { logger.error("Failed to save HMM POS model", ex); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static String[] stringValues2Array(final List<StringValue> _values) { final String[] ret; if (_values != null) { ret = new String[_values.size()]; int i = 0; for (final StringValue value : _values) { ret[i] = value.toString(); i++; } } else { ret = new String[0]; } return ret; } }
public class class_name { public static String[] stringValues2Array(final List<StringValue> _values) { final String[] ret; if (_values != null) { ret = new String[_values.size()]; // depends on control dependency: [if], data = [none] int i = 0; for (final StringValue value : _values) { ret[i] = value.toString(); // depends on control dependency: [for], data = [value] i++; // depends on control dependency: [for], data = [none] } } else { ret = new String[0]; // depends on control dependency: [if], data = [none] } return ret; } }
public class class_name { public EEnum getUSCBYPSIDEN() { if (uscbypsidenEEnum == null) { uscbypsidenEEnum = (EEnum)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(76); } return uscbypsidenEEnum; } }
public class class_name { public EEnum getUSCBYPSIDEN() { if (uscbypsidenEEnum == null) { uscbypsidenEEnum = (EEnum)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(76); // depends on control dependency: [if], data = [none] } return uscbypsidenEEnum; } }
public class class_name { protected static void mergeLists(List<Address> dest, List<Address> src) { for (Address node : src) { if (!dest.contains(node)) { dest.add(node); } } } }
public class class_name { protected static void mergeLists(List<Address> dest, List<Address> src) { for (Address node : src) { if (!dest.contains(node)) { dest.add(node); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public EClass getIfcMaterialSelect() { if (ifcMaterialSelectEClass == null) { ifcMaterialSelectEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI) .getEClassifiers().get(961); } return ifcMaterialSelectEClass; } }
public class class_name { public EClass getIfcMaterialSelect() { if (ifcMaterialSelectEClass == null) { ifcMaterialSelectEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI) .getEClassifiers().get(961); // depends on control dependency: [if], data = [none] } return ifcMaterialSelectEClass; } }
public class class_name { public void sendMessage(String message, boolean push, boolean persist, final Respoke.TaskCompletionListener completionListener) { if (isJoined()) { if ((null != groupID) && (groupID.length() > 0)) { RespokeClient client = clientReference.get(); if (null != client) { JSONObject data = new JSONObject(); try { data.put("endpointId", client.getEndpointID()); data.put("message", message); data.put("push", push); data.put("persist", persist); } catch (JSONException e) { Respoke.postTaskError(completionListener, "Unable to encode message"); return; } String urlEndpoint = "/v1/channels/" + groupID + "/publish/"; signalingChannel.sendRESTMessage("post", urlEndpoint, data, new RespokeSignalingChannel.RESTListener() { @Override public void onSuccess(Object response) { Respoke.postTaskSuccess(completionListener); } @Override public void onError(final String errorMessage) { Respoke.postTaskError(completionListener, errorMessage); } }); } else { Respoke.postTaskError(completionListener, "There was an internal error processing this request."); } } else { Respoke.postTaskError(completionListener, "Group name must be specified"); } } else { Respoke.postTaskError(completionListener, "Not a member of this group anymore."); } } }
public class class_name { public void sendMessage(String message, boolean push, boolean persist, final Respoke.TaskCompletionListener completionListener) { if (isJoined()) { if ((null != groupID) && (groupID.length() > 0)) { RespokeClient client = clientReference.get(); if (null != client) { JSONObject data = new JSONObject(); try { data.put("endpointId", client.getEndpointID()); // depends on control dependency: [try], data = [none] data.put("message", message); // depends on control dependency: [try], data = [none] data.put("push", push); // depends on control dependency: [try], data = [none] data.put("persist", persist); // depends on control dependency: [try], data = [none] } catch (JSONException e) { Respoke.postTaskError(completionListener, "Unable to encode message"); return; } // depends on control dependency: [catch], data = [none] String urlEndpoint = "/v1/channels/" + groupID + "/publish/"; signalingChannel.sendRESTMessage("post", urlEndpoint, data, new RespokeSignalingChannel.RESTListener() { @Override public void onSuccess(Object response) { Respoke.postTaskSuccess(completionListener); } @Override public void onError(final String errorMessage) { Respoke.postTaskError(completionListener, errorMessage); } }); // depends on control dependency: [if], data = [none] } else { Respoke.postTaskError(completionListener, "There was an internal error processing this request."); // depends on control dependency: [if], data = [none] } } else { Respoke.postTaskError(completionListener, "Group name must be specified"); // depends on control dependency: [if], data = [none] } } else { Respoke.postTaskError(completionListener, "Not a member of this group anymore."); // depends on control dependency: [if], data = [none] } } }
public class class_name { private void stage1(ProtoNetwork gpn) { beginStage(PHASE4_STAGE1_HDR, "1", numPhases); final StringBuilder bldr = new StringBuilder(); final String kamURL = sysconfig.getKamURL(); final String kamUser = sysconfig.getKamUser(); final String kamPass = sysconfig.getKamPassword(); // stageOutput("Building KAM at - " + kamURL); DBConnection dbc = null; try { dbc = p4.stage1ConnectKAMStore(kamURL, kamUser, kamPass); } catch (DBConnectionFailure e) { e.printStackTrace(); stageError(e.getUserFacingMessage()); exit(ExitCode.KAM_CONNECTION_FAILURE); } KamDbObject kamDb = new KamDbObject(null, kamName, kamDescription, new Date(), null); String kamSchemaName = null; try { kamSchemaName = p4.stage2SaveToKAMCatalog(kamDb); } catch (KAMCatalogFailure e) { e.printStackTrace(); stageError(e.getUserFacingMessage()); exit(ExitCode.KAM_CONNECTION_FAILURE); } try { p4.stage3CreateKAMstore(dbc, kamSchemaName); } catch (CreateKAMFailure e) { e.printStackTrace(); stageError("Unable to build KAM store - " + e.getMessage()); exit(ExitCode.KAM_CONNECTION_FAILURE); } try { p4.stage4LoadKAM(dbc, gpn, kamSchemaName); } catch (DatabaseError e) { stageError("Unable to load KAM."); stageError(e.getUserFacingMessage()); exit(ExitCode.KAM_LOAD_FAILURE); } catch (CreateKAMFailure e) { stageError("Unable to build KAM store - " + e.getMessage()); exit(ExitCode.KAM_CONNECTION_FAILURE); } markEndStage(bldr); } }
public class class_name { private void stage1(ProtoNetwork gpn) { beginStage(PHASE4_STAGE1_HDR, "1", numPhases); final StringBuilder bldr = new StringBuilder(); final String kamURL = sysconfig.getKamURL(); final String kamUser = sysconfig.getKamUser(); final String kamPass = sysconfig.getKamPassword(); // stageOutput("Building KAM at - " + kamURL); DBConnection dbc = null; try { dbc = p4.stage1ConnectKAMStore(kamURL, kamUser, kamPass); // depends on control dependency: [try], data = [none] } catch (DBConnectionFailure e) { e.printStackTrace(); stageError(e.getUserFacingMessage()); exit(ExitCode.KAM_CONNECTION_FAILURE); } // depends on control dependency: [catch], data = [none] KamDbObject kamDb = new KamDbObject(null, kamName, kamDescription, new Date(), null); String kamSchemaName = null; try { kamSchemaName = p4.stage2SaveToKAMCatalog(kamDb); // depends on control dependency: [try], data = [none] } catch (KAMCatalogFailure e) { e.printStackTrace(); stageError(e.getUserFacingMessage()); exit(ExitCode.KAM_CONNECTION_FAILURE); } // depends on control dependency: [catch], data = [none] try { p4.stage3CreateKAMstore(dbc, kamSchemaName); // depends on control dependency: [try], data = [none] } catch (CreateKAMFailure e) { e.printStackTrace(); stageError("Unable to build KAM store - " + e.getMessage()); exit(ExitCode.KAM_CONNECTION_FAILURE); } // depends on control dependency: [catch], data = [none] try { p4.stage4LoadKAM(dbc, gpn, kamSchemaName); // depends on control dependency: [try], data = [none] } catch (DatabaseError e) { stageError("Unable to load KAM."); stageError(e.getUserFacingMessage()); exit(ExitCode.KAM_LOAD_FAILURE); } catch (CreateKAMFailure e) { // depends on control dependency: [catch], data = [none] stageError("Unable to build KAM store - " + e.getMessage()); exit(ExitCode.KAM_CONNECTION_FAILURE); } // depends on control dependency: [catch], data = [none] markEndStage(bldr); } }
public class class_name { public synchronized void readAsynch(InvCatalogFactory factory, CatalogSetCallback caller) { if (init) { caller.setCatalog((InvCatalogImpl) getParentCatalog()); return; } // may be reletive String hrefResolved; try { java.net.URI uri = getParentCatalog().resolveUri(href); hrefResolved = uri.toString(); } catch (java.net.URISyntaxException e) { // this is to display an error message proxy = new InvDatasetImpl(null, "HREF ERROR"); if (debug) System.out.println("HREF ERROR =\n " + href + " err= " + e.getMessage()); proxy.addProperty(new InvProperty("HREF ERROR", href)); datasets.add(proxy); return; } // open and read the referenced catalog XML asynchronously // setCatalog will be called when ready try { if (debug) System.out.println(" InvCatalogRef readXMLasynch " + getFullName() + " hrefResolved = " + hrefResolved); factory.readXMLasynch(hrefResolved, new Callback(caller)); } catch (Exception e) { // this is to display an error message proxy = new InvDatasetImpl(null, "HREF ERROR"); if (debug) System.out.println("HREF ERROR =\n " + href + " err= " + e.getMessage()); proxy.addProperty(new InvProperty("HREF ERROR", href)); datasets.add(proxy); } } }
public class class_name { public synchronized void readAsynch(InvCatalogFactory factory, CatalogSetCallback caller) { if (init) { caller.setCatalog((InvCatalogImpl) getParentCatalog()); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } // may be reletive String hrefResolved; try { java.net.URI uri = getParentCatalog().resolveUri(href); hrefResolved = uri.toString(); // depends on control dependency: [try], data = [none] } catch (java.net.URISyntaxException e) { // this is to display an error message proxy = new InvDatasetImpl(null, "HREF ERROR"); if (debug) System.out.println("HREF ERROR =\n " + href + " err= " + e.getMessage()); proxy.addProperty(new InvProperty("HREF ERROR", href)); datasets.add(proxy); return; } // depends on control dependency: [catch], data = [none] // open and read the referenced catalog XML asynchronously // setCatalog will be called when ready try { if (debug) System.out.println(" InvCatalogRef readXMLasynch " + getFullName() + " hrefResolved = " + hrefResolved); factory.readXMLasynch(hrefResolved, new Callback(caller)); // depends on control dependency: [try], data = [none] } catch (Exception e) { // this is to display an error message proxy = new InvDatasetImpl(null, "HREF ERROR"); if (debug) System.out.println("HREF ERROR =\n " + href + " err= " + e.getMessage()); proxy.addProperty(new InvProperty("HREF ERROR", href)); datasets.add(proxy); } // depends on control dependency: [catch], data = [none] } }
public class class_name { @Override public void onMetadataChange(JobExecutionState state, String key, Object oldValue, Object newValue) { if (_log.isPresent()) { _log.get().info("JobExection metadata change for " + state.getJobSpec().toShortString() + key + ": '" + oldValue + "' --> '" + newValue + "'"); } } }
public class class_name { @Override public void onMetadataChange(JobExecutionState state, String key, Object oldValue, Object newValue) { if (_log.isPresent()) { _log.get().info("JobExection metadata change for " + state.getJobSpec().toShortString() + key + ": '" + oldValue + "' --> '" + newValue + "'"); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static TaskSystemFactoryMaker newInstance() { TaskSystemFactoryMaker ret = new TaskSystemFactoryMaker(); { for (TaskSystemFactory factory : ServiceLoader.load(TaskSystemFactory.class)) { factory.setCreatedWithSPI(); ret.addFactory(factory); } } return ret; } }
public class class_name { public static TaskSystemFactoryMaker newInstance() { TaskSystemFactoryMaker ret = new TaskSystemFactoryMaker(); { for (TaskSystemFactory factory : ServiceLoader.load(TaskSystemFactory.class)) { factory.setCreatedWithSPI(); // depends on control dependency: [for], data = [factory] ret.addFactory(factory); // depends on control dependency: [for], data = [factory] } } return ret; } }
public class class_name { public Material addVideo(InputStream inputStream, String fileName, String title, String description) { String url = WxEndpoint.get("url.material.binary.upload"); String desc = "{\"title\":\"%s\",\"introduction\":\"%s\"}"; Map<String, String> form = new HashMap<>(); form.put("description", String.format(desc, title, description)); String response = wxClient.post(String.format(url, MediaType.video.name()), inputStream, fileName, form); Map<String, Object> result = JsonMapper.defaultMapper().json2Map(response); if (result.containsKey("media_id")) { return JsonMapper.defaultMapper().fromJson(response, Material.class); } else { logger.warn("image upload failed: {}", response); throw new WxRuntimeException(999, response); } } }
public class class_name { public Material addVideo(InputStream inputStream, String fileName, String title, String description) { String url = WxEndpoint.get("url.material.binary.upload"); String desc = "{\"title\":\"%s\",\"introduction\":\"%s\"}"; Map<String, String> form = new HashMap<>(); form.put("description", String.format(desc, title, description)); String response = wxClient.post(String.format(url, MediaType.video.name()), inputStream, fileName, form); Map<String, Object> result = JsonMapper.defaultMapper().json2Map(response); if (result.containsKey("media_id")) { return JsonMapper.defaultMapper().fromJson(response, Material.class); // depends on control dependency: [if], data = [none] } else { logger.warn("image upload failed: {}", response); // depends on control dependency: [if], data = [none] throw new WxRuntimeException(999, response); } } }
public class class_name { public String printDSSP() { StringBuffer buf = new StringBuffer(); String nl = System.getProperty("line.separator"); //Header Line buf.append("==== Secondary Structure Definition by BioJava" + " DSSP implementation, Version October 2015 ===="+nl); //First line with column definition buf.append(" # RESIDUE AA STRUCTURE BP1 BP2 ACC " + "N-H-->O O-->H-N N-H-->O O-->H-N " + "TCO KAPPA ALPHA PHI PSI " + "X-CA Y-CA Z-CA "); for (int i =0 ; i < groups.length ;i++){ buf.append(nl); SecStrucState ss = getSecStrucState(i); buf.append(ss.printDSSPline(i)); } return buf.toString(); } }
public class class_name { public String printDSSP() { StringBuffer buf = new StringBuffer(); String nl = System.getProperty("line.separator"); //Header Line buf.append("==== Secondary Structure Definition by BioJava" + " DSSP implementation, Version October 2015 ===="+nl); //First line with column definition buf.append(" # RESIDUE AA STRUCTURE BP1 BP2 ACC " + "N-H-->O O-->H-N N-H-->O O-->H-N " + "TCO KAPPA ALPHA PHI PSI " + "X-CA Y-CA Z-CA "); for (int i =0 ; i < groups.length ;i++){ buf.append(nl); // depends on control dependency: [for], data = [none] SecStrucState ss = getSecStrucState(i); buf.append(ss.printDSSPline(i)); // depends on control dependency: [for], data = [i] } return buf.toString(); } }
public class class_name { public boolean updateSessionDetails(final SessionData session) { synchronized (sharedLock) { if (session != null) { SharedPreferences.Editor editor = getSharedPreferences().edit(); editor.putString(KEY_PROFILE_ID, session.getProfileId()); editor.putString(KEY_SESSION_ID, session.getSessionId()); editor.putString(KEY_ACCESS_TOKEN, session.getAccessToken()); editor.putLong(KEY_EXPIRES_ON, session.getExpiresOn()); boolean isUpdated = editor.commit(); sharedLock.notifyAll(); return isUpdated; } sharedLock.notifyAll(); } return false; } }
public class class_name { public boolean updateSessionDetails(final SessionData session) { synchronized (sharedLock) { if (session != null) { SharedPreferences.Editor editor = getSharedPreferences().edit(); editor.putString(KEY_PROFILE_ID, session.getProfileId()); // depends on control dependency: [if], data = [none] editor.putString(KEY_SESSION_ID, session.getSessionId()); // depends on control dependency: [if], data = [none] editor.putString(KEY_ACCESS_TOKEN, session.getAccessToken()); // depends on control dependency: [if], data = [none] editor.putLong(KEY_EXPIRES_ON, session.getExpiresOn()); // depends on control dependency: [if], data = [none] boolean isUpdated = editor.commit(); sharedLock.notifyAll(); // depends on control dependency: [if], data = [none] return isUpdated; // depends on control dependency: [if], data = [none] } sharedLock.notifyAll(); } return false; } }
public class class_name { private void adjustBounds(BoundingBox boundingBox, int zoom) { // Google Tile Format if (googleTiles) { adjustGoogleBounds(); } else if (projection.isUnit(Units.DEGREES)) { adjustGeoPackageBoundsWGS84(boundingBox, zoom); } else { adjustGeoPackageBounds(boundingBox, zoom); } } }
public class class_name { private void adjustBounds(BoundingBox boundingBox, int zoom) { // Google Tile Format if (googleTiles) { adjustGoogleBounds(); // depends on control dependency: [if], data = [none] } else if (projection.isUnit(Units.DEGREES)) { adjustGeoPackageBoundsWGS84(boundingBox, zoom); // depends on control dependency: [if], data = [none] } else { adjustGeoPackageBounds(boundingBox, zoom); // depends on control dependency: [if], data = [none] } } }
public class class_name { public boolean sendNotify(String subscriptionState, String termReason, String body, int timeLeft, EventHeader eventHdr, SubscriptionStateHeader ssHdr, AcceptHeader accHdr, ContentTypeHeader ctHdr, boolean viaProxy) { setErrorMessage(""); synchronized (dialogLock) { if (dialog == null) { setErrorMessage("Can't send notify, haven't received a request"); return false; } try { Request req = dialog.createRequest(Request.NOTIFY); EventHeader ehdr = eventHdr; if (ehdr == null) { if (eventHeader != null) { ehdr = phone.getParent().getHeaderFactory().createEventHeader(eventHeader.getEventType()); if (eventHeader.getEventId() != null) { ehdr.setEventId(eventHeader.getEventId()); } } else { ehdr = phone.getParent().getHeaderFactory().createEventHeader(getEventType()); } } req.setHeader(ehdr); SubscriptionStateHeader hdr = ssHdr; if (hdr == null) { hdr = phone.getParent().getHeaderFactory().createSubscriptionStateHeader(subscriptionState); if (subscriptionState.equalsIgnoreCase(SubscriptionStateHeader.TERMINATED)) { hdr.setReasonCode(termReason); } else if (timeLeft != -1) { hdr.setExpires(timeLeft); } } req.setHeader(hdr); AcceptHeader accept = accHdr; if (accept == null) { accept = phone.getParent().getHeaderFactory().createAcceptHeader(getPackageContentType(), getPackageContentSubType()); } req.setHeader(accept); // now for the body ContentTypeHeader ct_hdr = ctHdr; if (ct_hdr == null) { ct_hdr = phone.getParent().getHeaderFactory() .createContentTypeHeader(getPackageContentType(), getPackageContentSubType()); } req.setContent(body, ct_hdr); req.setContentLength( phone.getParent().getHeaderFactory().createContentLengthHeader(body.length())); return sendNotify(req, viaProxy); } catch (Exception e) { setErrorMessage(e.getClass().getName() + ": " + e.getMessage()); } } return false; } }
public class class_name { public boolean sendNotify(String subscriptionState, String termReason, String body, int timeLeft, EventHeader eventHdr, SubscriptionStateHeader ssHdr, AcceptHeader accHdr, ContentTypeHeader ctHdr, boolean viaProxy) { setErrorMessage(""); synchronized (dialogLock) { if (dialog == null) { setErrorMessage("Can't send notify, haven't received a request"); // depends on control dependency: [if], data = [none] return false; // depends on control dependency: [if], data = [none] } try { Request req = dialog.createRequest(Request.NOTIFY); EventHeader ehdr = eventHdr; if (ehdr == null) { if (eventHeader != null) { ehdr = phone.getParent().getHeaderFactory().createEventHeader(eventHeader.getEventType()); // depends on control dependency: [if], data = [(eventHeader] if (eventHeader.getEventId() != null) { ehdr.setEventId(eventHeader.getEventId()); // depends on control dependency: [if], data = [(eventHeader.getEventId()] } } else { ehdr = phone.getParent().getHeaderFactory().createEventHeader(getEventType()); // depends on control dependency: [if], data = [none] } } req.setHeader(ehdr); // depends on control dependency: [try], data = [none] SubscriptionStateHeader hdr = ssHdr; if (hdr == null) { hdr = phone.getParent().getHeaderFactory().createSubscriptionStateHeader(subscriptionState); // depends on control dependency: [if], data = [none] if (subscriptionState.equalsIgnoreCase(SubscriptionStateHeader.TERMINATED)) { hdr.setReasonCode(termReason); // depends on control dependency: [if], data = [none] } else if (timeLeft != -1) { hdr.setExpires(timeLeft); // depends on control dependency: [if], data = [(timeLeft] } } req.setHeader(hdr); // depends on control dependency: [try], data = [none] AcceptHeader accept = accHdr; if (accept == null) { accept = phone.getParent().getHeaderFactory().createAcceptHeader(getPackageContentType(), getPackageContentSubType()); // depends on control dependency: [if], data = [none] } req.setHeader(accept); // depends on control dependency: [try], data = [none] // now for the body ContentTypeHeader ct_hdr = ctHdr; if (ct_hdr == null) { ct_hdr = phone.getParent().getHeaderFactory() .createContentTypeHeader(getPackageContentType(), getPackageContentSubType()); // depends on control dependency: [if], data = [none] } req.setContent(body, ct_hdr); // depends on control dependency: [try], data = [none] req.setContentLength( phone.getParent().getHeaderFactory().createContentLengthHeader(body.length())); // depends on control dependency: [try], data = [none] return sendNotify(req, viaProxy); // depends on control dependency: [try], data = [none] } catch (Exception e) { setErrorMessage(e.getClass().getName() + ": " + e.getMessage()); } // depends on control dependency: [catch], data = [none] } return false; } }
public class class_name { private final int findMapIndex(String nsURI, String localName) { // Primary hit? int hash = localName.hashCode(); if (nsURI == null) { nsURI = ""; // just to simplify comparisons -- array contains nulls } else if (nsURI.length() > 0) { hash ^= nsURI.hashCode(); } int ix = mAttrMap[hash & (mAttrHashSize - 1)]; if (ix == 0) { // nothing in here; no spills either return -1; } // Index is "one off" (since 0 indicates 'null), 4 Strings per attr ix = (ix - 1) << 2; // Is primary candidate match? String[] raw = mRawAttrs; String thisName = raw[ix]; /* Equality first, since although equals() checks that too, it's * very likely to match (if interning Strings), and we can save * a method call. */ if (thisName == localName || thisName.equals(localName)) { String thisURI = raw[ix+OFFSET_NS_URI]; if (thisURI == nsURI) { return ix; } if (thisURI == null) { if (nsURI.length() == 0) { return ix; } } else if (thisURI.equals(nsURI)) { return ix; } } /* Nope, need to traverse spill list, which has 2 entries for * each spilled attribute id; first for hash value, second index. */ for (int i = mAttrHashSize, len = mAttrSpillEnd; i < len; i += 2) { if (mAttrMap[i] != hash) { continue; } /* Note: spill indexes are not off-by-one, since there's no need * to mask 0 */ ix = mAttrMap[i+1] << 2; // ... but there are 4 Strings for each attr thisName = raw[ix]; if (thisName == localName || thisName.equals(localName)) { String thisURI = raw[ix+1]; if (thisURI == nsURI) { return ix; } if (thisURI == null) { if (nsURI.length() == 0) { return ix; } } else if (thisURI.equals(nsURI)) { return ix; } } } return -1; } }
public class class_name { private final int findMapIndex(String nsURI, String localName) { // Primary hit? int hash = localName.hashCode(); if (nsURI == null) { nsURI = ""; // just to simplify comparisons -- array contains nulls // depends on control dependency: [if], data = [none] } else if (nsURI.length() > 0) { hash ^= nsURI.hashCode(); // depends on control dependency: [if], data = [none] } int ix = mAttrMap[hash & (mAttrHashSize - 1)]; if (ix == 0) { // nothing in here; no spills either return -1; // depends on control dependency: [if], data = [none] } // Index is "one off" (since 0 indicates 'null), 4 Strings per attr ix = (ix - 1) << 2; // Is primary candidate match? String[] raw = mRawAttrs; String thisName = raw[ix]; /* Equality first, since although equals() checks that too, it's * very likely to match (if interning Strings), and we can save * a method call. */ if (thisName == localName || thisName.equals(localName)) { String thisURI = raw[ix+OFFSET_NS_URI]; if (thisURI == nsURI) { return ix; // depends on control dependency: [if], data = [none] } if (thisURI == null) { if (nsURI.length() == 0) { return ix; // depends on control dependency: [if], data = [none] } } else if (thisURI.equals(nsURI)) { return ix; // depends on control dependency: [if], data = [none] } } /* Nope, need to traverse spill list, which has 2 entries for * each spilled attribute id; first for hash value, second index. */ for (int i = mAttrHashSize, len = mAttrSpillEnd; i < len; i += 2) { if (mAttrMap[i] != hash) { continue; } /* Note: spill indexes are not off-by-one, since there's no need * to mask 0 */ ix = mAttrMap[i+1] << 2; // ... but there are 4 Strings for each attr // depends on control dependency: [for], data = [i] thisName = raw[ix]; // depends on control dependency: [for], data = [none] if (thisName == localName || thisName.equals(localName)) { String thisURI = raw[ix+1]; if (thisURI == nsURI) { return ix; // depends on control dependency: [if], data = [none] } if (thisURI == null) { if (nsURI.length() == 0) { return ix; // depends on control dependency: [if], data = [none] } } else if (thisURI.equals(nsURI)) { return ix; // depends on control dependency: [if], data = [none] } } } return -1; } }
public class class_name { @Override public DataSource lookupDataSource(String dataSourceName) { try { final Context context = contextInstance.get(); if (context == null) { throw new ContextNotAvailableException("No Naming Context available."); } return (DataSource) context.lookup(dataSourceName); } catch (NamingException e) { throw new DataSourceNotFoundException("Unable to find data source for given name: " + dataSourceName, e); } } }
public class class_name { @Override public DataSource lookupDataSource(String dataSourceName) { try { final Context context = contextInstance.get(); if (context == null) { throw new ContextNotAvailableException("No Naming Context available."); } return (DataSource) context.lookup(dataSourceName); // depends on control dependency: [try], data = [none] } catch (NamingException e) { throw new DataSourceNotFoundException("Unable to find data source for given name: " + dataSourceName, e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void setConfigurationItems(java.util.Collection<ConfigurationItem> configurationItems) { if (configurationItems == null) { this.configurationItems = null; return; } this.configurationItems = new com.amazonaws.internal.SdkInternalList<ConfigurationItem>(configurationItems); } }
public class class_name { public void setConfigurationItems(java.util.Collection<ConfigurationItem> configurationItems) { if (configurationItems == null) { this.configurationItems = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.configurationItems = new com.amazonaws.internal.SdkInternalList<ConfigurationItem>(configurationItems); } }
public class class_name { @FFDCIgnore(PrivilegedActionException.class) public static SSLSocketFactory getSSLSocketFactoryBySSLRef(String sslRef, Map<String, Object> props, boolean fallbackOnDefault) { if (!SSLSupportService.isSSLSupportServiceReady()) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "The SSL support service is not ready and can't create SSLSocketFactory"); } return null; } SSLSupport sslSupportService = SSLSupportService.getSSLSupport(); JSSEHelper jsseHelper = sslSupportService.getJSSEHelper(); Boolean sslCfgExists = null; try { final JSSEHelper f_jsseHelper = jsseHelper; if (sslRef != null) { final String f_sslRef = sslRef; try { sslCfgExists = AccessController.doPrivileged(new PrivilegedExceptionAction<Boolean>() { @Override public Boolean run() throws SSLException { return Boolean.valueOf(f_jsseHelper.doesSSLConfigExist(f_sslRef)); } }); } catch (PrivilegedActionException pae) { Throwable cause = pae.getCause(); throw (SSLException) cause; } if (!sslCfgExists.booleanValue()) return null; } return SSLSupportService.getSSLSocketFactory(sslRef); } catch (SSLException e) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "SSL Exception with ssl ref id " + sslRef + ": " + e.toString()); } throw new IllegalArgumentException(e); } catch (Exception e) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Exception with ssl ref id " + sslRef + ": " + e.toString()); } throw new IllegalStateException(e); } } }
public class class_name { @FFDCIgnore(PrivilegedActionException.class) public static SSLSocketFactory getSSLSocketFactoryBySSLRef(String sslRef, Map<String, Object> props, boolean fallbackOnDefault) { if (!SSLSupportService.isSSLSupportServiceReady()) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "The SSL support service is not ready and can't create SSLSocketFactory"); // depends on control dependency: [if], data = [none] } return null; // depends on control dependency: [if], data = [none] } SSLSupport sslSupportService = SSLSupportService.getSSLSupport(); JSSEHelper jsseHelper = sslSupportService.getJSSEHelper(); Boolean sslCfgExists = null; try { final JSSEHelper f_jsseHelper = jsseHelper; if (sslRef != null) { final String f_sslRef = sslRef; try { sslCfgExists = AccessController.doPrivileged(new PrivilegedExceptionAction<Boolean>() { @Override public Boolean run() throws SSLException { return Boolean.valueOf(f_jsseHelper.doesSSLConfigExist(f_sslRef)); } }); // depends on control dependency: [try], data = [none] } catch (PrivilegedActionException pae) { Throwable cause = pae.getCause(); throw (SSLException) cause; } // depends on control dependency: [catch], data = [none] if (!sslCfgExists.booleanValue()) return null; } return SSLSupportService.getSSLSocketFactory(sslRef); // depends on control dependency: [try], data = [none] } catch (SSLException e) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "SSL Exception with ssl ref id " + sslRef + ": " + e.toString()); // depends on control dependency: [if], data = [none] } throw new IllegalArgumentException(e); } catch (Exception e) { // depends on control dependency: [catch], data = [none] if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Exception with ssl ref id " + sslRef + ": " + e.toString()); // depends on control dependency: [if], data = [none] } throw new IllegalStateException(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public NullnessStore uprootAccessPaths( Map<LocalVariableNode, LocalVariableNode> localVarTranslations) { NullnessStore.Builder nullnessBuilder = NullnessStore.empty().toBuilder(); for (AccessPath ap : contents.keySet()) { if (ap.getRoot().isReceiver()) { continue; } Element varElement = ap.getRoot().getVarElement(); for (LocalVariableNode fromVar : localVarTranslations.keySet()) { if (varElement.equals(fromVar.getElement())) { LocalVariableNode toVar = localVarTranslations.get(fromVar); AccessPath newAP = new AccessPath(new AccessPath.Root(toVar.getElement()), ap.getElements()); nullnessBuilder.setInformation(newAP, contents.get(ap)); } } } return nullnessBuilder.build(); } }
public class class_name { public NullnessStore uprootAccessPaths( Map<LocalVariableNode, LocalVariableNode> localVarTranslations) { NullnessStore.Builder nullnessBuilder = NullnessStore.empty().toBuilder(); for (AccessPath ap : contents.keySet()) { if (ap.getRoot().isReceiver()) { continue; } Element varElement = ap.getRoot().getVarElement(); for (LocalVariableNode fromVar : localVarTranslations.keySet()) { if (varElement.equals(fromVar.getElement())) { LocalVariableNode toVar = localVarTranslations.get(fromVar); AccessPath newAP = new AccessPath(new AccessPath.Root(toVar.getElement()), ap.getElements()); nullnessBuilder.setInformation(newAP, contents.get(ap)); // depends on control dependency: [if], data = [none] } } } return nullnessBuilder.build(); } }
public class class_name { private void configureSessionWithTimeout(final Session session, final int sessionTimeout) { if (transportStrategy != null) { // socket timeouts handling final Properties sessionProperties = session.getProperties(); sessionProperties.put(transportStrategy.propertyNameConnectionTimeout(), String.valueOf(sessionTimeout)); sessionProperties.put(transportStrategy.propertyNameTimeout(), String.valueOf(sessionTimeout)); sessionProperties.put(transportStrategy.propertyNameWriteTimeout(), String.valueOf(sessionTimeout)); } else { LOGGER.debug("No transport strategy provided, skipping defaults for .connectiontimout, .timout and .writetimeout"); } } }
public class class_name { private void configureSessionWithTimeout(final Session session, final int sessionTimeout) { if (transportStrategy != null) { // socket timeouts handling final Properties sessionProperties = session.getProperties(); sessionProperties.put(transportStrategy.propertyNameConnectionTimeout(), String.valueOf(sessionTimeout)); // depends on control dependency: [if], data = [(transportStrategy] sessionProperties.put(transportStrategy.propertyNameTimeout(), String.valueOf(sessionTimeout)); // depends on control dependency: [if], data = [(transportStrategy] sessionProperties.put(transportStrategy.propertyNameWriteTimeout(), String.valueOf(sessionTimeout)); // depends on control dependency: [if], data = [(transportStrategy] } else { LOGGER.debug("No transport strategy provided, skipping defaults for .connectiontimout, .timout and .writetimeout"); // depends on control dependency: [if], data = [none] } } }
public class class_name { public boolean evaluate(Object context){ switch (operatorType){ case OPERATOR_AND: for (BooleanExpression e: children){ if (e.evaluate(context) == false){ return false; } } return true; case OPERATOR_OR: for (BooleanExpression e: children){ if (e.evaluate(context) == true){ return true; } } return false; case OPERATOR_NOT: if (children.size() != 1){ throw new UnsupportedOperationException("One and only one operand is allowed for NOT operator."); } BooleanExpression e = children.get(0); return !e.evaluate(context); default: throw new UnsupportedOperationException("Operand should implement its own evaluation method."); } } }
public class class_name { public boolean evaluate(Object context){ switch (operatorType){ case OPERATOR_AND: for (BooleanExpression e: children){ if (e.evaluate(context) == false){ return false; // depends on control dependency: [if], data = [none] } } return true; case OPERATOR_OR: for (BooleanExpression e: children){ if (e.evaluate(context) == true){ return true; // depends on control dependency: [if], data = [none] } } return false; case OPERATOR_NOT: if (children.size() != 1){ throw new UnsupportedOperationException("One and only one operand is allowed for NOT operator."); } BooleanExpression e = children.get(0); return !e.evaluate(context); default: throw new UnsupportedOperationException("Operand should implement its own evaluation method."); } } }
public class class_name { @Override public Temporal addTo(Temporal temporal) { if (seconds != 0) { temporal = temporal.plus(seconds, SECONDS); } return temporal; } }
public class class_name { @Override public Temporal addTo(Temporal temporal) { if (seconds != 0) { temporal = temporal.plus(seconds, SECONDS); // depends on control dependency: [if], data = [(seconds] } return temporal; } }
public class class_name { public static SPSSODescriptor getSPSsoDescriptor(final EntityDescriptor entityDescriptor) { LOGGER.trace("Locating SP SSO descriptor for SAML2 protocol..."); var spssoDescriptor = entityDescriptor.getSPSSODescriptor(SAMLConstants.SAML20P_NS); if (spssoDescriptor == null) { LOGGER.trace("Locating SP SSO descriptor for SAML11 protocol..."); spssoDescriptor = entityDescriptor.getSPSSODescriptor(SAMLConstants.SAML11P_NS); } if (spssoDescriptor == null) { LOGGER.trace("Locating SP SSO descriptor for SAML1 protocol..."); spssoDescriptor = entityDescriptor.getSPSSODescriptor(SAMLConstants.SAML10P_NS); } LOGGER.trace("SP SSO descriptor resolved to be [{}]", spssoDescriptor); return spssoDescriptor; } }
public class class_name { public static SPSSODescriptor getSPSsoDescriptor(final EntityDescriptor entityDescriptor) { LOGGER.trace("Locating SP SSO descriptor for SAML2 protocol..."); var spssoDescriptor = entityDescriptor.getSPSSODescriptor(SAMLConstants.SAML20P_NS); if (spssoDescriptor == null) { LOGGER.trace("Locating SP SSO descriptor for SAML11 protocol..."); // depends on control dependency: [if], data = [none] spssoDescriptor = entityDescriptor.getSPSSODescriptor(SAMLConstants.SAML11P_NS); // depends on control dependency: [if], data = [none] } if (spssoDescriptor == null) { LOGGER.trace("Locating SP SSO descriptor for SAML1 protocol..."); // depends on control dependency: [if], data = [none] spssoDescriptor = entityDescriptor.getSPSSODescriptor(SAMLConstants.SAML10P_NS); // depends on control dependency: [if], data = [none] } LOGGER.trace("SP SSO descriptor resolved to be [{}]", spssoDescriptor); return spssoDescriptor; } }
public class class_name { public static void f(String tag, String msg, Object... args) { if (sLevel > LEVEL_FATAL) { return; } if (args.length > 0) { msg = String.format(msg, args); } Log.wtf(tag, msg); } }
public class class_name { public static void f(String tag, String msg, Object... args) { if (sLevel > LEVEL_FATAL) { return; // depends on control dependency: [if], data = [none] } if (args.length > 0) { msg = String.format(msg, args); // depends on control dependency: [if], data = [none] } Log.wtf(tag, msg); } }
public class class_name { public static void reset() { if (DebugUtil.isDebugFeaturesEnabled()) { UIContext context = getCurrent(); ALL_ACTIVE_CONTEXTS.remove(context); } CONTEXT_STACK.remove(); } }
public class class_name { public static void reset() { if (DebugUtil.isDebugFeaturesEnabled()) { UIContext context = getCurrent(); ALL_ACTIVE_CONTEXTS.remove(context); // depends on control dependency: [if], data = [none] } CONTEXT_STACK.remove(); } }
public class class_name { private static boolean polygonTouchesMultiPoint_(Polygon polygon_a, MultiPoint multipoint_b, double tolerance, ProgressTracker progress_tracker) { // Quick rasterize test to see whether the the geometries are disjoint, // or if one is contained in the other. int relation = tryRasterizedContainsOrDisjoint_(polygon_a, multipoint_b, tolerance, false); if (relation == Relation.disjoint || relation == Relation.contains) return false; Envelope2D env_a_inflated = new Envelope2D(); polygon_a.queryEnvelope2D(env_a_inflated); env_a_inflated.inflate(tolerance, tolerance); Point2D ptB; boolean b_boundary = false; MultiPathImpl polygon_a_impl = (MultiPathImpl)polygon_a._getImpl(); Polygon pa = null; Polygon p_polygon_a = polygon_a; boolean b_checked_polygon_a_quad_tree = false; for (int i = 0; i < multipoint_b.getPointCount(); i++) { ptB = multipoint_b.getXY(i); if (env_a_inflated.contains(ptB)) { PolygonUtils.PiPResult result = PolygonUtils.isPointInPolygon2D(p_polygon_a, ptB, tolerance); if (result == PolygonUtils.PiPResult.PiPBoundary) b_boundary = true; else if (result == PolygonUtils.PiPResult.PiPInside) return false; } if (!b_checked_polygon_a_quad_tree) { if (PointInPolygonHelper.quadTreeWillHelp(polygon_a, multipoint_b.getPointCount() - 1) && (polygon_a_impl._getAccelerators() == null || polygon_a_impl._getAccelerators().getQuadTree() == null)) { pa = new Polygon(); polygon_a.copyTo(pa); ((MultiPathImpl) pa._getImpl())._buildQuadTreeAccelerator(Geometry.GeometryAccelerationDegree.enumMedium); p_polygon_a = pa; } else { p_polygon_a = polygon_a; } b_checked_polygon_a_quad_tree = true; } } if (b_boundary) return true; return false; } }
public class class_name { private static boolean polygonTouchesMultiPoint_(Polygon polygon_a, MultiPoint multipoint_b, double tolerance, ProgressTracker progress_tracker) { // Quick rasterize test to see whether the the geometries are disjoint, // or if one is contained in the other. int relation = tryRasterizedContainsOrDisjoint_(polygon_a, multipoint_b, tolerance, false); if (relation == Relation.disjoint || relation == Relation.contains) return false; Envelope2D env_a_inflated = new Envelope2D(); polygon_a.queryEnvelope2D(env_a_inflated); env_a_inflated.inflate(tolerance, tolerance); Point2D ptB; boolean b_boundary = false; MultiPathImpl polygon_a_impl = (MultiPathImpl)polygon_a._getImpl(); Polygon pa = null; Polygon p_polygon_a = polygon_a; boolean b_checked_polygon_a_quad_tree = false; for (int i = 0; i < multipoint_b.getPointCount(); i++) { ptB = multipoint_b.getXY(i); // depends on control dependency: [for], data = [i] if (env_a_inflated.contains(ptB)) { PolygonUtils.PiPResult result = PolygonUtils.isPointInPolygon2D(p_polygon_a, ptB, tolerance); if (result == PolygonUtils.PiPResult.PiPBoundary) b_boundary = true; else if (result == PolygonUtils.PiPResult.PiPInside) return false; } if (!b_checked_polygon_a_quad_tree) { if (PointInPolygonHelper.quadTreeWillHelp(polygon_a, multipoint_b.getPointCount() - 1) && (polygon_a_impl._getAccelerators() == null || polygon_a_impl._getAccelerators().getQuadTree() == null)) { pa = new Polygon(); // depends on control dependency: [if], data = [none] polygon_a.copyTo(pa); // depends on control dependency: [if], data = [none] ((MultiPathImpl) pa._getImpl())._buildQuadTreeAccelerator(Geometry.GeometryAccelerationDegree.enumMedium); // depends on control dependency: [if], data = [none] p_polygon_a = pa; // depends on control dependency: [if], data = [none] } else { p_polygon_a = polygon_a; // depends on control dependency: [if], data = [none] } b_checked_polygon_a_quad_tree = true; // depends on control dependency: [if], data = [none] } } if (b_boundary) return true; return false; } }
public class class_name { private void closeConnectionAndLogExceptionsLocked(SQLiteConnection connection) { try { connection.close(); // might throw } catch (RuntimeException ex) { DLog.e(TAG, "Failed to close connection, its fate is now in the hands " + "of the merciful GC: " + connection, ex); } } }
public class class_name { private void closeConnectionAndLogExceptionsLocked(SQLiteConnection connection) { try { connection.close(); // might throw // depends on control dependency: [try], data = [none] } catch (RuntimeException ex) { DLog.e(TAG, "Failed to close connection, its fate is now in the hands " + "of the merciful GC: " + connection, ex); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private void attemptToExecuteTask(ApplicationDefinition appDef, Task task, TaskRecord taskRecord) { Tenant tenant = Tenant.getTenant(appDef); String taskID = taskRecord.getTaskID(); String claimID = "_claim/" + taskID; long claimStamp = System.currentTimeMillis(); writeTaskClaim(tenant, claimID, claimStamp); if (taskClaimedByUs(tenant, claimID)) { startTask(appDef, task, taskRecord); } else { m_logger.info("Will not start task: it was claimed by another service"); } } }
public class class_name { private void attemptToExecuteTask(ApplicationDefinition appDef, Task task, TaskRecord taskRecord) { Tenant tenant = Tenant.getTenant(appDef); String taskID = taskRecord.getTaskID(); String claimID = "_claim/" + taskID; long claimStamp = System.currentTimeMillis(); writeTaskClaim(tenant, claimID, claimStamp); if (taskClaimedByUs(tenant, claimID)) { startTask(appDef, task, taskRecord); // depends on control dependency: [if], data = [none] } else { m_logger.info("Will not start task: it was claimed by another service"); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Nullable public PointSymbolizer createPointSymbolizer(final PJsonObject styleJson) { if (this.allowNullSymbolizer && !( styleJson.has(JSON_EXTERNAL_GRAPHIC) || styleJson.has(JSON_GRAPHIC_NAME) || styleJson.has(JSON_POINT_RADIUS))) { return null; } Graphic graphic = this.styleBuilder.createGraphic(); graphic.graphicalSymbols().clear(); if (styleJson.has(JSON_EXTERNAL_GRAPHIC)) { String externalGraphicUrl = validateURL(styleJson.getString(JSON_EXTERNAL_GRAPHIC)); try { final URI uri = URI.create(externalGraphicUrl); if (uri.getScheme().startsWith("http")) { final ClientHttpRequest request = this.requestFactory.createRequest(uri, HttpMethod.GET); externalGraphicUrl = request.getURI().toString(); } } catch (IOException ignored) { // ignored } final String graphicFormat = getGraphicFormat(externalGraphicUrl, styleJson); ExternalGraphic externalGraphic = null; if (externalGraphicUrl.startsWith("data:")) { try { externalGraphic = this.styleBuilder.createExternalGraphic( new URL(null, externalGraphicUrl, new Handler()), graphicFormat ); } catch (MalformedURLException e) { // ignored } } else { externalGraphic = this.styleBuilder.createExternalGraphic(externalGraphicUrl, graphicFormat); } if (externalGraphic != null) { graphic.graphicalSymbols().add(externalGraphic); } } if (styleJson.has(JSON_GRAPHIC_NAME)) { Expression graphicName = parseProperty(styleJson.getString(JSON_GRAPHIC_NAME), input -> input); Fill fill = createFill(styleJson); Stroke stroke = createStroke(styleJson, false); final Mark mark = this.styleBuilder.createMark(graphicName, fill, stroke); graphic.graphicalSymbols().add(mark); } if (graphic.graphicalSymbols().isEmpty()) { Fill fill = createFill(styleJson); Stroke stroke = createStroke(styleJson, false); final Mark mark = this.styleBuilder.createMark(DEFAULT_POINT_MARK, fill, stroke); graphic.graphicalSymbols().add(mark); } graphic.setOpacity( parseExpression(null, styleJson, JSON_GRAPHIC_OPACITY, Double::parseDouble)); if (!StringUtils.isEmpty(styleJson.optString(JSON_POINT_RADIUS))) { Expression size = parseExpression(null, styleJson, JSON_POINT_RADIUS, (final String input) -> Double.parseDouble(input) * 2); graphic.setSize(size); } else if (!StringUtils.isEmpty(styleJson.optString(JSON_GRAPHIC_WIDTH))) { Expression size = parseExpression(null, styleJson, JSON_GRAPHIC_WIDTH, Double::parseDouble); graphic.setSize(size); } if (!StringUtils.isEmpty(styleJson.optString(JSON_GRAPHIC_Y_OFFSET)) && !StringUtils.isEmpty(styleJson.optString(JSON_GRAPHIC_X_OFFSET))) { Expression dy = parseExpression(null, styleJson, JSON_GRAPHIC_Y_OFFSET, Double::parseDouble); Expression dx = parseExpression(null, styleJson, JSON_GRAPHIC_X_OFFSET, Double::parseDouble); Displacement offset = this.styleBuilder.createDisplacement(dx, dy); graphic.setDisplacement(offset); } if (!StringUtils.isEmpty(styleJson.optString(JSON_ROTATION))) { final Expression rotation = parseExpression(null, styleJson, JSON_ROTATION, Double::parseDouble); graphic.setRotation(rotation); } return this.styleBuilder.createPointSymbolizer(graphic); } }
public class class_name { @Nullable public PointSymbolizer createPointSymbolizer(final PJsonObject styleJson) { if (this.allowNullSymbolizer && !( styleJson.has(JSON_EXTERNAL_GRAPHIC) || styleJson.has(JSON_GRAPHIC_NAME) || styleJson.has(JSON_POINT_RADIUS))) { return null; // depends on control dependency: [if], data = [none] } Graphic graphic = this.styleBuilder.createGraphic(); graphic.graphicalSymbols().clear(); if (styleJson.has(JSON_EXTERNAL_GRAPHIC)) { String externalGraphicUrl = validateURL(styleJson.getString(JSON_EXTERNAL_GRAPHIC)); try { final URI uri = URI.create(externalGraphicUrl); if (uri.getScheme().startsWith("http")) { final ClientHttpRequest request = this.requestFactory.createRequest(uri, HttpMethod.GET); externalGraphicUrl = request.getURI().toString(); // depends on control dependency: [if], data = [none] } } catch (IOException ignored) { // ignored } // depends on control dependency: [catch], data = [none] final String graphicFormat = getGraphicFormat(externalGraphicUrl, styleJson); ExternalGraphic externalGraphic = null; if (externalGraphicUrl.startsWith("data:")) { try { externalGraphic = this.styleBuilder.createExternalGraphic( new URL(null, externalGraphicUrl, new Handler()), graphicFormat ); // depends on control dependency: [try], data = [none] } catch (MalformedURLException e) { // ignored } // depends on control dependency: [catch], data = [none] } else { externalGraphic = this.styleBuilder.createExternalGraphic(externalGraphicUrl, graphicFormat); // depends on control dependency: [if], data = [none] } if (externalGraphic != null) { graphic.graphicalSymbols().add(externalGraphic); // depends on control dependency: [if], data = [(externalGraphic] } } if (styleJson.has(JSON_GRAPHIC_NAME)) { Expression graphicName = parseProperty(styleJson.getString(JSON_GRAPHIC_NAME), input -> input); Fill fill = createFill(styleJson); Stroke stroke = createStroke(styleJson, false); final Mark mark = this.styleBuilder.createMark(graphicName, fill, stroke); graphic.graphicalSymbols().add(mark); // depends on control dependency: [if], data = [none] } if (graphic.graphicalSymbols().isEmpty()) { Fill fill = createFill(styleJson); Stroke stroke = createStroke(styleJson, false); final Mark mark = this.styleBuilder.createMark(DEFAULT_POINT_MARK, fill, stroke); graphic.graphicalSymbols().add(mark); // depends on control dependency: [if], data = [none] } graphic.setOpacity( parseExpression(null, styleJson, JSON_GRAPHIC_OPACITY, Double::parseDouble)); if (!StringUtils.isEmpty(styleJson.optString(JSON_POINT_RADIUS))) { Expression size = parseExpression(null, styleJson, JSON_POINT_RADIUS, (final String input) -> Double.parseDouble(input) * 2); graphic.setSize(size); // depends on control dependency: [if], data = [none] } else if (!StringUtils.isEmpty(styleJson.optString(JSON_GRAPHIC_WIDTH))) { Expression size = parseExpression(null, styleJson, JSON_GRAPHIC_WIDTH, Double::parseDouble); graphic.setSize(size); // depends on control dependency: [if], data = [none] } if (!StringUtils.isEmpty(styleJson.optString(JSON_GRAPHIC_Y_OFFSET)) && !StringUtils.isEmpty(styleJson.optString(JSON_GRAPHIC_X_OFFSET))) { Expression dy = parseExpression(null, styleJson, JSON_GRAPHIC_Y_OFFSET, Double::parseDouble); Expression dx = parseExpression(null, styleJson, JSON_GRAPHIC_X_OFFSET, Double::parseDouble); Displacement offset = this.styleBuilder.createDisplacement(dx, dy); graphic.setDisplacement(offset); // depends on control dependency: [if], data = [none] } if (!StringUtils.isEmpty(styleJson.optString(JSON_ROTATION))) { final Expression rotation = parseExpression(null, styleJson, JSON_ROTATION, Double::parseDouble); graphic.setRotation(rotation); // depends on control dependency: [if], data = [none] } return this.styleBuilder.createPointSymbolizer(graphic); } }
public class class_name { public Duration getDuration(Date startDate, Date endDate) { Calendar cal = DateHelper.popCalendar(startDate); int days = getDaysInRange(startDate, endDate); int duration = 0; Day day = Day.getInstance(cal.get(Calendar.DAY_OF_WEEK)); while (days > 0) { if (isWorkingDate(cal.getTime(), day) == true) { ++duration; } --days; day = day.getNextDay(); cal.set(Calendar.DAY_OF_YEAR, cal.get(Calendar.DAY_OF_YEAR) + 1); } DateHelper.pushCalendar(cal); return (Duration.getInstance(duration, TimeUnit.DAYS)); } }
public class class_name { public Duration getDuration(Date startDate, Date endDate) { Calendar cal = DateHelper.popCalendar(startDate); int days = getDaysInRange(startDate, endDate); int duration = 0; Day day = Day.getInstance(cal.get(Calendar.DAY_OF_WEEK)); while (days > 0) { if (isWorkingDate(cal.getTime(), day) == true) { ++duration; // depends on control dependency: [if], data = [none] } --days; // depends on control dependency: [while], data = [none] day = day.getNextDay(); // depends on control dependency: [while], data = [none] cal.set(Calendar.DAY_OF_YEAR, cal.get(Calendar.DAY_OF_YEAR) + 1); // depends on control dependency: [while], data = [none] } DateHelper.pushCalendar(cal); return (Duration.getInstance(duration, TimeUnit.DAYS)); } }
public class class_name { private void setCenterInMap() { final Coordinate actCenter = getCenter(); if (getInitialized() && null != actCenter) { if (logger.isTraceEnabled()) { logger.trace("setting center in OpenLayers map: {}, animation: {}", actCenter, animationDuration.get()); } // using Double objects instead of primitives works here jsMapView .call("setCenter", actCenter.getLatitude(), actCenter.getLongitude(), animationDuration.get()); } } }
public class class_name { private void setCenterInMap() { final Coordinate actCenter = getCenter(); if (getInitialized() && null != actCenter) { if (logger.isTraceEnabled()) { logger.trace("setting center in OpenLayers map: {}, animation: {}", actCenter, animationDuration.get()); // depends on control dependency: [if], data = [none] } // using Double objects instead of primitives works here jsMapView .call("setCenter", actCenter.getLatitude(), actCenter.getLongitude(), animationDuration.get()); // depends on control dependency: [if], data = [none] } } }
public class class_name { static ManagerCommunicationException mapSendActionException(String actionName, Exception exception) { if (exception instanceof IllegalStateException) { return new ManagerCommunicationException("Not connected to Asterisk Server", exception); } else if (exception instanceof EventTimeoutException) { return new ManagerCommunicationException("Timeout waiting for events from " + actionName + "Action", exception); } else { return new ManagerCommunicationException("Unable to send " + actionName + "Action", exception); } } }
public class class_name { static ManagerCommunicationException mapSendActionException(String actionName, Exception exception) { if (exception instanceof IllegalStateException) { return new ManagerCommunicationException("Not connected to Asterisk Server", exception); // depends on control dependency: [if], data = [none] } else if (exception instanceof EventTimeoutException) { return new ManagerCommunicationException("Timeout waiting for events from " + actionName + "Action", exception); // depends on control dependency: [if], data = [none] } else { return new ManagerCommunicationException("Unable to send " + actionName + "Action", exception); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void clearUpToLowMark(L secondaryKey) { CircularArrayMap<E> field = fieldMap.get(secondaryKey); if (field != null) { field.clearUpToLowMark(); } } }
public class class_name { public void clearUpToLowMark(L secondaryKey) { CircularArrayMap<E> field = fieldMap.get(secondaryKey); if (field != null) { field.clearUpToLowMark(); // depends on control dependency: [if], data = [none] } } }
public class class_name { public View getFullScreenView() { if (mFullScreenView != null) { return mFullScreenView; } final DisplayMetrics metrics = new DisplayMetrics(); mActivity.getWindowManager().getDefaultDisplay().getMetrics(metrics); final int screenWidthPixels = Math.max(metrics.widthPixels, metrics.heightPixels); final int screenHeightPixels = Math.min(metrics.widthPixels, metrics.heightPixels); final ViewGroup.LayoutParams layout = new ViewGroup.LayoutParams(screenWidthPixels, screenHeightPixels); mFullScreenView = new View(mActivity); mFullScreenView.setLayoutParams(layout); mRenderableViewGroup.addView(mFullScreenView); return mFullScreenView; } }
public class class_name { public View getFullScreenView() { if (mFullScreenView != null) { return mFullScreenView; // depends on control dependency: [if], data = [none] } final DisplayMetrics metrics = new DisplayMetrics(); mActivity.getWindowManager().getDefaultDisplay().getMetrics(metrics); final int screenWidthPixels = Math.max(metrics.widthPixels, metrics.heightPixels); final int screenHeightPixels = Math.min(metrics.widthPixels, metrics.heightPixels); final ViewGroup.LayoutParams layout = new ViewGroup.LayoutParams(screenWidthPixels, screenHeightPixels); mFullScreenView = new View(mActivity); mFullScreenView.setLayoutParams(layout); mRenderableViewGroup.addView(mFullScreenView); return mFullScreenView; } }
public class class_name { void readObject() { for(int i = 0; i < sers.length; ++i) { try { data[i] = sers[i].fromByteBuffer(buffer); } catch(UnsupportedOperationException e) { throw new AbortException("Deserialization failed.", e); } catch(IOException e) { throw new AbortException("IO error", e); } } } }
public class class_name { void readObject() { for(int i = 0; i < sers.length; ++i) { try { data[i] = sers[i].fromByteBuffer(buffer); // depends on control dependency: [try], data = [none] } catch(UnsupportedOperationException e) { throw new AbortException("Deserialization failed.", e); } // depends on control dependency: [catch], data = [none] catch(IOException e) { throw new AbortException("IO error", e); } // depends on control dependency: [catch], data = [none] } } }
public class class_name { public void setEntries(java.util.Collection<DatasetEntry> entries) { if (entries == null) { this.entries = null; return; } this.entries = new java.util.ArrayList<DatasetEntry>(entries); } }
public class class_name { public void setEntries(java.util.Collection<DatasetEntry> entries) { if (entries == null) { this.entries = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.entries = new java.util.ArrayList<DatasetEntry>(entries); } }
public class class_name { public static String encode(final String input) { if (input == null || input.length() == 0) { return input; } return ENCODE.translate(input); } }
public class class_name { public static String encode(final String input) { if (input == null || input.length() == 0) { return input; // depends on control dependency: [if], data = [none] } return ENCODE.translate(input); } }
public class class_name { public static List<Pair<Double,Integer>> sortCandidates(INDArray x,INDArray X, List<Integer> candidates, String similarityFunction) { int prevIdx = -1; List<Pair<Double,Integer>> ret = new ArrayList<>(); for(int i = 0; i < candidates.size(); i++) { if(candidates.get(i) != prevIdx) { ret.add(Pair.of(computeDistance(similarityFunction,X.slice(candidates.get(i)),x),candidates.get(i))); } prevIdx = i; } Collections.sort(ret, new Comparator<Pair<Double, Integer>>() { @Override public int compare(Pair<Double, Integer> doubleIntegerPair, Pair<Double, Integer> t1) { return Doubles.compare(doubleIntegerPair.getFirst(),t1.getFirst()); } }); return ret; } }
public class class_name { public static List<Pair<Double,Integer>> sortCandidates(INDArray x,INDArray X, List<Integer> candidates, String similarityFunction) { int prevIdx = -1; List<Pair<Double,Integer>> ret = new ArrayList<>(); for(int i = 0; i < candidates.size(); i++) { if(candidates.get(i) != prevIdx) { ret.add(Pair.of(computeDistance(similarityFunction,X.slice(candidates.get(i)),x),candidates.get(i))); // depends on control dependency: [if], data = [(candidates.get(i)] } prevIdx = i; // depends on control dependency: [for], data = [i] } Collections.sort(ret, new Comparator<Pair<Double, Integer>>() { @Override public int compare(Pair<Double, Integer> doubleIntegerPair, Pair<Double, Integer> t1) { return Doubles.compare(doubleIntegerPair.getFirst(),t1.getFirst()); } }); return ret; } }
public class class_name { public static void themeDrawerItem(Context ctx, View view, int selected_color, boolean animate) { boolean legacyStyle = getBooleanStyleable(ctx, R.styleable.MaterialDrawer_material_drawer_legacy_style, false); Drawable selected; Drawable unselected; if (legacyStyle) { // Material 1.0 styling selected = new ColorDrawable(selected_color); unselected = UIUtils.getSelectableBackground(ctx); } else { // Material 2.0 styling int cornerRadius = ctx.getResources().getDimensionPixelSize(R.dimen.material_drawer_item_corner_radius); int paddingTopBottom = ctx.getResources().getDimensionPixelSize(R.dimen.material_drawer_item_background_padding_top_bottom); int paddingStartEnd = ctx.getResources().getDimensionPixelSize(R.dimen.material_drawer_item_background_padding_start_end); // define normal selected background GradientDrawable gradientDrawable = new GradientDrawable(); gradientDrawable.setColor(selected_color); gradientDrawable.setCornerRadius(cornerRadius); selected = new InsetDrawable(gradientDrawable, paddingStartEnd, paddingTopBottom, paddingStartEnd, paddingTopBottom); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { // define mask for ripple GradientDrawable gradientMask = new GradientDrawable(); gradientMask.setColor(Color.BLACK); gradientMask.setCornerRadius(cornerRadius); Drawable mask = new InsetDrawable(gradientMask, paddingStartEnd, paddingTopBottom, paddingStartEnd, paddingTopBottom); unselected = new RippleDrawable(new ColorStateList(new int[][]{new int[]{}}, new int[]{UIUtils.getThemeColor(ctx, R.attr.colorControlHighlight)}), null, mask); } else { // define touch drawable GradientDrawable touchDrawable = new GradientDrawable(); touchDrawable.setColor(UIUtils.getThemeColor(ctx, R.attr.colorControlHighlight)); touchDrawable.setCornerRadius(cornerRadius); Drawable touchInsetDrawable = new InsetDrawable(touchDrawable, paddingStartEnd, paddingTopBottom, paddingStartEnd, paddingTopBottom); StateListDrawable unselectedStates = new StateListDrawable(); //if possible and wanted we enable animating across states if (animate) { int duration = ctx.getResources().getInteger(android.R.integer.config_shortAnimTime); unselectedStates.setEnterFadeDuration(duration); unselectedStates.setExitFadeDuration(duration); } unselectedStates.addState(new int[]{android.R.attr.state_pressed}, touchInsetDrawable); unselectedStates.addState(new int[]{}, new ColorDrawable(Color.TRANSPARENT)); unselected = unselectedStates; } } StateListDrawable states = new StateListDrawable(); //if possible and wanted we enable animating across states if (animate) { int duration = ctx.getResources().getInteger(android.R.integer.config_shortAnimTime); states.setEnterFadeDuration(duration); states.setExitFadeDuration(duration); } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { states.addState(new int[]{android.R.attr.state_selected}, selected); states.addState(new int[]{}, new ColorDrawable(Color.TRANSPARENT)); ViewCompat.setBackground(view, states); view.setForeground(unselected); } else { states.addState(new int[]{android.R.attr.state_selected}, selected); states.addState(new int[]{}, unselected); ViewCompat.setBackground(view, states); } } }
public class class_name { public static void themeDrawerItem(Context ctx, View view, int selected_color, boolean animate) { boolean legacyStyle = getBooleanStyleable(ctx, R.styleable.MaterialDrawer_material_drawer_legacy_style, false); Drawable selected; Drawable unselected; if (legacyStyle) { // Material 1.0 styling selected = new ColorDrawable(selected_color); // depends on control dependency: [if], data = [none] unselected = UIUtils.getSelectableBackground(ctx); // depends on control dependency: [if], data = [none] } else { // Material 2.0 styling int cornerRadius = ctx.getResources().getDimensionPixelSize(R.dimen.material_drawer_item_corner_radius); int paddingTopBottom = ctx.getResources().getDimensionPixelSize(R.dimen.material_drawer_item_background_padding_top_bottom); int paddingStartEnd = ctx.getResources().getDimensionPixelSize(R.dimen.material_drawer_item_background_padding_start_end); // define normal selected background GradientDrawable gradientDrawable = new GradientDrawable(); gradientDrawable.setColor(selected_color); // depends on control dependency: [if], data = [none] gradientDrawable.setCornerRadius(cornerRadius); // depends on control dependency: [if], data = [none] selected = new InsetDrawable(gradientDrawable, paddingStartEnd, paddingTopBottom, paddingStartEnd, paddingTopBottom); // depends on control dependency: [if], data = [none] if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { // define mask for ripple GradientDrawable gradientMask = new GradientDrawable(); gradientMask.setColor(Color.BLACK); // depends on control dependency: [if], data = [none] gradientMask.setCornerRadius(cornerRadius); // depends on control dependency: [if], data = [none] Drawable mask = new InsetDrawable(gradientMask, paddingStartEnd, paddingTopBottom, paddingStartEnd, paddingTopBottom); unselected = new RippleDrawable(new ColorStateList(new int[][]{new int[]{}}, new int[]{UIUtils.getThemeColor(ctx, R.attr.colorControlHighlight)}), null, mask); // depends on control dependency: [if], data = [none] } else { // define touch drawable GradientDrawable touchDrawable = new GradientDrawable(); touchDrawable.setColor(UIUtils.getThemeColor(ctx, R.attr.colorControlHighlight)); // depends on control dependency: [if], data = [none] touchDrawable.setCornerRadius(cornerRadius); // depends on control dependency: [if], data = [none] Drawable touchInsetDrawable = new InsetDrawable(touchDrawable, paddingStartEnd, paddingTopBottom, paddingStartEnd, paddingTopBottom); StateListDrawable unselectedStates = new StateListDrawable(); //if possible and wanted we enable animating across states if (animate) { int duration = ctx.getResources().getInteger(android.R.integer.config_shortAnimTime); unselectedStates.setEnterFadeDuration(duration); // depends on control dependency: [if], data = [none] unselectedStates.setExitFadeDuration(duration); // depends on control dependency: [if], data = [none] } unselectedStates.addState(new int[]{android.R.attr.state_pressed}, touchInsetDrawable); // depends on control dependency: [if], data = [none] unselectedStates.addState(new int[]{}, new ColorDrawable(Color.TRANSPARENT)); // depends on control dependency: [if], data = [none] unselected = unselectedStates; // depends on control dependency: [if], data = [none] } } StateListDrawable states = new StateListDrawable(); //if possible and wanted we enable animating across states if (animate) { int duration = ctx.getResources().getInteger(android.R.integer.config_shortAnimTime); states.setEnterFadeDuration(duration); // depends on control dependency: [if], data = [none] states.setExitFadeDuration(duration); // depends on control dependency: [if], data = [none] } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { states.addState(new int[]{android.R.attr.state_selected}, selected); // depends on control dependency: [if], data = [none] states.addState(new int[]{}, new ColorDrawable(Color.TRANSPARENT)); // depends on control dependency: [if], data = [none] ViewCompat.setBackground(view, states); // depends on control dependency: [if], data = [none] view.setForeground(unselected); // depends on control dependency: [if], data = [none] } else { states.addState(new int[]{android.R.attr.state_selected}, selected); // depends on control dependency: [if], data = [none] states.addState(new int[]{}, unselected); // depends on control dependency: [if], data = [none] ViewCompat.setBackground(view, states); // depends on control dependency: [if], data = [none] } } }
public class class_name { private void fillPrimaryKeysBySequence(Object entity){ if(!dialect.supportsGenerationType(GenerationType.SEQUENCE)){ return; } BeanDesc beanDesc = beanDescFactory.getBeanDesc(entity.getClass()); int size = beanDesc.getPropertyDescSize(); for(int i=0; i < size; i++){ PropertyDesc propertyDesc = beanDesc.getPropertyDesc(i); PrimaryKey primaryKey = propertyDesc.getAnnotation(PrimaryKey.class); if(primaryKey != null && primaryKey.generationType() == GenerationType.SEQUENCE){ String sql = dialect.getSequenceSql(primaryKey.generator()); Object value = sqlExecutor.getSingleResult(propertyDesc.getPropertyType(), sql, new Object[0]); propertyDesc.setValue(entity, value); } } } }
public class class_name { private void fillPrimaryKeysBySequence(Object entity){ if(!dialect.supportsGenerationType(GenerationType.SEQUENCE)){ return; // depends on control dependency: [if], data = [none] } BeanDesc beanDesc = beanDescFactory.getBeanDesc(entity.getClass()); int size = beanDesc.getPropertyDescSize(); for(int i=0; i < size; i++){ PropertyDesc propertyDesc = beanDesc.getPropertyDesc(i); PrimaryKey primaryKey = propertyDesc.getAnnotation(PrimaryKey.class); if(primaryKey != null && primaryKey.generationType() == GenerationType.SEQUENCE){ String sql = dialect.getSequenceSql(primaryKey.generator()); Object value = sqlExecutor.getSingleResult(propertyDesc.getPropertyType(), sql, new Object[0]); propertyDesc.setValue(entity, value); // depends on control dependency: [if], data = [none] } } } }
public class class_name { @Override public void write(byte []buf, int offset, int length, boolean isEnd) throws IOException { OutputStream stream = getStream(); if (stream == null) { return; } synchronized (stream) { stream.write(buf, offset, length); if (isEnd) { stream.flush(); } } } }
public class class_name { @Override public void write(byte []buf, int offset, int length, boolean isEnd) throws IOException { OutputStream stream = getStream(); if (stream == null) { return; } synchronized (stream) { stream.write(buf, offset, length); if (isEnd) { stream.flush(); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public SourceFile retrievePanSource(String name, List<String> loadpath) { String cacheKey = name + ((String) " ") + String.join(":", loadpath); SourceFile cachedResult = retrievePanCacheLoadpath.get(cacheKey); if (cachedResult == null) { File file = lookupSource(name, loadpath); cachedResult = createPanSourceFile(name, file); retrievePanCacheLoadpath.put(cacheKey, cachedResult); } return cachedResult; } }
public class class_name { public SourceFile retrievePanSource(String name, List<String> loadpath) { String cacheKey = name + ((String) " ") + String.join(":", loadpath); SourceFile cachedResult = retrievePanCacheLoadpath.get(cacheKey); if (cachedResult == null) { File file = lookupSource(name, loadpath); cachedResult = createPanSourceFile(name, file); // depends on control dependency: [if], data = [none] retrievePanCacheLoadpath.put(cacheKey, cachedResult); // depends on control dependency: [if], data = [none] } return cachedResult; } }
public class class_name { private static final int bestPivot(int rank, int m1, int m2, int m3, int m4, int m5) { if(rank < m1) { return m1; } if(rank > m5) { return m5; } if(rank < m2) { return m2; } if(rank > m4) { return m4; } return m3; } }
public class class_name { private static final int bestPivot(int rank, int m1, int m2, int m3, int m4, int m5) { if(rank < m1) { return m1; // depends on control dependency: [if], data = [none] } if(rank > m5) { return m5; // depends on control dependency: [if], data = [none] } if(rank < m2) { return m2; // depends on control dependency: [if], data = [none] } if(rank > m4) { return m4; // depends on control dependency: [if], data = [none] } return m3; } }
public class class_name { public void marshall(AdminListDevicesRequest adminListDevicesRequest, ProtocolMarshaller protocolMarshaller) { if (adminListDevicesRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(adminListDevicesRequest.getUserPoolId(), USERPOOLID_BINDING); protocolMarshaller.marshall(adminListDevicesRequest.getUsername(), USERNAME_BINDING); protocolMarshaller.marshall(adminListDevicesRequest.getLimit(), LIMIT_BINDING); protocolMarshaller.marshall(adminListDevicesRequest.getPaginationToken(), PAGINATIONTOKEN_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(AdminListDevicesRequest adminListDevicesRequest, ProtocolMarshaller protocolMarshaller) { if (adminListDevicesRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(adminListDevicesRequest.getUserPoolId(), USERPOOLID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(adminListDevicesRequest.getUsername(), USERNAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(adminListDevicesRequest.getLimit(), LIMIT_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(adminListDevicesRequest.getPaginationToken(), PAGINATIONTOKEN_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 { protected void createFirstChainDelegate_Continue(final TargetMethodData tmd) { methodVisitor.visitCode(); if (tmd.msign.isStatic) { loadStaticMethodArguments(methodVisitor, tmd.msign); methodVisitor.visitMethodInsn( INVOKESTATIC, wd.thisReference, tmd.firstMethodName(), tmd.msign.getDescription(), false); } else { loadSpecialMethodArguments(methodVisitor, tmd.msign); methodVisitor.visitMethodInsn( INVOKESPECIAL, wd.thisReference, tmd.firstMethodName(), tmd.msign.getDescription(), false); } visitReturn(methodVisitor, tmd.msign, false); methodVisitor.visitMaxs(0, 0); methodVisitor.visitEnd(); } }
public class class_name { protected void createFirstChainDelegate_Continue(final TargetMethodData tmd) { methodVisitor.visitCode(); if (tmd.msign.isStatic) { loadStaticMethodArguments(methodVisitor, tmd.msign); // depends on control dependency: [if], data = [none] methodVisitor.visitMethodInsn( INVOKESTATIC, wd.thisReference, tmd.firstMethodName(), tmd.msign.getDescription(), false); // depends on control dependency: [if], data = [none] } else { loadSpecialMethodArguments(methodVisitor, tmd.msign); // depends on control dependency: [if], data = [none] methodVisitor.visitMethodInsn( INVOKESPECIAL, wd.thisReference, tmd.firstMethodName(), tmd.msign.getDescription(), false); // depends on control dependency: [if], data = [none] } visitReturn(methodVisitor, tmd.msign, false); methodVisitor.visitMaxs(0, 0); methodVisitor.visitEnd(); } }
public class class_name { void swap(int element1, int element2) { int ar1[] = m_buffer[element1 >> m_blockPower]; int ar2[] = m_buffer[element2 >> m_blockPower]; int ind1 = element1 & m_blockMask; int ind2 = element2 & m_blockMask; for (int i = 0; i < m_stride; i++) { int tmp = ar1[ind1 + i]; ar1[ind1 + i] = ar2[ind2 + i]; ar2[ind2 + i] = tmp; } } }
public class class_name { void swap(int element1, int element2) { int ar1[] = m_buffer[element1 >> m_blockPower]; int ar2[] = m_buffer[element2 >> m_blockPower]; int ind1 = element1 & m_blockMask; int ind2 = element2 & m_blockMask; for (int i = 0; i < m_stride; i++) { int tmp = ar1[ind1 + i]; ar1[ind1 + i] = ar2[ind2 + i]; // depends on control dependency: [for], data = [i] ar2[ind2 + i] = tmp; // depends on control dependency: [for], data = [i] } } }
public class class_name { private int compareMagnitude(BigDecimal val) { // Match scales, avoid unnecessary inflation long ys = val.intCompact; long xs = this.intCompact; if (xs == 0) return (ys == 0) ? 0 : -1; if (ys == 0) return 1; long sdiff = (long)this.scale - val.scale; if (sdiff != 0) { // Avoid matching scales if the (adjusted) exponents differ long xae = (long)this.precision() - this.scale; // [-1] long yae = (long)val.precision() - val.scale; // [-1] if (xae < yae) return -1; if (xae > yae) return 1; BigInteger rb = null; if (sdiff < 0) { // The cases sdiff <= Integer.MIN_VALUE intentionally fall through. if ( sdiff > Integer.MIN_VALUE && (xs == INFLATED || (xs = longMultiplyPowerTen(xs, (int)-sdiff)) == INFLATED) && ys == INFLATED) { rb = bigMultiplyPowerTen((int)-sdiff); return rb.compareMagnitude(val.intVal); } } else { // sdiff > 0 // The cases sdiff > Integer.MAX_VALUE intentionally fall through. if ( sdiff <= Integer.MAX_VALUE && (ys == INFLATED || (ys = longMultiplyPowerTen(ys, (int)sdiff)) == INFLATED) && xs == INFLATED) { rb = val.bigMultiplyPowerTen((int)sdiff); return this.intVal.compareMagnitude(rb); } } } if (xs != INFLATED) return (ys != INFLATED) ? longCompareMagnitude(xs, ys) : -1; else if (ys != INFLATED) return 1; else return this.intVal.compareMagnitude(val.intVal); } }
public class class_name { private int compareMagnitude(BigDecimal val) { // Match scales, avoid unnecessary inflation long ys = val.intCompact; long xs = this.intCompact; if (xs == 0) return (ys == 0) ? 0 : -1; if (ys == 0) return 1; long sdiff = (long)this.scale - val.scale; if (sdiff != 0) { // Avoid matching scales if the (adjusted) exponents differ long xae = (long)this.precision() - this.scale; // [-1] long yae = (long)val.precision() - val.scale; // [-1] if (xae < yae) return -1; if (xae > yae) return 1; BigInteger rb = null; if (sdiff < 0) { // The cases sdiff <= Integer.MIN_VALUE intentionally fall through. if ( sdiff > Integer.MIN_VALUE && (xs == INFLATED || (xs = longMultiplyPowerTen(xs, (int)-sdiff)) == INFLATED) && ys == INFLATED) { rb = bigMultiplyPowerTen((int)-sdiff); // depends on control dependency: [if], data = [none] return rb.compareMagnitude(val.intVal); // depends on control dependency: [if], data = [none] } } else { // sdiff > 0 // The cases sdiff > Integer.MAX_VALUE intentionally fall through. if ( sdiff <= Integer.MAX_VALUE && (ys == INFLATED || (ys = longMultiplyPowerTen(ys, (int)sdiff)) == INFLATED) && xs == INFLATED) { rb = val.bigMultiplyPowerTen((int)sdiff); // depends on control dependency: [if], data = [none] return this.intVal.compareMagnitude(rb); // depends on control dependency: [if], data = [none] } } } if (xs != INFLATED) return (ys != INFLATED) ? longCompareMagnitude(xs, ys) : -1; else if (ys != INFLATED) return 1; else return this.intVal.compareMagnitude(val.intVal); } }
public class class_name { public static ZMatrixRMaj identity(int width , int height) { ZMatrixRMaj A = new ZMatrixRMaj(width,height); int m = Math.min(width,height); for (int i = 0; i < m; i++) { A.set(i,i,1,0); } return A; } }
public class class_name { public static ZMatrixRMaj identity(int width , int height) { ZMatrixRMaj A = new ZMatrixRMaj(width,height); int m = Math.min(width,height); for (int i = 0; i < m; i++) { A.set(i,i,1,0); // depends on control dependency: [for], data = [i] } return A; } }
public class class_name { public static double ulp(double d) { int exp = getExponent(d); switch(exp) { case DoubleConsts.MAX_EXPONENT+1: // NaN or infinity return Math.abs(d); case DoubleConsts.MIN_EXPONENT-1: // zero or subnormal return Double.MIN_VALUE; default: assert exp <= DoubleConsts.MAX_EXPONENT && exp >= DoubleConsts.MIN_EXPONENT; // ulp(x) is usually 2^(SIGNIFICAND_WIDTH-1)*(2^ilogb(x)) exp = exp - (DoubleConsts.SIGNIFICAND_WIDTH-1); if (exp >= DoubleConsts.MIN_EXPONENT) { return powerOfTwoD(exp); } else { // return a subnormal result; left shift integer // representation of Double.MIN_VALUE appropriate // number of positions return Double.longBitsToDouble(1L << (exp - (DoubleConsts.MIN_EXPONENT - (DoubleConsts.SIGNIFICAND_WIDTH-1)) )); } } } }
public class class_name { public static double ulp(double d) { int exp = getExponent(d); switch(exp) { case DoubleConsts.MAX_EXPONENT+1: // NaN or infinity return Math.abs(d); case DoubleConsts.MIN_EXPONENT-1: // zero or subnormal return Double.MIN_VALUE; default: assert exp <= DoubleConsts.MAX_EXPONENT && exp >= DoubleConsts.MIN_EXPONENT; // ulp(x) is usually 2^(SIGNIFICAND_WIDTH-1)*(2^ilogb(x)) exp = exp - (DoubleConsts.SIGNIFICAND_WIDTH-1); if (exp >= DoubleConsts.MIN_EXPONENT) { return powerOfTwoD(exp); // depends on control dependency: [if], data = [(exp] } else { // return a subnormal result; left shift integer // representation of Double.MIN_VALUE appropriate // number of positions return Double.longBitsToDouble(1L << (exp - (DoubleConsts.MIN_EXPONENT - (DoubleConsts.SIGNIFICAND_WIDTH-1)) )); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public static int fromHSV(float h, float s, float v, int a) { float r = v; float g = v; float b = v; int i; float f, p, q, t; if (s == 0) { // achromatic (grey) int ri = (int) (r * 0xff); int gi = (int) (g * 0xff); int bi = (int) (b * 0xff); return getRGB(ri, gi, bi); } h /= 60; // sector 0 to 5 i = (int) Math.floor(h); f = h - i; // factorial part of h p = v * (1 - s); q = v * (1 - s * f); t = v * (1 - s * (1 - f)); switch (i) { case 0: r = v; g = t; b = p; break; case 1: r = q; g = v; b = p; break; case 2: r = p; g = v; b = t; break; case 3: r = p; g = q; b = v; break; case 4: r = t; g = p; b = v; break; // case 5: default: r = v; g = p; b = q; break; } int ri = (int) (r * 0xff); int gi = (int) (g * 0xff); int bi = (int) (b * 0xff); return getARGB(ri, gi, bi, a); } }
public class class_name { public static int fromHSV(float h, float s, float v, int a) { float r = v; float g = v; float b = v; int i; float f, p, q, t; if (s == 0) { // achromatic (grey) int ri = (int) (r * 0xff); int gi = (int) (g * 0xff); int bi = (int) (b * 0xff); return getRGB(ri, gi, bi); // depends on control dependency: [if], data = [none] } h /= 60; // sector 0 to 5 i = (int) Math.floor(h); f = h - i; // factorial part of h p = v * (1 - s); q = v * (1 - s * f); t = v * (1 - s * (1 - f)); switch (i) { case 0: r = v; g = t; b = p; break; case 1: r = q; g = v; b = p; break; case 2: r = p; g = v; b = t; break; case 3: r = p; g = q; b = v; break; case 4: r = t; g = p; b = v; break; // case 5: default: r = v; g = p; b = q; break; } int ri = (int) (r * 0xff); int gi = (int) (g * 0xff); int bi = (int) (b * 0xff); return getARGB(ri, gi, bi, a); } }
public class class_name { public final DSLMapParser.meta_section_return meta_section() throws RecognitionException { DSLMapParser.meta_section_return retval = new DSLMapParser.meta_section_return(); retval.start = input.LT(1); Object root_0 = null; Token LEFT_SQUARE13=null; Token LITERAL14=null; Token RIGHT_SQUARE15=null; Object LEFT_SQUARE13_tree=null; Object LITERAL14_tree=null; Object RIGHT_SQUARE15_tree=null; RewriteRuleTokenStream stream_RIGHT_SQUARE=new RewriteRuleTokenStream(adaptor,"token RIGHT_SQUARE"); RewriteRuleTokenStream stream_LITERAL=new RewriteRuleTokenStream(adaptor,"token LITERAL"); RewriteRuleTokenStream stream_LEFT_SQUARE=new RewriteRuleTokenStream(adaptor,"token LEFT_SQUARE"); try { // src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:145:5: ( LEFT_SQUARE ( LITERAL )? RIGHT_SQUARE -> ^( VT_META[$LEFT_SQUARE, \"META SECTION\"] ( LITERAL )? ) ) // src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:145:7: LEFT_SQUARE ( LITERAL )? RIGHT_SQUARE { LEFT_SQUARE13=(Token)match(input,LEFT_SQUARE,FOLLOW_LEFT_SQUARE_in_meta_section530); if (state.failed) return retval; if ( state.backtracking==0 ) stream_LEFT_SQUARE.add(LEFT_SQUARE13); // src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:145:19: ( LITERAL )? int alt7=2; int LA7_0 = input.LA(1); if ( (LA7_0==LITERAL) ) { alt7=1; } switch (alt7) { case 1 : // src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:145:19: LITERAL { LITERAL14=(Token)match(input,LITERAL,FOLLOW_LITERAL_in_meta_section532); if (state.failed) return retval; if ( state.backtracking==0 ) stream_LITERAL.add(LITERAL14); } break; } RIGHT_SQUARE15=(Token)match(input,RIGHT_SQUARE,FOLLOW_RIGHT_SQUARE_in_meta_section535); if (state.failed) return retval; if ( state.backtracking==0 ) stream_RIGHT_SQUARE.add(RIGHT_SQUARE15); // AST REWRITE // elements: LITERAL // token labels: // rule labels: retval // token list labels: // rule list labels: // wildcard labels: if ( state.backtracking==0 ) { retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null); root_0 = (Object)adaptor.nil(); // 146:5: -> ^( VT_META[$LEFT_SQUARE, \"META SECTION\"] ( LITERAL )? ) { // src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:146:8: ^( VT_META[$LEFT_SQUARE, \"META SECTION\"] ( LITERAL )? ) { Object root_1 = (Object)adaptor.nil(); root_1 = (Object)adaptor.becomeRoot((Object)adaptor.create(VT_META, LEFT_SQUARE13, "META SECTION"), root_1); // src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:146:48: ( LITERAL )? if ( stream_LITERAL.hasNext() ) { adaptor.addChild(root_1, stream_LITERAL.nextNode()); } stream_LITERAL.reset(); adaptor.addChild(root_0, root_1); } } retval.tree = root_0; } } 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 { // do for sure before leaving } return retval; } }
public class class_name { public final DSLMapParser.meta_section_return meta_section() throws RecognitionException { DSLMapParser.meta_section_return retval = new DSLMapParser.meta_section_return(); retval.start = input.LT(1); Object root_0 = null; Token LEFT_SQUARE13=null; Token LITERAL14=null; Token RIGHT_SQUARE15=null; Object LEFT_SQUARE13_tree=null; Object LITERAL14_tree=null; Object RIGHT_SQUARE15_tree=null; RewriteRuleTokenStream stream_RIGHT_SQUARE=new RewriteRuleTokenStream(adaptor,"token RIGHT_SQUARE"); RewriteRuleTokenStream stream_LITERAL=new RewriteRuleTokenStream(adaptor,"token LITERAL"); RewriteRuleTokenStream stream_LEFT_SQUARE=new RewriteRuleTokenStream(adaptor,"token LEFT_SQUARE"); try { // src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:145:5: ( LEFT_SQUARE ( LITERAL )? RIGHT_SQUARE -> ^( VT_META[$LEFT_SQUARE, \"META SECTION\"] ( LITERAL )? ) ) // src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:145:7: LEFT_SQUARE ( LITERAL )? RIGHT_SQUARE { LEFT_SQUARE13=(Token)match(input,LEFT_SQUARE,FOLLOW_LEFT_SQUARE_in_meta_section530); if (state.failed) return retval; if ( state.backtracking==0 ) stream_LEFT_SQUARE.add(LEFT_SQUARE13); // src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:145:19: ( LITERAL )? int alt7=2; int LA7_0 = input.LA(1); if ( (LA7_0==LITERAL) ) { alt7=1; // depends on control dependency: [if], data = [none] } switch (alt7) { case 1 : // src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:145:19: LITERAL { LITERAL14=(Token)match(input,LITERAL,FOLLOW_LITERAL_in_meta_section532); if (state.failed) return retval; if ( state.backtracking==0 ) stream_LITERAL.add(LITERAL14); } break; } RIGHT_SQUARE15=(Token)match(input,RIGHT_SQUARE,FOLLOW_RIGHT_SQUARE_in_meta_section535); if (state.failed) return retval; if ( state.backtracking==0 ) stream_RIGHT_SQUARE.add(RIGHT_SQUARE15); // AST REWRITE // elements: LITERAL // token labels: // rule labels: retval // token list labels: // rule list labels: // wildcard labels: if ( state.backtracking==0 ) { retval.tree = root_0; // depends on control dependency: [if], data = [none] RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null); root_0 = (Object)adaptor.nil(); // depends on control dependency: [if], data = [none] // 146:5: -> ^( VT_META[$LEFT_SQUARE, \"META SECTION\"] ( LITERAL )? ) { // src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:146:8: ^( VT_META[$LEFT_SQUARE, \"META SECTION\"] ( LITERAL )? ) { Object root_1 = (Object)adaptor.nil(); root_1 = (Object)adaptor.becomeRoot((Object)adaptor.create(VT_META, LEFT_SQUARE13, "META SECTION"), root_1); // src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:146:48: ( LITERAL )? if ( stream_LITERAL.hasNext() ) { adaptor.addChild(root_1, stream_LITERAL.nextNode()); // depends on control dependency: [if], data = [none] } stream_LITERAL.reset(); adaptor.addChild(root_0, root_1); } } retval.tree = root_0; // depends on control dependency: [if], data = [none] } } retval.stop = input.LT(-1); if ( state.backtracking==0 ) { retval.tree = (Object)adaptor.rulePostProcessing(root_0); // depends on control dependency: [if], data = [none] adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); // depends on control dependency: [if], data = [none] } } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (Object)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { // do for sure before leaving } return retval; } }
public class class_name { public boolean computeHomography( CalibrationObservation observedPoints ) { if( observedPoints.size() < 4) throw new IllegalArgumentException("At least 4 points needed in each set of observations. " + " Filter these first please"); List<AssociatedPair> pairs = new ArrayList<>(); for( int i = 0; i < observedPoints.size(); i++ ) { int which = observedPoints.get(i).index; Point2D_F64 obs = observedPoints.get(i); pairs.add( new AssociatedPair(worldPoints.get(which),obs,true)); } if( !computeHomography.process(pairs,found) ) return false; // todo do non-linear refinement. Take advantage of coordinates being fixed return true; } }
public class class_name { public boolean computeHomography( CalibrationObservation observedPoints ) { if( observedPoints.size() < 4) throw new IllegalArgumentException("At least 4 points needed in each set of observations. " + " Filter these first please"); List<AssociatedPair> pairs = new ArrayList<>(); for( int i = 0; i < observedPoints.size(); i++ ) { int which = observedPoints.get(i).index; Point2D_F64 obs = observedPoints.get(i); pairs.add( new AssociatedPair(worldPoints.get(which),obs,true)); // depends on control dependency: [for], data = [none] } if( !computeHomography.process(pairs,found) ) return false; // todo do non-linear refinement. Take advantage of coordinates being fixed return true; } }
public class class_name { public void marshall(HlsManifestCreateOrUpdateParameters hlsManifestCreateOrUpdateParameters, ProtocolMarshaller protocolMarshaller) { if (hlsManifestCreateOrUpdateParameters == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(hlsManifestCreateOrUpdateParameters.getAdMarkers(), ADMARKERS_BINDING); protocolMarshaller.marshall(hlsManifestCreateOrUpdateParameters.getId(), ID_BINDING); protocolMarshaller.marshall(hlsManifestCreateOrUpdateParameters.getIncludeIframeOnlyStream(), INCLUDEIFRAMEONLYSTREAM_BINDING); protocolMarshaller.marshall(hlsManifestCreateOrUpdateParameters.getManifestName(), MANIFESTNAME_BINDING); protocolMarshaller.marshall(hlsManifestCreateOrUpdateParameters.getPlaylistType(), PLAYLISTTYPE_BINDING); protocolMarshaller.marshall(hlsManifestCreateOrUpdateParameters.getPlaylistWindowSeconds(), PLAYLISTWINDOWSECONDS_BINDING); protocolMarshaller.marshall(hlsManifestCreateOrUpdateParameters.getProgramDateTimeIntervalSeconds(), PROGRAMDATETIMEINTERVALSECONDS_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(HlsManifestCreateOrUpdateParameters hlsManifestCreateOrUpdateParameters, ProtocolMarshaller protocolMarshaller) { if (hlsManifestCreateOrUpdateParameters == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(hlsManifestCreateOrUpdateParameters.getAdMarkers(), ADMARKERS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(hlsManifestCreateOrUpdateParameters.getId(), ID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(hlsManifestCreateOrUpdateParameters.getIncludeIframeOnlyStream(), INCLUDEIFRAMEONLYSTREAM_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(hlsManifestCreateOrUpdateParameters.getManifestName(), MANIFESTNAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(hlsManifestCreateOrUpdateParameters.getPlaylistType(), PLAYLISTTYPE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(hlsManifestCreateOrUpdateParameters.getPlaylistWindowSeconds(), PLAYLISTWINDOWSECONDS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(hlsManifestCreateOrUpdateParameters.getProgramDateTimeIntervalSeconds(), PROGRAMDATETIMEINTERVALSECONDS_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 { @SuppressWarnings({"unchecked"}) public synchronized ClassReflectionIndex getClassIndex(Class clazz) { try { ClassReflectionIndex index = classes.get(clazz); if (index == null) { final SecurityManager sm = System.getSecurityManager(); if (sm == null) { index = new ClassReflectionIndex(clazz, this); } else { index = AccessController.doPrivileged((PrivilegedAction<ClassReflectionIndex>) () -> new ClassReflectionIndex(clazz, this)); } classes.put(clazz, index); } return index; } catch (Throwable e) { throw ServerLogger.ROOT_LOGGER.errorGettingReflectiveInformation(clazz, clazz.getClassLoader(), e); } } }
public class class_name { @SuppressWarnings({"unchecked"}) public synchronized ClassReflectionIndex getClassIndex(Class clazz) { try { ClassReflectionIndex index = classes.get(clazz); if (index == null) { final SecurityManager sm = System.getSecurityManager(); if (sm == null) { index = new ClassReflectionIndex(clazz, this); // depends on control dependency: [if], data = [none] } else { index = AccessController.doPrivileged((PrivilegedAction<ClassReflectionIndex>) () -> new ClassReflectionIndex(clazz, this)); // depends on control dependency: [if], data = [none] } classes.put(clazz, index); // depends on control dependency: [if], data = [none] } return index; // depends on control dependency: [try], data = [none] } catch (Throwable e) { throw ServerLogger.ROOT_LOGGER.errorGettingReflectiveInformation(clazz, clazz.getClassLoader(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public synchronized void reset() throws IOException { checkClosed(); try { if (mpos <= Integer.MAX_VALUE) { lo.seek((int)mpos); } else { lo.seek64(mpos, LargeObject.SEEK_SET); } buffer = null; apos = mpos; } catch (SQLException se) { throw new IOException(se.toString()); } } }
public class class_name { public synchronized void reset() throws IOException { checkClosed(); try { if (mpos <= Integer.MAX_VALUE) { lo.seek((int)mpos); // depends on control dependency: [if], data = [none] } else { lo.seek64(mpos, LargeObject.SEEK_SET); // depends on control dependency: [if], data = [(mpos] } buffer = null; apos = mpos; } catch (SQLException se) { throw new IOException(se.toString()); } } }
public class class_name { protected static String createContextMenu(JavaScriptObject jso) { JsArray<?> jsItemArray = jso.<JsArray<?>> cast(); List<String> jsItemList = new ArrayList<String>(); for (int i = 0; i < jsItemArray.length(); i++) { jsItemList.add(jsItemArray.get(i).toString()); } return CmsTinyMceToolbarHelper.getContextMenuEntries(jsItemList); } }
public class class_name { protected static String createContextMenu(JavaScriptObject jso) { JsArray<?> jsItemArray = jso.<JsArray<?>> cast(); List<String> jsItemList = new ArrayList<String>(); for (int i = 0; i < jsItemArray.length(); i++) { jsItemList.add(jsItemArray.get(i).toString()); // depends on control dependency: [for], data = [i] } return CmsTinyMceToolbarHelper.getContextMenuEntries(jsItemList); } }
public class class_name { public JsonElement serialize(Enum<?> src, Type typeOfSrc, JsonSerializationContext context) { // Ignore this serializer for enums of class PaymentType. if (src.getDeclaringClass().equals(PaymentType.class)) { return context.serialize(src.name()); } return context.serialize(src.name().toLowerCase()); } }
public class class_name { public JsonElement serialize(Enum<?> src, Type typeOfSrc, JsonSerializationContext context) { // Ignore this serializer for enums of class PaymentType. if (src.getDeclaringClass().equals(PaymentType.class)) { return context.serialize(src.name()); // depends on control dependency: [if], data = [none] } return context.serialize(src.name().toLowerCase()); } }
public class class_name { @Override public ScheduledFuture<?> scheduleWithFixedDelay(Runnable task, long delay) { try { return this.scheduledExecutor.scheduleWithFixedDelay(decorateTask(task, true), 0, delay, TimeUnit.MILLISECONDS); } catch (RejectedExecutionException ex) { throw new TaskRejectedException("Executor [" + this.scheduledExecutor + "] did not accept task: " + task, ex); } } }
public class class_name { @Override public ScheduledFuture<?> scheduleWithFixedDelay(Runnable task, long delay) { try { return this.scheduledExecutor.scheduleWithFixedDelay(decorateTask(task, true), 0, delay, TimeUnit.MILLISECONDS); // depends on control dependency: [try], data = [none] } catch (RejectedExecutionException ex) { throw new TaskRejectedException("Executor [" + this.scheduledExecutor + "] did not accept task: " + task, ex); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private Set<String> getJarMemberSet(String absolutePathToJar) { /* * Note: * Our implementation returns a HashSet. initialCapacity and loadFactor are carefully tweaked for speed and RAM optimization purposes. * * Benchmark: * The HashSet implementation is about 10% slower to build (only happens once) than the ArrayList. * The HashSet with shiftBits = 1 was about 33 times(!) faster than the ArrayList for retrievals. */ try { int shiftBits = 1; // (fast, but big) 0 <= shiftBits <= 5, say (slower & compact) JarFile jar = new JarFile(absolutePathToJar); /* * Find the first power of 2 >= JarSize (as calculated in HashSet constructor) */ int jarSizePower2 = Integer.highestOneBit(jar.size()); if (jarSizePower2 != jar.size()) jarSizePower2 <<= 1; if (jarSizePower2 == 0) jarSizePower2 = 1; Set<String> jarMembers = new HashSet<String>(jarSizePower2 >> shiftBits, 1 << shiftBits); try { Enumeration<JarEntry> entries = jar.entries(); while (entries.hasMoreElements()) { JarEntry jarEntry = entries.nextElement(); if (jarEntry.isDirectory()) continue; jarMembers.add(jarEntry.getName()); } } catch (Exception ignore) { // ignored; if the jar can't be read, treating it as if the jar contains no classes is just what we want. } finally { jar.close(); } return jarMembers; } catch (Exception newJarFileException) { return Collections.emptySet(); } } }
public class class_name { private Set<String> getJarMemberSet(String absolutePathToJar) { /* * Note: * Our implementation returns a HashSet. initialCapacity and loadFactor are carefully tweaked for speed and RAM optimization purposes. * * Benchmark: * The HashSet implementation is about 10% slower to build (only happens once) than the ArrayList. * The HashSet with shiftBits = 1 was about 33 times(!) faster than the ArrayList for retrievals. */ try { int shiftBits = 1; // (fast, but big) 0 <= shiftBits <= 5, say (slower & compact) JarFile jar = new JarFile(absolutePathToJar); /* * Find the first power of 2 >= JarSize (as calculated in HashSet constructor) */ int jarSizePower2 = Integer.highestOneBit(jar.size()); if (jarSizePower2 != jar.size()) jarSizePower2 <<= 1; if (jarSizePower2 == 0) jarSizePower2 = 1; Set<String> jarMembers = new HashSet<String>(jarSizePower2 >> shiftBits, 1 << shiftBits); try { Enumeration<JarEntry> entries = jar.entries(); while (entries.hasMoreElements()) { JarEntry jarEntry = entries.nextElement(); if (jarEntry.isDirectory()) continue; jarMembers.add(jarEntry.getName()); // depends on control dependency: [while], data = [none] } } catch (Exception ignore) { // ignored; if the jar can't be read, treating it as if the jar contains no classes is just what we want. } finally { // depends on control dependency: [catch], data = [none] jar.close(); } return jarMembers; // depends on control dependency: [try], data = [none] } catch (Exception newJarFileException) { return Collections.emptySet(); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void processResources(List<Row> permanentRows, List<Row> consumableRows) { // // Process permanent resources // for (Row row : permanentRows) { Resource resource = m_project.addResource(); resource.setType(ResourceType.WORK); resource.setUniqueID(row.getInteger("PERMANENT_RESOURCEID")); resource.setEmailAddress(row.getString("EMAIL_ADDRESS")); // EFFORT_TIME_UNIT resource.setName(row.getString("NASE")); resource.setResourceCalendar(deriveResourceCalendar(row.getInteger("CALENDAV"))); resource.setMaxUnits(Double.valueOf(row.getDouble("AVAILABILITY").doubleValue() * 100)); resource.setGeneric(row.getBoolean("CREATED_AS_FOLDER")); resource.setInitials(getInitials(resource.getName())); } // // Process groups // /* for (Row row : permanentRows) { Resource resource = m_project.getResourceByUniqueID(row.getInteger("PERMANENT_RESOURCEID")); Resource group = m_project.getResourceByUniqueID(row.getInteger("ROLE")); if (resource != null && group != null) { resource.setGroup(group.getName()); } } */ // // Process consumable resources // for (Row row : consumableRows) { Resource resource = m_project.addResource(); resource.setType(ResourceType.MATERIAL); resource.setUniqueID(row.getInteger("CONSUMABLE_RESOURCEID")); resource.setCostPerUse(row.getDouble("COST_PER_USEDEFAULTSAMOUNT")); resource.setPeakUnits(Double.valueOf(row.getDouble("AVAILABILITY").doubleValue() * 100)); resource.setName(row.getString("NASE")); resource.setResourceCalendar(deriveResourceCalendar(row.getInteger("CALENDAV"))); resource.setAvailableFrom(row.getDate("AVAILABLE_FROM")); resource.setAvailableTo(row.getDate("AVAILABLE_TO")); resource.setGeneric(row.getBoolean("CREATED_AS_FOLDER")); resource.setMaterialLabel(row.getString("MEASUREMENT")); resource.setInitials(getInitials(resource.getName())); } } }
public class class_name { public void processResources(List<Row> permanentRows, List<Row> consumableRows) { // // Process permanent resources // for (Row row : permanentRows) { Resource resource = m_project.addResource(); resource.setType(ResourceType.WORK); // depends on control dependency: [for], data = [none] resource.setUniqueID(row.getInteger("PERMANENT_RESOURCEID")); // depends on control dependency: [for], data = [row] resource.setEmailAddress(row.getString("EMAIL_ADDRESS")); // depends on control dependency: [for], data = [row] // EFFORT_TIME_UNIT resource.setName(row.getString("NASE")); // depends on control dependency: [for], data = [row] resource.setResourceCalendar(deriveResourceCalendar(row.getInteger("CALENDAV"))); // depends on control dependency: [for], data = [row] resource.setMaxUnits(Double.valueOf(row.getDouble("AVAILABILITY").doubleValue() * 100)); // depends on control dependency: [for], data = [row] resource.setGeneric(row.getBoolean("CREATED_AS_FOLDER")); // depends on control dependency: [for], data = [row] resource.setInitials(getInitials(resource.getName())); // depends on control dependency: [for], data = [none] } // // Process groups // /* for (Row row : permanentRows) { Resource resource = m_project.getResourceByUniqueID(row.getInteger("PERMANENT_RESOURCEID")); Resource group = m_project.getResourceByUniqueID(row.getInteger("ROLE")); if (resource != null && group != null) { resource.setGroup(group.getName()); } } */ // // Process consumable resources // for (Row row : consumableRows) { Resource resource = m_project.addResource(); resource.setType(ResourceType.MATERIAL); // depends on control dependency: [for], data = [none] resource.setUniqueID(row.getInteger("CONSUMABLE_RESOURCEID")); // depends on control dependency: [for], data = [row] resource.setCostPerUse(row.getDouble("COST_PER_USEDEFAULTSAMOUNT")); // depends on control dependency: [for], data = [row] resource.setPeakUnits(Double.valueOf(row.getDouble("AVAILABILITY").doubleValue() * 100)); // depends on control dependency: [for], data = [row] resource.setName(row.getString("NASE")); // depends on control dependency: [for], data = [row] resource.setResourceCalendar(deriveResourceCalendar(row.getInteger("CALENDAV"))); // depends on control dependency: [for], data = [row] resource.setAvailableFrom(row.getDate("AVAILABLE_FROM")); // depends on control dependency: [for], data = [row] resource.setAvailableTo(row.getDate("AVAILABLE_TO")); // depends on control dependency: [for], data = [row] resource.setGeneric(row.getBoolean("CREATED_AS_FOLDER")); // depends on control dependency: [for], data = [row] resource.setMaterialLabel(row.getString("MEASUREMENT")); // depends on control dependency: [for], data = [row] resource.setInitials(getInitials(resource.getName())); // depends on control dependency: [for], data = [none] } } }
public class class_name { private static String readLine(InputStream is) throws IOException { StringBuilder builder = new StringBuilder(); while (true) { int ch = is.read(); if (ch == '\r') { ch = is.read(); if (ch == '\n') { break; } else { throw new IOException("unexpected char after \\r: " + ch); } } else if (ch == -1) { if (builder.length() > 0) { throw new IOException("unexpected end of stream"); } break; } builder.append((char) ch); } return builder.toString(); } }
public class class_name { private static String readLine(InputStream is) throws IOException { StringBuilder builder = new StringBuilder(); while (true) { int ch = is.read(); if (ch == '\r') { ch = is.read(); // depends on control dependency: [if], data = [none] if (ch == '\n') { break; } else { throw new IOException("unexpected char after \\r: " + ch); } } else if (ch == -1) { if (builder.length() > 0) { throw new IOException("unexpected end of stream"); } break; } builder.append((char) ch); } return builder.toString(); } }
public class class_name { public boolean isViewMapped(String viewId) { if (viewId != null) { viewId = viewId.trim(); for (UrlMapping mapping : mappings) { if (viewId.equals(mapping.getViewId()) || (viewId.startsWith("/") && viewId.substring(1).equals(mapping.getViewId()))) { return true; } } } return false; } }
public class class_name { public boolean isViewMapped(String viewId) { if (viewId != null) { viewId = viewId.trim(); // depends on control dependency: [if], data = [none] for (UrlMapping mapping : mappings) { if (viewId.equals(mapping.getViewId()) || (viewId.startsWith("/") && viewId.substring(1).equals(mapping.getViewId()))) { return true; // depends on control dependency: [if], data = [none] } } } return false; } }
public class class_name { public String mapFontNr(String fontNr) { if(this.importFontMapping.containsKey(fontNr)) { return (String) this.importFontMapping.get(fontNr); } else { return "0"; } } }
public class class_name { public String mapFontNr(String fontNr) { if(this.importFontMapping.containsKey(fontNr)) { return (String) this.importFontMapping.get(fontNr); // depends on control dependency: [if], data = [none] } else { return "0"; // depends on control dependency: [if], data = [none] } } }
public class class_name { public void marshall(VPCDerivedInfoStatus vPCDerivedInfoStatus, ProtocolMarshaller protocolMarshaller) { if (vPCDerivedInfoStatus == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(vPCDerivedInfoStatus.getOptions(), OPTIONS_BINDING); protocolMarshaller.marshall(vPCDerivedInfoStatus.getStatus(), STATUS_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(VPCDerivedInfoStatus vPCDerivedInfoStatus, ProtocolMarshaller protocolMarshaller) { if (vPCDerivedInfoStatus == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(vPCDerivedInfoStatus.getOptions(), OPTIONS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(vPCDerivedInfoStatus.getStatus(), STATUS_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 setFrequency(BigDecimal targetFrequency, BigDecimal frequencyCorrectionFactor) { validateFrequency(targetFrequency); frequency = targetFrequency; periodDurationMicros = calculatePeriodDuration(); int prescale = calculatePrescale(frequencyCorrectionFactor); int oldMode; try { oldMode = device.read(PCA9685A_MODE1); int newMode = (oldMode & 0x7F) | 0x10; // sleep device.write(PCA9685A_MODE1, (byte) newMode); // go to sleep device.write(PCA9685A_PRESCALE, (byte) prescale); device.write(PCA9685A_MODE1, (byte) oldMode); Thread.sleep(1); device.write(PCA9685A_MODE1, (byte) (oldMode | 0x80)); } catch (IOException e) { throw new RuntimeException("Unable to set prescale value [" + prescale + "]", e); } catch (InterruptedException e) { throw new RuntimeException(e); } } }
public class class_name { public void setFrequency(BigDecimal targetFrequency, BigDecimal frequencyCorrectionFactor) { validateFrequency(targetFrequency); frequency = targetFrequency; periodDurationMicros = calculatePeriodDuration(); int prescale = calculatePrescale(frequencyCorrectionFactor); int oldMode; try { oldMode = device.read(PCA9685A_MODE1); // depends on control dependency: [try], data = [none] int newMode = (oldMode & 0x7F) | 0x10; // sleep device.write(PCA9685A_MODE1, (byte) newMode); // go to sleep // depends on control dependency: [try], data = [none] device.write(PCA9685A_PRESCALE, (byte) prescale); // depends on control dependency: [try], data = [none] device.write(PCA9685A_MODE1, (byte) oldMode); // depends on control dependency: [try], data = [none] Thread.sleep(1); // depends on control dependency: [try], data = [none] device.write(PCA9685A_MODE1, (byte) (oldMode | 0x80)); // depends on control dependency: [try], data = [none] } catch (IOException e) { throw new RuntimeException("Unable to set prescale value [" + prescale + "]", e); } catch (InterruptedException e) { // depends on control dependency: [catch], data = [none] throw new RuntimeException(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void revertLabels(@NonNull INDArray[] labels, INDArray[] maskArrays, int output) { NormalizerStrategy strategy = getStrategy(globalOutputStrategy, perOutputStrategies, output); if (strategy != null) { INDArray mask = (maskArrays == null ? null : maskArrays[output]); //noinspection unchecked strategy.revert(labels[output], mask, getOutputStats(output)); } } }
public class class_name { public void revertLabels(@NonNull INDArray[] labels, INDArray[] maskArrays, int output) { NormalizerStrategy strategy = getStrategy(globalOutputStrategy, perOutputStrategies, output); if (strategy != null) { INDArray mask = (maskArrays == null ? null : maskArrays[output]); //noinspection unchecked strategy.revert(labels[output], mask, getOutputStats(output)); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public Object[] findIdsByColumn(String schemaName, String tableName, String pKeyName, String columnName, Object columnValue, Class entityClazz) { EntityMetadata m = KunderaMetadataManager.getEntityMetadata(kunderaMetadata, entityClazz); byte[] valueInBytes = HBaseUtils.getBytes(columnValue); Filter f = new SingleColumnValueFilter(Bytes.toBytes(tableName), Bytes.toBytes(columnName), CompareOp.EQUAL, valueInBytes); KeyOnlyFilter keyFilter = new KeyOnlyFilter(); FilterList filterList = new FilterList(f, keyFilter); try { return handler.scanRowyKeys(filterList, schemaName, tableName, columnName + "_" + columnValue, m .getIdAttribute().getBindableJavaType()); } catch (IOException e) { log.error("Error while executing findIdsByColumn(), Caused by: .", e); throw new KunderaException(e); } } }
public class class_name { @Override public Object[] findIdsByColumn(String schemaName, String tableName, String pKeyName, String columnName, Object columnValue, Class entityClazz) { EntityMetadata m = KunderaMetadataManager.getEntityMetadata(kunderaMetadata, entityClazz); byte[] valueInBytes = HBaseUtils.getBytes(columnValue); Filter f = new SingleColumnValueFilter(Bytes.toBytes(tableName), Bytes.toBytes(columnName), CompareOp.EQUAL, valueInBytes); KeyOnlyFilter keyFilter = new KeyOnlyFilter(); FilterList filterList = new FilterList(f, keyFilter); try { return handler.scanRowyKeys(filterList, schemaName, tableName, columnName + "_" + columnValue, m .getIdAttribute().getBindableJavaType()); // depends on control dependency: [try], data = [none] } catch (IOException e) { log.error("Error while executing findIdsByColumn(), Caused by: .", e); throw new KunderaException(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static String join(final String sep, final Iterable<String> strs) { final StringBuilder buf = new StringBuilder(); String prefix = ""; for (final String str : strs) { buf.append(prefix).append(str); prefix = sep; } return buf.toString(); } }
public class class_name { public static String join(final String sep, final Iterable<String> strs) { final StringBuilder buf = new StringBuilder(); String prefix = ""; for (final String str : strs) { buf.append(prefix).append(str); // depends on control dependency: [for], data = [str] prefix = sep; // depends on control dependency: [for], data = [none] } return buf.toString(); } }
public class class_name { @Override public E next() { if (!checkOnFetchSize() || scrollComplete) { throw new NoSuchElementException("Nothing to scroll further for:" + entityMetadata.getEntityClazz()); } E result = (E) handler.next(entityMetadata, columns); if (!entityMetadata.isRelationViaJoinTable() && (entityMetadata.getRelationNames() == null || (entityMetadata.getRelationNames().isEmpty()))) { return result; } else { return result = setRelationEntities(result, client, entityMetadata); } } }
public class class_name { @Override public E next() { if (!checkOnFetchSize() || scrollComplete) { throw new NoSuchElementException("Nothing to scroll further for:" + entityMetadata.getEntityClazz()); } E result = (E) handler.next(entityMetadata, columns); if (!entityMetadata.isRelationViaJoinTable() && (entityMetadata.getRelationNames() == null || (entityMetadata.getRelationNames().isEmpty()))) { return result; // depends on control dependency: [if], data = [none] } else { return result = setRelationEntities(result, client, entityMetadata); // depends on control dependency: [if], data = [none] } } }