code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { public void addFocusListener(FocusListener l) { super.addFocusListener(l); if (l instanceof JBasePanel) { m_tf.addFocusListener(l); if (m_button != null) m_button.addFocusListener(l); if (m_buttonTime != null) m_buttonTime.addFocusListener(l); } } }
public class class_name { public void addFocusListener(FocusListener l) { super.addFocusListener(l); if (l instanceof JBasePanel) { m_tf.addFocusListener(l); // depends on control dependency: [if], data = [none] if (m_button != null) m_button.addFocusListener(l); if (m_buttonTime != null) m_buttonTime.addFocusListener(l); } } }
public class class_name { private String getGangliaConfig(String cmdLine, Node ganglia, String attributeName, String defaultValue) { if (cmdLine == null) { return selectParameterFromNode(ganglia, attributeName, defaultValue); } else { return cmdLine; } } }
public class class_name { private String getGangliaConfig(String cmdLine, Node ganglia, String attributeName, String defaultValue) { if (cmdLine == null) { return selectParameterFromNode(ganglia, attributeName, defaultValue); // depends on control dependency: [if], data = [none] } else { return cmdLine; // depends on control dependency: [if], data = [none] } } }
public class class_name { public void setCidrIps(java.util.Collection<String> cidrIps) { if (cidrIps == null) { this.cidrIps = null; return; } this.cidrIps = new com.amazonaws.internal.SdkInternalList<String>(cidrIps); } }
public class class_name { public void setCidrIps(java.util.Collection<String> cidrIps) { if (cidrIps == null) { this.cidrIps = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.cidrIps = new com.amazonaws.internal.SdkInternalList<String>(cidrIps); } }
public class class_name { @JsonSetter("enterpriseContextViews") void setEnterpriseContextViews(Collection<SystemLandscapeView> enterpriseContextViews) { if (enterpriseContextViews != null) { this.systemLandscapeViews = new HashSet<>(enterpriseContextViews); } } }
public class class_name { @JsonSetter("enterpriseContextViews") void setEnterpriseContextViews(Collection<SystemLandscapeView> enterpriseContextViews) { if (enterpriseContextViews != null) { this.systemLandscapeViews = new HashSet<>(enterpriseContextViews); // depends on control dependency: [if], data = [(enterpriseContextViews] } } }
public class class_name { protected static String[] calculateBundleNames(String baseName, Locale locale) { int length = 1; boolean hasLanguage = locale.getLanguage().length() > 0; if (hasLanguage) { length++; } boolean hasCountry = locale.getCountry().length() > 0; if (hasCountry) { length++; } boolean hasVariant = locale.getVariant().length() > 0; if (hasVariant) { length++; } String[] result = new String[length]; int index = 0; result[index++] = baseName; if (!(hasLanguage || hasCountry || hasVariant)) { return result; } StringBuffer buffer = new StringBuffer(baseName); buffer.append('_'); buffer.append(locale.getLanguage()); if (hasLanguage) { result[index++] = new String(buffer); } if (!(hasCountry || hasVariant)) { return result; } buffer.append('_'); buffer.append(locale.getCountry()); if (hasCountry) { result[index++] = new String(buffer); } if (!hasVariant) { return result; } buffer.append('_'); buffer.append(locale.getVariant()); result[index++] = new String(buffer); return result; } }
public class class_name { protected static String[] calculateBundleNames(String baseName, Locale locale) { int length = 1; boolean hasLanguage = locale.getLanguage().length() > 0; if (hasLanguage) { length++; // depends on control dependency: [if], data = [none] } boolean hasCountry = locale.getCountry().length() > 0; if (hasCountry) { length++; // depends on control dependency: [if], data = [none] } boolean hasVariant = locale.getVariant().length() > 0; if (hasVariant) { length++; // depends on control dependency: [if], data = [none] } String[] result = new String[length]; int index = 0; result[index++] = baseName; if (!(hasLanguage || hasCountry || hasVariant)) { return result; // depends on control dependency: [if], data = [none] } StringBuffer buffer = new StringBuffer(baseName); buffer.append('_'); buffer.append(locale.getLanguage()); if (hasLanguage) { result[index++] = new String(buffer); // depends on control dependency: [if], data = [none] } if (!(hasCountry || hasVariant)) { return result; // depends on control dependency: [if], data = [none] } buffer.append('_'); buffer.append(locale.getCountry()); if (hasCountry) { result[index++] = new String(buffer); // depends on control dependency: [if], data = [none] } if (!hasVariant) { return result; // depends on control dependency: [if], data = [none] } buffer.append('_'); buffer.append(locale.getVariant()); result[index++] = new String(buffer); return result; } }
public class class_name { protected void trackCustomCascadingSaves(Mapping mapping, Iterable<PersistentProperty> persistentProperties) { for (PersistentProperty property : persistentProperties) { PropertyConfig propConf = mapping.getPropertyConfig(property.getName()); if (propConf != null && propConf.getCascade() != null) { propConf.setExplicitSaveUpdateCascade(isSaveUpdateCascade(propConf.getCascade())); } } } }
public class class_name { protected void trackCustomCascadingSaves(Mapping mapping, Iterable<PersistentProperty> persistentProperties) { for (PersistentProperty property : persistentProperties) { PropertyConfig propConf = mapping.getPropertyConfig(property.getName()); if (propConf != null && propConf.getCascade() != null) { propConf.setExplicitSaveUpdateCascade(isSaveUpdateCascade(propConf.getCascade())); // depends on control dependency: [if], data = [(propConf] } } } }
public class class_name { @Override public boolean rmUser(final Node node) { LdapUser user = (LdapUser) node; if(node == null) { return false; } try { deletionCount++; ctx.unbind(getOuForNode(user)); } catch (NamingException ex) { handleNamingException(user, ex); } Node ldapUser = getUser(user.getUid()); return ldapUser.isEmpty(); } }
public class class_name { @Override public boolean rmUser(final Node node) { LdapUser user = (LdapUser) node; if(node == null) { return false; // depends on control dependency: [if], data = [none] } try { deletionCount++; // depends on control dependency: [try], data = [none] ctx.unbind(getOuForNode(user)); // depends on control dependency: [try], data = [none] } catch (NamingException ex) { handleNamingException(user, ex); } // depends on control dependency: [catch], data = [none] Node ldapUser = getUser(user.getUid()); return ldapUser.isEmpty(); } }
public class class_name { public List getMtoNImplementor(CollectionDescriptor cod, Object obj) { ResultSetAndStatement rs = null; ArrayList result = new ArrayList(); ClassDescriptor cld = pb.getDescriptorRepository().getDescriptorFor(obj.getClass()); ValueContainer[] pkValues = pb.serviceBrokerHelper().getKeyValues(cld, obj); String[] pkColumns = cod.getFksToThisClass(); String[] fkColumns = cod.getFksToItemClass(); String table = cod.getIndirectionTable(); String selectStmt = pb.serviceSqlGenerator().getSelectMNStatement(table, fkColumns, pkColumns); ClassDescriptor itemCLD = pb.getDescriptorRepository().getDescriptorFor(cod.getItemClass()); Collection extents = pb.getDescriptorRepository().getAllConcreteSubclassDescriptors(itemCLD); if(extents.size() > 0) { itemCLD = (ClassDescriptor) extents.iterator().next(); } FieldDescriptor[] itemClassPKFields = itemCLD.getPkFields(); if(itemClassPKFields.length != fkColumns.length) { throw new PersistenceBrokerException("All pk fields of the element-class need to" + " be declared in the indirection table. Element class is " + itemCLD.getClassNameOfObject() + " with " + itemClassPKFields.length + " pk-fields." + " Declared 'fk-pointing-to-element-class' elements in collection-descriptor are" + fkColumns.length); } try { rs = pb.serviceJdbcAccess().executeSQL(selectStmt, cld, pkValues, Query.NOT_SCROLLABLE); while(rs.m_rs.next()) { ValueContainer[] row = new ValueContainer[fkColumns.length]; for(int i = 0; i < row.length; i++) { row[i] = new ValueContainer(rs.m_rs.getObject(i + 1), itemClassPKFields[i].getJdbcType()); } result.add(new MtoNBroker.Key(row)); } } catch(PersistenceBrokerException e) { throw e; } catch(SQLException e) { throw new PersistenceBrokerSQLException(e); } finally { if(rs != null) rs.close(); } return result; } }
public class class_name { public List getMtoNImplementor(CollectionDescriptor cod, Object obj) { ResultSetAndStatement rs = null; ArrayList result = new ArrayList(); ClassDescriptor cld = pb.getDescriptorRepository().getDescriptorFor(obj.getClass()); ValueContainer[] pkValues = pb.serviceBrokerHelper().getKeyValues(cld, obj); String[] pkColumns = cod.getFksToThisClass(); String[] fkColumns = cod.getFksToItemClass(); String table = cod.getIndirectionTable(); String selectStmt = pb.serviceSqlGenerator().getSelectMNStatement(table, fkColumns, pkColumns); ClassDescriptor itemCLD = pb.getDescriptorRepository().getDescriptorFor(cod.getItemClass()); Collection extents = pb.getDescriptorRepository().getAllConcreteSubclassDescriptors(itemCLD); if(extents.size() > 0) { itemCLD = (ClassDescriptor) extents.iterator().next(); // depends on control dependency: [if], data = [none] } FieldDescriptor[] itemClassPKFields = itemCLD.getPkFields(); if(itemClassPKFields.length != fkColumns.length) { throw new PersistenceBrokerException("All pk fields of the element-class need to" + " be declared in the indirection table. Element class is " + itemCLD.getClassNameOfObject() + " with " + itemClassPKFields.length + " pk-fields." + " Declared 'fk-pointing-to-element-class' elements in collection-descriptor are" + fkColumns.length); } try { rs = pb.serviceJdbcAccess().executeSQL(selectStmt, cld, pkValues, Query.NOT_SCROLLABLE); // depends on control dependency: [try], data = [none] while(rs.m_rs.next()) { ValueContainer[] row = new ValueContainer[fkColumns.length]; for(int i = 0; i < row.length; i++) { row[i] = new ValueContainer(rs.m_rs.getObject(i + 1), itemClassPKFields[i].getJdbcType()); // depends on control dependency: [for], data = [i] } result.add(new MtoNBroker.Key(row)); // depends on control dependency: [while], data = [none] } } catch(PersistenceBrokerException e) { throw e; } // depends on control dependency: [catch], data = [none] catch(SQLException e) { throw new PersistenceBrokerSQLException(e); } // depends on control dependency: [catch], data = [none] finally { if(rs != null) rs.close(); } return result; } }
public class class_name { public static SchemaBuilder fromJson(String json) { try { return JsonSerializer.fromString(json, SchemaBuilder.class); } catch (IOException e) { throw new IndexException(e, "Unparseable JSON schema: {}: {}", e.getMessage(), json); } } }
public class class_name { public static SchemaBuilder fromJson(String json) { try { return JsonSerializer.fromString(json, SchemaBuilder.class); // depends on control dependency: [try], data = [none] } catch (IOException e) { throw new IndexException(e, "Unparseable JSON schema: {}: {}", e.getMessage(), json); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private Response save(Response response) { String jsonBody; String key = response.request().url().toString(); log("----- SAVE FOR OFFLINE : saving starts"); log("---------- for request : " + key); log("---------- trying to parse response body"); //Try to get response body BufferedReader reader; StringBuilder sb = new StringBuilder(); log("---------- trying to parse response body"); InputStream bodyStream = response.body().byteStream(); InputStreamReader bodyReader = new InputStreamReader(bodyStream, Charset.forName("UTF-8")); reader = new BufferedReader(bodyReader); String line; try { while ((line = reader.readLine()) != null) { sb.append(line); } bodyReader.close(); bodyReader.close(); reader.close(); } catch (IOException e) { Log.e(TAG, "IOException : " + e.getMessage()); } jsonBody = sb.toString(); log("---------- trying to save response body for offline"); mCacheQueryHandler.put(key, jsonBody); log("---------- url : " + key); log("---------- body : " + jsonBody); log("----- SAVE FOR OFFLINE : saving ends"); return response.newBuilder().body(ResponseBody.create(response.body().contentType(), jsonBody)).build(); } }
public class class_name { private Response save(Response response) { String jsonBody; String key = response.request().url().toString(); log("----- SAVE FOR OFFLINE : saving starts"); log("---------- for request : " + key); log("---------- trying to parse response body"); //Try to get response body BufferedReader reader; StringBuilder sb = new StringBuilder(); log("---------- trying to parse response body"); InputStream bodyStream = response.body().byteStream(); InputStreamReader bodyReader = new InputStreamReader(bodyStream, Charset.forName("UTF-8")); reader = new BufferedReader(bodyReader); String line; try { while ((line = reader.readLine()) != null) { sb.append(line); // depends on control dependency: [while], data = [none] } bodyReader.close(); // depends on control dependency: [try], data = [none] bodyReader.close(); // depends on control dependency: [try], data = [none] reader.close(); // depends on control dependency: [try], data = [none] } catch (IOException e) { Log.e(TAG, "IOException : " + e.getMessage()); } // depends on control dependency: [catch], data = [none] jsonBody = sb.toString(); log("---------- trying to save response body for offline"); mCacheQueryHandler.put(key, jsonBody); log("---------- url : " + key); log("---------- body : " + jsonBody); log("----- SAVE FOR OFFLINE : saving ends"); return response.newBuilder().body(ResponseBody.create(response.body().contentType(), jsonBody)).build(); } }
public class class_name { private static boolean isInternal(String clsName) { boolean internal = false; for (String internalPackage : internalPackages) { if (clsName.startsWith(internalPackage)) { internal = true; break; } } if (internal) { for (String externalPackage : externalPackages) { if (clsName.startsWith(externalPackage)) { internal = false; break; } } } return internal; } }
public class class_name { private static boolean isInternal(String clsName) { boolean internal = false; for (String internalPackage : internalPackages) { if (clsName.startsWith(internalPackage)) { internal = true; // depends on control dependency: [if], data = [none] break; } } if (internal) { for (String externalPackage : externalPackages) { if (clsName.startsWith(externalPackage)) { internal = false; // depends on control dependency: [if], data = [none] break; } } } return internal; } }
public class class_name { private static boolean addIsotopeDist(IMolecularFormula mf, IIsotope[] isotopes, int idx, int count) { if (count == 0) return true; double frac = 100d; for (int i = 0; i < idx; i++) frac -= isotopes[i].getNaturalAbundance(); double p = isotopes[idx].getNaturalAbundance() / frac; if (p >= 1.0) { mf.addIsotope(isotopes[idx], count); return true; } double kMin = (count + 1) * (1 - p) - 1; double kMax = (count + 1) * (1 - p); if ((int) Math.ceil(kMin) == (int) Math.floor(kMax)) { int k = (int) kMax; mf.addIsotope(isotopes[idx], count - k); // recurse with remaining return addIsotopeDist(mf, isotopes, idx + 1, k); } return false; // multiple are most abundant } }
public class class_name { private static boolean addIsotopeDist(IMolecularFormula mf, IIsotope[] isotopes, int idx, int count) { if (count == 0) return true; double frac = 100d; for (int i = 0; i < idx; i++) frac -= isotopes[i].getNaturalAbundance(); double p = isotopes[idx].getNaturalAbundance() / frac; if (p >= 1.0) { mf.addIsotope(isotopes[idx], count); // depends on control dependency: [if], data = [none] return true; // depends on control dependency: [if], data = [none] } double kMin = (count + 1) * (1 - p) - 1; double kMax = (count + 1) * (1 - p); if ((int) Math.ceil(kMin) == (int) Math.floor(kMax)) { int k = (int) kMax; mf.addIsotope(isotopes[idx], count - k); // depends on control dependency: [if], data = [none] // recurse with remaining return addIsotopeDist(mf, isotopes, idx + 1, k); // depends on control dependency: [if], data = [none] } return false; // multiple are most abundant } }
public class class_name { String getTopic(Record record) throws StageException { String result = publisherConf.topic; if (publisherConf.runtimeTopicResolution) { RecordEL.setRecordInContext(topicVars, record); try { result = topicEval.eval(topicVars, publisherConf.topicExpression, String.class); if (isEmpty(result)) { throw new StageException(Errors.MQTT_08, publisherConf.topicExpression, record.getHeader().getSourceId()); } if (!allowedTopics.contains(result) && !allowAllTopics) { throw new StageException(Errors.MQTT_09, result, record.getHeader().getSourceId()); } } catch (ELEvalException e) { throw new StageException( Errors.MQTT_10, publisherConf.topicExpression, record.getHeader().getSourceId(), e.toString() ); } } return result; } }
public class class_name { String getTopic(Record record) throws StageException { String result = publisherConf.topic; if (publisherConf.runtimeTopicResolution) { RecordEL.setRecordInContext(topicVars, record); try { result = topicEval.eval(topicVars, publisherConf.topicExpression, String.class); // depends on control dependency: [try], data = [none] if (isEmpty(result)) { throw new StageException(Errors.MQTT_08, publisherConf.topicExpression, record.getHeader().getSourceId()); } if (!allowedTopics.contains(result) && !allowAllTopics) { throw new StageException(Errors.MQTT_09, result, record.getHeader().getSourceId()); } } catch (ELEvalException e) { throw new StageException( Errors.MQTT_10, publisherConf.topicExpression, record.getHeader().getSourceId(), e.toString() ); } // depends on control dependency: [catch], data = [none] } return result; } }
public class class_name { public static RuntimeException bubble(Throwable t) { if (t instanceof ExecutionException) { return bubble(t.getCause()); } if (t instanceof TimeoutException) { return new RedisCommandTimeoutException(t); } if (t instanceof InterruptedException) { Thread.currentThread().interrupt(); return new RedisCommandInterruptedException(t); } if (t instanceof RedisException) { return (RedisException) t; } return new RedisException(t); } }
public class class_name { public static RuntimeException bubble(Throwable t) { if (t instanceof ExecutionException) { return bubble(t.getCause()); // depends on control dependency: [if], data = [none] } if (t instanceof TimeoutException) { return new RedisCommandTimeoutException(t); // depends on control dependency: [if], data = [none] } if (t instanceof InterruptedException) { Thread.currentThread().interrupt(); // depends on control dependency: [if], data = [none] return new RedisCommandInterruptedException(t); // depends on control dependency: [if], data = [none] } if (t instanceof RedisException) { return (RedisException) t; // depends on control dependency: [if], data = [none] } return new RedisException(t); } }
public class class_name { void unmarshallLifecycle( final Lifecycle lifecycle, final IPortletDefinition portletDefinition) { /* * If this is an existing portletDefinition, it may (probably does) already contain * lifecycle entries. We need to remove those, because the lifecycle of a portlet after * import should reflect what the document says exactly. */ portletDefinition.clearLifecycle(); if (lifecycle == null) { /* * For backwards-compatibility, a complete absence of * lifecycle information means the portlet is published. */ portletDefinition.updateLifecycleState(PortletLifecycleState.PUBLISHED, systemUser); } else if (lifecycle.getEntries().isEmpty()) { /* * According to the comments for 4.3, we're supposed * to leave the portlet in CREATED state. */ portletDefinition.updateLifecycleState(PortletLifecycleState.CREATED, systemUser); } else { /* * Use a TreeMap because we need to be certain the the entries * get applied to the new portlet definition in a sane order... */ Map<IPortletLifecycleEntry, IPerson> convertedEntries = new TreeMap<>(); /* * Convert each LifecycleEntry (JAXB) to an IPortletLifecycleEntry (internal) */ for (LifecycleEntry entry : lifecycle.getEntries()) { final IPerson user = StringUtils.isNotBlank(entry.getUser()) ? userIdentityStore.getPerson(entry.getUser(), true) : systemUser; // default // We will support case insensitivity of entry/@name in the XML final PortletLifecycleState state = PortletLifecycleState.valueOf(entry.getName().toUpperCase()); // Entries added by an upgrade transform will not have a date final Date date = entry.getValue().equals(useCurrentDatetimeSignal) ? new Date() : entry.getValue().getTime(); convertedEntries.put( new IPortletLifecycleEntry() { @Override public int getUserId() { return user.getID(); } @Override public PortletLifecycleState getLifecycleState() { return state; } @Override public Date getDate() { return date; } @Override public int compareTo(IPortletLifecycleEntry o) { int rslt = date.compareTo(o.getDate()); if (rslt == 0) { rslt = state.getOrder() - o.getLifecycleState().getOrder(); } return rslt; } }, user); } /* * Apply them to the portlet definition */ convertedEntries.forEach( (k, v) -> { portletDefinition.updateLifecycleState( k.getLifecycleState(), v, k.getDate()); }); } } }
public class class_name { void unmarshallLifecycle( final Lifecycle lifecycle, final IPortletDefinition portletDefinition) { /* * If this is an existing portletDefinition, it may (probably does) already contain * lifecycle entries. We need to remove those, because the lifecycle of a portlet after * import should reflect what the document says exactly. */ portletDefinition.clearLifecycle(); if (lifecycle == null) { /* * For backwards-compatibility, a complete absence of * lifecycle information means the portlet is published. */ portletDefinition.updateLifecycleState(PortletLifecycleState.PUBLISHED, systemUser); // depends on control dependency: [if], data = [none] } else if (lifecycle.getEntries().isEmpty()) { /* * According to the comments for 4.3, we're supposed * to leave the portlet in CREATED state. */ portletDefinition.updateLifecycleState(PortletLifecycleState.CREATED, systemUser); // depends on control dependency: [if], data = [none] } else { /* * Use a TreeMap because we need to be certain the the entries * get applied to the new portlet definition in a sane order... */ Map<IPortletLifecycleEntry, IPerson> convertedEntries = new TreeMap<>(); /* * Convert each LifecycleEntry (JAXB) to an IPortletLifecycleEntry (internal) */ for (LifecycleEntry entry : lifecycle.getEntries()) { final IPerson user = StringUtils.isNotBlank(entry.getUser()) ? userIdentityStore.getPerson(entry.getUser(), true) : systemUser; // default // We will support case insensitivity of entry/@name in the XML final PortletLifecycleState state = PortletLifecycleState.valueOf(entry.getName().toUpperCase()); // Entries added by an upgrade transform will not have a date final Date date = entry.getValue().equals(useCurrentDatetimeSignal) ? new Date() : entry.getValue().getTime(); convertedEntries.put( new IPortletLifecycleEntry() { @Override public int getUserId() { return user.getID(); } @Override public PortletLifecycleState getLifecycleState() { return state; } @Override public Date getDate() { return date; } @Override public int compareTo(IPortletLifecycleEntry o) { int rslt = date.compareTo(o.getDate()); if (rslt == 0) { rslt = state.getOrder() - o.getLifecycleState().getOrder(); // depends on control dependency: [if], data = [none] } return rslt; } }, user); // depends on control dependency: [for], data = [none] } /* * Apply them to the portlet definition */ convertedEntries.forEach( (k, v) -> { portletDefinition.updateLifecycleState( k.getLifecycleState(), v, k.getDate()); // depends on control dependency: [if], data = [none] }); } } }
public class class_name { protected void updateSequence() throws RepositoryException { checkIfOpened(); try { ResultSet count = updateNextOrderNumber(localMaxOrderNumber); try { if (!count.next()) { throw new RepositoryException("Could not update the sequence: " + "the returned value cannot be found"); } } finally { try { count.close(); } catch (SQLException e) { LOG.error("Can't close the ResultSet: " + e.getMessage()); } } } catch (SQLException e) { throw new RepositoryException(e); } } }
public class class_name { protected void updateSequence() throws RepositoryException { checkIfOpened(); try { ResultSet count = updateNextOrderNumber(localMaxOrderNumber); try { if (!count.next()) { throw new RepositoryException("Could not update the sequence: " + "the returned value cannot be found"); } } finally { try { count.close(); // depends on control dependency: [try], data = [none] } catch (SQLException e) { LOG.error("Can't close the ResultSet: " + e.getMessage()); } // depends on control dependency: [catch], data = [none] } } catch (SQLException e) { throw new RepositoryException(e); } } }
public class class_name { private boolean fillReadBuffer() throws IOException { // TODO: Add reading from error stream of external process. Otherwise the InputFormat might get deadlocked! // stream was completely processed if(noMoreStreamInput) { if(this.readBufferReadPos == this.readBufferFillPos) { this.noMoreRecordBuffers = true; return false; } else { throw new RuntimeException("External process produced incomplete record"); } } // the buffer was completely filled and processed if(this.readBufferReadPos == this.readBuffer.length && this.readBufferRemainSpace == 0) { // reset counters and fill again this.readBufferFillPos = 0; this.readBufferRemainSpace = this.readBuffer.length; this.readBufferReadPos = 0; } // as long as not at least one record is complete while(this.readBufferFillPos - this.readBufferReadPos < this.recordLength) { // read from stdout int readCnt = super.extProcOutStream.read(this.readBuffer, this.readBufferFillPos, this.readBufferRemainSpace); if(readCnt == -1) { // the is nothing more to read this.noMoreStreamInput = true; return false; } else { // update fill position and remain cnt this.readBufferFillPos += readCnt; this.readBufferRemainSpace -= readCnt; } } return true; } }
public class class_name { private boolean fillReadBuffer() throws IOException { // TODO: Add reading from error stream of external process. Otherwise the InputFormat might get deadlocked! // stream was completely processed if(noMoreStreamInput) { if(this.readBufferReadPos == this.readBufferFillPos) { this.noMoreRecordBuffers = true; // depends on control dependency: [if], data = [none] return false; // depends on control dependency: [if], data = [none] } else { throw new RuntimeException("External process produced incomplete record"); } } // the buffer was completely filled and processed if(this.readBufferReadPos == this.readBuffer.length && this.readBufferRemainSpace == 0) { // reset counters and fill again this.readBufferFillPos = 0; this.readBufferRemainSpace = this.readBuffer.length; this.readBufferReadPos = 0; } // as long as not at least one record is complete while(this.readBufferFillPos - this.readBufferReadPos < this.recordLength) { // read from stdout int readCnt = super.extProcOutStream.read(this.readBuffer, this.readBufferFillPos, this.readBufferRemainSpace); if(readCnt == -1) { // the is nothing more to read this.noMoreStreamInput = true; return false; } else { // update fill position and remain cnt this.readBufferFillPos += readCnt; this.readBufferRemainSpace -= readCnt; } } return true; } }
public class class_name { public boolean setBusStop(BusStop busStop) { final BusStop old = getBusStop(); if ((busStop == null && old != null) || (busStop != null && !busStop.equals(old))) { if (old != null) { old.removeBusHalt(this); } this.busStop = busStop == null ? null : new WeakReference<>(busStop); if (busStop != null) { busStop.addBusHalt(this); } clearPositionBuffers(); fireShapeChanged(); checkPrimitiveValidity(); return true; } return false; } }
public class class_name { public boolean setBusStop(BusStop busStop) { final BusStop old = getBusStop(); if ((busStop == null && old != null) || (busStop != null && !busStop.equals(old))) { if (old != null) { old.removeBusHalt(this); // depends on control dependency: [if], data = [none] } this.busStop = busStop == null ? null : new WeakReference<>(busStop); // depends on control dependency: [if], data = [none] if (busStop != null) { busStop.addBusHalt(this); // depends on control dependency: [if], data = [none] } clearPositionBuffers(); // depends on control dependency: [if], data = [none] fireShapeChanged(); // depends on control dependency: [if], data = [none] checkPrimitiveValidity(); // depends on control dependency: [if], data = [none] return true; // depends on control dependency: [if], data = [none] } return false; } }
public class class_name { public void addFlush() { // There is no need to process all entries if there was already a flush before and no new messages // where added in the meantime. // // See https://github.com/netty/netty/issues/2577 Entry entry = unflushedEntry; if (entry != null) { if (flushedEntry == null) { // there is no flushedEntry yet, so start with the entry flushedEntry = entry; } do { flushed ++; if (!entry.promise.setUncancellable()) { // Was cancelled so make sure we free up memory and notify about the freed bytes int pending = entry.cancel(); decrementPendingOutboundBytes(pending, false, true); } entry = entry.next; } while (entry != null); // All flushed so reset unflushedEntry unflushedEntry = null; } } }
public class class_name { public void addFlush() { // There is no need to process all entries if there was already a flush before and no new messages // where added in the meantime. // // See https://github.com/netty/netty/issues/2577 Entry entry = unflushedEntry; if (entry != null) { if (flushedEntry == null) { // there is no flushedEntry yet, so start with the entry flushedEntry = entry; // depends on control dependency: [if], data = [none] } do { flushed ++; if (!entry.promise.setUncancellable()) { // Was cancelled so make sure we free up memory and notify about the freed bytes int pending = entry.cancel(); decrementPendingOutboundBytes(pending, false, true); // depends on control dependency: [if], data = [none] } entry = entry.next; } while (entry != null); // All flushed so reset unflushedEntry unflushedEntry = null; // depends on control dependency: [if], data = [none] } } }
public class class_name { protected final void insert_at_method_start(MethodGen mg, InstructionList new_il) { // Ignore methods with no instructions InstructionList il = mg.getInstructionList(); if (il == null) { return; } insert_before_handle(mg, il.getStart(), new_il, false); } }
public class class_name { protected final void insert_at_method_start(MethodGen mg, InstructionList new_il) { // Ignore methods with no instructions InstructionList il = mg.getInstructionList(); if (il == null) { return; // depends on control dependency: [if], data = [none] } insert_before_handle(mg, il.getStart(), new_il, false); } }
public class class_name { public static String generateString(int length) { if (length <= 0 || length > 100) { throw new IllegalArgumentException("Can't generate random id with length: " + length); } SecureRandom random = new SecureRandom(); StringBuilder sb = new StringBuilder(length); for (int i = 0; i < length; i++) { sb.append(ELEMENTS.charAt(random.nextInt(ELEMENTS.length()))); } return sb.toString(); } }
public class class_name { public static String generateString(int length) { if (length <= 0 || length > 100) { throw new IllegalArgumentException("Can't generate random id with length: " + length); } SecureRandom random = new SecureRandom(); StringBuilder sb = new StringBuilder(length); for (int i = 0; i < length; i++) { sb.append(ELEMENTS.charAt(random.nextInt(ELEMENTS.length()))); // depends on control dependency: [for], data = [none] } return sb.toString(); } }
public class class_name { @Override public String generateJavascriptTemplateContent(final Map<String, Object> variables, final String methodName) { final StringBuilder sb = new StringBuilder(); sb.append("new"); sb.append(" "); sb.append(methodName); sb.append("("); sb.append("'#"); sb.append(getComponentId()); sb.append("', "); if (0 < variables.size()) { generateJsOptionsForTemplateContent(variables, sb); } sb.append(");"); return sb.toString(); } }
public class class_name { @Override public String generateJavascriptTemplateContent(final Map<String, Object> variables, final String methodName) { final StringBuilder sb = new StringBuilder(); sb.append("new"); sb.append(" "); sb.append(methodName); sb.append("("); sb.append("'#"); sb.append(getComponentId()); sb.append("', "); if (0 < variables.size()) { generateJsOptionsForTemplateContent(variables, sb); // depends on control dependency: [if], data = [none] } sb.append(");"); return sb.toString(); } }
public class class_name { public boolean deleteId(final String identifier) { if (identifier == null) { log.error("Unable to delete a null Identifier value."); return false; } if (this.originString == null) { log.error("Origin has not been set. Cannot delete Identifiers without a valid origin."); return false; } DeleteIdentifierMessage message = new DeleteIdentifierMessage(); message.setOrigin(this.originString); message.setId(identifier); this.session.write(message); log.debug("Sent {}", message); return true; } }
public class class_name { public boolean deleteId(final String identifier) { if (identifier == null) { log.error("Unable to delete a null Identifier value."); // depends on control dependency: [if], data = [none] return false; // depends on control dependency: [if], data = [none] } if (this.originString == null) { log.error("Origin has not been set. Cannot delete Identifiers without a valid origin."); // depends on control dependency: [if], data = [none] return false; // depends on control dependency: [if], data = [none] } DeleteIdentifierMessage message = new DeleteIdentifierMessage(); message.setOrigin(this.originString); message.setId(identifier); this.session.write(message); log.debug("Sent {}", message); return true; } }
public class class_name { public GetStaticIpsResult withStaticIps(StaticIp... staticIps) { if (this.staticIps == null) { setStaticIps(new java.util.ArrayList<StaticIp>(staticIps.length)); } for (StaticIp ele : staticIps) { this.staticIps.add(ele); } return this; } }
public class class_name { public GetStaticIpsResult withStaticIps(StaticIp... staticIps) { if (this.staticIps == null) { setStaticIps(new java.util.ArrayList<StaticIp>(staticIps.length)); // depends on control dependency: [if], data = [none] } for (StaticIp ele : staticIps) { this.staticIps.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public Vertigo deployCluster(final String cluster, final String group, int nodes, final Handler<AsyncResult<Cluster>> doneHandler) { JsonObject config = new JsonObject() .putString("cluster", cluster) .putString("group", group); container.deployVerticle(getClusterMain(), config, nodes, new Handler<AsyncResult<String>>() { @Override public void handle(AsyncResult<String> result) { if (result.failed()) { new DefaultFutureResult<Cluster>(result.cause()).setHandler(doneHandler); } else { getCluster(cluster, doneHandler); } } }); return this; } }
public class class_name { public Vertigo deployCluster(final String cluster, final String group, int nodes, final Handler<AsyncResult<Cluster>> doneHandler) { JsonObject config = new JsonObject() .putString("cluster", cluster) .putString("group", group); container.deployVerticle(getClusterMain(), config, nodes, new Handler<AsyncResult<String>>() { @Override public void handle(AsyncResult<String> result) { if (result.failed()) { new DefaultFutureResult<Cluster>(result.cause()).setHandler(doneHandler); // depends on control dependency: [if], data = [none] } else { getCluster(cluster, doneHandler); // depends on control dependency: [if], data = [none] } } }); return this; } }
public class class_name { public void runInRetryableTransaction(Runnable runnable) throws DataAccessException { TransactionWrapper transaction=null; try { transaction = startTransaction(); runnable.run(); } catch (Throwable e) { if (canRetryTransaction(e)) { transaction = (TransactionWrapper)initTransactionRetry(transaction); ((ProcessExecutor)getTransactionRetrier()).runInTransaction(runnable); } else throw e; } finally { stopTransaction(transaction); } } }
public class class_name { public void runInRetryableTransaction(Runnable runnable) throws DataAccessException { TransactionWrapper transaction=null; try { transaction = startTransaction(); runnable.run(); } catch (Throwable e) { if (canRetryTransaction(e)) { transaction = (TransactionWrapper)initTransactionRetry(transaction); // depends on control dependency: [if], data = [none] ((ProcessExecutor)getTransactionRetrier()).runInTransaction(runnable); // depends on control dependency: [if], data = [none] } else throw e; } finally { stopTransaction(transaction); } } }
public class class_name { protected Object invokeJavascript(String function, Object... args) { Object[] jsArgs = new Object[args.length]; for (int i = 0; i < jsArgs.length; i++) { if (args[i] instanceof JavascriptObject) { jsArgs[i] = ((JavascriptObject) args[i]).getJSObject(); } else if (args[i] instanceof JavascriptEnum) { jsArgs[i] = ((JavascriptEnum) args[i]).getEnumValue(); } else { jsArgs[i] = args[i]; } } return checkUndefined(jsObject.call(function, (Object[]) jsArgs)); } }
public class class_name { protected Object invokeJavascript(String function, Object... args) { Object[] jsArgs = new Object[args.length]; for (int i = 0; i < jsArgs.length; i++) { if (args[i] instanceof JavascriptObject) { jsArgs[i] = ((JavascriptObject) args[i]).getJSObject(); // depends on control dependency: [if], data = [none] } else if (args[i] instanceof JavascriptEnum) { jsArgs[i] = ((JavascriptEnum) args[i]).getEnumValue(); // depends on control dependency: [if], data = [none] } else { jsArgs[i] = args[i]; // depends on control dependency: [if], data = [none] } } return checkUndefined(jsObject.call(function, (Object[]) jsArgs)); } }
public class class_name { protected Field<?> getPrivateField(final FieldHolder<?> fieldHolder, final String propertyName) { if (this.privateFieldConvention != null) { // Determine field name based on convention. MessageFormat arguments are: // // {0} = dateOfBirth, surname // {1} = DateOfBirth, Surname String[] arguments = new String[] { propertyName, StringUtils.capitalize(propertyName) }; String fieldName; synchronized (this.privateFieldConvention) { fieldName = this.privateFieldConvention.format(arguments, new StringBuffer(), null).toString(); } return fieldHolder.getField(fieldName); } Field<?> field = fieldHolder.getField(propertyName); // FORGE-402: support fields starting with capital letter if (field == null && !Character.isUpperCase(propertyName.charAt(0))) { field = fieldHolder.getField(StringUtils.capitalize(propertyName)); } return field; } }
public class class_name { protected Field<?> getPrivateField(final FieldHolder<?> fieldHolder, final String propertyName) { if (this.privateFieldConvention != null) { // Determine field name based on convention. MessageFormat arguments are: // // {0} = dateOfBirth, surname // {1} = DateOfBirth, Surname String[] arguments = new String[] { propertyName, StringUtils.capitalize(propertyName) }; String fieldName; synchronized (this.privateFieldConvention) // depends on control dependency: [if], data = [(this.privateFieldConvention] { fieldName = this.privateFieldConvention.format(arguments, new StringBuffer(), null).toString(); } return fieldHolder.getField(fieldName); // depends on control dependency: [if], data = [none] } Field<?> field = fieldHolder.getField(propertyName); // FORGE-402: support fields starting with capital letter if (field == null && !Character.isUpperCase(propertyName.charAt(0))) { field = fieldHolder.getField(StringUtils.capitalize(propertyName)); // depends on control dependency: [if], data = [none] } return field; } }
public class class_name { private NodeBuilder ensureParent() { if (parent == null) { parent = new NodeBuilder(); parent.child = this; } if (parent.upperBound == null) parent.reset(EMPTY_BRANCH, upperBound, updateFunction, comparator); return parent; } }
public class class_name { private NodeBuilder ensureParent() { if (parent == null) { parent = new NodeBuilder(); // depends on control dependency: [if], data = [none] parent.child = this; // depends on control dependency: [if], data = [none] } if (parent.upperBound == null) parent.reset(EMPTY_BRANCH, upperBound, updateFunction, comparator); return parent; } }
public class class_name { String replaceAllWithUppercase(String input, String regex, int groupNumberToUppercase) { Pattern underscoreAndDotPattern = Pattern.compile(regex); Matcher matcher = underscoreAndDotPattern.matcher(input); StringBuffer sb = new StringBuffer(); while (matcher.find()) { matcher.appendReplacement(sb, matcher.group(groupNumberToUppercase).toUpperCase()); } matcher.appendTail(sb); return sb.toString(); } }
public class class_name { String replaceAllWithUppercase(String input, String regex, int groupNumberToUppercase) { Pattern underscoreAndDotPattern = Pattern.compile(regex); Matcher matcher = underscoreAndDotPattern.matcher(input); StringBuffer sb = new StringBuffer(); while (matcher.find()) { matcher.appendReplacement(sb, matcher.group(groupNumberToUppercase).toUpperCase()); // depends on control dependency: [while], data = [none] } matcher.appendTail(sb); return sb.toString(); } }
public class class_name { protected void auditPatientRecordEvent(boolean systemIsSource, IHETransactionEventTypeCodes transaction, RFC3881EventOutcomeCodes eventOutcome, RFC3881EventActionCodes eventActionCode, String sourceFacility, String sourceApp, String sourceAltUserId, String sourceNetworkId, String destinationFacility, String destinationApp, String destinationAltUserId, String destinationNetworkId, String humanRequestor, String hl7MessageId, String patientIds[], List<CodedValueType> purposesOfUse, List<CodedValueType> userRoles) { // Create Patient Record event PatientRecordEvent patientEvent = new PatientRecordEvent(systemIsSource, eventOutcome, eventActionCode, transaction, purposesOfUse); patientEvent.setAuditSourceId(getAuditSourceId(), getAuditEnterpriseSiteId()); // Set the source active participant patientEvent.addSourceActiveParticipant(EventUtils.concatHL7FacilityApplication(sourceFacility,sourceApp), sourceAltUserId, null, sourceNetworkId, true); // Set the human requestor active participant if (!EventUtils.isEmptyOrNull(humanRequestor)) { patientEvent.addHumanRequestorActiveParticipant(humanRequestor, null, null, userRoles); } // Set the destination active participant patientEvent.addDestinationActiveParticipant(EventUtils.concatHL7FacilityApplication(destinationFacility,destinationApp), destinationAltUserId, null, destinationNetworkId, false); // Add a patient participant object for each patient id if (!EventUtils.isEmptyOrNull(patientIds)) { for (int i=0; i<patientIds.length; i++) { patientEvent.addPatientParticipantObject(patientIds[i], hl7MessageId.getBytes(), transaction); } } audit(patientEvent); } }
public class class_name { protected void auditPatientRecordEvent(boolean systemIsSource, IHETransactionEventTypeCodes transaction, RFC3881EventOutcomeCodes eventOutcome, RFC3881EventActionCodes eventActionCode, String sourceFacility, String sourceApp, String sourceAltUserId, String sourceNetworkId, String destinationFacility, String destinationApp, String destinationAltUserId, String destinationNetworkId, String humanRequestor, String hl7MessageId, String patientIds[], List<CodedValueType> purposesOfUse, List<CodedValueType> userRoles) { // Create Patient Record event PatientRecordEvent patientEvent = new PatientRecordEvent(systemIsSource, eventOutcome, eventActionCode, transaction, purposesOfUse); patientEvent.setAuditSourceId(getAuditSourceId(), getAuditEnterpriseSiteId()); // Set the source active participant patientEvent.addSourceActiveParticipant(EventUtils.concatHL7FacilityApplication(sourceFacility,sourceApp), sourceAltUserId, null, sourceNetworkId, true); // Set the human requestor active participant if (!EventUtils.isEmptyOrNull(humanRequestor)) { patientEvent.addHumanRequestorActiveParticipant(humanRequestor, null, null, userRoles); // depends on control dependency: [if], data = [none] } // Set the destination active participant patientEvent.addDestinationActiveParticipant(EventUtils.concatHL7FacilityApplication(destinationFacility,destinationApp), destinationAltUserId, null, destinationNetworkId, false); // Add a patient participant object for each patient id if (!EventUtils.isEmptyOrNull(patientIds)) { for (int i=0; i<patientIds.length; i++) { patientEvent.addPatientParticipantObject(patientIds[i], hl7MessageId.getBytes(), transaction); // depends on control dependency: [for], data = [i] } } audit(patientEvent); } }
public class class_name { private boolean initializeScore(List<Point2D_I32> contour , boolean loops ) { // Score each side Element<Corner> e = list.getHead(); Element<Corner> end = loops ? null : list.getTail(); while( e != end ) { if (convex && !isSideConvex(contour, e)) return false; Element<Corner> n = e.next; double error; if( n == null ) { error = computeSideError(contour,e.object.index, list.getHead().object.index); } else { error = computeSideError(contour,e.object.index, n.object.index); } e.object.sideError = error; e = n; } // Compute what would happen if a side was split e = list.getHead(); while( e != end ) { computePotentialSplitScore(contour,e,list.size() < minSides); e = e.next; } return true; } }
public class class_name { private boolean initializeScore(List<Point2D_I32> contour , boolean loops ) { // Score each side Element<Corner> e = list.getHead(); Element<Corner> end = loops ? null : list.getTail(); while( e != end ) { if (convex && !isSideConvex(contour, e)) return false; Element<Corner> n = e.next; double error; if( n == null ) { error = computeSideError(contour,e.object.index, list.getHead().object.index); // depends on control dependency: [if], data = [none] } else { error = computeSideError(contour,e.object.index, n.object.index); // depends on control dependency: [if], data = [none] } e.object.sideError = error; // depends on control dependency: [while], data = [none] e = n; // depends on control dependency: [while], data = [none] } // Compute what would happen if a side was split e = list.getHead(); while( e != end ) { computePotentialSplitScore(contour,e,list.size() < minSides); // depends on control dependency: [while], data = [none] e = e.next; // depends on control dependency: [while], data = [none] } return true; } }
public class class_name { ResolvedFeatureSearchResult findResolvedDependency(FeatureResource featureResource) { ProvisioningFeatureDefinition feature = resolvedFeatures.get(featureResource.getSymbolicName()); if (feature != null) { return new ResolvedFeatureSearchResult(ResultCategory.FOUND, feature.getSymbolicName()); } if (requirementsFoundForOtherProducts.contains(featureResource.getSymbolicName())) { return new ResolvedFeatureSearchResult(ResultCategory.FOUND_WRONG_PRODUCT, featureResource.getSymbolicName()); } String baseName = getFeatureBaseName(featureResource.getSymbolicName()); for (String toleratedVersion : featureResource.getTolerates()) { String featureName = baseName + toleratedVersion; feature = resolvedFeatures.get(featureName); if (feature != null) { return new ResolvedFeatureSearchResult(ResultCategory.FOUND, feature.getSymbolicName()); } if (requirementsFoundForOtherProducts.contains(featureName)) { return new ResolvedFeatureSearchResult(ResultCategory.FOUND_WRONG_PRODUCT, featureName); } } return new ResolvedFeatureSearchResult(ResultCategory.MISSING, null); } }
public class class_name { ResolvedFeatureSearchResult findResolvedDependency(FeatureResource featureResource) { ProvisioningFeatureDefinition feature = resolvedFeatures.get(featureResource.getSymbolicName()); if (feature != null) { return new ResolvedFeatureSearchResult(ResultCategory.FOUND, feature.getSymbolicName()); // depends on control dependency: [if], data = [none] } if (requirementsFoundForOtherProducts.contains(featureResource.getSymbolicName())) { return new ResolvedFeatureSearchResult(ResultCategory.FOUND_WRONG_PRODUCT, featureResource.getSymbolicName()); // depends on control dependency: [if], data = [none] } String baseName = getFeatureBaseName(featureResource.getSymbolicName()); for (String toleratedVersion : featureResource.getTolerates()) { String featureName = baseName + toleratedVersion; feature = resolvedFeatures.get(featureName); // depends on control dependency: [for], data = [none] if (feature != null) { return new ResolvedFeatureSearchResult(ResultCategory.FOUND, feature.getSymbolicName()); // depends on control dependency: [if], data = [none] } if (requirementsFoundForOtherProducts.contains(featureName)) { return new ResolvedFeatureSearchResult(ResultCategory.FOUND_WRONG_PRODUCT, featureName); // depends on control dependency: [if], data = [none] } } return new ResolvedFeatureSearchResult(ResultCategory.MISSING, null); } }
public class class_name { public void traverseModels( File sourceDirectory, ReportModelFileHandler handler ) { for( ReportModelFile f : Files.fileTreeTraverser().breadthFirstTraversal( sourceDirectory ) .filter( FilePredicates.endsWith( ".json" ) ) .transform( new ReportModelFileReader() ) ) { handler.handleReportModel( f ); } } }
public class class_name { public void traverseModels( File sourceDirectory, ReportModelFileHandler handler ) { for( ReportModelFile f : Files.fileTreeTraverser().breadthFirstTraversal( sourceDirectory ) .filter( FilePredicates.endsWith( ".json" ) ) .transform( new ReportModelFileReader() ) ) { handler.handleReportModel( f ); // depends on control dependency: [for], data = [f] } } }
public class class_name { private Collection<PartitionRanges> parsePartitionRanges(JSONObject jsData) { if (jsData != null) { try { JSONObject partitionObj = jsData.getJSONObject("partitionRanges"); Iterator<String> partitionKey = partitionObj.keys(); ImmutableList.Builder<PartitionRanges> partitionRangesBuilder = ImmutableList.builder(); while (partitionKey.hasNext()) { String pidStr = partitionKey.next(); JSONObject rangeObj = partitionObj.getJSONObject(pidStr); Iterator<String> rangeKey = rangeObj.keys(); ImmutableSortedMap.Builder<Integer, Integer> rangeBuilder = ImmutableSortedMap.naturalOrder(); while (rangeKey.hasNext()) { String rangeStartStr = rangeKey.next(); int rangeStart = Integer.parseInt(rangeStartStr); int rangeEnd = rangeObj.getInt(rangeStartStr); rangeBuilder.put(rangeStart, rangeEnd); } partitionRangesBuilder.add(new PartitionRanges(Integer.parseInt(pidStr), rangeBuilder.build())); } return partitionRangesBuilder.build(); } catch (JSONException e) { SNAP_LOG.warn("Failed to parse partition ranges", e); } } return null; } }
public class class_name { private Collection<PartitionRanges> parsePartitionRanges(JSONObject jsData) { if (jsData != null) { try { JSONObject partitionObj = jsData.getJSONObject("partitionRanges"); Iterator<String> partitionKey = partitionObj.keys(); ImmutableList.Builder<PartitionRanges> partitionRangesBuilder = ImmutableList.builder(); while (partitionKey.hasNext()) { String pidStr = partitionKey.next(); JSONObject rangeObj = partitionObj.getJSONObject(pidStr); Iterator<String> rangeKey = rangeObj.keys(); ImmutableSortedMap.Builder<Integer, Integer> rangeBuilder = ImmutableSortedMap.naturalOrder(); while (rangeKey.hasNext()) { String rangeStartStr = rangeKey.next(); int rangeStart = Integer.parseInt(rangeStartStr); int rangeEnd = rangeObj.getInt(rangeStartStr); rangeBuilder.put(rangeStart, rangeEnd); // depends on control dependency: [while], data = [none] } partitionRangesBuilder.add(new PartitionRanges(Integer.parseInt(pidStr), rangeBuilder.build())); // depends on control dependency: [while], data = [none] } return partitionRangesBuilder.build(); // depends on control dependency: [try], data = [none] } catch (JSONException e) { SNAP_LOG.warn("Failed to parse partition ranges", e); } // depends on control dependency: [catch], data = [none] } return null; } }
public class class_name { @Override protected void nibble(Queue<StorageStatsMorsel> queue) { StorageStatsMorsel morsel = queue.peek(); String storeId = morsel.getStoreId(); StorageProvider store = getStorageProvider(morsel.getAccount(), storeId); int maxTaskQueueSize = getMaxTaskQueueSize(); int taskQueueSize = getTaskQueue().size(); if (taskQueueSize >= maxTaskQueueSize) { log.info("Task queue size ({}) has reached or exceeded max size ({}).", taskQueueSize, maxTaskQueueSize); } else { addTask(morsel, store); queue.remove(morsel); } } }
public class class_name { @Override protected void nibble(Queue<StorageStatsMorsel> queue) { StorageStatsMorsel morsel = queue.peek(); String storeId = morsel.getStoreId(); StorageProvider store = getStorageProvider(morsel.getAccount(), storeId); int maxTaskQueueSize = getMaxTaskQueueSize(); int taskQueueSize = getTaskQueue().size(); if (taskQueueSize >= maxTaskQueueSize) { log.info("Task queue size ({}) has reached or exceeded max size ({}).", taskQueueSize, maxTaskQueueSize); // depends on control dependency: [if], data = [none] } else { addTask(morsel, store); // depends on control dependency: [if], data = [none] queue.remove(morsel); // depends on control dependency: [if], data = [none] } } }
public class class_name { public ClassGraph blacklistClasses(final String... classNames) { enableClassInfo(); for (final String className : classNames) { if (className.contains("*")) { throw new IllegalArgumentException("Cannot use a glob wildcard here: " + className); } final String classNameNormalized = WhiteBlackList.normalizePackageOrClassName(className); scanSpec.classWhiteBlackList.addToBlacklist(classNameNormalized); scanSpec.classfilePathWhiteBlackList .addToBlacklist(WhiteBlackList.classNameToClassfilePath(classNameNormalized)); } return this; } }
public class class_name { public ClassGraph blacklistClasses(final String... classNames) { enableClassInfo(); for (final String className : classNames) { if (className.contains("*")) { throw new IllegalArgumentException("Cannot use a glob wildcard here: " + className); } final String classNameNormalized = WhiteBlackList.normalizePackageOrClassName(className); scanSpec.classWhiteBlackList.addToBlacklist(classNameNormalized); // depends on control dependency: [for], data = [className] scanSpec.classfilePathWhiteBlackList .addToBlacklist(WhiteBlackList.classNameToClassfilePath(classNameNormalized)); // depends on control dependency: [for], data = [none] } return this; } }
public class class_name { protected void actionNext() { if (m_dialogIndex >= (m_resources.size() - 1)) { return; } m_dialogIndex++; m_uploadPropertyPanel.getPropertyEditor().getForm().validateAndSubmit(); m_nextAction = new Runnable() { public void run() { loadDialogBean(m_resources.get(m_dialogIndex)); } }; } }
public class class_name { protected void actionNext() { if (m_dialogIndex >= (m_resources.size() - 1)) { return; // depends on control dependency: [if], data = [none] } m_dialogIndex++; m_uploadPropertyPanel.getPropertyEditor().getForm().validateAndSubmit(); m_nextAction = new Runnable() { public void run() { loadDialogBean(m_resources.get(m_dialogIndex)); } }; } }
public class class_name { @SuppressWarnings("WeakerAccess") protected List<IBaseResource> toResourceList(ISearchBuilder sb, List<Long> pidsSubList) { Set<Long> includedPids = new HashSet<>(); if (mySearchEntity.getSearchType() == SearchTypeEnum.SEARCH) { includedPids.addAll(sb.loadIncludes(myContext, myEntityManager, pidsSubList, mySearchEntity.toRevIncludesList(), true, mySearchEntity.getLastUpdated(), myUuid)); includedPids.addAll(sb.loadIncludes(myContext, myEntityManager, pidsSubList, mySearchEntity.toIncludesList(), false, mySearchEntity.getLastUpdated(), myUuid)); } // Execute the query and make sure we return distinct results List<IBaseResource> resources = new ArrayList<>(); sb.loadResourcesByPid(pidsSubList, resources, includedPids, false, myEntityManager, myContext, myDao); return resources; } }
public class class_name { @SuppressWarnings("WeakerAccess") protected List<IBaseResource> toResourceList(ISearchBuilder sb, List<Long> pidsSubList) { Set<Long> includedPids = new HashSet<>(); if (mySearchEntity.getSearchType() == SearchTypeEnum.SEARCH) { includedPids.addAll(sb.loadIncludes(myContext, myEntityManager, pidsSubList, mySearchEntity.toRevIncludesList(), true, mySearchEntity.getLastUpdated(), myUuid)); // depends on control dependency: [if], data = [none] includedPids.addAll(sb.loadIncludes(myContext, myEntityManager, pidsSubList, mySearchEntity.toIncludesList(), false, mySearchEntity.getLastUpdated(), myUuid)); // depends on control dependency: [if], data = [none] } // Execute the query and make sure we return distinct results List<IBaseResource> resources = new ArrayList<>(); sb.loadResourcesByPid(pidsSubList, resources, includedPids, false, myEntityManager, myContext, myDao); return resources; } }
public class class_name { public ComplexDouble subi(ComplexDouble c, ComplexDouble result) { if (this == result) { r -= c.r; i -= c.i; } else { result.r = r - c.r; result.i = i - c.i; } return this; } }
public class class_name { public ComplexDouble subi(ComplexDouble c, ComplexDouble result) { if (this == result) { r -= c.r; // depends on control dependency: [if], data = [none] i -= c.i; // depends on control dependency: [if], data = [none] } else { result.r = r - c.r; // depends on control dependency: [if], data = [none] result.i = i - c.i; // depends on control dependency: [if], data = [none] } return this; } }
public class class_name { protected <Type> void addIfNotNull(final Array<Type> array, final Type object) { if (object != null) { array.add(object); } } }
public class class_name { protected <Type> void addIfNotNull(final Array<Type> array, final Type object) { if (object != null) { array.add(object); // depends on control dependency: [if], data = [(object] } } }
public class class_name { public static <T> void sort(List<T> list, Comparator<? super T> comparator) { if (list instanceof RandomAccess) { quicksort(list, comparator); } else { List<T> copy = new ArrayList<>(list); quicksort(copy, comparator); list.clear(); list.addAll(copy); } } }
public class class_name { public static <T> void sort(List<T> list, Comparator<? super T> comparator) { if (list instanceof RandomAccess) { quicksort(list, comparator); // depends on control dependency: [if], data = [none] } else { List<T> copy = new ArrayList<>(list); quicksort(copy, comparator); // depends on control dependency: [if], data = [none] list.clear(); // depends on control dependency: [if], data = [none] list.addAll(copy); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void print(String text) { try { out.write(text); } catch(IOException ioe) { throw new GroovyRuntimeException(ioe); } } }
public class class_name { public void print(String text) { try { out.write(text); // depends on control dependency: [try], data = [none] } catch(IOException ioe) { throw new GroovyRuntimeException(ioe); } // depends on control dependency: [catch], data = [none] } }
public class class_name { @Override public boolean start(final RootDoc root) { // Check sanity if (this.dotFacade == null) { throw new IllegalStateException("The DotFacade cannot be null."); } // Wrap the received RootDoc instance. final VisualizationWrappedRootDoc rootDoc = new VisualizationWrappedRootDoc(root); htmlDoclet.configuration.root = root; try { htmlDoclet.configuration.setOptions(); } catch (Configuration.Fault fault) { fault.printStackTrace(); } for (ClassDoc cDoc : rootDoc.classes()) { // Log somewhat if (log.isDebugEnabled()) { log.debug(getJavaDocAndTagsLog(cDoc)); } } for (PackageDoc pDoc : rootDoc.specifiedPackages()) { // Log somewhat if (log.isDebugEnabled()) { log.debug(getJavaDocAndTagsLog(pDoc)); } } // Convert the DOT-generated Map and write the image. // dotFacade.writePngImageAndImageMap(rootDoc, theDotDiagram, outputDirectory, fileName); // Delegate further execution to the standard Doclet. return HtmlDoclet.start(root); } }
public class class_name { @Override public boolean start(final RootDoc root) { // Check sanity if (this.dotFacade == null) { throw new IllegalStateException("The DotFacade cannot be null."); } // Wrap the received RootDoc instance. final VisualizationWrappedRootDoc rootDoc = new VisualizationWrappedRootDoc(root); htmlDoclet.configuration.root = root; try { htmlDoclet.configuration.setOptions(); // depends on control dependency: [try], data = [none] } catch (Configuration.Fault fault) { fault.printStackTrace(); } // depends on control dependency: [catch], data = [none] for (ClassDoc cDoc : rootDoc.classes()) { // Log somewhat if (log.isDebugEnabled()) { log.debug(getJavaDocAndTagsLog(cDoc)); // depends on control dependency: [if], data = [none] } } for (PackageDoc pDoc : rootDoc.specifiedPackages()) { // Log somewhat if (log.isDebugEnabled()) { log.debug(getJavaDocAndTagsLog(pDoc)); // depends on control dependency: [if], data = [none] } } // Convert the DOT-generated Map and write the image. // dotFacade.writePngImageAndImageMap(rootDoc, theDotDiagram, outputDirectory, fileName); // Delegate further execution to the standard Doclet. return HtmlDoclet.start(root); } }
public class class_name { public void installBundles(final BundleContext bContext, final BundleList bundleList, final BundleInstallStatus installStatus, final int minStartLevel, final int defaultStartLevel, final int defaultInitialStartLevel, final WsLocationAdmin locSvc) { if (bundleList == null || bundleList.isEmpty()) return; final FrameworkWiring fwkWiring = featureManager.bundleContext.getBundle(Constants.SYSTEM_BUNDLE_LOCATION).adapt(FrameworkWiring.class); final File bootFile = getBootJar(); bundleList.foreach(new BundleList.FeatureResourceHandler() { @Override @FFDCIgnore({ IllegalStateException.class, Exception.class }) public boolean handle(FeatureResource fr) { Bundle bundle = null; WsResource resource = null; String urlString = fr.getLocation(); try { String bundleRepositoryType = fr.getBundleRepositoryType(); BundleRepositoryHolder bundleRepositoryHolder = featureManager.getBundleRepositoryHolder(bundleRepositoryType); if (bundleRepositoryHolder == null) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Bundle repository not found for type=" + bundleRepositoryType); } Tr.error(tc, "UPDATE_MISSING_BUNDLE_ERROR", fr.getMatchString()); installStatus.addMissingBundle(fr); return true; } // Get the product name for which the bundles are being installed. String productName = bundleRepositoryHolder.getFeatureType(); if (libertyBoot) { bundle = installLibertyBootBundle(productName, fr, fwkWiring); } else { bundle = installFeatureBundle(urlString, productName, bundleRepositoryHolder, fr); } if (bundle == null) { return true; } BundleStartLevel bsl = bundle.adapt(BundleStartLevel.class); BundleRevision bRev = bundle.adapt(BundleRevision.class); int level = 0; // For non-fragment bundles set the bundle startLevel then // add to the list of bundles to be started. // The order is important because the bundles are sorted by // start level to preserve the start level ordering during // dynamic feature additions. if ((bRev.getTypes() & BundleRevision.TYPE_FRAGMENT) != BundleRevision.TYPE_FRAGMENT) { level = bsl.getStartLevel(); // Set the start level on the bundle to the selected value // if it hasn't been set before if (level == defaultInitialStartLevel) { int sl = fr.getStartLevel(); int newLevel = (sl == 0) ? defaultStartLevel : (sl < minStartLevel) ? minStartLevel : sl; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(this, tc, "Changing the start level of bundle {0} from {1} to the current level of {2}", bundle, level, newLevel); } level = newLevel; bsl.setStartLevel(level); } installStatus.addBundleToStart(bundle); } // need to get a resource for the bundle list createAssociation // call, if we end up with a null resource then bad things // happen, like we fail to uninstall bundles when we should File bundleFile = getBundleFile(bundle); resource = locSvc.asResource(bundleFile, bundleFile.isFile()); // Update bundle list with resolved information bundleList.createAssociation(fr, bundle, resource, level); } catch (IllegalStateException e) { // The framework is stopping: this is an expected but not ideal occurrence. installStatus.markContextInvalid(e); return false; } catch (Exception e) { // We encountered an error installing a bundle, add it to // the status, and continue. The caller will handle as appropriate installStatus.addInstallException("INSTALL " + urlString + " (resolved from: " + fr + ")", e); } return true; } private File getBundleFile(Bundle bundle) { if (libertyBoot) { return bootFile; } // make sure we have a File for the bundle that is already // installed. Get this by processing the location. We // need to get past the reference:file: part of the URL. String location = bundle.getLocation(); int index = location.indexOf(BUNDLE_LOC_REFERENCE_TAG); location = location.substring(index + BUNDLE_LOC_REFERENCE_TAG.length()); // This file path is URL form, convert it back to a valid system File path return new File(URI.create(location)); } private Bundle installLibertyBootBundle(String productName, FeatureResource fr, FrameworkWiring fwkWiring) throws BundleException, IOException { //getting the LibertyBootRuntime instance and installing the boot bundle LibertyBootRuntime libertyBoot = featureManager.getLibertyBoot(); if (libertyBoot == null) { throw new IllegalStateException("No LibertBootRuntime service available!"); } Bundle bundle = libertyBoot.installBootBundle(fr.getSymbolicName(), fr.getVersionRange(), BUNDLE_LOC_FEATURE_TAG); if (bundle == null) { installStatus.addMissingBundle(fr); return null; } Region productRegion = getProductRegion(productName); Region current = featureManager.getDigraph().getRegion(bundle); if (!productRegion.equals(current)) { current.removeBundle(bundle); productRegion.addBundle(bundle); } return bundle; } private Bundle installFeatureBundle(String urlString, String productName, BundleRepositoryHolder bundleRepositoryHolder, FeatureResource fr) throws BundleException, IOException { Bundle bundle = fetchInstalledBundle(urlString, productName); if (bundle == null) { ContentBasedLocalBundleRepository lbr = bundleRepositoryHolder.getBundleRepository(); // Try to find the file, hopefully using the cached path File bundleFile = lbr.selectBundle(urlString, fr.getSymbolicName(), fr.getVersionRange()); if (bundleFile == null) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Bundle not matched", lbr, fr); } Tr.error(tc, "UPDATE_MISSING_BUNDLE_ERROR", fr.getMatchString()); installStatus.addMissingBundle(fr); return null; } // Get URL from filename URI uri = bundleFile.toURI(); urlString = uri.toURL().toString(); urlString = PathUtils.normalize(urlString); // Install this bundle as a "reference"-- this means that the // framework will not copy this bundle into it's private cache, // it will run from the actual jar (wherever it is). urlString = BUNDLE_LOC_REFERENCE_TAG + urlString; // Get the bundle location. // The location format being returned must match the format in SchemaBundle and BundleList. String location = getBundleLocation(urlString, productName); Region productRegion = getProductRegion(productName); // Bundle will just be returned if something from this location exists already. bundle = productRegion.installBundleAtLocation(location, new URL(urlString).openStream()); } return bundle; } private Bundle fetchInstalledBundle(String urlString, String productName) { // We install bundles as references so we need to ensure that we add reference: to the file url. String location = getBundleLocation(BUNDLE_LOC_REFERENCE_TAG + urlString, productName); Bundle b = featureManager.bundleContext.getBundle(location); if (b != null && b.getState() == Bundle.UNINSTALLED) { b = null; } return b; } }); } }
public class class_name { public void installBundles(final BundleContext bContext, final BundleList bundleList, final BundleInstallStatus installStatus, final int minStartLevel, final int defaultStartLevel, final int defaultInitialStartLevel, final WsLocationAdmin locSvc) { if (bundleList == null || bundleList.isEmpty()) return; final FrameworkWiring fwkWiring = featureManager.bundleContext.getBundle(Constants.SYSTEM_BUNDLE_LOCATION).adapt(FrameworkWiring.class); final File bootFile = getBootJar(); bundleList.foreach(new BundleList.FeatureResourceHandler() { @Override @FFDCIgnore({ IllegalStateException.class, Exception.class }) public boolean handle(FeatureResource fr) { Bundle bundle = null; WsResource resource = null; String urlString = fr.getLocation(); try { String bundleRepositoryType = fr.getBundleRepositoryType(); BundleRepositoryHolder bundleRepositoryHolder = featureManager.getBundleRepositoryHolder(bundleRepositoryType); if (bundleRepositoryHolder == null) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Bundle repository not found for type=" + bundleRepositoryType); // depends on control dependency: [if], data = [none] } Tr.error(tc, "UPDATE_MISSING_BUNDLE_ERROR", fr.getMatchString()); // depends on control dependency: [if], data = [none] installStatus.addMissingBundle(fr); // depends on control dependency: [if], data = [none] return true; // depends on control dependency: [if], data = [none] } // Get the product name for which the bundles are being installed. String productName = bundleRepositoryHolder.getFeatureType(); if (libertyBoot) { bundle = installLibertyBootBundle(productName, fr, fwkWiring); // depends on control dependency: [if], data = [none] } else { bundle = installFeatureBundle(urlString, productName, bundleRepositoryHolder, fr); // depends on control dependency: [if], data = [none] } if (bundle == null) { return true; // depends on control dependency: [if], data = [none] } BundleStartLevel bsl = bundle.adapt(BundleStartLevel.class); BundleRevision bRev = bundle.adapt(BundleRevision.class); int level = 0; // For non-fragment bundles set the bundle startLevel then // add to the list of bundles to be started. // The order is important because the bundles are sorted by // start level to preserve the start level ordering during // dynamic feature additions. if ((bRev.getTypes() & BundleRevision.TYPE_FRAGMENT) != BundleRevision.TYPE_FRAGMENT) { level = bsl.getStartLevel(); // depends on control dependency: [if], data = [none] // Set the start level on the bundle to the selected value // if it hasn't been set before if (level == defaultInitialStartLevel) { int sl = fr.getStartLevel(); int newLevel = (sl == 0) ? defaultStartLevel : (sl < minStartLevel) ? minStartLevel : sl; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(this, tc, "Changing the start level of bundle {0} from {1} to the current level of {2}", bundle, level, newLevel); // depends on control dependency: [if], data = [none] } level = newLevel; // depends on control dependency: [if], data = [none] bsl.setStartLevel(level); // depends on control dependency: [if], data = [(level] } installStatus.addBundleToStart(bundle); // depends on control dependency: [if], data = [none] } // need to get a resource for the bundle list createAssociation // call, if we end up with a null resource then bad things // happen, like we fail to uninstall bundles when we should File bundleFile = getBundleFile(bundle); resource = locSvc.asResource(bundleFile, bundleFile.isFile()); // depends on control dependency: [try], data = [none] // Update bundle list with resolved information bundleList.createAssociation(fr, bundle, resource, level); // depends on control dependency: [try], data = [none] } catch (IllegalStateException e) { // The framework is stopping: this is an expected but not ideal occurrence. installStatus.markContextInvalid(e); return false; } catch (Exception e) { // depends on control dependency: [catch], data = [none] // We encountered an error installing a bundle, add it to // the status, and continue. The caller will handle as appropriate installStatus.addInstallException("INSTALL " + urlString + " (resolved from: " + fr + ")", e); } // depends on control dependency: [catch], data = [none] return true; } private File getBundleFile(Bundle bundle) { if (libertyBoot) { return bootFile; // depends on control dependency: [if], data = [none] } // make sure we have a File for the bundle that is already // installed. Get this by processing the location. We // need to get past the reference:file: part of the URL. String location = bundle.getLocation(); int index = location.indexOf(BUNDLE_LOC_REFERENCE_TAG); location = location.substring(index + BUNDLE_LOC_REFERENCE_TAG.length()); // This file path is URL form, convert it back to a valid system File path return new File(URI.create(location)); } private Bundle installLibertyBootBundle(String productName, FeatureResource fr, FrameworkWiring fwkWiring) throws BundleException, IOException { //getting the LibertyBootRuntime instance and installing the boot bundle LibertyBootRuntime libertyBoot = featureManager.getLibertyBoot(); if (libertyBoot == null) { throw new IllegalStateException("No LibertBootRuntime service available!"); } Bundle bundle = libertyBoot.installBootBundle(fr.getSymbolicName(), fr.getVersionRange(), BUNDLE_LOC_FEATURE_TAG); if (bundle == null) { installStatus.addMissingBundle(fr); return null; } Region productRegion = getProductRegion(productName); Region current = featureManager.getDigraph().getRegion(bundle); if (!productRegion.equals(current)) { current.removeBundle(bundle); // depends on control dependency: [if], data = [none] productRegion.addBundle(bundle); // depends on control dependency: [if], data = [none] } return bundle; } private Bundle installFeatureBundle(String urlString, String productName, BundleRepositoryHolder bundleRepositoryHolder, FeatureResource fr) throws BundleException, IOException { Bundle bundle = fetchInstalledBundle(urlString, productName); if (bundle == null) { ContentBasedLocalBundleRepository lbr = bundleRepositoryHolder.getBundleRepository(); // Try to find the file, hopefully using the cached path File bundleFile = lbr.selectBundle(urlString, fr.getSymbolicName(), fr.getVersionRange()); if (bundleFile == null) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Bundle not matched", lbr, fr); } Tr.error(tc, "UPDATE_MISSING_BUNDLE_ERROR", fr.getMatchString()); installStatus.addMissingBundle(fr); return null; } // Get URL from filename URI uri = bundleFile.toURI(); urlString = uri.toURL().toString(); urlString = PathUtils.normalize(urlString); // Install this bundle as a "reference"-- this means that the // framework will not copy this bundle into it's private cache, // it will run from the actual jar (wherever it is). urlString = BUNDLE_LOC_REFERENCE_TAG + urlString; // Get the bundle location. // The location format being returned must match the format in SchemaBundle and BundleList. String location = getBundleLocation(urlString, productName); Region productRegion = getProductRegion(productName); // Bundle will just be returned if something from this location exists already. bundle = productRegion.installBundleAtLocation(location, new URL(urlString).openStream()); } return bundle; } private Bundle fetchInstalledBundle(String urlString, String productName) { // We install bundles as references so we need to ensure that we add reference: to the file url. String location = getBundleLocation(BUNDLE_LOC_REFERENCE_TAG + urlString, productName); Bundle b = featureManager.bundleContext.getBundle(location); if (b != null && b.getState() == Bundle.UNINSTALLED) { b = null; } return b; } }); } }
public class class_name { @Override public void processXML() throws InjectionException { final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); if (isTraceOn && tc.isEntryEnabled()) Tr.entry(tc, "processXML : " + this); List<? extends ConnectionFactory> connectionFactoryDefinitions = ivNameSpaceConfig.getJNDIEnvironmentRefs(ConnectionFactory.class); if (connectionFactoryDefinitions != null) { for (ConnectionFactory connectionFactory : connectionFactoryDefinitions) { String jndiName = connectionFactory.getName(); InjectionBinding<ConnectionFactoryDefinition> injectionBinding = ivAllAnnotationsCollection.get(jndiName); ConnectionFactoryDefinitionInjectionBinding binding; if (injectionBinding != null) { binding = (ConnectionFactoryDefinitionInjectionBinding) injectionBinding; } else { binding = new ConnectionFactoryDefinitionInjectionBinding(jndiName, ivNameSpaceConfig); addInjectionBinding(binding); } binding.mergeXML(connectionFactory); } } if (isTraceOn && tc.isEntryEnabled()) Tr.exit(tc, "processXML : " + this); } }
public class class_name { @Override public void processXML() throws InjectionException { final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); if (isTraceOn && tc.isEntryEnabled()) Tr.entry(tc, "processXML : " + this); List<? extends ConnectionFactory> connectionFactoryDefinitions = ivNameSpaceConfig.getJNDIEnvironmentRefs(ConnectionFactory.class); if (connectionFactoryDefinitions != null) { for (ConnectionFactory connectionFactory : connectionFactoryDefinitions) { String jndiName = connectionFactory.getName(); InjectionBinding<ConnectionFactoryDefinition> injectionBinding = ivAllAnnotationsCollection.get(jndiName); ConnectionFactoryDefinitionInjectionBinding binding; if (injectionBinding != null) { binding = (ConnectionFactoryDefinitionInjectionBinding) injectionBinding; // depends on control dependency: [if], data = [none] } else { binding = new ConnectionFactoryDefinitionInjectionBinding(jndiName, ivNameSpaceConfig); // depends on control dependency: [if], data = [none] addInjectionBinding(binding); // depends on control dependency: [if], data = [none] } binding.mergeXML(connectionFactory); } } if (isTraceOn && tc.isEntryEnabled()) Tr.exit(tc, "processXML : " + this); } }
public class class_name { public JsonArray getAsArray() { if (!(value instanceof JsonArray)) { JsonArray val = new JsonArray(); val.add(value); value = val; } return (JsonArray)value; } }
public class class_name { public JsonArray getAsArray() { if (!(value instanceof JsonArray)) { JsonArray val = new JsonArray(); val.add(value); // depends on control dependency: [if], data = [none] value = val; // depends on control dependency: [if], data = [none] } return (JsonArray)value; } }
public class class_name { public void load(String antecedent, Engine engine) { FuzzyLite.logger().log(Level.FINE, "Antecedent: {0}", antecedent); unload(); setText(antecedent); if (antecedent.trim().isEmpty()) { throw new RuntimeException("[syntax error] antecedent is empty"); } /* Builds an proposition tree from the antecedent of a fuzzy rule. The rules are: 1) After a variable comes 'is', 2) After 'is' comes a hedge or a term 3) After a hedge comes a hedge or a term 4) After a term comes a variable or an operator */ Function function = new Function(); String postfix = function.toPostfix(antecedent); FuzzyLite.logger().log(Level.FINE, "Postfix {0}", postfix); final byte S_VARIABLE = 1, S_IS = 2, S_HEDGE = 4, S_TERM = 8, S_AND_OR = 16; byte state = S_VARIABLE; Deque<Expression> expressionStack = new ArrayDeque<Expression>(); Proposition proposition = null; StringTokenizer tokenizer = new StringTokenizer(postfix); String token = ""; while (tokenizer.hasMoreTokens()) { token = tokenizer.nextToken(); if ((state & S_VARIABLE) != 0) { Variable variable = null; if (engine.hasInputVariable(token)) { variable = engine.getInputVariable(token); } else if (engine.hasOutputVariable(token)) { variable = engine.getOutputVariable(token); } if (variable != null) { proposition = new Proposition(); proposition.setVariable(variable); expressionStack.push(proposition); state = S_IS; FuzzyLite.logger().log(Level.FINE, "Token <{0}> is variable", token); continue; } } if ((state & S_IS) != 0) { if (Rule.FL_IS.equals(token)) { state = S_HEDGE | S_TERM; FuzzyLite.logger().log(Level.FINE, "Token <{0}> is keyword", token); continue; } } if ((state & S_HEDGE) != 0) { HedgeFactory hedgeFactory = FactoryManager.instance().hedge(); if (hedgeFactory.hasConstructor(token)) { Hedge hedge = hedgeFactory.constructObject(token); proposition.getHedges().add(hedge); if (hedge instanceof Any) { state = S_VARIABLE | S_AND_OR; } else { state = S_HEDGE | S_TERM; } FuzzyLite.logger().log(Level.FINE, "Token <{0}> is hedge", token); continue; } } if ((state & S_TERM) != 0) { if (proposition.getVariable().hasTerm(token)) { proposition.setTerm(proposition.getVariable().getTerm(token)); state = S_VARIABLE | S_AND_OR; FuzzyLite.logger().log(Level.FINE, "Token <{0}> is term", token); continue; } } if ((state & S_AND_OR) != 0) { if (Rule.FL_AND.equals(token) || Rule.FL_OR.equals(token)) { if (expressionStack.size() < 2) { throw new RuntimeException(String.format( "[syntax error] logical operator <%s> expects at least two operands, but found <%d>", token, expressionStack.size())); } Operator operator = new Operator(); operator.setName(token); operator.setRight(expressionStack.pop()); operator.setLeft(expressionStack.pop()); expressionStack.push(operator); state = S_VARIABLE | S_AND_OR; FuzzyLite.logger().log(Level.FINE, "Subtree: ({0}) ({1})", new Object[]{operator.getLeft(), operator.getRight()}); continue; } } //If reached this point, there was an error if ((state & S_VARIABLE) != 0 || (state & S_AND_OR) != 0) { throw new RuntimeException(String.format( "[syntax error] expected variable or logical operator, but found <%s>", token)); } if ((state & S_IS) != 0) { throw new RuntimeException(String.format( "[syntax error] expected keyword <%s>, but found <%s>", Rule.FL_IS, token)); } if ((state & S_HEDGE) != 0 || (state & S_TERM) != 0) { throw new RuntimeException(String.format( "[syntax error] expected hedge or term, but found <%s>", token)); } throw new RuntimeException(String.format( "[syntax error] unexpected token <%s>", token)); } if (!((state & S_VARIABLE) != 0 || (state & S_AND_OR) != 0)) { //only acceptable final state if ((state & S_IS) != 0) { throw new RuntimeException(String.format( "[syntax error] expected keyword <%s> after <%s>", Rule.FL_IS, token)); } if ((state & S_HEDGE) != 0 || (state & S_TERM) != 0) { throw new RuntimeException(String.format( "[syntax error] expected hedge or term, but found <%s>", token)); } } if (expressionStack.size() != 1) { List<String> errors = new LinkedList<String>(); while (expressionStack.size() > 1) { Expression element = expressionStack.pop(); errors.add(element.toString()); } throw new RuntimeException(String.format( "[syntax error] unable to parse the following expressions: <%s>", Op.join(errors, " "))); } setExpression(expressionStack.pop()); } }
public class class_name { public void load(String antecedent, Engine engine) { FuzzyLite.logger().log(Level.FINE, "Antecedent: {0}", antecedent); unload(); setText(antecedent); if (antecedent.trim().isEmpty()) { throw new RuntimeException("[syntax error] antecedent is empty"); } /* Builds an proposition tree from the antecedent of a fuzzy rule. The rules are: 1) After a variable comes 'is', 2) After 'is' comes a hedge or a term 3) After a hedge comes a hedge or a term 4) After a term comes a variable or an operator */ Function function = new Function(); String postfix = function.toPostfix(antecedent); FuzzyLite.logger().log(Level.FINE, "Postfix {0}", postfix); final byte S_VARIABLE = 1, S_IS = 2, S_HEDGE = 4, S_TERM = 8, S_AND_OR = 16; byte state = S_VARIABLE; Deque<Expression> expressionStack = new ArrayDeque<Expression>(); Proposition proposition = null; StringTokenizer tokenizer = new StringTokenizer(postfix); String token = ""; while (tokenizer.hasMoreTokens()) { token = tokenizer.nextToken(); // depends on control dependency: [while], data = [none] if ((state & S_VARIABLE) != 0) { Variable variable = null; if (engine.hasInputVariable(token)) { variable = engine.getInputVariable(token); // depends on control dependency: [if], data = [none] } else if (engine.hasOutputVariable(token)) { variable = engine.getOutputVariable(token); // depends on control dependency: [if], data = [none] } if (variable != null) { proposition = new Proposition(); // depends on control dependency: [if], data = [none] proposition.setVariable(variable); // depends on control dependency: [if], data = [(variable] expressionStack.push(proposition); // depends on control dependency: [if], data = [none] state = S_IS; // depends on control dependency: [if], data = [none] FuzzyLite.logger().log(Level.FINE, "Token <{0}> is variable", token); // depends on control dependency: [if], data = [none] continue; } } if ((state & S_IS) != 0) { if (Rule.FL_IS.equals(token)) { state = S_HEDGE | S_TERM; // depends on control dependency: [if], data = [none] FuzzyLite.logger().log(Level.FINE, "Token <{0}> is keyword", token); // depends on control dependency: [if], data = [none] continue; } } if ((state & S_HEDGE) != 0) { HedgeFactory hedgeFactory = FactoryManager.instance().hedge(); if (hedgeFactory.hasConstructor(token)) { Hedge hedge = hedgeFactory.constructObject(token); proposition.getHedges().add(hedge); // depends on control dependency: [if], data = [none] if (hedge instanceof Any) { state = S_VARIABLE | S_AND_OR; // depends on control dependency: [if], data = [none] } else { state = S_HEDGE | S_TERM; // depends on control dependency: [if], data = [none] } FuzzyLite.logger().log(Level.FINE, "Token <{0}> is hedge", token); // depends on control dependency: [if], data = [none] continue; } } if ((state & S_TERM) != 0) { if (proposition.getVariable().hasTerm(token)) { proposition.setTerm(proposition.getVariable().getTerm(token)); // depends on control dependency: [if], data = [none] state = S_VARIABLE | S_AND_OR; // depends on control dependency: [if], data = [none] FuzzyLite.logger().log(Level.FINE, "Token <{0}> is term", token); // depends on control dependency: [if], data = [none] continue; } } if ((state & S_AND_OR) != 0) { if (Rule.FL_AND.equals(token) || Rule.FL_OR.equals(token)) { if (expressionStack.size() < 2) { throw new RuntimeException(String.format( "[syntax error] logical operator <%s> expects at least two operands, but found <%d>", token, expressionStack.size())); } Operator operator = new Operator(); operator.setName(token); // depends on control dependency: [if], data = [none] operator.setRight(expressionStack.pop()); // depends on control dependency: [if], data = [none] operator.setLeft(expressionStack.pop()); // depends on control dependency: [if], data = [none] expressionStack.push(operator); // depends on control dependency: [if], data = [none] state = S_VARIABLE | S_AND_OR; // depends on control dependency: [if], data = [none] FuzzyLite.logger().log(Level.FINE, "Subtree: ({0}) ({1})", new Object[]{operator.getLeft(), operator.getRight()}); // depends on control dependency: [if], data = [none] continue; } } //If reached this point, there was an error if ((state & S_VARIABLE) != 0 || (state & S_AND_OR) != 0) { throw new RuntimeException(String.format( "[syntax error] expected variable or logical operator, but found <%s>", token)); } if ((state & S_IS) != 0) { throw new RuntimeException(String.format( "[syntax error] expected keyword <%s>, but found <%s>", Rule.FL_IS, token)); } if ((state & S_HEDGE) != 0 || (state & S_TERM) != 0) { throw new RuntimeException(String.format( "[syntax error] expected hedge or term, but found <%s>", token)); } throw new RuntimeException(String.format( "[syntax error] unexpected token <%s>", token)); } if (!((state & S_VARIABLE) != 0 || (state & S_AND_OR) != 0)) { //only acceptable final state if ((state & S_IS) != 0) { throw new RuntimeException(String.format( "[syntax error] expected keyword <%s> after <%s>", Rule.FL_IS, token)); } if ((state & S_HEDGE) != 0 || (state & S_TERM) != 0) { throw new RuntimeException(String.format( "[syntax error] expected hedge or term, but found <%s>", token)); } } if (expressionStack.size() != 1) { List<String> errors = new LinkedList<String>(); while (expressionStack.size() > 1) { Expression element = expressionStack.pop(); errors.add(element.toString()); // depends on control dependency: [while], data = [none] } throw new RuntimeException(String.format( "[syntax error] unable to parse the following expressions: <%s>", Op.join(errors, " "))); } setExpression(expressionStack.pop()); } }
public class class_name { public Locale getMainLocale() { if (m_mainLocale != null) { return m_mainLocale; } try { CmsLocaleGroup localeGroup = m_cms.getLocaleGroupService().readLocaleGroup(this); m_mainLocale = localeGroup.getMainLocale(); return m_mainLocale; } catch (CmsException e) { return null; } } }
public class class_name { public Locale getMainLocale() { if (m_mainLocale != null) { return m_mainLocale; // depends on control dependency: [if], data = [none] } try { CmsLocaleGroup localeGroup = m_cms.getLocaleGroupService().readLocaleGroup(this); m_mainLocale = localeGroup.getMainLocale(); // depends on control dependency: [try], data = [none] return m_mainLocale; // depends on control dependency: [try], data = [none] } catch (CmsException e) { return null; } // depends on control dependency: [catch], data = [none] } }
public class class_name { private void doStop(Throwable cause) { long traceId = LoggerHelpers.traceEnterWithContext(log, traceObjectId, "doStop"); log.info("{}: Stopping.", this.traceObjectId); CompletableFuture.allOf( Services.stopAsync(this.metadataCleaner, this.executor), Services.stopAsync(this.writer, this.executor), Services.stopAsync(this.durableLog, this.executor)) .whenCompleteAsync((r, ex) -> { Throwable failureCause = getFailureCause(this.durableLog, this.writer, this.metadataCleaner); if (failureCause == null) { failureCause = cause; } else if (cause != null && failureCause != cause) { failureCause.addSuppressed(cause); } if (failureCause == null) { // Normal shutdown log.info("{}: Stopped.", this.traceObjectId); LoggerHelpers.traceLeave(log, traceObjectId, "doStop", traceId); notifyStopped(); } else { // Shutting down due to failure. log.warn("{}: Failed due to component failure.", this.traceObjectId); LoggerHelpers.traceLeave(log, traceObjectId, "doStop", traceId); notifyFailed(failureCause); } }, this.executor) .exceptionally(ex -> { notifyFailed(ex); return null; }); } }
public class class_name { private void doStop(Throwable cause) { long traceId = LoggerHelpers.traceEnterWithContext(log, traceObjectId, "doStop"); log.info("{}: Stopping.", this.traceObjectId); CompletableFuture.allOf( Services.stopAsync(this.metadataCleaner, this.executor), Services.stopAsync(this.writer, this.executor), Services.stopAsync(this.durableLog, this.executor)) .whenCompleteAsync((r, ex) -> { Throwable failureCause = getFailureCause(this.durableLog, this.writer, this.metadataCleaner); if (failureCause == null) { failureCause = cause; // depends on control dependency: [if], data = [none] } else if (cause != null && failureCause != cause) { failureCause.addSuppressed(cause); // depends on control dependency: [if], data = [(cause] } if (failureCause == null) { // Normal shutdown log.info("{}: Stopped.", this.traceObjectId); // depends on control dependency: [if], data = [none] LoggerHelpers.traceLeave(log, traceObjectId, "doStop", traceId); // depends on control dependency: [if], data = [none] notifyStopped(); // depends on control dependency: [if], data = [none] } else { // Shutting down due to failure. log.warn("{}: Failed due to component failure.", this.traceObjectId); // depends on control dependency: [if], data = [none] LoggerHelpers.traceLeave(log, traceObjectId, "doStop", traceId); // depends on control dependency: [if], data = [none] notifyFailed(failureCause); // depends on control dependency: [if], data = [(failureCause] } }, this.executor) .exceptionally(ex -> { notifyFailed(ex); return null; }); } }
public class class_name { private void visitImage(CmsObject cms, File f, boolean withVariations, boolean showSize, boolean statsOnly) { m_variationsCount++; m_variationsSize += f.length(); String oName = f.getAbsolutePath().substring(CmsImageLoader.getImageRepositoryPath().length()); oName = CmsStringUtil.substitute(oName, "\\", "/"); if (!oName.startsWith("/")) { oName = "/" + oName; } String imgName = oName; CmsResource res = null; boolean found = false; while (!found) { String path = CmsResource.getParentFolder(imgName); String name = imgName.substring(path.length()); String ext = CmsFileUtil.getExtension(imgName); String nameWoExt = name.substring(0, name.length() - ext.length()); int pos = nameWoExt.lastIndexOf("_"); String newName = path; found = (pos < 0); if (!found) { newName += nameWoExt.substring(0, pos); } else { newName += nameWoExt; } newName += ext; try { res = cms.readResource(newName, CmsResourceFilter.ALL); found = true; } catch (Exception e) { // it could be a variation } imgName = newName; } if (res != null) { oName = res.getRootPath(); } m_filePaths.put(oName, f.getAbsolutePath()); List variations = (List)m_variations.get(oName); if (variations == null) { variations = new ArrayList(); m_variations.put(oName, variations); if (statsOnly) { return; } if (res != null) { m_lengths.put(oName, "" + res.getLength() + " Bytes"); if (showSize) { m_sizes.put(oName, getSingleSize(cms, res)); } } else { m_lengths.put(oName, "" + f.length() + " Bytes"); if (showSize) { try { BufferedImage img = Simapi.read(f); m_sizes.put(oName, "" + img.getWidth() + " x " + img.getHeight() + "px"); } catch (Throwable e) { // ignore } } } } if (!withVariations) { return; } oName += " ("; if (showSize) { try { BufferedImage img = Simapi.read(f); oName += "" + img.getWidth() + " x " + img.getHeight() + "px - "; } catch (Throwable e) { // ignore } } oName += f.length() + " Bytes)"; variations.add(oName); } }
public class class_name { private void visitImage(CmsObject cms, File f, boolean withVariations, boolean showSize, boolean statsOnly) { m_variationsCount++; m_variationsSize += f.length(); String oName = f.getAbsolutePath().substring(CmsImageLoader.getImageRepositoryPath().length()); oName = CmsStringUtil.substitute(oName, "\\", "/"); if (!oName.startsWith("/")) { oName = "/" + oName; // depends on control dependency: [if], data = [none] } String imgName = oName; CmsResource res = null; boolean found = false; while (!found) { String path = CmsResource.getParentFolder(imgName); String name = imgName.substring(path.length()); String ext = CmsFileUtil.getExtension(imgName); String nameWoExt = name.substring(0, name.length() - ext.length()); int pos = nameWoExt.lastIndexOf("_"); String newName = path; found = (pos < 0); // depends on control dependency: [while], data = [none] if (!found) { newName += nameWoExt.substring(0, pos); // depends on control dependency: [if], data = [none] } else { newName += nameWoExt; // depends on control dependency: [if], data = [none] } newName += ext; // depends on control dependency: [while], data = [none] try { res = cms.readResource(newName, CmsResourceFilter.ALL); // depends on control dependency: [try], data = [none] found = true; // depends on control dependency: [try], data = [none] } catch (Exception e) { // it could be a variation } // depends on control dependency: [catch], data = [none] imgName = newName; // depends on control dependency: [while], data = [none] } if (res != null) { oName = res.getRootPath(); // depends on control dependency: [if], data = [none] } m_filePaths.put(oName, f.getAbsolutePath()); List variations = (List)m_variations.get(oName); if (variations == null) { variations = new ArrayList(); // depends on control dependency: [if], data = [none] m_variations.put(oName, variations); // depends on control dependency: [if], data = [none] if (statsOnly) { return; // depends on control dependency: [if], data = [none] } if (res != null) { m_lengths.put(oName, "" + res.getLength() + " Bytes"); // depends on control dependency: [if], data = [none] if (showSize) { m_sizes.put(oName, getSingleSize(cms, res)); // depends on control dependency: [if], data = [none] } } else { m_lengths.put(oName, "" + f.length() + " Bytes"); // depends on control dependency: [if], data = [none] if (showSize) { try { BufferedImage img = Simapi.read(f); m_sizes.put(oName, "" + img.getWidth() + " x " + img.getHeight() + "px"); // depends on control dependency: [try], data = [none] } catch (Throwable e) { // ignore } // depends on control dependency: [catch], data = [none] } } } if (!withVariations) { return; // depends on control dependency: [if], data = [none] } oName += " ("; if (showSize) { try { BufferedImage img = Simapi.read(f); oName += "" + img.getWidth() + " x " + img.getHeight() + "px - "; // depends on control dependency: [try], data = [none] } catch (Throwable e) { // ignore } // depends on control dependency: [catch], data = [none] } oName += f.length() + " Bytes)"; variations.add(oName); } }
public class class_name { protected void claBumpActivity(final MSClause c) { c.incrementActivity(claInc); if (c.activity() > 1e20) { for (final MSClause clause : learnts) clause.rescaleActivity(); claInc *= 1e-20; } } }
public class class_name { protected void claBumpActivity(final MSClause c) { c.incrementActivity(claInc); if (c.activity() > 1e20) { for (final MSClause clause : learnts) clause.rescaleActivity(); claInc *= 1e-20; // depends on control dependency: [if], data = [none] } } }
public class class_name { public EEnum getIfcAlarmTypeEnum() { if (ifcAlarmTypeEnumEEnum == null) { ifcAlarmTypeEnumEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI) .getEClassifiers().get(778); } return ifcAlarmTypeEnumEEnum; } }
public class class_name { public EEnum getIfcAlarmTypeEnum() { if (ifcAlarmTypeEnumEEnum == null) { ifcAlarmTypeEnumEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI) .getEClassifiers().get(778); // depends on control dependency: [if], data = [none] } return ifcAlarmTypeEnumEEnum; } }
public class class_name { public AddTags addTags(String photoId, List<String> tags) throws JinxException { JinxUtils.validateParams(photoId, tags); Map<String, String> params = new TreeMap<>(); params.put("method", "flickr.photos.addTags"); params.put("photo_id", photoId); StringBuilder sb = new StringBuilder(); for (String tag : tags) { if (tag.contains(" ")) { sb.append('"').append(tag).append('"'); } else { sb.append(tag); } sb.append(' '); } sb.deleteCharAt(sb.length() - 1); params.put("tags", sb.toString()); return this.jinx.flickrPost(params, AddTags.class); } }
public class class_name { public AddTags addTags(String photoId, List<String> tags) throws JinxException { JinxUtils.validateParams(photoId, tags); Map<String, String> params = new TreeMap<>(); params.put("method", "flickr.photos.addTags"); params.put("photo_id", photoId); StringBuilder sb = new StringBuilder(); for (String tag : tags) { if (tag.contains(" ")) { sb.append('"').append(tag).append('"'); // depends on control dependency: [if], data = [none] } else { sb.append(tag); // depends on control dependency: [if], data = [none] } sb.append(' '); } sb.deleteCharAt(sb.length() - 1); params.put("tags", sb.toString()); return this.jinx.flickrPost(params, AddTags.class); } }
public class class_name { public MessageDestinationRefType<EntityBeanType<T>> getOrCreateMessageDestinationRef() { List<Node> nodeList = childNode.get("message-destination-ref"); if (nodeList != null && nodeList.size() > 0) { return new MessageDestinationRefTypeImpl<EntityBeanType<T>>(this, "message-destination-ref", childNode, nodeList.get(0)); } return createMessageDestinationRef(); } }
public class class_name { public MessageDestinationRefType<EntityBeanType<T>> getOrCreateMessageDestinationRef() { List<Node> nodeList = childNode.get("message-destination-ref"); if (nodeList != null && nodeList.size() > 0) { return new MessageDestinationRefTypeImpl<EntityBeanType<T>>(this, "message-destination-ref", childNode, nodeList.get(0)); // depends on control dependency: [if], data = [none] } return createMessageDestinationRef(); } }
public class class_name { protected JSONObject elementToJson(CmsContainerElementBean element, Set<String> excludeSettings) { JSONObject data = null; try { data = new JSONObject(); data.put(FavListProp.ELEMENT.name().toLowerCase(), element.getId().toString()); if (element.getFormatterId() != null) { data.put(FavListProp.FORMATTER.name().toLowerCase(), element.getFormatterId().toString()); } JSONObject properties = new JSONObject(); for (Map.Entry<String, String> entry : element.getIndividualSettings().entrySet()) { String settingKey = entry.getKey(); if (!excludeSettings.contains(settingKey)) { properties.put(entry.getKey(), entry.getValue()); } } data.put(FavListProp.PROPERTIES.name().toLowerCase(), properties); } catch (JSONException e) { // should never happen if (!LOG.isDebugEnabled()) { LOG.warn(e.getLocalizedMessage()); } LOG.debug(e.getLocalizedMessage(), e); return null; } return data; } }
public class class_name { protected JSONObject elementToJson(CmsContainerElementBean element, Set<String> excludeSettings) { JSONObject data = null; try { data = new JSONObject(); // depends on control dependency: [try], data = [none] data.put(FavListProp.ELEMENT.name().toLowerCase(), element.getId().toString()); // depends on control dependency: [try], data = [none] if (element.getFormatterId() != null) { data.put(FavListProp.FORMATTER.name().toLowerCase(), element.getFormatterId().toString()); // depends on control dependency: [if], data = [none] } JSONObject properties = new JSONObject(); for (Map.Entry<String, String> entry : element.getIndividualSettings().entrySet()) { String settingKey = entry.getKey(); if (!excludeSettings.contains(settingKey)) { properties.put(entry.getKey(), entry.getValue()); // depends on control dependency: [if], data = [none] } } data.put(FavListProp.PROPERTIES.name().toLowerCase(), properties); // depends on control dependency: [try], data = [none] } catch (JSONException e) { // should never happen if (!LOG.isDebugEnabled()) { LOG.warn(e.getLocalizedMessage()); // depends on control dependency: [if], data = [none] } LOG.debug(e.getLocalizedMessage(), e); return null; } // depends on control dependency: [catch], data = [none] return data; } }
public class class_name { public static NumberData round(SoyValue value, int numDigitsAfterPoint) { // NOTE: for more accurate rounding, this should really be using BigDecimal which can do correct // decimal arithmetic. However, for compatibility with js, that probably isn't an option. if (numDigitsAfterPoint == 0) { return IntegerData.forValue(round(value)); } else if (numDigitsAfterPoint > 0) { double valueDouble = value.numberValue(); double shift = Math.pow(10, numDigitsAfterPoint); return FloatData.forValue(Math.round(valueDouble * shift) / shift); } else { double valueDouble = value.numberValue(); double shift = Math.pow(10, -numDigitsAfterPoint); return IntegerData.forValue((int) (Math.round(valueDouble / shift) * shift)); } } }
public class class_name { public static NumberData round(SoyValue value, int numDigitsAfterPoint) { // NOTE: for more accurate rounding, this should really be using BigDecimal which can do correct // decimal arithmetic. However, for compatibility with js, that probably isn't an option. if (numDigitsAfterPoint == 0) { return IntegerData.forValue(round(value)); // depends on control dependency: [if], data = [none] } else if (numDigitsAfterPoint > 0) { double valueDouble = value.numberValue(); double shift = Math.pow(10, numDigitsAfterPoint); return FloatData.forValue(Math.round(valueDouble * shift) / shift); // depends on control dependency: [if], data = [none] } else { double valueDouble = value.numberValue(); double shift = Math.pow(10, -numDigitsAfterPoint); return IntegerData.forValue((int) (Math.round(valueDouble / shift) * shift)); // depends on control dependency: [if], data = [none] } } }
public class class_name { private SQLiteConnection tryAcquirePrimaryConnectionLocked(int connectionFlags) { // If the primary connection is available, acquire it now. SQLiteConnection connection = mAvailablePrimaryConnection; if (connection != null) { mAvailablePrimaryConnection = null; finishAcquireConnectionLocked(connection, connectionFlags); // might throw return connection; } // Make sure that the primary connection actually exists and has just been acquired. for (SQLiteConnection acquiredConnection : mAcquiredConnections.keySet()) { if (acquiredConnection.isPrimaryConnection()) { return null; } } // Uhoh. No primary connection! Either this is the first time we asked // for it, or maybe it leaked? connection = openConnectionLocked(mConfiguration, true /*primaryConnection*/); // might throw finishAcquireConnectionLocked(connection, connectionFlags); // might throw return connection; } }
public class class_name { private SQLiteConnection tryAcquirePrimaryConnectionLocked(int connectionFlags) { // If the primary connection is available, acquire it now. SQLiteConnection connection = mAvailablePrimaryConnection; if (connection != null) { mAvailablePrimaryConnection = null; // depends on control dependency: [if], data = [none] finishAcquireConnectionLocked(connection, connectionFlags); // might throw // depends on control dependency: [if], data = [(connection] return connection; // depends on control dependency: [if], data = [none] } // Make sure that the primary connection actually exists and has just been acquired. for (SQLiteConnection acquiredConnection : mAcquiredConnections.keySet()) { if (acquiredConnection.isPrimaryConnection()) { return null; // depends on control dependency: [if], data = [none] } } // Uhoh. No primary connection! Either this is the first time we asked // for it, or maybe it leaked? connection = openConnectionLocked(mConfiguration, true /*primaryConnection*/); // might throw finishAcquireConnectionLocked(connection, connectionFlags); // might throw return connection; } }
public class class_name { public static long multReorder(ZMatrixRMaj matA , ZMatrixRMaj matB , ZMatrixRMaj matResult , int numTrials) { long prev = System.currentTimeMillis(); for( int i = 0; i < numTrials; i++ ) { MatrixMatrixMult_ZDRM.mult_reorder(matA, matB, matResult); } long curr = System.currentTimeMillis(); return curr-prev; } }
public class class_name { public static long multReorder(ZMatrixRMaj matA , ZMatrixRMaj matB , ZMatrixRMaj matResult , int numTrials) { long prev = System.currentTimeMillis(); for( int i = 0; i < numTrials; i++ ) { MatrixMatrixMult_ZDRM.mult_reorder(matA, matB, matResult); // depends on control dependency: [for], data = [none] } long curr = System.currentTimeMillis(); return curr-prev; } }
public class class_name { protected void removeSnapshotIdFromSpaceProps(String spaceId) { log.debug("Removing " + Constants.SNAPSHOT_ID_PROP + " property from space " + spaceId); Map<String, String> spaceProps = snapshotProvider.getSpaceProperties(spaceId); if (spaceProps.remove(Constants.SNAPSHOT_ID_PROP) != null) { unwrappedSnapshotProvider.setNewSpaceProperties(spaceId, spaceProps); log.info("Removed " + Constants.SNAPSHOT_ID_PROP + " from space properties for space " + spaceId); } else { log.debug("Property " + Constants.SNAPSHOT_ID_PROP + " does not exist in space properties for " + spaceId + ". No need to update space properties."); } } }
public class class_name { protected void removeSnapshotIdFromSpaceProps(String spaceId) { log.debug("Removing " + Constants.SNAPSHOT_ID_PROP + " property from space " + spaceId); Map<String, String> spaceProps = snapshotProvider.getSpaceProperties(spaceId); if (spaceProps.remove(Constants.SNAPSHOT_ID_PROP) != null) { unwrappedSnapshotProvider.setNewSpaceProperties(spaceId, spaceProps); // depends on control dependency: [if], data = [none] log.info("Removed " + Constants.SNAPSHOT_ID_PROP + " from space properties for space " + spaceId); // depends on control dependency: [if], data = [none] } else { log.debug("Property " + Constants.SNAPSHOT_ID_PROP + " does not exist in space properties for " + spaceId + ". No need to update space properties."); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static long getAndAddRequest(AtomicLong requested, long n) { // add n to field but check for overflow while (true) { long current = requested.get(); long next = current + n; // check for overflow if (next < 0) { next = Long.MAX_VALUE; } if (requested.compareAndSet(current, next)) { return current; } } } }
public class class_name { public static long getAndAddRequest(AtomicLong requested, long n) { // add n to field but check for overflow while (true) { long current = requested.get(); long next = current + n; // check for overflow if (next < 0) { next = Long.MAX_VALUE; // depends on control dependency: [if], data = [none] } if (requested.compareAndSet(current, next)) { return current; // depends on control dependency: [if], data = [none] } } } }
public class class_name { public void marshall(OrcSerDe orcSerDe, ProtocolMarshaller protocolMarshaller) { if (orcSerDe == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(orcSerDe.getStripeSizeBytes(), STRIPESIZEBYTES_BINDING); protocolMarshaller.marshall(orcSerDe.getBlockSizeBytes(), BLOCKSIZEBYTES_BINDING); protocolMarshaller.marshall(orcSerDe.getRowIndexStride(), ROWINDEXSTRIDE_BINDING); protocolMarshaller.marshall(orcSerDe.getEnablePadding(), ENABLEPADDING_BINDING); protocolMarshaller.marshall(orcSerDe.getPaddingTolerance(), PADDINGTOLERANCE_BINDING); protocolMarshaller.marshall(orcSerDe.getCompression(), COMPRESSION_BINDING); protocolMarshaller.marshall(orcSerDe.getBloomFilterColumns(), BLOOMFILTERCOLUMNS_BINDING); protocolMarshaller.marshall(orcSerDe.getBloomFilterFalsePositiveProbability(), BLOOMFILTERFALSEPOSITIVEPROBABILITY_BINDING); protocolMarshaller.marshall(orcSerDe.getDictionaryKeyThreshold(), DICTIONARYKEYTHRESHOLD_BINDING); protocolMarshaller.marshall(orcSerDe.getFormatVersion(), FORMATVERSION_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(OrcSerDe orcSerDe, ProtocolMarshaller protocolMarshaller) { if (orcSerDe == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(orcSerDe.getStripeSizeBytes(), STRIPESIZEBYTES_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(orcSerDe.getBlockSizeBytes(), BLOCKSIZEBYTES_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(orcSerDe.getRowIndexStride(), ROWINDEXSTRIDE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(orcSerDe.getEnablePadding(), ENABLEPADDING_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(orcSerDe.getPaddingTolerance(), PADDINGTOLERANCE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(orcSerDe.getCompression(), COMPRESSION_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(orcSerDe.getBloomFilterColumns(), BLOOMFILTERCOLUMNS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(orcSerDe.getBloomFilterFalsePositiveProbability(), BLOOMFILTERFALSEPOSITIVEPROBABILITY_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(orcSerDe.getDictionaryKeyThreshold(), DICTIONARYKEYTHRESHOLD_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(orcSerDe.getFormatVersion(), FORMATVERSION_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 synchronized Resource[] internalGet(String pattern) { Resource[] resources = cache.get(pattern); if (resources != null) { return resources; } try { resources = resolver.getResources(pattern); } catch (IOException e) { throw MiscUtil.toUnchecked(e); } if (resources == null) { resources = new Resource[0]; } else { Arrays.sort(resources, resourceComparator); } cache.put(pattern, resources); return resources; } }
public class class_name { private synchronized Resource[] internalGet(String pattern) { Resource[] resources = cache.get(pattern); if (resources != null) { return resources; // depends on control dependency: [if], data = [none] } try { resources = resolver.getResources(pattern); // depends on control dependency: [try], data = [none] } catch (IOException e) { throw MiscUtil.toUnchecked(e); } // depends on control dependency: [catch], data = [none] if (resources == null) { resources = new Resource[0]; // depends on control dependency: [if], data = [none] } else { Arrays.sort(resources, resourceComparator); // depends on control dependency: [if], data = [(resources] } cache.put(pattern, resources); return resources; } }
public class class_name { public com.google.protobuf.ByteString getDefaultHostnameBytes() { java.lang.Object ref = defaultHostname_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); defaultHostname_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } }
public class class_name { public com.google.protobuf.ByteString getDefaultHostnameBytes() { java.lang.Object ref = defaultHostname_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); defaultHostname_ = b; // depends on control dependency: [if], data = [none] return b; // depends on control dependency: [if], data = [none] } else { return (com.google.protobuf.ByteString) ref; // depends on control dependency: [if], data = [none] } } }
public class class_name { public void move(GeometryIndex[] indices, JsArray<JsArrayObject> coordinates) { List<List<Coordinate>> coords = new ArrayList<List<Coordinate>>(coordinates.length()); for (int i = 0; i < coordinates.length(); i++) { JsArrayObject jsObj = coordinates.get(i); coords.add(Arrays.asList(ExporterUtil.toArrObject(jsObj, new Coordinate[jsObj.length()]))); } try { delegate.move(Arrays.asList(indices), coords); } catch (GeometryOperationFailedException e) { throw new RuntimeException(e.getMessage()); } } }
public class class_name { public void move(GeometryIndex[] indices, JsArray<JsArrayObject> coordinates) { List<List<Coordinate>> coords = new ArrayList<List<Coordinate>>(coordinates.length()); for (int i = 0; i < coordinates.length(); i++) { JsArrayObject jsObj = coordinates.get(i); coords.add(Arrays.asList(ExporterUtil.toArrObject(jsObj, new Coordinate[jsObj.length()]))); // depends on control dependency: [for], data = [none] } try { delegate.move(Arrays.asList(indices), coords); // depends on control dependency: [try], data = [none] } catch (GeometryOperationFailedException e) { throw new RuntimeException(e.getMessage()); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void marshall(Eyeglasses eyeglasses, ProtocolMarshaller protocolMarshaller) { if (eyeglasses == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(eyeglasses.getValue(), VALUE_BINDING); protocolMarshaller.marshall(eyeglasses.getConfidence(), CONFIDENCE_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(Eyeglasses eyeglasses, ProtocolMarshaller protocolMarshaller) { if (eyeglasses == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(eyeglasses.getValue(), VALUE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(eyeglasses.getConfidence(), CONFIDENCE_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 static OperationId getOperationId(Method method) { Command command = method.getAnnotation(Command.class); if (command != null) { String name = command.value().equals("") ? method.getName() : command.value(); return OperationId.from(name, OperationType.COMMAND); } Query query = method.getAnnotation(Query.class); if (query != null) { String name = query.value().equals("") ? method.getName() : query.value(); return OperationId.from(name, OperationType.QUERY); } Operation operation = method.getAnnotation(Operation.class); if (operation != null) { String name = operation.value().equals("") ? method.getName() : operation.value(); return OperationId.from(name, operation.type()); } return null; } }
public class class_name { private static OperationId getOperationId(Method method) { Command command = method.getAnnotation(Command.class); if (command != null) { String name = command.value().equals("") ? method.getName() : command.value(); return OperationId.from(name, OperationType.COMMAND); // depends on control dependency: [if], data = [none] } Query query = method.getAnnotation(Query.class); if (query != null) { String name = query.value().equals("") ? method.getName() : query.value(); return OperationId.from(name, OperationType.QUERY); // depends on control dependency: [if], data = [none] } Operation operation = method.getAnnotation(Operation.class); if (operation != null) { String name = operation.value().equals("") ? method.getName() : operation.value(); return OperationId.from(name, operation.type()); // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { @Override public DTDSubset combineWithExternalSubset(InputProblemReporter rep, DTDSubset extSubset) throws XMLStreamException { /* First let's see if we can just reuse GE Map used by int or ext * subset; (if only one has contents), or if not, combine them. */ HashMap<String,EntityDecl> ge1 = getGeneralEntityMap(); HashMap<String,EntityDecl> ge2 = extSubset.getGeneralEntityMap(); if (ge1 == null || ge1.isEmpty()) { ge1 = ge2; } else { if (ge2 != null && !ge2.isEmpty()) { /* Internal subset Objects are never shared or reused (and by * extension, neither are objects they contain), so we can just * modify GE map if necessary */ combineMaps(ge1, ge2); } } // Ok, then, let's combine notations similarly HashMap<String,NotationDeclaration> n1 = getNotationMap(); HashMap<String,NotationDeclaration> n2 = extSubset.getNotationMap(); if (n1 == null || n1.isEmpty()) { n1 = n2; } else { if (n2 != null && !n2.isEmpty()) { /* First; let's make sure there are no colliding notation * definitions: it's an error to try to redefine notations. */ checkNotations(n1, n2); /* Internal subset Objects are never shared or reused (and by * extension, neither are objects they contain), so we can just * modify notation map if necessary */ combineMaps(n1, n2); } } // And finally elements, rather similarly: HashMap<PrefixedName,DTDElement> e1 = getElementMap(); HashMap<PrefixedName,DTDElement> e2 = extSubset.getElementMap(); if (e1 == null || e1.isEmpty()) { e1 = e2; } else { if (e2 != null && !e2.isEmpty()) { /* Internal subset Objects are never shared or reused (and by * extension, neither are objects they contain), so we can just * modify element map if necessary */ combineElements(rep, e1, e2); } } /* Combos are not cachable, and because of that, there's no point * in storing any PE info either. */ return constructInstance(false, ge1, null, null, null, n1, e1, mFullyValidating); } }
public class class_name { @Override public DTDSubset combineWithExternalSubset(InputProblemReporter rep, DTDSubset extSubset) throws XMLStreamException { /* First let's see if we can just reuse GE Map used by int or ext * subset; (if only one has contents), or if not, combine them. */ HashMap<String,EntityDecl> ge1 = getGeneralEntityMap(); HashMap<String,EntityDecl> ge2 = extSubset.getGeneralEntityMap(); if (ge1 == null || ge1.isEmpty()) { ge1 = ge2; } else { if (ge2 != null && !ge2.isEmpty()) { /* Internal subset Objects are never shared or reused (and by * extension, neither are objects they contain), so we can just * modify GE map if necessary */ combineMaps(ge1, ge2); // depends on control dependency: [if], data = [none] } } // Ok, then, let's combine notations similarly HashMap<String,NotationDeclaration> n1 = getNotationMap(); HashMap<String,NotationDeclaration> n2 = extSubset.getNotationMap(); if (n1 == null || n1.isEmpty()) { n1 = n2; } else { if (n2 != null && !n2.isEmpty()) { /* First; let's make sure there are no colliding notation * definitions: it's an error to try to redefine notations. */ checkNotations(n1, n2); // depends on control dependency: [if], data = [none] /* Internal subset Objects are never shared or reused (and by * extension, neither are objects they contain), so we can just * modify notation map if necessary */ combineMaps(n1, n2); // depends on control dependency: [if], data = [none] } } // And finally elements, rather similarly: HashMap<PrefixedName,DTDElement> e1 = getElementMap(); HashMap<PrefixedName,DTDElement> e2 = extSubset.getElementMap(); if (e1 == null || e1.isEmpty()) { e1 = e2; } else { if (e2 != null && !e2.isEmpty()) { /* Internal subset Objects are never shared or reused (and by * extension, neither are objects they contain), so we can just * modify element map if necessary */ combineElements(rep, e1, e2); // depends on control dependency: [if], data = [none] } } /* Combos are not cachable, and because of that, there's no point * in storing any PE info either. */ return constructInstance(false, ge1, null, null, null, n1, e1, mFullyValidating); } }
public class class_name { public boolean isLeap(long instant) { int thisYear = iChronology.getYear(instant); if (iChronology.isLeapYear(thisYear)) { return (iChronology.getMonthOfYear(instant, thisYear) == iLeapMonth); } return false; } }
public class class_name { public boolean isLeap(long instant) { int thisYear = iChronology.getYear(instant); if (iChronology.isLeapYear(thisYear)) { return (iChronology.getMonthOfYear(instant, thisYear) == iLeapMonth); // depends on control dependency: [if], data = [none] } return false; } }
public class class_name { public static String getChallengePassword(final PKCS10CertificationRequest csr) { Attribute[] attrs = csr.getAttributes(); for (Attribute attr : attrs) { if (attr.getAttrType().equals( PKCSObjectIdentifiers.pkcs_9_at_challengePassword)) { // According to RFC 2985 this may be any of the DirectoryString // types, but we can be more flexible and allow any ASN.1 // string. ASN1String challengePassword = (ASN1String) attr .getAttrValues().getObjectAt(0); return challengePassword.getString(); } } return null; } }
public class class_name { public static String getChallengePassword(final PKCS10CertificationRequest csr) { Attribute[] attrs = csr.getAttributes(); for (Attribute attr : attrs) { if (attr.getAttrType().equals( PKCSObjectIdentifiers.pkcs_9_at_challengePassword)) { // According to RFC 2985 this may be any of the DirectoryString // types, but we can be more flexible and allow any ASN.1 // string. ASN1String challengePassword = (ASN1String) attr .getAttrValues().getObjectAt(0); return challengePassword.getString(); // depends on control dependency: [if], data = [none] } } return null; } }
public class class_name { protected String optionDisplayString(final String opt, boolean extended) { StringBuffer stringBuffer = new StringBuffer(); stringBuffer.append("-").append(opt); Option option = getOption(opt); if(null!=option) { if (option.getLongOpt() != null) { stringBuffer.append("/--"); stringBuffer.append(option.getLongOpt()); } if(option.getArgName()!=null && extended){ stringBuffer.append(" <"); stringBuffer.append(option.getArgName()); stringBuffer.append(">"); } } return stringBuffer.toString(); } }
public class class_name { protected String optionDisplayString(final String opt, boolean extended) { StringBuffer stringBuffer = new StringBuffer(); stringBuffer.append("-").append(opt); Option option = getOption(opt); if(null!=option) { if (option.getLongOpt() != null) { stringBuffer.append("/--"); // depends on control dependency: [if], data = [none] stringBuffer.append(option.getLongOpt()); // depends on control dependency: [if], data = [(option.getLongOpt()] } if(option.getArgName()!=null && extended){ stringBuffer.append(" <"); // depends on control dependency: [if], data = [none] stringBuffer.append(option.getArgName()); // depends on control dependency: [if], data = [(option.getArgName()] stringBuffer.append(">"); // depends on control dependency: [if], data = [none] } } return stringBuffer.toString(); } }
public class class_name { public void marshall(LogEvent logEvent, ProtocolMarshaller protocolMarshaller) { if (logEvent == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(logEvent.getCreatedAt(), CREATEDAT_BINDING); protocolMarshaller.marshall(logEvent.getMessage(), MESSAGE_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(LogEvent logEvent, ProtocolMarshaller protocolMarshaller) { if (logEvent == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(logEvent.getCreatedAt(), CREATEDAT_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(logEvent.getMessage(), MESSAGE_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static TemporalDataModelIF<Long, Long> run(final Properties properties) throws ClassNotFoundException, IllegalAccessException, InstantiationException, InvocationTargetException, NoSuchMethodException, IOException { System.out.println("Parsing started"); TemporalDataModelIF<Long, Long> model = null; File file = new File(properties.getProperty(DATASET_FILE)); String parserClassName = properties.getProperty(DATASET_PARSER); Class<?> parserClass = Class.forName(parserClassName); Parser<Long, Long> parser = instantiateParser(properties); if (parserClassName.contains("LastfmCelma")) { String mapIdsPrefix = properties.getProperty(LASTFM_IDS_PREFIX); Object modelObj = parserClass.getMethod("parseData", File.class, String.class).invoke(parser, file, mapIdsPrefix); if (modelObj instanceof TemporalDataModelIF) { @SuppressWarnings("unchecked") TemporalDataModelIF<Long, Long> modelTemp = (TemporalDataModelIF<Long, Long>) modelObj; model = modelTemp; } } else { model = parser.parseTemporalData(file); } System.out.println("Parsing finished"); return model; } }
public class class_name { public static TemporalDataModelIF<Long, Long> run(final Properties properties) throws ClassNotFoundException, IllegalAccessException, InstantiationException, InvocationTargetException, NoSuchMethodException, IOException { System.out.println("Parsing started"); TemporalDataModelIF<Long, Long> model = null; File file = new File(properties.getProperty(DATASET_FILE)); String parserClassName = properties.getProperty(DATASET_PARSER); Class<?> parserClass = Class.forName(parserClassName); Parser<Long, Long> parser = instantiateParser(properties); if (parserClassName.contains("LastfmCelma")) { String mapIdsPrefix = properties.getProperty(LASTFM_IDS_PREFIX); Object modelObj = parserClass.getMethod("parseData", File.class, String.class).invoke(parser, file, mapIdsPrefix); if (modelObj instanceof TemporalDataModelIF) { @SuppressWarnings("unchecked") TemporalDataModelIF<Long, Long> modelTemp = (TemporalDataModelIF<Long, Long>) modelObj; model = modelTemp; // depends on control dependency: [if], data = [none] } } else { model = parser.parseTemporalData(file); } System.out.println("Parsing finished"); return model; } }
public class class_name { public void marshall(UdpOutputSettings udpOutputSettings, ProtocolMarshaller protocolMarshaller) { if (udpOutputSettings == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(udpOutputSettings.getBufferMsec(), BUFFERMSEC_BINDING); protocolMarshaller.marshall(udpOutputSettings.getContainerSettings(), CONTAINERSETTINGS_BINDING); protocolMarshaller.marshall(udpOutputSettings.getDestination(), DESTINATION_BINDING); protocolMarshaller.marshall(udpOutputSettings.getFecOutputSettings(), FECOUTPUTSETTINGS_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(UdpOutputSettings udpOutputSettings, ProtocolMarshaller protocolMarshaller) { if (udpOutputSettings == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(udpOutputSettings.getBufferMsec(), BUFFERMSEC_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(udpOutputSettings.getContainerSettings(), CONTAINERSETTINGS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(udpOutputSettings.getDestination(), DESTINATION_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(udpOutputSettings.getFecOutputSettings(), FECOUTPUTSETTINGS_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 String parse(final String message, final Map<String, ?> vars, boolean recursive, final MessageResolver messageResolver) { // 評価したメッセージを格納するバッファ。 final StringBuilder sb = new StringBuilder(message.length()); /* * 変数とEL式を解析する際に使用する、スタック変数。 * 式の開始が現れたらスタックに積み、式の終了が現れたらスタックから全てを取り出す。 * スタックに積まれるのは、1つ文の変数またはEL式。 */ final LinkedList<String> stack = new LinkedList<String>(); final int length = message.length(); for(int i=0; i < length; i++) { final char c = message.charAt(i); if(StackUtils.equalsTopElement(stack, "\\")) { // 直前の文字がエスケープ文字の場合、エスケープ文字として結合する。 String escapedChar = StackUtils.popup(stack) + c; if(!stack.isEmpty()) { // 取り出した後もスタックがある場合は、式の途中であるため、再度スタックに積む。 stack.push(escapedChar); } else { // 取り出した後にスタックがない場合は、エスケープを解除して通常の文字として積む。 sb.append(c); } } else if(c == '\\') { // エスケープ文字の場合はスタックに積む。 stack.push(String.valueOf(c)); } else if(c == '$') { stack.push(String.valueOf(c)); } else if(c == '{') { if(!stack.isEmpty() && !StackUtils.equalsAnyBottomElement(stack, new String[]{"$", "{"})) { // スタックの先頭が式の開始形式でない場合 throw new MessageParseException(message, "expression not start with '{' or '$'"); } else { stack.push(String.valueOf(c)); } } else if(c == '}') { if(StackUtils.equalsAnyBottomElement(stack, new String[]{"{", "$"})) { // 式の終わりの場合は、式を取り出し評価する。 String expression = StackUtils.popupAndConcat(stack) + c; // エスケープを解除する expression = Utils.removeEscapeChar(expression, '\\'); String result = evaluate(expression, vars, recursive, messageResolver); sb.append(result); } else { sb.append(c); } } else { if(stack.isEmpty()) { sb.append(c); } else { stack.push(String.valueOf(c)); } } } if(!stack.isEmpty()) { String val = StackUtils.popupAndConcat(stack); val = Utils.removeEscapeChar(val, '\\'); sb.append(val); } return sb.toString(); } }
public class class_name { protected String parse(final String message, final Map<String, ?> vars, boolean recursive, final MessageResolver messageResolver) { // 評価したメッセージを格納するバッファ。 final StringBuilder sb = new StringBuilder(message.length()); /* * 変数とEL式を解析する際に使用する、スタック変数。 * 式の開始が現れたらスタックに積み、式の終了が現れたらスタックから全てを取り出す。 * スタックに積まれるのは、1つ文の変数またはEL式。 */ final LinkedList<String> stack = new LinkedList<String>(); final int length = message.length(); for(int i=0; i < length; i++) { final char c = message.charAt(i); if(StackUtils.equalsTopElement(stack, "\\")) { // 直前の文字がエスケープ文字の場合、エスケープ文字として結合する。 String escapedChar = StackUtils.popup(stack) + c; if(!stack.isEmpty()) { // 取り出した後もスタックがある場合は、式の途中であるため、再度スタックに積む。 stack.push(escapedChar); // depends on control dependency: [if], data = [none] } else { // 取り出した後にスタックがない場合は、エスケープを解除して通常の文字として積む。 sb.append(c); // depends on control dependency: [if], data = [none] } } else if(c == '\\') { // エスケープ文字の場合はスタックに積む。 stack.push(String.valueOf(c)); // depends on control dependency: [if], data = [(c] } else if(c == '$') { stack.push(String.valueOf(c)); // depends on control dependency: [if], data = [(c] } else if(c == '{') { if(!stack.isEmpty() && !StackUtils.equalsAnyBottomElement(stack, new String[]{"$", "{"})) { // スタックの先頭が式の開始形式でない場合 throw new MessageParseException(message, "expression not start with '{' or '$'"); } else { stack.push(String.valueOf(c)); } } else if(c == '}') { if(StackUtils.equalsAnyBottomElement(stack, new String[]{"{", "$"})) { // 式の終わりの場合は、式を取り出し評価する。 String expression = StackUtils.popupAndConcat(stack) + c; // エスケープを解除する expression = Utils.removeEscapeChar(expression, '\\'); String result = evaluate(expression, vars, recursive, messageResolver); sb.append(result); } else { sb.append(c); } } else { if(stack.isEmpty()) { sb.append(c); // depends on control dependency: [if], data = [none] } else { stack.push(String.valueOf(c)); // depends on control dependency: [if], data = [none] } } } if(!stack.isEmpty()) { String val = StackUtils.popupAndConcat(stack); val = Utils.removeEscapeChar(val, '\\'); // depends on control dependency: [if], data = [none] sb.append(val); // depends on control dependency: [if], data = [none] } return sb.toString(); // depends on control dependency: [if], data = [none] } }
public class class_name { public void setUsers(java.util.Collection<User> users) { if (users == null) { this.users = null; return; } this.users = new com.amazonaws.internal.SdkInternalList<User>(users); } }
public class class_name { public void setUsers(java.util.Collection<User> users) { if (users == null) { this.users = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.users = new com.amazonaws.internal.SdkInternalList<User>(users); } }
public class class_name { public ResourceBundle getResourceBundle(FacesContext ctx, String name) { if (defaultApplication != null) { return defaultApplication.getResourceBundle(ctx, name); } throw new UnsupportedOperationException(); } }
public class class_name { public ResourceBundle getResourceBundle(FacesContext ctx, String name) { if (defaultApplication != null) { return defaultApplication.getResourceBundle(ctx, name); // depends on control dependency: [if], data = [none] } throw new UnsupportedOperationException(); } }
public class class_name { @Override public boolean offer(final T data) { if (!open) { throw new ClosedQueueException(); } try { final boolean result = producerWait.offer(() -> this.queue.offer((T) nullSafe(data), this.offerTimeout, this.offerTimeUnit)); if (sizeSignal != null) this.sizeSignal.set(queue.size()); return result; } catch (final InterruptedException e) { Thread.currentThread() .interrupt(); throw ExceptionSoftener.throwSoftenedException(e); } } }
public class class_name { @Override public boolean offer(final T data) { if (!open) { throw new ClosedQueueException(); } try { final boolean result = producerWait.offer(() -> this.queue.offer((T) nullSafe(data), this.offerTimeout, this.offerTimeUnit)); if (sizeSignal != null) this.sizeSignal.set(queue.size()); return result; // depends on control dependency: [try], data = [none] } catch (final InterruptedException e) { Thread.currentThread() .interrupt(); throw ExceptionSoftener.throwSoftenedException(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { @Override public SocializeEntityLoader initEntityLoader() { SocializeEntityLoader entityLoader = Socialize.getSocialize().getEntityLoader(); if(entityLoader == null) { String entityLoaderClassName = config.getProperty(SocializeConfig.SOCIALIZE_ENTITY_LOADER); if(!StringUtils.isEmpty(entityLoaderClassName)) { try { if(logger != null && logger.isDebugEnabled()) { logger.debug("Instantiating entity loader [" + entityLoader + "]"); } Object loader = objectUtils.construct(entityLoaderClassName); if(loader instanceof SocializeEntityLoader) { entityLoader = (SocializeEntityLoader)loader; Socialize.getSocialize().setEntityLoader(entityLoader); } else { if(logger != null) { logger.error("Entity loader [" + entityLoader + "] is not an instance of [" + SocializeEntityLoader.class.getName() + "]"); } } } catch (SocializeException e) { if(logger != null) { logger.error("Failed to instantiate entity loader [" + entityLoader + "]", e); } } } else { if(logger != null) { logger.warn("No entity loader specified in socialize.properties"); } } } return entityLoader; } }
public class class_name { @Override public SocializeEntityLoader initEntityLoader() { SocializeEntityLoader entityLoader = Socialize.getSocialize().getEntityLoader(); if(entityLoader == null) { String entityLoaderClassName = config.getProperty(SocializeConfig.SOCIALIZE_ENTITY_LOADER); if(!StringUtils.isEmpty(entityLoaderClassName)) { try { if(logger != null && logger.isDebugEnabled()) { logger.debug("Instantiating entity loader [" + entityLoader + "]"); // depends on control dependency: [if], data = [none] } Object loader = objectUtils.construct(entityLoaderClassName); if(loader instanceof SocializeEntityLoader) { entityLoader = (SocializeEntityLoader)loader; // depends on control dependency: [if], data = [none] Socialize.getSocialize().setEntityLoader(entityLoader); // depends on control dependency: [if], data = [none] } else { if(logger != null) { logger.error("Entity loader [" + entityLoader + "] is not an instance of [" + SocializeEntityLoader.class.getName() + "]"); // depends on control dependency: [if], data = [none] } } } catch (SocializeException e) { if(logger != null) { logger.error("Failed to instantiate entity loader [" + entityLoader + "]", e); // depends on control dependency: [if], data = [none] } } // depends on control dependency: [catch], data = [none] } else { if(logger != null) { logger.warn("No entity loader specified in socialize.properties"); // depends on control dependency: [if], data = [none] } } } return entityLoader; } }
public class class_name { public static FeatureList read(String filename) throws IOException { logger.info("Reading: {}", filename); FeatureList features = new FeatureList(); BufferedReader br = new BufferedReader(new FileReader(filename)); String s; for (s = br.readLine(); null != s; s = br.readLine()) { s = s.trim(); if (s.length() > 0) { if (s.charAt(0) == '#') { //ignore comment lines } else { FeatureI f = parseLine(s); if (f != null) { features.add(f); } } } } br.close(); return features; } }
public class class_name { public static FeatureList read(String filename) throws IOException { logger.info("Reading: {}", filename); FeatureList features = new FeatureList(); BufferedReader br = new BufferedReader(new FileReader(filename)); String s; for (s = br.readLine(); null != s; s = br.readLine()) { s = s.trim(); if (s.length() > 0) { if (s.charAt(0) == '#') { //ignore comment lines } else { FeatureI f = parseLine(s); if (f != null) { features.add(f); // depends on control dependency: [if], data = [(f] } } } } br.close(); return features; } }
public class class_name { private UserRole getPanelRole(User user, Panel panel) { if (panel != null) { PanelUserDAO panelUserDAO = new PanelUserDAO(); PanelUser panelUser = panelUserDAO.findByPanelAndUserAndStamp(panel, user, panel.getCurrentStamp()); return panelUser == null ? getEveryoneRole() : panelUser.getRole(); } return getEveryoneRole(); } }
public class class_name { private UserRole getPanelRole(User user, Panel panel) { if (panel != null) { PanelUserDAO panelUserDAO = new PanelUserDAO(); PanelUser panelUser = panelUserDAO.findByPanelAndUserAndStamp(panel, user, panel.getCurrentStamp()); return panelUser == null ? getEveryoneRole() : panelUser.getRole(); // depends on control dependency: [if], data = [none] } return getEveryoneRole(); } }
public class class_name { private <J, T extends Proxy<J>> T marshalConstructor(final int opcode, final J implementation, final int version, final Class<T> newProxyCls, final long argsPointer) { try { final long wlProxy = WaylandClientCore.INSTANCE() .wl_proxy_marshal_array_constructor(this.pointer, opcode, argsPointer, InterfaceMeta.get(newProxyCls).pointer.address); return marshalProxy(wlProxy, implementation, version, newProxyCls); } catch (final NoSuchMethodException | IllegalAccessException | InstantiationException | InvocationTargetException e) { throw new RuntimeException("Uh oh, this is a bug!", e); } } }
public class class_name { private <J, T extends Proxy<J>> T marshalConstructor(final int opcode, final J implementation, final int version, final Class<T> newProxyCls, final long argsPointer) { try { final long wlProxy = WaylandClientCore.INSTANCE() .wl_proxy_marshal_array_constructor(this.pointer, opcode, argsPointer, InterfaceMeta.get(newProxyCls).pointer.address); return marshalProxy(wlProxy, implementation, version, newProxyCls); // depends on control dependency: [try], data = [none] } catch (final NoSuchMethodException | IllegalAccessException | InstantiationException | InvocationTargetException e) { throw new RuntimeException("Uh oh, this is a bug!", e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public boolean isChildOf(String label) { if (label == null) return false; else { if (hasParent()) { if (getParent().is(label)) return true; else return getParent().isChildOf(label); } else { return false; } } } }
public class class_name { public boolean isChildOf(String label) { if (label == null) return false; else { if (hasParent()) { if (getParent().is(label)) return true; else return getParent().isChildOf(label); } else { return false; // depends on control dependency: [if], data = [none] } } } }
public class class_name { @Beta // TODO(kevinb): decide best return type public static List<Throwable> getCausalChain(Throwable throwable) { checkNotNull(throwable); List<Throwable> causes = new ArrayList<Throwable>(4); while (throwable != null) { causes.add(throwable); throwable = throwable.getCause(); } return Collections.unmodifiableList(causes); } }
public class class_name { @Beta // TODO(kevinb): decide best return type public static List<Throwable> getCausalChain(Throwable throwable) { checkNotNull(throwable); List<Throwable> causes = new ArrayList<Throwable>(4); while (throwable != null) { causes.add(throwable); // depends on control dependency: [while], data = [(throwable] throwable = throwable.getCause(); // depends on control dependency: [while], data = [none] } return Collections.unmodifiableList(causes); } }
public class class_name { public JsonElement getActualHighWatermark() { if (!contains(ConfigurationKeys.WORK_UNIT_STATE_ACTUAL_HIGH_WATER_MARK_KEY)) { return null; } return JSON_PARSER.parse(getProp(ConfigurationKeys.WORK_UNIT_STATE_ACTUAL_HIGH_WATER_MARK_KEY)); } }
public class class_name { public JsonElement getActualHighWatermark() { if (!contains(ConfigurationKeys.WORK_UNIT_STATE_ACTUAL_HIGH_WATER_MARK_KEY)) { return null; // depends on control dependency: [if], data = [none] } return JSON_PARSER.parse(getProp(ConfigurationKeys.WORK_UNIT_STATE_ACTUAL_HIGH_WATER_MARK_KEY)); } }
public class class_name { @Override public int read () throws IOException { _ensureOpen (); while (true) { if (m_nNextCharIndex >= m_nChars) { _fill (); if (m_nNextCharIndex >= m_nChars) return -1; } if (m_bSkipLF) { m_bSkipLF = false; if (m_aBuf[m_nNextCharIndex] == '\n') { m_nNextCharIndex++; continue; } } return m_aBuf[m_nNextCharIndex++]; } } }
public class class_name { @Override public int read () throws IOException { _ensureOpen (); while (true) { if (m_nNextCharIndex >= m_nChars) { _fill (); // depends on control dependency: [if], data = [none] if (m_nNextCharIndex >= m_nChars) return -1; } if (m_bSkipLF) { m_bSkipLF = false; // depends on control dependency: [if], data = [none] if (m_aBuf[m_nNextCharIndex] == '\n') { m_nNextCharIndex++; // depends on control dependency: [if], data = [none] continue; } } return m_aBuf[m_nNextCharIndex++]; } } }
public class class_name { @Override public long[] validatePartitioning(long[] tableIds, byte[] hashinatorConfig) { ByteBuffer paramBuffer = m_ee.getParamBufferForExecuteTask(4 + (8 * tableIds.length) + 4 + hashinatorConfig.length); paramBuffer.putInt(tableIds.length); for (long tableId : tableIds) { paramBuffer.putLong(tableId); } paramBuffer.put(hashinatorConfig); ByteBuffer resultBuffer = ByteBuffer.wrap(m_ee.executeTask( TaskType.VALIDATE_PARTITIONING, paramBuffer)); long mispartitionedRows[] = new long[tableIds.length]; for (int ii = 0; ii < tableIds.length; ii++) { mispartitionedRows[ii] = resultBuffer.getLong(); } return mispartitionedRows; } }
public class class_name { @Override public long[] validatePartitioning(long[] tableIds, byte[] hashinatorConfig) { ByteBuffer paramBuffer = m_ee.getParamBufferForExecuteTask(4 + (8 * tableIds.length) + 4 + hashinatorConfig.length); paramBuffer.putInt(tableIds.length); for (long tableId : tableIds) { paramBuffer.putLong(tableId); // depends on control dependency: [for], data = [tableId] } paramBuffer.put(hashinatorConfig); ByteBuffer resultBuffer = ByteBuffer.wrap(m_ee.executeTask( TaskType.VALIDATE_PARTITIONING, paramBuffer)); long mispartitionedRows[] = new long[tableIds.length]; for (int ii = 0; ii < tableIds.length; ii++) { mispartitionedRows[ii] = resultBuffer.getLong(); // depends on control dependency: [for], data = [ii] } return mispartitionedRows; } }
public class class_name { private static int[] lookupClasses() { Class<?> annotationMemberArrayClazz; try { annotationFactoryClazz = Class.forName("org.apache.harmony.lang.annotation.AnnotationFactory"); annotationMemberClazz = Class.forName("org.apache.harmony.lang.annotation.AnnotationMember"); annotationMemberArrayClazz = Class.forName("[Lorg.apache.harmony.lang.annotation.AnnotationMember;"); } catch (ClassNotFoundException e) { return null; } Field fieldField; try { elementsField = annotationFactoryClazz.getDeclaredField("elements"); elementsField.setAccessible(true); nameField = annotationMemberClazz.getDeclaredField("name"); nameField.setAccessible(true); valueField = annotationMemberClazz.getDeclaredField("value"); valueField.setAccessible(true); fieldField = DatabaseFieldSample.class.getDeclaredField("field"); } catch (SecurityException e) { return null; } catch (NoSuchFieldException e) { return null; } DatabaseField databaseField = fieldField.getAnnotation(DatabaseField.class); InvocationHandler proxy = Proxy.getInvocationHandler(databaseField); if (proxy.getClass() != annotationFactoryClazz) { return null; } try { // this should be an array of AnnotationMember objects Object elements = elementsField.get(proxy); if (elements == null || elements.getClass() != annotationMemberArrayClazz) { return null; } Object[] elementArray = (Object[]) elements; int[] configNums = new int[elementArray.length]; // build our array of field-numbers that match the AnnotationMember array for (int i = 0; i < elementArray.length; i++) { String name = (String) nameField.get(elementArray[i]); configNums[i] = configFieldNameToNum(name); } return configNums; } catch (IllegalAccessException e) { return null; } } }
public class class_name { private static int[] lookupClasses() { Class<?> annotationMemberArrayClazz; try { annotationFactoryClazz = Class.forName("org.apache.harmony.lang.annotation.AnnotationFactory"); // depends on control dependency: [try], data = [none] annotationMemberClazz = Class.forName("org.apache.harmony.lang.annotation.AnnotationMember"); // depends on control dependency: [try], data = [none] annotationMemberArrayClazz = Class.forName("[Lorg.apache.harmony.lang.annotation.AnnotationMember;"); // depends on control dependency: [try], data = [none] } catch (ClassNotFoundException e) { return null; } // depends on control dependency: [catch], data = [none] Field fieldField; try { elementsField = annotationFactoryClazz.getDeclaredField("elements"); // depends on control dependency: [try], data = [none] elementsField.setAccessible(true); // depends on control dependency: [try], data = [none] nameField = annotationMemberClazz.getDeclaredField("name"); // depends on control dependency: [try], data = [none] nameField.setAccessible(true); // depends on control dependency: [try], data = [none] valueField = annotationMemberClazz.getDeclaredField("value"); // depends on control dependency: [try], data = [none] valueField.setAccessible(true); // depends on control dependency: [try], data = [none] fieldField = DatabaseFieldSample.class.getDeclaredField("field"); // depends on control dependency: [try], data = [none] } catch (SecurityException e) { return null; } catch (NoSuchFieldException e) { // depends on control dependency: [catch], data = [none] return null; } // depends on control dependency: [catch], data = [none] DatabaseField databaseField = fieldField.getAnnotation(DatabaseField.class); InvocationHandler proxy = Proxy.getInvocationHandler(databaseField); if (proxy.getClass() != annotationFactoryClazz) { return null; // depends on control dependency: [if], data = [none] } try { // this should be an array of AnnotationMember objects Object elements = elementsField.get(proxy); if (elements == null || elements.getClass() != annotationMemberArrayClazz) { return null; // depends on control dependency: [if], data = [none] } Object[] elementArray = (Object[]) elements; int[] configNums = new int[elementArray.length]; // build our array of field-numbers that match the AnnotationMember array for (int i = 0; i < elementArray.length; i++) { String name = (String) nameField.get(elementArray[i]); configNums[i] = configFieldNameToNum(name); // depends on control dependency: [for], data = [i] } return configNums; // depends on control dependency: [try], data = [none] } catch (IllegalAccessException e) { return null; } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void addMessageListener(JMessageListener listener) { if (listener == null) return; // Never this.removeDuplicateFilters(listener); // Remove any duplicate record filters if (m_vListenerList == null) m_vListenerList = new Vector<JMessageListener>(); for (int i = 0; i < m_vListenerList.size(); i++) { if (m_vListenerList.get(i) == listener) { Util.getLogger().warning("--------Error-Added message listener twice--------"); return; // I'm sure you didn't mean to do that. } } m_vListenerList.add(listener); listener.addListenerMessageFilter(this); } }
public class class_name { public void addMessageListener(JMessageListener listener) { if (listener == null) return; // Never this.removeDuplicateFilters(listener); // Remove any duplicate record filters if (m_vListenerList == null) m_vListenerList = new Vector<JMessageListener>(); for (int i = 0; i < m_vListenerList.size(); i++) { if (m_vListenerList.get(i) == listener) { Util.getLogger().warning("--------Error-Added message listener twice--------"); // depends on control dependency: [if], data = [none] return; // I'm sure you didn't mean to do that. // depends on control dependency: [if], data = [none] } } m_vListenerList.add(listener); listener.addListenerMessageFilter(this); } }
public class class_name { public List<Double> listAnswers(QueryField queryField) { List<QueryQuestionNumericAnswer> listByQueryField = listByQueryField(queryField); List<Double> results = new ArrayList<>(); for (QueryQuestionNumericAnswer answer : listByQueryField) { results.add(answer.getData()); } return results; } }
public class class_name { public List<Double> listAnswers(QueryField queryField) { List<QueryQuestionNumericAnswer> listByQueryField = listByQueryField(queryField); List<Double> results = new ArrayList<>(); for (QueryQuestionNumericAnswer answer : listByQueryField) { results.add(answer.getData()); // depends on control dependency: [for], data = [answer] } return results; } }
public class class_name { public synchronized boolean validationEnabled() { // enable/disable hostname verification String validate = getGlobalProperty(Constants.SSLPROP_VALIDATION_ENABLED); if (validate != null && (validate.equalsIgnoreCase("true") || validate.equalsIgnoreCase("yes"))) { return true; } return false; } }
public class class_name { public synchronized boolean validationEnabled() { // enable/disable hostname verification String validate = getGlobalProperty(Constants.SSLPROP_VALIDATION_ENABLED); if (validate != null && (validate.equalsIgnoreCase("true") || validate.equalsIgnoreCase("yes"))) { return true; // depends on control dependency: [if], data = [none] } return false; } }
public class class_name { public void addClassReference(final String className, final MetadataElement classReference) { classReference.setRef(getNamespaceValue(classReference.getRef())); for (MetadataItem item : classList) { if (item.getName().equals(className) && item.getNamespace().equals(getCurrentNamespace()) && item.getPackageApi().equals(getCurrentPackageApi())) { item.getReferences().add(classReference); return; } } final MetadataItem newItem = new MetadataItem(className); newItem.getReferences().add(classReference); newItem.setNamespace(getCurrentNamespace()); newItem.setSchemaName(getCurrentSchmema()); newItem.setPackageApi(getCurrentPackageApi()); newItem.setPackageImpl(getCurrentPackageImpl()); classList.add(newItem); } }
public class class_name { public void addClassReference(final String className, final MetadataElement classReference) { classReference.setRef(getNamespaceValue(classReference.getRef())); for (MetadataItem item : classList) { if (item.getName().equals(className) && item.getNamespace().equals(getCurrentNamespace()) && item.getPackageApi().equals(getCurrentPackageApi())) { item.getReferences().add(classReference); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } } final MetadataItem newItem = new MetadataItem(className); newItem.getReferences().add(classReference); newItem.setNamespace(getCurrentNamespace()); newItem.setSchemaName(getCurrentSchmema()); newItem.setPackageApi(getCurrentPackageApi()); newItem.setPackageImpl(getCurrentPackageImpl()); classList.add(newItem); } }
public class class_name { public GetFolderResult withSymbolicLinks(SymbolicLink... symbolicLinks) { if (this.symbolicLinks == null) { setSymbolicLinks(new java.util.ArrayList<SymbolicLink>(symbolicLinks.length)); } for (SymbolicLink ele : symbolicLinks) { this.symbolicLinks.add(ele); } return this; } }
public class class_name { public GetFolderResult withSymbolicLinks(SymbolicLink... symbolicLinks) { if (this.symbolicLinks == null) { setSymbolicLinks(new java.util.ArrayList<SymbolicLink>(symbolicLinks.length)); // depends on control dependency: [if], data = [none] } for (SymbolicLink ele : symbolicLinks) { this.symbolicLinks.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public void hideEnhancedOptions(boolean hide) { if (hide) { addStyleName(I_CmsLayoutBundle.INSTANCE.previewDialogCss().hiding()); } else { removeStyleName(I_CmsLayoutBundle.INSTANCE.previewDialogCss().hiding()); } } }
public class class_name { public void hideEnhancedOptions(boolean hide) { if (hide) { addStyleName(I_CmsLayoutBundle.INSTANCE.previewDialogCss().hiding()); // depends on control dependency: [if], data = [none] } else { removeStyleName(I_CmsLayoutBundle.INSTANCE.previewDialogCss().hiding()); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void setPricingDetails(java.util.Collection<PricingDetail> pricingDetails) { if (pricingDetails == null) { this.pricingDetails = null; return; } this.pricingDetails = new com.amazonaws.internal.SdkInternalList<PricingDetail>(pricingDetails); } }
public class class_name { public void setPricingDetails(java.util.Collection<PricingDetail> pricingDetails) { if (pricingDetails == null) { this.pricingDetails = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.pricingDetails = new com.amazonaws.internal.SdkInternalList<PricingDetail>(pricingDetails); } }
public class class_name { Runnable popLifo () { final long _top = top; final Runnable result = tasks[asArrayindex (_top-1)]; if (result == null) { // The queue is empty. It is possible for the queue to be empty even if the previous unprotected read does not return null, but // it will only ever return null if the queue really is empty: New entries are only added by the owning thread, and this method // 'popLifo()' is also only ever called by the owning thread. return null; } if (! UNSAFE.compareAndSwapObject (tasks, taskOffset (_top-1), result, null)) { // The CAS operation failing means that another thread pulled the top-most item from the queue, so the queue is now definitely // empty. It also null'ed out the task in the array if it was previously available, allowing to to be GC'ed when processing is // finished. return null; } // Since 'result' is not null, and was not previously consumed by another thread, we can safely consume it --> decrement 'top' UNSAFE.putOrderedLong (this, OFFS_TOP, _top-1); return result; } }
public class class_name { Runnable popLifo () { final long _top = top; final Runnable result = tasks[asArrayindex (_top-1)]; if (result == null) { // The queue is empty. It is possible for the queue to be empty even if the previous unprotected read does not return null, but // it will only ever return null if the queue really is empty: New entries are only added by the owning thread, and this method // 'popLifo()' is also only ever called by the owning thread. return null; // depends on control dependency: [if], data = [none] } if (! UNSAFE.compareAndSwapObject (tasks, taskOffset (_top-1), result, null)) { // The CAS operation failing means that another thread pulled the top-most item from the queue, so the queue is now definitely // empty. It also null'ed out the task in the array if it was previously available, allowing to to be GC'ed when processing is // finished. return null; // depends on control dependency: [if], data = [none] } // Since 'result' is not null, and was not previously consumed by another thread, we can safely consume it --> decrement 'top' UNSAFE.putOrderedLong (this, OFFS_TOP, _top-1); return result; } }
public class class_name { public void setEntityDetailsList(java.util.Collection<EntityDetails> entityDetailsList) { if (entityDetailsList == null) { this.entityDetailsList = null; return; } this.entityDetailsList = new com.amazonaws.internal.SdkInternalList<EntityDetails>(entityDetailsList); } }
public class class_name { public void setEntityDetailsList(java.util.Collection<EntityDetails> entityDetailsList) { if (entityDetailsList == null) { this.entityDetailsList = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.entityDetailsList = new com.amazonaws.internal.SdkInternalList<EntityDetails>(entityDetailsList); } }
public class class_name { public String getUriStyleSheet() { if (m_uriStyleSheet == null) { try { if (OpenCms.getWorkplaceManager().getEditorCssHandlers().size() > 0) { // use the configured handlers to determine the CSS to use Iterator<I_CmsEditorCssHandler> i = OpenCms.getWorkplaceManager().getEditorCssHandlers().iterator(); while (i.hasNext()) { I_CmsEditorCssHandler cssHandler = i.next(); if (cssHandler.matches(getCms(), getParamTempfile())) { m_uriStyleSheet = cssHandler.getUriStyleSheet(getCms(), getParamTempfile()); break; } } } else { // for compatibility reasons, read the template property value from the template file to get the CSS String currentTemplate = getUriTemplate(); m_uriStyleSheet = getCms().readPropertyObject( currentTemplate, CmsPropertyDefinition.PROPERTY_TEMPLATE, false).getValue(""); } } catch (CmsException e) { LOG.warn(Messages.get().getBundle().key(Messages.LOG_READ_TEMPLATE_PROP_STYLESHEET_FAILED_0), e); } } return m_uriStyleSheet; } }
public class class_name { public String getUriStyleSheet() { if (m_uriStyleSheet == null) { try { if (OpenCms.getWorkplaceManager().getEditorCssHandlers().size() > 0) { // use the configured handlers to determine the CSS to use Iterator<I_CmsEditorCssHandler> i = OpenCms.getWorkplaceManager().getEditorCssHandlers().iterator(); while (i.hasNext()) { I_CmsEditorCssHandler cssHandler = i.next(); if (cssHandler.matches(getCms(), getParamTempfile())) { m_uriStyleSheet = cssHandler.getUriStyleSheet(getCms(), getParamTempfile()); // depends on control dependency: [if], data = [none] break; } } } else { // for compatibility reasons, read the template property value from the template file to get the CSS String currentTemplate = getUriTemplate(); m_uriStyleSheet = getCms().readPropertyObject( currentTemplate, CmsPropertyDefinition.PROPERTY_TEMPLATE, false).getValue(""); // depends on control dependency: [if], data = [none] } } catch (CmsException e) { LOG.warn(Messages.get().getBundle().key(Messages.LOG_READ_TEMPLATE_PROP_STYLESHEET_FAILED_0), e); } // depends on control dependency: [catch], data = [none] } return m_uriStyleSheet; } }
public class class_name { public static boolean checkMethodSignature(final Method method, final List<WaveItem<?>> wParams) { boolean isCompliant = false; final Type[] mParams = method.getGenericParameterTypes(); if (wParams.isEmpty() && Wave.class.isAssignableFrom(ClassUtility.getClassFromType(mParams[0]))) { isCompliant = true; } else if (mParams.length - 1 == wParams.size()) { // Flag used to skip a method not compliant boolean skipMethod = false; // Check each parameter for (int i = 0; !skipMethod && i < mParams.length - 1 && !isCompliant; i++) { if (!ClassUtility.getClassFromType(mParams[i]).isAssignableFrom(ClassUtility.getClassFromType(wParams.get(i).type()))) { // This method has not the right parameters skipMethod = true; } if (i == mParams.length - 2 && Wave.class.isAssignableFrom(ClassUtility.getClassFromType(mParams[i + 1]))) { // This method is compliant with wave type isCompliant = true; } } } return isCompliant; } }
public class class_name { public static boolean checkMethodSignature(final Method method, final List<WaveItem<?>> wParams) { boolean isCompliant = false; final Type[] mParams = method.getGenericParameterTypes(); if (wParams.isEmpty() && Wave.class.isAssignableFrom(ClassUtility.getClassFromType(mParams[0]))) { isCompliant = true; } else if (mParams.length - 1 == wParams.size()) { // Flag used to skip a method not compliant boolean skipMethod = false; // Check each parameter for (int i = 0; !skipMethod && i < mParams.length - 1 && !isCompliant; i++) { if (!ClassUtility.getClassFromType(mParams[i]).isAssignableFrom(ClassUtility.getClassFromType(wParams.get(i).type()))) { // This method has not the right parameters skipMethod = true; // depends on control dependency: [if], data = [none] } if (i == mParams.length - 2 && Wave.class.isAssignableFrom(ClassUtility.getClassFromType(mParams[i + 1]))) { // This method is compliant with wave type isCompliant = true; // depends on control dependency: [if], data = [none] } } } return isCompliant; } }
public class class_name { public URLNormalizer removeTrailingSlash() { String urlRoot = HttpURL.getRoot(url); String path = toURL().getPath(); String urlRootAndPath = urlRoot + path; if (path.endsWith("/")) { String newPath = StringUtils.removeEnd(path, "/"); String newUrlRootAndPath = urlRoot + newPath; url = StringUtils.replaceOnce( url, urlRootAndPath, newUrlRootAndPath); } return this; } }
public class class_name { public URLNormalizer removeTrailingSlash() { String urlRoot = HttpURL.getRoot(url); String path = toURL().getPath(); String urlRootAndPath = urlRoot + path; if (path.endsWith("/")) { String newPath = StringUtils.removeEnd(path, "/"); String newUrlRootAndPath = urlRoot + newPath; url = StringUtils.replaceOnce( url, urlRootAndPath, newUrlRootAndPath); // depends on control dependency: [if], data = [none] } return this; } }