code stringlengths 130 281k | code_dependency stringlengths 182 306k |
|---|---|
public class class_name {
public ZMatrixRMaj getQ(ZMatrixRMaj Q ) {
Q = UtilDecompositons_ZDRM.checkIdentity(Q,N,N);
Arrays.fill(u,0,N*2,0);
for( int j = N-2; j >= 0; j-- ) {
QrHelperFunctions_ZDRM.extractHouseholderColumn(QH,j+1,N,j,u,0);
QrHelperFunctions_ZDRM.rank1UpdateMultR(Q, u, 0,gammas[j], j + 1, j + 1, N, b);
}
return Q;
} } | public class class_name {
public ZMatrixRMaj getQ(ZMatrixRMaj Q ) {
Q = UtilDecompositons_ZDRM.checkIdentity(Q,N,N);
Arrays.fill(u,0,N*2,0);
for( int j = N-2; j >= 0; j-- ) {
QrHelperFunctions_ZDRM.extractHouseholderColumn(QH,j+1,N,j,u,0); // depends on control dependency: [for], data = [j]
QrHelperFunctions_ZDRM.rank1UpdateMultR(Q, u, 0,gammas[j], j + 1, j + 1, N, b); // depends on control dependency: [for], data = [j]
}
return Q;
} } |
public class class_name {
protected void deleteExceptionByteArrayRef(TimerJobEntity jobEntity) {
ByteArrayRef exceptionByteArrayRef = jobEntity.getExceptionByteArrayRef();
if (exceptionByteArrayRef != null) {
exceptionByteArrayRef.delete();
}
} } | public class class_name {
protected void deleteExceptionByteArrayRef(TimerJobEntity jobEntity) {
ByteArrayRef exceptionByteArrayRef = jobEntity.getExceptionByteArrayRef();
if (exceptionByteArrayRef != null) {
exceptionByteArrayRef.delete(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void setResponses(java.util.Collection<BatchReadOperationResponse> responses) {
if (responses == null) {
this.responses = null;
return;
}
this.responses = new java.util.ArrayList<BatchReadOperationResponse>(responses);
} } | public class class_name {
public void setResponses(java.util.Collection<BatchReadOperationResponse> responses) {
if (responses == null) {
this.responses = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.responses = new java.util.ArrayList<BatchReadOperationResponse>(responses);
} } |
public class class_name {
public <T> T createInstance(Class<T> type) {
try {
return type.newInstance();
} catch (InstantiationException | IllegalAccessException e) {
throw new IllegalArgumentException("Cannot create instance of class " + type.getName(), e);
}
} } | public class class_name {
public <T> T createInstance(Class<T> type) {
try {
return type.newInstance(); // depends on control dependency: [try], data = [none]
} catch (InstantiationException | IllegalAccessException e) {
throw new IllegalArgumentException("Cannot create instance of class " + type.getName(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void remove(String user) {
Object o = userMap.remove(user);
if(o!=null) {
access.log(Level.INFO, user,"removed from Client Cache by Request");
}
} } | public class class_name {
public void remove(String user) {
Object o = userMap.remove(user);
if(o!=null) {
access.log(Level.INFO, user,"removed from Client Cache by Request"); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private void dctOnePlane(int blocksPerSlice, byte[] src, byte[] hibd, int[] dst) {
for (int i = 0; i < src.length; i++) {
dst[i] = ((src[i] + 128) << 2);
}
if (hibd != null) {
for (int i = 0; i < src.length; i++) {
dst[i] += hibd[i];
}
}
for (int i = 0; i < blocksPerSlice; i++) {
fdctProres10(dst, i << 6);
}
} } | public class class_name {
private void dctOnePlane(int blocksPerSlice, byte[] src, byte[] hibd, int[] dst) {
for (int i = 0; i < src.length; i++) {
dst[i] = ((src[i] + 128) << 2); // depends on control dependency: [for], data = [i]
}
if (hibd != null) {
for (int i = 0; i < src.length; i++) {
dst[i] += hibd[i]; // depends on control dependency: [for], data = [i]
}
}
for (int i = 0; i < blocksPerSlice; i++) {
fdctProres10(dst, i << 6); // depends on control dependency: [for], data = [i]
}
} } |
public class class_name {
public AttributeValue read_attribute_value(final DeviceProxy deviceProxy, final String attname)
throws DevFailed {
checkIfTango(deviceProxy, "read_attribute_value");
build_connection(deviceProxy);
AttributeValue[] attrval;
if (deviceProxy.getAttnames_array() == null) {
deviceProxy.setAttnames_array(new String[1]);
}
deviceProxy.getAttnames_array()[0] = attname;
try {
if (deviceProxy.device_2 != null) {
attrval = deviceProxy.device_2.read_attributes_2(deviceProxy.getAttnames_array(),
deviceProxy.dev_src);
} else {
attrval = deviceProxy.device.read_attributes(deviceProxy.getAttnames_array());
}
return attrval[0];
} catch (final DevFailed e) {
Except.throw_connection_failed(e, "TangoApi_CANNOT_READ_ATTRIBUTE",
"Cannot read attribute: " + attname, deviceProxy.getFull_class_name()
+ ".read_attribute()");
return null;
} catch (final Exception e) {
ApiUtilDAODefaultImpl.removePendingRepliesOfDevice(deviceProxy);
throw_dev_failed(deviceProxy, e, "device.read_attributes()", false);
return null;
}
} } | public class class_name {
public AttributeValue read_attribute_value(final DeviceProxy deviceProxy, final String attname)
throws DevFailed {
checkIfTango(deviceProxy, "read_attribute_value");
build_connection(deviceProxy);
AttributeValue[] attrval;
if (deviceProxy.getAttnames_array() == null) {
deviceProxy.setAttnames_array(new String[1]);
}
deviceProxy.getAttnames_array()[0] = attname;
try {
if (deviceProxy.device_2 != null) {
attrval = deviceProxy.device_2.read_attributes_2(deviceProxy.getAttnames_array(),
deviceProxy.dev_src); // depends on control dependency: [if], data = [none]
} else {
attrval = deviceProxy.device.read_attributes(deviceProxy.getAttnames_array()); // depends on control dependency: [if], data = [none]
}
return attrval[0];
} catch (final DevFailed e) {
Except.throw_connection_failed(e, "TangoApi_CANNOT_READ_ATTRIBUTE",
"Cannot read attribute: " + attname, deviceProxy.getFull_class_name()
+ ".read_attribute()");
return null;
} catch (final Exception e) {
ApiUtilDAODefaultImpl.removePendingRepliesOfDevice(deviceProxy);
throw_dev_failed(deviceProxy, e, "device.read_attributes()", false);
return null;
}
} } |
public class class_name {
public FaceletTaglibFunctionType<FaceletTaglibType<T>> getOrCreateFunction()
{
List<Node> nodeList = childNode.get("function");
if (nodeList != null && nodeList.size() > 0)
{
return new FaceletTaglibFunctionTypeImpl<FaceletTaglibType<T>>(this, "function", childNode, nodeList.get(0));
}
return createFunction();
} } | public class class_name {
public FaceletTaglibFunctionType<FaceletTaglibType<T>> getOrCreateFunction()
{
List<Node> nodeList = childNode.get("function");
if (nodeList != null && nodeList.size() > 0)
{
return new FaceletTaglibFunctionTypeImpl<FaceletTaglibType<T>>(this, "function", childNode, nodeList.get(0)); // depends on control dependency: [if], data = [none]
}
return createFunction();
} } |
public class class_name {
@NotNull
public OptionalLong map(@NotNull LongUnaryOperator mapper) {
if (!isPresent()) {
return empty();
}
Objects.requireNonNull(mapper);
return OptionalLong.of(mapper.applyAsLong(value));
} } | public class class_name {
@NotNull
public OptionalLong map(@NotNull LongUnaryOperator mapper) {
if (!isPresent()) {
return empty(); // depends on control dependency: [if], data = [none]
}
Objects.requireNonNull(mapper);
return OptionalLong.of(mapper.applyAsLong(value));
} } |
public class class_name {
public static Driver routingDriver( Iterable<URI> routingUris, AuthToken authToken, Config config )
{
assertRoutingUris( routingUris );
Logger log = createLogger( config );
for ( URI uri : routingUris )
{
try
{
return driver( uri, authToken, config );
}
catch ( ServiceUnavailableException e )
{
log.warn( "Unable to create routing driver for URI: " + uri, e );
}
}
throw new ServiceUnavailableException( "Failed to discover an available server" );
} } | public class class_name {
public static Driver routingDriver( Iterable<URI> routingUris, AuthToken authToken, Config config )
{
assertRoutingUris( routingUris );
Logger log = createLogger( config );
for ( URI uri : routingUris )
{
try
{
return driver( uri, authToken, config ); // depends on control dependency: [try], data = [none]
}
catch ( ServiceUnavailableException e )
{
log.warn( "Unable to create routing driver for URI: " + uri, e );
} // depends on control dependency: [catch], data = [none]
}
throw new ServiceUnavailableException( "Failed to discover an available server" );
} } |
public class class_name {
public static double[] asDoubleArray(Collection collection) {
double[] result = new double[collection.size()];
int i = 0;
for (Object c : collection) {
result[i++] = asDouble(c);
}
return result;
} } | public class class_name {
public static double[] asDoubleArray(Collection collection) {
double[] result = new double[collection.size()];
int i = 0;
for (Object c : collection) {
result[i++] = asDouble(c); // depends on control dependency: [for], data = [c]
}
return result;
} } |
public class class_name {
public static String modifier ( final String prefix, final Modifier modifier )
{
if ( modifier == null )
{
return "";
}
String value = null;
switch ( modifier )
{
case DEFAULT:
value = "default";
break;
case PRIMARY:
value = "primary";
break;
case SUCCESS:
value = "success";
break;
case INFO:
value = "info";
break;
case WARNING:
value = "warning";
break;
case DANGER:
value = "danger";
break;
case LINK:
value = "link";
break;
}
if ( value != null && prefix != null )
{
return prefix + value;
}
else
{
return value != null ? value : "";
}
} } | public class class_name {
public static String modifier ( final String prefix, final Modifier modifier )
{
if ( modifier == null )
{
return ""; // depends on control dependency: [if], data = [none]
}
String value = null;
switch ( modifier )
{
case DEFAULT:
value = "default";
break;
case PRIMARY:
value = "primary";
break;
case SUCCESS:
value = "success";
break;
case INFO:
value = "info";
break;
case WARNING:
value = "warning";
break;
case DANGER:
value = "danger";
break;
case LINK:
value = "link";
break;
}
if ( value != null && prefix != null )
{
return prefix + value; // depends on control dependency: [if], data = [none]
}
else
{
return value != null ? value : ""; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private static boolean isMatchesMethod(Method method) {
if (method.getParameterTypes().length != 1) {
return false;
}
if (method.isBridge()) {
return false;
}
return "matches".equals(method.getName());
} } | public class class_name {
private static boolean isMatchesMethod(Method method) {
if (method.getParameterTypes().length != 1) {
return false; // depends on control dependency: [if], data = [none]
}
if (method.isBridge()) {
return false; // depends on control dependency: [if], data = [none]
}
return "matches".equals(method.getName());
} } |
public class class_name {
protected JCClassDecl enumDeclaration(JCModifiers mods, Comment dc) {
int pos = token.pos;
accept(ENUM);
Name name = ident();
List<JCExpression> implementing = List.nil();
if (token.kind == IMPLEMENTS) {
nextToken();
implementing = typeList();
}
List<JCTree> defs = enumBody(name);
mods.flags |= Flags.ENUM;
JCClassDecl result = toP(F.at(pos).
ClassDef(mods, name, List.nil(),
null, implementing, defs));
attach(result, dc);
return result;
} } | public class class_name {
protected JCClassDecl enumDeclaration(JCModifiers mods, Comment dc) {
int pos = token.pos;
accept(ENUM);
Name name = ident();
List<JCExpression> implementing = List.nil();
if (token.kind == IMPLEMENTS) {
nextToken(); // depends on control dependency: [if], data = [none]
implementing = typeList(); // depends on control dependency: [if], data = [none]
}
List<JCTree> defs = enumBody(name);
mods.flags |= Flags.ENUM;
JCClassDecl result = toP(F.at(pos).
ClassDef(mods, name, List.nil(),
null, implementing, defs));
attach(result, dc);
return result;
} } |
public class class_name {
public void removeValue(V value) {
Set<K> keys = m_reverseMap.removeAll(value);
for (K key : keys) {
m_forwardMap.remove(key);
}
} } | public class class_name {
public void removeValue(V value) {
Set<K> keys = m_reverseMap.removeAll(value);
for (K key : keys) {
m_forwardMap.remove(key); // depends on control dependency: [for], data = [key]
}
} } |
public class class_name {
public SockAddr getAddr() {
SockAddr sockAddr = null;
if (this.addr != null) {
sockAddr = new SockAddr(this.addr.getSaFamily().getValue(), this.addr.getData());
}
return sockAddr;
} } | public class class_name {
public SockAddr getAddr() {
SockAddr sockAddr = null;
if (this.addr != null) {
sockAddr = new SockAddr(this.addr.getSaFamily().getValue(), this.addr.getData()); // depends on control dependency: [if], data = [(this.addr]
}
return sockAddr;
} } |
public class class_name {
public void setConnection(Connection connection, boolean csv) {
this.connection = connection;
this.csv = csv;
try {
dialect = DialectUtil.getDialect(connection);
} catch (Exception e) {
e.printStackTrace();
}
if (chart != null) {
if (chart.getReport().getQuery() != null) {
chart.getReport().getQuery().setDialect(dialect);
}
}
} } | public class class_name {
public void setConnection(Connection connection, boolean csv) {
this.connection = connection;
this.csv = csv;
try {
dialect = DialectUtil.getDialect(connection); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
if (chart != null) {
if (chart.getReport().getQuery() != null) {
chart.getReport().getQuery().setDialect(dialect); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public void marshall(CreateJobRequest createJobRequest, ProtocolMarshaller protocolMarshaller) {
if (createJobRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(createJobRequest.getAccelerationSettings(), ACCELERATIONSETTINGS_BINDING);
protocolMarshaller.marshall(createJobRequest.getBillingTagsSource(), BILLINGTAGSSOURCE_BINDING);
protocolMarshaller.marshall(createJobRequest.getClientRequestToken(), CLIENTREQUESTTOKEN_BINDING);
protocolMarshaller.marshall(createJobRequest.getJobTemplate(), JOBTEMPLATE_BINDING);
protocolMarshaller.marshall(createJobRequest.getQueue(), QUEUE_BINDING);
protocolMarshaller.marshall(createJobRequest.getRole(), ROLE_BINDING);
protocolMarshaller.marshall(createJobRequest.getSettings(), SETTINGS_BINDING);
protocolMarshaller.marshall(createJobRequest.getStatusUpdateInterval(), STATUSUPDATEINTERVAL_BINDING);
protocolMarshaller.marshall(createJobRequest.getUserMetadata(), USERMETADATA_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(CreateJobRequest createJobRequest, ProtocolMarshaller protocolMarshaller) {
if (createJobRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(createJobRequest.getAccelerationSettings(), ACCELERATIONSETTINGS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createJobRequest.getBillingTagsSource(), BILLINGTAGSSOURCE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createJobRequest.getClientRequestToken(), CLIENTREQUESTTOKEN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createJobRequest.getJobTemplate(), JOBTEMPLATE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createJobRequest.getQueue(), QUEUE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createJobRequest.getRole(), ROLE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createJobRequest.getSettings(), SETTINGS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createJobRequest.getStatusUpdateInterval(), STATUSUPDATEINTERVAL_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createJobRequest.getUserMetadata(), USERMETADATA_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 ListPlaybackConfigurationsResult withItems(PlaybackConfiguration... items) {
if (this.items == null) {
setItems(new java.util.ArrayList<PlaybackConfiguration>(items.length));
}
for (PlaybackConfiguration ele : items) {
this.items.add(ele);
}
return this;
} } | public class class_name {
public ListPlaybackConfigurationsResult withItems(PlaybackConfiguration... items) {
if (this.items == null) {
setItems(new java.util.ArrayList<PlaybackConfiguration>(items.length)); // depends on control dependency: [if], data = [none]
}
for (PlaybackConfiguration ele : items) {
this.items.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
@Trivial
@Override
public synchronized void run() {
clientSupport = null;
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "run : cached ClientSupport reference cleared");
}
} } | public class class_name {
@Trivial
@Override
public synchronized void run() {
clientSupport = null;
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "run : cached ClientSupport reference cleared"); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static Type getTypeFromObject(Object o)
{
// Check if the object is null, in which case its type cannot be derived.
if (o == null)
{
return new UnknownType();
}
// Check if the object is an attribute a and get its type that way if possible.
if (o instanceof Attribute)
{
return ((Attribute) o).getType();
}
// Return an approproate Type for the java primitive, wrapper or class type of the argument.
return new JavaType(o);
} } | public class class_name {
public static Type getTypeFromObject(Object o)
{
// Check if the object is null, in which case its type cannot be derived.
if (o == null)
{
return new UnknownType(); // depends on control dependency: [if], data = [none]
}
// Check if the object is an attribute a and get its type that way if possible.
if (o instanceof Attribute)
{
return ((Attribute) o).getType(); // depends on control dependency: [if], data = [none]
}
// Return an approproate Type for the java primitive, wrapper or class type of the argument.
return new JavaType(o);
} } |
public class class_name {
public RuleBlock getRuleBlock(String name) {
for (RuleBlock ruleBlock : this.ruleBlocks) {
if (ruleBlock.getName().equals(name)) {
return ruleBlock;
}
}
throw new RuntimeException(String.format(
"[engine error] no rule block by name <%s>", name));
} } | public class class_name {
public RuleBlock getRuleBlock(String name) {
for (RuleBlock ruleBlock : this.ruleBlocks) {
if (ruleBlock.getName().equals(name)) {
return ruleBlock; // depends on control dependency: [if], data = [none]
}
}
throw new RuntimeException(String.format(
"[engine error] no rule block by name <%s>", name));
} } |
public class class_name {
public static Integer getInteger(String name, Integer def, Level logLevel) {
String v = getString(name);
if (v != null) {
try {
return Integer.decode(v);
} catch (NumberFormatException e) {
// Ignore, fallback to default
if (LOGGER.isLoggable(logLevel)) {
LOGGER.log(logLevel, "Property. Value is not integer: {0} => {1}", new Object[] {name, v});
}
}
}
return def;
} } | public class class_name {
public static Integer getInteger(String name, Integer def, Level logLevel) {
String v = getString(name);
if (v != null) {
try {
return Integer.decode(v); // depends on control dependency: [try], data = [none]
} catch (NumberFormatException e) {
// Ignore, fallback to default
if (LOGGER.isLoggable(logLevel)) {
LOGGER.log(logLevel, "Property. Value is not integer: {0} => {1}", new Object[] {name, v}); // depends on control dependency: [if], data = [none]
}
} // depends on control dependency: [catch], data = [none]
}
return def;
} } |
public class class_name {
public final CommandRepository createCommandRepository() {
CommandRepository cr = new CommandRepository();
for (Command c : commandSection.getAllCommands()) {
CommandDefinition cd = new CommandDefinition(c.getName(), c.getPlugin());
cd.setArgs(c.getCommandLine());
cr.addCommandDefinition(cd);
}
return cr;
} } | public class class_name {
public final CommandRepository createCommandRepository() {
CommandRepository cr = new CommandRepository();
for (Command c : commandSection.getAllCommands()) {
CommandDefinition cd = new CommandDefinition(c.getName(), c.getPlugin());
cd.setArgs(c.getCommandLine()); // depends on control dependency: [for], data = [c]
cr.addCommandDefinition(cd); // depends on control dependency: [for], data = [c]
}
return cr;
} } |
public class class_name {
private Map<String, Object> loadPropertyFiles() {
final Map<String, Object> definedProps = new HashMap<>();
for (int propertyFileIndex = 0; propertyFileIndex < propertyFiles.size(); propertyFileIndex++) {
final String filename = propertyFiles.elementAt(propertyFileIndex);
final Properties props = new Properties();
FileInputStream fis = null;
try {
fis = new FileInputStream(filename);
props.load(fis);
} catch (final IOException e) {
System.out.println("Could not load property file " + filename + ": " + e.getMessage());
} finally {
FileUtils.close(fis);
}
// ensure that -D properties take precedence
final Enumeration propertyNames = props.propertyNames();
while (propertyNames.hasMoreElements()) {
final String name = propertyNames.nextElement().toString();
if (!definedProps.containsKey(name)) {
final Argument arg = getPluginArguments().get("--" + name);
final String value = props.getProperty(name);
if (arg != null) {
definedProps.put(name, arg.getValue(value));
} else {
definedProps.put(name, value);
}
}
}
}
return definedProps;
} } | public class class_name {
private Map<String, Object> loadPropertyFiles() {
final Map<String, Object> definedProps = new HashMap<>();
for (int propertyFileIndex = 0; propertyFileIndex < propertyFiles.size(); propertyFileIndex++) {
final String filename = propertyFiles.elementAt(propertyFileIndex);
final Properties props = new Properties();
FileInputStream fis = null;
try {
fis = new FileInputStream(filename); // depends on control dependency: [try], data = [none]
props.load(fis); // depends on control dependency: [try], data = [none]
} catch (final IOException e) {
System.out.println("Could not load property file " + filename + ": " + e.getMessage());
} finally { // depends on control dependency: [catch], data = [none]
FileUtils.close(fis);
}
// ensure that -D properties take precedence
final Enumeration propertyNames = props.propertyNames();
while (propertyNames.hasMoreElements()) {
final String name = propertyNames.nextElement().toString();
if (!definedProps.containsKey(name)) {
final Argument arg = getPluginArguments().get("--" + name);
final String value = props.getProperty(name);
if (arg != null) {
definedProps.put(name, arg.getValue(value)); // depends on control dependency: [if], data = [none]
} else {
definedProps.put(name, value); // depends on control dependency: [if], data = [none]
}
}
}
}
return definedProps;
} } |
public class class_name {
public void setNeedleShape(final NeedleShape SHAPE) {
if (null == needleShape) {
_needleShape = null == SHAPE ? NeedleShape.ANGLED : SHAPE;
fireUpdateEvent(REDRAW_EVENT);
} else {
needleShape.set(SHAPE);
}
} } | public class class_name {
public void setNeedleShape(final NeedleShape SHAPE) {
if (null == needleShape) {
_needleShape = null == SHAPE ? NeedleShape.ANGLED : SHAPE; // depends on control dependency: [if], data = [none]
fireUpdateEvent(REDRAW_EVENT); // depends on control dependency: [if], data = [none]
} else {
needleShape.set(SHAPE); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static Iterator<Integer> getPortRangeFromString(String rangeDefinition) throws NumberFormatException {
final String[] ranges = rangeDefinition.trim().split(",");
UnionIterator<Integer> iterators = new UnionIterator<>();
for (String rawRange: ranges) {
Iterator<Integer> rangeIterator;
String range = rawRange.trim();
int dashIdx = range.indexOf('-');
if (dashIdx == -1) {
// only one port in range:
final int port = Integer.valueOf(range);
if (port < 0 || port > 65535) {
throw new IllegalConfigurationException("Invalid port configuration. Port must be between 0" +
"and 65535, but was " + port + ".");
}
rangeIterator = Collections.singleton(Integer.valueOf(range)).iterator();
} else {
// evaluate range
final int start = Integer.valueOf(range.substring(0, dashIdx));
if (start < 0 || start > 65535) {
throw new IllegalConfigurationException("Invalid port configuration. Port must be between 0" +
"and 65535, but was " + start + ".");
}
final int end = Integer.valueOf(range.substring(dashIdx + 1, range.length()));
if (end < 0 || end > 65535) {
throw new IllegalConfigurationException("Invalid port configuration. Port must be between 0" +
"and 65535, but was " + end + ".");
}
rangeIterator = new Iterator<Integer>() {
int i = start;
@Override
public boolean hasNext() {
return i <= end;
}
@Override
public Integer next() {
return i++;
}
@Override
public void remove() {
throw new UnsupportedOperationException("Remove not supported");
}
};
}
iterators.add(rangeIterator);
}
return iterators;
} } | public class class_name {
public static Iterator<Integer> getPortRangeFromString(String rangeDefinition) throws NumberFormatException {
final String[] ranges = rangeDefinition.trim().split(",");
UnionIterator<Integer> iterators = new UnionIterator<>();
for (String rawRange: ranges) {
Iterator<Integer> rangeIterator;
String range = rawRange.trim();
int dashIdx = range.indexOf('-');
if (dashIdx == -1) {
// only one port in range:
final int port = Integer.valueOf(range);
if (port < 0 || port > 65535) {
throw new IllegalConfigurationException("Invalid port configuration. Port must be between 0" +
"and 65535, but was " + port + ".");
}
rangeIterator = Collections.singleton(Integer.valueOf(range)).iterator(); // depends on control dependency: [if], data = [none]
} else {
// evaluate range
final int start = Integer.valueOf(range.substring(0, dashIdx));
if (start < 0 || start > 65535) {
throw new IllegalConfigurationException("Invalid port configuration. Port must be between 0" +
"and 65535, but was " + start + ".");
}
final int end = Integer.valueOf(range.substring(dashIdx + 1, range.length()));
if (end < 0 || end > 65535) {
throw new IllegalConfigurationException("Invalid port configuration. Port must be between 0" +
"and 65535, but was " + end + ".");
}
rangeIterator = new Iterator<Integer>() {
int i = start;
@Override
public boolean hasNext() {
return i <= end;
}
@Override
public Integer next() {
return i++;
}
@Override
public void remove() {
throw new UnsupportedOperationException("Remove not supported");
}
}; // depends on control dependency: [if], data = [none]
}
iterators.add(rangeIterator);
}
return iterators;
} } |
public class class_name {
public static void copy(Reader reader, Writer writer, boolean closeStreams) throws IOException {
char[] buf = new char[BUFFER_SIZE];
int num = 0;
try {
while ((num = reader.read(buf, 0, buf.length)) != -1) {
writer.write(buf, 0, num);
}
} finally {
if (closeStreams) {
close(reader);
close(writer);
}
}
} } | public class class_name {
public static void copy(Reader reader, Writer writer, boolean closeStreams) throws IOException {
char[] buf = new char[BUFFER_SIZE];
int num = 0;
try {
while ((num = reader.read(buf, 0, buf.length)) != -1) {
writer.write(buf, 0, num); // depends on control dependency: [while], data = [none]
}
} finally {
if (closeStreams) {
close(reader); // depends on control dependency: [if], data = [none]
close(writer); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
@Override
public void runReport(Map<String, Object> extra) {
PreparedStatement prestatement = null;
PreparedStatement poststatement = null;
PreparedStatement statement = null;
try {
getStartConnection();
if (StringUtils.isNotBlank(presql))
{
FreemarkerSQLResult prefreemarkerSQLResult = freemakerParams(extra, false, presql);
prestatement = connection.prepareStatement(prefreemarkerSQLResult.getSql());
for(int i=0;i<prefreemarkerSQLResult.getParams().size();i++) {
prestatement.setObject(i + 1, prefreemarkerSQLResult.getParams().get(i));
}
prestatement.setQueryTimeout(queryTimeout);
prestatement.execute();
}
FreemarkerSQLResult freemarkerSQLResult = freemakerParams(extra, true, freemarkerSql);
statement = connection.prepareStatement(freemarkerSQLResult.getSql());
for(int i=0;i<freemarkerSQLResult.getParams().size();i++) {
statement.setObject(i + 1, freemarkerSQLResult.getParams().get(i));
}
statement.setQueryTimeout(queryTimeout);
rows = resultSetToMap(statement.executeQuery());
if (StringUtils.isNotBlank(postsql))
{
FreemarkerSQLResult postfreemarkerSQLResult = freemakerParams(extra, false, postsql);
poststatement = connection.prepareStatement(postfreemarkerSQLResult.getSql());
for(int i=0;i<postfreemarkerSQLResult.getParams().size();i++) {
poststatement.setObject(i + 1, postfreemarkerSQLResult.getParams().get(i));
}
poststatement.setQueryTimeout(queryTimeout);
poststatement.execute();
}
} catch (Exception ex) {
errors.add(ex.getMessage());
} finally {
try {
if (statement != null && !statement.isClosed())
{
statement.close();
statement = null;
}
if (prestatement != null && !prestatement.isClosed())
{
prestatement.close();
prestatement = null;
}
if (poststatement != null && !poststatement.isClosed())
{
poststatement.close();
poststatement = null;
}
if (connection != null && !connection.isClosed())
{
connection.close();
connection = null;
}
} catch (SQLException e) {
errors.add(e.getMessage());
e.printStackTrace();
}
}
} } | public class class_name {
@Override
public void runReport(Map<String, Object> extra) {
PreparedStatement prestatement = null;
PreparedStatement poststatement = null;
PreparedStatement statement = null;
try {
getStartConnection(); // depends on control dependency: [try], data = [none]
if (StringUtils.isNotBlank(presql))
{
FreemarkerSQLResult prefreemarkerSQLResult = freemakerParams(extra, false, presql);
prestatement = connection.prepareStatement(prefreemarkerSQLResult.getSql()); // depends on control dependency: [if], data = [none]
for(int i=0;i<prefreemarkerSQLResult.getParams().size();i++) {
prestatement.setObject(i + 1, prefreemarkerSQLResult.getParams().get(i)); // depends on control dependency: [for], data = [i]
}
prestatement.setQueryTimeout(queryTimeout); // depends on control dependency: [if], data = [none]
prestatement.execute(); // depends on control dependency: [if], data = [none]
}
FreemarkerSQLResult freemarkerSQLResult = freemakerParams(extra, true, freemarkerSql);
statement = connection.prepareStatement(freemarkerSQLResult.getSql()); // depends on control dependency: [try], data = [none]
for(int i=0;i<freemarkerSQLResult.getParams().size();i++) {
statement.setObject(i + 1, freemarkerSQLResult.getParams().get(i)); // depends on control dependency: [for], data = [i]
}
statement.setQueryTimeout(queryTimeout); // depends on control dependency: [try], data = [none]
rows = resultSetToMap(statement.executeQuery()); // depends on control dependency: [try], data = [none]
if (StringUtils.isNotBlank(postsql))
{
FreemarkerSQLResult postfreemarkerSQLResult = freemakerParams(extra, false, postsql);
poststatement = connection.prepareStatement(postfreemarkerSQLResult.getSql()); // depends on control dependency: [if], data = [none]
for(int i=0;i<postfreemarkerSQLResult.getParams().size();i++) {
poststatement.setObject(i + 1, postfreemarkerSQLResult.getParams().get(i)); // depends on control dependency: [for], data = [i]
}
poststatement.setQueryTimeout(queryTimeout); // depends on control dependency: [if], data = [none]
poststatement.execute(); // depends on control dependency: [if], data = [none]
}
} catch (Exception ex) {
errors.add(ex.getMessage());
} finally { // depends on control dependency: [catch], data = [none]
try {
if (statement != null && !statement.isClosed())
{
statement.close(); // depends on control dependency: [if], data = [none]
statement = null; // depends on control dependency: [if], data = [none]
}
if (prestatement != null && !prestatement.isClosed())
{
prestatement.close(); // depends on control dependency: [if], data = [none]
prestatement = null; // depends on control dependency: [if], data = [none]
}
if (poststatement != null && !poststatement.isClosed())
{
poststatement.close(); // depends on control dependency: [if], data = [none]
poststatement = null; // depends on control dependency: [if], data = [none]
}
if (connection != null && !connection.isClosed())
{
connection.close(); // depends on control dependency: [if], data = [none]
connection = null; // depends on control dependency: [if], data = [none]
}
} catch (SQLException e) {
errors.add(e.getMessage());
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
@Override
public EClass getPrimitiveDefinition() {
if (primitiveDefinitionEClass == null) {
primitiveDefinitionEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(StorePackage.eNS_URI).getEClassifiers().get(69);
}
return primitiveDefinitionEClass;
} } | public class class_name {
@Override
public EClass getPrimitiveDefinition() {
if (primitiveDefinitionEClass == null) {
primitiveDefinitionEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(StorePackage.eNS_URI).getEClassifiers().get(69);
// depends on control dependency: [if], data = [none]
}
return primitiveDefinitionEClass;
} } |
public class class_name {
private void makeCardinalityVariables() {
vmsCountOnNodes = new ArrayList<>(nodes.size());
int nbVMs = vms.size();
for (Node n : nodes) {
vmsCountOnNodes.add(csp.intVar(makeVarLabel("nbVMsOn('", n, "')"), 0, nbVMs, true));
}
vmsCountOnNodes = Collections.unmodifiableList(vmsCountOnNodes);
} } | public class class_name {
private void makeCardinalityVariables() {
vmsCountOnNodes = new ArrayList<>(nodes.size());
int nbVMs = vms.size();
for (Node n : nodes) {
vmsCountOnNodes.add(csp.intVar(makeVarLabel("nbVMsOn('", n, "')"), 0, nbVMs, true)); // depends on control dependency: [for], data = [n]
}
vmsCountOnNodes = Collections.unmodifiableList(vmsCountOnNodes);
} } |
public class class_name {
private static JQL buildJQLInsert(SQLiteModelMethod method, final JQL result, String preparedJql) {
if (StringUtils.hasText(preparedJql)) {
result.value = preparedJql;
// INSERT can contains bind parameter in column values and select
// statement
final One<Boolean> inColumnValueSet = new One<Boolean>(false);
final One<Boolean> inWhereStatement = new One<Boolean>(false);
JQLChecker.getInstance().analyze(method, result, new JqlBaseListener() {
@Override
public void enterConflict_algorithm(Conflict_algorithmContext ctx) {
result.conflictAlgorithmType = ConflictAlgorithmType.valueOf(ctx.getText().toUpperCase());
}
@Override
public void enterProjected_columns(Projected_columnsContext ctx) {
result.containsSelectOperation = true;
}
@Override
public void enterWhere_stmt(Where_stmtContext ctx) {
inWhereStatement.value0 = true;
}
@Override
public void exitWhere_stmt(Where_stmtContext ctx) {
inWhereStatement.value0 = false;
}
@Override
public void enterColumn_value_set(Column_value_setContext ctx) {
inColumnValueSet.value0 = true;
}
@Override
public void exitColumn_value_set(Column_value_setContext ctx) {
inColumnValueSet.value0 = false;
}
@Override
public void enterBind_parameter(Bind_parameterContext ctx) {
if (inWhereStatement.value0) {
result.bindParameterOnWhereStatementCounter++;
} else if (inColumnValueSet.value0) {
result.bindParameterAsColumnValueCounter++;
}
AssertKripton.assertTrue(inWhereStatement.value0 || inColumnValueSet.value0, "unknown situation!");
}
});
if (result.containsSelectOperation) {
AssertKripton.assertTrueOrInvalidMethodSignException(method.getReturnClass().equals(TypeName.VOID), method, "defined JQL requires that method's return type is void");
}
// ASSERT: a INSERT-SELECT SQL can not contains parameters on values
// section.
} else {
// use annotation's attribute value and exclude and bean definition
// to
final Class<? extends Annotation> annotation = BindSqlInsert.class;
final SQLiteDaoDefinition dao = method.getParent();
final One<Boolean> includePrimaryKey = new One<>(AnnotationUtility.extractAsBoolean(method.getElement(), annotation, AnnotationAttributeType.INCLUDE_PRIMARY_KEY));
//
if (method.getEntity().getPrimaryKey().columnType == ColumnType.PRIMARY_KEY_UNMANGED) {
includePrimaryKey.value0 = true;
}
// define field list
// every method parameter can be used only as insert field
InsertType insertResultType = SqlInsertBuilder.detectInsertType(method);
Set<String> fields=new HashSet<>();
switch(insertResultType) {
case INSERT_BEAN:
case INSERT_LIST_BEAN:
fields = extractFieldsFromAnnotation(method, annotation, includePrimaryKey.value0);
break;
case INSERT_RAW:
fields = extractFieldsFromMethodParameters(method, annotation);
break;
}
AssertKripton.assertTrueOrInvalidMethodSignException(fields.size() > 0, method, "no field is included in this query");
result.conflictAlgorithmType = ConflictAlgorithmType.valueOf(AnnotationUtility.extractAsEnumerationValue(method.getElement(), annotation, AnnotationAttributeType.CONFLICT_ALGORITHM_TYPE));
StringBuilder builder = new StringBuilder();
builder.append(INSERT_KEYWORD);
builder.append(" " + result.conflictAlgorithmType.getSqlForInsert());
builder.append(INTO_KEYWORD);
builder.append(" " + dao.getEntitySimplyClassName());
builder.append(" (");
builder.append(forEachFields(fields, new OnFieldListener() {
@Override
public String onField(String item) {
return item;
}
}));
builder.append(") ");
builder.append(VALUES_KEYWORD);
final One<String> prefix = new One<>("");
if (result.hasParamBean()) {
prefix.value0 = result.paramBean + ".";
}
builder.append(" (");
builder.append(forEachFields(fields, new OnFieldListener() {
@Override
public String onField(String item) {
return SqlAnalyzer.PARAM_PREFIX + prefix.value0 + item + SqlAnalyzer.PARAM_SUFFIX;
}
}));
builder.append(")");
result.value = builder.toString();
}
result.operationType = JQLType.INSERT;
result.dynamicReplace = new HashMap<>();
return result;
} } | public class class_name {
private static JQL buildJQLInsert(SQLiteModelMethod method, final JQL result, String preparedJql) {
if (StringUtils.hasText(preparedJql)) {
result.value = preparedJql; // depends on control dependency: [if], data = [none]
// INSERT can contains bind parameter in column values and select
// statement
final One<Boolean> inColumnValueSet = new One<Boolean>(false);
final One<Boolean> inWhereStatement = new One<Boolean>(false);
JQLChecker.getInstance().analyze(method, result, new JqlBaseListener() {
@Override
public void enterConflict_algorithm(Conflict_algorithmContext ctx) {
result.conflictAlgorithmType = ConflictAlgorithmType.valueOf(ctx.getText().toUpperCase());
}
@Override
public void enterProjected_columns(Projected_columnsContext ctx) {
result.containsSelectOperation = true;
}
@Override
public void enterWhere_stmt(Where_stmtContext ctx) {
inWhereStatement.value0 = true;
}
@Override
public void exitWhere_stmt(Where_stmtContext ctx) {
inWhereStatement.value0 = false;
}
@Override
public void enterColumn_value_set(Column_value_setContext ctx) {
inColumnValueSet.value0 = true;
}
@Override
public void exitColumn_value_set(Column_value_setContext ctx) {
inColumnValueSet.value0 = false;
}
@Override
public void enterBind_parameter(Bind_parameterContext ctx) {
if (inWhereStatement.value0) {
result.bindParameterOnWhereStatementCounter++; // depends on control dependency: [if], data = [none]
} else if (inColumnValueSet.value0) {
result.bindParameterAsColumnValueCounter++; // depends on control dependency: [if], data = [none]
}
AssertKripton.assertTrue(inWhereStatement.value0 || inColumnValueSet.value0, "unknown situation!");
}
}); // depends on control dependency: [if], data = [none]
if (result.containsSelectOperation) {
AssertKripton.assertTrueOrInvalidMethodSignException(method.getReturnClass().equals(TypeName.VOID), method, "defined JQL requires that method's return type is void");
}
// ASSERT: a INSERT-SELECT SQL can not contains parameters on values
// section.
} else {
// use annotation's attribute value and exclude and bean definition
// to
final Class<? extends Annotation> annotation = BindSqlInsert.class;
final SQLiteDaoDefinition dao = method.getParent();
final One<Boolean> includePrimaryKey = new One<>(AnnotationUtility.extractAsBoolean(method.getElement(), annotation, AnnotationAttributeType.INCLUDE_PRIMARY_KEY));
//
if (method.getEntity().getPrimaryKey().columnType == ColumnType.PRIMARY_KEY_UNMANGED) {
includePrimaryKey.value0 = true;
}
// define field list
// every method parameter can be used only as insert field
InsertType insertResultType = SqlInsertBuilder.detectInsertType(method);
Set<String> fields=new HashSet<>();
switch(insertResultType) {
case INSERT_BEAN:
case INSERT_LIST_BEAN:
fields = extractFieldsFromAnnotation(method, annotation, includePrimaryKey.value0); // depends on control dependency: [if], data = [none]
break;
case INSERT_RAW:
fields = extractFieldsFromMethodParameters(method, annotation);
break;
}
AssertKripton.assertTrueOrInvalidMethodSignException(fields.size() > 0, method, "no field is included in this query"); // depends on control dependency: [if], data = [none]
result.conflictAlgorithmType = ConflictAlgorithmType.valueOf(AnnotationUtility.extractAsEnumerationValue(method.getElement(), annotation, AnnotationAttributeType.CONFLICT_ALGORITHM_TYPE)); // depends on control dependency: [if], data = [none]
StringBuilder builder = new StringBuilder();
builder.append(INSERT_KEYWORD); // depends on control dependency: [if], data = [none]
builder.append(" " + result.conflictAlgorithmType.getSqlForInsert()); // depends on control dependency: [if], data = [none]
builder.append(INTO_KEYWORD); // depends on control dependency: [if], data = [none]
builder.append(" " + dao.getEntitySimplyClassName()); // depends on control dependency: [if], data = [none]
builder.append(" ("); // depends on control dependency: [if], data = [none]
builder.append(forEachFields(fields, new OnFieldListener() {
@Override
public String onField(String item) {
return item;
}
})); // depends on control dependency: [if], data = [none]
builder.append(") "); // depends on control dependency: [if], data = [none]
builder.append(VALUES_KEYWORD); // depends on control dependency: [if], data = [none]
final One<String> prefix = new One<>("");
if (result.hasParamBean()) {
prefix.value0 = result.paramBean + "."; // depends on control dependency: [if], data = [none]
}
builder.append(" ("); // depends on control dependency: [if], data = [none]
builder.append(forEachFields(fields, new OnFieldListener() {
@Override
public String onField(String item) {
return SqlAnalyzer.PARAM_PREFIX + prefix.value0 + item + SqlAnalyzer.PARAM_SUFFIX;
}
})); // depends on control dependency: [if], data = [none]
builder.append(")"); // depends on control dependency: [if], data = [none]
result.value = builder.toString(); // depends on control dependency: [if], data = [none]
}
result.operationType = JQLType.INSERT;
result.dynamicReplace = new HashMap<>();
return result;
} } |
public class class_name {
public int put(String feature)
{
//logger.debug("FeatureIndex.put : " + feature + "(" + count + ")");
Integer index = (Integer) map.get(feature);
if (index == null)
{
if (readOnly)
return -1;
index = new Integer(count++);
map.put(feature, index);
}
return index.intValue();
} } | public class class_name {
public int put(String feature)
{
//logger.debug("FeatureIndex.put : " + feature + "(" + count + ")");
Integer index = (Integer) map.get(feature);
if (index == null)
{
if (readOnly)
return -1;
index = new Integer(count++); // depends on control dependency: [if], data = [none]
map.put(feature, index); // depends on control dependency: [if], data = [none]
}
return index.intValue();
} } |
public class class_name {
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
ApptentiveLog.d(DATABASE, "Upgrade database from %d to %d", oldVersion, newVersion);
try {
DatabaseMigrator migrator = createDatabaseMigrator(oldVersion, newVersion);
if (migrator != null) {
migrator.onUpgrade(db, oldVersion, newVersion);
}
} catch (Exception e) {
ApptentiveLog.e(DATABASE, e, "Exception while trying to migrate database from %d to %d", oldVersion, newVersion);
logException(e);
// if migration failed - create new table
db.execSQL(SQL_DELETE_PAYLOAD_TABLE);
onCreate(db);
}
} } | public class class_name {
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
ApptentiveLog.d(DATABASE, "Upgrade database from %d to %d", oldVersion, newVersion);
try {
DatabaseMigrator migrator = createDatabaseMigrator(oldVersion, newVersion);
if (migrator != null) {
migrator.onUpgrade(db, oldVersion, newVersion); // depends on control dependency: [if], data = [none]
}
} catch (Exception e) {
ApptentiveLog.e(DATABASE, e, "Exception while trying to migrate database from %d to %d", oldVersion, newVersion);
logException(e);
// if migration failed - create new table
db.execSQL(SQL_DELETE_PAYLOAD_TABLE);
onCreate(db);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void merge(MtasSolrCollectionResult newItem) throws IOException {
if (action != null && newItem.action != null) {
if (action.equals(ComponentCollection.ACTION_CREATE)
&& newItem.action.equals(ComponentCollection.ACTION_CREATE)) {
values.addAll(newItem.values);
if (id != null && (newItem.id == null || !newItem.id.equals(id))) {
id = null;
}
} else if (action.equals(ComponentCollection.ACTION_LIST)) {
if (list != null) {
HashMap<String, SimpleOrderedMap<Object>> index = new HashMap<>();
for (SimpleOrderedMap<Object> item : list) {
if (item.get("id") != null && item.get("id") instanceof String) {
index.put((String) item.get("id"), item);
if (item.get("shards") == null
|| !(item.get("shards") instanceof List)) {
item.add("shards", new ArrayList<>());
}
}
}
for (SimpleOrderedMap<Object> item : newItem.list) {
if (item.get("id") != null && item.get("id") instanceof String) {
String id = (String) item.get("id");
if (index.containsKey(id)) {
SimpleOrderedMap<Object> indexItem = index.get(id);
List<SimpleOrderedMap<Object>> shards;
if (indexItem.get("shards") != null
&& indexItem.get("shards") instanceof List) {
shards = (List<SimpleOrderedMap<Object>>) indexItem
.get("shards");
} else {
shards = new ArrayList<>();
indexItem.add("shards", shards);
}
shards.add(item);
}
}
}
}
} else if (action.equals(ComponentCollection.ACTION_CHECK)
|| action.equals(ComponentCollection.ACTION_POST)
|| action.equals(ComponentCollection.ACTION_IMPORT)
|| action.equals(ComponentCollection.ACTION_CREATE)
|| action.equals(ComponentCollection.ACTION_GET)) {
if (status != null && status.get("id") != null
&& status.get("id") instanceof String) {
String id = (String) status.get("id");
if (id.equals(newItem.id)) {
List<SimpleOrderedMap<Object>> shards;
if (status.get("shards") != null
&& status.get("shards") instanceof List) {
shards = (List<SimpleOrderedMap<Object>>) status.get("shards");
} else {
shards = new ArrayList<>();
status.add("shards", shards);
}
if (newItem.status != null) {
if (action.equals(ComponentCollection.ACTION_GET)) {
newItem.status.add("values", newItem.values);
}
shards.add(newItem.status);
}
}
}
} else {
throw new IOException("not allowed for action '" + action + "'");
}
}
} } | public class class_name {
public void merge(MtasSolrCollectionResult newItem) throws IOException {
if (action != null && newItem.action != null) {
if (action.equals(ComponentCollection.ACTION_CREATE)
&& newItem.action.equals(ComponentCollection.ACTION_CREATE)) {
values.addAll(newItem.values); // depends on control dependency: [if], data = [none]
if (id != null && (newItem.id == null || !newItem.id.equals(id))) {
id = null; // depends on control dependency: [if], data = [none]
}
} else if (action.equals(ComponentCollection.ACTION_LIST)) {
if (list != null) {
HashMap<String, SimpleOrderedMap<Object>> index = new HashMap<>();
for (SimpleOrderedMap<Object> item : list) {
if (item.get("id") != null && item.get("id") instanceof String) {
index.put((String) item.get("id"), item); // depends on control dependency: [if], data = [none]
if (item.get("shards") == null
|| !(item.get("shards") instanceof List)) {
item.add("shards", new ArrayList<>()); // depends on control dependency: [if], data = [none]
}
}
}
for (SimpleOrderedMap<Object> item : newItem.list) {
if (item.get("id") != null && item.get("id") instanceof String) {
String id = (String) item.get("id");
if (index.containsKey(id)) {
SimpleOrderedMap<Object> indexItem = index.get(id);
List<SimpleOrderedMap<Object>> shards;
if (indexItem.get("shards") != null
&& indexItem.get("shards") instanceof List) {
shards = (List<SimpleOrderedMap<Object>>) indexItem
.get("shards"); // depends on control dependency: [if], data = [none]
} else {
shards = new ArrayList<>(); // depends on control dependency: [if], data = [none]
indexItem.add("shards", shards); // depends on control dependency: [if], data = [none]
}
shards.add(item); // depends on control dependency: [if], data = [none]
}
}
}
}
} else if (action.equals(ComponentCollection.ACTION_CHECK)
|| action.equals(ComponentCollection.ACTION_POST)
|| action.equals(ComponentCollection.ACTION_IMPORT)
|| action.equals(ComponentCollection.ACTION_CREATE)
|| action.equals(ComponentCollection.ACTION_GET)) {
if (status != null && status.get("id") != null
&& status.get("id") instanceof String) {
String id = (String) status.get("id");
if (id.equals(newItem.id)) {
List<SimpleOrderedMap<Object>> shards;
if (status.get("shards") != null
&& status.get("shards") instanceof List) {
shards = (List<SimpleOrderedMap<Object>>) status.get("shards"); // depends on control dependency: [if], data = [none]
} else {
shards = new ArrayList<>(); // depends on control dependency: [if], data = [none]
status.add("shards", shards); // depends on control dependency: [if], data = [none]
}
if (newItem.status != null) {
if (action.equals(ComponentCollection.ACTION_GET)) {
newItem.status.add("values", newItem.values); // depends on control dependency: [if], data = [none]
}
shards.add(newItem.status); // depends on control dependency: [if], data = [(newItem.status]
}
}
}
} else {
throw new IOException("not allowed for action '" + action + "'");
}
}
} } |
public class class_name {
Object asJSON() {
final List<Object> groupBy = new ArrayList<>();
for (Expression expression : expressions) { groupBy.add(expression.asJSON()); }
return groupBy;
} } | public class class_name {
Object asJSON() {
final List<Object> groupBy = new ArrayList<>();
for (Expression expression : expressions) { groupBy.add(expression.asJSON()); } // depends on control dependency: [for], data = [expression]
return groupBy;
} } |
public class class_name {
public void removeResultCollector(ResultCollector<?, DPO> resultCollector) {
if (resultCollector != null) {
removeTrigger(resultCollector);
removeDataProvider(resultCollector);
}
} } | public class class_name {
public void removeResultCollector(ResultCollector<?, DPO> resultCollector) {
if (resultCollector != null) {
removeTrigger(resultCollector); // depends on control dependency: [if], data = [(resultCollector]
removeDataProvider(resultCollector); // depends on control dependency: [if], data = [(resultCollector]
}
} } |
public class class_name {
private File getWarDirectory(TreeLogger logger) throws UnableToCompleteException {
File currentDirectory = new File(".");
try {
String canonicalPath = currentDirectory.getCanonicalPath();
logger.log(TreeLogger.INFO, "Current directory in which this generator is executing: "
+ canonicalPath);
if (canonicalPath.endsWith("war")) {
return currentDirectory;
} else {
return new File("war");
}
} catch (IOException e) {
logger.log(TreeLogger.ERROR, "Failed to get canonical path", e);
throw new UnableToCompleteException();
}
} } | public class class_name {
private File getWarDirectory(TreeLogger logger) throws UnableToCompleteException {
File currentDirectory = new File(".");
try {
String canonicalPath = currentDirectory.getCanonicalPath();
logger.log(TreeLogger.INFO, "Current directory in which this generator is executing: "
+ canonicalPath);
if (canonicalPath.endsWith("war")) {
return currentDirectory; // depends on control dependency: [if], data = [none]
} else {
return new File("war"); // depends on control dependency: [if], data = [none]
}
} catch (IOException e) {
logger.log(TreeLogger.ERROR, "Failed to get canonical path", e);
throw new UnableToCompleteException();
}
} } |
public class class_name {
private int getMatchingPoint(String pattern, String itemName) {
int index = pattern.indexOf('*');
if (index == -1) {
return -1;
}
String firstPart = pattern.substring(0, index);
if (!itemName.startsWith(firstPart)) {
return -1;
}
String secondPart = pattern.substring(index + 1);
if (!itemName.endsWith(secondPart)) {
return -1;
}
return firstPart.length() + secondPart.length();
} } | public class class_name {
private int getMatchingPoint(String pattern, String itemName) {
int index = pattern.indexOf('*');
if (index == -1) {
return -1; // depends on control dependency: [if], data = [none]
}
String firstPart = pattern.substring(0, index);
if (!itemName.startsWith(firstPart)) {
return -1; // depends on control dependency: [if], data = [none]
}
String secondPart = pattern.substring(index + 1);
if (!itemName.endsWith(secondPart)) {
return -1; // depends on control dependency: [if], data = [none]
}
return firstPart.length() + secondPart.length();
} } |
public class class_name {
public List<String> getSupportedNameIdFormats() {
val nameIdFormats = new ArrayList<String>();
val children = this.ssoDescriptor.getOrderedChildren();
if (children != null) {
nameIdFormats.addAll(children.stream().filter(NameIDFormat.class::isInstance)
.map(child -> ((NameIDFormat) child).getFormat()).collect(Collectors.toList()));
}
return nameIdFormats;
} } | public class class_name {
public List<String> getSupportedNameIdFormats() {
val nameIdFormats = new ArrayList<String>();
val children = this.ssoDescriptor.getOrderedChildren();
if (children != null) {
nameIdFormats.addAll(children.stream().filter(NameIDFormat.class::isInstance)
.map(child -> ((NameIDFormat) child).getFormat()).collect(Collectors.toList())); // depends on control dependency: [if], data = [(children]
}
return nameIdFormats;
} } |
public class class_name {
public final EObject ruleAssignment() throws RecognitionException {
EObject current = null;
Token lv_predicated_0_0=null;
Token lv_firstSetPredicated_1_0=null;
Token lv_operator_3_1=null;
Token lv_operator_3_2=null;
Token lv_operator_3_3=null;
AntlrDatatypeRuleToken lv_feature_2_0 = null;
EObject lv_terminal_4_0 = null;
enterRule();
try {
// InternalXtext.g:2364:2: ( ( ( ( (lv_predicated_0_0= '=>' ) ) | ( (lv_firstSetPredicated_1_0= '->' ) ) )? ( (lv_feature_2_0= ruleValidID ) ) ( ( (lv_operator_3_1= '+=' | lv_operator_3_2= '=' | lv_operator_3_3= '?=' ) ) ) ( (lv_terminal_4_0= ruleAssignableTerminal ) ) ) )
// InternalXtext.g:2365:2: ( ( ( (lv_predicated_0_0= '=>' ) ) | ( (lv_firstSetPredicated_1_0= '->' ) ) )? ( (lv_feature_2_0= ruleValidID ) ) ( ( (lv_operator_3_1= '+=' | lv_operator_3_2= '=' | lv_operator_3_3= '?=' ) ) ) ( (lv_terminal_4_0= ruleAssignableTerminal ) ) )
{
// InternalXtext.g:2365:2: ( ( ( (lv_predicated_0_0= '=>' ) ) | ( (lv_firstSetPredicated_1_0= '->' ) ) )? ( (lv_feature_2_0= ruleValidID ) ) ( ( (lv_operator_3_1= '+=' | lv_operator_3_2= '=' | lv_operator_3_3= '?=' ) ) ) ( (lv_terminal_4_0= ruleAssignableTerminal ) ) )
// InternalXtext.g:2366:3: ( ( (lv_predicated_0_0= '=>' ) ) | ( (lv_firstSetPredicated_1_0= '->' ) ) )? ( (lv_feature_2_0= ruleValidID ) ) ( ( (lv_operator_3_1= '+=' | lv_operator_3_2= '=' | lv_operator_3_3= '?=' ) ) ) ( (lv_terminal_4_0= ruleAssignableTerminal ) )
{
// InternalXtext.g:2366:3: ( ( (lv_predicated_0_0= '=>' ) ) | ( (lv_firstSetPredicated_1_0= '->' ) ) )?
int alt54=3;
int LA54_0 = input.LA(1);
if ( (LA54_0==42) ) {
alt54=1;
}
else if ( (LA54_0==43) ) {
alt54=2;
}
switch (alt54) {
case 1 :
// InternalXtext.g:2367:4: ( (lv_predicated_0_0= '=>' ) )
{
// InternalXtext.g:2367:4: ( (lv_predicated_0_0= '=>' ) )
// InternalXtext.g:2368:5: (lv_predicated_0_0= '=>' )
{
// InternalXtext.g:2368:5: (lv_predicated_0_0= '=>' )
// InternalXtext.g:2369:6: lv_predicated_0_0= '=>'
{
lv_predicated_0_0=(Token)match(input,42,FollowSets000.FOLLOW_3);
newLeafNode(lv_predicated_0_0, grammarAccess.getAssignmentAccess().getPredicatedEqualsSignGreaterThanSignKeyword_0_0_0());
if (current==null) {
current = createModelElement(grammarAccess.getAssignmentRule());
}
setWithLastConsumed(current, "predicated", true, "=>");
}
}
}
break;
case 2 :
// InternalXtext.g:2382:4: ( (lv_firstSetPredicated_1_0= '->' ) )
{
// InternalXtext.g:2382:4: ( (lv_firstSetPredicated_1_0= '->' ) )
// InternalXtext.g:2383:5: (lv_firstSetPredicated_1_0= '->' )
{
// InternalXtext.g:2383:5: (lv_firstSetPredicated_1_0= '->' )
// InternalXtext.g:2384:6: lv_firstSetPredicated_1_0= '->'
{
lv_firstSetPredicated_1_0=(Token)match(input,43,FollowSets000.FOLLOW_3);
newLeafNode(lv_firstSetPredicated_1_0, grammarAccess.getAssignmentAccess().getFirstSetPredicatedHyphenMinusGreaterThanSignKeyword_0_1_0());
if (current==null) {
current = createModelElement(grammarAccess.getAssignmentRule());
}
setWithLastConsumed(current, "firstSetPredicated", true, "->");
}
}
}
break;
}
// InternalXtext.g:2397:3: ( (lv_feature_2_0= ruleValidID ) )
// InternalXtext.g:2398:4: (lv_feature_2_0= ruleValidID )
{
// InternalXtext.g:2398:4: (lv_feature_2_0= ruleValidID )
// InternalXtext.g:2399:5: lv_feature_2_0= ruleValidID
{
newCompositeNode(grammarAccess.getAssignmentAccess().getFeatureValidIDParserRuleCall_1_0());
pushFollow(FollowSets000.FOLLOW_39);
lv_feature_2_0=ruleValidID();
state._fsp--;
if (current==null) {
current = createModelElementForParent(grammarAccess.getAssignmentRule());
}
set(
current,
"feature",
lv_feature_2_0,
"org.eclipse.xtext.Xtext.ValidID");
afterParserOrEnumRuleCall();
}
}
// InternalXtext.g:2416:3: ( ( (lv_operator_3_1= '+=' | lv_operator_3_2= '=' | lv_operator_3_3= '?=' ) ) )
// InternalXtext.g:2417:4: ( (lv_operator_3_1= '+=' | lv_operator_3_2= '=' | lv_operator_3_3= '?=' ) )
{
// InternalXtext.g:2417:4: ( (lv_operator_3_1= '+=' | lv_operator_3_2= '=' | lv_operator_3_3= '?=' ) )
// InternalXtext.g:2418:5: (lv_operator_3_1= '+=' | lv_operator_3_2= '=' | lv_operator_3_3= '?=' )
{
// InternalXtext.g:2418:5: (lv_operator_3_1= '+=' | lv_operator_3_2= '=' | lv_operator_3_3= '?=' )
int alt55=3;
switch ( input.LA(1) ) {
case 36:
{
alt55=1;
}
break;
case 35:
{
alt55=2;
}
break;
case 44:
{
alt55=3;
}
break;
default:
NoViableAltException nvae =
new NoViableAltException("", 55, 0, input);
throw nvae;
}
switch (alt55) {
case 1 :
// InternalXtext.g:2419:6: lv_operator_3_1= '+='
{
lv_operator_3_1=(Token)match(input,36,FollowSets000.FOLLOW_40);
newLeafNode(lv_operator_3_1, grammarAccess.getAssignmentAccess().getOperatorPlusSignEqualsSignKeyword_2_0_0());
if (current==null) {
current = createModelElement(grammarAccess.getAssignmentRule());
}
setWithLastConsumed(current, "operator", lv_operator_3_1, null);
}
break;
case 2 :
// InternalXtext.g:2430:6: lv_operator_3_2= '='
{
lv_operator_3_2=(Token)match(input,35,FollowSets000.FOLLOW_40);
newLeafNode(lv_operator_3_2, grammarAccess.getAssignmentAccess().getOperatorEqualsSignKeyword_2_0_1());
if (current==null) {
current = createModelElement(grammarAccess.getAssignmentRule());
}
setWithLastConsumed(current, "operator", lv_operator_3_2, null);
}
break;
case 3 :
// InternalXtext.g:2441:6: lv_operator_3_3= '?='
{
lv_operator_3_3=(Token)match(input,44,FollowSets000.FOLLOW_40);
newLeafNode(lv_operator_3_3, grammarAccess.getAssignmentAccess().getOperatorQuestionMarkEqualsSignKeyword_2_0_2());
if (current==null) {
current = createModelElement(grammarAccess.getAssignmentRule());
}
setWithLastConsumed(current, "operator", lv_operator_3_3, null);
}
break;
}
}
}
// InternalXtext.g:2454:3: ( (lv_terminal_4_0= ruleAssignableTerminal ) )
// InternalXtext.g:2455:4: (lv_terminal_4_0= ruleAssignableTerminal )
{
// InternalXtext.g:2455:4: (lv_terminal_4_0= ruleAssignableTerminal )
// InternalXtext.g:2456:5: lv_terminal_4_0= ruleAssignableTerminal
{
newCompositeNode(grammarAccess.getAssignmentAccess().getTerminalAssignableTerminalParserRuleCall_3_0());
pushFollow(FollowSets000.FOLLOW_2);
lv_terminal_4_0=ruleAssignableTerminal();
state._fsp--;
if (current==null) {
current = createModelElementForParent(grammarAccess.getAssignmentRule());
}
set(
current,
"terminal",
lv_terminal_4_0,
"org.eclipse.xtext.Xtext.AssignableTerminal");
afterParserOrEnumRuleCall();
}
}
}
}
leaveRule();
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
} } | public class class_name {
public final EObject ruleAssignment() throws RecognitionException {
EObject current = null;
Token lv_predicated_0_0=null;
Token lv_firstSetPredicated_1_0=null;
Token lv_operator_3_1=null;
Token lv_operator_3_2=null;
Token lv_operator_3_3=null;
AntlrDatatypeRuleToken lv_feature_2_0 = null;
EObject lv_terminal_4_0 = null;
enterRule();
try {
// InternalXtext.g:2364:2: ( ( ( ( (lv_predicated_0_0= '=>' ) ) | ( (lv_firstSetPredicated_1_0= '->' ) ) )? ( (lv_feature_2_0= ruleValidID ) ) ( ( (lv_operator_3_1= '+=' | lv_operator_3_2= '=' | lv_operator_3_3= '?=' ) ) ) ( (lv_terminal_4_0= ruleAssignableTerminal ) ) ) )
// InternalXtext.g:2365:2: ( ( ( (lv_predicated_0_0= '=>' ) ) | ( (lv_firstSetPredicated_1_0= '->' ) ) )? ( (lv_feature_2_0= ruleValidID ) ) ( ( (lv_operator_3_1= '+=' | lv_operator_3_2= '=' | lv_operator_3_3= '?=' ) ) ) ( (lv_terminal_4_0= ruleAssignableTerminal ) ) )
{
// InternalXtext.g:2365:2: ( ( ( (lv_predicated_0_0= '=>' ) ) | ( (lv_firstSetPredicated_1_0= '->' ) ) )? ( (lv_feature_2_0= ruleValidID ) ) ( ( (lv_operator_3_1= '+=' | lv_operator_3_2= '=' | lv_operator_3_3= '?=' ) ) ) ( (lv_terminal_4_0= ruleAssignableTerminal ) ) )
// InternalXtext.g:2366:3: ( ( (lv_predicated_0_0= '=>' ) ) | ( (lv_firstSetPredicated_1_0= '->' ) ) )? ( (lv_feature_2_0= ruleValidID ) ) ( ( (lv_operator_3_1= '+=' | lv_operator_3_2= '=' | lv_operator_3_3= '?=' ) ) ) ( (lv_terminal_4_0= ruleAssignableTerminal ) )
{
// InternalXtext.g:2366:3: ( ( (lv_predicated_0_0= '=>' ) ) | ( (lv_firstSetPredicated_1_0= '->' ) ) )?
int alt54=3;
int LA54_0 = input.LA(1);
if ( (LA54_0==42) ) {
alt54=1; // depends on control dependency: [if], data = [none]
}
else if ( (LA54_0==43) ) {
alt54=2; // depends on control dependency: [if], data = [none]
}
switch (alt54) {
case 1 :
// InternalXtext.g:2367:4: ( (lv_predicated_0_0= '=>' ) )
{
// InternalXtext.g:2367:4: ( (lv_predicated_0_0= '=>' ) )
// InternalXtext.g:2368:5: (lv_predicated_0_0= '=>' )
{
// InternalXtext.g:2368:5: (lv_predicated_0_0= '=>' )
// InternalXtext.g:2369:6: lv_predicated_0_0= '=>'
{
lv_predicated_0_0=(Token)match(input,42,FollowSets000.FOLLOW_3);
newLeafNode(lv_predicated_0_0, grammarAccess.getAssignmentAccess().getPredicatedEqualsSignGreaterThanSignKeyword_0_0_0());
if (current==null) {
current = createModelElement(grammarAccess.getAssignmentRule()); // depends on control dependency: [if], data = [none]
}
setWithLastConsumed(current, "predicated", true, "=>");
}
}
}
break;
case 2 :
// InternalXtext.g:2382:4: ( (lv_firstSetPredicated_1_0= '->' ) )
{
// InternalXtext.g:2382:4: ( (lv_firstSetPredicated_1_0= '->' ) )
// InternalXtext.g:2383:5: (lv_firstSetPredicated_1_0= '->' )
{
// InternalXtext.g:2383:5: (lv_firstSetPredicated_1_0= '->' )
// InternalXtext.g:2384:6: lv_firstSetPredicated_1_0= '->'
{
lv_firstSetPredicated_1_0=(Token)match(input,43,FollowSets000.FOLLOW_3);
newLeafNode(lv_firstSetPredicated_1_0, grammarAccess.getAssignmentAccess().getFirstSetPredicatedHyphenMinusGreaterThanSignKeyword_0_1_0());
if (current==null) {
current = createModelElement(grammarAccess.getAssignmentRule()); // depends on control dependency: [if], data = [none]
}
setWithLastConsumed(current, "firstSetPredicated", true, "->");
}
}
}
break;
}
// InternalXtext.g:2397:3: ( (lv_feature_2_0= ruleValidID ) )
// InternalXtext.g:2398:4: (lv_feature_2_0= ruleValidID )
{
// InternalXtext.g:2398:4: (lv_feature_2_0= ruleValidID )
// InternalXtext.g:2399:5: lv_feature_2_0= ruleValidID
{
newCompositeNode(grammarAccess.getAssignmentAccess().getFeatureValidIDParserRuleCall_1_0());
pushFollow(FollowSets000.FOLLOW_39);
lv_feature_2_0=ruleValidID();
state._fsp--;
if (current==null) {
current = createModelElementForParent(grammarAccess.getAssignmentRule()); // depends on control dependency: [if], data = [none]
}
set(
current,
"feature",
lv_feature_2_0,
"org.eclipse.xtext.Xtext.ValidID");
afterParserOrEnumRuleCall();
}
}
// InternalXtext.g:2416:3: ( ( (lv_operator_3_1= '+=' | lv_operator_3_2= '=' | lv_operator_3_3= '?=' ) ) )
// InternalXtext.g:2417:4: ( (lv_operator_3_1= '+=' | lv_operator_3_2= '=' | lv_operator_3_3= '?=' ) )
{
// InternalXtext.g:2417:4: ( (lv_operator_3_1= '+=' | lv_operator_3_2= '=' | lv_operator_3_3= '?=' ) )
// InternalXtext.g:2418:5: (lv_operator_3_1= '+=' | lv_operator_3_2= '=' | lv_operator_3_3= '?=' )
{
// InternalXtext.g:2418:5: (lv_operator_3_1= '+=' | lv_operator_3_2= '=' | lv_operator_3_3= '?=' )
int alt55=3;
switch ( input.LA(1) ) {
case 36:
{
alt55=1;
}
break;
case 35:
{
alt55=2;
}
break;
case 44:
{
alt55=3;
}
break;
default:
NoViableAltException nvae =
new NoViableAltException("", 55, 0, input);
throw nvae;
}
switch (alt55) {
case 1 :
// InternalXtext.g:2419:6: lv_operator_3_1= '+='
{
lv_operator_3_1=(Token)match(input,36,FollowSets000.FOLLOW_40);
newLeafNode(lv_operator_3_1, grammarAccess.getAssignmentAccess().getOperatorPlusSignEqualsSignKeyword_2_0_0());
if (current==null) {
current = createModelElement(grammarAccess.getAssignmentRule()); // depends on control dependency: [if], data = [none]
}
setWithLastConsumed(current, "operator", lv_operator_3_1, null);
}
break;
case 2 :
// InternalXtext.g:2430:6: lv_operator_3_2= '='
{
lv_operator_3_2=(Token)match(input,35,FollowSets000.FOLLOW_40);
newLeafNode(lv_operator_3_2, grammarAccess.getAssignmentAccess().getOperatorEqualsSignKeyword_2_0_1());
if (current==null) {
current = createModelElement(grammarAccess.getAssignmentRule()); // depends on control dependency: [if], data = [none]
}
setWithLastConsumed(current, "operator", lv_operator_3_2, null);
}
break;
case 3 :
// InternalXtext.g:2441:6: lv_operator_3_3= '?='
{
lv_operator_3_3=(Token)match(input,44,FollowSets000.FOLLOW_40);
newLeafNode(lv_operator_3_3, grammarAccess.getAssignmentAccess().getOperatorQuestionMarkEqualsSignKeyword_2_0_2());
if (current==null) {
current = createModelElement(grammarAccess.getAssignmentRule()); // depends on control dependency: [if], data = [none]
}
setWithLastConsumed(current, "operator", lv_operator_3_3, null);
}
break;
}
}
}
// InternalXtext.g:2454:3: ( (lv_terminal_4_0= ruleAssignableTerminal ) )
// InternalXtext.g:2455:4: (lv_terminal_4_0= ruleAssignableTerminal )
{
// InternalXtext.g:2455:4: (lv_terminal_4_0= ruleAssignableTerminal )
// InternalXtext.g:2456:5: lv_terminal_4_0= ruleAssignableTerminal
{
newCompositeNode(grammarAccess.getAssignmentAccess().getTerminalAssignableTerminalParserRuleCall_3_0());
pushFollow(FollowSets000.FOLLOW_2);
lv_terminal_4_0=ruleAssignableTerminal();
state._fsp--;
if (current==null) {
current = createModelElementForParent(grammarAccess.getAssignmentRule()); // depends on control dependency: [if], data = [none]
}
set(
current,
"terminal",
lv_terminal_4_0,
"org.eclipse.xtext.Xtext.AssignableTerminal");
afterParserOrEnumRuleCall();
}
}
}
}
leaveRule();
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
} } |
public class class_name {
synchronized void startBlinkTimer() {
if(blinkTimer != null) {
// Already on!
return;
}
blinkTimer = new Timer("LanternaTerminalBlinkTimer", true);
blinkTimer.schedule(new TimerTask() {
@Override
public void run() {
blinkOn = !blinkOn;
if(hasBlinkingText) {
repaint();
}
}
}, deviceConfiguration.getBlinkLengthInMilliSeconds(), deviceConfiguration.getBlinkLengthInMilliSeconds());
} } | public class class_name {
synchronized void startBlinkTimer() {
if(blinkTimer != null) {
// Already on!
return; // depends on control dependency: [if], data = [none]
}
blinkTimer = new Timer("LanternaTerminalBlinkTimer", true);
blinkTimer.schedule(new TimerTask() {
@Override
public void run() {
blinkOn = !blinkOn;
if(hasBlinkingText) {
repaint(); // depends on control dependency: [if], data = [none]
}
}
}, deviceConfiguration.getBlinkLengthInMilliSeconds(), deviceConfiguration.getBlinkLengthInMilliSeconds());
} } |
public class class_name {
public int writeTemplate(String template, ValueSet vs) {
int returnCode = htod.writeTemplate(template, vs);
if (returnCode == HTODDynacache.DISK_EXCEPTION) {
stopOnError(this.htod.diskCacheException);
}
return returnCode;
} } | public class class_name {
public int writeTemplate(String template, ValueSet vs) {
int returnCode = htod.writeTemplate(template, vs);
if (returnCode == HTODDynacache.DISK_EXCEPTION) {
stopOnError(this.htod.diskCacheException); // depends on control dependency: [if], data = [none]
}
return returnCode;
} } |
public class class_name {
public void dispose() {
for (ServiceRegistration registration : registrations) {
registration.unregister();
}
registrations.clear();
for (AbstractJTACrud crud : cruds) {
crud.dispose();
}
} } | public class class_name {
public void dispose() {
for (ServiceRegistration registration : registrations) {
registration.unregister(); // depends on control dependency: [for], data = [registration]
}
registrations.clear();
for (AbstractJTACrud crud : cruds) {
crud.dispose(); // depends on control dependency: [for], data = [crud]
}
} } |
public class class_name {
public void deltaTotalCreationTime(long delta)
{
if (enabled.get() && delta > 0)
{
totalCreationTime.addAndGet(delta);
if (delta > maxCreationTime.get())
maxCreationTime.set(delta);
}
} } | public class class_name {
public void deltaTotalCreationTime(long delta)
{
if (enabled.get() && delta > 0)
{
totalCreationTime.addAndGet(delta); // depends on control dependency: [if], data = [none]
if (delta > maxCreationTime.get())
maxCreationTime.set(delta);
}
} } |
public class class_name {
public UnsignedTransaction createUnsignedTransaction(List<UnspentTransactionOutput> unspent, Address changeAddress,
PublicKeyRing keyRing, NetworkParameters network) throws InsufficientFundsException {
long fee = MIN_MINER_FEE;
while (true) {
UnsignedTransaction unsigned;
try {
unsigned = createUnsignedTransaction(unspent, changeAddress, fee, keyRing, network);
} catch (InsufficientFundsException e) {
// We did not even have enough funds to pay the minimum fee
throw e;
}
int txSize = estimateTransacrionSize(unsigned);
// fee is based on the size of the transaction, we have to pay for
// every 1000 bytes
long requiredFee = (1 + (txSize / 1000)) * MIN_MINER_FEE;
if (fee >= requiredFee) {
return unsigned;
}
// collect coins anew with an increased fee
fee += MIN_MINER_FEE;
}
} } | public class class_name {
public UnsignedTransaction createUnsignedTransaction(List<UnspentTransactionOutput> unspent, Address changeAddress,
PublicKeyRing keyRing, NetworkParameters network) throws InsufficientFundsException {
long fee = MIN_MINER_FEE;
while (true) {
UnsignedTransaction unsigned;
try {
unsigned = createUnsignedTransaction(unspent, changeAddress, fee, keyRing, network); // depends on control dependency: [try], data = [none]
} catch (InsufficientFundsException e) {
// We did not even have enough funds to pay the minimum fee
throw e;
} // depends on control dependency: [catch], data = [none]
int txSize = estimateTransacrionSize(unsigned);
// fee is based on the size of the transaction, we have to pay for
// every 1000 bytes
long requiredFee = (1 + (txSize / 1000)) * MIN_MINER_FEE;
if (fee >= requiredFee) {
return unsigned; // depends on control dependency: [if], data = [none]
}
// collect coins anew with an increased fee
fee += MIN_MINER_FEE;
}
} } |
public class class_name {
public double overlapAbsolute(DoubleRange other) {
if (!intersects(other)) {
return 0;
}
int loCmp = lo.compareTo(other.lo);
int hiCmp = hi.compareTo(other.hi);
if (loCmp >= 0 && hiCmp <= 0) {
return this.length();
} else if (loCmp <= 0 && hiCmp >= 0) {
return other.length();
} else {
double newLo = (loCmp >= 0) ? this.lo : other.lo;
double newHi = (hiCmp <= 0) ? this.hi : other.hi;
return newHi - newLo;
}
} } | public class class_name {
public double overlapAbsolute(DoubleRange other) {
if (!intersects(other)) {
return 0; // depends on control dependency: [if], data = [none]
}
int loCmp = lo.compareTo(other.lo);
int hiCmp = hi.compareTo(other.hi);
if (loCmp >= 0 && hiCmp <= 0) {
return this.length(); // depends on control dependency: [if], data = [none]
} else if (loCmp <= 0 && hiCmp >= 0) {
return other.length(); // depends on control dependency: [if], data = [none]
} else {
double newLo = (loCmp >= 0) ? this.lo : other.lo;
double newHi = (hiCmp <= 0) ? this.hi : other.hi;
return newHi - newLo; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public SizeableLinkedList<WAMInstruction> compileBodyCall(Functor expression, boolean isFirstBody,
boolean isLastBody, boolean chainRule, int permVarsRemaining)
{
SizeableLinkedList<WAMInstruction> instructions = new SizeableLinkedList<WAMInstruction>();
if (isFirstBody)
{
instructions.add(new WAMInstruction(NeckCut));
}
else
{
Integer cutLevelVarAllocation =
(Integer) defaultBuiltIn.getSymbolTable().get(CutLevelVariable.CUT_LEVEL_VARIABLE.getSymbolKey(),
SymbolTableKeys.SYMKEY_ALLOCATION);
instructions.add(new WAMInstruction(Cut, (byte) (cutLevelVarAllocation & 0xff)));
}
return instructions;
} } | public class class_name {
public SizeableLinkedList<WAMInstruction> compileBodyCall(Functor expression, boolean isFirstBody,
boolean isLastBody, boolean chainRule, int permVarsRemaining)
{
SizeableLinkedList<WAMInstruction> instructions = new SizeableLinkedList<WAMInstruction>();
if (isFirstBody)
{
instructions.add(new WAMInstruction(NeckCut)); // depends on control dependency: [if], data = [none]
}
else
{
Integer cutLevelVarAllocation =
(Integer) defaultBuiltIn.getSymbolTable().get(CutLevelVariable.CUT_LEVEL_VARIABLE.getSymbolKey(),
SymbolTableKeys.SYMKEY_ALLOCATION);
instructions.add(new WAMInstruction(Cut, (byte) (cutLevelVarAllocation & 0xff))); // depends on control dependency: [if], data = [none]
}
return instructions;
} } |
public class class_name {
public TafResp validate(LifeForm reading, String... info) {
TafResp tresp,firstTryAuth=null;
for(Taf taf : tafs) {
tresp = taf.validate(reading, info);
switch(tresp.isAuthenticated()) {
case TRY_ANOTHER_TAF:
break;
case TRY_AUTHENTICATING:
if(firstTryAuth==null)firstTryAuth=tresp;
break;
default:
return tresp;
}
}
// No TAFs configured, at this point. It is safer at this point to be "not validated",
// rather than "let it go"
return firstTryAuth == null?NullTafResp.singleton():firstTryAuth;
} } | public class class_name {
public TafResp validate(LifeForm reading, String... info) {
TafResp tresp,firstTryAuth=null;
for(Taf taf : tafs) {
tresp = taf.validate(reading, info); // depends on control dependency: [for], data = [taf]
switch(tresp.isAuthenticated()) {
case TRY_ANOTHER_TAF:
break;
case TRY_AUTHENTICATING:
if(firstTryAuth==null)firstTryAuth=tresp;
break;
default:
return tresp;
}
}
// No TAFs configured, at this point. It is safer at this point to be "not validated",
// rather than "let it go"
return firstTryAuth == null?NullTafResp.singleton():firstTryAuth;
} } |
public class class_name {
public static String humanize(final String input) {
if (input == null || input.length() == 0) {
return "";
}
return upperFirst(underscored(input).replaceAll("_", " "));
} } | public class class_name {
public static String humanize(final String input) {
if (input == null || input.length() == 0) {
return ""; // depends on control dependency: [if], data = [none]
}
return upperFirst(underscored(input).replaceAll("_", " "));
} } |
public class class_name {
public GVRSceneObject[] getSceneObjectsByName(final String name) {
if (null == name || name.isEmpty()) {
return null;
}
return mSceneRoot.getSceneObjectsByName(name);
} } | public class class_name {
public GVRSceneObject[] getSceneObjectsByName(final String name) {
if (null == name || name.isEmpty()) {
return null; // depends on control dependency: [if], data = [none]
}
return mSceneRoot.getSceneObjectsByName(name);
} } |
public class class_name {
public DescribeTrustedAdvisorChecksResult withChecks(TrustedAdvisorCheckDescription... checks) {
if (this.checks == null) {
setChecks(new com.amazonaws.internal.SdkInternalList<TrustedAdvisorCheckDescription>(checks.length));
}
for (TrustedAdvisorCheckDescription ele : checks) {
this.checks.add(ele);
}
return this;
} } | public class class_name {
public DescribeTrustedAdvisorChecksResult withChecks(TrustedAdvisorCheckDescription... checks) {
if (this.checks == null) {
setChecks(new com.amazonaws.internal.SdkInternalList<TrustedAdvisorCheckDescription>(checks.length)); // depends on control dependency: [if], data = [none]
}
for (TrustedAdvisorCheckDescription ele : checks) {
this.checks.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
public List<Profile> findAllProfiles() throws Exception {
ArrayList<Profile> allProfiles = new ArrayList<>();
PreparedStatement statement = null;
ResultSet results = null;
try (Connection sqlConnection = sqlService.getConnection()) {
statement = sqlConnection.prepareStatement("SELECT * FROM " + Constants.DB_TABLE_PROFILE);
results = statement.executeQuery();
while (results.next()) {
allProfiles.add(this.getProfileFromResultSet(results));
}
} catch (Exception e) {
throw e;
} finally {
try {
if (results != null) {
results.close();
}
} catch (Exception e) {
}
try {
if (statement != null) {
statement.close();
}
} catch (Exception e) {
}
}
return allProfiles;
} } | public class class_name {
public List<Profile> findAllProfiles() throws Exception {
ArrayList<Profile> allProfiles = new ArrayList<>();
PreparedStatement statement = null;
ResultSet results = null;
try (Connection sqlConnection = sqlService.getConnection()) {
statement = sqlConnection.prepareStatement("SELECT * FROM " + Constants.DB_TABLE_PROFILE);
results = statement.executeQuery();
while (results.next()) {
allProfiles.add(this.getProfileFromResultSet(results));
}
} catch (Exception e) {
throw e;
} finally {
try {
if (results != null) {
results.close(); // depends on control dependency: [if], data = [none]
}
} catch (Exception e) {
} // depends on control dependency: [catch], data = [none]
try {
if (statement != null) {
statement.close(); // depends on control dependency: [if], data = [none]
}
} catch (Exception e) {
} // depends on control dependency: [catch], data = [none]
}
return allProfiles;
} } |
public class class_name {
public static Plugin fromString(String outputLine) {
Matcher matcher = LIST_OUTPUT_PATTERN.matcher(outputLine);
if (!matcher.matches()) {
return null;
}
String state = matcher.group(1);
String pluginName = matcher.group(2);
String version = matcher.group(3);
return new Plugin(pluginName, State.fromString(state), version);
} } | public class class_name {
public static Plugin fromString(String outputLine) {
Matcher matcher = LIST_OUTPUT_PATTERN.matcher(outputLine);
if (!matcher.matches()) {
return null; // depends on control dependency: [if], data = [none]
}
String state = matcher.group(1);
String pluginName = matcher.group(2);
String version = matcher.group(3);
return new Plugin(pluginName, State.fromString(state), version);
} } |
public class class_name {
@Nullable
public Long getMaxStaleness(final TimeUnit timeUnit) {
notNull("timeUnit", timeUnit);
if (maxStalenessMS == null) {
return null;
}
return timeUnit.convert(maxStalenessMS, TimeUnit.MILLISECONDS);
} } | public class class_name {
@Nullable
public Long getMaxStaleness(final TimeUnit timeUnit) {
notNull("timeUnit", timeUnit);
if (maxStalenessMS == null) {
return null; // depends on control dependency: [if], data = [none]
}
return timeUnit.convert(maxStalenessMS, TimeUnit.MILLISECONDS);
} } |
public class class_name {
public Object string_to_resource(Class<?> responseClass, String response)
{
try
{
Gson gson = new Gson();
return gson.fromJson(response, responseClass);
}catch(Exception e)
{
System.out.println(e.getMessage());
}
return null;
} } | public class class_name {
public Object string_to_resource(Class<?> responseClass, String response)
{
try
{
Gson gson = new Gson();
return gson.fromJson(response, responseClass);
// depends on control dependency: [try], data = [none]
}catch(Exception e)
{
System.out.println(e.getMessage());
}
// depends on control dependency: [catch], data = [none]
return null;
} } |
public class class_name {
private void internalLockResource(CmsLock lock, Map<String, CmsLock> locks) throws CmsLockException {
CmsLock currentLock = null;
if (locks == null) {
currentLock = OpenCms.getMemoryMonitor().getCachedLock(lock.getResourceName());
} else {
currentLock = locks.get(lock.getResourceName());
}
if (currentLock != null) {
if (currentLock.getSystemLock().equals(lock) || currentLock.getEditionLock().equals(lock)) {
return;
}
if (!currentLock.getSystemLock().isUnlocked() && lock.getSystemLock().isUnlocked()) {
lock.setRelatedLock(currentLock);
if (locks == null) {
OpenCms.getMemoryMonitor().cacheLock(lock);
} else {
locks.put(lock.getResourceName(), lock);
}
} else if (currentLock.getSystemLock().isUnlocked() && !lock.getSystemLock().isUnlocked()) {
currentLock.setRelatedLock(lock);
} else {
throw new CmsLockException(
Messages.get().container(Messages.ERR_LOCK_ILLEGAL_STATE_2, currentLock, lock));
}
} else {
if (locks == null) {
OpenCms.getMemoryMonitor().cacheLock(lock);
} else {
locks.put(lock.getResourceName(), lock);
}
}
} } | public class class_name {
private void internalLockResource(CmsLock lock, Map<String, CmsLock> locks) throws CmsLockException {
CmsLock currentLock = null;
if (locks == null) {
currentLock = OpenCms.getMemoryMonitor().getCachedLock(lock.getResourceName());
} else {
currentLock = locks.get(lock.getResourceName());
}
if (currentLock != null) {
if (currentLock.getSystemLock().equals(lock) || currentLock.getEditionLock().equals(lock)) {
return;
}
if (!currentLock.getSystemLock().isUnlocked() && lock.getSystemLock().isUnlocked()) {
lock.setRelatedLock(currentLock);
if (locks == null) {
OpenCms.getMemoryMonitor().cacheLock(lock); // depends on control dependency: [if], data = [none]
} else {
locks.put(lock.getResourceName(), lock); // depends on control dependency: [if], data = [none]
}
} else if (currentLock.getSystemLock().isUnlocked() && !lock.getSystemLock().isUnlocked()) {
currentLock.setRelatedLock(lock);
} else {
throw new CmsLockException(
Messages.get().container(Messages.ERR_LOCK_ILLEGAL_STATE_2, currentLock, lock));
}
} else {
if (locks == null) {
OpenCms.getMemoryMonitor().cacheLock(lock);
} else {
locks.put(lock.getResourceName(), lock);
}
}
} } |
public class class_name {
public Object toEntityValue(Attribute attr, Object paramValue, Object id) {
// Treat empty strings as null
if ((paramValue instanceof String) && ((String) paramValue).isEmpty()) {
paramValue = null;
}
Object value;
AttributeType attrType = attr.getDataType();
switch (attrType) {
case BOOL:
value = convertBool(attr, paramValue);
break;
case EMAIL:
case ENUM:
case HTML:
case HYPERLINK:
case SCRIPT:
case STRING:
case TEXT:
value = convertString(attr, paramValue);
break;
case CATEGORICAL:
case XREF:
value = convertRef(attr, paramValue);
break;
case CATEGORICAL_MREF:
case MREF:
case ONE_TO_MANY:
value = convertMref(attr, paramValue);
break;
case DATE:
value = convertDate(attr, paramValue);
break;
case DATE_TIME:
value = convertDateTime(attr, paramValue);
break;
case DECIMAL:
value = convertDecimal(attr, paramValue);
break;
case FILE:
value = convertFile(attr, paramValue, id);
break;
case INT:
value = convertInt(attr, paramValue);
break;
case LONG:
value = convertLong(attr, paramValue);
break;
case COMPOUND:
throw new IllegalAttributeTypeException(attrType);
default:
throw new UnexpectedEnumException(attrType);
}
return value;
} } | public class class_name {
public Object toEntityValue(Attribute attr, Object paramValue, Object id) {
// Treat empty strings as null
if ((paramValue instanceof String) && ((String) paramValue).isEmpty()) {
paramValue = null; // depends on control dependency: [if], data = [none]
}
Object value;
AttributeType attrType = attr.getDataType();
switch (attrType) {
case BOOL:
value = convertBool(attr, paramValue);
break;
case EMAIL:
case ENUM:
case HTML:
case HYPERLINK:
case SCRIPT:
case STRING:
case TEXT:
value = convertString(attr, paramValue);
break;
case CATEGORICAL:
case XREF:
value = convertRef(attr, paramValue);
break;
case CATEGORICAL_MREF:
case MREF:
case ONE_TO_MANY:
value = convertMref(attr, paramValue);
break;
case DATE:
value = convertDate(attr, paramValue);
break;
case DATE_TIME:
value = convertDateTime(attr, paramValue);
break;
case DECIMAL:
value = convertDecimal(attr, paramValue);
break;
case FILE:
value = convertFile(attr, paramValue, id);
break;
case INT:
value = convertInt(attr, paramValue);
break;
case LONG:
value = convertLong(attr, paramValue);
break;
case COMPOUND:
throw new IllegalAttributeTypeException(attrType);
default:
throw new UnexpectedEnumException(attrType);
}
return value;
} } |
public class class_name {
public Graph categories(String... names) {
if (names == null || names.length == 0) {
return this;
}
for (String name : names) {
this.categories().add(new Category(name));
}
return this;
} } | public class class_name {
public Graph categories(String... names) {
if (names == null || names.length == 0) {
return this; // depends on control dependency: [if], data = [none]
}
for (String name : names) {
this.categories().add(new Category(name)); // depends on control dependency: [for], data = [name]
}
return this;
} } |
public class class_name {
public static String getShortName(String longName, String containsShortNameRegex, int shortNameRegexGroup) {
Pattern pattern = Pattern.compile(containsShortNameRegex);
Matcher matcher = pattern.matcher(longName);
if (matcher.matches()) {
return matcher.group(shortNameRegexGroup);
} else {
return longName;
}
} } | public class class_name {
public static String getShortName(String longName, String containsShortNameRegex, int shortNameRegexGroup) {
Pattern pattern = Pattern.compile(containsShortNameRegex);
Matcher matcher = pattern.matcher(longName);
if (matcher.matches()) {
return matcher.group(shortNameRegexGroup); // depends on control dependency: [if], data = [none]
} else {
return longName; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private static PrimitiveParameter indexedBinarySearch(
List<PrimitiveParameter> list, long tstamp) {
int low = 0;
int high = list.size() - 1;
while (low <= high) {
/*
* We use >>> instead of >> or /2 to avoid overflow. Sun's
* implementation of binary search actually doesn't do this (bug
* #5045582).
*/
int mid = (low + high) >>> 1;
PrimitiveParameter midVal = list.get(mid);
long cmp = midVal.getPosition() - tstamp;
if (cmp < 0) {
low = mid + 1;
} else if (cmp > 0) {
high = mid - 1;
} else {
return midVal;
}
}
return null;
} } | public class class_name {
private static PrimitiveParameter indexedBinarySearch(
List<PrimitiveParameter> list, long tstamp) {
int low = 0;
int high = list.size() - 1;
while (low <= high) {
/*
* We use >>> instead of >> or /2 to avoid overflow. Sun's
* implementation of binary search actually doesn't do this (bug
* #5045582).
*/
int mid = (low + high) >>> 1;
PrimitiveParameter midVal = list.get(mid);
long cmp = midVal.getPosition() - tstamp;
if (cmp < 0) {
low = mid + 1; // depends on control dependency: [if], data = [none]
} else if (cmp > 0) {
high = mid - 1; // depends on control dependency: [if], data = [none]
} else {
return midVal; // depends on control dependency: [if], data = [none]
}
}
return null;
} } |
public class class_name {
public DependencyCustomizer ifAllMissingClasses(String... classNames) {
return new DependencyCustomizer(this) {
@Override
protected boolean canAdd() {
for (String className : classNames) {
try {
DependencyCustomizer.this.loader.loadClass(className);
return false;
}
catch (Exception ex) {
// swallow exception and continue
}
}
return DependencyCustomizer.this.canAdd();
}
};
} } | public class class_name {
public DependencyCustomizer ifAllMissingClasses(String... classNames) {
return new DependencyCustomizer(this) {
@Override
protected boolean canAdd() {
for (String className : classNames) {
try {
DependencyCustomizer.this.loader.loadClass(className); // depends on control dependency: [try], data = [none]
return false; // depends on control dependency: [try], data = [none]
}
catch (Exception ex) {
// swallow exception and continue
} // depends on control dependency: [catch], data = [none]
}
return DependencyCustomizer.this.canAdd();
}
};
} } |
public class class_name {
public void marshall(StandardsSubscriptionRequest standardsSubscriptionRequest, ProtocolMarshaller protocolMarshaller) {
if (standardsSubscriptionRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(standardsSubscriptionRequest.getStandardsArn(), STANDARDSARN_BINDING);
protocolMarshaller.marshall(standardsSubscriptionRequest.getStandardsInput(), STANDARDSINPUT_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(StandardsSubscriptionRequest standardsSubscriptionRequest, ProtocolMarshaller protocolMarshaller) {
if (standardsSubscriptionRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(standardsSubscriptionRequest.getStandardsArn(), STANDARDSARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(standardsSubscriptionRequest.getStandardsInput(), STANDARDSINPUT_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 readObjectArrayFrom(ResultSetAndStatement rs_stmt, Map row)
{
FieldDescriptor[] fields;
/*
arminw:
TODO: this feature doesn't work, so remove this in future
*/
if (m_cld.getSuperClass() != null)
{
/**
* treeder
* append super class fields if exist
*/
fields = m_cld.getFieldDescriptorsInHeirarchy();
}
else
{
String ojbConcreteClass = extractOjbConcreteClass(m_cld, rs_stmt.m_rs, row);
/*
arminw:
if multiple classes were mapped to the same table, lookup the concrete
class and use these fields, attach ojbConcreteClass in row map for later use
*/
if(ojbConcreteClass != null)
{
ClassDescriptor cld = m_cld.getRepository().getDescriptorFor(ojbConcreteClass);
row.put(OJB_CONCRETE_CLASS_KEY, cld.getClassOfObject());
fields = cld.getFieldDescriptor(true);
}
else
{
String ojbClass = SqlHelper.getOjbClassName(rs_stmt.m_rs);
if (ojbClass != null)
{
ClassDescriptor cld = m_cld.getRepository().getDescriptorFor(ojbClass);
row.put(OJB_CONCRETE_CLASS_KEY, cld.getClassOfObject());
fields = cld.getFieldDescriptor(true);
}
else
{
fields = m_cld.getFieldDescriptor(true);
}
}
}
readValuesFrom(rs_stmt, row, fields);
} } | public class class_name {
public void readObjectArrayFrom(ResultSetAndStatement rs_stmt, Map row)
{
FieldDescriptor[] fields;
/*
arminw:
TODO: this feature doesn't work, so remove this in future
*/
if (m_cld.getSuperClass() != null)
{
/**
* treeder
* append super class fields if exist
*/
fields = m_cld.getFieldDescriptorsInHeirarchy();
// depends on control dependency: [if], data = [none]
}
else
{
String ojbConcreteClass = extractOjbConcreteClass(m_cld, rs_stmt.m_rs, row);
/*
arminw:
if multiple classes were mapped to the same table, lookup the concrete
class and use these fields, attach ojbConcreteClass in row map for later use
*/
if(ojbConcreteClass != null)
{
ClassDescriptor cld = m_cld.getRepository().getDescriptorFor(ojbConcreteClass);
row.put(OJB_CONCRETE_CLASS_KEY, cld.getClassOfObject());
// depends on control dependency: [if], data = [none]
fields = cld.getFieldDescriptor(true);
// depends on control dependency: [if], data = [none]
}
else
{
String ojbClass = SqlHelper.getOjbClassName(rs_stmt.m_rs);
if (ojbClass != null)
{
ClassDescriptor cld = m_cld.getRepository().getDescriptorFor(ojbClass);
row.put(OJB_CONCRETE_CLASS_KEY, cld.getClassOfObject());
// depends on control dependency: [if], data = [none]
fields = cld.getFieldDescriptor(true);
// depends on control dependency: [if], data = [none]
}
else
{
fields = m_cld.getFieldDescriptor(true);
// depends on control dependency: [if], data = [none]
}
}
}
readValuesFrom(rs_stmt, row, fields);
} } |
public class class_name {
@Override
public String getColumnName(final int column) {
Object id = null;
// This test is to cover the case when
// getColumnCount has been subclassed by mistake ...
if (column < this.columnIdentifiers.size() && column >= 0) {
id = this.columnIdentifiers.elementAt(column);
}
return id == null ? super.getColumnName(column) : id.toString();
} } | public class class_name {
@Override
public String getColumnName(final int column) {
Object id = null;
// This test is to cover the case when
// getColumnCount has been subclassed by mistake ...
if (column < this.columnIdentifiers.size() && column >= 0) {
id = this.columnIdentifiers.elementAt(column);
// depends on control dependency: [if], data = [none]
}
return id == null ? super.getColumnName(column) : id.toString();
} } |
public class class_name {
public static TupleDesc_F64 combine( List<TupleDesc_F64> inputs , TupleDesc_F64 combined ) {
int N = 0;
for (int i = 0; i < inputs.size(); i++) {
N += inputs.get(i).size();
}
if( combined == null ) {
combined = new TupleDesc_F64(N);
} else {
if (N != combined.size())
throw new RuntimeException("The combined feature needs to be " + N + " not " + combined.size());
}
int start = 0;
for (int i = 0; i < inputs.size(); i++) {
double v[] = inputs.get(i).value;
System.arraycopy(v,0,combined.value,start,v.length);
start += v.length;
}
return combined;
} } | public class class_name {
public static TupleDesc_F64 combine( List<TupleDesc_F64> inputs , TupleDesc_F64 combined ) {
int N = 0;
for (int i = 0; i < inputs.size(); i++) {
N += inputs.get(i).size(); // depends on control dependency: [for], data = [i]
}
if( combined == null ) {
combined = new TupleDesc_F64(N); // depends on control dependency: [if], data = [none]
} else {
if (N != combined.size())
throw new RuntimeException("The combined feature needs to be " + N + " not " + combined.size());
}
int start = 0;
for (int i = 0; i < inputs.size(); i++) {
double v[] = inputs.get(i).value;
System.arraycopy(v,0,combined.value,start,v.length); // depends on control dependency: [for], data = [none]
start += v.length; // depends on control dependency: [for], data = [none]
}
return combined;
} } |
public class class_name {
public PagedList<ComputeNode> list(final String poolId, final ComputeNodeListOptions computeNodeListOptions) {
ServiceResponseWithHeaders<Page<ComputeNode>, ComputeNodeListHeaders> response = listSinglePageAsync(poolId, computeNodeListOptions).toBlocking().single();
return new PagedList<ComputeNode>(response.body()) {
@Override
public Page<ComputeNode> nextPage(String nextPageLink) {
ComputeNodeListNextOptions computeNodeListNextOptions = null;
if (computeNodeListOptions != null) {
computeNodeListNextOptions = new ComputeNodeListNextOptions();
computeNodeListNextOptions.withClientRequestId(computeNodeListOptions.clientRequestId());
computeNodeListNextOptions.withReturnClientRequestId(computeNodeListOptions.returnClientRequestId());
computeNodeListNextOptions.withOcpDate(computeNodeListOptions.ocpDate());
}
return listNextSinglePageAsync(nextPageLink, computeNodeListNextOptions).toBlocking().single().body();
}
};
} } | public class class_name {
public PagedList<ComputeNode> list(final String poolId, final ComputeNodeListOptions computeNodeListOptions) {
ServiceResponseWithHeaders<Page<ComputeNode>, ComputeNodeListHeaders> response = listSinglePageAsync(poolId, computeNodeListOptions).toBlocking().single();
return new PagedList<ComputeNode>(response.body()) {
@Override
public Page<ComputeNode> nextPage(String nextPageLink) {
ComputeNodeListNextOptions computeNodeListNextOptions = null;
if (computeNodeListOptions != null) {
computeNodeListNextOptions = new ComputeNodeListNextOptions(); // depends on control dependency: [if], data = [none]
computeNodeListNextOptions.withClientRequestId(computeNodeListOptions.clientRequestId()); // depends on control dependency: [if], data = [(computeNodeListOptions]
computeNodeListNextOptions.withReturnClientRequestId(computeNodeListOptions.returnClientRequestId()); // depends on control dependency: [if], data = [(computeNodeListOptions]
computeNodeListNextOptions.withOcpDate(computeNodeListOptions.ocpDate()); // depends on control dependency: [if], data = [(computeNodeListOptions]
}
return listNextSinglePageAsync(nextPageLink, computeNodeListNextOptions).toBlocking().single().body();
}
};
} } |
public class class_name {
public void endElement (String namespaceURI,
String localName,
String qName)
throws SAXException {
super.endElement(namespaceURI, localName, qName);
// Check after popping the stack so we don't erroneously think we
// are our own extension namespace...
boolean inExtension = inExtensionNamespace();
int entryType = -1;
Vector entryArgs = new Vector();
if (namespaceURI != null
&& (extendedNamespaceName.equals(namespaceURI))
&& !inExtension) {
String popURI = (String) baseURIStack.pop();
String baseURI = (String) baseURIStack.peek();
if (!baseURI.equals(popURI)) {
entryType = catalog.BASE;
entryArgs.add(baseURI);
debug.message(4, "(reset) xml:base", baseURI);
try {
CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
catalog.addEntry(ce);
} catch (CatalogException cex) {
if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
debug.message(1, "Invalid catalog entry type", localName);
} else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) {
debug.message(1, "Invalid catalog entry (rbase)", localName);
}
}
}
}
} } | public class class_name {
public void endElement (String namespaceURI,
String localName,
String qName)
throws SAXException {
super.endElement(namespaceURI, localName, qName);
// Check after popping the stack so we don't erroneously think we
// are our own extension namespace...
boolean inExtension = inExtensionNamespace();
int entryType = -1;
Vector entryArgs = new Vector();
if (namespaceURI != null
&& (extendedNamespaceName.equals(namespaceURI))
&& !inExtension) {
String popURI = (String) baseURIStack.pop();
String baseURI = (String) baseURIStack.peek();
if (!baseURI.equals(popURI)) {
entryType = catalog.BASE; // depends on control dependency: [if], data = [none]
entryArgs.add(baseURI); // depends on control dependency: [if], data = [none]
debug.message(4, "(reset) xml:base", baseURI); // depends on control dependency: [if], data = [none]
try {
CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
catalog.addEntry(ce); // depends on control dependency: [try], data = [none]
} catch (CatalogException cex) {
if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
debug.message(1, "Invalid catalog entry type", localName); // depends on control dependency: [if], data = [none]
} else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) {
debug.message(1, "Invalid catalog entry (rbase)", localName); // depends on control dependency: [if], data = [none]
}
} // depends on control dependency: [catch], data = [none]
}
}
} } |
public class class_name {
private static void readField(DatabaseFieldConfig config, String field, String value) {
if (field.equals(FIELD_NAME_FIELD_NAME)) {
config.setFieldName(value);
} else if (field.equals(FIELD_NAME_COLUMN_NAME)) {
config.setColumnName(value);
} else if (field.equals(FIELD_NAME_DATA_PERSISTER)) {
config.setDataPersister(DataType.valueOf(value).getDataPersister());
} else if (field.equals(FIELD_NAME_DEFAULT_VALUE)) {
config.setDefaultValue(value);
} else if (field.equals(FIELD_NAME_WIDTH)) {
config.setWidth(Integer.parseInt(value));
} else if (field.equals(FIELD_NAME_CAN_BE_NULL)) {
config.setCanBeNull(Boolean.parseBoolean(value));
} else if (field.equals(FIELD_NAME_ID)) {
config.setId(Boolean.parseBoolean(value));
} else if (field.equals(FIELD_NAME_GENERATED_ID)) {
config.setGeneratedId(Boolean.parseBoolean(value));
} else if (field.equals(FIELD_NAME_GENERATED_ID_SEQUENCE)) {
config.setGeneratedIdSequence(value);
} else if (field.equals(FIELD_NAME_FOREIGN)) {
config.setForeign(Boolean.parseBoolean(value));
} else if (field.equals(FIELD_NAME_USE_GET_SET)) {
config.setUseGetSet(Boolean.parseBoolean(value));
} else if (field.equals(FIELD_NAME_UNKNOWN_ENUM_VALUE)) {
String[] parts = value.split("#", -2);
if (parts.length != 2) {
throw new IllegalArgumentException(
"Invalid value for unknownEnumValue which should be in class#name format: " + value);
}
Class<?> enumClass;
try {
enumClass = Class.forName(parts[0]);
} catch (ClassNotFoundException e) {
throw new IllegalArgumentException("Unknown class specified for unknownEnumValue: " + value);
}
Object[] consts = enumClass.getEnumConstants();
if (consts == null) {
throw new IllegalArgumentException("Invalid class is not an Enum for unknownEnumValue: " + value);
}
@SuppressWarnings("rawtypes")
Enum[] enumConstants = (Enum[]) consts;
boolean found = false;
for (Enum<?> enumInstance : enumConstants) {
if (enumInstance.name().equals(parts[1])) {
config.setUnknownEnumValue(enumInstance);
found = true;
}
}
if (!found) {
throw new IllegalArgumentException("Invalid enum value name for unknownEnumvalue: " + value);
}
} else if (field.equals(FIELD_NAME_THROW_IF_NULL)) {
config.setThrowIfNull(Boolean.parseBoolean(value));
} else if (field.equals(FIELD_NAME_FORMAT)) {
config.setFormat(value);
} else if (field.equals(FIELD_NAME_UNIQUE)) {
config.setUnique(Boolean.parseBoolean(value));
} else if (field.equals(FIELD_NAME_UNIQUE_COMBO)) {
config.setUniqueCombo(Boolean.parseBoolean(value));
} else if (field.equals(FIELD_NAME_INDEX)) {
config.setIndex(Boolean.parseBoolean(value));
} else if (field.equals(FIELD_NAME_INDEX_NAME)) {
config.setIndex(true);
config.setIndexName(value);
} else if (field.equals(FIELD_NAME_UNIQUE_INDEX)) {
config.setUniqueIndex(Boolean.parseBoolean(value));
} else if (field.equals(FIELD_NAME_UNIQUE_INDEX_NAME)) {
config.setUniqueIndex(true);
config.setUniqueIndexName(value);
} else if (field.equals(FIELD_NAME_FOREIGN_AUTO_REFRESH)) {
config.setForeignAutoRefresh(Boolean.parseBoolean(value));
} else if (field.equals(FIELD_NAME_MAX_FOREIGN_AUTO_REFRESH_LEVEL)) {
config.setMaxForeignAutoRefreshLevel(Integer.parseInt(value));
} else if (field.equals(FIELD_NAME_PERSISTER_CLASS)) {
try {
@SuppressWarnings("unchecked")
Class<? extends DataPersister> clazz = (Class<? extends DataPersister>) Class.forName(value);
config.setPersisterClass(clazz);
} catch (ClassNotFoundException e) {
throw new IllegalArgumentException("Could not find persisterClass: " + value);
}
} else if (field.equals(FIELD_NAME_ALLOW_GENERATED_ID_INSERT)) {
config.setAllowGeneratedIdInsert(Boolean.parseBoolean(value));
} else if (field.equals(FIELD_NAME_COLUMN_DEFINITION)) {
config.setColumnDefinition(value);
} else if (field.equals(FIELD_NAME_FULL_COLUMN_DEFINITION)) {
config.setFullColumnDefinition(value);
} else if (field.equals(FIELD_NAME_FOREIGN_AUTO_CREATE)) {
config.setForeignAutoCreate(Boolean.parseBoolean(value));
} else if (field.equals(FIELD_NAME_VERSION)) {
config.setVersion(Boolean.parseBoolean(value));
} else if (field.equals(FIELD_NAME_FOREIGN_COLUMN_NAME)) {
config.setForeignColumnName(value);
} else if (field.equals(FIELD_NAME_READ_ONLY)) {
config.setReadOnly(Boolean.parseBoolean(value));
}
/**
* foreign collection field information
*/
else if (field.equals(FIELD_NAME_FOREIGN_COLLECTION)) {
config.setForeignCollection(Boolean.parseBoolean(value));
} else if (field.equals(FIELD_NAME_FOREIGN_COLLECTION_EAGER)) {
config.setForeignCollectionEager(Boolean.parseBoolean(value));
} else if (field.equals(FIELD_NAME_MAX_EAGER_FOREIGN_COLLECTION_LEVEL_OLD)) {
config.setForeignCollectionMaxEagerLevel(Integer.parseInt(value));
} else if (field.equals(FIELD_NAME_MAX_EAGER_FOREIGN_COLLECTION_LEVEL)) {
config.setForeignCollectionMaxEagerLevel(Integer.parseInt(value));
} else if (field.equals(FIELD_NAME_FOREIGN_COLLECTION_COLUMN_NAME)) {
config.setForeignCollectionColumnName(value);
} else if (field.equals(FIELD_NAME_FOREIGN_COLLECTION_ORDER_COLUMN_NAME_OLD)) {
config.setForeignCollectionOrderColumnName(value);
} else if (field.equals(FIELD_NAME_FOREIGN_COLLECTION_ORDER_COLUMN_NAME)) {
config.setForeignCollectionOrderColumnName(value);
} else if (field.equals(FIELD_NAME_FOREIGN_COLLECTION_ORDER_ASCENDING)) {
config.setForeignCollectionOrderAscending(Boolean.parseBoolean(value));
} else if (field.equals(FIELD_NAME_FOREIGN_COLLECTION_FOREIGN_FIELD_NAME_OLD)) {
config.setForeignCollectionForeignFieldName(value);
} else if (field.equals(FIELD_NAME_FOREIGN_COLLECTION_FOREIGN_FIELD_NAME)) {
config.setForeignCollectionForeignFieldName(value);
}
} } | public class class_name {
private static void readField(DatabaseFieldConfig config, String field, String value) {
if (field.equals(FIELD_NAME_FIELD_NAME)) {
config.setFieldName(value); // depends on control dependency: [if], data = [none]
} else if (field.equals(FIELD_NAME_COLUMN_NAME)) {
config.setColumnName(value); // depends on control dependency: [if], data = [none]
} else if (field.equals(FIELD_NAME_DATA_PERSISTER)) {
config.setDataPersister(DataType.valueOf(value).getDataPersister()); // depends on control dependency: [if], data = [none]
} else if (field.equals(FIELD_NAME_DEFAULT_VALUE)) {
config.setDefaultValue(value); // depends on control dependency: [if], data = [none]
} else if (field.equals(FIELD_NAME_WIDTH)) {
config.setWidth(Integer.parseInt(value)); // depends on control dependency: [if], data = [none]
} else if (field.equals(FIELD_NAME_CAN_BE_NULL)) {
config.setCanBeNull(Boolean.parseBoolean(value)); // depends on control dependency: [if], data = [none]
} else if (field.equals(FIELD_NAME_ID)) {
config.setId(Boolean.parseBoolean(value)); // depends on control dependency: [if], data = [none]
} else if (field.equals(FIELD_NAME_GENERATED_ID)) {
config.setGeneratedId(Boolean.parseBoolean(value)); // depends on control dependency: [if], data = [none]
} else if (field.equals(FIELD_NAME_GENERATED_ID_SEQUENCE)) {
config.setGeneratedIdSequence(value); // depends on control dependency: [if], data = [none]
} else if (field.equals(FIELD_NAME_FOREIGN)) {
config.setForeign(Boolean.parseBoolean(value)); // depends on control dependency: [if], data = [none]
} else if (field.equals(FIELD_NAME_USE_GET_SET)) {
config.setUseGetSet(Boolean.parseBoolean(value)); // depends on control dependency: [if], data = [none]
} else if (field.equals(FIELD_NAME_UNKNOWN_ENUM_VALUE)) {
String[] parts = value.split("#", -2);
if (parts.length != 2) {
throw new IllegalArgumentException(
"Invalid value for unknownEnumValue which should be in class#name format: " + value);
}
Class<?> enumClass;
try {
enumClass = Class.forName(parts[0]); // depends on control dependency: [try], data = [none]
} catch (ClassNotFoundException e) {
throw new IllegalArgumentException("Unknown class specified for unknownEnumValue: " + value);
} // depends on control dependency: [catch], data = [none]
Object[] consts = enumClass.getEnumConstants();
if (consts == null) {
throw new IllegalArgumentException("Invalid class is not an Enum for unknownEnumValue: " + value);
}
@SuppressWarnings("rawtypes")
Enum[] enumConstants = (Enum[]) consts; // depends on control dependency: [if], data = [none]
boolean found = false;
for (Enum<?> enumInstance : enumConstants) {
if (enumInstance.name().equals(parts[1])) {
config.setUnknownEnumValue(enumInstance); // depends on control dependency: [if], data = [none]
found = true; // depends on control dependency: [if], data = [none]
}
}
if (!found) {
throw new IllegalArgumentException("Invalid enum value name for unknownEnumvalue: " + value);
}
} else if (field.equals(FIELD_NAME_THROW_IF_NULL)) {
config.setThrowIfNull(Boolean.parseBoolean(value)); // depends on control dependency: [if], data = [none]
} else if (field.equals(FIELD_NAME_FORMAT)) {
config.setFormat(value); // depends on control dependency: [if], data = [none]
} else if (field.equals(FIELD_NAME_UNIQUE)) {
config.setUnique(Boolean.parseBoolean(value)); // depends on control dependency: [if], data = [none]
} else if (field.equals(FIELD_NAME_UNIQUE_COMBO)) {
config.setUniqueCombo(Boolean.parseBoolean(value)); // depends on control dependency: [if], data = [none]
} else if (field.equals(FIELD_NAME_INDEX)) {
config.setIndex(Boolean.parseBoolean(value)); // depends on control dependency: [if], data = [none]
} else if (field.equals(FIELD_NAME_INDEX_NAME)) {
config.setIndex(true); // depends on control dependency: [if], data = [none]
config.setIndexName(value); // depends on control dependency: [if], data = [none]
} else if (field.equals(FIELD_NAME_UNIQUE_INDEX)) {
config.setUniqueIndex(Boolean.parseBoolean(value)); // depends on control dependency: [if], data = [none]
} else if (field.equals(FIELD_NAME_UNIQUE_INDEX_NAME)) {
config.setUniqueIndex(true); // depends on control dependency: [if], data = [none]
config.setUniqueIndexName(value); // depends on control dependency: [if], data = [none]
} else if (field.equals(FIELD_NAME_FOREIGN_AUTO_REFRESH)) {
config.setForeignAutoRefresh(Boolean.parseBoolean(value)); // depends on control dependency: [if], data = [none]
} else if (field.equals(FIELD_NAME_MAX_FOREIGN_AUTO_REFRESH_LEVEL)) {
config.setMaxForeignAutoRefreshLevel(Integer.parseInt(value)); // depends on control dependency: [if], data = [none]
} else if (field.equals(FIELD_NAME_PERSISTER_CLASS)) {
try {
@SuppressWarnings("unchecked")
Class<? extends DataPersister> clazz = (Class<? extends DataPersister>) Class.forName(value);
config.setPersisterClass(clazz);
} catch (ClassNotFoundException e) {
throw new IllegalArgumentException("Could not find persisterClass: " + value);
} // depends on control dependency: [catch], data = [none]
} else if (field.equals(FIELD_NAME_ALLOW_GENERATED_ID_INSERT)) {
config.setAllowGeneratedIdInsert(Boolean.parseBoolean(value)); // depends on control dependency: [if], data = [none]
} else if (field.equals(FIELD_NAME_COLUMN_DEFINITION)) {
config.setColumnDefinition(value); // depends on control dependency: [if], data = [none]
} else if (field.equals(FIELD_NAME_FULL_COLUMN_DEFINITION)) {
config.setFullColumnDefinition(value); // depends on control dependency: [if], data = [none]
} else if (field.equals(FIELD_NAME_FOREIGN_AUTO_CREATE)) {
config.setForeignAutoCreate(Boolean.parseBoolean(value)); // depends on control dependency: [if], data = [none]
} else if (field.equals(FIELD_NAME_VERSION)) {
config.setVersion(Boolean.parseBoolean(value)); // depends on control dependency: [if], data = [none]
} else if (field.equals(FIELD_NAME_FOREIGN_COLUMN_NAME)) {
config.setForeignColumnName(value); // depends on control dependency: [if], data = [none]
} else if (field.equals(FIELD_NAME_READ_ONLY)) {
config.setReadOnly(Boolean.parseBoolean(value)); // depends on control dependency: [if], data = [none]
}
/**
* foreign collection field information
*/
else if (field.equals(FIELD_NAME_FOREIGN_COLLECTION)) {
config.setForeignCollection(Boolean.parseBoolean(value)); // depends on control dependency: [if], data = [none]
} else if (field.equals(FIELD_NAME_FOREIGN_COLLECTION_EAGER)) {
config.setForeignCollectionEager(Boolean.parseBoolean(value)); // depends on control dependency: [if], data = [none]
} else if (field.equals(FIELD_NAME_MAX_EAGER_FOREIGN_COLLECTION_LEVEL_OLD)) {
config.setForeignCollectionMaxEagerLevel(Integer.parseInt(value)); // depends on control dependency: [if], data = [none]
} else if (field.equals(FIELD_NAME_MAX_EAGER_FOREIGN_COLLECTION_LEVEL)) {
config.setForeignCollectionMaxEagerLevel(Integer.parseInt(value)); // depends on control dependency: [if], data = [none]
} else if (field.equals(FIELD_NAME_FOREIGN_COLLECTION_COLUMN_NAME)) {
config.setForeignCollectionColumnName(value); // depends on control dependency: [if], data = [none]
} else if (field.equals(FIELD_NAME_FOREIGN_COLLECTION_ORDER_COLUMN_NAME_OLD)) {
config.setForeignCollectionOrderColumnName(value); // depends on control dependency: [if], data = [none]
} else if (field.equals(FIELD_NAME_FOREIGN_COLLECTION_ORDER_COLUMN_NAME)) {
config.setForeignCollectionOrderColumnName(value); // depends on control dependency: [if], data = [none]
} else if (field.equals(FIELD_NAME_FOREIGN_COLLECTION_ORDER_ASCENDING)) {
config.setForeignCollectionOrderAscending(Boolean.parseBoolean(value)); // depends on control dependency: [if], data = [none]
} else if (field.equals(FIELD_NAME_FOREIGN_COLLECTION_FOREIGN_FIELD_NAME_OLD)) {
config.setForeignCollectionForeignFieldName(value); // depends on control dependency: [if], data = [none]
} else if (field.equals(FIELD_NAME_FOREIGN_COLLECTION_FOREIGN_FIELD_NAME)) {
config.setForeignCollectionForeignFieldName(value); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static <T> Callable<T> callable(CheckedCallable<T> callable, Consumer<Throwable> handler) {
return () -> {
try {
return callable.call();
}
catch (Throwable e) {
handler.accept(e);
throw new IllegalStateException("Exception handler must throw a RuntimeException", e);
}
};
} } | public class class_name {
public static <T> Callable<T> callable(CheckedCallable<T> callable, Consumer<Throwable> handler) {
return () -> {
try {
return callable.call(); // depends on control dependency: [try], data = [none]
}
catch (Throwable e) {
handler.accept(e);
throw new IllegalStateException("Exception handler must throw a RuntimeException", e);
} // depends on control dependency: [catch], data = [none]
};
} } |
public class class_name {
private Expression correctClassClassChain(PropertyExpression pe) {
LinkedList<Expression> stack = new LinkedList<Expression>();
ClassExpression found = null;
for (Expression it = pe; it != null; it = ((PropertyExpression) it).getObjectExpression()) {
if (it instanceof ClassExpression) {
found = (ClassExpression) it;
break;
} else if (!(it.getClass() == PropertyExpression.class)) {
return pe;
}
stack.addFirst(it);
}
if (found == null) return pe;
if (stack.isEmpty()) return pe;
Object stackElement = stack.removeFirst();
if (!(stackElement.getClass() == PropertyExpression.class)) return pe;
PropertyExpression classPropertyExpression = (PropertyExpression) stackElement;
String propertyNamePart = classPropertyExpression.getPropertyAsString();
if (propertyNamePart == null || !propertyNamePart.equals("class")) return pe;
found.setSourcePosition(classPropertyExpression);
if (stack.isEmpty()) return found;
stackElement = stack.removeFirst();
if (!(stackElement.getClass() == PropertyExpression.class)) return pe;
PropertyExpression classPropertyExpressionContainer = (PropertyExpression) stackElement;
classPropertyExpressionContainer.setObjectExpression(found);
return pe;
} } | public class class_name {
private Expression correctClassClassChain(PropertyExpression pe) {
LinkedList<Expression> stack = new LinkedList<Expression>();
ClassExpression found = null;
for (Expression it = pe; it != null; it = ((PropertyExpression) it).getObjectExpression()) {
if (it instanceof ClassExpression) {
found = (ClassExpression) it; // depends on control dependency: [if], data = [none]
break;
} else if (!(it.getClass() == PropertyExpression.class)) {
return pe; // depends on control dependency: [if], data = [none]
}
stack.addFirst(it); // depends on control dependency: [for], data = [it]
}
if (found == null) return pe;
if (stack.isEmpty()) return pe;
Object stackElement = stack.removeFirst();
if (!(stackElement.getClass() == PropertyExpression.class)) return pe;
PropertyExpression classPropertyExpression = (PropertyExpression) stackElement;
String propertyNamePart = classPropertyExpression.getPropertyAsString();
if (propertyNamePart == null || !propertyNamePart.equals("class")) return pe;
found.setSourcePosition(classPropertyExpression);
if (stack.isEmpty()) return found;
stackElement = stack.removeFirst();
if (!(stackElement.getClass() == PropertyExpression.class)) return pe;
PropertyExpression classPropertyExpressionContainer = (PropertyExpression) stackElement;
classPropertyExpressionContainer.setObjectExpression(found);
return pe;
} } |
public class class_name {
private Object getConstantValue(FieldType type, byte[] block)
{
Object value;
DataType dataType = type.getDataType();
if (dataType == null)
{
value = null;
}
else
{
switch (dataType)
{
case DURATION:
{
value = MPPUtility.getAdjustedDuration(m_properties, MPPUtility.getInt(block, getValueOffset()), MPPUtility.getDurationTimeUnits(MPPUtility.getShort(block, getTimeUnitsOffset())));
break;
}
case NUMERIC:
{
value = Double.valueOf(MPPUtility.getDouble(block, getValueOffset()));
break;
}
case PERCENTAGE:
{
value = Double.valueOf(MPPUtility.getShort(block, getValueOffset()));
break;
}
case CURRENCY:
{
value = Double.valueOf(MPPUtility.getDouble(block, getValueOffset()) / 100);
break;
}
case STRING:
{
int textOffset = getTextOffset(block);
value = MPPUtility.getUnicodeString(m_criteriaData, m_dataOffset + m_criteriaTextStart + textOffset);
break;
}
case BOOLEAN:
{
int intValue = MPPUtility.getShort(block, getValueOffset());
value = (intValue == 1 ? Boolean.TRUE : Boolean.FALSE);
break;
}
case DATE:
{
value = MPPUtility.getTimestamp(block, getValueOffset());
break;
}
default:
{
value = null;
break;
}
}
}
return value;
} } | public class class_name {
private Object getConstantValue(FieldType type, byte[] block)
{
Object value;
DataType dataType = type.getDataType();
if (dataType == null)
{
value = null; // depends on control dependency: [if], data = [none]
}
else
{
switch (dataType)
{
case DURATION:
{
value = MPPUtility.getAdjustedDuration(m_properties, MPPUtility.getInt(block, getValueOffset()), MPPUtility.getDurationTimeUnits(MPPUtility.getShort(block, getTimeUnitsOffset())));
break;
}
case NUMERIC:
{
value = Double.valueOf(MPPUtility.getDouble(block, getValueOffset()));
break;
}
case PERCENTAGE:
{
value = Double.valueOf(MPPUtility.getShort(block, getValueOffset()));
break;
}
case CURRENCY:
{
value = Double.valueOf(MPPUtility.getDouble(block, getValueOffset()) / 100);
break;
}
case STRING:
{
int textOffset = getTextOffset(block);
value = MPPUtility.getUnicodeString(m_criteriaData, m_dataOffset + m_criteriaTextStart + textOffset);
break;
}
case BOOLEAN:
{
int intValue = MPPUtility.getShort(block, getValueOffset());
value = (intValue == 1 ? Boolean.TRUE : Boolean.FALSE);
break;
}
case DATE:
{
value = MPPUtility.getTimestamp(block, getValueOffset());
break;
}
default:
{
value = null;
break;
}
}
}
return value;
} } |
public class class_name {
@Override
public void tearDownOperation() throws SQLException {
Statement statement = null;
try {
Connection connection = getConnection();
statement = connection.createStatement();
disableReferentialIntegrity(statement);
List<String> tableNames = getTableNames(getConnection());
deleteContent(tableNames, statement);
} catch (SQLException e) {
LOG.error(e.getMessage(), e);
try {
rollback();
} catch (SQLException e1) {
LOG.error(e1.getMessage(), e1);
}
} finally {
try {
enableReferentialIntegrity(statement);
if (statement != null) {
statement.close();
}
commit();
closeConnection();
} catch (Exception e) {
rollback();
LOG.error(e.getMessage(), e);
}
}
} } | public class class_name {
@Override
public void tearDownOperation() throws SQLException {
Statement statement = null;
try {
Connection connection = getConnection();
statement = connection.createStatement();
disableReferentialIntegrity(statement);
List<String> tableNames = getTableNames(getConnection());
deleteContent(tableNames, statement);
} catch (SQLException e) {
LOG.error(e.getMessage(), e);
try {
rollback(); // depends on control dependency: [try], data = [none]
} catch (SQLException e1) {
LOG.error(e1.getMessage(), e1);
} // depends on control dependency: [catch], data = [none]
} finally {
try {
enableReferentialIntegrity(statement); // depends on control dependency: [try], data = [none]
if (statement != null) {
statement.close(); // depends on control dependency: [if], data = [none]
}
commit(); // depends on control dependency: [try], data = [none]
closeConnection(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
rollback();
LOG.error(e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
private void parseResource(final Element resourceElement, final Collection<Resource> resources) {
final String tagName = resourceElement.getTagName();
final String uri = resourceElement.getTextContent();
if (TAG_GROUP_REF.equals(tagName)) {
// uri in this case is the group name
resources.addAll(getResourcesForGroup(uri));
}
if (getResourceType(resourceElement) != null) {
final Resource resource = createResource(resourceElement);
LOG.debug("\t\tadding resource: {}", resource);
resources.add(resource);
}
} } | public class class_name {
private void parseResource(final Element resourceElement, final Collection<Resource> resources) {
final String tagName = resourceElement.getTagName();
final String uri = resourceElement.getTextContent();
if (TAG_GROUP_REF.equals(tagName)) {
// uri in this case is the group name
resources.addAll(getResourcesForGroup(uri));
// depends on control dependency: [if], data = [none]
}
if (getResourceType(resourceElement) != null) {
final Resource resource = createResource(resourceElement);
LOG.debug("\t\tadding resource: {}", resource);
// depends on control dependency: [if], data = [none]
resources.add(resource);
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void stop() {
if (this.active) {
this.mongodProcess.stop();
this.active = false;
LOG.info("Successfully stopped EmbeddedMongoDB @ {}:{}", this.host, this.port);
}
} } | public class class_name {
public void stop() {
if (this.active) {
this.mongodProcess.stop(); // depends on control dependency: [if], data = [none]
this.active = false; // depends on control dependency: [if], data = [none]
LOG.info("Successfully stopped EmbeddedMongoDB @ {}:{}", this.host, this.port); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private void update(ByteBuffer buffer) {
int pos = buffer.position();
int limit = buffer.limit();
assert (pos <= limit);
int rem = limit - pos;
if (rem <= 0)
return;
if (buffer instanceof DirectBuffer) {
adler = updateByteBuffer(adler, ((DirectBuffer)buffer).address(), pos, rem);
} else if (buffer.hasArray()) {
adler = updateBytes(adler, buffer.array(), pos + buffer.arrayOffset(), rem);
} else {
byte[] b = new byte[rem];
buffer.get(b);
adler = updateBytes(adler, b, 0, b.length);
}
buffer.position(limit);
} } | public class class_name {
private void update(ByteBuffer buffer) {
int pos = buffer.position();
int limit = buffer.limit();
assert (pos <= limit);
int rem = limit - pos;
if (rem <= 0)
return;
if (buffer instanceof DirectBuffer) {
adler = updateByteBuffer(adler, ((DirectBuffer)buffer).address(), pos, rem); // depends on control dependency: [if], data = [none]
} else if (buffer.hasArray()) {
adler = updateBytes(adler, buffer.array(), pos + buffer.arrayOffset(), rem); // depends on control dependency: [if], data = [none]
} else {
byte[] b = new byte[rem];
buffer.get(b); // depends on control dependency: [if], data = [none]
adler = updateBytes(adler, b, 0, b.length); // depends on control dependency: [if], data = [none]
}
buffer.position(limit);
} } |
public class class_name {
public void errorCommon(String[] msgCodes, Object[] objects) {
int msgIndex = 0;
if (!TYPE_ID_TOKEN.equals(this.getTokenType())) {
msgIndex = 1;
}
if (!bInboundSupported) {
Tr.error(tcCommon, msgCodes[msgIndex], objects);
}
} } | public class class_name {
public void errorCommon(String[] msgCodes, Object[] objects) {
int msgIndex = 0;
if (!TYPE_ID_TOKEN.equals(this.getTokenType())) {
msgIndex = 1; // depends on control dependency: [if], data = [none]
}
if (!bInboundSupported) {
Tr.error(tcCommon, msgCodes[msgIndex], objects); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public Node getPreviousSiblingElement() {
parentNode.initChildElementNodes();
if (siblingElementIndex == -1) {
for (int i = siblingIndex - 1; i >= 0; i--) {
Node sibling = parentNode.childNodes.get(i);
if (sibling.getNodeType() == NodeType.ELEMENT) {
return sibling;
}
}
return null;
}
int index = siblingElementIndex - 1;
if (index < 0) {
return null;
}
return parentNode.childElementNodes[index];
} } | public class class_name {
public Node getPreviousSiblingElement() {
parentNode.initChildElementNodes();
if (siblingElementIndex == -1) {
for (int i = siblingIndex - 1; i >= 0; i--) {
Node sibling = parentNode.childNodes.get(i);
if (sibling.getNodeType() == NodeType.ELEMENT) {
return sibling; // depends on control dependency: [if], data = [none]
}
}
return null; // depends on control dependency: [if], data = [none]
}
int index = siblingElementIndex - 1;
if (index < 0) {
return null; // depends on control dependency: [if], data = [none]
}
return parentNode.childElementNodes[index];
} } |
public class class_name {
public JsonObject newHar(String initialPageRef,
boolean captureHeaders,
boolean captureContent,
boolean captureBinaryContent) {
try {
// Request BMP to create a new HAR for this Proxy
HttpPut request = new HttpPut(requestURIBuilder()
.setPath(proxyURIPath() + "/har")
.build());
// Add form parameters to the request
applyFormParamsToHttpRequest(request,
new BasicNameValuePair("initialPageRef", initialPageRef),
new BasicNameValuePair("captureHeaders", Boolean.toString(captureHeaders)),
new BasicNameValuePair("captureContent", Boolean.toString(captureContent)),
new BasicNameValuePair("captureBinaryContent", Boolean.toString(captureBinaryContent)));
// Execute request
CloseableHttpResponse response = HTTPclient.execute(request);
// Parse response into JSON
JsonObject previousHar = httpResponseToJsonObject(response);
// Close HTTP Response
response.close();
return previousHar;
} catch (Exception e) {
throw new BMPCUnableToCreateHarException(e);
}
} } | public class class_name {
public JsonObject newHar(String initialPageRef,
boolean captureHeaders,
boolean captureContent,
boolean captureBinaryContent) {
try {
// Request BMP to create a new HAR for this Proxy
HttpPut request = new HttpPut(requestURIBuilder()
.setPath(proxyURIPath() + "/har")
.build());
// Add form parameters to the request
applyFormParamsToHttpRequest(request,
new BasicNameValuePair("initialPageRef", initialPageRef),
new BasicNameValuePair("captureHeaders", Boolean.toString(captureHeaders)),
new BasicNameValuePair("captureContent", Boolean.toString(captureContent)),
new BasicNameValuePair("captureBinaryContent", Boolean.toString(captureBinaryContent))); // depends on control dependency: [try], data = [none]
// Execute request
CloseableHttpResponse response = HTTPclient.execute(request);
// Parse response into JSON
JsonObject previousHar = httpResponseToJsonObject(response);
// Close HTTP Response
response.close(); // depends on control dependency: [try], data = [none]
return previousHar; // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new BMPCUnableToCreateHarException(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
protected MetaClass createNormalMetaClass(Class theClass, MetaClassRegistry registry) {
if(theClass != ExpandoMetaClass.class) {
return new ExpandoMetaClass(theClass, true, true);
}
else {
return super.createNormalMetaClass(theClass, registry);
}
} } | public class class_name {
protected MetaClass createNormalMetaClass(Class theClass, MetaClassRegistry registry) {
if(theClass != ExpandoMetaClass.class) {
return new ExpandoMetaClass(theClass, true, true); // depends on control dependency: [if], data = [(theClass]
}
else {
return super.createNormalMetaClass(theClass, registry); // depends on control dependency: [if], data = [(theClass]
}
} } |
public class class_name {
public synchronized static SQLiteDatabase getConnection(Context context) {
if (database == null) {
// Construct the single helper and open the unique(!) db connection for the app
database = new CupboardDbHelper(context.getApplicationContext()).getWritableDatabase();
}
return database;
} } | public class class_name {
public synchronized static SQLiteDatabase getConnection(Context context) {
if (database == null) {
// Construct the single helper and open the unique(!) db connection for the app
database = new CupboardDbHelper(context.getApplicationContext()).getWritableDatabase(); // depends on control dependency: [if], data = [none]
}
return database;
} } |
public class class_name {
public static String anonymize(String ip) {
InetAddress inetAddress;
try {
inetAddress = InetAddresses.forString(ip);
} catch (IllegalArgumentException e) {
logger.warn(e.getMessage(), e);
inetAddress = null;
}
InetAddress anonymized = null;
if (inetAddress instanceof Inet4Address) {
anonymized = anonymizeIpV4Address((Inet4Address) inetAddress);
} else if (inetAddress instanceof Inet6Address) {
anonymized = anonymizeIpV6Address((Inet6Address) inetAddress);
}
if (anonymized != null) {
return anonymized.getHostAddress();
} else {
return null;
}
} } | public class class_name {
public static String anonymize(String ip) {
InetAddress inetAddress;
try {
inetAddress = InetAddresses.forString(ip); // depends on control dependency: [try], data = [none]
} catch (IllegalArgumentException e) {
logger.warn(e.getMessage(), e);
inetAddress = null;
} // depends on control dependency: [catch], data = [none]
InetAddress anonymized = null;
if (inetAddress instanceof Inet4Address) {
anonymized = anonymizeIpV4Address((Inet4Address) inetAddress); // depends on control dependency: [if], data = [none]
} else if (inetAddress instanceof Inet6Address) {
anonymized = anonymizeIpV6Address((Inet6Address) inetAddress); // depends on control dependency: [if], data = [none]
}
if (anonymized != null) {
return anonymized.getHostAddress(); // depends on control dependency: [if], data = [none]
} else {
return null; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private static <D, T> void executeCommandAsync(final String database, final BsonDocument command,
final Decoder<D> decoder, final AsyncConnection connection,
final ReadPreference readPreference,
final CommandWriteTransformerAsync<D, T> transformer,
final SessionContext sessionContext,
final SingleResultCallback<T> callback) {
connection.commandAsync(database, command, new NoOpFieldNameValidator(), readPreference, decoder, sessionContext,
new SingleResultCallback<D>() {
@Override
public void onResult(final D result, final Throwable t) {
if (t != null) {
callback.onResult(null, t);
} else {
try {
T transformedResult = transformer.apply(result, connection);
callback.onResult(transformedResult, null);
} catch (Exception e) {
callback.onResult(null, e);
}
}
}
});
} } | public class class_name {
private static <D, T> void executeCommandAsync(final String database, final BsonDocument command,
final Decoder<D> decoder, final AsyncConnection connection,
final ReadPreference readPreference,
final CommandWriteTransformerAsync<D, T> transformer,
final SessionContext sessionContext,
final SingleResultCallback<T> callback) {
connection.commandAsync(database, command, new NoOpFieldNameValidator(), readPreference, decoder, sessionContext,
new SingleResultCallback<D>() {
@Override
public void onResult(final D result, final Throwable t) {
if (t != null) {
callback.onResult(null, t); // depends on control dependency: [if], data = [none]
} else {
try {
T transformedResult = transformer.apply(result, connection);
callback.onResult(transformedResult, null); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
callback.onResult(null, e);
} // depends on control dependency: [catch], data = [none]
}
}
});
} } |
public class class_name {
protected Map<String, Object> loadInstanceDataFromNodeAttributes(
final INodeEntry node,
final Description description
)
{
HashMap<String, Object> config = new HashMap<>();
for (Property property : description.getProperties()) {
Map<String, Object> renderingOptions = property.getRenderingOptions();
if (null == renderingOptions) {
continue;
}
Object o = renderingOptions.get(
StringRenderingConstants.INSTANCE_SCOPE_NODE_ATTRIBUTE_KEY
);
if (null == o || !(o instanceof String)) {
continue;
}
String attribute = (String) o;
String s = node.getAttributes().get(attribute);
if (s == null) {
continue;
}
config.put(property.getName(), s);
}
return config;
} } | public class class_name {
protected Map<String, Object> loadInstanceDataFromNodeAttributes(
final INodeEntry node,
final Description description
)
{
HashMap<String, Object> config = new HashMap<>();
for (Property property : description.getProperties()) {
Map<String, Object> renderingOptions = property.getRenderingOptions();
if (null == renderingOptions) {
continue;
}
Object o = renderingOptions.get(
StringRenderingConstants.INSTANCE_SCOPE_NODE_ATTRIBUTE_KEY
);
if (null == o || !(o instanceof String)) {
continue;
}
String attribute = (String) o;
String s = node.getAttributes().get(attribute);
if (s == null) {
continue;
}
config.put(property.getName(), s); // depends on control dependency: [for], data = [property]
}
return config;
} } |
public class class_name {
public void marshall(PutConfigurationRecorderRequest putConfigurationRecorderRequest, ProtocolMarshaller protocolMarshaller) {
if (putConfigurationRecorderRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(putConfigurationRecorderRequest.getConfigurationRecorder(), CONFIGURATIONRECORDER_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(PutConfigurationRecorderRequest putConfigurationRecorderRequest, ProtocolMarshaller protocolMarshaller) {
if (putConfigurationRecorderRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(putConfigurationRecorderRequest.getConfigurationRecorder(), CONFIGURATIONRECORDER_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private void createFileMonitor() {
try {
ltpaFileMonitor = new SecurityFileMonitor(this);
setFileMonitorRegistration(ltpaFileMonitor.monitorFiles(Arrays.asList(keyImportFile), monitorInterval));
} catch (Exception e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Exception creating the LTPA file monitor.", e);
}
}
} } | public class class_name {
private void createFileMonitor() {
try {
ltpaFileMonitor = new SecurityFileMonitor(this); // depends on control dependency: [try], data = [none]
setFileMonitorRegistration(ltpaFileMonitor.monitorFiles(Arrays.asList(keyImportFile), monitorInterval)); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Exception creating the LTPA file monitor.", e); // depends on control dependency: [if], data = [none]
}
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static Boolean[] toObject(boolean[] array) {
if (array == null) {
return null;
} else if (array.length == 0) {
return EMPTY_BOOLEAN_OBJECT_ARRAY;
}
final Boolean[] result = new Boolean[array.length];
for (int i = 0; i < array.length; i++) {
result[i] = (array[i] ? Boolean.TRUE : Boolean.FALSE);
}
return result;
} } | public class class_name {
public static Boolean[] toObject(boolean[] array) {
if (array == null) {
return null; // depends on control dependency: [if], data = [none]
} else if (array.length == 0) {
return EMPTY_BOOLEAN_OBJECT_ARRAY; // depends on control dependency: [if], data = [none]
}
final Boolean[] result = new Boolean[array.length];
for (int i = 0; i < array.length; i++) {
result[i] = (array[i] ? Boolean.TRUE : Boolean.FALSE); // depends on control dependency: [for], data = [i]
}
return result;
} } |
public class class_name {
@Override
public Collection<URL> getResources(String resName)
{
try
{
return new EnumerationList<URL>(delegate.getResources(resName));
} catch (IOException e)
{
throw new ResourceLoadingException(Tr.formatMessage(tc,
"error.loading.resource.CWOWB1005E",
resName
), e);
}
} } | public class class_name {
@Override
public Collection<URL> getResources(String resName)
{
try
{
return new EnumerationList<URL>(delegate.getResources(resName)); // depends on control dependency: [try], data = [none]
} catch (IOException e)
{
throw new ResourceLoadingException(Tr.formatMessage(tc,
"error.loading.resource.CWOWB1005E",
resName
), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void setNeedleBehavior(final NeedleBehavior BEHAVIOR) {
if (null == needleBehavior) {
_needleBehavior = null == BEHAVIOR ? NeedleBehavior.STANDARD : BEHAVIOR;
} else {
needleBehavior.set(BEHAVIOR);
}
} } | public class class_name {
public void setNeedleBehavior(final NeedleBehavior BEHAVIOR) {
if (null == needleBehavior) {
_needleBehavior = null == BEHAVIOR ? NeedleBehavior.STANDARD : BEHAVIOR; // depends on control dependency: [if], data = [none]
} else {
needleBehavior.set(BEHAVIOR); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public AnnotatedTypeBuilder<X> addToMethod(Method method, Annotation annotation) {
if (methods.get(method) == null) {
methods.put(method, new AnnotationBuilder());
}
methods.get(method).add(annotation);
return this;
} } | public class class_name {
public AnnotatedTypeBuilder<X> addToMethod(Method method, Annotation annotation) {
if (methods.get(method) == null) {
methods.put(method, new AnnotationBuilder()); // depends on control dependency: [if], data = [none]
}
methods.get(method).add(annotation);
return this;
} } |
public class class_name {
@Override
protected LicenseProvider createLicenseProvider(String licenseAgreementPrefix, String licenseInformationPrefix,
String subsystemLicenseType) {
String featureLicenseAgreementPrefix = this.featureName + "/" + licenseAgreementPrefix;
String featureLicenseInformationPrefix = licenseInformationPrefix == null ? null : this.featureName + "/" + licenseInformationPrefix;
if (featureLicenseInformationPrefix == null) {
LicenseProvider lp = ZipLicenseProvider.createInstance(zip, featureLicenseAgreementPrefix);
if (lp != null)
return lp;
} else {
wlp.lib.extract.ReturnCode licenseReturnCode = ZipLicenseProvider.buildInstance(zip, featureLicenseAgreementPrefix,
featureLicenseInformationPrefix);
if (licenseReturnCode == wlp.lib.extract.ReturnCode.OK) {
// Everything is set up ok so carry on
return ZipLicenseProvider.getInstance();
}
}
// An error indicates that the IBM licenses could not be found so we can use the subsystem header
if (subsystemLicenseType != null && subsystemLicenseType.length() > 0) {
return new ThirdPartyLicenseProvider(featureDefinition.getFeatureName(), subsystemLicenseType);
}
return null;
} } | public class class_name {
@Override
protected LicenseProvider createLicenseProvider(String licenseAgreementPrefix, String licenseInformationPrefix,
String subsystemLicenseType) {
String featureLicenseAgreementPrefix = this.featureName + "/" + licenseAgreementPrefix;
String featureLicenseInformationPrefix = licenseInformationPrefix == null ? null : this.featureName + "/" + licenseInformationPrefix;
if (featureLicenseInformationPrefix == null) {
LicenseProvider lp = ZipLicenseProvider.createInstance(zip, featureLicenseAgreementPrefix);
if (lp != null)
return lp;
} else {
wlp.lib.extract.ReturnCode licenseReturnCode = ZipLicenseProvider.buildInstance(zip, featureLicenseAgreementPrefix,
featureLicenseInformationPrefix);
if (licenseReturnCode == wlp.lib.extract.ReturnCode.OK) {
// Everything is set up ok so carry on
return ZipLicenseProvider.getInstance(); // depends on control dependency: [if], data = [none]
}
}
// An error indicates that the IBM licenses could not be found so we can use the subsystem header
if (subsystemLicenseType != null && subsystemLicenseType.length() > 0) {
return new ThirdPartyLicenseProvider(featureDefinition.getFeatureName(), subsystemLicenseType); // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
private MethodSymbol firstUnimplementedAbstractImpl(ClassSymbol impl, ClassSymbol c) {
MethodSymbol undef = null;
// Do not bother to search in classes that are not abstract,
// since they cannot have abstract members.
if (c == impl || (c.flags() & (ABSTRACT | INTERFACE)) != 0) {
Scope s = c.members();
for (Scope.Entry e = s.elems;
undef == null && e != null;
e = e.sibling) {
if (e.sym.kind == MTH &&
(e.sym.flags() & (ABSTRACT|IPROXY|DEFAULT)) == ABSTRACT) {
MethodSymbol absmeth = (MethodSymbol)e.sym;
MethodSymbol implmeth = absmeth.implementation(impl, this, true);
if (implmeth == null || implmeth == absmeth) {
//look for default implementations
if (allowDefaultMethods) {
MethodSymbol prov = interfaceCandidates(impl.type, absmeth).head;
if (prov != null && prov.overrides(absmeth, impl, this, true)) {
implmeth = prov;
}
}
}
if (implmeth == null || implmeth == absmeth) {
undef = absmeth;
}
}
}
if (undef == null) {
Type st = supertype(c.type);
if (st.hasTag(CLASS))
undef = firstUnimplementedAbstractImpl(impl, (ClassSymbol)st.tsym);
}
for (List<Type> l = interfaces(c.type);
undef == null && l.nonEmpty();
l = l.tail) {
undef = firstUnimplementedAbstractImpl(impl, (ClassSymbol)l.head.tsym);
}
}
return undef;
} } | public class class_name {
private MethodSymbol firstUnimplementedAbstractImpl(ClassSymbol impl, ClassSymbol c) {
MethodSymbol undef = null;
// Do not bother to search in classes that are not abstract,
// since they cannot have abstract members.
if (c == impl || (c.flags() & (ABSTRACT | INTERFACE)) != 0) {
Scope s = c.members();
for (Scope.Entry e = s.elems;
undef == null && e != null;
e = e.sibling) {
if (e.sym.kind == MTH &&
(e.sym.flags() & (ABSTRACT|IPROXY|DEFAULT)) == ABSTRACT) {
MethodSymbol absmeth = (MethodSymbol)e.sym;
MethodSymbol implmeth = absmeth.implementation(impl, this, true);
if (implmeth == null || implmeth == absmeth) {
//look for default implementations
if (allowDefaultMethods) {
MethodSymbol prov = interfaceCandidates(impl.type, absmeth).head;
if (prov != null && prov.overrides(absmeth, impl, this, true)) {
implmeth = prov; // depends on control dependency: [if], data = [none]
}
}
}
if (implmeth == null || implmeth == absmeth) {
undef = absmeth; // depends on control dependency: [if], data = [none]
}
}
}
if (undef == null) {
Type st = supertype(c.type);
if (st.hasTag(CLASS))
undef = firstUnimplementedAbstractImpl(impl, (ClassSymbol)st.tsym);
}
for (List<Type> l = interfaces(c.type);
undef == null && l.nonEmpty();
l = l.tail) {
undef = firstUnimplementedAbstractImpl(impl, (ClassSymbol)l.head.tsym); // depends on control dependency: [for], data = [l]
}
}
return undef;
} } |
public class class_name {
@MapMethod
public int length(Object o){
if(o instanceof List){
return ((List) o).size();
}else if(o instanceof Map){
return ((Map) o).size();
}else if(o instanceof String){
return ((String) o).length();
}
return 0;
} } | public class class_name {
@MapMethod
public int length(Object o){
if(o instanceof List){
return ((List) o).size(); // depends on control dependency: [if], data = [none]
}else if(o instanceof Map){
return ((Map) o).size(); // depends on control dependency: [if], data = [none]
}else if(o instanceof String){
return ((String) o).length(); // depends on control dependency: [if], data = [none]
}
return 0;
} } |
public class class_name {
public EClass getIfcDistributionPort() {
if (ifcDistributionPortEClass == null) {
ifcDistributionPortEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(165);
}
return ifcDistributionPortEClass;
} } | public class class_name {
public EClass getIfcDistributionPort() {
if (ifcDistributionPortEClass == null) {
ifcDistributionPortEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(165);
// depends on control dependency: [if], data = [none]
}
return ifcDistributionPortEClass;
} } |
public class class_name {
public void marshall(GetCampaignRequest getCampaignRequest, ProtocolMarshaller protocolMarshaller) {
if (getCampaignRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(getCampaignRequest.getApplicationId(), APPLICATIONID_BINDING);
protocolMarshaller.marshall(getCampaignRequest.getCampaignId(), CAMPAIGNID_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(GetCampaignRequest getCampaignRequest, ProtocolMarshaller protocolMarshaller) {
if (getCampaignRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(getCampaignRequest.getApplicationId(), APPLICATIONID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(getCampaignRequest.getCampaignId(), CAMPAIGNID_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private boolean checkIfHostHasChanged(EventChannelStruct event_channel_struct) {
boolean retVal = false;
try {
IORdump dump = new IORdump(event_channel_struct.adm_device_proxy);
String server_host = dump.get_hostname();
// Keep server_host name without Fully Qualify Domain Name
int idx = server_host.indexOf('.');
if (idx > 0)
server_host = server_host.substring(0, idx);
if (!event_channel_struct.host.equals(server_host))
retVal = true;
} catch (DevFailed e) { /* */ }
return retVal;
} } | public class class_name {
private boolean checkIfHostHasChanged(EventChannelStruct event_channel_struct) {
boolean retVal = false;
try {
IORdump dump = new IORdump(event_channel_struct.adm_device_proxy);
String server_host = dump.get_hostname();
// Keep server_host name without Fully Qualify Domain Name
int idx = server_host.indexOf('.');
if (idx > 0)
server_host = server_host.substring(0, idx);
if (!event_channel_struct.host.equals(server_host))
retVal = true;
} catch (DevFailed e) { /* */ } // depends on control dependency: [catch], data = [none]
return retVal;
} } |
public class class_name {
private Collection<Multigraph<T,E>> enumerateSimpleGraphs(
Multigraph<T,E> input, List<IntPair> connected,
int curPair, Multigraph<T,E> toCopy) {
List<Multigraph<T,E>> simpleGraphs = new LinkedList<Multigraph<T,E>>();
IntPair p = connected.get(curPair);
// Get the set of edges between the current vertex pair
Set<E> edges = input.getEdges(p.x, p.y);
// Pick one of the edges and generate a graph from the remaining pairs
for (E e : edges) {
// Make a copy of the input graph and add this edge to the graph
Multigraph<T,E> m = toCopy.copy(toCopy.vertices());
// Graphs.asMultigraph(new GenericGraph<E>(toCopy));
// Add one of the edges that connects the current pair
m.add(e);
// If there are more pairs to connect, then make the recursive call,
// passing in this graph
if (curPair + 1 < connected.size()) {
simpleGraphs.addAll(
enumerateSimpleGraphs(input, connected, curPair + 1, m));
}
// Otherwise, this is the last vertex pair for which an edge is to
// be selected, so add it to the current list
else {
// System.out.println("Constructed next enumeration: " + m);
simpleGraphs.add(m);
}
}
return simpleGraphs;
} } | public class class_name {
private Collection<Multigraph<T,E>> enumerateSimpleGraphs(
Multigraph<T,E> input, List<IntPair> connected,
int curPair, Multigraph<T,E> toCopy) {
List<Multigraph<T,E>> simpleGraphs = new LinkedList<Multigraph<T,E>>();
IntPair p = connected.get(curPair);
// Get the set of edges between the current vertex pair
Set<E> edges = input.getEdges(p.x, p.y);
// Pick one of the edges and generate a graph from the remaining pairs
for (E e : edges) {
// Make a copy of the input graph and add this edge to the graph
Multigraph<T,E> m = toCopy.copy(toCopy.vertices());
// Graphs.asMultigraph(new GenericGraph<E>(toCopy));
// Add one of the edges that connects the current pair
m.add(e); // depends on control dependency: [for], data = [e]
// If there are more pairs to connect, then make the recursive call,
// passing in this graph
if (curPair + 1 < connected.size()) {
simpleGraphs.addAll(
enumerateSimpleGraphs(input, connected, curPair + 1, m)); // depends on control dependency: [if], data = [none]
}
// Otherwise, this is the last vertex pair for which an edge is to
// be selected, so add it to the current list
else {
// System.out.println("Constructed next enumeration: " + m);
simpleGraphs.add(m); // depends on control dependency: [if], data = [none]
}
}
return simpleGraphs;
} } |
public class class_name {
public boolean setClipboardContents(Transferable data)
{
if (data == null)
return false;
if ((clipboardWriteStatus & CLIPBOARD_DISABLED) == CLIPBOARD_DISABLED)
return false; // Rejected it last time, don't ask again
clipboardWriteStatus = CLIPBOARD_ENABLED;
if (cs == null)
{
try {
cs = (ClipboardService)ServiceManager.lookup("javax.jnlp.ClipboardService");
} catch (UnavailableServiceException e) {
cs = null;
}
}
if (cs != null)
{ // set the system clipboard contents to a string selection
try {
cs.setContents(data);
clipboardWriteStatus = CLIPBOARD_ENABLED;
return true;
} catch (Exception e) {
e.printStackTrace();
}
}
return false;
} } | public class class_name {
public boolean setClipboardContents(Transferable data)
{
if (data == null)
return false;
if ((clipboardWriteStatus & CLIPBOARD_DISABLED) == CLIPBOARD_DISABLED)
return false; // Rejected it last time, don't ask again
clipboardWriteStatus = CLIPBOARD_ENABLED;
if (cs == null)
{
try {
cs = (ClipboardService)ServiceManager.lookup("javax.jnlp.ClipboardService"); // depends on control dependency: [try], data = [none]
} catch (UnavailableServiceException e) {
cs = null;
} // depends on control dependency: [catch], data = [none]
}
if (cs != null)
{ // set the system clipboard contents to a string selection
try {
cs.setContents(data); // depends on control dependency: [try], data = [none]
clipboardWriteStatus = CLIPBOARD_ENABLED; // depends on control dependency: [try], data = [none]
return true; // depends on control dependency: [try], data = [none]
} catch (Exception e) {
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
}
return false;
} } |
public class class_name {
static void buildHashTable(Block keyBlock, int keyOffset, int keyCount, MethodHandle keyBlockHashCode, int[] outputHashTable, int hashTableOffset, int hashTableSize)
{
for (int i = 0; i < keyCount; i++) {
int hash = getHashPosition(keyBlock, keyOffset + i, keyBlockHashCode, hashTableSize);
while (true) {
if (outputHashTable[hashTableOffset + hash] == -1) {
outputHashTable[hashTableOffset + hash] = i;
break;
}
hash++;
if (hash == hashTableSize) {
hash = 0;
}
}
}
} } | public class class_name {
static void buildHashTable(Block keyBlock, int keyOffset, int keyCount, MethodHandle keyBlockHashCode, int[] outputHashTable, int hashTableOffset, int hashTableSize)
{
for (int i = 0; i < keyCount; i++) {
int hash = getHashPosition(keyBlock, keyOffset + i, keyBlockHashCode, hashTableSize);
while (true) {
if (outputHashTable[hashTableOffset + hash] == -1) {
outputHashTable[hashTableOffset + hash] = i; // depends on control dependency: [if], data = [none]
break;
}
hash++; // depends on control dependency: [while], data = [none]
if (hash == hashTableSize) {
hash = 0; // depends on control dependency: [if], data = [none]
}
}
}
} } |
public class class_name {
public EClass getGCBEZRG() {
if (gcbezrgEClass == null) {
gcbezrgEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(492);
}
return gcbezrgEClass;
} } | public class class_name {
public EClass getGCBEZRG() {
if (gcbezrgEClass == null) {
gcbezrgEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(492); // depends on control dependency: [if], data = [none]
}
return gcbezrgEClass;
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.