code stringlengths 130 281k | code_dependency stringlengths 182 306k |
|---|---|
public class class_name {
public static InternationalFixedDate from(TemporalAccessor temporal) {
if (temporal instanceof InternationalFixedDate) {
return (InternationalFixedDate) temporal;
}
return InternationalFixedDate.ofEpochDay(temporal.getLong(ChronoField.EPOCH_DAY));
} } | public class class_name {
public static InternationalFixedDate from(TemporalAccessor temporal) {
if (temporal instanceof InternationalFixedDate) {
return (InternationalFixedDate) temporal; // depends on control dependency: [if], data = [none]
}
return InternationalFixedDate.ofEpochDay(temporal.getLong(ChronoField.EPOCH_DAY));
} } |
public class class_name {
public CloudhopperBuilder port(String... port) {
for (String p : port) {
if (port != null) {
ports.add(p);
}
}
return this;
} } | public class class_name {
public CloudhopperBuilder port(String... port) {
for (String p : port) {
if (port != null) {
ports.add(p); // depends on control dependency: [if], data = [none]
}
}
return this;
} } |
public class class_name {
public final void synpred31_InternalXbase_fragment() throws RecognitionException {
// InternalXbase.g:4199:6: ( ( () ( ( ( ruleJvmFormalParameter ) ) ( ',' ( ( ruleJvmFormalParameter ) ) )* )? ( ( '|' ) ) ) )
// InternalXbase.g:4199:7: ( () ( ( ( ruleJvmFormalParameter ) ) ( ',' ( ( ruleJvmFormalParameter ) ) )* )? ( ( '|' ) ) )
{
// InternalXbase.g:4199:7: ( () ( ( ( ruleJvmFormalParameter ) ) ( ',' ( ( ruleJvmFormalParameter ) ) )* )? ( ( '|' ) ) )
// InternalXbase.g:4200:7: () ( ( ( ruleJvmFormalParameter ) ) ( ',' ( ( ruleJvmFormalParameter ) ) )* )? ( ( '|' ) )
{
// InternalXbase.g:4200:7: ()
// InternalXbase.g:4201:7:
{
}
// InternalXbase.g:4202:7: ( ( ( ruleJvmFormalParameter ) ) ( ',' ( ( ruleJvmFormalParameter ) ) )* )?
int alt120=2;
int LA120_0 = input.LA(1);
if ( (LA120_0==RULE_ID||LA120_0==32||LA120_0==49) ) {
alt120=1;
}
switch (alt120) {
case 1 :
// InternalXbase.g:4203:8: ( ( ruleJvmFormalParameter ) ) ( ',' ( ( ruleJvmFormalParameter ) ) )*
{
// InternalXbase.g:4203:8: ( ( ruleJvmFormalParameter ) )
// InternalXbase.g:4204:9: ( ruleJvmFormalParameter )
{
// InternalXbase.g:4204:9: ( ruleJvmFormalParameter )
// InternalXbase.g:4205:10: ruleJvmFormalParameter
{
pushFollow(FOLLOW_39);
ruleJvmFormalParameter();
state._fsp--;
if (state.failed) return ;
}
}
// InternalXbase.g:4208:8: ( ',' ( ( ruleJvmFormalParameter ) ) )*
loop119:
do {
int alt119=2;
int LA119_0 = input.LA(1);
if ( (LA119_0==48) ) {
alt119=1;
}
switch (alt119) {
case 1 :
// InternalXbase.g:4209:9: ',' ( ( ruleJvmFormalParameter ) )
{
match(input,48,FOLLOW_13); if (state.failed) return ;
// InternalXbase.g:4210:9: ( ( ruleJvmFormalParameter ) )
// InternalXbase.g:4211:10: ( ruleJvmFormalParameter )
{
// InternalXbase.g:4211:10: ( ruleJvmFormalParameter )
// InternalXbase.g:4212:11: ruleJvmFormalParameter
{
pushFollow(FOLLOW_39);
ruleJvmFormalParameter();
state._fsp--;
if (state.failed) return ;
}
}
}
break;
default :
break loop119;
}
} while (true);
}
break;
}
// InternalXbase.g:4217:7: ( ( '|' ) )
// InternalXbase.g:4218:8: ( '|' )
{
// InternalXbase.g:4218:8: ( '|' )
// InternalXbase.g:4219:9: '|'
{
match(input,56,FOLLOW_2); if (state.failed) return ;
}
}
}
}
} } | public class class_name {
public final void synpred31_InternalXbase_fragment() throws RecognitionException {
// InternalXbase.g:4199:6: ( ( () ( ( ( ruleJvmFormalParameter ) ) ( ',' ( ( ruleJvmFormalParameter ) ) )* )? ( ( '|' ) ) ) )
// InternalXbase.g:4199:7: ( () ( ( ( ruleJvmFormalParameter ) ) ( ',' ( ( ruleJvmFormalParameter ) ) )* )? ( ( '|' ) ) )
{
// InternalXbase.g:4199:7: ( () ( ( ( ruleJvmFormalParameter ) ) ( ',' ( ( ruleJvmFormalParameter ) ) )* )? ( ( '|' ) ) )
// InternalXbase.g:4200:7: () ( ( ( ruleJvmFormalParameter ) ) ( ',' ( ( ruleJvmFormalParameter ) ) )* )? ( ( '|' ) )
{
// InternalXbase.g:4200:7: ()
// InternalXbase.g:4201:7:
{
}
// InternalXbase.g:4202:7: ( ( ( ruleJvmFormalParameter ) ) ( ',' ( ( ruleJvmFormalParameter ) ) )* )?
int alt120=2;
int LA120_0 = input.LA(1);
if ( (LA120_0==RULE_ID||LA120_0==32||LA120_0==49) ) {
alt120=1;
}
switch (alt120) {
case 1 :
// InternalXbase.g:4203:8: ( ( ruleJvmFormalParameter ) ) ( ',' ( ( ruleJvmFormalParameter ) ) )*
{
// InternalXbase.g:4203:8: ( ( ruleJvmFormalParameter ) )
// InternalXbase.g:4204:9: ( ruleJvmFormalParameter )
{
// InternalXbase.g:4204:9: ( ruleJvmFormalParameter )
// InternalXbase.g:4205:10: ruleJvmFormalParameter
{
pushFollow(FOLLOW_39);
ruleJvmFormalParameter();
state._fsp--;
if (state.failed) return ;
}
}
// InternalXbase.g:4208:8: ( ',' ( ( ruleJvmFormalParameter ) ) )*
loop119:
do {
int alt119=2;
int LA119_0 = input.LA(1);
if ( (LA119_0==48) ) {
alt119=1; // depends on control dependency: [if], data = [none]
}
switch (alt119) {
case 1 :
// InternalXbase.g:4209:9: ',' ( ( ruleJvmFormalParameter ) )
{
match(input,48,FOLLOW_13); if (state.failed) return ;
// InternalXbase.g:4210:9: ( ( ruleJvmFormalParameter ) )
// InternalXbase.g:4211:10: ( ruleJvmFormalParameter )
{
// InternalXbase.g:4211:10: ( ruleJvmFormalParameter )
// InternalXbase.g:4212:11: ruleJvmFormalParameter
{
pushFollow(FOLLOW_39);
ruleJvmFormalParameter();
state._fsp--;
if (state.failed) return ;
}
}
}
break;
default :
break loop119;
}
} while (true);
}
break;
}
// InternalXbase.g:4217:7: ( ( '|' ) )
// InternalXbase.g:4218:8: ( '|' )
{
// InternalXbase.g:4218:8: ( '|' )
// InternalXbase.g:4219:9: '|'
{
match(input,56,FOLLOW_2); if (state.failed) return ;
}
}
}
}
} } |
public class class_name {
@SuppressWarnings("WeakerAccess")
public synchronized void stop() {
if (isRunning()) {
MetadataFinder.getInstance().removeTrackMetadataListener(metadataListener);
running.set(false);
pendingUpdates.clear();
queueHandler.interrupt();
queueHandler = null;
// Report the loss of our previews, on the proper thread, and outside our lock.
final Set<DeckReference> dyingCache = new HashSet<DeckReference>(hotCache.keySet());
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
for (DeckReference deck : dyingCache) {
if (deck.hotCue == 0) {
deliverBeatGridUpdate(deck.player, null);
}
}
}
});
hotCache.clear();
deliverLifecycleAnnouncement(logger, false);
}
} } | public class class_name {
@SuppressWarnings("WeakerAccess")
public synchronized void stop() {
if (isRunning()) {
MetadataFinder.getInstance().removeTrackMetadataListener(metadataListener); // depends on control dependency: [if], data = [none]
running.set(false); // depends on control dependency: [if], data = [none]
pendingUpdates.clear(); // depends on control dependency: [if], data = [none]
queueHandler.interrupt(); // depends on control dependency: [if], data = [none]
queueHandler = null; // depends on control dependency: [if], data = [none]
// Report the loss of our previews, on the proper thread, and outside our lock.
final Set<DeckReference> dyingCache = new HashSet<DeckReference>(hotCache.keySet());
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
for (DeckReference deck : dyingCache) {
if (deck.hotCue == 0) {
deliverBeatGridUpdate(deck.player, null); // depends on control dependency: [if], data = [none]
}
}
}
}); // depends on control dependency: [if], data = [none]
hotCache.clear(); // depends on control dependency: [if], data = [none]
deliverLifecycleAnnouncement(logger, false); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
protected boolean initiateClient()
{
for (String host : hosts)
{
if (host == null || !StringUtils.isNumeric(port) || port.isEmpty())
{
logger.error("Host or port should not be null / port should be numeric");
throw new IllegalArgumentException("Host or port should not be null / port should be numeric");
}
try
{
client = new KuduClient.KuduClientBuilder(host + ":" + port).build();
}
catch (Exception e)
{
logger.error("Database host cannot be resolved, Caused by: " + e.getMessage());
throw new SchemaGenerationException("Database host cannot be resolved, Caused by: " + e.getMessage());
}
}
return true;
} } | public class class_name {
@Override
protected boolean initiateClient()
{
for (String host : hosts)
{
if (host == null || !StringUtils.isNumeric(port) || port.isEmpty())
{
logger.error("Host or port should not be null / port should be numeric"); // depends on control dependency: [if], data = [none]
throw new IllegalArgumentException("Host or port should not be null / port should be numeric");
}
try
{
client = new KuduClient.KuduClientBuilder(host + ":" + port).build(); // depends on control dependency: [try], data = [none]
}
catch (Exception e)
{
logger.error("Database host cannot be resolved, Caused by: " + e.getMessage());
throw new SchemaGenerationException("Database host cannot be resolved, Caused by: " + e.getMessage());
} // depends on control dependency: [catch], data = [none]
}
return true;
} } |
public class class_name {
public static String encode(byte[] data) {
if (data.length == 0) {
return "";
}
final byte[] bytes = copyOfRange(data, 0, data.length);
// Count leading zeroes.
int zeroCount = 0;
while (zeroCount < bytes.length && bytes[zeroCount] == 0) {
++zeroCount;
}
// The actual encoding.
byte[] temp = new byte[bytes.length * 2];
int j = temp.length;
int startAt = zeroCount;
while (startAt < bytes.length) {
byte mod = divmod58(bytes, startAt);
if (bytes[startAt] == 0) {
++startAt;
}
temp[--j] = (byte) ALPHABET[mod];
}
// Strip extra '1' if there are some after decoding.
while (j < temp.length && temp[j] == ALPHABET[0]) {
++j;
}
// Add as many leading '1' as there were leading zeros.
while (--zeroCount >= 0) {
temp[--j] = (byte) ALPHABET[0];
}
byte[] output = copyOfRange(temp, j, temp.length);
try {
return new String(output, "US-ASCII");
} catch (UnsupportedEncodingException e) {
throw new ApplicationException(e); // Cannot happen.
}
} } | public class class_name {
public static String encode(byte[] data) {
if (data.length == 0) {
return ""; // depends on control dependency: [if], data = [none]
}
final byte[] bytes = copyOfRange(data, 0, data.length);
// Count leading zeroes.
int zeroCount = 0;
while (zeroCount < bytes.length && bytes[zeroCount] == 0) {
++zeroCount; // depends on control dependency: [while], data = [none]
}
// The actual encoding.
byte[] temp = new byte[bytes.length * 2];
int j = temp.length;
int startAt = zeroCount;
while (startAt < bytes.length) {
byte mod = divmod58(bytes, startAt);
if (bytes[startAt] == 0) {
++startAt; // depends on control dependency: [if], data = [none]
}
temp[--j] = (byte) ALPHABET[mod]; // depends on control dependency: [while], data = [none]
}
// Strip extra '1' if there are some after decoding.
while (j < temp.length && temp[j] == ALPHABET[0]) {
++j; // depends on control dependency: [while], data = [none]
}
// Add as many leading '1' as there were leading zeros.
while (--zeroCount >= 0) {
temp[--j] = (byte) ALPHABET[0]; // depends on control dependency: [while], data = [none]
}
byte[] output = copyOfRange(temp, j, temp.length);
try {
return new String(output, "US-ASCII"); // depends on control dependency: [try], data = [none]
} catch (UnsupportedEncodingException e) {
throw new ApplicationException(e); // Cannot happen.
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private String getTableDefinition(Function atom, AliasIndex index, String indent) {
if (atom.isAlgebraFunction()) {
Predicate functionSymbol = atom.getFunctionSymbol();
ImmutableList<Function> joinAtoms = convert(atom.getTerms());
if (functionSymbol.equals(datalogFactory.getSparqlJoinPredicate())) {
// nested joins we need to add parenthesis later
boolean parenthesis = joinAtoms.get(0).isAlgebraFunction()
|| joinAtoms.get(1).isAlgebraFunction();
return getTableDefinitions(joinAtoms, index,
"JOIN", parenthesis, indent + INDENT);
}
else if (functionSymbol.equals(datalogFactory.getSparqlLeftJoinPredicate())) {
// in case of left join we want to add the parenthesis only for the right tables
// we ignore nested joins from the left tables
boolean parenthesis = joinAtoms.get(1).isAlgebraFunction();
return getTableDefinitions(joinAtoms, index,
"LEFT OUTER JOIN", parenthesis, indent + INDENT);
}
}
else if (!atom.isOperation() && !atom.isDataTypeFunction()) {
return index.getViewDefinition(atom); // a database atom
}
return null;
} } | public class class_name {
private String getTableDefinition(Function atom, AliasIndex index, String indent) {
if (atom.isAlgebraFunction()) {
Predicate functionSymbol = atom.getFunctionSymbol();
ImmutableList<Function> joinAtoms = convert(atom.getTerms());
if (functionSymbol.equals(datalogFactory.getSparqlJoinPredicate())) {
// nested joins we need to add parenthesis later
boolean parenthesis = joinAtoms.get(0).isAlgebraFunction()
|| joinAtoms.get(1).isAlgebraFunction();
return getTableDefinitions(joinAtoms, index,
"JOIN", parenthesis, indent + INDENT); // depends on control dependency: [if], data = [none]
}
else if (functionSymbol.equals(datalogFactory.getSparqlLeftJoinPredicate())) {
// in case of left join we want to add the parenthesis only for the right tables
// we ignore nested joins from the left tables
boolean parenthesis = joinAtoms.get(1).isAlgebraFunction();
return getTableDefinitions(joinAtoms, index,
"LEFT OUTER JOIN", parenthesis, indent + INDENT); // depends on control dependency: [if], data = [none]
}
}
else if (!atom.isOperation() && !atom.isDataTypeFunction()) {
return index.getViewDefinition(atom); // a database atom // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
public void setValue(final Object targetObj, final Object value) {
ArgUtils.notNull(targetObj, "targetObj");
if(targetSetter.isPresent()) {
try {
targetSetter.get().invoke(targetObj, value);
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
throw new FieldAccessException(this, "fail setter value", e);
}
} else if(targetField.isPresent()) {
try {
targetField.get().set(targetObj, value);
} catch (IllegalArgumentException | IllegalAccessException e) {
throw new FieldAccessException(this, "fail setter field value", e);
}
} else {
throw new FieldAccessException(this, "not found setter method or field.");
}
} } | public class class_name {
public void setValue(final Object targetObj, final Object value) {
ArgUtils.notNull(targetObj, "targetObj");
if(targetSetter.isPresent()) {
try {
targetSetter.get().invoke(targetObj, value);
// depends on control dependency: [try], data = [none]
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
throw new FieldAccessException(this, "fail setter value", e);
}
// depends on control dependency: [catch], data = [none]
} else if(targetField.isPresent()) {
try {
targetField.get().set(targetObj, value);
// depends on control dependency: [try], data = [none]
} catch (IllegalArgumentException | IllegalAccessException e) {
throw new FieldAccessException(this, "fail setter field value", e);
}
// depends on control dependency: [catch], data = [none]
} else {
throw new FieldAccessException(this, "not found setter method or field.");
}
} } |
public class class_name {
public AnnotationValueBuilder<T> member(String name, int... ints) {
if (ints != null) {
values.put(name, ints);
}
return this;
} } | public class class_name {
public AnnotationValueBuilder<T> member(String name, int... ints) {
if (ints != null) {
values.put(name, ints); // depends on control dependency: [if], data = [none]
}
return this;
} } |
public class class_name {
@Override
public void onValueUnRestricted(final String value) {
this.restrictedColumns.remove(value);
// Check single column used in data set -> it cannot be unselected.
if (listEditor.getList().size() == 1) {
setEditorEnabled(0 ,false, DataSetEditorConstants.INSTANCE.dataSetMustHaveAtLeastOneColumn());
} else {
setEditorEnabled(value, true, null);
}
} } | public class class_name {
@Override
public void onValueUnRestricted(final String value) {
this.restrictedColumns.remove(value);
// Check single column used in data set -> it cannot be unselected.
if (listEditor.getList().size() == 1) {
setEditorEnabled(0 ,false, DataSetEditorConstants.INSTANCE.dataSetMustHaveAtLeastOneColumn()); // depends on control dependency: [if], data = [none]
} else {
setEditorEnabled(value, true, null); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private static Field tryGetFieldWithoutExp(Class<?> clazz, String itemName) {
try {
return clazz.getDeclaredField(itemName);
} catch (Exception e) {
return null;
}
} } | public class class_name {
private static Field tryGetFieldWithoutExp(Class<?> clazz, String itemName) {
try {
return clazz.getDeclaredField(itemName); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
return null;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void setDividerPadding(float padding, final Axis axis) {
if (!equal(mDividerPadding.get(axis), padding)) {
mDividerPadding.set(padding, axis);
if (mContainer != null) {
mContainer.onLayoutChanged(this);
}
}
} } | public class class_name {
public void setDividerPadding(float padding, final Axis axis) {
if (!equal(mDividerPadding.get(axis), padding)) {
mDividerPadding.set(padding, axis); // depends on control dependency: [if], data = [none]
if (mContainer != null) {
mContainer.onLayoutChanged(this); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public void marshall(PolicyVersion policyVersion, ProtocolMarshaller protocolMarshaller) {
if (policyVersion == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(policyVersion.getVersionId(), VERSIONID_BINDING);
protocolMarshaller.marshall(policyVersion.getIsDefaultVersion(), ISDEFAULTVERSION_BINDING);
protocolMarshaller.marshall(policyVersion.getCreateDate(), CREATEDATE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(PolicyVersion policyVersion, ProtocolMarshaller protocolMarshaller) {
if (policyVersion == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(policyVersion.getVersionId(), VERSIONID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(policyVersion.getIsDefaultVersion(), ISDEFAULTVERSION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(policyVersion.getCreateDate(), CREATEDATE_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 {
static Namespace parseUnknown(List<String> unknown) {
Map<String, Object> attrs = new HashMap<>();
String attr = null;
for (String arg : unknown) {
if (arg.startsWith("--")) {
int splitIndex = arg.indexOf('=');
if (splitIndex == -1) {
attr = arg.substring(2);
} else {
attrs.put(arg.substring(2, splitIndex), arg.substring(splitIndex + 1));
attr = null;
}
} else if (attr != null) {
attrs.put(attr, arg);
attr = null;
}
}
return new Namespace(attrs);
} } | public class class_name {
static Namespace parseUnknown(List<String> unknown) {
Map<String, Object> attrs = new HashMap<>();
String attr = null;
for (String arg : unknown) {
if (arg.startsWith("--")) {
int splitIndex = arg.indexOf('=');
if (splitIndex == -1) {
attr = arg.substring(2); // depends on control dependency: [if], data = [none]
} else {
attrs.put(arg.substring(2, splitIndex), arg.substring(splitIndex + 1)); // depends on control dependency: [if], data = [(splitIndex]
attr = null; // depends on control dependency: [if], data = [none]
}
} else if (attr != null) {
attrs.put(attr, arg); // depends on control dependency: [if], data = [(attr]
attr = null; // depends on control dependency: [if], data = [none]
}
}
return new Namespace(attrs);
} } |
public class class_name {
@Override
public RandomVariable getVolatility(int timeIndex, int liborIndex) {
// Create a very simple volatility model here
double time = getTimeDiscretization().getTime(timeIndex);
double maturity = getLiborPeriodDiscretization().getTime(liborIndex);
double timeToMaturity = maturity-time;
double volatilityInstanteaneous;
if(timeToMaturity <= 0)
{
volatilityInstanteaneous = 0; // This forward rate is already fixed, no volatility
}
else
{
volatilityInstanteaneous = a * Math.exp(-b * timeToMaturity);
}
return new RandomVariable(getTimeDiscretization().getTime(timeIndex), volatilityInstanteaneous);
} } | public class class_name {
@Override
public RandomVariable getVolatility(int timeIndex, int liborIndex) {
// Create a very simple volatility model here
double time = getTimeDiscretization().getTime(timeIndex);
double maturity = getLiborPeriodDiscretization().getTime(liborIndex);
double timeToMaturity = maturity-time;
double volatilityInstanteaneous;
if(timeToMaturity <= 0)
{
volatilityInstanteaneous = 0; // This forward rate is already fixed, no volatility // depends on control dependency: [if], data = [none]
}
else
{
volatilityInstanteaneous = a * Math.exp(-b * timeToMaturity); // depends on control dependency: [if], data = [none]
}
return new RandomVariable(getTimeDiscretization().getTime(timeIndex), volatilityInstanteaneous);
} } |
public class class_name {
private void convertAudits() {
// Only do this if ADMID values were found in the object.
if (m_dsADMIDs.size() > 0) {
// Look at datastreams to see if there are audit records for them.
// NOTE: we do not look at disseminators because in pre-2.0
// the disseminators did not point to their audit records as
// did the datastreams.
Iterator<String> dsIdIter = m_obj.datastreamIdIterator();
while (dsIdIter.hasNext()) {
for (Datastream ds : m_obj.datastreams(dsIdIter.next())) {
// ADMID processing...
// get list of ADMIDs that go with a datastream version
List<String> admIdList = m_dsADMIDs.get(ds.DSVersionID);
List<String> cleanAdmIdList = new ArrayList<String>();
if (admIdList != null) {
Iterator<String> admIdIter = admIdList.iterator();
while (admIdIter.hasNext()) {
String admId = admIdIter.next();
// Detect ADMIDs that reference audit records
// vs. regular admin metadata. Drop audits from
// the list. We know we have an audit if the ADMID
// is not a regular datatream in the object.
Iterator<Datastream> matchedDatastreams =
m_obj.datastreams(admId).iterator();
if (matchedDatastreams.hasNext()) {
// Keep track of audit metadata correlated with the
// datastream version it's about (for later use).
m_AuditIdToComponentId.put(admId,
ds.DSVersionID);
} else {
// Keep track of non-audit metadata in a new list.
cleanAdmIdList.add(admId);
}
}
}
if (cleanAdmIdList.size() <= 0) {
// we keep track of admin metadata references
// for each datastream, but we exclude the audit
// records from this list. If there are no
// non-audit metadata references, remove the
// datastream entry from the master hashmap.
m_dsADMIDs.remove(ds.DSVersionID);
} else {
// otherwise, update the master hashmap with the
// clean list of non-audit metadata
m_dsADMIDs.put(ds.DSVersionID, cleanAdmIdList);
}
}
}
// Now, put component ids on audit records. Pre-Fedora 2.0
// datastream versions pointed to their audit records.
Iterator<AuditRecord> iter = m_obj.getAuditRecords().iterator();
while (iter.hasNext()) {
AuditRecord au = iter.next();
if (au.componentID == null || au.componentID.isEmpty()) {
// Before Fedora 2.0 audit records were associated with
// datastream version ids. From now on, the datastream id
// will be posted as the component id in the audit record,
// and associations to particular datastream versions can
// be derived via the datastream version dates and the audit
// record dates.
String dsVersId = m_AuditIdToComponentId.get(au.id);
if (dsVersId != null && !dsVersId.isEmpty()) {
au.componentID =
dsVersId.substring(0, dsVersId.indexOf("."));
}
}
}
}
} } | public class class_name {
private void convertAudits() {
// Only do this if ADMID values were found in the object.
if (m_dsADMIDs.size() > 0) {
// Look at datastreams to see if there are audit records for them.
// NOTE: we do not look at disseminators because in pre-2.0
// the disseminators did not point to their audit records as
// did the datastreams.
Iterator<String> dsIdIter = m_obj.datastreamIdIterator();
while (dsIdIter.hasNext()) {
for (Datastream ds : m_obj.datastreams(dsIdIter.next())) {
// ADMID processing...
// get list of ADMIDs that go with a datastream version
List<String> admIdList = m_dsADMIDs.get(ds.DSVersionID);
List<String> cleanAdmIdList = new ArrayList<String>();
if (admIdList != null) {
Iterator<String> admIdIter = admIdList.iterator();
while (admIdIter.hasNext()) {
String admId = admIdIter.next();
// Detect ADMIDs that reference audit records
// vs. regular admin metadata. Drop audits from
// the list. We know we have an audit if the ADMID
// is not a regular datatream in the object.
Iterator<Datastream> matchedDatastreams =
m_obj.datastreams(admId).iterator();
if (matchedDatastreams.hasNext()) {
// Keep track of audit metadata correlated with the
// datastream version it's about (for later use).
m_AuditIdToComponentId.put(admId,
ds.DSVersionID); // depends on control dependency: [if], data = [none]
} else {
// Keep track of non-audit metadata in a new list.
cleanAdmIdList.add(admId); // depends on control dependency: [if], data = [none]
}
}
}
if (cleanAdmIdList.size() <= 0) {
// we keep track of admin metadata references
// for each datastream, but we exclude the audit
// records from this list. If there are no
// non-audit metadata references, remove the
// datastream entry from the master hashmap.
m_dsADMIDs.remove(ds.DSVersionID); // depends on control dependency: [if], data = [none]
} else {
// otherwise, update the master hashmap with the
// clean list of non-audit metadata
m_dsADMIDs.put(ds.DSVersionID, cleanAdmIdList); // depends on control dependency: [if], data = [none]
}
}
}
// Now, put component ids on audit records. Pre-Fedora 2.0
// datastream versions pointed to their audit records.
Iterator<AuditRecord> iter = m_obj.getAuditRecords().iterator();
while (iter.hasNext()) {
AuditRecord au = iter.next();
if (au.componentID == null || au.componentID.isEmpty()) {
// Before Fedora 2.0 audit records were associated with
// datastream version ids. From now on, the datastream id
// will be posted as the component id in the audit record,
// and associations to particular datastream versions can
// be derived via the datastream version dates and the audit
// record dates.
String dsVersId = m_AuditIdToComponentId.get(au.id);
if (dsVersId != null && !dsVersId.isEmpty()) {
au.componentID =
dsVersId.substring(0, dsVersId.indexOf(".")); // depends on control dependency: [if], data = [none]
}
}
}
}
} } |
public class class_name {
public static void write(CharSequence content, File file, String encoding) {
OutputStream os = null;
try {
os = new FileOutputStream(file);
PrintWriter printWriter = new PrintWriter(new OutputStreamWriter(os, encoding));
printWriter.print(content);
printWriter.flush();
os.flush();
} catch (IOException e) {
throw E.unexpected(e);
} finally {
close(os);
}
} } | public class class_name {
public static void write(CharSequence content, File file, String encoding) {
OutputStream os = null;
try {
os = new FileOutputStream(file); // depends on control dependency: [try], data = [none]
PrintWriter printWriter = new PrintWriter(new OutputStreamWriter(os, encoding));
printWriter.print(content); // depends on control dependency: [try], data = [none]
printWriter.flush(); // depends on control dependency: [try], data = [none]
os.flush(); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
throw E.unexpected(e);
} finally { // depends on control dependency: [catch], data = [none]
close(os);
}
} } |
public class class_name {
public static Object callMethod(Context cx, Scriptable obj,
String methodName,
Object[] args)
{
Object funObj = getProperty(obj, methodName);
if (!(funObj instanceof Function)) {
throw ScriptRuntime.notFunctionError(obj, methodName);
}
Function fun = (Function)funObj;
// XXX: What should be the scope when calling funObj?
// The following favor scope stored in the object on the assumption
// that is more useful especially under dynamic scope setup.
// An alternative is to check for dynamic scope flag
// and use ScriptableObject.getTopLevelScope(fun) if the flag is not
// set. But that require access to Context and messy code
// so for now it is not checked.
Scriptable scope = ScriptableObject.getTopLevelScope(obj);
if (cx != null) {
return fun.call(cx, scope, obj, args);
}
return Context.call(null, fun, scope, obj, args);
} } | public class class_name {
public static Object callMethod(Context cx, Scriptable obj,
String methodName,
Object[] args)
{
Object funObj = getProperty(obj, methodName);
if (!(funObj instanceof Function)) {
throw ScriptRuntime.notFunctionError(obj, methodName);
}
Function fun = (Function)funObj;
// XXX: What should be the scope when calling funObj?
// The following favor scope stored in the object on the assumption
// that is more useful especially under dynamic scope setup.
// An alternative is to check for dynamic scope flag
// and use ScriptableObject.getTopLevelScope(fun) if the flag is not
// set. But that require access to Context and messy code
// so for now it is not checked.
Scriptable scope = ScriptableObject.getTopLevelScope(obj);
if (cx != null) {
return fun.call(cx, scope, obj, args); // depends on control dependency: [if], data = [(cx]
}
return Context.call(null, fun, scope, obj, args);
} } |
public class class_name {
@Override
public EClass getIfcStructuralLoadSingleForceWarping() {
if (ifcStructuralLoadSingleForceWarpingEClass == null) {
ifcStructuralLoadSingleForceWarpingEClass = (EClass) EPackage.Registry.INSTANCE
.getEPackage(Ifc4Package.eNS_URI).getEClassifiers().get(650);
}
return ifcStructuralLoadSingleForceWarpingEClass;
} } | public class class_name {
@Override
public EClass getIfcStructuralLoadSingleForceWarping() {
if (ifcStructuralLoadSingleForceWarpingEClass == null) {
ifcStructuralLoadSingleForceWarpingEClass = (EClass) EPackage.Registry.INSTANCE
.getEPackage(Ifc4Package.eNS_URI).getEClassifiers().get(650);
// depends on control dependency: [if], data = [none]
}
return ifcStructuralLoadSingleForceWarpingEClass;
} } |
public class class_name {
private void removeFromServerContextBindingMap(String bindingName,
boolean explicit)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "removeFromServerContextBindingMap : " + bindingName +
", explicit : " + explicit);
// Re-wrote method to account for explict and implicit bindings. d457053.1
BindingData bdata = ivServerContextBindingMap.get(bindingName);
if (bdata != null)
{
if (explicit)
{
if (ivHomeRecord.j2eeName.equals(bdata.ivExplicitBean))
{
bdata.ivExplicitBean = null;
bdata.ivExplicitInterface = null;
}
else
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "removeFromServerContextBindingMap : " +
"ERROR : explicit binding for different bean : " +
bdata.ivExplicitBean);
}
}
else
{
if (bdata.ivImplicitBeans != null)
{
bdata.ivImplicitBeans.remove(ivHomeRecord.j2eeName);
if (bdata.ivImplicitBeans.size() == 0)
{
bdata.ivImplicitBeans = null;
}
}
else
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "removeFromServerContextBindingMap : " +
"ERROR : no implicit binding");
}
}
if (bdata.ivExplicitBean == null &&
bdata.ivImplicitBeans == null)
{
ivServerContextBindingMap.remove(bindingName);
}
}
else
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "removeFromServerContextBindingMap : " +
"ERROR : no binding data");
}
} } | public class class_name {
private void removeFromServerContextBindingMap(String bindingName,
boolean explicit)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "removeFromServerContextBindingMap : " + bindingName +
", explicit : " + explicit);
// Re-wrote method to account for explict and implicit bindings. d457053.1
BindingData bdata = ivServerContextBindingMap.get(bindingName);
if (bdata != null)
{
if (explicit)
{
if (ivHomeRecord.j2eeName.equals(bdata.ivExplicitBean))
{
bdata.ivExplicitBean = null; // depends on control dependency: [if], data = [none]
bdata.ivExplicitInterface = null; // depends on control dependency: [if], data = [none]
}
else
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "removeFromServerContextBindingMap : " +
"ERROR : explicit binding for different bean : " +
bdata.ivExplicitBean);
}
}
else
{
if (bdata.ivImplicitBeans != null)
{
bdata.ivImplicitBeans.remove(ivHomeRecord.j2eeName); // depends on control dependency: [if], data = [none]
if (bdata.ivImplicitBeans.size() == 0)
{
bdata.ivImplicitBeans = null; // depends on control dependency: [if], data = [none]
}
}
else
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "removeFromServerContextBindingMap : " +
"ERROR : no implicit binding");
}
}
if (bdata.ivExplicitBean == null &&
bdata.ivImplicitBeans == null)
{
ivServerContextBindingMap.remove(bindingName); // depends on control dependency: [if], data = [none]
}
}
else
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "removeFromServerContextBindingMap : " +
"ERROR : no binding data");
}
} } |
public class class_name {
private String processExpression(String expressionString) {
expressionString = expressionString == null ? "" : expressionString.trim();
if (expressionString.isEmpty()) {
if (isAttributeBinding(currentAttribute)) {
logger.error(
"Empty expression in template property binding. If you want to pass an empty string then simply don't use binding: my-attribute=\"\"",
currentAttribute.toString());
} else if (isEventBinding(currentAttribute)) {
logger.error("Empty expression in template event binding.",
currentAttribute.toString());
} else {
return "";
}
}
if (expressionString.startsWith("{")) {
logger.error(
"Object literal syntax are not supported yet in Vue GWT, please use map(e(\"key1\", myValue), e(\"key2\", myValue2 > 5)...) instead. The object returned by map() is a regular Javascript Object (JsObject) with the given key/values.",
expressionString);
}
if (expressionString.startsWith("[")) {
logger.error(
"Array literal syntax are not supported yet in Vue GWT, please use array(myValue, myValue2 > 5...) instead. The object returned by array() is a regular Javascript Array (JsArray) with the given values.",
expressionString);
}
if (shouldSkipExpressionProcessing(expressionString)) {
return expressionString;
}
return processJavaExpression(expressionString).toTemplateString();
} } | public class class_name {
private String processExpression(String expressionString) {
expressionString = expressionString == null ? "" : expressionString.trim();
if (expressionString.isEmpty()) {
if (isAttributeBinding(currentAttribute)) {
logger.error(
"Empty expression in template property binding. If you want to pass an empty string then simply don't use binding: my-attribute=\"\"",
currentAttribute.toString()); // depends on control dependency: [if], data = [none]
} else if (isEventBinding(currentAttribute)) {
logger.error("Empty expression in template event binding.",
currentAttribute.toString()); // depends on control dependency: [if], data = [none]
} else {
return ""; // depends on control dependency: [if], data = [none]
}
}
if (expressionString.startsWith("{")) {
logger.error(
"Object literal syntax are not supported yet in Vue GWT, please use map(e(\"key1\", myValue), e(\"key2\", myValue2 > 5)...) instead. The object returned by map() is a regular Javascript Object (JsObject) with the given key/values.",
expressionString); // depends on control dependency: [if], data = [none]
}
if (expressionString.startsWith("[")) {
logger.error(
"Array literal syntax are not supported yet in Vue GWT, please use array(myValue, myValue2 > 5...) instead. The object returned by array() is a regular Javascript Array (JsArray) with the given values.",
expressionString); // depends on control dependency: [if], data = [none]
}
if (shouldSkipExpressionProcessing(expressionString)) {
return expressionString; // depends on control dependency: [if], data = [none]
}
return processJavaExpression(expressionString).toTemplateString();
} } |
public class class_name {
public static <T extends ImageBase<T>> ImageDistort<T,T>
rectifyImage(CameraPinholeBrown param, FMatrixRMaj rectify , BorderType borderType, ImageType<T> imageType)
{
boolean skip = borderType == BorderType.SKIP;
if( skip ) {
borderType = BorderType.EXTENDED;
}
InterpolatePixel<T> interp =
FactoryInterpolation.createPixel(0,255, InterpolationType.BILINEAR,borderType,imageType);
// only compute the transform once
ImageDistort<T,T> ret = FactoryDistort.distort(true, interp, imageType);
ret.setRenderAll(!skip);
Point2Transform2_F32 transform = transformRectToPixel(param, rectify);
ret.setModel(new PointToPixelTransform_F32(transform));
return ret;
} } | public class class_name {
public static <T extends ImageBase<T>> ImageDistort<T,T>
rectifyImage(CameraPinholeBrown param, FMatrixRMaj rectify , BorderType borderType, ImageType<T> imageType)
{
boolean skip = borderType == BorderType.SKIP;
if( skip ) {
borderType = BorderType.EXTENDED; // depends on control dependency: [if], data = [none]
}
InterpolatePixel<T> interp =
FactoryInterpolation.createPixel(0,255, InterpolationType.BILINEAR,borderType,imageType);
// only compute the transform once
ImageDistort<T,T> ret = FactoryDistort.distort(true, interp, imageType);
ret.setRenderAll(!skip);
Point2Transform2_F32 transform = transformRectToPixel(param, rectify);
ret.setModel(new PointToPixelTransform_F32(transform));
return ret;
} } |
public class class_name {
public int lengthOf(String value) {
int length = 0;
if (value != null) {
length = value.length();
}
return length;
} } | public class class_name {
public int lengthOf(String value) {
int length = 0;
if (value != null) {
length = value.length(); // depends on control dependency: [if], data = [none]
}
return length;
} } |
public class class_name {
public void marshall(DatabaseInput databaseInput, ProtocolMarshaller protocolMarshaller) {
if (databaseInput == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(databaseInput.getName(), NAME_BINDING);
protocolMarshaller.marshall(databaseInput.getDescription(), DESCRIPTION_BINDING);
protocolMarshaller.marshall(databaseInput.getLocationUri(), LOCATIONURI_BINDING);
protocolMarshaller.marshall(databaseInput.getParameters(), PARAMETERS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(DatabaseInput databaseInput, ProtocolMarshaller protocolMarshaller) {
if (databaseInput == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(databaseInput.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(databaseInput.getDescription(), DESCRIPTION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(databaseInput.getLocationUri(), LOCATIONURI_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(databaseInput.getParameters(), PARAMETERS_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 List<HttpRequestBase> parseJobCallbackProperties(final Props props,
final JobCallbackStatusEnum status, final Map<String, String> contextInfo,
final int maxNumCallback, final Logger privateLogger) {
String callbackUrl = null;
if (!isThereJobCallbackProperty(props, status)) {
// short circuit
return Collections.emptyList();
}
final List<HttpRequestBase> result = new ArrayList<>();
// replace property templates with status
final String jobCallBackUrlKey =
replaceStatusToken(JOB_CALLBACK_URL_TEMPLATE, status);
final String requestMethod =
replaceStatusToken(JOB_CALLBACK_REQUEST_METHOD_TEMPLATE, status);
final String httpBodyKey = replaceStatusToken(JOB_CALLBACK_BODY_TEMPLATE, status);
final String headersKey =
replaceStatusToken(JOB_CALLBACK_REQUEST_HEADERS_TEMPLATE, status);
for (int sequence = 1; sequence <= maxNumCallback; sequence++) {
HttpRequestBase httpRequest = null;
final String sequenceStr = Integer.toString(sequence);
// callback url
final String callbackUrlKey =
jobCallBackUrlKey.replace(SEQUENCE_TOKEN, sequenceStr);
callbackUrl = props.get(callbackUrlKey);
if (callbackUrl == null || callbackUrl.length() == 0) {
// no more needs to done
break;
} else {
final String callbackUrlWithTokenReplaced =
replaceTokens(callbackUrl, contextInfo, true);
final String requestMethodKey =
requestMethod.replace(SEQUENCE_TOKEN, sequenceStr);
final String method = props.getString(requestMethodKey, HTTP_GET);
if (HTTP_POST.equals(method)) {
final String postBodyKey = httpBodyKey.replace(SEQUENCE_TOKEN, sequenceStr);
final String httpBodyValue = props.get(postBodyKey);
if (httpBodyValue == null) {
// missing body for POST, not good
// update the wiki about skipping callback url if body is missing
privateLogger.warn("Missing value for key: " + postBodyKey
+ " skipping job callback '" + callbackUrl + " for job "
+ contextInfo.get(CONTEXT_JOB_TOKEN));
} else {
// put together an URL
final HttpPost httpPost = new HttpPost(callbackUrlWithTokenReplaced);
final String postActualBody =
replaceTokens(httpBodyValue, contextInfo, false);
privateLogger.info("postActualBody: " + postActualBody);
httpPost.setEntity(createStringEntity(postActualBody));
httpRequest = httpPost;
}
} else if (HTTP_GET.equals(method)) {
// GET
httpRequest = new HttpGet(callbackUrlWithTokenReplaced);
} else {
privateLogger.warn("Unsupported request method: " + method
+ ". Only POST and GET are supported");
}
final String headersKeyPerSequence =
headersKey.replace(SEQUENCE_TOKEN, sequenceStr);
final String headersValue = props.get(headersKeyPerSequence);
privateLogger.info("headers: " + headersValue);
final Header[] headers = parseHttpHeaders(headersValue);
if (headers != null) {
httpRequest.setHeaders(headers);
privateLogger.info("# of headers found: " + headers.length);
}
result.add(httpRequest);
}
}
return result;
} } | public class class_name {
public static List<HttpRequestBase> parseJobCallbackProperties(final Props props,
final JobCallbackStatusEnum status, final Map<String, String> contextInfo,
final int maxNumCallback, final Logger privateLogger) {
String callbackUrl = null;
if (!isThereJobCallbackProperty(props, status)) {
// short circuit
return Collections.emptyList(); // depends on control dependency: [if], data = [none]
}
final List<HttpRequestBase> result = new ArrayList<>();
// replace property templates with status
final String jobCallBackUrlKey =
replaceStatusToken(JOB_CALLBACK_URL_TEMPLATE, status);
final String requestMethod =
replaceStatusToken(JOB_CALLBACK_REQUEST_METHOD_TEMPLATE, status);
final String httpBodyKey = replaceStatusToken(JOB_CALLBACK_BODY_TEMPLATE, status);
final String headersKey =
replaceStatusToken(JOB_CALLBACK_REQUEST_HEADERS_TEMPLATE, status);
for (int sequence = 1; sequence <= maxNumCallback; sequence++) {
HttpRequestBase httpRequest = null;
final String sequenceStr = Integer.toString(sequence);
// callback url
final String callbackUrlKey =
jobCallBackUrlKey.replace(SEQUENCE_TOKEN, sequenceStr);
callbackUrl = props.get(callbackUrlKey);
if (callbackUrl == null || callbackUrl.length() == 0) {
// no more needs to done
break;
} else {
final String callbackUrlWithTokenReplaced =
replaceTokens(callbackUrl, contextInfo, true);
final String requestMethodKey =
requestMethod.replace(SEQUENCE_TOKEN, sequenceStr);
final String method = props.getString(requestMethodKey, HTTP_GET);
if (HTTP_POST.equals(method)) {
final String postBodyKey = httpBodyKey.replace(SEQUENCE_TOKEN, sequenceStr);
final String httpBodyValue = props.get(postBodyKey);
if (httpBodyValue == null) {
// missing body for POST, not good
// update the wiki about skipping callback url if body is missing
privateLogger.warn("Missing value for key: " + postBodyKey
+ " skipping job callback '" + callbackUrl + " for job "
+ contextInfo.get(CONTEXT_JOB_TOKEN)); // depends on control dependency: [if], data = [none]
} else {
// put together an URL
final HttpPost httpPost = new HttpPost(callbackUrlWithTokenReplaced);
final String postActualBody =
replaceTokens(httpBodyValue, contextInfo, false);
privateLogger.info("postActualBody: " + postActualBody); // depends on control dependency: [if], data = [none]
httpPost.setEntity(createStringEntity(postActualBody)); // depends on control dependency: [if], data = [none]
httpRequest = httpPost; // depends on control dependency: [if], data = [none]
}
} else if (HTTP_GET.equals(method)) {
// GET
httpRequest = new HttpGet(callbackUrlWithTokenReplaced);
} else {
privateLogger.warn("Unsupported request method: " + method
+ ". Only POST and GET are supported");
}
final String headersKeyPerSequence =
headersKey.replace(SEQUENCE_TOKEN, sequenceStr);
final String headersValue = props.get(headersKeyPerSequence);
privateLogger.info("headers: " + headersValue);
final Header[] headers = parseHttpHeaders(headersValue);
if (headers != null) {
httpRequest.setHeaders(headers);
privateLogger.info("# of headers found: " + headers.length);
}
result.add(httpRequest);
}
}
return result;
} } |
public class class_name {
public static String validate(String zahl) {
try {
return Geldbetrag.valueOf(zahl).toString();
} catch (IllegalArgumentException ex) {
throw new InvalidValueException(zahl, "money_amount", ex);
}
} } | public class class_name {
public static String validate(String zahl) {
try {
return Geldbetrag.valueOf(zahl).toString(); // depends on control dependency: [try], data = [none]
} catch (IllegalArgumentException ex) {
throw new InvalidValueException(zahl, "money_amount", ex);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public String get(final String aMessage, final File... aFileArray) {
final String[] details = new String[aFileArray.length];
for (int index = 0; index < details.length; index++) {
details[index] = aFileArray[index].getAbsolutePath();
}
LOGGER.debug(MessageCodes.UTIL_026, aMessage, details);
return StringUtils.format(super.getString(aMessage), details);
} } | public class class_name {
public String get(final String aMessage, final File... aFileArray) {
final String[] details = new String[aFileArray.length];
for (int index = 0; index < details.length; index++) {
details[index] = aFileArray[index].getAbsolutePath(); // depends on control dependency: [for], data = [index]
}
LOGGER.debug(MessageCodes.UTIL_026, aMessage, details);
return StringUtils.format(super.getString(aMessage), details);
} } |
public class class_name {
protected Boolean isOverWritingInherited(int flags) {
if ((flags & CmsAccessControlEntry.ACCESS_FLAGS_OVERWRITE) > 0) {
return Boolean.TRUE;
}
return Boolean.FALSE;
} } | public class class_name {
protected Boolean isOverWritingInherited(int flags) {
if ((flags & CmsAccessControlEntry.ACCESS_FLAGS_OVERWRITE) > 0) {
return Boolean.TRUE; // depends on control dependency: [if], data = [none]
}
return Boolean.FALSE;
} } |
public class class_name {
private List<XMLFilter> getProcessingPipe(final URI fileToParse) {
final List<XMLFilter> pipe = new ArrayList<>();
if (forceUnique) {
forceUniqueFilter = new ForceUniqueFilter();
forceUniqueFilter.setLogger(logger);
forceUniqueFilter.setJob(job);
forceUniqueFilter.setCurrentFile(fileToParse);
forceUniqueFilter.setTempFileNameScheme(tempFileNameScheme);
pipe.add(forceUniqueFilter);
}
reader.setJob(job);
reader.setLogger(logger);
reader.setCurrentFile(fileToParse);
pipe.add(reader);
return pipe;
} } | public class class_name {
private List<XMLFilter> getProcessingPipe(final URI fileToParse) {
final List<XMLFilter> pipe = new ArrayList<>();
if (forceUnique) {
forceUniqueFilter = new ForceUniqueFilter(); // depends on control dependency: [if], data = [none]
forceUniqueFilter.setLogger(logger); // depends on control dependency: [if], data = [none]
forceUniqueFilter.setJob(job); // depends on control dependency: [if], data = [none]
forceUniqueFilter.setCurrentFile(fileToParse); // depends on control dependency: [if], data = [none]
forceUniqueFilter.setTempFileNameScheme(tempFileNameScheme); // depends on control dependency: [if], data = [none]
pipe.add(forceUniqueFilter); // depends on control dependency: [if], data = [none]
}
reader.setJob(job);
reader.setLogger(logger);
reader.setCurrentFile(fileToParse);
pipe.add(reader);
return pipe;
} } |
public class class_name {
protected void loadDefaultConfigurations() {
if (JK.getURL(DEFAULT_LABLES_FILE_NAME) != null) {
logger.debug("Load default lables from : " + DEFAULT_LABLES_FILE_NAME);
addLables(JKIOUtil.readPropertiesFile(DEFAULT_LABLES_FILE_NAME));
}
} } | public class class_name {
protected void loadDefaultConfigurations() {
if (JK.getURL(DEFAULT_LABLES_FILE_NAME) != null) {
logger.debug("Load default lables from : " + DEFAULT_LABLES_FILE_NAME);
// depends on control dependency: [if], data = [none]
addLables(JKIOUtil.readPropertiesFile(DEFAULT_LABLES_FILE_NAME));
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void garbageCollection() {
// number of tiles to remove from cache
int toBeRemoved = Integer.MAX_VALUE; // MAX_VALUE for stressed memory case
final int size = mCachedTiles.size();
if (!mStressedMemory) {
toBeRemoved = size - mCapacity;
if (toBeRemoved <= 0) {
return;
}
}
refreshAdditionalLists();
if (mAutoEnsureCapacity) {
final int target = mMapTileArea.size() + mAdditionalMapTileList.size();
if (ensureCapacity(target)) {
if (!mStressedMemory) {
toBeRemoved = size - mCapacity;
if (toBeRemoved <= 0) {
return;
}
}
}
}
populateSyncCachedTiles(mGC);
for (int i = 0; i < mGC.getSize() ; i ++) {
final long index = mGC.get(i);
if (shouldKeepTile(index)) {
continue;
}
remove(index);
if (-- toBeRemoved == 0) {
break;
};
}
} } | public class class_name {
public void garbageCollection() {
// number of tiles to remove from cache
int toBeRemoved = Integer.MAX_VALUE; // MAX_VALUE for stressed memory case
final int size = mCachedTiles.size();
if (!mStressedMemory) {
toBeRemoved = size - mCapacity; // depends on control dependency: [if], data = [none]
if (toBeRemoved <= 0) {
return; // depends on control dependency: [if], data = [none]
}
}
refreshAdditionalLists();
if (mAutoEnsureCapacity) {
final int target = mMapTileArea.size() + mAdditionalMapTileList.size();
if (ensureCapacity(target)) {
if (!mStressedMemory) {
toBeRemoved = size - mCapacity; // depends on control dependency: [if], data = [none]
if (toBeRemoved <= 0) {
return; // depends on control dependency: [if], data = [none]
}
}
}
}
populateSyncCachedTiles(mGC);
for (int i = 0; i < mGC.getSize() ; i ++) {
final long index = mGC.get(i);
if (shouldKeepTile(index)) {
continue;
}
remove(index); // depends on control dependency: [for], data = [none]
if (-- toBeRemoved == 0) {
break;
};
}
} } |
public class class_name {
public final boolean onActivityResult(Activity currentActivity, int requestCode, int resultCode, Intent data) {
Validate.notNull(currentActivity, "currentActivity");
initializeStaticContext(currentActivity);
synchronized (lock) {
if (pendingAuthorizationRequest == null || (requestCode != pendingAuthorizationRequest.getRequestCode())) {
return false;
}
}
Exception exception = null;
AuthorizationClient.Result.Code code = AuthorizationClient.Result.Code.ERROR;
if (data != null) {
AuthorizationClient.Result result = (AuthorizationClient.Result) data.getSerializableExtra(
LoginActivity.RESULT_KEY);
if (result != null) {
// This came from LoginActivity.
handleAuthorizationResult(resultCode, result);
return true;
} else if (authorizationClient != null) {
// Delegate to the auth client.
authorizationClient.onActivityResult(requestCode, resultCode, data);
return true;
}
} else if (resultCode == Activity.RESULT_CANCELED) {
exception = new FacebookOperationCanceledException("User canceled operation.");
code = AuthorizationClient.Result.Code.CANCEL;
}
if (exception == null) {
exception = new FacebookException("Unexpected call to Session.onActivityResult");
}
logAuthorizationComplete(code, null, exception);
finishAuthOrReauth(null, exception);
return true;
} } | public class class_name {
public final boolean onActivityResult(Activity currentActivity, int requestCode, int resultCode, Intent data) {
Validate.notNull(currentActivity, "currentActivity");
initializeStaticContext(currentActivity);
synchronized (lock) {
if (pendingAuthorizationRequest == null || (requestCode != pendingAuthorizationRequest.getRequestCode())) {
return false; // depends on control dependency: [if], data = [none]
}
}
Exception exception = null;
AuthorizationClient.Result.Code code = AuthorizationClient.Result.Code.ERROR;
if (data != null) {
AuthorizationClient.Result result = (AuthorizationClient.Result) data.getSerializableExtra(
LoginActivity.RESULT_KEY);
if (result != null) {
// This came from LoginActivity.
handleAuthorizationResult(resultCode, result); // depends on control dependency: [if], data = [(result]
return true; // depends on control dependency: [if], data = [none]
} else if (authorizationClient != null) {
// Delegate to the auth client.
authorizationClient.onActivityResult(requestCode, resultCode, data); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
} else if (resultCode == Activity.RESULT_CANCELED) {
exception = new FacebookOperationCanceledException("User canceled operation."); // depends on control dependency: [if], data = [none]
code = AuthorizationClient.Result.Code.CANCEL; // depends on control dependency: [if], data = [none]
}
if (exception == null) {
exception = new FacebookException("Unexpected call to Session.onActivityResult"); // depends on control dependency: [if], data = [none]
}
logAuthorizationComplete(code, null, exception);
finishAuthOrReauth(null, exception);
return true;
} } |
public class class_name {
public static String prettyMethodSignature(ClassSymbol origin, MethodSymbol m) {
StringBuilder sb = new StringBuilder();
if (m.isConstructor()) {
Name name = m.owner.enclClass().getSimpleName();
if (name.isEmpty()) {
// use the superclass name of anonymous classes
name = m.owner.enclClass().getSuperclass().asElement().getSimpleName();
}
sb.append(name);
} else {
if (!m.owner.equals(origin)) {
sb.append(m.owner.getSimpleName()).append('.');
}
sb.append(m.getSimpleName());
}
sb.append(
m.getParameters().stream()
.map(v -> v.type.accept(PRETTY_TYPE_VISITOR, null))
.collect(joining(", ", "(", ")")));
return sb.toString();
} } | public class class_name {
public static String prettyMethodSignature(ClassSymbol origin, MethodSymbol m) {
StringBuilder sb = new StringBuilder();
if (m.isConstructor()) {
Name name = m.owner.enclClass().getSimpleName();
if (name.isEmpty()) {
// use the superclass name of anonymous classes
name = m.owner.enclClass().getSuperclass().asElement().getSimpleName(); // depends on control dependency: [if], data = [none]
}
sb.append(name); // depends on control dependency: [if], data = [none]
} else {
if (!m.owner.equals(origin)) {
sb.append(m.owner.getSimpleName()).append('.'); // depends on control dependency: [if], data = [none]
}
sb.append(m.getSimpleName()); // depends on control dependency: [if], data = [none]
}
sb.append(
m.getParameters().stream()
.map(v -> v.type.accept(PRETTY_TYPE_VISITOR, null))
.collect(joining(", ", "(", ")")));
return sb.toString();
} } |
public class class_name {
public static KeyStroke fromString(String keyStr) {
String keyStrLC = keyStr.toLowerCase();
KeyStroke k;
if (keyStr.length() == 1) {
k = new KeyStroke(KeyType.Character, keyStr.charAt(0), false, false, false);
} else if (keyStr.startsWith("<") && keyStr.endsWith(">")) {
if (keyStrLC.equals("<s-tab>")) {
k = new KeyStroke(KeyType.ReverseTab);
} else if (keyStr.contains("-")) {
ArrayList<String> segments = new ArrayList<String>(Arrays.asList(keyStr.substring(1, keyStr.length() - 1).split("-")));
if (segments.size() < 2) {
throw new IllegalArgumentException("Invalid vim notation: " + keyStr);
}
String characterStr = segments.remove(segments.size() - 1);
boolean altPressed = false;
boolean ctrlPressed = false;
for (String modifier : segments) {
if ("c".equals(modifier.toLowerCase())) {
ctrlPressed = true;
} else if ("a".equals(modifier.toLowerCase())) {
altPressed = true;
} else if ("s".equals(modifier.toLowerCase())) {
characterStr = characterStr.toUpperCase();
}
}
k = new KeyStroke(characterStr.charAt(0), ctrlPressed, altPressed);
} else {
if (keyStrLC.startsWith("<esc")) {
k = new KeyStroke(KeyType.Escape);
} else if (keyStrLC.equals("<cr>") || keyStrLC.equals("<enter>") || keyStrLC.equals("<return>")) {
k = new KeyStroke(KeyType.Enter);
} else if (keyStrLC.equals("<bs>")) {
k = new KeyStroke(KeyType.Backspace);
} else if (keyStrLC.equals("<tab>")) {
k = new KeyStroke(KeyType.Tab);
} else if (keyStrLC.equals("<space>")) {
k = new KeyStroke(' ', false, false);
} else if (keyStrLC.equals("<up>")) {
k = new KeyStroke(KeyType.ArrowUp);
} else if (keyStrLC.equals("<down>")) {
k = new KeyStroke(KeyType.ArrowDown);
} else if (keyStrLC.equals("<left>")) {
k = new KeyStroke(KeyType.ArrowLeft);
} else if (keyStrLC.equals("<right>")) {
k = new KeyStroke(KeyType.ArrowRight);
} else if (keyStrLC.equals("<insert>")) {
k = new KeyStroke(KeyType.Insert);
} else if (keyStrLC.equals("<del>")) {
k = new KeyStroke(KeyType.Delete);
} else if (keyStrLC.equals("<home>")) {
k = new KeyStroke(KeyType.Home);
} else if (keyStrLC.equals("<end>")) {
k = new KeyStroke(KeyType.End);
} else if (keyStrLC.equals("<pageup>")) {
k = new KeyStroke(KeyType.PageUp);
} else if (keyStrLC.equals("<pagedown>")) {
k = new KeyStroke(KeyType.PageDown);
} else if (keyStrLC.equals("<f1>")) {
k = new KeyStroke(KeyType.F1);
} else if (keyStrLC.equals("<f2>")) {
k = new KeyStroke(KeyType.F2);
} else if (keyStrLC.equals("<f3>")) {
k = new KeyStroke(KeyType.F3);
} else if (keyStrLC.equals("<f4>")) {
k = new KeyStroke(KeyType.F4);
} else if (keyStrLC.equals("<f5>")) {
k = new KeyStroke(KeyType.F5);
} else if (keyStrLC.equals("<f6>")) {
k = new KeyStroke(KeyType.F6);
} else if (keyStrLC.equals("<f7>")) {
k = new KeyStroke(KeyType.F7);
} else if (keyStrLC.equals("<f8>")) {
k = new KeyStroke(KeyType.F8);
} else if (keyStrLC.equals("<f9>")) {
k = new KeyStroke(KeyType.F9);
} else if (keyStrLC.equals("<f10>")) {
k = new KeyStroke(KeyType.F10);
} else if (keyStrLC.equals("<f11>")) {
k = new KeyStroke(KeyType.F11);
} else if (keyStrLC.equals("<f12>")) {
k = new KeyStroke(KeyType.F12);
} else {
throw new IllegalArgumentException("Invalid vim notation: " + keyStr);
}
}
} else {
throw new IllegalArgumentException("Invalid vim notation: " + keyStr);
}
return k;
} } | public class class_name {
public static KeyStroke fromString(String keyStr) {
String keyStrLC = keyStr.toLowerCase();
KeyStroke k;
if (keyStr.length() == 1) {
k = new KeyStroke(KeyType.Character, keyStr.charAt(0), false, false, false); // depends on control dependency: [if], data = [none]
} else if (keyStr.startsWith("<") && keyStr.endsWith(">")) {
if (keyStrLC.equals("<s-tab>")) {
k = new KeyStroke(KeyType.ReverseTab); // depends on control dependency: [if], data = [none]
} else if (keyStr.contains("-")) {
ArrayList<String> segments = new ArrayList<String>(Arrays.asList(keyStr.substring(1, keyStr.length() - 1).split("-")));
if (segments.size() < 2) {
throw new IllegalArgumentException("Invalid vim notation: " + keyStr);
}
String characterStr = segments.remove(segments.size() - 1);
boolean altPressed = false;
boolean ctrlPressed = false;
for (String modifier : segments) {
if ("c".equals(modifier.toLowerCase())) {
ctrlPressed = true; // depends on control dependency: [if], data = [none]
} else if ("a".equals(modifier.toLowerCase())) {
altPressed = true; // depends on control dependency: [if], data = [none]
} else if ("s".equals(modifier.toLowerCase())) {
characterStr = characterStr.toUpperCase(); // depends on control dependency: [if], data = [none]
}
}
k = new KeyStroke(characterStr.charAt(0), ctrlPressed, altPressed); // depends on control dependency: [if], data = [none]
} else {
if (keyStrLC.startsWith("<esc")) {
k = new KeyStroke(KeyType.Escape); // depends on control dependency: [if], data = [none]
} else if (keyStrLC.equals("<cr>") || keyStrLC.equals("<enter>") || keyStrLC.equals("<return>")) {
k = new KeyStroke(KeyType.Enter); // depends on control dependency: [if], data = [none]
} else if (keyStrLC.equals("<bs>")) {
k = new KeyStroke(KeyType.Backspace); // depends on control dependency: [if], data = [none]
} else if (keyStrLC.equals("<tab>")) {
k = new KeyStroke(KeyType.Tab); // depends on control dependency: [if], data = [none]
} else if (keyStrLC.equals("<space>")) {
k = new KeyStroke(' ', false, false); // depends on control dependency: [if], data = [none]
} else if (keyStrLC.equals("<up>")) {
k = new KeyStroke(KeyType.ArrowUp); // depends on control dependency: [if], data = [none]
} else if (keyStrLC.equals("<down>")) {
k = new KeyStroke(KeyType.ArrowDown); // depends on control dependency: [if], data = [none]
} else if (keyStrLC.equals("<left>")) {
k = new KeyStroke(KeyType.ArrowLeft); // depends on control dependency: [if], data = [none]
} else if (keyStrLC.equals("<right>")) {
k = new KeyStroke(KeyType.ArrowRight); // depends on control dependency: [if], data = [none]
} else if (keyStrLC.equals("<insert>")) {
k = new KeyStroke(KeyType.Insert); // depends on control dependency: [if], data = [none]
} else if (keyStrLC.equals("<del>")) {
k = new KeyStroke(KeyType.Delete); // depends on control dependency: [if], data = [none]
} else if (keyStrLC.equals("<home>")) {
k = new KeyStroke(KeyType.Home); // depends on control dependency: [if], data = [none]
} else if (keyStrLC.equals("<end>")) {
k = new KeyStroke(KeyType.End); // depends on control dependency: [if], data = [none]
} else if (keyStrLC.equals("<pageup>")) {
k = new KeyStroke(KeyType.PageUp); // depends on control dependency: [if], data = [none]
} else if (keyStrLC.equals("<pagedown>")) {
k = new KeyStroke(KeyType.PageDown); // depends on control dependency: [if], data = [none]
} else if (keyStrLC.equals("<f1>")) {
k = new KeyStroke(KeyType.F1); // depends on control dependency: [if], data = [none]
} else if (keyStrLC.equals("<f2>")) {
k = new KeyStroke(KeyType.F2); // depends on control dependency: [if], data = [none]
} else if (keyStrLC.equals("<f3>")) {
k = new KeyStroke(KeyType.F3); // depends on control dependency: [if], data = [none]
} else if (keyStrLC.equals("<f4>")) {
k = new KeyStroke(KeyType.F4); // depends on control dependency: [if], data = [none]
} else if (keyStrLC.equals("<f5>")) {
k = new KeyStroke(KeyType.F5); // depends on control dependency: [if], data = [none]
} else if (keyStrLC.equals("<f6>")) {
k = new KeyStroke(KeyType.F6); // depends on control dependency: [if], data = [none]
} else if (keyStrLC.equals("<f7>")) {
k = new KeyStroke(KeyType.F7); // depends on control dependency: [if], data = [none]
} else if (keyStrLC.equals("<f8>")) {
k = new KeyStroke(KeyType.F8); // depends on control dependency: [if], data = [none]
} else if (keyStrLC.equals("<f9>")) {
k = new KeyStroke(KeyType.F9); // depends on control dependency: [if], data = [none]
} else if (keyStrLC.equals("<f10>")) {
k = new KeyStroke(KeyType.F10); // depends on control dependency: [if], data = [none]
} else if (keyStrLC.equals("<f11>")) {
k = new KeyStroke(KeyType.F11); // depends on control dependency: [if], data = [none]
} else if (keyStrLC.equals("<f12>")) {
k = new KeyStroke(KeyType.F12); // depends on control dependency: [if], data = [none]
} else {
throw new IllegalArgumentException("Invalid vim notation: " + keyStr);
}
}
} else {
throw new IllegalArgumentException("Invalid vim notation: " + keyStr);
}
return k;
} } |
public class class_name {
public PatchRuleGroup withPatchRules(PatchRule... patchRules) {
if (this.patchRules == null) {
setPatchRules(new com.amazonaws.internal.SdkInternalList<PatchRule>(patchRules.length));
}
for (PatchRule ele : patchRules) {
this.patchRules.add(ele);
}
return this;
} } | public class class_name {
public PatchRuleGroup withPatchRules(PatchRule... patchRules) {
if (this.patchRules == null) {
setPatchRules(new com.amazonaws.internal.SdkInternalList<PatchRule>(patchRules.length)); // depends on control dependency: [if], data = [none]
}
for (PatchRule ele : patchRules) {
this.patchRules.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
private PVPanel createVisualization(final ProtovisWidget graphWidget) {
final PVPanel vis = graphWidget.getPVPanel()
.width(400)
.height(30)
.margin(20)
.left(100) // translate(_,y)
.top(
new JsDoubleFunction() {
public double f(JsArgs args) {
PVMark _this = args.getThis();
return 10 + _this.index() * 60; // translate(x,_)
}
}
);
PVBulletLayout bullet = vis.add(PV.Layout.Bullet()).orient(LEFT)
.ranges(new JsFunction<JsArrayNumber>() {
public JsArrayNumber f(JsArgs args) {
Bullet d = args.getObject();
return JsUtils.toJsArrayNumber(d.ranges);
}
}).measures(new JsFunction<JsArrayNumber>() {
public JsArrayNumber f(JsArgs args) {
Bullet d = args.getObject();
return JsUtils.toJsArrayNumber(d.measures);
}
}).markers(new JsFunction<JsArrayNumber>() {
public JsArrayNumber f(JsArgs args) {
Bullet d = args.getObject();
return JsUtils.toJsArrayNumber(d.markers);
}
});
// workaround for right hand side labels
graphWidget.addAttachHandler(new AttachEvent.Handler() {
@Override
public void onAttachOrDetach(AttachEvent event) {
if(event.isAttached()) {
Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() {
@Override
public void execute() {
Element svg = graphWidget.getElement().getFirstChildElement();
if (svg != null) {
svg.setAttribute("overflow", "visible");
}
}
});
}
}
});
bullet.strokeStyle("#CFCFCF");
bullet.lineWidth(0.9);
bullet.range().add(PV.Bar).fillStyle("#ffffff");
bullet.measure().add(PV.Bar).fillStyle("#666666");
bullet.marker().add(PV.Dot).shape(PVShape.TRIANGLE).fillStyle("white");
bullet.tick().add(PV.Rule)
.strokeStyle("#CFCFCF")
.anchor(BOTTOM)
.add(PV.Label)
.text(bullet.x().tickFormat());
// title
bullet.anchor(LEFT).add(PV.Label).font("12px sans-serif")
.textAlign(RIGHT).textBaseline(BOTTOM)
.text(new JsStringFunction() {
public String f(JsArgs args) {
Bullet d = args.getObject(0);
return d.title;
}
});
// subtitle
bullet.anchor(LEFT).add(PV.Label).textStyle("#616161").textAlign(RIGHT)
.textBaseline(TOP).text(new JsStringFunction() {
public String f(JsArgs args) {
Bullet d = args.getObject(0);
return d.subtitle;
}
});
// scale
bullet.anchor(RIGHT)
.add(PV.Label)
.textStyle("#616161")
.textAlign(LEFT)
.textBaseline(MIDDLE)
.text(new JsStringFunction() {
public String f(JsArgs args) {
Bullet d = args.getObject(0);
double measures = d.measures[0];
return measures > 0.00 ? String.valueOf(Double.valueOf(d.ranges[0]).longValue()) : "";
}
});
return vis;
} } | public class class_name {
private PVPanel createVisualization(final ProtovisWidget graphWidget) {
final PVPanel vis = graphWidget.getPVPanel()
.width(400)
.height(30)
.margin(20)
.left(100) // translate(_,y)
.top(
new JsDoubleFunction() {
public double f(JsArgs args) {
PVMark _this = args.getThis();
return 10 + _this.index() * 60; // translate(x,_)
}
}
);
PVBulletLayout bullet = vis.add(PV.Layout.Bullet()).orient(LEFT)
.ranges(new JsFunction<JsArrayNumber>() {
public JsArrayNumber f(JsArgs args) {
Bullet d = args.getObject();
return JsUtils.toJsArrayNumber(d.ranges);
}
}).measures(new JsFunction<JsArrayNumber>() {
public JsArrayNumber f(JsArgs args) {
Bullet d = args.getObject();
return JsUtils.toJsArrayNumber(d.measures);
}
}).markers(new JsFunction<JsArrayNumber>() {
public JsArrayNumber f(JsArgs args) {
Bullet d = args.getObject();
return JsUtils.toJsArrayNumber(d.markers);
}
});
// workaround for right hand side labels
graphWidget.addAttachHandler(new AttachEvent.Handler() {
@Override
public void onAttachOrDetach(AttachEvent event) {
if(event.isAttached()) {
Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() {
@Override
public void execute() {
Element svg = graphWidget.getElement().getFirstChildElement();
if (svg != null) {
svg.setAttribute("overflow", "visible"); // depends on control dependency: [if], data = [none]
}
}
}); // depends on control dependency: [if], data = [none]
}
}
});
bullet.strokeStyle("#CFCFCF");
bullet.lineWidth(0.9);
bullet.range().add(PV.Bar).fillStyle("#ffffff");
bullet.measure().add(PV.Bar).fillStyle("#666666");
bullet.marker().add(PV.Dot).shape(PVShape.TRIANGLE).fillStyle("white");
bullet.tick().add(PV.Rule)
.strokeStyle("#CFCFCF")
.anchor(BOTTOM)
.add(PV.Label)
.text(bullet.x().tickFormat());
// title
bullet.anchor(LEFT).add(PV.Label).font("12px sans-serif")
.textAlign(RIGHT).textBaseline(BOTTOM)
.text(new JsStringFunction() {
public String f(JsArgs args) {
Bullet d = args.getObject(0);
return d.title;
}
});
// subtitle
bullet.anchor(LEFT).add(PV.Label).textStyle("#616161").textAlign(RIGHT)
.textBaseline(TOP).text(new JsStringFunction() {
public String f(JsArgs args) {
Bullet d = args.getObject(0);
return d.subtitle;
}
});
// scale
bullet.anchor(RIGHT)
.add(PV.Label)
.textStyle("#616161")
.textAlign(LEFT)
.textBaseline(MIDDLE)
.text(new JsStringFunction() {
public String f(JsArgs args) {
Bullet d = args.getObject(0);
double measures = d.measures[0];
return measures > 0.00 ? String.valueOf(Double.valueOf(d.ranges[0]).longValue()) : "";
}
});
return vis;
} } |
public class class_name {
public INDArray inferVector(LabelledDocument document, double learningRate, double minLearningRate,
int iterations) {
if (document.getReferencedContent() != null && !document.getReferencedContent().isEmpty()) {
return inferVector(document.getReferencedContent(), learningRate, minLearningRate, iterations);
} else
return inferVector(document.getContent(), learningRate, minLearningRate, iterations);
} } | public class class_name {
public INDArray inferVector(LabelledDocument document, double learningRate, double minLearningRate,
int iterations) {
if (document.getReferencedContent() != null && !document.getReferencedContent().isEmpty()) {
return inferVector(document.getReferencedContent(), learningRate, minLearningRate, iterations); // depends on control dependency: [if], data = [(document.getReferencedContent()]
} else
return inferVector(document.getContent(), learningRate, minLearningRate, iterations);
} } |
public class class_name {
public static NumberFormat getNumberFormat(final Element element) {
if (XMLTags.FORMAT.equals(element.getName())) {
return createNumberFormat(element);
}
Element child = element.getChild(XMLTags.FORMAT);
if (child != null) {
return createNumberFormat(child);
}
return getNumberFormat(element.getParentElement());
} } | public class class_name {
public static NumberFormat getNumberFormat(final Element element) {
if (XMLTags.FORMAT.equals(element.getName())) {
return createNumberFormat(element);
// depends on control dependency: [if], data = [none]
}
Element child = element.getChild(XMLTags.FORMAT);
if (child != null) {
return createNumberFormat(child);
// depends on control dependency: [if], data = [(child]
}
return getNumberFormat(element.getParentElement());
} } |
public class class_name {
public void marshall(UpdateServerRequest updateServerRequest, ProtocolMarshaller protocolMarshaller) {
if (updateServerRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(updateServerRequest.getDisableAutomatedBackup(), DISABLEAUTOMATEDBACKUP_BINDING);
protocolMarshaller.marshall(updateServerRequest.getBackupRetentionCount(), BACKUPRETENTIONCOUNT_BINDING);
protocolMarshaller.marshall(updateServerRequest.getServerName(), SERVERNAME_BINDING);
protocolMarshaller.marshall(updateServerRequest.getPreferredMaintenanceWindow(), PREFERREDMAINTENANCEWINDOW_BINDING);
protocolMarshaller.marshall(updateServerRequest.getPreferredBackupWindow(), PREFERREDBACKUPWINDOW_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(UpdateServerRequest updateServerRequest, ProtocolMarshaller protocolMarshaller) {
if (updateServerRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(updateServerRequest.getDisableAutomatedBackup(), DISABLEAUTOMATEDBACKUP_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateServerRequest.getBackupRetentionCount(), BACKUPRETENTIONCOUNT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateServerRequest.getServerName(), SERVERNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateServerRequest.getPreferredMaintenanceWindow(), PREFERREDMAINTENANCEWINDOW_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateServerRequest.getPreferredBackupWindow(), PREFERREDBACKUPWINDOW_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 void pack(ZipEntrySource[] entries, File zip) {
if (log.isDebugEnabled()) {
log.debug("Creating '{}' from {}.", zip, Arrays.asList(entries));
}
OutputStream out = null;
try {
out = new BufferedOutputStream(new FileOutputStream(zip));
pack(entries, out, true);
}
catch (IOException e) {
throw ZipExceptionUtil.rethrow(e);
}
finally {
IOUtils.closeQuietly(out);
}
} } | public class class_name {
public static void pack(ZipEntrySource[] entries, File zip) {
if (log.isDebugEnabled()) {
log.debug("Creating '{}' from {}.", zip, Arrays.asList(entries)); // depends on control dependency: [if], data = [none]
}
OutputStream out = null;
try {
out = new BufferedOutputStream(new FileOutputStream(zip)); // depends on control dependency: [try], data = [none]
pack(entries, out, true); // depends on control dependency: [try], data = [none]
}
catch (IOException e) {
throw ZipExceptionUtil.rethrow(e);
} // depends on control dependency: [catch], data = [none]
finally {
IOUtils.closeQuietly(out);
}
} } |
public class class_name {
private static Map<Object, Object> getAllFieldsByClassIntern (Class<?> pvClass, Map<Object, Object> pvFieldsMap) {
putAllFieldsIntern( pvClass.getFields(), pvFieldsMap) ;
putAllFieldsIntern( pvClass.getDeclaredFields(), pvFieldsMap);
if (!(pvClass.getSuperclass().equals(Object.class))) {
getAllFieldsByClassIntern(pvClass.getSuperclass(), pvFieldsMap);
}
return pvFieldsMap;
} } | public class class_name {
private static Map<Object, Object> getAllFieldsByClassIntern (Class<?> pvClass, Map<Object, Object> pvFieldsMap) {
putAllFieldsIntern( pvClass.getFields(), pvFieldsMap) ;
putAllFieldsIntern( pvClass.getDeclaredFields(), pvFieldsMap);
if (!(pvClass.getSuperclass().equals(Object.class))) {
getAllFieldsByClassIntern(pvClass.getSuperclass(), pvFieldsMap);
// depends on control dependency: [if], data = [none]
}
return pvFieldsMap;
} } |
public class class_name {
@Deprecated
public CursorIterator<T> iterate(final Txn<T> txn, final T key,
final IteratorType type) {
if (SHOULD_CHECK) {
requireNonNull(type);
}
final KeyRange<T> range;
if (type == FORWARD) {
range = key == null ? all() : atLeast(key);
} else {
range = key == null ? allBackward() : atLeastBackward(key);
}
return iterate(txn, range);
} } | public class class_name {
@Deprecated
public CursorIterator<T> iterate(final Txn<T> txn, final T key,
final IteratorType type) {
if (SHOULD_CHECK) {
requireNonNull(type); // depends on control dependency: [if], data = [none]
}
final KeyRange<T> range;
if (type == FORWARD) {
range = key == null ? all() : atLeast(key); // depends on control dependency: [if], data = [none]
} else {
range = key == null ? allBackward() : atLeastBackward(key); // depends on control dependency: [if], data = [none]
}
return iterate(txn, range);
} } |
public class class_name {
public Apptentive.DateTime getTimeAtInstallTotal() {
// Simply return the first item's timestamp, if there is one.
if (versionHistoryItems.size() > 0) {
return new Apptentive.DateTime(versionHistoryItems.get(0).getTimestamp());
}
return new Apptentive.DateTime(Util.currentTimeSeconds());
} } | public class class_name {
public Apptentive.DateTime getTimeAtInstallTotal() {
// Simply return the first item's timestamp, if there is one.
if (versionHistoryItems.size() > 0) {
return new Apptentive.DateTime(versionHistoryItems.get(0).getTimestamp()); // depends on control dependency: [if], data = [0)]
}
return new Apptentive.DateTime(Util.currentTimeSeconds());
} } |
public class class_name {
@Override
public boolean isCDIEnabled(String bdaId) {
boolean hasBeans = false;
//the top level isCDIEnabled can fail faster
if (isCDIEnabled()) {
Boolean hasBeansBoolean = cdiStatusMap.get(bdaId);
if (hasBeansBoolean == null) {
WebSphereBeanDeploymentArchive bda = deploymentDBAs.get(bdaId);
if (bda == null) {
// turns out that JAXWS create modules dynamically at runtime. That should be the only way
// that there is no bda for a valid module/bda id. At the moment, CDI is not supported in
// a module unless it exists at startup.
hasBeans = false;
} else {
hasBeans = isCDIEnabled(bda);
}
} else {
hasBeans = hasBeansBoolean;
}
}
return hasBeans;
} } | public class class_name {
@Override
public boolean isCDIEnabled(String bdaId) {
boolean hasBeans = false;
//the top level isCDIEnabled can fail faster
if (isCDIEnabled()) {
Boolean hasBeansBoolean = cdiStatusMap.get(bdaId);
if (hasBeansBoolean == null) {
WebSphereBeanDeploymentArchive bda = deploymentDBAs.get(bdaId);
if (bda == null) {
// turns out that JAXWS create modules dynamically at runtime. That should be the only way
// that there is no bda for a valid module/bda id. At the moment, CDI is not supported in
// a module unless it exists at startup.
hasBeans = false; // depends on control dependency: [if], data = [none]
} else {
hasBeans = isCDIEnabled(bda); // depends on control dependency: [if], data = [(bda]
}
} else {
hasBeans = hasBeansBoolean; // depends on control dependency: [if], data = [none]
}
}
return hasBeans;
} } |
public class class_name {
private void readMessage() throws IOException {
while (true) {
if (closed) throw new IOException("closed");
if (frameLength > 0) {
source.readFully(messageFrameBuffer, frameLength);
if (!isClient) {
messageFrameBuffer.readAndWriteUnsafe(maskCursor);
maskCursor.seek(messageFrameBuffer.size() - frameLength);
toggleMask(maskCursor, maskKey);
maskCursor.close();
}
}
if (isFinalFrame) break; // We are exhausted and have no continuations.
readUntilNonControlFrame();
if (opcode != OPCODE_CONTINUATION) {
throw new ProtocolException("Expected continuation opcode. Got: " + toHexString(opcode));
}
}
} } | public class class_name {
private void readMessage() throws IOException {
while (true) {
if (closed) throw new IOException("closed");
if (frameLength > 0) {
source.readFully(messageFrameBuffer, frameLength); // depends on control dependency: [if], data = [none]
if (!isClient) {
messageFrameBuffer.readAndWriteUnsafe(maskCursor); // depends on control dependency: [if], data = [none]
maskCursor.seek(messageFrameBuffer.size() - frameLength); // depends on control dependency: [if], data = [none]
toggleMask(maskCursor, maskKey); // depends on control dependency: [if], data = [none]
maskCursor.close(); // depends on control dependency: [if], data = [none]
}
}
if (isFinalFrame) break; // We are exhausted and have no continuations.
readUntilNonControlFrame();
if (opcode != OPCODE_CONTINUATION) {
throw new ProtocolException("Expected continuation opcode. Got: " + toHexString(opcode));
}
}
} } |
public class class_name {
private BudgetSummary getBudgetSummary(BudgetSummaryDto budgetSummaryData) {
BudgetSummary budgetSummary = BudgetSummary.Factory.newInstance();
SummaryDataType summaryPersonnel = SummaryDataType.Factory.newInstance();
SummaryDataType summarySeniorKey = SummaryDataType.Factory.newInstance();
SummaryDataType directCosts = SummaryDataType.Factory.newInstance();
SummaryDataType directIndirectCosts = SummaryDataType.Factory.newInstance();
if (budgetSummaryData != null) {
if (budgetSummaryData.getCumTotalFundsForSrPersonnel() != null) {
summarySeniorKey.setFederalSummary(budgetSummaryData.getCumTotalFundsForSrPersonnel().bigDecimalValue());
}
if (budgetSummaryData.getCumTotalNonFundsForSrPersonnel() != null) {
summarySeniorKey.setNonFederalSummary(budgetSummaryData.getCumTotalNonFundsForSrPersonnel().bigDecimalValue());
if (budgetSummaryData.getCumTotalFundsForSrPersonnel() != null) {
summarySeniorKey.setTotalFedNonFedSummary(budgetSummaryData.getCumTotalFundsForSrPersonnel().add(
budgetSummaryData.getCumTotalNonFundsForSrPersonnel()).bigDecimalValue());
}
else {
summarySeniorKey.setTotalFedNonFedSummary(budgetSummaryData.getCumTotalNonFundsForSrPersonnel()
.bigDecimalValue());
}
}
SummaryDataType summaryOtherPersonnel = SummaryDataType.Factory.newInstance();
if (budgetSummaryData.getCumTotalFundsForOtherPersonnel() != null) {
summaryOtherPersonnel.setFederalSummary(budgetSummaryData.getCumTotalFundsForOtherPersonnel().bigDecimalValue());
}
if (budgetSummaryData.getCumTotalNonFundsForOtherPersonnel() != null) {
summaryOtherPersonnel.setNonFederalSummary(budgetSummaryData.getCumTotalNonFundsForOtherPersonnel()
.bigDecimalValue());
if (budgetSummaryData.getCumTotalFundsForOtherPersonnel() != null) {
summaryOtherPersonnel.setTotalFedNonFedSummary(budgetSummaryData.getCumTotalFundsForOtherPersonnel().add(
budgetSummaryData.getCumTotalNonFundsForOtherPersonnel()).bigDecimalValue());
}
else {
summaryOtherPersonnel.setTotalFedNonFedSummary(budgetSummaryData.getCumTotalNonFundsForOtherPersonnel()
.bigDecimalValue());
}
}
budgetSummary.setCumulativeTotalFundsRequestedOtherPersonnel(summaryOtherPersonnel);
if (budgetSummaryData.getCumNumOtherPersonnel() != null) {
budgetSummary.setCumulativeTotalNoOtherPersonnel(budgetSummaryData.getCumNumOtherPersonnel().intValue());
}
if (budgetSummaryData.getCumTotalFundsForPersonnel() != null) {
summaryPersonnel.setFederalSummary(budgetSummaryData.getCumTotalFundsForPersonnel().bigDecimalValue());
}
if (budgetSummaryData.getCumTotalNonFundsForPersonnel() != null) {
summaryPersonnel.setNonFederalSummary(budgetSummaryData.getCumTotalNonFundsForPersonnel().bigDecimalValue());
if (budgetSummaryData.getCumTotalFundsForPersonnel() != null) {
summaryPersonnel.setTotalFedNonFedSummary(budgetSummaryData.getCumTotalFundsForPersonnel().add(
budgetSummaryData.getCumTotalNonFundsForPersonnel()).bigDecimalValue());
}
else {
summaryPersonnel
.setTotalFedNonFedSummary(budgetSummaryData.getCumTotalNonFundsForPersonnel().bigDecimalValue());
}
}
budgetSummary.setCumulativeEquipments(getCumulativeEquipments(budgetSummaryData));
budgetSummary.setCumulativeTravels(getCumulativeTravels(budgetSummaryData));
budgetSummary.setCumulativeTrainee(getCumulativeTrainee(budgetSummaryData));
budgetSummary.setCumulativeOtherDirect(getCumulativeOtherDirect(budgetSummaryData));
if (budgetSummaryData.getCumTotalDirectCosts() != null && budgetSummaryData.getCumTotalDirectCostSharing() != null) {
if (budgetSummaryData.getCumFee() != null) {
budgetSummary.setCumulativeFee(budgetSummaryData.getCumFee().bigDecimalValue());
}
directCosts.setFederalSummary(budgetSummaryData.getCumTotalDirectCosts().bigDecimalValue());
directCosts.setNonFederalSummary(budgetSummaryData.getCumTotalDirectCostSharing().bigDecimalValue());
directCosts.setTotalFedNonFedSummary(budgetSummaryData.getCumTotalDirectCosts().add(
budgetSummaryData.getCumTotalDirectCostSharing()).bigDecimalValue());
}
if (budgetSummaryData.getCumTotalIndirectCosts() != null && budgetSummaryData.getCumTotalIndirectCostSharing() != null) {
SummaryDataType summaryDataType = SummaryDataType.Factory.newInstance();
summaryDataType.setFederalSummary(budgetSummaryData.getCumTotalIndirectCosts().bigDecimalValue());
summaryDataType.setNonFederalSummary(budgetSummaryData.getCumTotalIndirectCostSharing().bigDecimalValue());
summaryDataType.setTotalFedNonFedSummary(budgetSummaryData.getCumTotalIndirectCosts().add(
budgetSummaryData.getCumTotalIndirectCostSharing()).bigDecimalValue());
budgetSummary.setCumulativeTotalFundsRequestedIndirectCost(summaryDataType);
}
if (budgetSummaryData.getCumTotalCosts() != null && budgetSummaryData.getCumTotalCostSharing() != null) {
directIndirectCosts.setFederalSummary(budgetSummaryData.getCumTotalCosts().bigDecimalValue());
directIndirectCosts.setNonFederalSummary(budgetSummaryData.getCumTotalCostSharing().bigDecimalValue());
directIndirectCosts.setTotalFedNonFedSummary(budgetSummaryData.getCumTotalCosts().add(
budgetSummaryData.getCumTotalCostSharing()).bigDecimalValue());
}
}
budgetSummary.setCumulativeTotalFundsRequestedSeniorKeyPerson(summarySeniorKey);
budgetSummary.setCumulativeTotalFundsRequestedPersonnel(summaryPersonnel);
budgetSummary.setCumulativeTotalFundsRequestedDirectCosts(directCosts);
budgetSummary.setCumulativeTotalFundsRequestedDirectIndirectCosts(directIndirectCosts);
return budgetSummary;
} } | public class class_name {
private BudgetSummary getBudgetSummary(BudgetSummaryDto budgetSummaryData) {
BudgetSummary budgetSummary = BudgetSummary.Factory.newInstance();
SummaryDataType summaryPersonnel = SummaryDataType.Factory.newInstance();
SummaryDataType summarySeniorKey = SummaryDataType.Factory.newInstance();
SummaryDataType directCosts = SummaryDataType.Factory.newInstance();
SummaryDataType directIndirectCosts = SummaryDataType.Factory.newInstance();
if (budgetSummaryData != null) {
if (budgetSummaryData.getCumTotalFundsForSrPersonnel() != null) {
summarySeniorKey.setFederalSummary(budgetSummaryData.getCumTotalFundsForSrPersonnel().bigDecimalValue()); // depends on control dependency: [if], data = [(budgetSummaryData.getCumTotalFundsForSrPersonnel()]
}
if (budgetSummaryData.getCumTotalNonFundsForSrPersonnel() != null) {
summarySeniorKey.setNonFederalSummary(budgetSummaryData.getCumTotalNonFundsForSrPersonnel().bigDecimalValue()); // depends on control dependency: [if], data = [(budgetSummaryData.getCumTotalNonFundsForSrPersonnel()]
if (budgetSummaryData.getCumTotalFundsForSrPersonnel() != null) {
summarySeniorKey.setTotalFedNonFedSummary(budgetSummaryData.getCumTotalFundsForSrPersonnel().add(
budgetSummaryData.getCumTotalNonFundsForSrPersonnel()).bigDecimalValue()); // depends on control dependency: [if], data = [none]
}
else {
summarySeniorKey.setTotalFedNonFedSummary(budgetSummaryData.getCumTotalNonFundsForSrPersonnel()
.bigDecimalValue()); // depends on control dependency: [if], data = [none]
}
}
SummaryDataType summaryOtherPersonnel = SummaryDataType.Factory.newInstance();
if (budgetSummaryData.getCumTotalFundsForOtherPersonnel() != null) {
summaryOtherPersonnel.setFederalSummary(budgetSummaryData.getCumTotalFundsForOtherPersonnel().bigDecimalValue()); // depends on control dependency: [if], data = [(budgetSummaryData.getCumTotalFundsForOtherPersonnel()]
}
if (budgetSummaryData.getCumTotalNonFundsForOtherPersonnel() != null) {
summaryOtherPersonnel.setNonFederalSummary(budgetSummaryData.getCumTotalNonFundsForOtherPersonnel()
.bigDecimalValue()); // depends on control dependency: [if], data = [none]
if (budgetSummaryData.getCumTotalFundsForOtherPersonnel() != null) {
summaryOtherPersonnel.setTotalFedNonFedSummary(budgetSummaryData.getCumTotalFundsForOtherPersonnel().add(
budgetSummaryData.getCumTotalNonFundsForOtherPersonnel()).bigDecimalValue()); // depends on control dependency: [if], data = [none]
}
else {
summaryOtherPersonnel.setTotalFedNonFedSummary(budgetSummaryData.getCumTotalNonFundsForOtherPersonnel()
.bigDecimalValue()); // depends on control dependency: [if], data = [none]
}
}
budgetSummary.setCumulativeTotalFundsRequestedOtherPersonnel(summaryOtherPersonnel); // depends on control dependency: [if], data = [none]
if (budgetSummaryData.getCumNumOtherPersonnel() != null) {
budgetSummary.setCumulativeTotalNoOtherPersonnel(budgetSummaryData.getCumNumOtherPersonnel().intValue()); // depends on control dependency: [if], data = [(budgetSummaryData.getCumNumOtherPersonnel()]
}
if (budgetSummaryData.getCumTotalFundsForPersonnel() != null) {
summaryPersonnel.setFederalSummary(budgetSummaryData.getCumTotalFundsForPersonnel().bigDecimalValue()); // depends on control dependency: [if], data = [(budgetSummaryData.getCumTotalFundsForPersonnel()]
}
if (budgetSummaryData.getCumTotalNonFundsForPersonnel() != null) {
summaryPersonnel.setNonFederalSummary(budgetSummaryData.getCumTotalNonFundsForPersonnel().bigDecimalValue()); // depends on control dependency: [if], data = [(budgetSummaryData.getCumTotalNonFundsForPersonnel()]
if (budgetSummaryData.getCumTotalFundsForPersonnel() != null) {
summaryPersonnel.setTotalFedNonFedSummary(budgetSummaryData.getCumTotalFundsForPersonnel().add(
budgetSummaryData.getCumTotalNonFundsForPersonnel()).bigDecimalValue()); // depends on control dependency: [if], data = [none]
}
else {
summaryPersonnel
.setTotalFedNonFedSummary(budgetSummaryData.getCumTotalNonFundsForPersonnel().bigDecimalValue()); // depends on control dependency: [if], data = [none]
}
}
budgetSummary.setCumulativeEquipments(getCumulativeEquipments(budgetSummaryData)); // depends on control dependency: [if], data = [(budgetSummaryData]
budgetSummary.setCumulativeTravels(getCumulativeTravels(budgetSummaryData)); // depends on control dependency: [if], data = [(budgetSummaryData]
budgetSummary.setCumulativeTrainee(getCumulativeTrainee(budgetSummaryData)); // depends on control dependency: [if], data = [(budgetSummaryData]
budgetSummary.setCumulativeOtherDirect(getCumulativeOtherDirect(budgetSummaryData)); // depends on control dependency: [if], data = [(budgetSummaryData]
if (budgetSummaryData.getCumTotalDirectCosts() != null && budgetSummaryData.getCumTotalDirectCostSharing() != null) {
if (budgetSummaryData.getCumFee() != null) {
budgetSummary.setCumulativeFee(budgetSummaryData.getCumFee().bigDecimalValue()); // depends on control dependency: [if], data = [(budgetSummaryData.getCumFee()]
}
directCosts.setFederalSummary(budgetSummaryData.getCumTotalDirectCosts().bigDecimalValue()); // depends on control dependency: [if], data = [(budgetSummaryData.getCumTotalDirectCosts()]
directCosts.setNonFederalSummary(budgetSummaryData.getCumTotalDirectCostSharing().bigDecimalValue()); // depends on control dependency: [if], data = [none]
directCosts.setTotalFedNonFedSummary(budgetSummaryData.getCumTotalDirectCosts().add(
budgetSummaryData.getCumTotalDirectCostSharing()).bigDecimalValue()); // depends on control dependency: [if], data = [none]
}
if (budgetSummaryData.getCumTotalIndirectCosts() != null && budgetSummaryData.getCumTotalIndirectCostSharing() != null) {
SummaryDataType summaryDataType = SummaryDataType.Factory.newInstance();
summaryDataType.setFederalSummary(budgetSummaryData.getCumTotalIndirectCosts().bigDecimalValue()); // depends on control dependency: [if], data = [(budgetSummaryData.getCumTotalIndirectCosts()]
summaryDataType.setNonFederalSummary(budgetSummaryData.getCumTotalIndirectCostSharing().bigDecimalValue()); // depends on control dependency: [if], data = [none]
summaryDataType.setTotalFedNonFedSummary(budgetSummaryData.getCumTotalIndirectCosts().add(
budgetSummaryData.getCumTotalIndirectCostSharing()).bigDecimalValue()); // depends on control dependency: [if], data = [none]
budgetSummary.setCumulativeTotalFundsRequestedIndirectCost(summaryDataType); // depends on control dependency: [if], data = [none]
}
if (budgetSummaryData.getCumTotalCosts() != null && budgetSummaryData.getCumTotalCostSharing() != null) {
directIndirectCosts.setFederalSummary(budgetSummaryData.getCumTotalCosts().bigDecimalValue()); // depends on control dependency: [if], data = [(budgetSummaryData.getCumTotalCosts()]
directIndirectCosts.setNonFederalSummary(budgetSummaryData.getCumTotalCostSharing().bigDecimalValue()); // depends on control dependency: [if], data = [none]
directIndirectCosts.setTotalFedNonFedSummary(budgetSummaryData.getCumTotalCosts().add(
budgetSummaryData.getCumTotalCostSharing()).bigDecimalValue()); // depends on control dependency: [if], data = [none]
}
}
budgetSummary.setCumulativeTotalFundsRequestedSeniorKeyPerson(summarySeniorKey);
budgetSummary.setCumulativeTotalFundsRequestedPersonnel(summaryPersonnel);
budgetSummary.setCumulativeTotalFundsRequestedDirectCosts(directCosts);
budgetSummary.setCumulativeTotalFundsRequestedDirectIndirectCosts(directIndirectCosts);
return budgetSummary;
} } |
public class class_name {
public static void dumpNodeAnim(AiNodeAnim nodeAnim) {
for (int i = 0; i < nodeAnim.getNumPosKeys(); i++) {
System.out.println(i + ": " + nodeAnim.getPosKeyTime(i) +
" ticks, " + nodeAnim.getPosKeyVector(i, Jassimp.BUILTIN));
}
} } | public class class_name {
public static void dumpNodeAnim(AiNodeAnim nodeAnim) {
for (int i = 0; i < nodeAnim.getNumPosKeys(); i++) {
System.out.println(i + ": " + nodeAnim.getPosKeyTime(i) +
" ticks, " + nodeAnim.getPosKeyVector(i, Jassimp.BUILTIN)); // depends on control dependency: [for], data = [i]
}
} } |
public class class_name {
public void setInstructions(String instructions) {
// Split the instructions into multiple instructions for each existent newline
ArrayList<String> instructionsList = new ArrayList<>();
StringTokenizer st = new StringTokenizer(instructions, "\n");
while (st.hasMoreTokens()) {
instructionsList.add(st.nextToken());
}
// Set the new list of instructions
dataForm.setInstructions(instructionsList);
} } | public class class_name {
public void setInstructions(String instructions) {
// Split the instructions into multiple instructions for each existent newline
ArrayList<String> instructionsList = new ArrayList<>();
StringTokenizer st = new StringTokenizer(instructions, "\n");
while (st.hasMoreTokens()) {
instructionsList.add(st.nextToken()); // depends on control dependency: [while], data = [none]
}
// Set the new list of instructions
dataForm.setInstructions(instructionsList);
} } |
public class class_name {
protected String buildDefaultMavenCoordinates() {
StringBuilder sb = new StringBuilder();
sb.append(getGroupId()).append(":");
sb.append(getArtifactId());
if (StringUtils.isNotBlank(getType())) {
sb.append(":").append(getType());
}
if (StringUtils.isNotBlank(getClassifier())) {
sb.append(":").append(getClassifier());
}
sb.append(":");
sb.append(getVersion());
return sb.toString().trim();
} } | public class class_name {
protected String buildDefaultMavenCoordinates() {
StringBuilder sb = new StringBuilder();
sb.append(getGroupId()).append(":");
sb.append(getArtifactId());
if (StringUtils.isNotBlank(getType())) {
sb.append(":").append(getType()); // depends on control dependency: [if], data = [none]
}
if (StringUtils.isNotBlank(getClassifier())) {
sb.append(":").append(getClassifier()); // depends on control dependency: [if], data = [none]
}
sb.append(":");
sb.append(getVersion());
return sb.toString().trim();
} } |
public class class_name {
private static int[] distributedSizes(List formSpecs,
int totalSize, int totalPrefSize,
int[] inputSizes) {
double totalFreeSpace = totalSize - totalPrefSize;
// Do nothing if there's no free space.
if (totalFreeSpace < 0) {
return inputSizes;
}
// Compute the total weight.
int count = formSpecs.size();
double totalWeight = 0.0;
for (int i = 0; i < count; i++) {
FormSpec formSpec = (FormSpec) formSpecs.get(i);
totalWeight += formSpec.getResizeWeight();
}
// Do nothing if there's no resizing column.
if (totalWeight == 0.0) {
return inputSizes;
}
int[] sizes = new int[count];
double restSpace = totalFreeSpace;
int roundedRestSpace = (int) totalFreeSpace;
for (int i = 0; i < count; i++) {
FormSpec formSpec = (FormSpec) formSpecs.get(i);
double weight = formSpec.getResizeWeight();
if (weight == FormSpec.NO_GROW) {
sizes[i] = inputSizes[i];
} else {
double roundingCorrection = restSpace - roundedRestSpace;
double extraSpace = totalFreeSpace * weight / totalWeight;
double correctedExtraSpace = extraSpace - roundingCorrection;
int roundedExtraSpace = (int) Math.round(correctedExtraSpace);
sizes[i] = inputSizes[i] + roundedExtraSpace;
restSpace -= extraSpace;
roundedRestSpace -= roundedExtraSpace;
}
}
return sizes;
} } | public class class_name {
private static int[] distributedSizes(List formSpecs,
int totalSize, int totalPrefSize,
int[] inputSizes) {
double totalFreeSpace = totalSize - totalPrefSize;
// Do nothing if there's no free space.
if (totalFreeSpace < 0) {
return inputSizes; // depends on control dependency: [if], data = [none]
}
// Compute the total weight.
int count = formSpecs.size();
double totalWeight = 0.0;
for (int i = 0; i < count; i++) {
FormSpec formSpec = (FormSpec) formSpecs.get(i);
totalWeight += formSpec.getResizeWeight(); // depends on control dependency: [for], data = [none]
}
// Do nothing if there's no resizing column.
if (totalWeight == 0.0) {
return inputSizes; // depends on control dependency: [if], data = [none]
}
int[] sizes = new int[count];
double restSpace = totalFreeSpace;
int roundedRestSpace = (int) totalFreeSpace;
for (int i = 0; i < count; i++) {
FormSpec formSpec = (FormSpec) formSpecs.get(i);
double weight = formSpec.getResizeWeight();
if (weight == FormSpec.NO_GROW) {
sizes[i] = inputSizes[i]; // depends on control dependency: [if], data = [none]
} else {
double roundingCorrection = restSpace - roundedRestSpace;
double extraSpace = totalFreeSpace * weight / totalWeight;
double correctedExtraSpace = extraSpace - roundingCorrection;
int roundedExtraSpace = (int) Math.round(correctedExtraSpace);
sizes[i] = inputSizes[i] + roundedExtraSpace; // depends on control dependency: [if], data = [none]
restSpace -= extraSpace; // depends on control dependency: [if], data = [none]
roundedRestSpace -= roundedExtraSpace; // depends on control dependency: [if], data = [none]
}
}
return sizes;
} } |
public class class_name {
public long updateGameInfo(GameInfo gameInfo){
HMSAgentLog.i("updateGameInfo:gameInfo=" + StrUtils.objDesc(gameInfo));
HuaweiApiClient client = ApiClientMgr.INST.getApiClient();
if (client == null || !ApiClientMgr.INST.isConnect(client)) {
HMSAgentLog.e("client not connted");
return CommonCode.ErrorCode.CLIENT_API_INVALID;
}
return HuaweiGame.HuaweiGameApi.updateGameInfo(client, gameInfo);
} } | public class class_name {
public long updateGameInfo(GameInfo gameInfo){
HMSAgentLog.i("updateGameInfo:gameInfo=" + StrUtils.objDesc(gameInfo));
HuaweiApiClient client = ApiClientMgr.INST.getApiClient();
if (client == null || !ApiClientMgr.INST.isConnect(client)) {
HMSAgentLog.e("client not connted");
// depends on control dependency: [if], data = [none]
return CommonCode.ErrorCode.CLIENT_API_INVALID;
// depends on control dependency: [if], data = [none]
}
return HuaweiGame.HuaweiGameApi.updateGameInfo(client, gameInfo);
} } |
public class class_name {
@Override
public boolean cancel(boolean mayInterruptIfRunning) {
if (!completed && !cancelled) {
stop();
cancelled = true;
return true;
}
return false;
} } | public class class_name {
@Override
public boolean cancel(boolean mayInterruptIfRunning) {
if (!completed && !cancelled) {
stop(); // depends on control dependency: [if], data = [none]
cancelled = true; // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
return false;
} } |
public class class_name {
public String getReplyString() {
Object replyString = getHeader(FtpMessageHeaders.FTP_REPLY_STRING);
if (replyString != null) {
return replyString.toString();
}
return null;
} } | public class class_name {
public String getReplyString() {
Object replyString = getHeader(FtpMessageHeaders.FTP_REPLY_STRING);
if (replyString != null) {
return replyString.toString(); // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
public String[] generateFieldNameCodes(final String objectName, final String field) {
final List<String> codeList = new ArrayList<String>();
codeList.addAll(Arrays.asList(generateCodes(null, objectName, field, null)));
// オブジェクト名の最後の値を取得する
final int dotIndex = objectName.lastIndexOf('.');
if(dotIndex > 0) {
final String subName = objectName.substring(dotIndex + 1);
for(String code : generateCodes(null, subName, field, null)) {
if(!codeList.contains(code)) {
codeList.add(code);
}
}
}
return codeList.toArray(new String[codeList.size()]);
} } | public class class_name {
public String[] generateFieldNameCodes(final String objectName, final String field) {
final List<String> codeList = new ArrayList<String>();
codeList.addAll(Arrays.asList(generateCodes(null, objectName, field, null)));
// オブジェクト名の最後の値を取得する
final int dotIndex = objectName.lastIndexOf('.');
if(dotIndex > 0) {
final String subName = objectName.substring(dotIndex + 1);
for(String code : generateCodes(null, subName, field, null)) {
if(!codeList.contains(code)) {
codeList.add(code);
// depends on control dependency: [if], data = [none]
}
}
}
return codeList.toArray(new String[codeList.size()]);
} } |
public class class_name {
private void setupResponse(ByteArrayOutputStream response, Call call, Status status, IOReadableWritable rv,
String errorClass, String error) throws IOException {
response.reset();
DataOutputStream out = new DataOutputStream(response);
out.writeInt(call.id); // write call id
out.writeInt(status.state); // write status
if (status == Status.SUCCESS) {
if (rv == null) {
out.writeBoolean(false);
} else {
out.writeBoolean(true);
StringRecord.writeString(out, rv.getClass().getName());
rv.write(out);
}
} else {
StringRecord.writeString(out, errorClass);
StringRecord.writeString(out, error);
}
call.setResponse(ByteBuffer.wrap(response.toByteArray()));
} } | public class class_name {
private void setupResponse(ByteArrayOutputStream response, Call call, Status status, IOReadableWritable rv,
String errorClass, String error) throws IOException {
response.reset();
DataOutputStream out = new DataOutputStream(response);
out.writeInt(call.id); // write call id
out.writeInt(status.state); // write status
if (status == Status.SUCCESS) {
if (rv == null) {
out.writeBoolean(false); // depends on control dependency: [if], data = [none]
} else {
out.writeBoolean(true); // depends on control dependency: [if], data = [none]
StringRecord.writeString(out, rv.getClass().getName()); // depends on control dependency: [if], data = [none]
rv.write(out); // depends on control dependency: [if], data = [none]
}
} else {
StringRecord.writeString(out, errorClass);
StringRecord.writeString(out, error);
}
call.setResponse(ByteBuffer.wrap(response.toByteArray()));
} } |
public class class_name {
@SuppressWarnings("unchecked")
private boolean isAnySecureTransportAddressAvailable(Map<String, Object> extraConfig) {
Map<String, List<TransportAddress>> addrMap = (Map<String, List<TransportAddress>>) extraConfig.get(ADDR_KEY);
if (addrMap != null) {
Set<String> sslAliases = addrMap.keySet();
return sslAliases.size() != 1;
}
return true;
} } | public class class_name {
@SuppressWarnings("unchecked")
private boolean isAnySecureTransportAddressAvailable(Map<String, Object> extraConfig) {
Map<String, List<TransportAddress>> addrMap = (Map<String, List<TransportAddress>>) extraConfig.get(ADDR_KEY);
if (addrMap != null) {
Set<String> sslAliases = addrMap.keySet();
return sslAliases.size() != 1; // depends on control dependency: [if], data = [none]
}
return true;
} } |
public class class_name {
@Nonnull
private static Configuration _unmarshallConfiguration (@WillClose @Nonnull final InputStream aIS)
{
ValueEnforcer.notNull (aIS, "InputStream");
try
{
final JAXBContext ctx = JAXBContextCache.getInstance ()
.getFromCache (com.helger.holiday.jaxb.ObjectFactory.class);
final Unmarshaller um = ctx.createUnmarshaller ();
final JAXBElement <Configuration> aElement = GenericReflection.uncheckedCast (um.unmarshal (aIS));
return aElement.getValue ();
}
catch (final JAXBException ex)
{
throw new IllegalArgumentException ("Cannot parse holidays XML.", ex);
}
finally
{
StreamHelper.close (aIS);
}
} } | public class class_name {
@Nonnull
private static Configuration _unmarshallConfiguration (@WillClose @Nonnull final InputStream aIS)
{
ValueEnforcer.notNull (aIS, "InputStream");
try
{
final JAXBContext ctx = JAXBContextCache.getInstance ()
.getFromCache (com.helger.holiday.jaxb.ObjectFactory.class);
final Unmarshaller um = ctx.createUnmarshaller ();
final JAXBElement <Configuration> aElement = GenericReflection.uncheckedCast (um.unmarshal (aIS));
return aElement.getValue (); // depends on control dependency: [try], data = [none]
}
catch (final JAXBException ex)
{
throw new IllegalArgumentException ("Cannot parse holidays XML.", ex);
} // depends on control dependency: [catch], data = [none]
finally
{
StreamHelper.close (aIS);
}
} } |
public class class_name {
private <T extends BaseProxy> AutoBean<T> cloneBeanAndCollections(final AutoBean<T> toClone) {
final AutoBean<T> clone = toClone.getFactory().create(toClone.getType());
clone.setTag(STABLE_ID, toClone.getTag(STABLE_ID));
clone.setTag(Constants.VERSION_PROPERTY_B64, toClone.getTag(Constants.VERSION_PROPERTY_B64));
/*
* Take ownership here to prevent cycles in value objects from overflowing the stack.
*/
this.takeOwnership(clone);
clone.accept(new AutoBeanVisitor() {
final Map<String, Object> values = AutoBeanUtils.getAllProperties(toClone);
@Override
public boolean visitCollectionProperty(final String propertyName,
AutoBean<Collection<?>> value, final CollectionPropertyContext ctx) {
// javac generics bug
value = AutoBeanUtils.<Collection<?>, Collection<?>>getAutoBean(
(Collection<?>) this.values.get(propertyName));
if (value != null) {
Collection<Object> collection;
if (List.class == ctx.getType()) {
collection = new ArrayList<>();
} else if (Set.class == ctx.getType()) {
collection = new HashSet<>();
} else {
// Should not get here if the validator works correctly
throw new IllegalArgumentException(ctx.getType().getName());
}
if (AbstractRequestContext.this.isValueType(ctx.getElementType())
|| AbstractRequestContext.this.isEntityType(ctx.getElementType())) {
/*
* Proxies must be edited up-front so that the elements in the collection have stable
* identity.
*/
for (final Object o : value.as()) {
if (o == null) {
collection.add(null);
} else {
collection.add(AbstractRequestContext.this.editProxy((BaseProxy) o));
}
}
} else {
// For simple values, just copy the values
collection.addAll(value.as());
}
ctx.set(collection);
}
return false;
}
@Override
public boolean visitReferenceProperty(final String propertyName, AutoBean<?> value,
final PropertyContext ctx) {
value = AutoBeanUtils.getAutoBean(this.values.get(propertyName));
if (value != null) {
if (AbstractRequestContext.this.isValueType(ctx.getType())
|| AbstractRequestContext.this.isEntityType(ctx.getType())) {
/*
* Value proxies must be cloned upfront, since the value is replaced outright.
*/
@SuppressWarnings("unchecked")
final AutoBean<BaseProxy> valueBean = (AutoBean<BaseProxy>) value;
ctx.set(AbstractRequestContext.this.editProxy(valueBean.as()));
} else {
ctx.set(value.as());
}
}
return false;
}
@Override
public boolean visitValueProperty(final String propertyName, final Object value,
final PropertyContext ctx) {
ctx.set(this.values.get(propertyName));
return false;
}
});
return clone;
} } | public class class_name {
private <T extends BaseProxy> AutoBean<T> cloneBeanAndCollections(final AutoBean<T> toClone) {
final AutoBean<T> clone = toClone.getFactory().create(toClone.getType());
clone.setTag(STABLE_ID, toClone.getTag(STABLE_ID));
clone.setTag(Constants.VERSION_PROPERTY_B64, toClone.getTag(Constants.VERSION_PROPERTY_B64));
/*
* Take ownership here to prevent cycles in value objects from overflowing the stack.
*/
this.takeOwnership(clone);
clone.accept(new AutoBeanVisitor() {
final Map<String, Object> values = AutoBeanUtils.getAllProperties(toClone);
@Override
public boolean visitCollectionProperty(final String propertyName,
AutoBean<Collection<?>> value, final CollectionPropertyContext ctx) {
// javac generics bug
value = AutoBeanUtils.<Collection<?>, Collection<?>>getAutoBean(
(Collection<?>) this.values.get(propertyName));
if (value != null) {
Collection<Object> collection;
if (List.class == ctx.getType()) {
collection = new ArrayList<>();
} else if (Set.class == ctx.getType()) {
collection = new HashSet<>();
} else {
// Should not get here if the validator works correctly
throw new IllegalArgumentException(ctx.getType().getName());
}
if (AbstractRequestContext.this.isValueType(ctx.getElementType())
|| AbstractRequestContext.this.isEntityType(ctx.getElementType())) {
/*
* Proxies must be edited up-front so that the elements in the collection have stable
* identity.
*/
for (final Object o : value.as()) {
if (o == null) {
collection.add(null); // depends on control dependency: [if], data = [null)]
} else {
collection.add(AbstractRequestContext.this.editProxy((BaseProxy) o)); // depends on control dependency: [if], data = [none]
}
}
} else {
// For simple values, just copy the values
collection.addAll(value.as());
}
ctx.set(collection);
}
return false;
}
@Override
public boolean visitReferenceProperty(final String propertyName, AutoBean<?> value,
final PropertyContext ctx) {
value = AutoBeanUtils.getAutoBean(this.values.get(propertyName));
if (value != null) {
if (AbstractRequestContext.this.isValueType(ctx.getType())
|| AbstractRequestContext.this.isEntityType(ctx.getType())) {
/*
* Value proxies must be cloned upfront, since the value is replaced outright.
*/
@SuppressWarnings("unchecked")
final AutoBean<BaseProxy> valueBean = (AutoBean<BaseProxy>) value;
ctx.set(AbstractRequestContext.this.editProxy(valueBean.as()));
} else {
ctx.set(value.as());
}
}
return false;
}
@Override
public boolean visitValueProperty(final String propertyName, final Object value,
final PropertyContext ctx) {
ctx.set(this.values.get(propertyName));
return false;
}
});
return clone;
} } |
public class class_name {
private void detectImplmentedExtension() {
if (isImplExtRegistered == false) {
Object o = getThis();
Class thisClass = o.getClass();
// superclass interfaces
Class[] declared = thisClass.getSuperclass().getInterfaces();
for (Class declare : declared) {
detectImplmentedExtension(declare);
}
// subclass interfaces
declared = thisClass.getInterfaces();
for (Class declare : declared) {
detectImplmentedExtension(declare);
}
isImplExtRegistered = true;
}
} } | public class class_name {
private void detectImplmentedExtension() {
if (isImplExtRegistered == false) {
Object o = getThis();
Class thisClass = o.getClass();
// superclass interfaces
Class[] declared = thisClass.getSuperclass().getInterfaces();
for (Class declare : declared) {
detectImplmentedExtension(declare);
// depends on control dependency: [for], data = [declare]
}
// subclass interfaces
declared = thisClass.getInterfaces();
// depends on control dependency: [if], data = [none]
for (Class declare : declared) {
detectImplmentedExtension(declare);
// depends on control dependency: [for], data = [declare]
}
isImplExtRegistered = true;
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@SuppressWarnings("unchecked")
private <T> Optional<T> getValue(Object object, Supplier<Object> method, Class<T> cls) {
T source = null;
if (cls.isInstance(method.get())) {
source = (T) method.get();
} else {
if (CoreParameters.DEVELOPER_MODE.get()) {
throw new CoreRuntimeException("Cannot cast object " + method.get() + " to " + cls.toGenericString());
}
}
return Optional.ofNullable(source);
} } | public class class_name {
@SuppressWarnings("unchecked")
private <T> Optional<T> getValue(Object object, Supplier<Object> method, Class<T> cls) {
T source = null;
if (cls.isInstance(method.get())) {
source = (T) method.get(); // depends on control dependency: [if], data = [none]
} else {
if (CoreParameters.DEVELOPER_MODE.get()) {
throw new CoreRuntimeException("Cannot cast object " + method.get() + " to " + cls.toGenericString());
}
}
return Optional.ofNullable(source);
} } |
public class class_name {
public KeePassFile openDatabase(String password, InputStream keyFileStream) {
if (password == null) {
throw new IllegalArgumentException(MSG_EMPTY_MASTER_KEY);
}
if (keyFileStream == null) {
throw new IllegalArgumentException("You must provide a non-empty KeePass keyfile stream.");
}
try {
byte[] passwordBytes = password.getBytes(UTF_8);
byte[] hashedPassword = Sha256.hash(passwordBytes);
byte[] protectedBuffer = new KeyFileReader().readKeyFile(keyFileStream);
return new KeePassDatabaseReader(keepassHeader).decryptAndParseDatabase(ByteUtils.concat(hashedPassword, protectedBuffer), keepassFile);
} catch (UnsupportedEncodingException e) {
throw new UnsupportedOperationException(MSG_UTF8_NOT_SUPPORTED, e);
}
} } | public class class_name {
public KeePassFile openDatabase(String password, InputStream keyFileStream) {
if (password == null) {
throw new IllegalArgumentException(MSG_EMPTY_MASTER_KEY);
}
if (keyFileStream == null) {
throw new IllegalArgumentException("You must provide a non-empty KeePass keyfile stream.");
}
try {
byte[] passwordBytes = password.getBytes(UTF_8);
byte[] hashedPassword = Sha256.hash(passwordBytes);
byte[] protectedBuffer = new KeyFileReader().readKeyFile(keyFileStream);
return new KeePassDatabaseReader(keepassHeader).decryptAndParseDatabase(ByteUtils.concat(hashedPassword, protectedBuffer), keepassFile);
// depends on control dependency: [try], data = [none]
} catch (UnsupportedEncodingException e) {
throw new UnsupportedOperationException(MSG_UTF8_NOT_SUPPORTED, e);
}
// depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static void addThreadIdentityService(ThreadIdentityService tis) {
if (tis != null) {
threadIdentityServices.add(tis);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "A ThreadIdentityService implementation was added.", tis.getClass().getName());
}
}
} } | public class class_name {
public static void addThreadIdentityService(ThreadIdentityService tis) {
if (tis != null) {
threadIdentityServices.add(tis); // depends on control dependency: [if], data = [(tis]
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "A ThreadIdentityService implementation was added.", tis.getClass().getName()); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
private static String getWindowsUserShell()
{
if( null != m_SHELL )
{
return m_SHELL;
}
if( -1 != OSNAME.indexOf( "98" )
|| -1 != OSNAME.indexOf( "95" )
|| -1 != OSNAME.indexOf( "Me" ) )
{
m_SHELL = "command.com";
return m_SHELL;
}
m_SHELL = "cmd.exe";
return m_SHELL;
} } | public class class_name {
private static String getWindowsUserShell()
{
if( null != m_SHELL )
{
return m_SHELL; // depends on control dependency: [if], data = [none]
}
if( -1 != OSNAME.indexOf( "98" )
|| -1 != OSNAME.indexOf( "95" )
|| -1 != OSNAME.indexOf( "Me" ) )
{
m_SHELL = "command.com"; // depends on control dependency: [if], data = [none]
return m_SHELL; // depends on control dependency: [if], data = [none]
}
m_SHELL = "cmd.exe";
return m_SHELL;
} } |
public class class_name {
public EClass getIfcSectionReinforcementProperties() {
if (ifcSectionReinforcementPropertiesEClass == null) {
ifcSectionReinforcementPropertiesEClass = (EClass) EPackage.Registry.INSTANCE
.getEPackage(Ifc2x3tc1Package.eNS_URI).getEClassifiers().get(505);
}
return ifcSectionReinforcementPropertiesEClass;
} } | public class class_name {
public EClass getIfcSectionReinforcementProperties() {
if (ifcSectionReinforcementPropertiesEClass == null) {
ifcSectionReinforcementPropertiesEClass = (EClass) EPackage.Registry.INSTANCE
.getEPackage(Ifc2x3tc1Package.eNS_URI).getEClassifiers().get(505);
// depends on control dependency: [if], data = [none]
}
return ifcSectionReinforcementPropertiesEClass;
} } |
public class class_name {
@ForbiddenWhenBuilding
@Override
public String getVar() {
fwba.checkNotForbidden();
if (cachedVar != null) {
return cachedVar;
} else {
cachedVar = StringUtil.escape(columnConfig.getFieldName());
return cachedVar;
}
} } | public class class_name {
@ForbiddenWhenBuilding
@Override
public String getVar() {
fwba.checkNotForbidden();
if (cachedVar != null) {
return cachedVar; // depends on control dependency: [if], data = [none]
} else {
cachedVar = StringUtil.escape(columnConfig.getFieldName()); // depends on control dependency: [if], data = [none]
return cachedVar; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static AWSCredentialsProvider getCredentialsProvider(
AmazonWebServiceRequest req,
AWSCredentialsProvider base) {
if (req != null && req.getRequestCredentialsProvider() != null) {
return req.getRequestCredentialsProvider();
}
return base;
} } | public class class_name {
public static AWSCredentialsProvider getCredentialsProvider(
AmazonWebServiceRequest req,
AWSCredentialsProvider base) {
if (req != null && req.getRequestCredentialsProvider() != null) {
return req.getRequestCredentialsProvider(); // depends on control dependency: [if], data = [none]
}
return base;
} } |
public class class_name {
public static final DoubleMatrix1D zMult(final DoubleMatrix2D A, final DoubleMatrix1D a, final DoubleMatrix1D b, final double beta){
if(A.columns()!=a.size()){
throw new IllegalArgumentException("Wrong matrix dimensions. Number of columns must be " + a.size() + ", found: " + A.columns());
}
if(A.rows()!=b.size()){
throw new IllegalArgumentException("Wrong matrix dimensions. Number of rows must be " + b.size() + ", found: " + A.rows());
}
final DoubleMatrix1D ret = DoubleFactory1D.dense.make(A.rows());
if(A instanceof SparseDoubleMatrix2D){
//sparse matrix
A.forEachNonZero(new IntIntDoubleFunction() {
@Override
public double apply(int i, int j, double Aij) {
ret.setQuick(i, ret.getQuick(i) + Aij * a.getQuick(j));
return Aij;
}
});
for(int i=0; i<ret.size(); i++){
ret.setQuick(i, ret.getQuick(i) + beta * b.getQuick(i));
}
}else{
//dense matrix
for(int i=0; i<A.rows(); i++){
double vi = beta * b.getQuick(i);
for(int j=0; j<A.columns(); j++){
vi += A.getQuick(i, j) * a.getQuick(j);
}
ret.setQuick(i, vi);
}
}
return ret;
} } | public class class_name {
public static final DoubleMatrix1D zMult(final DoubleMatrix2D A, final DoubleMatrix1D a, final DoubleMatrix1D b, final double beta){
if(A.columns()!=a.size()){
throw new IllegalArgumentException("Wrong matrix dimensions. Number of columns must be " + a.size() + ", found: " + A.columns());
}
if(A.rows()!=b.size()){
throw new IllegalArgumentException("Wrong matrix dimensions. Number of rows must be " + b.size() + ", found: " + A.rows());
}
final DoubleMatrix1D ret = DoubleFactory1D.dense.make(A.rows());
if(A instanceof SparseDoubleMatrix2D){
//sparse matrix
A.forEachNonZero(new IntIntDoubleFunction() {
@Override
public double apply(int i, int j, double Aij) {
ret.setQuick(i, ret.getQuick(i) + Aij * a.getQuick(j));
return Aij;
}
});
// depends on control dependency: [if], data = [none]
for(int i=0; i<ret.size(); i++){
ret.setQuick(i, ret.getQuick(i) + beta * b.getQuick(i));
// depends on control dependency: [for], data = [i]
}
}else{
//dense matrix
for(int i=0; i<A.rows(); i++){
double vi = beta * b.getQuick(i);
for(int j=0; j<A.columns(); j++){
vi += A.getQuick(i, j) * a.getQuick(j);
// depends on control dependency: [for], data = [j]
}
ret.setQuick(i, vi);
// depends on control dependency: [for], data = [i]
}
}
return ret;
} } |
public class class_name {
public boolean isAllowed(final ModelNode operationObject) {
if(alternatives != null) {
for(final String alternative : alternatives) {
if(operationObject.hasDefined(alternative)) {
return false;
}
}
}
return true;
} } | public class class_name {
public boolean isAllowed(final ModelNode operationObject) {
if(alternatives != null) {
for(final String alternative : alternatives) {
if(operationObject.hasDefined(alternative)) {
return false; // depends on control dependency: [if], data = [none]
}
}
}
return true;
} } |
public class class_name {
private List<EthereumTransaction> parseRLPTransactions(RLPList rlpTransactions) {
ArrayList<EthereumTransaction> result = new ArrayList<>(rlpTransactions.getRlpList().size());
for (int i=0;i<rlpTransactions.getRlpList().size();i++) {
RLPList currenTransactionRLP = (RLPList) rlpTransactions.getRlpList().get(i);
EthereumTransaction currentTransaction = new EthereumTransaction();
currentTransaction.setNonce(((RLPElement)currenTransactionRLP.getRlpList().get(0)).getRawData());
currentTransaction.setGasPriceRaw(((RLPElement)currenTransactionRLP.getRlpList().get(1)).getRawData());
currentTransaction.setGasLimitRaw(((RLPElement)currenTransactionRLP.getRlpList().get(2)).getRawData());
currentTransaction.setReceiveAddress(((RLPElement)currenTransactionRLP.getRlpList().get(3)).getRawData());
currentTransaction.setValueRaw(((RLPElement)currenTransactionRLP.getRlpList().get(4)).getRawData());
currentTransaction.setData(((RLPElement)currenTransactionRLP.getRlpList().get(5)).getRawData());
if (((RLPElement)currenTransactionRLP.getRlpList().get(6)).getRawData().length>0) {
currentTransaction.setSig_v(((RLPElement)currenTransactionRLP.getRlpList().get(6)).getRawData());
currentTransaction.setSig_r(((RLPElement)currenTransactionRLP.getRlpList().get(7)).getRawData());
currentTransaction.setSig_s(((RLPElement)currenTransactionRLP.getRlpList().get(8)).getRawData());
}
result.add(currentTransaction);
}
return result;
} } | public class class_name {
private List<EthereumTransaction> parseRLPTransactions(RLPList rlpTransactions) {
ArrayList<EthereumTransaction> result = new ArrayList<>(rlpTransactions.getRlpList().size());
for (int i=0;i<rlpTransactions.getRlpList().size();i++) {
RLPList currenTransactionRLP = (RLPList) rlpTransactions.getRlpList().get(i);
EthereumTransaction currentTransaction = new EthereumTransaction();
currentTransaction.setNonce(((RLPElement)currenTransactionRLP.getRlpList().get(0)).getRawData()); // depends on control dependency: [for], data = [none]
currentTransaction.setGasPriceRaw(((RLPElement)currenTransactionRLP.getRlpList().get(1)).getRawData()); // depends on control dependency: [for], data = [none]
currentTransaction.setGasLimitRaw(((RLPElement)currenTransactionRLP.getRlpList().get(2)).getRawData()); // depends on control dependency: [for], data = [none]
currentTransaction.setReceiveAddress(((RLPElement)currenTransactionRLP.getRlpList().get(3)).getRawData()); // depends on control dependency: [for], data = [none]
currentTransaction.setValueRaw(((RLPElement)currenTransactionRLP.getRlpList().get(4)).getRawData()); // depends on control dependency: [for], data = [none]
currentTransaction.setData(((RLPElement)currenTransactionRLP.getRlpList().get(5)).getRawData()); // depends on control dependency: [for], data = [none]
if (((RLPElement)currenTransactionRLP.getRlpList().get(6)).getRawData().length>0) {
currentTransaction.setSig_v(((RLPElement)currenTransactionRLP.getRlpList().get(6)).getRawData()); // depends on control dependency: [if], data = [none]
currentTransaction.setSig_r(((RLPElement)currenTransactionRLP.getRlpList().get(7)).getRawData()); // depends on control dependency: [if], data = [none]
currentTransaction.setSig_s(((RLPElement)currenTransactionRLP.getRlpList().get(8)).getRawData()); // depends on control dependency: [if], data = [none]
}
result.add(currentTransaction); // depends on control dependency: [for], data = [none]
}
return result;
} } |
public class class_name {
private static InputStream findFileInClasspath(String fileName) {
InputStream is = null;
try {
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
is = classLoader.getResourceAsStream(fileName);
return is;
} catch (Exception ex) {
log.error(String.format("Error while reading file '%s' from classpath", fileName), ex);
return null;
}
} } | public class class_name {
private static InputStream findFileInClasspath(String fileName) {
InputStream is = null;
try {
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
is = classLoader.getResourceAsStream(fileName); // depends on control dependency: [try], data = [none]
return is; // depends on control dependency: [try], data = [none]
} catch (Exception ex) {
log.error(String.format("Error while reading file '%s' from classpath", fileName), ex);
return null;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
public void visitCode(Code obj) {
fbInfo.clear();
loadedReg = -1;
CodeException[] exc = obj.getExceptionTable();
if (exc != null) {
for (CodeException ce : exc) {
if ((ce.getCatchType() == 0) && (ce.getStartPC() == ce.getHandlerPC())) {
fbInfo.add(new FinallyBlockInfo(ce.getStartPC()));
}
}
}
if (!fbInfo.isEmpty()) {
try {
super.visitCode(obj);
} catch (StopOpcodeParsingException e) {
// no more finally blocks to check
}
}
} } | public class class_name {
@Override
public void visitCode(Code obj) {
fbInfo.clear();
loadedReg = -1;
CodeException[] exc = obj.getExceptionTable();
if (exc != null) {
for (CodeException ce : exc) {
if ((ce.getCatchType() == 0) && (ce.getStartPC() == ce.getHandlerPC())) {
fbInfo.add(new FinallyBlockInfo(ce.getStartPC())); // depends on control dependency: [if], data = [none]
}
}
}
if (!fbInfo.isEmpty()) {
try {
super.visitCode(obj); // depends on control dependency: [try], data = [none]
} catch (StopOpcodeParsingException e) {
// no more finally blocks to check
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
private boolean canScanNode(StructuralNode node) {
if (node == null) {
if (log.isDebugEnabled()) {
log.debug("Ignoring null node");
}
return false;
}
HistoryReference hRef = node.getHistoryReference();
if (hRef == null) {
if (log.isDebugEnabled()) {
log.debug("Ignoring null history reference for node: " + node.getName());
}
return false;
}
if (HistoryReference.TYPE_SCANNER == hRef.getHistoryType()) {
if (log.isDebugEnabled()) {
log.debug("Ignoring \"scanner\" type href [id=" + hRef.getHistoryId() + ", URL=" + hRef.getURI() + "]");
}
return false;
}
if (!nodeInScope(node.getName())) {
if (log.isDebugEnabled()) {
log.debug("Ignoring node not in scope: " + node.getName());
}
return false;
}
return true;
} } | public class class_name {
private boolean canScanNode(StructuralNode node) {
if (node == null) {
if (log.isDebugEnabled()) {
log.debug("Ignoring null node");
// depends on control dependency: [if], data = [none]
}
return false;
// depends on control dependency: [if], data = [none]
}
HistoryReference hRef = node.getHistoryReference();
if (hRef == null) {
if (log.isDebugEnabled()) {
log.debug("Ignoring null history reference for node: " + node.getName());
// depends on control dependency: [if], data = [none]
}
return false;
// depends on control dependency: [if], data = [none]
}
if (HistoryReference.TYPE_SCANNER == hRef.getHistoryType()) {
if (log.isDebugEnabled()) {
log.debug("Ignoring \"scanner\" type href [id=" + hRef.getHistoryId() + ", URL=" + hRef.getURI() + "]");
}
return false;
}
if (!nodeInScope(node.getName())) {
if (log.isDebugEnabled()) {
log.debug("Ignoring node not in scope: " + node.getName());
}
return false;
}
return true;
} } |
public class class_name {
private void enhanceFAB(final FloatingActionButton fab, int dx, int dy) {
if (isEnhancedFAB() && getFab() != null) {
final FloatingActionButton mFloatingActionButton = this.fab;
if (getLinearLayoutManager() != null) {
if (dy > 0) {
if (mFloatingActionButton.getVisibility() == View.VISIBLE) {
mFloatingActionButton.hide();
}
} else {
if (mFloatingActionButton.getVisibility() != View.VISIBLE) {
mFloatingActionButton.show();
}
}
}
}
} } | public class class_name {
private void enhanceFAB(final FloatingActionButton fab, int dx, int dy) {
if (isEnhancedFAB() && getFab() != null) {
final FloatingActionButton mFloatingActionButton = this.fab;
if (getLinearLayoutManager() != null) {
if (dy > 0) {
if (mFloatingActionButton.getVisibility() == View.VISIBLE) {
mFloatingActionButton.hide(); // depends on control dependency: [if], data = [none]
}
} else {
if (mFloatingActionButton.getVisibility() != View.VISIBLE) {
mFloatingActionButton.show(); // depends on control dependency: [if], data = [none]
}
}
}
}
} } |
public class class_name {
public static Double getDiskUsage() {
if (!OSInfo.isLinux() && !OSInfo.isMac()) {
return 0.0;
}
try {
String output = SystemOperation.exec("df -h " + duHome);
if (output != null) {
String[] lines = output.split("[\\r\\n]+");
if (lines.length >= 2) {
String[] parts = lines[1].split("\\s+");
if (parts.length >= 5) {
String pct = parts[4];
if (pct.endsWith("%")) {
return Integer.valueOf(pct.substring(0, pct.length() - 1)) / 100.0;
}
}
}
}
} catch (Exception e) {
LOG.warn("failed to get disk usage.");
}
return 0.0;
} } | public class class_name {
public static Double getDiskUsage() {
if (!OSInfo.isLinux() && !OSInfo.isMac()) {
return 0.0; // depends on control dependency: [if], data = [none]
}
try {
String output = SystemOperation.exec("df -h " + duHome);
if (output != null) {
String[] lines = output.split("[\\r\\n]+");
if (lines.length >= 2) {
String[] parts = lines[1].split("\\s+");
if (parts.length >= 5) {
String pct = parts[4];
if (pct.endsWith("%")) {
return Integer.valueOf(pct.substring(0, pct.length() - 1)) / 100.0; // depends on control dependency: [if], data = [none]
}
}
}
}
} catch (Exception e) {
LOG.warn("failed to get disk usage.");
} // depends on control dependency: [catch], data = [none]
return 0.0;
} } |
public class class_name {
public static Predicate suffixes(final String... paths) {
if(paths.length == 1) {
return suffix(paths[0]);
}
final PathSuffixPredicate[] predicates = new PathSuffixPredicate[paths.length];
for (int i = 0; i < paths.length; ++i) {
predicates[i] = new PathSuffixPredicate(paths[i]);
}
return or(predicates);
} } | public class class_name {
public static Predicate suffixes(final String... paths) {
if(paths.length == 1) {
return suffix(paths[0]); // depends on control dependency: [if], data = [none]
}
final PathSuffixPredicate[] predicates = new PathSuffixPredicate[paths.length];
for (int i = 0; i < paths.length; ++i) {
predicates[i] = new PathSuffixPredicate(paths[i]); // depends on control dependency: [for], data = [i]
}
return or(predicates);
} } |
public class class_name {
public static List<Annotation> loadDAOGeneratorAnnotations(Field field) {
// Liste des annotations retrouvees
List<Annotation> daoAnnotations = new ArrayList<Annotation>();
// Si l'objet est null
if(field == null) {
// On retourne une liste vide
return daoAnnotations;
}
// Obtention des annotations de la classe
Annotation[] objectAnnotations = field.getDeclaredAnnotations();
// Si le tableau est vide
if(objectAnnotations == null || objectAnnotations.length == 0) {
// On retourne une liste vide
return daoAnnotations;
}
// Parcours
for (Annotation annotation : objectAnnotations) {
// Si c'est une annotation du Framework
if(isDAOGeneratorAnnotation(annotation)) {
// On ajoute l'annotation
daoAnnotations.add(annotation);
}
}
// On retourne la liste
return daoAnnotations;
} } | public class class_name {
public static List<Annotation> loadDAOGeneratorAnnotations(Field field) {
// Liste des annotations retrouvees
List<Annotation> daoAnnotations = new ArrayList<Annotation>();
// Si l'objet est null
if(field == null) {
// On retourne une liste vide
return daoAnnotations;
// depends on control dependency: [if], data = [none]
}
// Obtention des annotations de la classe
Annotation[] objectAnnotations = field.getDeclaredAnnotations();
// Si le tableau est vide
if(objectAnnotations == null || objectAnnotations.length == 0) {
// On retourne une liste vide
return daoAnnotations;
// depends on control dependency: [if], data = [none]
}
// Parcours
for (Annotation annotation : objectAnnotations) {
// Si c'est une annotation du Framework
if(isDAOGeneratorAnnotation(annotation)) {
// On ajoute l'annotation
daoAnnotations.add(annotation);
// depends on control dependency: [if], data = [none]
}
}
// On retourne la liste
return daoAnnotations;
} } |
public class class_name {
private void zzScanError(int errorCode) {
String message;
try {
message = ZZ_ERROR_MSG[errorCode];
}
catch (ArrayIndexOutOfBoundsException e) {
message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR];
}
throw new Error(message);
} } | public class class_name {
private void zzScanError(int errorCode) {
String message;
try {
message = ZZ_ERROR_MSG[errorCode];
// depends on control dependency: [try], data = [none]
}
catch (ArrayIndexOutOfBoundsException e) {
message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR];
}
// depends on control dependency: [catch], data = [none]
throw new Error(message);
} } |
public class class_name {
public static Expression attributeValue(Data data, TagLibTag tag, String type, boolean parseExpression, boolean isNonName, Expression noExpression) throws TemplateException {
Expression expr;
try {
ExprTransformer transfomer = null;
if (parseExpression) {
transfomer = tag.getTagLib().getExprTransfomer();
}
else {
if (data.getSimpleExprTransformer() == null) {
data.setSimpleExprTransformer(new SimpleExprTransformer('#'));
// set.setSpecialChar();
}
transfomer = data.getSimpleExprTransformer();
}
if (isNonName) {
int pos = data.srcCode.getPos();
try {
expr = transfomer.transform(data);
}
catch (TemplateException ete) {
if (data.srcCode.getPos() == pos) expr = noExpression;
else throw ete;
}
}
else {
if (data.settings.handleUnQuotedAttrValueAsString) {
boolean alt = data.allowLowerThan;
data.allowLowerThan = true;
try {
expr = transfomer.transformAsString(data);
}
finally {
data.allowLowerThan = alt;
}
}
else expr = transfomer.transform(data);
}
if (type.length() > 0) {
expr = data.factory.toExpression(expr, type);
}
}
catch (TagLibException e) {
throw new TemplateException(data.srcCode, e);
}
return expr;
} } | public class class_name {
public static Expression attributeValue(Data data, TagLibTag tag, String type, boolean parseExpression, boolean isNonName, Expression noExpression) throws TemplateException {
Expression expr;
try {
ExprTransformer transfomer = null;
if (parseExpression) {
transfomer = tag.getTagLib().getExprTransfomer(); // depends on control dependency: [if], data = [none]
}
else {
if (data.getSimpleExprTransformer() == null) {
data.setSimpleExprTransformer(new SimpleExprTransformer('#')); // depends on control dependency: [if], data = [none]
// set.setSpecialChar();
}
transfomer = data.getSimpleExprTransformer(); // depends on control dependency: [if], data = [none]
}
if (isNonName) {
int pos = data.srcCode.getPos();
try {
expr = transfomer.transform(data); // depends on control dependency: [try], data = [none]
}
catch (TemplateException ete) {
if (data.srcCode.getPos() == pos) expr = noExpression;
else throw ete;
} // depends on control dependency: [catch], data = [none]
}
else {
if (data.settings.handleUnQuotedAttrValueAsString) {
boolean alt = data.allowLowerThan;
data.allowLowerThan = true; // depends on control dependency: [if], data = [none]
try {
expr = transfomer.transformAsString(data); // depends on control dependency: [try], data = [none]
}
finally {
data.allowLowerThan = alt;
}
}
else expr = transfomer.transform(data);
}
if (type.length() > 0) {
expr = data.factory.toExpression(expr, type); // depends on control dependency: [if], data = [none]
}
}
catch (TagLibException e) {
throw new TemplateException(data.srcCode, e);
}
return expr;
} } |
public class class_name {
@SuppressWarnings("PMD.GuardLogStatementJavaUtil")
@Override
public final void create(final Events event, final String userId) {
Validate.notNull(event, "The validated object 'event' is null");
Validate.notBlank(userId, "The validated character sequence 'userId' is null or empty");
// PMD does not recognize the guarded log statement
if (LOG.isInfoEnabled()) {
LOG.info("[MESSAGEQ] " + event.getValue() + ". User ID '" + userId);
}
} } | public class class_name {
@SuppressWarnings("PMD.GuardLogStatementJavaUtil")
@Override
public final void create(final Events event, final String userId) {
Validate.notNull(event, "The validated object 'event' is null");
Validate.notBlank(userId, "The validated character sequence 'userId' is null or empty");
// PMD does not recognize the guarded log statement
if (LOG.isInfoEnabled()) {
LOG.info("[MESSAGEQ] " + event.getValue() + ". User ID '" + userId); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void calcOffset(Container compAnchor, Point offset)
{
offset.x = 0;
offset.y = 0;
Container parent = this;
while (parent != null)
{
offset.x -= parent.getLocation().x;
offset.y -= parent.getLocation().y;
parent = parent.getParent();
if (parent == compAnchor)
return; // Success
}
// Failure - comp not found.
offset.x = 0;
offset.y = 0;
} } | public class class_name {
public void calcOffset(Container compAnchor, Point offset)
{
offset.x = 0;
offset.y = 0;
Container parent = this;
while (parent != null)
{
offset.x -= parent.getLocation().x; // depends on control dependency: [while], data = [none]
offset.y -= parent.getLocation().y; // depends on control dependency: [while], data = [none]
parent = parent.getParent(); // depends on control dependency: [while], data = [none]
if (parent == compAnchor)
return; // Success
}
// Failure - comp not found.
offset.x = 0;
offset.y = 0;
} } |
public class class_name {
public void setBarBorderColor(final Color COLOR) {
if (null == barBorderColor) {
_barBorderColor = null == COLOR ? Color.TRANSPARENT : COLOR;
fireUpdateEvent(REDRAW_EVENT);
} else {
barBorderColor.set(COLOR);
}
} } | public class class_name {
public void setBarBorderColor(final Color COLOR) {
if (null == barBorderColor) {
_barBorderColor = null == COLOR ? Color.TRANSPARENT : COLOR; // depends on control dependency: [if], data = [none]
fireUpdateEvent(REDRAW_EVENT); // depends on control dependency: [if], data = [none]
} else {
barBorderColor.set(COLOR); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public EClass getIfcStructuredDimensionCallout() {
if (ifcStructuredDimensionCalloutEClass == null) {
ifcStructuredDimensionCalloutEClass = (EClass) EPackage.Registry.INSTANCE
.getEPackage(Ifc2x3tc1Package.eNS_URI).getEClassifiers().get(568);
}
return ifcStructuredDimensionCalloutEClass;
} } | public class class_name {
public EClass getIfcStructuredDimensionCallout() {
if (ifcStructuredDimensionCalloutEClass == null) {
ifcStructuredDimensionCalloutEClass = (EClass) EPackage.Registry.INSTANCE
.getEPackage(Ifc2x3tc1Package.eNS_URI).getEClassifiers().get(568);
// depends on control dependency: [if], data = [none]
}
return ifcStructuredDimensionCalloutEClass;
} } |
public class class_name {
public static <T extends Enum<T> & HeaderKey> Map<T, StandardField> readHeaderEntries(
Class<T> clazz, SpecificationFormat specFormat,
List<String[]> specification, byte[] headerbytes, long headerOffset) {
assert clazz != null && specFormat != null && headerbytes != null;
/* initializers */
// init a full map with default fields. Fields that can be read are
// changed subsequently
Map<T, StandardField> data = initFullEnumMap(clazz);
// use the specification format to get the right indices
int descriptionIndex = specFormat.description;
int offsetIndex = specFormat.offset;
int lengthIndex = specFormat.length;
int keyIndex = specFormat.key;
// loop through every line in the specification, put read data to the
// map
for (String[] specs : specification) {
// get the enum type for the key string
T key = Enum.valueOf(clazz, specs[keyIndex].trim());
// read offset, length, and description, offset is relative to
// header
int offset = Integer.parseInt(specs[offsetIndex].trim());
int length = Integer.parseInt(specs[lengthIndex].trim());
String description = specs[descriptionIndex];
// get the absolute file offset for the current field
long fieldOffset = headerOffset + offset;
// check if value is entirely contained in the headerbytes
long value = 0;
if (headerbytes.length >= offset + length) {
value = getBytesLongValue(headerbytes, offset, length);
data.put(key, new StandardField(key, description, value,
fieldOffset, length));
} else {
// value not entirely contained in array, so use a safe method
// to fetch it
value = getBytesLongValueSafely(headerbytes, offset, length);
// ... and print a warning message
logger.warn("offset + length larger than headerbytes given");
}
// add data to map
data.put(key, new StandardField(key, description, value,
fieldOffset, length));
}
assert data != null;
return data;
} } | public class class_name {
public static <T extends Enum<T> & HeaderKey> Map<T, StandardField> readHeaderEntries(
Class<T> clazz, SpecificationFormat specFormat,
List<String[]> specification, byte[] headerbytes, long headerOffset) {
assert clazz != null && specFormat != null && headerbytes != null;
/* initializers */
// init a full map with default fields. Fields that can be read are
// changed subsequently
Map<T, StandardField> data = initFullEnumMap(clazz);
// use the specification format to get the right indices
int descriptionIndex = specFormat.description;
int offsetIndex = specFormat.offset;
int lengthIndex = specFormat.length;
int keyIndex = specFormat.key;
// loop through every line in the specification, put read data to the
// map
for (String[] specs : specification) {
// get the enum type for the key string
T key = Enum.valueOf(clazz, specs[keyIndex].trim());
// read offset, length, and description, offset is relative to
// header
int offset = Integer.parseInt(specs[offsetIndex].trim());
int length = Integer.parseInt(specs[lengthIndex].trim());
String description = specs[descriptionIndex];
// get the absolute file offset for the current field
long fieldOffset = headerOffset + offset;
// check if value is entirely contained in the headerbytes
long value = 0;
if (headerbytes.length >= offset + length) {
value = getBytesLongValue(headerbytes, offset, length); // depends on control dependency: [if], data = [none]
data.put(key, new StandardField(key, description, value,
fieldOffset, length)); // depends on control dependency: [if], data = [none]
} else {
// value not entirely contained in array, so use a safe method
// to fetch it
value = getBytesLongValueSafely(headerbytes, offset, length); // depends on control dependency: [if], data = [none]
// ... and print a warning message
logger.warn("offset + length larger than headerbytes given"); // depends on control dependency: [if], data = [none]
}
// add data to map
data.put(key, new StandardField(key, description, value,
fieldOffset, length)); // depends on control dependency: [for], data = [none]
}
assert data != null;
return data;
} } |
public class class_name {
protected void collectQueryParameters(HttpRequest request, HttpParameters out) {
String url = request.getRequestUrl();
int q = url.indexOf('?');
if (q >= 0) {
// Combine the URL query string with the other parameters:
out.putAll(OAuth.decodeForm(url.substring(q + 1)), true);
}
} } | public class class_name {
protected void collectQueryParameters(HttpRequest request, HttpParameters out) {
String url = request.getRequestUrl();
int q = url.indexOf('?');
if (q >= 0) {
// Combine the URL query string with the other parameters:
out.putAll(OAuth.decodeForm(url.substring(q + 1)), true); // depends on control dependency: [if], data = [(q]
}
} } |
public class class_name {
private static String mapUDTagSetToKaf(final String postag) {
if (postag.equalsIgnoreCase("ADV")) {
return "A"; // adverb
} else if (postag.equalsIgnoreCase("CONJ") || postag.equalsIgnoreCase("SCONJ")) {
return "C"; // conjunction
} else if (postag.equalsIgnoreCase("DET")) {
return "D"; // det predeterminer
} else if (postag.equalsIgnoreCase("ADJ")) {
return "G"; // adjective
} else if (postag.equalsIgnoreCase("NOUN")) {
return "N"; // common noun
} else if (postag.equalsIgnoreCase("PROPN")) {
return "R"; // proper noun
} else if (postag.equalsIgnoreCase("ADP")) {
return "P"; // preposition
} else if (postag.equalsIgnoreCase("PRON")) {
return "Q"; // pronoun
} else if (postag.startsWith("V")) {
return "V"; // verb
} else {
return "O"; // other
}
} } | public class class_name {
private static String mapUDTagSetToKaf(final String postag) {
if (postag.equalsIgnoreCase("ADV")) {
return "A"; // adverb // depends on control dependency: [if], data = [none]
} else if (postag.equalsIgnoreCase("CONJ") || postag.equalsIgnoreCase("SCONJ")) {
return "C"; // conjunction // depends on control dependency: [if], data = [none]
} else if (postag.equalsIgnoreCase("DET")) {
return "D"; // det predeterminer // depends on control dependency: [if], data = [none]
} else if (postag.equalsIgnoreCase("ADJ")) {
return "G"; // adjective // depends on control dependency: [if], data = [none]
} else if (postag.equalsIgnoreCase("NOUN")) {
return "N"; // common noun // depends on control dependency: [if], data = [none]
} else if (postag.equalsIgnoreCase("PROPN")) {
return "R"; // proper noun // depends on control dependency: [if], data = [none]
} else if (postag.equalsIgnoreCase("ADP")) {
return "P"; // preposition // depends on control dependency: [if], data = [none]
} else if (postag.equalsIgnoreCase("PRON")) {
return "Q"; // pronoun // depends on control dependency: [if], data = [none]
} else if (postag.startsWith("V")) {
return "V"; // verb // depends on control dependency: [if], data = [none]
} else {
return "O"; // other // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public @Nullable T invoke(@NotNull Object... args) {
checkNotNull(args);
Method method = target();
boolean accessible = method.isAccessible();
try {
makeAccessible(method);
Object returnValue = method.invoke(target, args);
return castSafely(returnValue, checkNotNull(returnType));
} catch (Throwable t) {
Throwable cause = targetOf(t);
if (cause instanceof RuntimeException) {
throw (RuntimeException) cause;
}
String format = "Unable to invoke method %s with arguments %s";
throw new ReflectionError(String.format(format, quote(method.getName()), format(args)), cause);
} finally {
setAccessibleIgnoringExceptions(method, accessible);
}
} } | public class class_name {
public @Nullable T invoke(@NotNull Object... args) {
checkNotNull(args);
Method method = target();
boolean accessible = method.isAccessible();
try {
makeAccessible(method); // depends on control dependency: [try], data = [none]
Object returnValue = method.invoke(target, args);
return castSafely(returnValue, checkNotNull(returnType)); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
Throwable cause = targetOf(t);
if (cause instanceof RuntimeException) {
throw (RuntimeException) cause;
}
String format = "Unable to invoke method %s with arguments %s";
throw new ReflectionError(String.format(format, quote(method.getName()), format(args)), cause);
} finally { // depends on control dependency: [catch], data = [none]
setAccessibleIgnoringExceptions(method, accessible);
}
} } |
public class class_name {
protected Future<T> addToListeners(
final GenericCompletionListener<? extends Future<T>> listener) {
if (listener == null) {
throw new IllegalArgumentException("The listener can't be null.");
}
synchronized(this) {
listeners.add(listener);
}
if(isDone()) {
notifyListeners();
}
return this;
} } | public class class_name {
protected Future<T> addToListeners(
final GenericCompletionListener<? extends Future<T>> listener) {
if (listener == null) {
throw new IllegalArgumentException("The listener can't be null.");
}
synchronized(this) {
listeners.add(listener);
}
if(isDone()) {
notifyListeners(); // depends on control dependency: [if], data = [none]
}
return this;
} } |
public class class_name {
private void activateFirstOnlyAliasOfKeyStore(int ksIndex) {
if (ksIndex < 0 || ksIndex >= keyStoreList.getModel().getSize()) {
return;
}
keyStoreList.setSelectedIndex(ksIndex);
if (aliasTable.getRowCount() != 0) {
aliasTable.setRowSelectionInterval(0, 0);
if (aliasTable.getRowCount() == 1 && !isCertActive()) {
setActiveAction();
}
}
} } | public class class_name {
private void activateFirstOnlyAliasOfKeyStore(int ksIndex) {
if (ksIndex < 0 || ksIndex >= keyStoreList.getModel().getSize()) {
return;
// depends on control dependency: [if], data = [none]
}
keyStoreList.setSelectedIndex(ksIndex);
if (aliasTable.getRowCount() != 0) {
aliasTable.setRowSelectionInterval(0, 0);
// depends on control dependency: [if], data = [0)]
if (aliasTable.getRowCount() == 1 && !isCertActive()) {
setActiveAction();
// depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public boolean cancel(boolean setFlag) {
final AtomicInteger stateRef = this.stateRef;
int oldVal, newVal;
do {
oldVal = stateRef.get();
if (oldVal == ST_WAITING) {
newVal = ST_CANCELLED;
} else if (oldVal == ST_CANCELLED) {
if (! setFlag) {
return true;
}
newVal = ST_CANCELLED_FLAG_SET;
} else if (oldVal == ST_CANCELLED_FLAG_SET) {
// do nothing
return true;
} else if (oldVal == ST_STARTED) {
if (! setFlag) {
return false;
}
newVal = ST_STARTED_FLAG_SET;
} else {
assert oldVal == ST_STARTED_FLAG_SET;
return false;
}
} while (! stateRef.compareAndSet(oldVal, newVal));
return newVal == ST_CANCELLED || newVal == ST_CANCELLED_FLAG_SET;
} } | public class class_name {
public boolean cancel(boolean setFlag) {
final AtomicInteger stateRef = this.stateRef;
int oldVal, newVal;
do {
oldVal = stateRef.get();
if (oldVal == ST_WAITING) {
newVal = ST_CANCELLED; // depends on control dependency: [if], data = [none]
} else if (oldVal == ST_CANCELLED) {
if (! setFlag) {
return true; // depends on control dependency: [if], data = [none]
}
newVal = ST_CANCELLED_FLAG_SET; // depends on control dependency: [if], data = [none]
} else if (oldVal == ST_CANCELLED_FLAG_SET) {
// do nothing
return true; // depends on control dependency: [if], data = [none]
} else if (oldVal == ST_STARTED) {
if (! setFlag) {
return false; // depends on control dependency: [if], data = [none]
}
newVal = ST_STARTED_FLAG_SET; // depends on control dependency: [if], data = [none]
} else {
assert oldVal == ST_STARTED_FLAG_SET;
return false; // depends on control dependency: [if], data = [none]
}
} while (! stateRef.compareAndSet(oldVal, newVal));
return newVal == ST_CANCELLED || newVal == ST_CANCELLED_FLAG_SET;
} } |
public class class_name {
public boolean collectionExists(final String collectionName) {
Set<String> collectionNames = getCollectionNames();
for (final String name : collectionNames) {
if (name.equalsIgnoreCase(collectionName)) {
return true;
}
}
return false;
} } | public class class_name {
public boolean collectionExists(final String collectionName) {
Set<String> collectionNames = getCollectionNames();
for (final String name : collectionNames) {
if (name.equalsIgnoreCase(collectionName)) {
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
} } |
public class class_name {
int readReferenceOrNull (Input input, Class type, boolean mayBeNull) {
if (type.isPrimitive()) type = getWrapperClass(type);
boolean referencesSupported = referenceResolver.useReferences(type);
int id;
if (mayBeNull) {
id = input.readVarInt(true);
if (id == NULL) {
if (TRACE || (DEBUG && depth == 1)) log("Read", null, input.position());
readObject = null;
return REF;
}
if (!referencesSupported) {
readReferenceIds.add(NO_REF);
return readReferenceIds.size;
}
} else {
if (!referencesSupported) {
readReferenceIds.add(NO_REF);
return readReferenceIds.size;
}
id = input.readVarInt(true);
}
if (id == NOT_NULL) {
if (TRACE) trace("kryo", "Read: <not null>" + pos(input.position()));
// First time object has been encountered.
id = referenceResolver.nextReadId(type);
if (TRACE) trace("kryo", "Read initial reference " + id + ": " + className(type) + pos(input.position()));
readReferenceIds.add(id);
return readReferenceIds.size;
}
// The id is an object reference.
id -= 2; // - 2 because 0 and 1 are used for NULL and NOT_NULL.
readObject = referenceResolver.getReadObject(type, id);
if (DEBUG) debug("kryo", "Read reference " + id + ": " + string(readObject) + pos(input.position()));
return REF;
} } | public class class_name {
int readReferenceOrNull (Input input, Class type, boolean mayBeNull) {
if (type.isPrimitive()) type = getWrapperClass(type);
boolean referencesSupported = referenceResolver.useReferences(type);
int id;
if (mayBeNull) {
id = input.readVarInt(true);
// depends on control dependency: [if], data = [none]
if (id == NULL) {
if (TRACE || (DEBUG && depth == 1)) log("Read", null, input.position());
readObject = null;
// depends on control dependency: [if], data = [none]
return REF;
// depends on control dependency: [if], data = [none]
}
if (!referencesSupported) {
readReferenceIds.add(NO_REF);
// depends on control dependency: [if], data = [none]
return readReferenceIds.size;
// depends on control dependency: [if], data = [none]
}
} else {
if (!referencesSupported) {
readReferenceIds.add(NO_REF);
// depends on control dependency: [if], data = [none]
return readReferenceIds.size;
// depends on control dependency: [if], data = [none]
}
id = input.readVarInt(true);
// depends on control dependency: [if], data = [none]
}
if (id == NOT_NULL) {
if (TRACE) trace("kryo", "Read: <not null>" + pos(input.position()));
// First time object has been encountered.
id = referenceResolver.nextReadId(type);
// depends on control dependency: [if], data = [none]
if (TRACE) trace("kryo", "Read initial reference " + id + ": " + className(type) + pos(input.position()));
readReferenceIds.add(id);
// depends on control dependency: [if], data = [(id]
return readReferenceIds.size;
// depends on control dependency: [if], data = [none]
}
// The id is an object reference.
id -= 2; // - 2 because 0 and 1 are used for NULL and NOT_NULL.
readObject = referenceResolver.getReadObject(type, id);
if (DEBUG) debug("kryo", "Read reference " + id + ": " + string(readObject) + pos(input.position()));
return REF;
} } |
public class class_name {
public static byte[] stringUToByteArr(String s) {
char c;
byte[] b = new byte[2 * s.length()];
for (int i = 0; i < s.length(); i++) {
c = s.charAt(i);
b[2 * i + 1] = (byte) c;
b[2 * i] = (byte) (c >> 8);
}
return b;
} } | public class class_name {
public static byte[] stringUToByteArr(String s) {
char c;
byte[] b = new byte[2 * s.length()];
for (int i = 0; i < s.length(); i++) {
c = s.charAt(i);
// depends on control dependency: [for], data = [i]
b[2 * i + 1] = (byte) c;
// depends on control dependency: [for], data = [i]
b[2 * i] = (byte) (c >> 8);
// depends on control dependency: [for], data = [i]
}
return b;
} } |
public class class_name {
public void marshall(Radios radios, ProtocolMarshaller protocolMarshaller) {
if (radios == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(radios.getWifi(), WIFI_BINDING);
protocolMarshaller.marshall(radios.getBluetooth(), BLUETOOTH_BINDING);
protocolMarshaller.marshall(radios.getNfc(), NFC_BINDING);
protocolMarshaller.marshall(radios.getGps(), GPS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(Radios radios, ProtocolMarshaller protocolMarshaller) {
if (radios == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(radios.getWifi(), WIFI_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(radios.getBluetooth(), BLUETOOTH_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(radios.getNfc(), NFC_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(radios.getGps(), GPS_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void marshall(CreateDirectoryRequest createDirectoryRequest, ProtocolMarshaller protocolMarshaller) {
if (createDirectoryRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(createDirectoryRequest.getName(), NAME_BINDING);
protocolMarshaller.marshall(createDirectoryRequest.getSchemaArn(), SCHEMAARN_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(CreateDirectoryRequest createDirectoryRequest, ProtocolMarshaller protocolMarshaller) {
if (createDirectoryRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(createDirectoryRequest.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createDirectoryRequest.getSchemaArn(), SCHEMAARN_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
public Collection<Event> findEvents(SearchCriteria criteria) {
ensureInitialized();
Preconditions.checkNotNull(criteria, "criteria must be non-null");
Collection<Event> matches = new ArrayList<>();
User user = criteria.getUser();
DetectionPoint detectionPoint = criteria.getDetectionPoint();
Rule rule = criteria.getRule();
Collection<String> detectionSystemIds = criteria.getDetectionSystemIds();
DateTime earliest = DateUtils.fromString(criteria.getEarliest());
String influxQL = Utils.constructInfluxQL(Utils.EVENTS, user,
detectionPoint, null,
detectionSystemIds,
earliest,
Utils.QueryMode.IGNORE_THRESHOLDS);
if (rule != null) {
influxQL += " AND (";
int i = 0;
for (DetectionPoint point : rule.getAllDetectionPoints()) {
influxQL += (i == 0) ? "" : " OR ";
influxQL += "(";
influxQL += Utils.constructDetectionPointSqlString(point, Utils.QueryMode.IGNORE_THRESHOLDS);
influxQL += ")";
i++;
}
influxQL += ")";
}
Query query = new Query(influxQL, Utils.DATABASE);
QueryResult results = influxDB.query(query);
for(QueryResult.Result result : results.getResults()) {
if(result == null || result.getSeries() == null) {
continue;
}
for(QueryResult.Series series : result.getSeries()) {
if(series == null || series.getValues() == null) {
continue;
}
for(List<Object> record : series.getValues()) {
if(record == null) {
continue;
}
matches.add( gson.fromJson( Utils.getValue(Utils.JSON_CONTENT, series, record), Event.class ) );
}
}
}
return matches;
} } | public class class_name {
@Override
public Collection<Event> findEvents(SearchCriteria criteria) {
ensureInitialized();
Preconditions.checkNotNull(criteria, "criteria must be non-null");
Collection<Event> matches = new ArrayList<>();
User user = criteria.getUser();
DetectionPoint detectionPoint = criteria.getDetectionPoint();
Rule rule = criteria.getRule();
Collection<String> detectionSystemIds = criteria.getDetectionSystemIds();
DateTime earliest = DateUtils.fromString(criteria.getEarliest());
String influxQL = Utils.constructInfluxQL(Utils.EVENTS, user,
detectionPoint, null,
detectionSystemIds,
earliest,
Utils.QueryMode.IGNORE_THRESHOLDS);
if (rule != null) {
influxQL += " AND ("; // depends on control dependency: [if], data = [none]
int i = 0;
for (DetectionPoint point : rule.getAllDetectionPoints()) {
influxQL += (i == 0) ? "" : " OR "; // depends on control dependency: [for], data = [none]
influxQL += "(";
influxQL += Utils.constructDetectionPointSqlString(point, Utils.QueryMode.IGNORE_THRESHOLDS);
influxQL += ")";
i++; // depends on control dependency: [for], data = [none]
}
influxQL += ")"; // depends on control dependency: [if], data = [none]
}
Query query = new Query(influxQL, Utils.DATABASE);
QueryResult results = influxDB.query(query);
for(QueryResult.Result result : results.getResults()) {
if(result == null || result.getSeries() == null) {
continue;
}
for(QueryResult.Series series : result.getSeries()) {
if(series == null || series.getValues() == null) {
continue;
}
for(List<Object> record : series.getValues()) {
if(record == null) {
continue;
}
matches.add( gson.fromJson( Utils.getValue(Utils.JSON_CONTENT, series, record), Event.class ) ); // depends on control dependency: [for], data = [record]
}
}
}
return matches;
} } |
public class class_name {
protected synchronized WriterPoolMember makeNewWriterIfAppropriate() {
long now = System.currentTimeMillis();
lastWriterNeededTime = now;
if(currentActive < maxActive) {
currentActive++;
lastWriterRolloverTime = now;
return makeWriter();
}
return null;
} } | public class class_name {
protected synchronized WriterPoolMember makeNewWriterIfAppropriate() {
long now = System.currentTimeMillis();
lastWriterNeededTime = now;
if(currentActive < maxActive) {
currentActive++; // depends on control dependency: [if], data = [none]
lastWriterRolloverTime = now; // depends on control dependency: [if], data = [none]
return makeWriter(); // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
void computeSyndromes( GrowQueue_I8 input ,
GrowQueue_I8 ecc ,
GrowQueue_I8 syndromes)
{
syndromes.resize(syndromeLength());
for (int i = 0; i < syndromes.size; i++) {
int val = math.power(2,i);
syndromes.data[i] = (byte)math.polyEval(input,val);
syndromes.data[i] = (byte)math.polyEvalContinue(syndromes.data[i]&0xFF,ecc,val);
}
} } | public class class_name {
void computeSyndromes( GrowQueue_I8 input ,
GrowQueue_I8 ecc ,
GrowQueue_I8 syndromes)
{
syndromes.resize(syndromeLength());
for (int i = 0; i < syndromes.size; i++) {
int val = math.power(2,i);
syndromes.data[i] = (byte)math.polyEval(input,val); // depends on control dependency: [for], data = [i]
syndromes.data[i] = (byte)math.polyEvalContinue(syndromes.data[i]&0xFF,ecc,val); // depends on control dependency: [for], data = [i]
}
} } |
public class class_name {
public static JedisCluster newJedisCluster(String hostsAndPorts, String password,
long timeoutMs) {
final int maxTotal = Runtime.getRuntime().availableProcessors();
final int maxIdle = maxTotal / 2;
JedisPoolConfig poolConfig = new JedisPoolConfig();
poolConfig.setMaxTotal(maxTotal);
poolConfig.setMinIdle(1);
poolConfig.setMaxIdle(maxIdle > 0 ? maxIdle : 1);
poolConfig.setMaxWaitMillis(timeoutMs + 1000);
// poolConfig.setTestOnBorrow(true);
poolConfig.setTestWhileIdle(true);
Set<HostAndPort> clusterNodes = new HashSet<>();
String[] hapList = hostsAndPorts.split("[,;\\s]+");
for (String hostAndPort : hapList) {
String[] tokens = hostAndPort.split(":");
String host = tokens.length > 0 ? tokens[0] : Protocol.DEFAULT_HOST;
int port = tokens.length > 1 ? Integer.parseInt(tokens[1]) : Protocol.DEFAULT_PORT;
clusterNodes.add(new HostAndPort(host, port));
}
JedisCluster jedisCluster = new JedisCluster(clusterNodes, (int) timeoutMs, (int) timeoutMs,
DEFAULT_MAX_ATTEMPTS, password, poolConfig);
return jedisCluster;
} } | public class class_name {
public static JedisCluster newJedisCluster(String hostsAndPorts, String password,
long timeoutMs) {
final int maxTotal = Runtime.getRuntime().availableProcessors();
final int maxIdle = maxTotal / 2;
JedisPoolConfig poolConfig = new JedisPoolConfig();
poolConfig.setMaxTotal(maxTotal);
poolConfig.setMinIdle(1);
poolConfig.setMaxIdle(maxIdle > 0 ? maxIdle : 1);
poolConfig.setMaxWaitMillis(timeoutMs + 1000);
// poolConfig.setTestOnBorrow(true);
poolConfig.setTestWhileIdle(true);
Set<HostAndPort> clusterNodes = new HashSet<>();
String[] hapList = hostsAndPorts.split("[,;\\s]+");
for (String hostAndPort : hapList) {
String[] tokens = hostAndPort.split(":");
String host = tokens.length > 0 ? tokens[0] : Protocol.DEFAULT_HOST;
int port = tokens.length > 1 ? Integer.parseInt(tokens[1]) : Protocol.DEFAULT_PORT;
clusterNodes.add(new HostAndPort(host, port)); // depends on control dependency: [for], data = [none]
}
JedisCluster jedisCluster = new JedisCluster(clusterNodes, (int) timeoutMs, (int) timeoutMs,
DEFAULT_MAX_ATTEMPTS, password, poolConfig);
return jedisCluster;
} } |
public class class_name {
private V replaceNoCopyOrAwait(K key, V value) {
requireNonNull(value);
V copy = copyOf(value);
@SuppressWarnings("unchecked")
V[] replaced = (V[]) new Object[1];
cache.asMap().computeIfPresent(key, (k, expirable) -> {
if (!expirable.isEternal() && expirable.hasExpired(currentTimeMillis())) {
dispatcher.publishExpired(this, key, expirable.get());
statistics.recordEvictions(1L);
return null;
}
publishToCacheWriter(writer::write, () -> new EntryProxy<>(key, value));
long expireTimeMS = getWriteExpireTimeMS(/* created */ false);
if (expireTimeMS == Long.MIN_VALUE) {
expireTimeMS = expirable.getExpireTimeMS();
}
dispatcher.publishUpdated(this, key, expirable.get(), copy);
replaced[0] = expirable.get();
return new Expirable<>(copy, expireTimeMS);
});
return replaced[0];
} } | public class class_name {
private V replaceNoCopyOrAwait(K key, V value) {
requireNonNull(value);
V copy = copyOf(value);
@SuppressWarnings("unchecked")
V[] replaced = (V[]) new Object[1];
cache.asMap().computeIfPresent(key, (k, expirable) -> {
if (!expirable.isEternal() && expirable.hasExpired(currentTimeMillis())) {
dispatcher.publishExpired(this, key, expirable.get()); // depends on control dependency: [if], data = [none]
statistics.recordEvictions(1L); // depends on control dependency: [if], data = [none]
return null; // depends on control dependency: [if], data = [none]
}
publishToCacheWriter(writer::write, () -> new EntryProxy<>(key, value));
long expireTimeMS = getWriteExpireTimeMS(/* created */ false);
if (expireTimeMS == Long.MIN_VALUE) {
expireTimeMS = expirable.getExpireTimeMS(); // depends on control dependency: [if], data = [none]
}
dispatcher.publishUpdated(this, key, expirable.get(), copy);
replaced[0] = expirable.get();
return new Expirable<>(copy, expireTimeMS);
});
return replaced[0];
} } |
public class class_name {
@Override
public synchronized void processConnect(WebSocketChannel channel, WSURI uri, String[] protocols) {
LOG.entering(CLASS_NAME, "processConnect", new Object[] { uri, protocols });
try {
WebSocketNativeChannel nativeChannel = (WebSocketNativeChannel)channel;
if (nativeChannel.getProxy() != null) {
throw new IllegalStateException("Bridge proxy previously set");
}
Proxy proxy = BridgeUtil.createProxy(uri.getURI(), this);
proxy.setPeer(channel);
nativeChannel.setProxy(proxy);
String[] params;
if (protocols != null) {
String s = "";
for (int i=0; i<protocols.length; i++) {
if (i>0) {
s += ",";
}
s += protocols[i];
}
params = new String[] { "WEBSOCKET", uri.toString(), s, ""};
} else {
params = new String[] { "WEBSOCKET", uri.toString() };
}
proxy.processEvent(XoaEventKind.CREATE, params);
}
catch (Exception e) {
LOG.log(Level.FINE, "While initializing WebSocket proxy: "+e.getMessage(), e);
listener.connectionFailed(channel, e);
}
} } | public class class_name {
@Override
public synchronized void processConnect(WebSocketChannel channel, WSURI uri, String[] protocols) {
LOG.entering(CLASS_NAME, "processConnect", new Object[] { uri, protocols });
try {
WebSocketNativeChannel nativeChannel = (WebSocketNativeChannel)channel;
if (nativeChannel.getProxy() != null) {
throw new IllegalStateException("Bridge proxy previously set");
}
Proxy proxy = BridgeUtil.createProxy(uri.getURI(), this);
proxy.setPeer(channel); // depends on control dependency: [try], data = [none]
nativeChannel.setProxy(proxy); // depends on control dependency: [try], data = [none]
String[] params;
if (protocols != null) {
String s = "";
for (int i=0; i<protocols.length; i++) {
if (i>0) {
s += ","; // depends on control dependency: [if], data = [none]
}
s += protocols[i]; // depends on control dependency: [for], data = [i]
}
params = new String[] { "WEBSOCKET", uri.toString(), s, ""}; // depends on control dependency: [if], data = [none]
} else {
params = new String[] { "WEBSOCKET", uri.toString() }; // depends on control dependency: [if], data = [none]
}
proxy.processEvent(XoaEventKind.CREATE, params); // depends on control dependency: [try], data = [none]
}
catch (Exception e) {
LOG.log(Level.FINE, "While initializing WebSocket proxy: "+e.getMessage(), e);
listener.connectionFailed(channel, e);
} // depends on control dependency: [catch], data = [none]
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.