code stringlengths 130 281k | code_dependency stringlengths 182 306k |
|---|---|
public class class_name {
public static String byteToHex(byte b[]) {
int len = b.length;
char[] s = new char[len * 2];
for (int i = 0, j = 0; i < len; i++) {
int c = ((int) b[i]) & 0xff;
s[j++] = HEXCHAR[c >> 4 & 0xf];
s[j++] = HEXCHAR[c & 0xf];
}
return new String(s);
} } | public class class_name {
public static String byteToHex(byte b[]) {
int len = b.length;
char[] s = new char[len * 2];
for (int i = 0, j = 0; i < len; i++) {
int c = ((int) b[i]) & 0xff;
s[j++] = HEXCHAR[c >> 4 & 0xf]; // depends on control dependency: [for], data = [none]
s[j++] = HEXCHAR[c & 0xf]; // depends on control dependency: [for], data = [none]
}
return new String(s);
} } |
public class class_name {
protected void modify(Transaction t) {
try {
this.lock.writeLock().lock();
t.perform();
} finally {
this.lock.writeLock().unlock();
}
} } | public class class_name {
protected void modify(Transaction t) {
try {
this.lock.writeLock().lock(); // depends on control dependency: [try], data = [none]
t.perform(); // depends on control dependency: [try], data = [none]
} finally {
this.lock.writeLock().unlock();
}
} } |
public class class_name {
public Label newLabel(String labelStr, int options) {
if (options == TAG_LABEL) {
return new TaggedWord(null, labelStr);
}
return new TaggedWord(labelStr);
} } | public class class_name {
public Label newLabel(String labelStr, int options) {
if (options == TAG_LABEL) {
return new TaggedWord(null, labelStr);
// depends on control dependency: [if], data = [none]
}
return new TaggedWord(labelStr);
} } |
public class class_name {
@SuppressWarnings( {"UnusedDeclaration", "unchecked"} )
public <T> ObjectIdGenerator<T> findObjectIdGenerator( ObjectIdGenerator<T> gen ) {
if ( null != generators ) {
for ( ObjectIdGenerator<?> generator : generators ) {
if ( generator.canUseFor( gen ) ) {
return (ObjectIdGenerator<T>) generator;
}
}
}
return null;
} } | public class class_name {
@SuppressWarnings( {"UnusedDeclaration", "unchecked"} )
public <T> ObjectIdGenerator<T> findObjectIdGenerator( ObjectIdGenerator<T> gen ) {
if ( null != generators ) {
for ( ObjectIdGenerator<?> generator : generators ) {
if ( generator.canUseFor( gen ) ) {
return (ObjectIdGenerator<T>) generator; // depends on control dependency: [if], data = [none]
}
}
}
return null;
} } |
public class class_name {
public void normalize() {
float base = 1;
// if(scores[0]>=0.0f)
// base = scores[0]/2;
float sum = 0;
for(int i=0;i<scores.length;i++){
float s = (float) Math.exp(scores[i]/base);
scores[i] = s;
sum +=s;
}
for(int i=0;i<scores.length;i++){
float s = scores[i]/sum;
scores[i] = s;
}
} } | public class class_name {
public void normalize() {
float base = 1;
// if(scores[0]>=0.0f)
// base = scores[0]/2;
float sum = 0;
for(int i=0;i<scores.length;i++){
float s = (float) Math.exp(scores[i]/base);
scores[i] = s;
// depends on control dependency: [for], data = [i]
sum +=s;
// depends on control dependency: [for], data = [none]
}
for(int i=0;i<scores.length;i++){
float s = scores[i]/sum;
scores[i] = s;
// depends on control dependency: [for], data = [i]
}
} } |
public class class_name {
public void shutdown () {
synchronized ( this.queueDiscoverers ) {
for (MBeanDestinationDiscovererScheduler oneDiscovererScheduler : this.queueDiscoverers.values()) {
oneDiscovererScheduler.stop();
}
}
synchronized ( this.brokerPollerMap ) {
for ( ActiveMQBrokerPoller onePoller : this.brokerPollerMap.values() ) {
onePoller.stop();
}
}
this.discovererExecutorService.shutdown();
} } | public class class_name {
public void shutdown () {
synchronized ( this.queueDiscoverers ) {
for (MBeanDestinationDiscovererScheduler oneDiscovererScheduler : this.queueDiscoverers.values()) {
oneDiscovererScheduler.stop(); // depends on control dependency: [for], data = [oneDiscovererScheduler]
}
}
synchronized ( this.brokerPollerMap ) {
for ( ActiveMQBrokerPoller onePoller : this.brokerPollerMap.values() ) {
onePoller.stop(); // depends on control dependency: [for], data = [onePoller]
}
}
this.discovererExecutorService.shutdown();
} } |
public class class_name {
public void marshall(TableDescription tableDescription, ProtocolMarshaller protocolMarshaller) {
if (tableDescription == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(tableDescription.getAttributeDefinitions(), ATTRIBUTEDEFINITIONS_BINDING);
protocolMarshaller.marshall(tableDescription.getTableName(), TABLENAME_BINDING);
protocolMarshaller.marshall(tableDescription.getKeySchema(), KEYSCHEMA_BINDING);
protocolMarshaller.marshall(tableDescription.getTableStatus(), TABLESTATUS_BINDING);
protocolMarshaller.marshall(tableDescription.getCreationDateTime(), CREATIONDATETIME_BINDING);
protocolMarshaller.marshall(tableDescription.getProvisionedThroughput(), PROVISIONEDTHROUGHPUT_BINDING);
protocolMarshaller.marshall(tableDescription.getTableSizeBytes(), TABLESIZEBYTES_BINDING);
protocolMarshaller.marshall(tableDescription.getItemCount(), ITEMCOUNT_BINDING);
protocolMarshaller.marshall(tableDescription.getTableArn(), TABLEARN_BINDING);
protocolMarshaller.marshall(tableDescription.getTableId(), TABLEID_BINDING);
protocolMarshaller.marshall(tableDescription.getBillingModeSummary(), BILLINGMODESUMMARY_BINDING);
protocolMarshaller.marshall(tableDescription.getLocalSecondaryIndexes(), LOCALSECONDARYINDEXES_BINDING);
protocolMarshaller.marshall(tableDescription.getGlobalSecondaryIndexes(), GLOBALSECONDARYINDEXES_BINDING);
protocolMarshaller.marshall(tableDescription.getStreamSpecification(), STREAMSPECIFICATION_BINDING);
protocolMarshaller.marshall(tableDescription.getLatestStreamLabel(), LATESTSTREAMLABEL_BINDING);
protocolMarshaller.marshall(tableDescription.getLatestStreamArn(), LATESTSTREAMARN_BINDING);
protocolMarshaller.marshall(tableDescription.getRestoreSummary(), RESTORESUMMARY_BINDING);
protocolMarshaller.marshall(tableDescription.getSSEDescription(), SSEDESCRIPTION_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(TableDescription tableDescription, ProtocolMarshaller protocolMarshaller) {
if (tableDescription == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(tableDescription.getAttributeDefinitions(), ATTRIBUTEDEFINITIONS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(tableDescription.getTableName(), TABLENAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(tableDescription.getKeySchema(), KEYSCHEMA_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(tableDescription.getTableStatus(), TABLESTATUS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(tableDescription.getCreationDateTime(), CREATIONDATETIME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(tableDescription.getProvisionedThroughput(), PROVISIONEDTHROUGHPUT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(tableDescription.getTableSizeBytes(), TABLESIZEBYTES_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(tableDescription.getItemCount(), ITEMCOUNT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(tableDescription.getTableArn(), TABLEARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(tableDescription.getTableId(), TABLEID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(tableDescription.getBillingModeSummary(), BILLINGMODESUMMARY_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(tableDescription.getLocalSecondaryIndexes(), LOCALSECONDARYINDEXES_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(tableDescription.getGlobalSecondaryIndexes(), GLOBALSECONDARYINDEXES_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(tableDescription.getStreamSpecification(), STREAMSPECIFICATION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(tableDescription.getLatestStreamLabel(), LATESTSTREAMLABEL_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(tableDescription.getLatestStreamArn(), LATESTSTREAMARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(tableDescription.getRestoreSummary(), RESTORESUMMARY_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(tableDescription.getSSEDescription(), SSEDESCRIPTION_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 Map<String, Map<String, Object>> getPropertyMetadataAndValuesAsMap() {
Map<String, Map<String, Object>> configMap = new HashMap<>();
for (ConfigurationProperty property : this) {
Map<String, Object> mapValue = new HashMap<>();
mapValue.put("isSecure", property.isSecure());
if (property.isSecure()) {
mapValue.put(VALUE_KEY, property.getEncryptedValue());
} else {
final String value = property.getConfigurationValue() == null ? null : property.getConfigurationValue().getValue();
mapValue.put(VALUE_KEY, value);
}
mapValue.put("displayValue", property.getDisplayValue());
configMap.put(property.getConfigKeyName(), mapValue);
}
return configMap;
} } | public class class_name {
public Map<String, Map<String, Object>> getPropertyMetadataAndValuesAsMap() {
Map<String, Map<String, Object>> configMap = new HashMap<>();
for (ConfigurationProperty property : this) {
Map<String, Object> mapValue = new HashMap<>();
mapValue.put("isSecure", property.isSecure()); // depends on control dependency: [for], data = [property]
if (property.isSecure()) {
mapValue.put(VALUE_KEY, property.getEncryptedValue()); // depends on control dependency: [if], data = [none]
} else {
final String value = property.getConfigurationValue() == null ? null : property.getConfigurationValue().getValue();
mapValue.put(VALUE_KEY, value); // depends on control dependency: [if], data = [none]
}
mapValue.put("displayValue", property.getDisplayValue()); // depends on control dependency: [for], data = [property]
configMap.put(property.getConfigKeyName(), mapValue); // depends on control dependency: [for], data = [property]
}
return configMap;
} } |
public class class_name {
public static Map<String, Object> toMap(XmlReaders readers){
Node root = readers.getNode("xml");
if (root == null){
return Collections.emptyMap();
}
NodeList children = root.getChildNodes();
if (children.getLength() == 0){
return Collections.emptyMap();
}
Map<String, Object> data = new HashMap<>(children.getLength());
Node n;
for (int i = 0; i<children.getLength(); i++){
n = children.item(i);
data.put(n.getNodeName(), n.getTextContent());
}
return data;
} } | public class class_name {
public static Map<String, Object> toMap(XmlReaders readers){
Node root = readers.getNode("xml");
if (root == null){
return Collections.emptyMap(); // depends on control dependency: [if], data = [none]
}
NodeList children = root.getChildNodes();
if (children.getLength() == 0){
return Collections.emptyMap(); // depends on control dependency: [if], data = [none]
}
Map<String, Object> data = new HashMap<>(children.getLength());
Node n;
for (int i = 0; i<children.getLength(); i++){
n = children.item(i); // depends on control dependency: [for], data = [i]
data.put(n.getNodeName(), n.getTextContent()); // depends on control dependency: [for], data = [none]
}
return data;
} } |
public class class_name {
public String getSchemaLocation(MessageVersion recMessageVersion, String schemaLocation)
{
String location = this.getField(MessageControl.BASE_SCHEMA_LOCATION).toString();
if (location == null)
location = DBConstants.BLANK;
else if (!location.endsWith("/"))
location += "/";
if ((recMessageVersion != null) && (!recMessageVersion.getField(MessageVersion.SCHEMA_LOCATION).isNull()))
location = location + recMessageVersion.getField(MessageVersion.SCHEMA_LOCATION).toString();
else
location = location + recMessageVersion.getField(MessageVersion.CODE).toString();
if (location != null)
{
if (!location.endsWith("/"))
location += "/";
return location + schemaLocation;
}
return schemaLocation;
} } | public class class_name {
public String getSchemaLocation(MessageVersion recMessageVersion, String schemaLocation)
{
String location = this.getField(MessageControl.BASE_SCHEMA_LOCATION).toString();
if (location == null)
location = DBConstants.BLANK;
else if (!location.endsWith("/"))
location += "/";
if ((recMessageVersion != null) && (!recMessageVersion.getField(MessageVersion.SCHEMA_LOCATION).isNull()))
location = location + recMessageVersion.getField(MessageVersion.SCHEMA_LOCATION).toString();
else
location = location + recMessageVersion.getField(MessageVersion.CODE).toString();
if (location != null)
{
if (!location.endsWith("/"))
location += "/";
return location + schemaLocation; // depends on control dependency: [if], data = [none]
}
return schemaLocation;
} } |
public class class_name {
Expression genCodeForParamAccess(String paramName, VarDefn varDefn) {
Expression source = OPT_DATA;
if (varDefn.isInjected()) {
// Special case for csp_nonce. It is created by the compiler itself, and users should not need
// to set it. So, instead of generating opt_ij_data.csp_nonce, we generate opt_ij_data &&
// opt_ij_data.csp_nonce.
// TODO(lukes): we only need to generate this logic if there aren't any other ij params
if (paramName.equals(CSP_NONCE_VARIABLE_NAME)) {
return OPT_IJ_DATA.and(OPT_IJ_DATA.dotAccess(paramName), codeGenerator);
}
source = OPT_IJ_DATA;
} else if (varDefn.kind() == VarDefn.Kind.STATE) {
return genCodeForStateAccess(paramName, (TemplateStateVar) varDefn);
}
return source.dotAccess(paramName);
} } | public class class_name {
Expression genCodeForParamAccess(String paramName, VarDefn varDefn) {
Expression source = OPT_DATA;
if (varDefn.isInjected()) {
// Special case for csp_nonce. It is created by the compiler itself, and users should not need
// to set it. So, instead of generating opt_ij_data.csp_nonce, we generate opt_ij_data &&
// opt_ij_data.csp_nonce.
// TODO(lukes): we only need to generate this logic if there aren't any other ij params
if (paramName.equals(CSP_NONCE_VARIABLE_NAME)) {
return OPT_IJ_DATA.and(OPT_IJ_DATA.dotAccess(paramName), codeGenerator); // depends on control dependency: [if], data = [none]
}
source = OPT_IJ_DATA; // depends on control dependency: [if], data = [none]
} else if (varDefn.kind() == VarDefn.Kind.STATE) {
return genCodeForStateAccess(paramName, (TemplateStateVar) varDefn); // depends on control dependency: [if], data = [none]
}
return source.dotAccess(paramName);
} } |
public class class_name {
static <E> ImmutableList<E> asImmutableList(Object[] elements, int length) {
switch (length) {
case 0:
return of();
case 1:
@SuppressWarnings("unchecked") // collection had only Es in it
ImmutableList<E> list = new SingletonImmutableList<E>((E) elements[0]);
return list;
default:
if (length < elements.length) {
elements = arraysCopyOf(elements, length);
}
return new RegularImmutableList<E>(elements);
}
} } | public class class_name {
static <E> ImmutableList<E> asImmutableList(Object[] elements, int length) {
switch (length) {
case 0:
return of();
case 1:
@SuppressWarnings("unchecked") // collection had only Es in it
ImmutableList<E> list = new SingletonImmutableList<E>((E) elements[0]);
return list;
default:
if (length < elements.length) {
elements = arraysCopyOf(elements, length); // depends on control dependency: [if], data = [none]
}
return new RegularImmutableList<E>(elements);
}
} } |
public class class_name {
@Override
public Set<Entry<String, Object>> entrySet() {
Map<String, Object> entries = new HashMap<String, Object>();
for (Property property : getProperties(_scope)) {
entries.put(property.getName(), property.getValue());
}
return entries.entrySet();
} } | public class class_name {
@Override
public Set<Entry<String, Object>> entrySet() {
Map<String, Object> entries = new HashMap<String, Object>();
for (Property property : getProperties(_scope)) {
entries.put(property.getName(), property.getValue()); // depends on control dependency: [for], data = [property]
}
return entries.entrySet();
} } |
public class class_name {
public boolean areParamsValid() {
if (queryType == QueryType.COUNT) {
if (eventCollection == null || eventCollection.isEmpty()) {
return false;
}
}
if (queryType == QueryType.COUNT_UNIQUE
|| queryType == QueryType.MINIMUM || queryType == QueryType.MAXIMUM
|| queryType == QueryType.AVERAGE || queryType == QueryType.MEDIAN
|| queryType == QueryType.PERCENTILE || queryType == QueryType.SUM
|| queryType == QueryType.SELECT_UNIQUE || queryType == QueryType.STANDARD_DEVIATION) {
if (eventCollection == null || eventCollection.isEmpty() || targetProperty == null || targetProperty.isEmpty()) {
return false;
}
}
if (queryType == QueryType.PERCENTILE) {
return percentile != null;
}
return true;
} } | public class class_name {
public boolean areParamsValid() {
if (queryType == QueryType.COUNT) {
if (eventCollection == null || eventCollection.isEmpty()) {
return false; // depends on control dependency: [if], data = [none]
}
}
if (queryType == QueryType.COUNT_UNIQUE
|| queryType == QueryType.MINIMUM || queryType == QueryType.MAXIMUM
|| queryType == QueryType.AVERAGE || queryType == QueryType.MEDIAN
|| queryType == QueryType.PERCENTILE || queryType == QueryType.SUM
|| queryType == QueryType.SELECT_UNIQUE || queryType == QueryType.STANDARD_DEVIATION) {
if (eventCollection == null || eventCollection.isEmpty() || targetProperty == null || targetProperty.isEmpty()) {
return false; // depends on control dependency: [if], data = [none]
}
}
if (queryType == QueryType.PERCENTILE) {
return percentile != null; // depends on control dependency: [if], data = [none]
}
return true;
} } |
public class class_name {
public boolean add( Object o )
{
boolean result = false;
if( o == null ) {
throw new IllegalArgumentException("Address sets do not support null.");
}
else if( o instanceof String ) {
result = super.add(convertAddress((String)o));
}
else if( o instanceof InternetAddress ) {
result = super.add(o);
}
else {
throw new IllegalArgumentException("Address sets cannot take objects of type '"+o.getClass().getName()+"'.");
}
return result;
} } | public class class_name {
public boolean add( Object o )
{
boolean result = false;
if( o == null ) {
throw new IllegalArgumentException("Address sets do not support null.");
}
else if( o instanceof String ) {
result = super.add(convertAddress((String)o)); // depends on control dependency: [if], data = [none]
}
else if( o instanceof InternetAddress ) {
result = super.add(o); // depends on control dependency: [if], data = [none]
}
else {
throw new IllegalArgumentException("Address sets cannot take objects of type '"+o.getClass().getName()+"'.");
}
return result;
} } |
public class class_name {
private boolean existsIn(String element, String[] a) {
for (String s : a) {
if (element.equals(s)) {
return true;
}
}
return false;
} } | public class class_name {
private boolean existsIn(String element, String[] a) {
for (String s : a) {
if (element.equals(s)) {
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
} } |
public class class_name {
public Planar<T> partialSpectrum(int ...which ) {
Planar<T> out = new Planar<>(getBandType(), which.length);
out.setWidth(width);
out.setHeight(height);
out.setStride(stride);
for (int i = 0; i < which.length; i++) {
out.setBand(i,getBand(which[i]));
}
return out;
} } | public class class_name {
public Planar<T> partialSpectrum(int ...which ) {
Planar<T> out = new Planar<>(getBandType(), which.length);
out.setWidth(width);
out.setHeight(height);
out.setStride(stride);
for (int i = 0; i < which.length; i++) {
out.setBand(i,getBand(which[i])); // depends on control dependency: [for], data = [i]
}
return out;
} } |
public class class_name {
public Service getService(String type, String name) {
for (int i = 0; i < configs.length; i++) {
Provider p = getProvider(i);
Service s = p.getService(type, name);
if (s != null) {
return s;
}
}
return null;
} } | public class class_name {
public Service getService(String type, String name) {
for (int i = 0; i < configs.length; i++) {
Provider p = getProvider(i);
Service s = p.getService(type, name);
if (s != null) {
return s; // depends on control dependency: [if], data = [none]
}
}
return null;
} } |
public class class_name {
void addBridgeIfNeeded(DiagnosticPosition pos,
Symbol sym,
ClassSymbol origin,
ListBuffer<JCTree> bridges) {
if (sym.kind == MTH &&
sym.name != names.init &&
(sym.flags() & (PRIVATE | STATIC)) == 0 &&
(sym.flags() & SYNTHETIC) != SYNTHETIC &&
sym.isMemberOf(origin, types))
{
MethodSymbol meth = (MethodSymbol)sym;
MethodSymbol bridge = meth.binaryImplementation(origin, types);
MethodSymbol impl = meth.implementation(origin, types, true);
if (bridge == null ||
bridge == meth ||
(impl != null && !bridge.owner.isSubClass(impl.owner, types))) {
// No bridge was added yet.
if (impl != null && isBridgeNeeded(meth, impl, origin.type)) {
addBridge(pos, meth, impl, origin, bridge==impl, bridges);
} else if (impl == meth
&& impl.owner != origin
&& (impl.flags() & FINAL) == 0
&& (meth.flags() & (ABSTRACT|PUBLIC)) == PUBLIC
&& (origin.flags() & PUBLIC) > (impl.owner.flags() & PUBLIC)) {
// this is to work around a horrible but permanent
// reflection design error.
addBridge(pos, meth, impl, origin, false, bridges);
}
} else if ((bridge.flags() & SYNTHETIC) == SYNTHETIC) {
final Pair<MethodSymbol, MethodSymbol> bridgeSpan = bridgeSpans.get(bridge);
MethodSymbol other = bridgeSpan == null ? null : bridgeSpan.fst;
if (other != null && other != meth) {
if (impl == null || !impl.overrides(other, origin, types, true)) {
// Is bridge effectively also the bridge for `meth', if so no clash.
MethodSymbol target = bridgeSpan == null ? null : bridgeSpan.snd;
if (target == null || !target.overrides(meth, origin, types, true, false)) {
// Bridge for other symbol pair was added
log.error(pos, "name.clash.same.erasure.no.override",
other, other.location(origin.type, types),
meth, meth.location(origin.type, types));
}
}
}
} else if (!bridge.overrides(meth, origin, types, true)) {
// Accidental binary override without source override.
if (bridge.owner == origin ||
types.asSuper(bridge.owner.type, meth.owner) == null)
// Don't diagnose the problem if it would already
// have been reported in the superclass
log.error(pos, "name.clash.same.erasure.no.override",
bridge, bridge.location(origin.type, types),
meth, meth.location(origin.type, types));
}
}
} } | public class class_name {
void addBridgeIfNeeded(DiagnosticPosition pos,
Symbol sym,
ClassSymbol origin,
ListBuffer<JCTree> bridges) {
if (sym.kind == MTH &&
sym.name != names.init &&
(sym.flags() & (PRIVATE | STATIC)) == 0 &&
(sym.flags() & SYNTHETIC) != SYNTHETIC &&
sym.isMemberOf(origin, types))
{
MethodSymbol meth = (MethodSymbol)sym;
MethodSymbol bridge = meth.binaryImplementation(origin, types);
MethodSymbol impl = meth.implementation(origin, types, true);
if (bridge == null ||
bridge == meth ||
(impl != null && !bridge.owner.isSubClass(impl.owner, types))) {
// No bridge was added yet.
if (impl != null && isBridgeNeeded(meth, impl, origin.type)) {
addBridge(pos, meth, impl, origin, bridge==impl, bridges); // depends on control dependency: [if], data = [none]
} else if (impl == meth
&& impl.owner != origin
&& (impl.flags() & FINAL) == 0
&& (meth.flags() & (ABSTRACT|PUBLIC)) == PUBLIC
&& (origin.flags() & PUBLIC) > (impl.owner.flags() & PUBLIC)) {
// this is to work around a horrible but permanent
// reflection design error.
addBridge(pos, meth, impl, origin, false, bridges); // depends on control dependency: [if], data = [meth]
}
} else if ((bridge.flags() & SYNTHETIC) == SYNTHETIC) {
final Pair<MethodSymbol, MethodSymbol> bridgeSpan = bridgeSpans.get(bridge);
MethodSymbol other = bridgeSpan == null ? null : bridgeSpan.fst;
if (other != null && other != meth) {
if (impl == null || !impl.overrides(other, origin, types, true)) {
// Is bridge effectively also the bridge for `meth', if so no clash.
MethodSymbol target = bridgeSpan == null ? null : bridgeSpan.snd;
if (target == null || !target.overrides(meth, origin, types, true, false)) {
// Bridge for other symbol pair was added
log.error(pos, "name.clash.same.erasure.no.override",
other, other.location(origin.type, types),
meth, meth.location(origin.type, types)); // depends on control dependency: [if], data = [none]
}
}
}
} else if (!bridge.overrides(meth, origin, types, true)) {
// Accidental binary override without source override.
if (bridge.owner == origin ||
types.asSuper(bridge.owner.type, meth.owner) == null)
// Don't diagnose the problem if it would already
// have been reported in the superclass
log.error(pos, "name.clash.same.erasure.no.override",
bridge, bridge.location(origin.type, types),
meth, meth.location(origin.type, types));
}
}
} } |
public class class_name {
public synchronized void markCompleted(Piece piece) {
if (this.completedPieces.get(piece.getIndex())) {
return;
}
// A completed piece means that's that much data left to download for
// this torrent.
myTorrentStatistic.addLeft(-piece.size());
this.completedPieces.set(piece.getIndex());
if (completedPieces.cardinality() == getPiecesCount()) {
logger.info("all pieces are received for torrent {}. Validating...", this);
}
} } | public class class_name {
public synchronized void markCompleted(Piece piece) {
if (this.completedPieces.get(piece.getIndex())) {
return; // depends on control dependency: [if], data = [none]
}
// A completed piece means that's that much data left to download for
// this torrent.
myTorrentStatistic.addLeft(-piece.size());
this.completedPieces.set(piece.getIndex());
if (completedPieces.cardinality() == getPiecesCount()) {
logger.info("all pieces are received for torrent {}. Validating...", this); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public Point twice() {
if (this.isInfinity()) {
// Twice identity element (point at infinity) is identity
return this;
}
if (this._y.toBigInteger().signum() == 0) {
// if y1 == 0, then (x1, y1) == (x1, -y1)
// and hence this = -this and thus 2(x1, y1) == infinity
return this._curve.getInfinity();
}
FieldElement TWO = this._curve.fromBigInteger(BigInteger.valueOf(2));
FieldElement THREE = this._curve.fromBigInteger(BigInteger.valueOf(3));
FieldElement gamma = this._x.square().multiply(THREE).add(_curve.getA()).divide(_y.multiply(TWO));
FieldElement x3 = gamma.square().subtract(this._x.multiply(TWO));
FieldElement y3 = gamma.multiply(this._x.subtract(x3)).subtract(this._y);
return new Point(_curve, x3, y3, this._compressed);
} } | public class class_name {
public Point twice() {
if (this.isInfinity()) {
// Twice identity element (point at infinity) is identity
return this; // depends on control dependency: [if], data = [none]
}
if (this._y.toBigInteger().signum() == 0) {
// if y1 == 0, then (x1, y1) == (x1, -y1)
// and hence this = -this and thus 2(x1, y1) == infinity
return this._curve.getInfinity(); // depends on control dependency: [if], data = [none]
}
FieldElement TWO = this._curve.fromBigInteger(BigInteger.valueOf(2));
FieldElement THREE = this._curve.fromBigInteger(BigInteger.valueOf(3));
FieldElement gamma = this._x.square().multiply(THREE).add(_curve.getA()).divide(_y.multiply(TWO));
FieldElement x3 = gamma.square().subtract(this._x.multiply(TWO));
FieldElement y3 = gamma.multiply(this._x.subtract(x3)).subtract(this._y);
return new Point(_curve, x3, y3, this._compressed);
} } |
public class class_name {
public boolean removeMessageFilter(MessageFilter messageFilter, boolean bFreeFilter)
{
boolean bSuccess = false;
try {
if (((BaseMessageFilter)messageFilter).getRemoteFilterID() == null)
bSuccess = true; // No remote filter to remove
else
bSuccess = m_receiveQueue.removeRemoteMessageFilter((BaseMessageFilter)messageFilter, bFreeFilter);
} catch (RemoteException ex) {
ex.printStackTrace();
}
if (!bSuccess)
Util.getLogger().warning("Remote listener not removed"); // Never
return super.removeMessageFilter(messageFilter, bFreeFilter);
} } | public class class_name {
public boolean removeMessageFilter(MessageFilter messageFilter, boolean bFreeFilter)
{
boolean bSuccess = false;
try {
if (((BaseMessageFilter)messageFilter).getRemoteFilterID() == null)
bSuccess = true; // No remote filter to remove
else
bSuccess = m_receiveQueue.removeRemoteMessageFilter((BaseMessageFilter)messageFilter, bFreeFilter);
} catch (RemoteException ex) {
ex.printStackTrace();
} // depends on control dependency: [catch], data = [none]
if (!bSuccess)
Util.getLogger().warning("Remote listener not removed"); // Never
return super.removeMessageFilter(messageFilter, bFreeFilter);
} } |
public class class_name {
public LocalDate plusDays(int days) {
if (days == 0) {
return this;
}
long instant = getChronology().days().add(getLocalMillis(), days);
return withLocalMillis(instant);
} } | public class class_name {
public LocalDate plusDays(int days) {
if (days == 0) {
return this; // depends on control dependency: [if], data = [none]
}
long instant = getChronology().days().add(getLocalMillis(), days);
return withLocalMillis(instant);
} } |
public class class_name {
public void auditPIXQueryV3Event(RFC3881EventOutcomeCodes eventOutcome,
String pixManagerUri, String receivingFacility, String receivingApp,
String sendingFacility, String sendingApp,
String hl7MessageId, String hl7QueryParameters,
String[] patientIds,
List<CodedValueType> purposesOfUse,
List<CodedValueType> userRoles)
{
if (!isAuditorEnabled()) {
return;
}
auditQueryEvent(true,
new IHETransactionEventTypeCodes.PIXQueryV3(), eventOutcome,
sendingFacility, sendingApp, getSystemAltUserId(), getSystemNetworkId(),
receivingFacility, receivingApp, null, EventUtils.getAddressForUrl(pixManagerUri, false),
getHumanRequestor(),
hl7MessageId, hl7QueryParameters,
patientIds, purposesOfUse, userRoles);
} } | public class class_name {
public void auditPIXQueryV3Event(RFC3881EventOutcomeCodes eventOutcome,
String pixManagerUri, String receivingFacility, String receivingApp,
String sendingFacility, String sendingApp,
String hl7MessageId, String hl7QueryParameters,
String[] patientIds,
List<CodedValueType> purposesOfUse,
List<CodedValueType> userRoles)
{
if (!isAuditorEnabled()) {
return; // depends on control dependency: [if], data = [none]
}
auditQueryEvent(true,
new IHETransactionEventTypeCodes.PIXQueryV3(), eventOutcome,
sendingFacility, sendingApp, getSystemAltUserId(), getSystemNetworkId(),
receivingFacility, receivingApp, null, EventUtils.getAddressForUrl(pixManagerUri, false),
getHumanRequestor(),
hl7MessageId, hl7QueryParameters,
patientIds, purposesOfUse, userRoles);
} } |
public class class_name {
public static HttpStatusException of(int statusCode) {
if (statusCode < 0 || statusCode >= 1000) {
final HttpStatus status = HttpStatus.valueOf(statusCode);
if (Flags.verboseExceptions()) {
return new HttpStatusException(status);
} else {
return new HttpStatusException(status, false);
}
} else {
return EXCEPTIONS[statusCode];
}
} } | public class class_name {
public static HttpStatusException of(int statusCode) {
if (statusCode < 0 || statusCode >= 1000) {
final HttpStatus status = HttpStatus.valueOf(statusCode);
if (Flags.verboseExceptions()) {
return new HttpStatusException(status); // depends on control dependency: [if], data = [none]
} else {
return new HttpStatusException(status, false); // depends on control dependency: [if], data = [none]
}
} else {
return EXCEPTIONS[statusCode]; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static URL getSentryApiUrl(URI sentryUri, String projectId) {
try {
String url = sentryUri.toString() + "api/" + projectId + "/store/";
return new URL(url);
} catch (MalformedURLException e) {
throw new IllegalArgumentException("Couldn't build a valid URL from the Sentry API.", e);
}
} } | public class class_name {
public static URL getSentryApiUrl(URI sentryUri, String projectId) {
try {
String url = sentryUri.toString() + "api/" + projectId + "/store/";
return new URL(url); // depends on control dependency: [try], data = [none]
} catch (MalformedURLException e) {
throw new IllegalArgumentException("Couldn't build a valid URL from the Sentry API.", e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
static JapaneseEra from(LocalDate date) {
if (date.isBefore(MEIJI.since)) {
throw new DateTimeException("Date too early: " + date);
}
JapaneseEra[] known = KNOWN_ERAS.get();
for (int i = known.length - 1; i >= 0; i--) {
JapaneseEra era = known[i];
if (date.compareTo(era.since) >= 0) {
return era;
}
}
return null;
} } | public class class_name {
static JapaneseEra from(LocalDate date) {
if (date.isBefore(MEIJI.since)) {
throw new DateTimeException("Date too early: " + date);
}
JapaneseEra[] known = KNOWN_ERAS.get();
for (int i = known.length - 1; i >= 0; i--) {
JapaneseEra era = known[i];
if (date.compareTo(era.since) >= 0) {
return era; // depends on control dependency: [if], data = [none]
}
}
return null;
} } |
public class class_name {
public static ClassLoader getDefaultClassLoader() {
ClassLoader cl = null;
try {
cl = Thread.currentThread().getContextClassLoader();
} catch (Throwable ex) {
// Cannot access thread context ClassLoader - falling back...
}
if (cl == null) {
// No thread context class loader -> use class loader of this class.
cl = ClassKit.class.getClassLoader();
if (cl == null) {
// getClassLoader() returning null indicates the bootstrap ClassLoader
try {
cl = ClassLoader.getSystemClassLoader();
} catch (Throwable ex) {
// Cannot access system ClassLoader - oh well, maybe the caller can live with null...
}
}
}
return cl;
} } | public class class_name {
public static ClassLoader getDefaultClassLoader() {
ClassLoader cl = null;
try {
cl = Thread.currentThread().getContextClassLoader(); // depends on control dependency: [try], data = [none]
} catch (Throwable ex) {
// Cannot access thread context ClassLoader - falling back...
} // depends on control dependency: [catch], data = [none]
if (cl == null) {
// No thread context class loader -> use class loader of this class.
cl = ClassKit.class.getClassLoader(); // depends on control dependency: [if], data = [none]
if (cl == null) {
// getClassLoader() returning null indicates the bootstrap ClassLoader
try {
cl = ClassLoader.getSystemClassLoader(); // depends on control dependency: [try], data = [none]
} catch (Throwable ex) {
// Cannot access system ClassLoader - oh well, maybe the caller can live with null...
} // depends on control dependency: [catch], data = [none]
}
}
return cl;
} } |
public class class_name {
public String toQueryString()
{
try
{
StringBuffer result = new StringBuffer();
if ((null != parameters) && !parameters.isEmpty())
{
result.append("?");
Iterator<Entry<String, List<String>>> iterator = parameters.entrySet().iterator();
while (iterator.hasNext())
{
Entry<String, List<String>> entry = iterator.next();
String key = entry.getKey();
List<String> values = entry.getValue();
if ((key != null) && !"".equals(key))
{
key = URLEncoder.encode(key, "UTF-8");
result.append(key);
if ((values != null) && !values.isEmpty())
{
for (int i = 0; i < values.size(); i++)
{
String value = values.get(i);
if ((value != null) && !"".equals(value))
{
value = URLEncoder.encode(value, "UTF-8");
result.append("=" + value);
}
else if ((value != null) && "".equals(value))
{
result.append("=");
}
if (i < values.size() - 1)
{
result.append("&" + key);
}
}
}
}
if (iterator.hasNext())
{
result.append("&");
}
}
}
return result.toString();
}
catch (UnsupportedEncodingException e)
{
throw new PrettyException("Error building query string.", e);
}
} } | public class class_name {
public String toQueryString()
{
try
{
StringBuffer result = new StringBuffer();
if ((null != parameters) && !parameters.isEmpty())
{
result.append("?"); // depends on control dependency: [if], data = [none]
Iterator<Entry<String, List<String>>> iterator = parameters.entrySet().iterator();
while (iterator.hasNext())
{
Entry<String, List<String>> entry = iterator.next();
String key = entry.getKey();
List<String> values = entry.getValue();
if ((key != null) && !"".equals(key))
{
key = URLEncoder.encode(key, "UTF-8"); // depends on control dependency: [if], data = [none]
result.append(key); // depends on control dependency: [if], data = [none]
if ((values != null) && !values.isEmpty())
{
for (int i = 0; i < values.size(); i++)
{
String value = values.get(i);
if ((value != null) && !"".equals(value))
{
value = URLEncoder.encode(value, "UTF-8"); // depends on control dependency: [if], data = [none]
result.append("=" + value); // depends on control dependency: [if], data = [none]
}
else if ((value != null) && "".equals(value))
{
result.append("="); // depends on control dependency: [if], data = [none]
}
if (i < values.size() - 1)
{
result.append("&" + key); // depends on control dependency: [if], data = [none]
}
}
}
}
if (iterator.hasNext())
{
result.append("&"); // depends on control dependency: [if], data = [none]
}
}
}
return result.toString(); // depends on control dependency: [try], data = [none]
}
catch (UnsupportedEncodingException e)
{
throw new PrettyException("Error building query string.", e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
public void createMinXFunction() {
createFunction(MIN_X_FUNCTION, new GeometryFunction() {
@Override
public Object execute(GeoPackageGeometryData data) {
Object value = null;
GeometryEnvelope envelope = getEnvelope(data);
if (envelope != null) {
value = envelope.getMinX();
}
return value;
}
});
} } | public class class_name {
@Override
public void createMinXFunction() {
createFunction(MIN_X_FUNCTION, new GeometryFunction() {
@Override
public Object execute(GeoPackageGeometryData data) {
Object value = null;
GeometryEnvelope envelope = getEnvelope(data);
if (envelope != null) {
value = envelope.getMinX(); // depends on control dependency: [if], data = [none]
}
return value;
}
});
} } |
public class class_name {
private void fsyncImpl(Result<Boolean> result, FsyncType fsyncType)
{
try {
flushData();
ArrayList<SegmentFsyncCallback> fsyncListeners
= new ArrayList<>(_fsyncListeners);
_fsyncListeners.clear();
Result<Boolean> resultNext = result.then((v,r)->
afterDataFsync(r, _position, fsyncType, fsyncListeners));
if (_isDirty || ! fsyncType.isSchedule()) {
_isDirty = false;
try (OutStore sOut = _readWrite.openWrite(_segment.extent())) {
if (fsyncType.isSchedule()) {
sOut.fsyncSchedule(resultNext);
}
else {
sOut.fsync(resultNext);
}
}
}
else {
resultNext.ok(true);
}
} catch (Throwable e) {
e.printStackTrace();
result.fail(e);
}
} } | public class class_name {
private void fsyncImpl(Result<Boolean> result, FsyncType fsyncType)
{
try {
flushData(); // depends on control dependency: [try], data = [none]
ArrayList<SegmentFsyncCallback> fsyncListeners
= new ArrayList<>(_fsyncListeners);
_fsyncListeners.clear(); // depends on control dependency: [try], data = [none]
Result<Boolean> resultNext = result.then((v,r)->
afterDataFsync(r, _position, fsyncType, fsyncListeners));
if (_isDirty || ! fsyncType.isSchedule()) {
_isDirty = false; // depends on control dependency: [if], data = [none]
try (OutStore sOut = _readWrite.openWrite(_segment.extent())) {
if (fsyncType.isSchedule()) {
sOut.fsyncSchedule(resultNext); // depends on control dependency: [if], data = [none]
}
else {
sOut.fsync(resultNext); // depends on control dependency: [if], data = [none]
}
}
}
else {
resultNext.ok(true);
}
} catch (Throwable e) {
e.printStackTrace();
result.fail(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public Matrix getH () {
Matrix X = new Matrix(m,n);
double[][] H = X.getArray();
for (int i = 0; i < m; i++) {
for (int j = 0; j < n; j++) {
if (i >= j) {
H[i][j] = QR[i][j];
} else {
H[i][j] = 0.0;
}
}
}
return X;
} } | public class class_name {
public Matrix getH () {
Matrix X = new Matrix(m,n);
double[][] H = X.getArray();
for (int i = 0; i < m; i++) {
for (int j = 0; j < n; j++) {
if (i >= j) {
H[i][j] = QR[i][j]; // depends on control dependency: [if], data = [none]
} else {
H[i][j] = 0.0; // depends on control dependency: [if], data = [none]
}
}
}
return X;
} } |
public class class_name {
private static void addControlsRecursive(Interaction inter, Set<Interaction> set)
{
for (Control ctrl : inter.getControlledOf())
{
set.add(ctrl);
addControlsRecursive(ctrl, set);
}
} } | public class class_name {
private static void addControlsRecursive(Interaction inter, Set<Interaction> set)
{
for (Control ctrl : inter.getControlledOf())
{
set.add(ctrl); // depends on control dependency: [for], data = [ctrl]
addControlsRecursive(ctrl, set); // depends on control dependency: [for], data = [ctrl]
}
} } |
public class class_name {
public void doFilter(final ServletRequest req, final ServletResponse res, final FilterChain chain)
throws IOException, ServletException {
final HttpServletRequest request = (HttpServletRequest) req;
final HttpServletResponse response = (HttpServletResponse) res;
try {
// add request, response & servletContext to thread local
Context.set(Context.webContext(request, response, filterConfig));
final ByteArrayOutputStream os = new ByteArrayOutputStream();
final HttpServletResponse wrappedResponse = new RedirectedStreamServletResponseWrapper(os, response);
chain.doFilter(request, wrappedResponse);
final Reader reader = new StringReader(new String(os.toByteArray(), Context.get().getConfig().getEncoding()));
final StringWriter writer = new StringWriter();
final String requestUri = request.getRequestURI().replaceFirst(request.getContextPath(), "");
doProcess(requestUri, reader, writer);
// it is important to update the contentLength to new value, otherwise the transfer can be closed without all
// bytes being read. Some browsers (chrome) complains with the following message: ERR_CONNECTION_CLOSED
final int contentLength = writer.getBuffer().length();
response.setContentLength(contentLength);
// Content length can be 0 when the 30x (not modified) status code is returned.
if (contentLength > 0) {
IOUtils.write(writer.toString(), response.getOutputStream());
}
} catch (final RuntimeException e) {
onRuntimeException(e, response, chain);
} finally {
Context.unset();
}
} } | public class class_name {
public void doFilter(final ServletRequest req, final ServletResponse res, final FilterChain chain)
throws IOException, ServletException {
final HttpServletRequest request = (HttpServletRequest) req;
final HttpServletResponse response = (HttpServletResponse) res;
try {
// add request, response & servletContext to thread local
Context.set(Context.webContext(request, response, filterConfig));
final ByteArrayOutputStream os = new ByteArrayOutputStream();
final HttpServletResponse wrappedResponse = new RedirectedStreamServletResponseWrapper(os, response);
chain.doFilter(request, wrappedResponse);
final Reader reader = new StringReader(new String(os.toByteArray(), Context.get().getConfig().getEncoding()));
final StringWriter writer = new StringWriter();
final String requestUri = request.getRequestURI().replaceFirst(request.getContextPath(), "");
doProcess(requestUri, reader, writer);
// it is important to update the contentLength to new value, otherwise the transfer can be closed without all
// bytes being read. Some browsers (chrome) complains with the following message: ERR_CONNECTION_CLOSED
final int contentLength = writer.getBuffer().length();
response.setContentLength(contentLength);
// Content length can be 0 when the 30x (not modified) status code is returned.
if (contentLength > 0) {
IOUtils.write(writer.toString(), response.getOutputStream()); // depends on control dependency: [if], data = [none]
}
} catch (final RuntimeException e) {
onRuntimeException(e, response, chain);
} finally {
Context.unset();
}
} } |
public class class_name {
@Action(name = "Clone Virtual Machine",
outputs = {
@Output(Outputs.RETURN_CODE),
@Output(Outputs.RETURN_RESULT),
@Output(Outputs.EXCEPTION)
},
responses = {
@Response(text = Outputs.SUCCESS, field = Outputs.RETURN_CODE, value = Outputs.RETURN_CODE_SUCCESS,
matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.RESOLVED),
@Response(text = Outputs.FAILURE, field = Outputs.RETURN_CODE, value = Outputs.RETURN_CODE_FAILURE,
matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.ERROR, isOnFail = true)
})
public Map<String, String> cloneVM(@Param(value = HOST, required = true) String host,
@Param(value = PORT) String port,
@Param(value = PROTOCOL) String protocol,
@Param(value = USERNAME, required = true) String username,
@Param(value = PASSWORD, encrypted = true) String password,
@Param(value = TRUST_EVERYONE) String trustEveryone,
@Param(value = CLOSE_SESSION) String closeSession,
@Param(value = DATA_CENTER_NAME, required = true) String dataCenterName,
@Param(value = HOSTNAME, required = true) String hostname,
@Param(value = VM_NAME, required = true) String virtualMachineName,
@Param(value = CLONE_NAME, required = true) String cloneName,
@Param(value = FOLDER_NAME) String folderName,
@Param(value = CLONE_HOST) String cloneHost,
@Param(value = CLONE_RESOURCE_POOL) String cloneResourcePool,
@Param(value = CLONE_DATA_STORE) String cloneDataStore,
@Param(value = THICK_PROVISION) String thickProvision,
@Param(value = IS_TEMPLATE) String isTemplate,
@Param(value = CPU_NUM) String cpuNum,
@Param(value = CORES_PER_SOCKET) String coresPerSocket,
@Param(value = MEMORY) String memory,
@Param(value = CLONE_DESCRIPTION) String cloneDescription,
@Param(value = VMWARE_GLOBAL_SESSION_OBJECT) GlobalSessionObject<Map<String, Connection>> globalSessionObject) {
try {
final HttpInputs httpInputs = new HttpInputs.HttpInputsBuilder()
.withHost(host)
.withPort(port)
.withProtocol(protocol)
.withUsername(username)
.withPassword(password)
.withTrustEveryone(defaultIfEmpty(trustEveryone, FALSE))
.withCloseSession(defaultIfEmpty(closeSession, TRUE))
.withGlobalSessionObject(globalSessionObject)
.build();
final VmInputs vmInputs = new VmInputs.VmInputsBuilder()
.withDataCenterName(dataCenterName)
.withHostname(hostname)
.withVirtualMachineName(virtualMachineName)
.withCloneName(cloneName)
.withFolderName(folderName)
.withCloneHost(cloneHost)
.withCloneResourcePool(cloneResourcePool)
.withCloneDataStore(cloneDataStore)
.withThickProvision(thickProvision)
.withTemplate(isTemplate)
.withIntNumCPUs(cpuNum)
.withCoresPerSocket(coresPerSocket)
.withLongVmMemorySize(memory)
.withDescription(cloneDescription)
.build();
return new VmService().cloneVM(httpInputs, vmInputs);
} catch (Exception ex) {
return OutputUtilities.getFailureResultsMap(ex);
}
} } | public class class_name {
@Action(name = "Clone Virtual Machine",
outputs = {
@Output(Outputs.RETURN_CODE),
@Output(Outputs.RETURN_RESULT),
@Output(Outputs.EXCEPTION)
},
responses = {
@Response(text = Outputs.SUCCESS, field = Outputs.RETURN_CODE, value = Outputs.RETURN_CODE_SUCCESS,
matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.RESOLVED),
@Response(text = Outputs.FAILURE, field = Outputs.RETURN_CODE, value = Outputs.RETURN_CODE_FAILURE,
matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.ERROR, isOnFail = true)
})
public Map<String, String> cloneVM(@Param(value = HOST, required = true) String host,
@Param(value = PORT) String port,
@Param(value = PROTOCOL) String protocol,
@Param(value = USERNAME, required = true) String username,
@Param(value = PASSWORD, encrypted = true) String password,
@Param(value = TRUST_EVERYONE) String trustEveryone,
@Param(value = CLOSE_SESSION) String closeSession,
@Param(value = DATA_CENTER_NAME, required = true) String dataCenterName,
@Param(value = HOSTNAME, required = true) String hostname,
@Param(value = VM_NAME, required = true) String virtualMachineName,
@Param(value = CLONE_NAME, required = true) String cloneName,
@Param(value = FOLDER_NAME) String folderName,
@Param(value = CLONE_HOST) String cloneHost,
@Param(value = CLONE_RESOURCE_POOL) String cloneResourcePool,
@Param(value = CLONE_DATA_STORE) String cloneDataStore,
@Param(value = THICK_PROVISION) String thickProvision,
@Param(value = IS_TEMPLATE) String isTemplate,
@Param(value = CPU_NUM) String cpuNum,
@Param(value = CORES_PER_SOCKET) String coresPerSocket,
@Param(value = MEMORY) String memory,
@Param(value = CLONE_DESCRIPTION) String cloneDescription,
@Param(value = VMWARE_GLOBAL_SESSION_OBJECT) GlobalSessionObject<Map<String, Connection>> globalSessionObject) {
try {
final HttpInputs httpInputs = new HttpInputs.HttpInputsBuilder()
.withHost(host)
.withPort(port)
.withProtocol(protocol)
.withUsername(username)
.withPassword(password)
.withTrustEveryone(defaultIfEmpty(trustEveryone, FALSE))
.withCloseSession(defaultIfEmpty(closeSession, TRUE))
.withGlobalSessionObject(globalSessionObject)
.build();
final VmInputs vmInputs = new VmInputs.VmInputsBuilder()
.withDataCenterName(dataCenterName)
.withHostname(hostname)
.withVirtualMachineName(virtualMachineName)
.withCloneName(cloneName)
.withFolderName(folderName)
.withCloneHost(cloneHost)
.withCloneResourcePool(cloneResourcePool)
.withCloneDataStore(cloneDataStore)
.withThickProvision(thickProvision)
.withTemplate(isTemplate)
.withIntNumCPUs(cpuNum)
.withCoresPerSocket(coresPerSocket)
.withLongVmMemorySize(memory)
.withDescription(cloneDescription)
.build();
return new VmService().cloneVM(httpInputs, vmInputs); // depends on control dependency: [try], data = [none]
} catch (Exception ex) {
return OutputUtilities.getFailureResultsMap(ex);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public Set<String> getParents(String pid) throws MelcoeXacmlException {
logger.debug("Obtaining parents for: {}", pid);
Set<String> parentPIDs = new HashSet<String>();
if (pid.equalsIgnoreCase(Constants.FEDORA_REPOSITORY_PID.uri)) {
return parentPIDs;
}
query: for (String relationship : relationships) {
logger.debug("relationship query: {}, {}", pid, relationship);
Map<String, Set<String>> mapping;
try {
mapping = getRelationships(pid, relationship);
} catch (MelcoeXacmlException e) {
Throwable t = e.getCause();
// An object X, may legitimately declare a parent relation to
// another object, Y which does not exist. Therefore, we don't
// want to continue querying for Y's parents.
if (t != null && t instanceof ObjectNotInLowlevelStorageException) {
logger.debug("Parent, {}, not found.", pid);
break query;
} else {
// Unexpected error, so we throw back the original
throw e;
}
}
Set<String> parents = mapping.get(relationship);
if (parents != null) {
for (String parent : parents) {
PID parentPID = PID.getInstance(parent);
// we want the parents in demo:123 form, not info:fedora/demo:123
parentPIDs.add(parentPID.toString());
logger.debug("added parent {}", parentPID.toString());
}
}
}
return parentPIDs;
} } | public class class_name {
public Set<String> getParents(String pid) throws MelcoeXacmlException {
logger.debug("Obtaining parents for: {}", pid);
Set<String> parentPIDs = new HashSet<String>();
if (pid.equalsIgnoreCase(Constants.FEDORA_REPOSITORY_PID.uri)) {
return parentPIDs;
}
query: for (String relationship : relationships) {
logger.debug("relationship query: {}, {}", pid, relationship);
Map<String, Set<String>> mapping;
try {
mapping = getRelationships(pid, relationship); // depends on control dependency: [try], data = [none]
} catch (MelcoeXacmlException e) {
Throwable t = e.getCause();
// An object X, may legitimately declare a parent relation to
// another object, Y which does not exist. Therefore, we don't
// want to continue querying for Y's parents.
if (t != null && t instanceof ObjectNotInLowlevelStorageException) {
logger.debug("Parent, {}, not found.", pid); // depends on control dependency: [if], data = [none]
break query;
} else {
// Unexpected error, so we throw back the original
throw e;
}
} // depends on control dependency: [catch], data = [none]
Set<String> parents = mapping.get(relationship);
if (parents != null) {
for (String parent : parents) {
PID parentPID = PID.getInstance(parent);
// we want the parents in demo:123 form, not info:fedora/demo:123
parentPIDs.add(parentPID.toString()); // depends on control dependency: [for], data = [parent]
logger.debug("added parent {}", parentPID.toString()); // depends on control dependency: [for], data = [parent]
}
}
}
return parentPIDs;
} } |
public class class_name {
public static String byteBufferToString (final ByteBuffer buffer) {
if (buffer == null) return "null";
final int numberOfBytes = buffer.limit();
final StringBuilder sb = new StringBuilder();
buffer.position(0);
int value;
for (int i = 1; i <= numberOfBytes; ++i) {
sb.append("0x");
value = 255 & buffer.get();
if (value < 16) sb.append("0");
sb.append(Integer.toHexString(value));
if (i % BYTES_PER_LINE == 0)
sb.append("\n");
else
sb.append(" ");
}
return sb.toString();
} } | public class class_name {
public static String byteBufferToString (final ByteBuffer buffer) {
if (buffer == null) return "null";
final int numberOfBytes = buffer.limit();
final StringBuilder sb = new StringBuilder();
buffer.position(0);
int value;
for (int i = 1; i <= numberOfBytes; ++i) {
sb.append("0x");
// depends on control dependency: [for], data = [none]
value = 255 & buffer.get();
// depends on control dependency: [for], data = [none]
if (value < 16) sb.append("0");
sb.append(Integer.toHexString(value));
// depends on control dependency: [for], data = [none]
if (i % BYTES_PER_LINE == 0)
sb.append("\n");
else
sb.append(" ");
}
return sb.toString();
} } |
public class class_name {
public static float noise1(float x) {
int bx0, bx1;
float rx0, rx1, sx, t, u, v;
if (start) {
start = false;
init();
}
t = x + N;
bx0 = ((int)t) & BM;
bx1 = (bx0+1) & BM;
rx0 = t - (int)t;
rx1 = rx0 - 1.0f;
sx = sCurve(rx0);
u = rx0 * g1[p[bx0]];
v = rx1 * g1[p[bx1]];
return 2.3f*lerp(sx, u, v);
} } | public class class_name {
public static float noise1(float x) {
int bx0, bx1;
float rx0, rx1, sx, t, u, v;
if (start) {
start = false; // depends on control dependency: [if], data = [none]
init(); // depends on control dependency: [if], data = [none]
}
t = x + N;
bx0 = ((int)t) & BM;
bx1 = (bx0+1) & BM;
rx0 = t - (int)t;
rx1 = rx0 - 1.0f;
sx = sCurve(rx0);
u = rx0 * g1[p[bx0]];
v = rx1 * g1[p[bx1]];
return 2.3f*lerp(sx, u, v);
} } |
public class class_name {
protected void prepareTypeCondition(
CmsUUID projectId,
int type,
int mode,
StringBuffer conditions,
List<Object> params) {
if (type != CmsDriverManager.READ_IGNORE_TYPE) {
if ((mode & CmsDriverManager.READMODE_EXCLUDE_TYPE) > 0) {
// C_READ_FILE_TYPES: add condition to match against any type, but not given type
conditions.append(BEGIN_EXCLUDE_CONDITION);
conditions.append(m_sqlManager.readQuery(projectId, "C_RESOURCES_SELECT_BY_RESOURCE_TYPE"));
conditions.append(END_CONDITION);
params.add(new Integer(type));
} else {
//otherwise add condition to match against given type if necessary
conditions.append(BEGIN_INCLUDE_CONDITION);
conditions.append(m_sqlManager.readQuery(projectId, "C_RESOURCES_SELECT_BY_RESOURCE_TYPE"));
conditions.append(END_CONDITION);
params.add(new Integer(type));
}
}
} } | public class class_name {
protected void prepareTypeCondition(
CmsUUID projectId,
int type,
int mode,
StringBuffer conditions,
List<Object> params) {
if (type != CmsDriverManager.READ_IGNORE_TYPE) {
if ((mode & CmsDriverManager.READMODE_EXCLUDE_TYPE) > 0) {
// C_READ_FILE_TYPES: add condition to match against any type, but not given type
conditions.append(BEGIN_EXCLUDE_CONDITION); // depends on control dependency: [if], data = [none]
conditions.append(m_sqlManager.readQuery(projectId, "C_RESOURCES_SELECT_BY_RESOURCE_TYPE")); // depends on control dependency: [if], data = [none]
conditions.append(END_CONDITION); // depends on control dependency: [if], data = [none]
params.add(new Integer(type)); // depends on control dependency: [if], data = [none]
} else {
//otherwise add condition to match against given type if necessary
conditions.append(BEGIN_INCLUDE_CONDITION); // depends on control dependency: [if], data = [none]
conditions.append(m_sqlManager.readQuery(projectId, "C_RESOURCES_SELECT_BY_RESOURCE_TYPE")); // depends on control dependency: [if], data = [none]
conditions.append(END_CONDITION); // depends on control dependency: [if], data = [none]
params.add(new Integer(type)); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
@Override
public synchronized void recordRemovedEvaluator(final String id) {
if (this.fileSystem != null && this.changeLogLocation != null) {
final String entry = REMOVE_FLAG + id + System.lineSeparator();
this.logContainerChange(entry);
}
} } | public class class_name {
@Override
public synchronized void recordRemovedEvaluator(final String id) {
if (this.fileSystem != null && this.changeLogLocation != null) {
final String entry = REMOVE_FLAG + id + System.lineSeparator();
this.logContainerChange(entry); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public void paint(final RenderContext renderContext) {
super.paint(renderContext);
UIContext uic = UIContextHolder.getCurrent();
if (LOG.isDebugEnabled()) {
UIContextDebugWrapper debugWrapper = new UIContextDebugWrapper(uic);
LOG.debug("Session usage after paint:\n" + debugWrapper);
}
LOG.debug("Performing session tidy up of WComponents (any WComponents disconnected from the active top component will not be tidied up.");
getUI().tidyUpUIContextForTree();
LOG.debug("After paint - Clearing scratch maps.");
uic.clearScratchMap();
uic.clearRequestScratchMap();
} } | public class class_name {
@Override
public void paint(final RenderContext renderContext) {
super.paint(renderContext);
UIContext uic = UIContextHolder.getCurrent();
if (LOG.isDebugEnabled()) {
UIContextDebugWrapper debugWrapper = new UIContextDebugWrapper(uic);
LOG.debug("Session usage after paint:\n" + debugWrapper); // depends on control dependency: [if], data = [none]
}
LOG.debug("Performing session tidy up of WComponents (any WComponents disconnected from the active top component will not be tidied up.");
getUI().tidyUpUIContextForTree();
LOG.debug("After paint - Clearing scratch maps.");
uic.clearScratchMap();
uic.clearRequestScratchMap();
} } |
public class class_name {
private UiSelector buildSelector(int selectorId, Object selectorValue) {
if (selectorId == SELECTOR_CHILD || selectorId == SELECTOR_PARENT) {
throw new UnsupportedOperationException();
// selector.getLastSubSelector().mSelectorAttributes.put(selectorId, selectorValue);
} else {
this.mSelectorAttributes.put(selectorId, selectorValue);
}
return this;
} } | public class class_name {
private UiSelector buildSelector(int selectorId, Object selectorValue) {
if (selectorId == SELECTOR_CHILD || selectorId == SELECTOR_PARENT) {
throw new UnsupportedOperationException();
// selector.getLastSubSelector().mSelectorAttributes.put(selectorId, selectorValue);
} else {
this.mSelectorAttributes.put(selectorId, selectorValue); // depends on control dependency: [if], data = [(selectorId]
}
return this;
} } |
public class class_name {
@Override
public void onDown(HumanInputEvent<?> event) {
if (dragging && leftWidget) {
// mouse was moved outside of widget
doSelect(event);
} else if (!isRightMouseButton(event)) {
// no point trying to select when there is no active layer
dragging = true;
leftWidget = false;
timestamp = new Date().getTime();
begin = getLocation(event, RenderSpace.SCREEN);
bounds = new Bbox(begin.getX(), begin.getY(), 0.0, 0.0);
shift = event.isShiftKeyDown();
rectangle = new Rectangle("selectionRectangle");
rectangle.setStyle(rectangleStyle);
rectangle.setBounds(bounds);
mapWidget.render(rectangle, RenderGroup.SCREEN, RenderStatus.UPDATE);
}
} } | public class class_name {
@Override
public void onDown(HumanInputEvent<?> event) {
if (dragging && leftWidget) {
// mouse was moved outside of widget
doSelect(event); // depends on control dependency: [if], data = [none]
} else if (!isRightMouseButton(event)) {
// no point trying to select when there is no active layer
dragging = true; // depends on control dependency: [if], data = [none]
leftWidget = false; // depends on control dependency: [if], data = [none]
timestamp = new Date().getTime(); // depends on control dependency: [if], data = [none]
begin = getLocation(event, RenderSpace.SCREEN); // depends on control dependency: [if], data = [none]
bounds = new Bbox(begin.getX(), begin.getY(), 0.0, 0.0); // depends on control dependency: [if], data = [none]
shift = event.isShiftKeyDown(); // depends on control dependency: [if], data = [none]
rectangle = new Rectangle("selectionRectangle"); // depends on control dependency: [if], data = [none]
rectangle.setStyle(rectangleStyle); // depends on control dependency: [if], data = [none]
rectangle.setBounds(bounds); // depends on control dependency: [if], data = [none]
mapWidget.render(rectangle, RenderGroup.SCREEN, RenderStatus.UPDATE); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public final EObject ruleXSwitchExpression() throws RecognitionException {
EObject current = null;
Token otherlv_1=null;
Token otherlv_2=null;
Token otherlv_4=null;
Token otherlv_6=null;
Token otherlv_8=null;
Token otherlv_10=null;
Token otherlv_12=null;
Token otherlv_13=null;
Token otherlv_15=null;
EObject lv_declaredParam_3_0 = null;
EObject lv_switch_5_0 = null;
EObject lv_declaredParam_7_0 = null;
EObject lv_switch_9_0 = null;
EObject lv_cases_11_0 = null;
EObject lv_default_14_0 = null;
enterRule();
try {
// InternalXbase.g:2967:2: ( ( () otherlv_1= 'switch' ( ( ( ( ( '(' ( ( ruleJvmFormalParameter ) ) ':' ) )=> (otherlv_2= '(' ( (lv_declaredParam_3_0= ruleJvmFormalParameter ) ) otherlv_4= ':' ) ) ( (lv_switch_5_0= ruleXExpression ) ) otherlv_6= ')' ) | ( ( ( ( ( ( ruleJvmFormalParameter ) ) ':' ) )=> ( ( (lv_declaredParam_7_0= ruleJvmFormalParameter ) ) otherlv_8= ':' ) )? ( (lv_switch_9_0= ruleXExpression ) ) ) ) otherlv_10= '{' ( (lv_cases_11_0= ruleXCasePart ) )* (otherlv_12= 'default' otherlv_13= ':' ( (lv_default_14_0= ruleXExpression ) ) )? otherlv_15= '}' ) )
// InternalXbase.g:2968:2: ( () otherlv_1= 'switch' ( ( ( ( ( '(' ( ( ruleJvmFormalParameter ) ) ':' ) )=> (otherlv_2= '(' ( (lv_declaredParam_3_0= ruleJvmFormalParameter ) ) otherlv_4= ':' ) ) ( (lv_switch_5_0= ruleXExpression ) ) otherlv_6= ')' ) | ( ( ( ( ( ( ruleJvmFormalParameter ) ) ':' ) )=> ( ( (lv_declaredParam_7_0= ruleJvmFormalParameter ) ) otherlv_8= ':' ) )? ( (lv_switch_9_0= ruleXExpression ) ) ) ) otherlv_10= '{' ( (lv_cases_11_0= ruleXCasePart ) )* (otherlv_12= 'default' otherlv_13= ':' ( (lv_default_14_0= ruleXExpression ) ) )? otherlv_15= '}' )
{
// InternalXbase.g:2968:2: ( () otherlv_1= 'switch' ( ( ( ( ( '(' ( ( ruleJvmFormalParameter ) ) ':' ) )=> (otherlv_2= '(' ( (lv_declaredParam_3_0= ruleJvmFormalParameter ) ) otherlv_4= ':' ) ) ( (lv_switch_5_0= ruleXExpression ) ) otherlv_6= ')' ) | ( ( ( ( ( ( ruleJvmFormalParameter ) ) ':' ) )=> ( ( (lv_declaredParam_7_0= ruleJvmFormalParameter ) ) otherlv_8= ':' ) )? ( (lv_switch_9_0= ruleXExpression ) ) ) ) otherlv_10= '{' ( (lv_cases_11_0= ruleXCasePart ) )* (otherlv_12= 'default' otherlv_13= ':' ( (lv_default_14_0= ruleXExpression ) ) )? otherlv_15= '}' )
// InternalXbase.g:2969:3: () otherlv_1= 'switch' ( ( ( ( ( '(' ( ( ruleJvmFormalParameter ) ) ':' ) )=> (otherlv_2= '(' ( (lv_declaredParam_3_0= ruleJvmFormalParameter ) ) otherlv_4= ':' ) ) ( (lv_switch_5_0= ruleXExpression ) ) otherlv_6= ')' ) | ( ( ( ( ( ( ruleJvmFormalParameter ) ) ':' ) )=> ( ( (lv_declaredParam_7_0= ruleJvmFormalParameter ) ) otherlv_8= ':' ) )? ( (lv_switch_9_0= ruleXExpression ) ) ) ) otherlv_10= '{' ( (lv_cases_11_0= ruleXCasePart ) )* (otherlv_12= 'default' otherlv_13= ':' ( (lv_default_14_0= ruleXExpression ) ) )? otherlv_15= '}'
{
// InternalXbase.g:2969:3: ()
// InternalXbase.g:2970:4:
{
if ( state.backtracking==0 ) {
current = forceCreateModelElement(
grammarAccess.getXSwitchExpressionAccess().getXSwitchExpressionAction_0(),
current);
}
}
otherlv_1=(Token)match(input,60,FOLLOW_46); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_1, grammarAccess.getXSwitchExpressionAccess().getSwitchKeyword_1());
}
// InternalXbase.g:2980:3: ( ( ( ( ( '(' ( ( ruleJvmFormalParameter ) ) ':' ) )=> (otherlv_2= '(' ( (lv_declaredParam_3_0= ruleJvmFormalParameter ) ) otherlv_4= ':' ) ) ( (lv_switch_5_0= ruleXExpression ) ) otherlv_6= ')' ) | ( ( ( ( ( ( ruleJvmFormalParameter ) ) ':' ) )=> ( ( (lv_declaredParam_7_0= ruleJvmFormalParameter ) ) otherlv_8= ':' ) )? ( (lv_switch_9_0= ruleXExpression ) ) ) )
int alt49=2;
alt49 = dfa49.predict(input);
switch (alt49) {
case 1 :
// InternalXbase.g:2981:4: ( ( ( ( '(' ( ( ruleJvmFormalParameter ) ) ':' ) )=> (otherlv_2= '(' ( (lv_declaredParam_3_0= ruleJvmFormalParameter ) ) otherlv_4= ':' ) ) ( (lv_switch_5_0= ruleXExpression ) ) otherlv_6= ')' )
{
// InternalXbase.g:2981:4: ( ( ( ( '(' ( ( ruleJvmFormalParameter ) ) ':' ) )=> (otherlv_2= '(' ( (lv_declaredParam_3_0= ruleJvmFormalParameter ) ) otherlv_4= ':' ) ) ( (lv_switch_5_0= ruleXExpression ) ) otherlv_6= ')' )
// InternalXbase.g:2982:5: ( ( ( '(' ( ( ruleJvmFormalParameter ) ) ':' ) )=> (otherlv_2= '(' ( (lv_declaredParam_3_0= ruleJvmFormalParameter ) ) otherlv_4= ':' ) ) ( (lv_switch_5_0= ruleXExpression ) ) otherlv_6= ')'
{
// InternalXbase.g:2982:5: ( ( ( '(' ( ( ruleJvmFormalParameter ) ) ':' ) )=> (otherlv_2= '(' ( (lv_declaredParam_3_0= ruleJvmFormalParameter ) ) otherlv_4= ':' ) )
// InternalXbase.g:2983:6: ( ( '(' ( ( ruleJvmFormalParameter ) ) ':' ) )=> (otherlv_2= '(' ( (lv_declaredParam_3_0= ruleJvmFormalParameter ) ) otherlv_4= ':' )
{
// InternalXbase.g:2993:6: (otherlv_2= '(' ( (lv_declaredParam_3_0= ruleJvmFormalParameter ) ) otherlv_4= ':' )
// InternalXbase.g:2994:7: otherlv_2= '(' ( (lv_declaredParam_3_0= ruleJvmFormalParameter ) ) otherlv_4= ':'
{
otherlv_2=(Token)match(input,49,FOLLOW_13); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_2, grammarAccess.getXSwitchExpressionAccess().getLeftParenthesisKeyword_2_0_0_0_0());
}
// InternalXbase.g:2998:7: ( (lv_declaredParam_3_0= ruleJvmFormalParameter ) )
// InternalXbase.g:2999:8: (lv_declaredParam_3_0= ruleJvmFormalParameter )
{
// InternalXbase.g:2999:8: (lv_declaredParam_3_0= ruleJvmFormalParameter )
// InternalXbase.g:3000:9: lv_declaredParam_3_0= ruleJvmFormalParameter
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXSwitchExpressionAccess().getDeclaredParamJvmFormalParameterParserRuleCall_2_0_0_0_1_0());
}
pushFollow(FOLLOW_47);
lv_declaredParam_3_0=ruleJvmFormalParameter();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getXSwitchExpressionRule());
}
set(
current,
"declaredParam",
lv_declaredParam_3_0,
"org.eclipse.xtext.xbase.Xbase.JvmFormalParameter");
afterParserOrEnumRuleCall();
}
}
}
otherlv_4=(Token)match(input,61,FOLLOW_4); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_4, grammarAccess.getXSwitchExpressionAccess().getColonKeyword_2_0_0_0_2());
}
}
}
// InternalXbase.g:3023:5: ( (lv_switch_5_0= ruleXExpression ) )
// InternalXbase.g:3024:6: (lv_switch_5_0= ruleXExpression )
{
// InternalXbase.g:3024:6: (lv_switch_5_0= ruleXExpression )
// InternalXbase.g:3025:7: lv_switch_5_0= ruleXExpression
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXSwitchExpressionAccess().getSwitchXExpressionParserRuleCall_2_0_1_0());
}
pushFollow(FOLLOW_29);
lv_switch_5_0=ruleXExpression();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getXSwitchExpressionRule());
}
set(
current,
"switch",
lv_switch_5_0,
"org.eclipse.xtext.xbase.Xbase.XExpression");
afterParserOrEnumRuleCall();
}
}
}
otherlv_6=(Token)match(input,50,FOLLOW_32); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_6, grammarAccess.getXSwitchExpressionAccess().getRightParenthesisKeyword_2_0_2());
}
}
}
break;
case 2 :
// InternalXbase.g:3048:4: ( ( ( ( ( ( ruleJvmFormalParameter ) ) ':' ) )=> ( ( (lv_declaredParam_7_0= ruleJvmFormalParameter ) ) otherlv_8= ':' ) )? ( (lv_switch_9_0= ruleXExpression ) ) )
{
// InternalXbase.g:3048:4: ( ( ( ( ( ( ruleJvmFormalParameter ) ) ':' ) )=> ( ( (lv_declaredParam_7_0= ruleJvmFormalParameter ) ) otherlv_8= ':' ) )? ( (lv_switch_9_0= ruleXExpression ) ) )
// InternalXbase.g:3049:5: ( ( ( ( ( ruleJvmFormalParameter ) ) ':' ) )=> ( ( (lv_declaredParam_7_0= ruleJvmFormalParameter ) ) otherlv_8= ':' ) )? ( (lv_switch_9_0= ruleXExpression ) )
{
// InternalXbase.g:3049:5: ( ( ( ( ( ruleJvmFormalParameter ) ) ':' ) )=> ( ( (lv_declaredParam_7_0= ruleJvmFormalParameter ) ) otherlv_8= ':' ) )?
int alt48=2;
alt48 = dfa48.predict(input);
switch (alt48) {
case 1 :
// InternalXbase.g:3050:6: ( ( ( ( ruleJvmFormalParameter ) ) ':' ) )=> ( ( (lv_declaredParam_7_0= ruleJvmFormalParameter ) ) otherlv_8= ':' )
{
// InternalXbase.g:3059:6: ( ( (lv_declaredParam_7_0= ruleJvmFormalParameter ) ) otherlv_8= ':' )
// InternalXbase.g:3060:7: ( (lv_declaredParam_7_0= ruleJvmFormalParameter ) ) otherlv_8= ':'
{
// InternalXbase.g:3060:7: ( (lv_declaredParam_7_0= ruleJvmFormalParameter ) )
// InternalXbase.g:3061:8: (lv_declaredParam_7_0= ruleJvmFormalParameter )
{
// InternalXbase.g:3061:8: (lv_declaredParam_7_0= ruleJvmFormalParameter )
// InternalXbase.g:3062:9: lv_declaredParam_7_0= ruleJvmFormalParameter
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXSwitchExpressionAccess().getDeclaredParamJvmFormalParameterParserRuleCall_2_1_0_0_0_0());
}
pushFollow(FOLLOW_47);
lv_declaredParam_7_0=ruleJvmFormalParameter();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getXSwitchExpressionRule());
}
set(
current,
"declaredParam",
lv_declaredParam_7_0,
"org.eclipse.xtext.xbase.Xbase.JvmFormalParameter");
afterParserOrEnumRuleCall();
}
}
}
otherlv_8=(Token)match(input,61,FOLLOW_4); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_8, grammarAccess.getXSwitchExpressionAccess().getColonKeyword_2_1_0_0_1());
}
}
}
break;
}
// InternalXbase.g:3085:5: ( (lv_switch_9_0= ruleXExpression ) )
// InternalXbase.g:3086:6: (lv_switch_9_0= ruleXExpression )
{
// InternalXbase.g:3086:6: (lv_switch_9_0= ruleXExpression )
// InternalXbase.g:3087:7: lv_switch_9_0= ruleXExpression
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXSwitchExpressionAccess().getSwitchXExpressionParserRuleCall_2_1_1_0());
}
pushFollow(FOLLOW_32);
lv_switch_9_0=ruleXExpression();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getXSwitchExpressionRule());
}
set(
current,
"switch",
lv_switch_9_0,
"org.eclipse.xtext.xbase.Xbase.XExpression");
afterParserOrEnumRuleCall();
}
}
}
}
}
break;
}
otherlv_10=(Token)match(input,52,FOLLOW_48); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_10, grammarAccess.getXSwitchExpressionAccess().getLeftCurlyBracketKeyword_3());
}
// InternalXbase.g:3110:3: ( (lv_cases_11_0= ruleXCasePart ) )*
loop50:
do {
int alt50=2;
int LA50_0 = input.LA(1);
if ( (LA50_0==RULE_ID||LA50_0==32||(LA50_0>=48 && LA50_0<=49)||LA50_0==61||LA50_0==63) ) {
alt50=1;
}
switch (alt50) {
case 1 :
// InternalXbase.g:3111:4: (lv_cases_11_0= ruleXCasePart )
{
// InternalXbase.g:3111:4: (lv_cases_11_0= ruleXCasePart )
// InternalXbase.g:3112:5: lv_cases_11_0= ruleXCasePart
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXSwitchExpressionAccess().getCasesXCasePartParserRuleCall_4_0());
}
pushFollow(FOLLOW_48);
lv_cases_11_0=ruleXCasePart();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getXSwitchExpressionRule());
}
add(
current,
"cases",
lv_cases_11_0,
"org.eclipse.xtext.xbase.Xbase.XCasePart");
afterParserOrEnumRuleCall();
}
}
}
break;
default :
break loop50;
}
} while (true);
// InternalXbase.g:3129:3: (otherlv_12= 'default' otherlv_13= ':' ( (lv_default_14_0= ruleXExpression ) ) )?
int alt51=2;
int LA51_0 = input.LA(1);
if ( (LA51_0==62) ) {
alt51=1;
}
switch (alt51) {
case 1 :
// InternalXbase.g:3130:4: otherlv_12= 'default' otherlv_13= ':' ( (lv_default_14_0= ruleXExpression ) )
{
otherlv_12=(Token)match(input,62,FOLLOW_47); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_12, grammarAccess.getXSwitchExpressionAccess().getDefaultKeyword_5_0());
}
otherlv_13=(Token)match(input,61,FOLLOW_4); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_13, grammarAccess.getXSwitchExpressionAccess().getColonKeyword_5_1());
}
// InternalXbase.g:3138:4: ( (lv_default_14_0= ruleXExpression ) )
// InternalXbase.g:3139:5: (lv_default_14_0= ruleXExpression )
{
// InternalXbase.g:3139:5: (lv_default_14_0= ruleXExpression )
// InternalXbase.g:3140:6: lv_default_14_0= ruleXExpression
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXSwitchExpressionAccess().getDefaultXExpressionParserRuleCall_5_2_0());
}
pushFollow(FOLLOW_49);
lv_default_14_0=ruleXExpression();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getXSwitchExpressionRule());
}
set(
current,
"default",
lv_default_14_0,
"org.eclipse.xtext.xbase.Xbase.XExpression");
afterParserOrEnumRuleCall();
}
}
}
}
break;
}
otherlv_15=(Token)match(input,53,FOLLOW_2); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_15, grammarAccess.getXSwitchExpressionAccess().getRightCurlyBracketKeyword_6());
}
}
}
if ( state.backtracking==0 ) {
leaveRule();
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
} } | public class class_name {
public final EObject ruleXSwitchExpression() throws RecognitionException {
EObject current = null;
Token otherlv_1=null;
Token otherlv_2=null;
Token otherlv_4=null;
Token otherlv_6=null;
Token otherlv_8=null;
Token otherlv_10=null;
Token otherlv_12=null;
Token otherlv_13=null;
Token otherlv_15=null;
EObject lv_declaredParam_3_0 = null;
EObject lv_switch_5_0 = null;
EObject lv_declaredParam_7_0 = null;
EObject lv_switch_9_0 = null;
EObject lv_cases_11_0 = null;
EObject lv_default_14_0 = null;
enterRule();
try {
// InternalXbase.g:2967:2: ( ( () otherlv_1= 'switch' ( ( ( ( ( '(' ( ( ruleJvmFormalParameter ) ) ':' ) )=> (otherlv_2= '(' ( (lv_declaredParam_3_0= ruleJvmFormalParameter ) ) otherlv_4= ':' ) ) ( (lv_switch_5_0= ruleXExpression ) ) otherlv_6= ')' ) | ( ( ( ( ( ( ruleJvmFormalParameter ) ) ':' ) )=> ( ( (lv_declaredParam_7_0= ruleJvmFormalParameter ) ) otherlv_8= ':' ) )? ( (lv_switch_9_0= ruleXExpression ) ) ) ) otherlv_10= '{' ( (lv_cases_11_0= ruleXCasePart ) )* (otherlv_12= 'default' otherlv_13= ':' ( (lv_default_14_0= ruleXExpression ) ) )? otherlv_15= '}' ) )
// InternalXbase.g:2968:2: ( () otherlv_1= 'switch' ( ( ( ( ( '(' ( ( ruleJvmFormalParameter ) ) ':' ) )=> (otherlv_2= '(' ( (lv_declaredParam_3_0= ruleJvmFormalParameter ) ) otherlv_4= ':' ) ) ( (lv_switch_5_0= ruleXExpression ) ) otherlv_6= ')' ) | ( ( ( ( ( ( ruleJvmFormalParameter ) ) ':' ) )=> ( ( (lv_declaredParam_7_0= ruleJvmFormalParameter ) ) otherlv_8= ':' ) )? ( (lv_switch_9_0= ruleXExpression ) ) ) ) otherlv_10= '{' ( (lv_cases_11_0= ruleXCasePart ) )* (otherlv_12= 'default' otherlv_13= ':' ( (lv_default_14_0= ruleXExpression ) ) )? otherlv_15= '}' )
{
// InternalXbase.g:2968:2: ( () otherlv_1= 'switch' ( ( ( ( ( '(' ( ( ruleJvmFormalParameter ) ) ':' ) )=> (otherlv_2= '(' ( (lv_declaredParam_3_0= ruleJvmFormalParameter ) ) otherlv_4= ':' ) ) ( (lv_switch_5_0= ruleXExpression ) ) otherlv_6= ')' ) | ( ( ( ( ( ( ruleJvmFormalParameter ) ) ':' ) )=> ( ( (lv_declaredParam_7_0= ruleJvmFormalParameter ) ) otherlv_8= ':' ) )? ( (lv_switch_9_0= ruleXExpression ) ) ) ) otherlv_10= '{' ( (lv_cases_11_0= ruleXCasePart ) )* (otherlv_12= 'default' otherlv_13= ':' ( (lv_default_14_0= ruleXExpression ) ) )? otherlv_15= '}' )
// InternalXbase.g:2969:3: () otherlv_1= 'switch' ( ( ( ( ( '(' ( ( ruleJvmFormalParameter ) ) ':' ) )=> (otherlv_2= '(' ( (lv_declaredParam_3_0= ruleJvmFormalParameter ) ) otherlv_4= ':' ) ) ( (lv_switch_5_0= ruleXExpression ) ) otherlv_6= ')' ) | ( ( ( ( ( ( ruleJvmFormalParameter ) ) ':' ) )=> ( ( (lv_declaredParam_7_0= ruleJvmFormalParameter ) ) otherlv_8= ':' ) )? ( (lv_switch_9_0= ruleXExpression ) ) ) ) otherlv_10= '{' ( (lv_cases_11_0= ruleXCasePart ) )* (otherlv_12= 'default' otherlv_13= ':' ( (lv_default_14_0= ruleXExpression ) ) )? otherlv_15= '}'
{
// InternalXbase.g:2969:3: ()
// InternalXbase.g:2970:4:
{
if ( state.backtracking==0 ) {
current = forceCreateModelElement(
grammarAccess.getXSwitchExpressionAccess().getXSwitchExpressionAction_0(),
current); // depends on control dependency: [if], data = [none]
}
}
otherlv_1=(Token)match(input,60,FOLLOW_46); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_1, grammarAccess.getXSwitchExpressionAccess().getSwitchKeyword_1()); // depends on control dependency: [if], data = [none]
}
// InternalXbase.g:2980:3: ( ( ( ( ( '(' ( ( ruleJvmFormalParameter ) ) ':' ) )=> (otherlv_2= '(' ( (lv_declaredParam_3_0= ruleJvmFormalParameter ) ) otherlv_4= ':' ) ) ( (lv_switch_5_0= ruleXExpression ) ) otherlv_6= ')' ) | ( ( ( ( ( ( ruleJvmFormalParameter ) ) ':' ) )=> ( ( (lv_declaredParam_7_0= ruleJvmFormalParameter ) ) otherlv_8= ':' ) )? ( (lv_switch_9_0= ruleXExpression ) ) ) )
int alt49=2;
alt49 = dfa49.predict(input);
switch (alt49) {
case 1 :
// InternalXbase.g:2981:4: ( ( ( ( '(' ( ( ruleJvmFormalParameter ) ) ':' ) )=> (otherlv_2= '(' ( (lv_declaredParam_3_0= ruleJvmFormalParameter ) ) otherlv_4= ':' ) ) ( (lv_switch_5_0= ruleXExpression ) ) otherlv_6= ')' )
{
// InternalXbase.g:2981:4: ( ( ( ( '(' ( ( ruleJvmFormalParameter ) ) ':' ) )=> (otherlv_2= '(' ( (lv_declaredParam_3_0= ruleJvmFormalParameter ) ) otherlv_4= ':' ) ) ( (lv_switch_5_0= ruleXExpression ) ) otherlv_6= ')' )
// InternalXbase.g:2982:5: ( ( ( '(' ( ( ruleJvmFormalParameter ) ) ':' ) )=> (otherlv_2= '(' ( (lv_declaredParam_3_0= ruleJvmFormalParameter ) ) otherlv_4= ':' ) ) ( (lv_switch_5_0= ruleXExpression ) ) otherlv_6= ')'
{
// InternalXbase.g:2982:5: ( ( ( '(' ( ( ruleJvmFormalParameter ) ) ':' ) )=> (otherlv_2= '(' ( (lv_declaredParam_3_0= ruleJvmFormalParameter ) ) otherlv_4= ':' ) )
// InternalXbase.g:2983:6: ( ( '(' ( ( ruleJvmFormalParameter ) ) ':' ) )=> (otherlv_2= '(' ( (lv_declaredParam_3_0= ruleJvmFormalParameter ) ) otherlv_4= ':' )
{
// InternalXbase.g:2993:6: (otherlv_2= '(' ( (lv_declaredParam_3_0= ruleJvmFormalParameter ) ) otherlv_4= ':' )
// InternalXbase.g:2994:7: otherlv_2= '(' ( (lv_declaredParam_3_0= ruleJvmFormalParameter ) ) otherlv_4= ':'
{
otherlv_2=(Token)match(input,49,FOLLOW_13); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_2, grammarAccess.getXSwitchExpressionAccess().getLeftParenthesisKeyword_2_0_0_0_0()); // depends on control dependency: [if], data = [none]
}
// InternalXbase.g:2998:7: ( (lv_declaredParam_3_0= ruleJvmFormalParameter ) )
// InternalXbase.g:2999:8: (lv_declaredParam_3_0= ruleJvmFormalParameter )
{
// InternalXbase.g:2999:8: (lv_declaredParam_3_0= ruleJvmFormalParameter )
// InternalXbase.g:3000:9: lv_declaredParam_3_0= ruleJvmFormalParameter
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXSwitchExpressionAccess().getDeclaredParamJvmFormalParameterParserRuleCall_2_0_0_0_1_0()); // depends on control dependency: [if], data = [none]
}
pushFollow(FOLLOW_47);
lv_declaredParam_3_0=ruleJvmFormalParameter();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getXSwitchExpressionRule()); // depends on control dependency: [if], data = [none]
}
set(
current,
"declaredParam",
lv_declaredParam_3_0,
"org.eclipse.xtext.xbase.Xbase.JvmFormalParameter"); // depends on control dependency: [if], data = [none]
afterParserOrEnumRuleCall(); // depends on control dependency: [if], data = [none]
}
}
}
otherlv_4=(Token)match(input,61,FOLLOW_4); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_4, grammarAccess.getXSwitchExpressionAccess().getColonKeyword_2_0_0_0_2()); // depends on control dependency: [if], data = [none]
}
}
}
// InternalXbase.g:3023:5: ( (lv_switch_5_0= ruleXExpression ) )
// InternalXbase.g:3024:6: (lv_switch_5_0= ruleXExpression )
{
// InternalXbase.g:3024:6: (lv_switch_5_0= ruleXExpression )
// InternalXbase.g:3025:7: lv_switch_5_0= ruleXExpression
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXSwitchExpressionAccess().getSwitchXExpressionParserRuleCall_2_0_1_0()); // depends on control dependency: [if], data = [none]
}
pushFollow(FOLLOW_29);
lv_switch_5_0=ruleXExpression();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getXSwitchExpressionRule()); // depends on control dependency: [if], data = [none]
}
set(
current,
"switch",
lv_switch_5_0,
"org.eclipse.xtext.xbase.Xbase.XExpression"); // depends on control dependency: [if], data = [none]
afterParserOrEnumRuleCall(); // depends on control dependency: [if], data = [none]
}
}
}
otherlv_6=(Token)match(input,50,FOLLOW_32); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_6, grammarAccess.getXSwitchExpressionAccess().getRightParenthesisKeyword_2_0_2()); // depends on control dependency: [if], data = [none]
}
}
}
break;
case 2 :
// InternalXbase.g:3048:4: ( ( ( ( ( ( ruleJvmFormalParameter ) ) ':' ) )=> ( ( (lv_declaredParam_7_0= ruleJvmFormalParameter ) ) otherlv_8= ':' ) )? ( (lv_switch_9_0= ruleXExpression ) ) )
{
// InternalXbase.g:3048:4: ( ( ( ( ( ( ruleJvmFormalParameter ) ) ':' ) )=> ( ( (lv_declaredParam_7_0= ruleJvmFormalParameter ) ) otherlv_8= ':' ) )? ( (lv_switch_9_0= ruleXExpression ) ) )
// InternalXbase.g:3049:5: ( ( ( ( ( ruleJvmFormalParameter ) ) ':' ) )=> ( ( (lv_declaredParam_7_0= ruleJvmFormalParameter ) ) otherlv_8= ':' ) )? ( (lv_switch_9_0= ruleXExpression ) )
{
// InternalXbase.g:3049:5: ( ( ( ( ( ruleJvmFormalParameter ) ) ':' ) )=> ( ( (lv_declaredParam_7_0= ruleJvmFormalParameter ) ) otherlv_8= ':' ) )?
int alt48=2;
alt48 = dfa48.predict(input);
switch (alt48) {
case 1 :
// InternalXbase.g:3050:6: ( ( ( ( ruleJvmFormalParameter ) ) ':' ) )=> ( ( (lv_declaredParam_7_0= ruleJvmFormalParameter ) ) otherlv_8= ':' )
{
// InternalXbase.g:3059:6: ( ( (lv_declaredParam_7_0= ruleJvmFormalParameter ) ) otherlv_8= ':' )
// InternalXbase.g:3060:7: ( (lv_declaredParam_7_0= ruleJvmFormalParameter ) ) otherlv_8= ':'
{
// InternalXbase.g:3060:7: ( (lv_declaredParam_7_0= ruleJvmFormalParameter ) )
// InternalXbase.g:3061:8: (lv_declaredParam_7_0= ruleJvmFormalParameter )
{
// InternalXbase.g:3061:8: (lv_declaredParam_7_0= ruleJvmFormalParameter )
// InternalXbase.g:3062:9: lv_declaredParam_7_0= ruleJvmFormalParameter
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXSwitchExpressionAccess().getDeclaredParamJvmFormalParameterParserRuleCall_2_1_0_0_0_0()); // depends on control dependency: [if], data = [none]
}
pushFollow(FOLLOW_47);
lv_declaredParam_7_0=ruleJvmFormalParameter();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getXSwitchExpressionRule()); // depends on control dependency: [if], data = [none]
}
set(
current,
"declaredParam",
lv_declaredParam_7_0,
"org.eclipse.xtext.xbase.Xbase.JvmFormalParameter"); // depends on control dependency: [if], data = [none]
afterParserOrEnumRuleCall(); // depends on control dependency: [if], data = [none]
}
}
}
otherlv_8=(Token)match(input,61,FOLLOW_4); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_8, grammarAccess.getXSwitchExpressionAccess().getColonKeyword_2_1_0_0_1()); // depends on control dependency: [if], data = [none]
}
}
}
break;
}
// InternalXbase.g:3085:5: ( (lv_switch_9_0= ruleXExpression ) )
// InternalXbase.g:3086:6: (lv_switch_9_0= ruleXExpression )
{
// InternalXbase.g:3086:6: (lv_switch_9_0= ruleXExpression )
// InternalXbase.g:3087:7: lv_switch_9_0= ruleXExpression
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXSwitchExpressionAccess().getSwitchXExpressionParserRuleCall_2_1_1_0()); // depends on control dependency: [if], data = [none]
}
pushFollow(FOLLOW_32);
lv_switch_9_0=ruleXExpression();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getXSwitchExpressionRule()); // depends on control dependency: [if], data = [none]
}
set(
current,
"switch",
lv_switch_9_0,
"org.eclipse.xtext.xbase.Xbase.XExpression"); // depends on control dependency: [if], data = [none]
afterParserOrEnumRuleCall(); // depends on control dependency: [if], data = [none]
}
}
}
}
}
break;
}
otherlv_10=(Token)match(input,52,FOLLOW_48); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_10, grammarAccess.getXSwitchExpressionAccess().getLeftCurlyBracketKeyword_3()); // depends on control dependency: [if], data = [none]
}
// InternalXbase.g:3110:3: ( (lv_cases_11_0= ruleXCasePart ) )*
loop50:
do {
int alt50=2;
int LA50_0 = input.LA(1);
if ( (LA50_0==RULE_ID||LA50_0==32||(LA50_0>=48 && LA50_0<=49)||LA50_0==61||LA50_0==63) ) {
alt50=1; // depends on control dependency: [if], data = [none]
}
switch (alt50) {
case 1 :
// InternalXbase.g:3111:4: (lv_cases_11_0= ruleXCasePart )
{
// InternalXbase.g:3111:4: (lv_cases_11_0= ruleXCasePart )
// InternalXbase.g:3112:5: lv_cases_11_0= ruleXCasePart
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXSwitchExpressionAccess().getCasesXCasePartParserRuleCall_4_0()); // depends on control dependency: [if], data = [none]
}
pushFollow(FOLLOW_48);
lv_cases_11_0=ruleXCasePart();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getXSwitchExpressionRule()); // depends on control dependency: [if], data = [none]
}
add(
current,
"cases",
lv_cases_11_0,
"org.eclipse.xtext.xbase.Xbase.XCasePart"); // depends on control dependency: [if], data = [none]
afterParserOrEnumRuleCall(); // depends on control dependency: [if], data = [none]
}
}
}
break;
default :
break loop50;
}
} while (true);
// InternalXbase.g:3129:3: (otherlv_12= 'default' otherlv_13= ':' ( (lv_default_14_0= ruleXExpression ) ) )?
int alt51=2;
int LA51_0 = input.LA(1);
if ( (LA51_0==62) ) {
alt51=1; // depends on control dependency: [if], data = [none]
}
switch (alt51) {
case 1 :
// InternalXbase.g:3130:4: otherlv_12= 'default' otherlv_13= ':' ( (lv_default_14_0= ruleXExpression ) )
{
otherlv_12=(Token)match(input,62,FOLLOW_47); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_12, grammarAccess.getXSwitchExpressionAccess().getDefaultKeyword_5_0()); // depends on control dependency: [if], data = [none]
}
otherlv_13=(Token)match(input,61,FOLLOW_4); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_13, grammarAccess.getXSwitchExpressionAccess().getColonKeyword_5_1()); // depends on control dependency: [if], data = [none]
}
// InternalXbase.g:3138:4: ( (lv_default_14_0= ruleXExpression ) )
// InternalXbase.g:3139:5: (lv_default_14_0= ruleXExpression )
{
// InternalXbase.g:3139:5: (lv_default_14_0= ruleXExpression )
// InternalXbase.g:3140:6: lv_default_14_0= ruleXExpression
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXSwitchExpressionAccess().getDefaultXExpressionParserRuleCall_5_2_0()); // depends on control dependency: [if], data = [none]
}
pushFollow(FOLLOW_49);
lv_default_14_0=ruleXExpression();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getXSwitchExpressionRule()); // depends on control dependency: [if], data = [none]
}
set(
current,
"default",
lv_default_14_0,
"org.eclipse.xtext.xbase.Xbase.XExpression"); // depends on control dependency: [if], data = [none]
afterParserOrEnumRuleCall(); // depends on control dependency: [if], data = [none]
}
}
}
}
break;
}
otherlv_15=(Token)match(input,53,FOLLOW_2); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_15, grammarAccess.getXSwitchExpressionAccess().getRightCurlyBracketKeyword_6()); // depends on control dependency: [if], data = [none]
}
}
}
if ( state.backtracking==0 ) {
leaveRule(); // depends on control dependency: [if], data = [none]
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
} } |
public class class_name {
private static String makeBaseUri(URL url) {
String r = url.getProtocol().toLowerCase() + "://" +
url.getHost().toLowerCase();
if ((url.getProtocol().equalsIgnoreCase("http") &&
url.getPort() != -1 && url.getPort() != 80) ||
(url.getProtocol().equalsIgnoreCase("https") &&
url.getPort() != -1 && url.getPort() != 443)) {
r += ":" + url.getPort();
}
return r;
} } | public class class_name {
private static String makeBaseUri(URL url) {
String r = url.getProtocol().toLowerCase() + "://" +
url.getHost().toLowerCase();
if ((url.getProtocol().equalsIgnoreCase("http") &&
url.getPort() != -1 && url.getPort() != 80) ||
(url.getProtocol().equalsIgnoreCase("https") &&
url.getPort() != -1 && url.getPort() != 443)) {
r += ":" + url.getPort(); // depends on control dependency: [if], data = [none]
}
return r;
} } |
public class class_name {
public String createFieldTypeSignature(VariableElement variable) {
if (!hasGenericSignature(variable.asType())) {
return null;
}
StringBuilder sb = new StringBuilder();
genTypeSignature(variable.asType(), sb);
return sb.toString();
} } | public class class_name {
public String createFieldTypeSignature(VariableElement variable) {
if (!hasGenericSignature(variable.asType())) {
return null; // depends on control dependency: [if], data = [none]
}
StringBuilder sb = new StringBuilder();
genTypeSignature(variable.asType(), sb);
return sb.toString();
} } |
public class class_name {
public MultiNote[] normalize() {
Hashtable splitter = new Hashtable();
for (int i=0; i<m_notes.size(); i++) {
Note note = (Note)m_notes.elementAt(i);
Short key = note.getStrictDuration();
if (splitter.containsKey(key))
((Vector)splitter.get(key)).addElement(note);
else {
Vector v = new Vector();
v.addElement(note);
splitter.put(key, v);
}
}
short[] strictDurations = getStrictDurations();
MultiNote[] normalizedChords = new MultiNote[strictDurations.length];
for (int i=0; i<strictDurations.length;i++) {
normalizedChords[i] = new MultiNote((Vector)splitter.get(new Short(strictDurations[i])));
}
return normalizedChords;
} } | public class class_name {
public MultiNote[] normalize() {
Hashtable splitter = new Hashtable();
for (int i=0; i<m_notes.size(); i++) {
Note note = (Note)m_notes.elementAt(i);
Short key = note.getStrictDuration();
if (splitter.containsKey(key))
((Vector)splitter.get(key)).addElement(note);
else {
Vector v = new Vector();
v.addElement(note);
// depends on control dependency: [if], data = [none]
splitter.put(key, v);
// depends on control dependency: [if], data = [none]
}
}
short[] strictDurations = getStrictDurations();
MultiNote[] normalizedChords = new MultiNote[strictDurations.length];
for (int i=0; i<strictDurations.length;i++) {
normalizedChords[i] = new MultiNote((Vector)splitter.get(new Short(strictDurations[i])));
// depends on control dependency: [for], data = [i]
}
return normalizedChords;
} } |
public class class_name {
public Logging withClusterLogging(LogSetup... clusterLogging) {
if (this.clusterLogging == null) {
setClusterLogging(new java.util.ArrayList<LogSetup>(clusterLogging.length));
}
for (LogSetup ele : clusterLogging) {
this.clusterLogging.add(ele);
}
return this;
} } | public class class_name {
public Logging withClusterLogging(LogSetup... clusterLogging) {
if (this.clusterLogging == null) {
setClusterLogging(new java.util.ArrayList<LogSetup>(clusterLogging.length)); // depends on control dependency: [if], data = [none]
}
for (LogSetup ele : clusterLogging) {
this.clusterLogging.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
public void readHeader(InputStream in) throws IOException {
CRC32 crc = new CRC32();
crc.reset();
if (!testGzipMagic(in, crc)) {
throw new NoGzipMagicException();
}
this.length += 2;
if (readByte(in, crc) != Deflater.DEFLATED) {
throw new IOException("Unknown compression");
}
this.length++;
// Get gzip header flag.
this.flg = readByte(in, crc);
this.length++;
// Get MTIME.
this.mtime = readInt(in, crc);
this.length += 4;
// Read XFL and OS.
this.xfl = readByte(in, crc);
this.length++;
this.os = readByte(in, crc);
this.length++;
// Skip optional extra field -- stuff w/ alexa stuff in it.
final int FLG_FEXTRA = 4;
if ((this.flg & FLG_FEXTRA) == FLG_FEXTRA) {
int count = readShort(in, crc);
this.length +=2;
this.fextra = new byte[count];
readByte(in, crc, this.fextra, 0, count);
this.length += count;
}
// Skip file name. It ends in null.
final int FLG_FNAME = 8;
if ((this.flg & FLG_FNAME) == FLG_FNAME) {
while (readByte(in, crc) != 0) {
this.length++;
}
}
// Skip file comment. It ends in null.
final int FLG_FCOMMENT = 16; // File comment
if ((this.flg & FLG_FCOMMENT) == FLG_FCOMMENT) {
while (readByte(in, crc) != 0) {
this.length++;
}
}
// Check optional CRC.
final int FLG_FHCRC = 2;
if ((this.flg & FLG_FHCRC) == FLG_FHCRC) {
int calcCrc = (int)(crc.getValue() & 0xffff);
if (readShort(in, crc) != calcCrc) {
throw new IOException("Bad header CRC");
}
this.length += 2;
}
} } | public class class_name {
public void readHeader(InputStream in) throws IOException {
CRC32 crc = new CRC32();
crc.reset();
if (!testGzipMagic(in, crc)) {
throw new NoGzipMagicException();
}
this.length += 2;
if (readByte(in, crc) != Deflater.DEFLATED) {
throw new IOException("Unknown compression");
}
this.length++;
// Get gzip header flag.
this.flg = readByte(in, crc);
this.length++;
// Get MTIME.
this.mtime = readInt(in, crc);
this.length += 4;
// Read XFL and OS.
this.xfl = readByte(in, crc);
this.length++;
this.os = readByte(in, crc);
this.length++;
// Skip optional extra field -- stuff w/ alexa stuff in it.
final int FLG_FEXTRA = 4;
if ((this.flg & FLG_FEXTRA) == FLG_FEXTRA) {
int count = readShort(in, crc);
this.length +=2;
this.fextra = new byte[count];
readByte(in, crc, this.fextra, 0, count);
this.length += count;
}
// Skip file name. It ends in null.
final int FLG_FNAME = 8;
if ((this.flg & FLG_FNAME) == FLG_FNAME) {
while (readByte(in, crc) != 0) {
this.length++; // depends on control dependency: [while], data = [none]
}
}
// Skip file comment. It ends in null.
final int FLG_FCOMMENT = 16; // File comment
if ((this.flg & FLG_FCOMMENT) == FLG_FCOMMENT) {
while (readByte(in, crc) != 0) {
this.length++; // depends on control dependency: [while], data = [none]
}
}
// Check optional CRC.
final int FLG_FHCRC = 2;
if ((this.flg & FLG_FHCRC) == FLG_FHCRC) {
int calcCrc = (int)(crc.getValue() & 0xffff);
if (readShort(in, crc) != calcCrc) {
throw new IOException("Bad header CRC");
}
this.length += 2;
}
} } |
public class class_name {
private boolean aquireFileLock() {
// PRE:
//
// raf is never null and is never closed upon entry.
//
// Rhetorical question to self: How does one tell if a RandomAccessFile
// is closed, short of invoking an operation and getting an IOException
// the says its closed (assuming you can control the Locale of the error
// message)?
//
final RandomAccessFile lraf = super.raf;
// In an ideal world, we would use a lock region back off approach,
// starting with region MAX_LOCK_REGION, then MAX_NFS_LOCK_REGION,
// then MIN_LOCK_REGION.
//
// In practice, however, it is just generally unwise to mount network
// file system database instances. Be warned.
//
// In general, it is probably also unwise to mount removable media
// database instances that are not read-only.
boolean success = false;
try {
if (this.fileLock != null) {
// API says never throws exception, but I suspect
// it's quite possible some research / FOSS JVMs might
// still throw unsupported operation exceptions on certain
// NIO classes...better to be safe than sorry.
if (this.fileLock.isValid()) {
return true;
} else {
// It's not valid, so releasing it is a no-op.
//
// However, we should still clean up the referenceand hope
// no previous complications exist (a hung FileLock in a
// flaky JVM) or that gc kicks in and saves the day...
// (unlikely, though).
this.releaseFileLock();
}
}
if (isPosixManditoryFileLock()) {
try {
Runtime.getRuntime().exec(new String[] {
"chmod", "g+s,g-x", file.getPath()
});
} catch (Exception ex) {
//ex.printStackTrace();
}
}
// Note: from FileChannel.tryLock(...) JavaDoc:
//
// @return A lock object representing the newly-acquired lock,
// or <tt>null</tt> if the lock could not be acquired
// because another program holds an overlapping lock
this.fileLock = lraf.getChannel().tryLock(0, MIN_LOCK_REGION,
false);
// According to the API, if it's non-null, it must be valid.
// This may not actually yet be the full truth of the matter under
// all commonly available JVM implementations.
// fileLock.isValid() API says it never throws, though, so
// with fingers crossed...
success = (this.fileLock != null && this.fileLock.isValid());
} catch (Exception e) {}
if (!success) {
this.releaseFileLock();
}
return success;
} } | public class class_name {
private boolean aquireFileLock() {
// PRE:
//
// raf is never null and is never closed upon entry.
//
// Rhetorical question to self: How does one tell if a RandomAccessFile
// is closed, short of invoking an operation and getting an IOException
// the says its closed (assuming you can control the Locale of the error
// message)?
//
final RandomAccessFile lraf = super.raf;
// In an ideal world, we would use a lock region back off approach,
// starting with region MAX_LOCK_REGION, then MAX_NFS_LOCK_REGION,
// then MIN_LOCK_REGION.
//
// In practice, however, it is just generally unwise to mount network
// file system database instances. Be warned.
//
// In general, it is probably also unwise to mount removable media
// database instances that are not read-only.
boolean success = false;
try {
if (this.fileLock != null) {
// API says never throws exception, but I suspect
// it's quite possible some research / FOSS JVMs might
// still throw unsupported operation exceptions on certain
// NIO classes...better to be safe than sorry.
if (this.fileLock.isValid()) {
return true; // depends on control dependency: [if], data = [none]
} else {
// It's not valid, so releasing it is a no-op.
//
// However, we should still clean up the referenceand hope
// no previous complications exist (a hung FileLock in a
// flaky JVM) or that gc kicks in and saves the day...
// (unlikely, though).
this.releaseFileLock(); // depends on control dependency: [if], data = [none]
}
}
if (isPosixManditoryFileLock()) {
try {
Runtime.getRuntime().exec(new String[] {
"chmod", "g+s,g-x", file.getPath()
}); // depends on control dependency: [try], data = [none]
} catch (Exception ex) {
//ex.printStackTrace();
} // depends on control dependency: [catch], data = [none]
}
// Note: from FileChannel.tryLock(...) JavaDoc:
//
// @return A lock object representing the newly-acquired lock,
// or <tt>null</tt> if the lock could not be acquired
// because another program holds an overlapping lock
this.fileLock = lraf.getChannel().tryLock(0, MIN_LOCK_REGION,
false); // depends on control dependency: [try], data = [none]
// According to the API, if it's non-null, it must be valid.
// This may not actually yet be the full truth of the matter under
// all commonly available JVM implementations.
// fileLock.isValid() API says it never throws, though, so
// with fingers crossed...
success = (this.fileLock != null && this.fileLock.isValid()); // depends on control dependency: [try], data = [none]
} catch (Exception e) {} // depends on control dependency: [catch], data = [none]
if (!success) {
this.releaseFileLock(); // depends on control dependency: [if], data = [none]
}
return success;
} } |
public class class_name {
protected double getFerrySpeed(ReaderWay way) {
long duration = 0;
try {
// During the reader process we have converted the duration value into a artificial tag called "duration:seconds".
duration = Long.parseLong(way.getTag("duration:seconds"));
} catch (Exception ex) {
}
// seconds to hours
double durationInHours = duration / 60d / 60d;
// Check if our graphhopper specific artificially created estimated_distance way tag is present
Number estimatedLength = way.getTag("estimated_distance", null);
if (durationInHours > 0)
try {
if (estimatedLength != null) {
double estimatedLengthInKm = estimatedLength.doubleValue() / 1000;
// If duration AND distance is available we can calculate the speed more precisely
// and set both speed to the same value. Factor 1.4 slower because of waiting time!
double calculatedTripSpeed = estimatedLengthInKm / durationInHours / 1.4;
// Plausibility check especially for the case of wrongly used PxM format with the intention to
// specify the duration in minutes, but actually using months
if (calculatedTripSpeed > 0.01d) {
if (calculatedTripSpeed > getMaxSpeed()) {
return getMaxSpeed();
}
// If the speed is lower than the speed we can store, we have to set it to the minSpeed, but > 0
if (Math.round(calculatedTripSpeed) < speedFactor / 2) {
return speedFactor / 2;
}
return Math.round(calculatedTripSpeed);
} else {
long lastId = way.getNodes().isEmpty() ? -1 : way.getNodes().get(way.getNodes().size() - 1);
long firstId = way.getNodes().isEmpty() ? -1 : way.getNodes().get(0);
if (firstId != lastId)
logger.warn("Unrealistic long duration ignored in way with way ID=" + way.getId() + " : Duration tag value="
+ way.getTag("duration") + " (=" + Math.round(duration / 60d) + " minutes)");
durationInHours = 0;
}
}
} catch (Exception ex) {
}
if (durationInHours == 0) {
if (estimatedLength != null && estimatedLength.doubleValue() <= 300)
return speedFactor / 2;
// unknown speed -> put penalty on ferry transport
return UNKNOWN_DURATION_FERRY_SPEED;
} else if (durationInHours > 1) {
// lengthy ferries should be faster than short trip ferry
return LONG_TRIP_FERRY_SPEED;
} else {
return SHORT_TRIP_FERRY_SPEED;
}
} } | public class class_name {
protected double getFerrySpeed(ReaderWay way) {
long duration = 0;
try {
// During the reader process we have converted the duration value into a artificial tag called "duration:seconds".
duration = Long.parseLong(way.getTag("duration:seconds")); // depends on control dependency: [try], data = [none]
} catch (Exception ex) {
} // depends on control dependency: [catch], data = [none]
// seconds to hours
double durationInHours = duration / 60d / 60d;
// Check if our graphhopper specific artificially created estimated_distance way tag is present
Number estimatedLength = way.getTag("estimated_distance", null);
if (durationInHours > 0)
try {
if (estimatedLength != null) {
double estimatedLengthInKm = estimatedLength.doubleValue() / 1000;
// If duration AND distance is available we can calculate the speed more precisely
// and set both speed to the same value. Factor 1.4 slower because of waiting time!
double calculatedTripSpeed = estimatedLengthInKm / durationInHours / 1.4;
// Plausibility check especially for the case of wrongly used PxM format with the intention to
// specify the duration in minutes, but actually using months
if (calculatedTripSpeed > 0.01d) {
if (calculatedTripSpeed > getMaxSpeed()) {
return getMaxSpeed(); // depends on control dependency: [if], data = [none]
}
// If the speed is lower than the speed we can store, we have to set it to the minSpeed, but > 0
if (Math.round(calculatedTripSpeed) < speedFactor / 2) {
return speedFactor / 2; // depends on control dependency: [if], data = [none]
}
return Math.round(calculatedTripSpeed); // depends on control dependency: [if], data = [(calculatedTripSpeed]
} else {
long lastId = way.getNodes().isEmpty() ? -1 : way.getNodes().get(way.getNodes().size() - 1);
long firstId = way.getNodes().isEmpty() ? -1 : way.getNodes().get(0);
if (firstId != lastId)
logger.warn("Unrealistic long duration ignored in way with way ID=" + way.getId() + " : Duration tag value="
+ way.getTag("duration") + " (=" + Math.round(duration / 60d) + " minutes)");
durationInHours = 0; // depends on control dependency: [if], data = [none]
}
}
} catch (Exception ex) {
} // depends on control dependency: [catch], data = [none]
if (durationInHours == 0) {
if (estimatedLength != null && estimatedLength.doubleValue() <= 300)
return speedFactor / 2;
// unknown speed -> put penalty on ferry transport
return UNKNOWN_DURATION_FERRY_SPEED; // depends on control dependency: [if], data = [none]
} else if (durationInHours > 1) {
// lengthy ferries should be faster than short trip ferry
return LONG_TRIP_FERRY_SPEED; // depends on control dependency: [if], data = [none]
} else {
return SHORT_TRIP_FERRY_SPEED; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public FileSystem getProxiedFileSystem(State properties, AuthType authType, String authPath, String uri, final Configuration conf)
throws IOException, InterruptedException, URISyntaxException {
Preconditions.checkArgument(StringUtils.isNotBlank(properties.getProp(ConfigurationKeys.FS_PROXY_AS_USER_NAME)),
"State does not contain a proper proxy user name");
String proxyUserName = properties.getProp(ConfigurationKeys.FS_PROXY_AS_USER_NAME);
UserGroupInformation proxyUser;
switch (authType) {
case KEYTAB: // If the authentication type is KEYTAB, log in a super user first before creating a proxy user.
Preconditions.checkArgument(
StringUtils.isNotBlank(properties.getProp(ConfigurationKeys.SUPER_USER_NAME_TO_PROXY_AS_OTHERS)),
"State does not contain a proper proxy token file name");
String superUser = properties.getProp(ConfigurationKeys.SUPER_USER_NAME_TO_PROXY_AS_OTHERS);
UserGroupInformation.loginUserFromKeytab(superUser, authPath);
proxyUser = UserGroupInformation.createProxyUser(proxyUserName, UserGroupInformation.getLoginUser());
break;
case TOKEN: // If the authentication type is TOKEN, create a proxy user and then add the token to the user.
proxyUser = UserGroupInformation.createProxyUser(proxyUserName, UserGroupInformation.getLoginUser());
Optional<Token<?>> proxyToken = getTokenFromSeqFile(authPath, proxyUserName);
if (proxyToken.isPresent()) {
proxyUser.addToken(proxyToken.get());
} else {
LOG.warn("No delegation token found for the current proxy user.");
}
break;
default:
LOG.warn("Creating a proxy user without authentication, which could not perform File system operations.");
proxyUser = UserGroupInformation.createProxyUser(proxyUserName, UserGroupInformation.getLoginUser());
break;
}
final URI fsURI = URI.create(uri);
proxyUser.doAs(new PrivilegedExceptionAction<Void>() {
@Override
public Void run() throws IOException {
LOG.debug("Now performing file system operations as :" + UserGroupInformation.getCurrentUser());
proxiedFs = FileSystem.get(fsURI, conf);
return null;
}
});
return this.proxiedFs;
} } | public class class_name {
public FileSystem getProxiedFileSystem(State properties, AuthType authType, String authPath, String uri, final Configuration conf)
throws IOException, InterruptedException, URISyntaxException {
Preconditions.checkArgument(StringUtils.isNotBlank(properties.getProp(ConfigurationKeys.FS_PROXY_AS_USER_NAME)),
"State does not contain a proper proxy user name");
String proxyUserName = properties.getProp(ConfigurationKeys.FS_PROXY_AS_USER_NAME);
UserGroupInformation proxyUser;
switch (authType) {
case KEYTAB: // If the authentication type is KEYTAB, log in a super user first before creating a proxy user.
Preconditions.checkArgument(
StringUtils.isNotBlank(properties.getProp(ConfigurationKeys.SUPER_USER_NAME_TO_PROXY_AS_OTHERS)),
"State does not contain a proper proxy token file name");
String superUser = properties.getProp(ConfigurationKeys.SUPER_USER_NAME_TO_PROXY_AS_OTHERS);
UserGroupInformation.loginUserFromKeytab(superUser, authPath);
proxyUser = UserGroupInformation.createProxyUser(proxyUserName, UserGroupInformation.getLoginUser());
break;
case TOKEN: // If the authentication type is TOKEN, create a proxy user and then add the token to the user.
proxyUser = UserGroupInformation.createProxyUser(proxyUserName, UserGroupInformation.getLoginUser());
Optional<Token<?>> proxyToken = getTokenFromSeqFile(authPath, proxyUserName);
if (proxyToken.isPresent()) {
proxyUser.addToken(proxyToken.get()); // depends on control dependency: [if], data = [none]
} else {
LOG.warn("No delegation token found for the current proxy user."); // depends on control dependency: [if], data = [none]
}
break;
default:
LOG.warn("Creating a proxy user without authentication, which could not perform File system operations.");
proxyUser = UserGroupInformation.createProxyUser(proxyUserName, UserGroupInformation.getLoginUser());
break;
}
final URI fsURI = URI.create(uri);
proxyUser.doAs(new PrivilegedExceptionAction<Void>() {
@Override
public Void run() throws IOException {
LOG.debug("Now performing file system operations as :" + UserGroupInformation.getCurrentUser());
proxiedFs = FileSystem.get(fsURI, conf);
return null;
}
});
return this.proxiedFs;
} } |
public class class_name {
public void marshall(S3Destination s3Destination, ProtocolMarshaller protocolMarshaller) {
if (s3Destination == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(s3Destination.getBucket(), BUCKET_BINDING);
protocolMarshaller.marshall(s3Destination.getPrefix(), PREFIX_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(S3Destination s3Destination, ProtocolMarshaller protocolMarshaller) {
if (s3Destination == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(s3Destination.getBucket(), BUCKET_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(s3Destination.getPrefix(), PREFIX_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 setDay(Day d)
{
if (m_day != null)
{
m_parentCalendar.removeHoursFromDay(this);
}
m_day = d;
m_parentCalendar.attachHoursToDay(this);
} } | public class class_name {
public void setDay(Day d)
{
if (m_day != null)
{
m_parentCalendar.removeHoursFromDay(this); // depends on control dependency: [if], data = [none]
}
m_day = d;
m_parentCalendar.attachHoursToDay(this);
} } |
public class class_name {
public Element build(SVGPlot svgp, double x, double y, double width, double height) {
Element barchart = svgp.svgElement(SVGConstants.SVG_G_TAG);
// TODO: use style library for colors!
Element bar = svgp.svgRect(x, y, width, height);
bar.setAttribute(SVGConstants.SVG_FILL_ATTRIBUTE, "#a0a0a0");
bar.setAttribute(SVGConstants.SVG_STROKE_ATTRIBUTE, "#a0a0a0");
bar.setAttribute(SVGConstants.SVG_STROKE_WIDTH_ATTRIBUTE, String.valueOf(height * 0.01));
barchart.appendChild(bar);
if(val >= min && val <= max && min < max) {
final double frame = 0.02 * height;
double fpos = (val - min) / (max - min) * (width - 2 * frame);
Element chart;
if(reversed) {
chart = svgp.svgRect(x + frame + fpos, y + frame, width - fpos - 2 * frame, height - 2 * frame);
}
else {
chart = svgp.svgRect(x + frame, y + frame, fpos, height - 2 * frame);
}
chart.setAttribute(SVGConstants.SVG_FILL_ATTRIBUTE, "#d4e4f1");
chart.setAttribute(SVGConstants.SVG_STROKE_ATTRIBUTE, "#a0a0a0");
chart.setAttribute(SVGConstants.SVG_STROKE_WIDTH_ATTRIBUTE, String.valueOf(height * 0.01));
barchart.appendChild(chart);
}
// Draw the values:
if(format != null) {
String num = Double.isNaN(val) ? "NaN" : format.format(val);
Element lbl = svgp.svgText(x + 0.05 * width, y + 0.75 * height, num);
lbl.setAttribute(SVGConstants.SVG_STYLE_ATTRIBUTE, "font-size: " + 0.75 * height + "; font-weight: bold");
barchart.appendChild(lbl);
}
// Draw the label
if(label != null) {
Element lbl = svgp.svgText(x + 1.05 * width, y + 0.75 * height, label);
lbl.setAttribute(SVGConstants.SVG_STYLE_ATTRIBUTE, "font-size: " + 0.75 * height + "; font-weight: normal");
barchart.appendChild(lbl);
}
return barchart;
} } | public class class_name {
public Element build(SVGPlot svgp, double x, double y, double width, double height) {
Element barchart = svgp.svgElement(SVGConstants.SVG_G_TAG);
// TODO: use style library for colors!
Element bar = svgp.svgRect(x, y, width, height);
bar.setAttribute(SVGConstants.SVG_FILL_ATTRIBUTE, "#a0a0a0");
bar.setAttribute(SVGConstants.SVG_STROKE_ATTRIBUTE, "#a0a0a0");
bar.setAttribute(SVGConstants.SVG_STROKE_WIDTH_ATTRIBUTE, String.valueOf(height * 0.01));
barchart.appendChild(bar);
if(val >= min && val <= max && min < max) {
final double frame = 0.02 * height;
double fpos = (val - min) / (max - min) * (width - 2 * frame);
Element chart;
if(reversed) {
chart = svgp.svgRect(x + frame + fpos, y + frame, width - fpos - 2 * frame, height - 2 * frame); // depends on control dependency: [if], data = [none]
}
else {
chart = svgp.svgRect(x + frame, y + frame, fpos, height - 2 * frame); // depends on control dependency: [if], data = [none]
}
chart.setAttribute(SVGConstants.SVG_FILL_ATTRIBUTE, "#d4e4f1"); // depends on control dependency: [if], data = [none]
chart.setAttribute(SVGConstants.SVG_STROKE_ATTRIBUTE, "#a0a0a0"); // depends on control dependency: [if], data = [none]
chart.setAttribute(SVGConstants.SVG_STROKE_WIDTH_ATTRIBUTE, String.valueOf(height * 0.01)); // depends on control dependency: [if], data = [none]
barchart.appendChild(chart); // depends on control dependency: [if], data = [none]
}
// Draw the values:
if(format != null) {
String num = Double.isNaN(val) ? "NaN" : format.format(val);
Element lbl = svgp.svgText(x + 0.05 * width, y + 0.75 * height, num);
lbl.setAttribute(SVGConstants.SVG_STYLE_ATTRIBUTE, "font-size: " + 0.75 * height + "; font-weight: bold"); // depends on control dependency: [if], data = [none]
barchart.appendChild(lbl); // depends on control dependency: [if], data = [none]
}
// Draw the label
if(label != null) {
Element lbl = svgp.svgText(x + 1.05 * width, y + 0.75 * height, label);
lbl.setAttribute(SVGConstants.SVG_STYLE_ATTRIBUTE, "font-size: " + 0.75 * height + "; font-weight: normal"); // depends on control dependency: [if], data = [none]
barchart.appendChild(lbl); // depends on control dependency: [if], data = [none]
}
return barchart;
} } |
public class class_name {
@Override
@Pure
public RoadPolyline getMapElementAt(int index) {
final Iterator<RoadSegment> segments = this.roadNetwork.iterator();
for (int i = 0; i < index - 1 && segments.hasNext(); ++i) {
segments.next();
}
if (segments.hasNext()) {
return (RoadPolyline) segments.next();
}
throw new IndexOutOfBoundsException();
} } | public class class_name {
@Override
@Pure
public RoadPolyline getMapElementAt(int index) {
final Iterator<RoadSegment> segments = this.roadNetwork.iterator();
for (int i = 0; i < index - 1 && segments.hasNext(); ++i) {
segments.next(); // depends on control dependency: [for], data = [none]
}
if (segments.hasNext()) {
return (RoadPolyline) segments.next(); // depends on control dependency: [if], data = [none]
}
throw new IndexOutOfBoundsException();
} } |
public class class_name {
public FieldDescriptor getFieldDescriptorForPath(String aPath, Map pathHints)
{
ArrayList desc = getAttributeDescriptorsForPath(aPath, pathHints);
FieldDescriptor fld = null;
Object temp;
if (!desc.isEmpty())
{
temp = desc.get(desc.size() - 1);
if (temp instanceof FieldDescriptor)
{
fld = (FieldDescriptor) temp;
}
}
return fld;
} } | public class class_name {
public FieldDescriptor getFieldDescriptorForPath(String aPath, Map pathHints)
{
ArrayList desc = getAttributeDescriptorsForPath(aPath, pathHints);
FieldDescriptor fld = null;
Object temp;
if (!desc.isEmpty())
{
temp = desc.get(desc.size() - 1);
// depends on control dependency: [if], data = [none]
if (temp instanceof FieldDescriptor)
{
fld = (FieldDescriptor) temp;
// depends on control dependency: [if], data = [none]
}
}
return fld;
} } |
public class class_name {
public boolean add(XEvent event) {
try {
events.append(event);
} catch (IOException e) {
e.printStackTrace();
return false;
}
return true;
} } | public class class_name {
public boolean add(XEvent event) {
try {
events.append(event); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
e.printStackTrace();
return false;
} // depends on control dependency: [catch], data = [none]
return true;
} } |
public class class_name {
public EClass getIfcReinforcingElement() {
if (ifcReinforcingElementEClass == null) {
ifcReinforcingElementEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(435);
}
return ifcReinforcingElementEClass;
} } | public class class_name {
public EClass getIfcReinforcingElement() {
if (ifcReinforcingElementEClass == null) {
ifcReinforcingElementEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(435);
// depends on control dependency: [if], data = [none]
}
return ifcReinforcingElementEClass;
} } |
public class class_name {
public synchronized Collection<ContainerShutdownDescriptor> removeShutdownDescriptors(GavLabel gavLabel) {
List<ContainerShutdownDescriptor> descriptors;
if (gavLabel != null) {
descriptors = removeFromPomLabelMap(gavLabel);
removeFromPerContainerMap(descriptors);
} else {
// All entries are requested
descriptors = new ArrayList<>(shutdownDescriptorPerContainerMap.values());
clearAllMaps();
}
Collections.reverse(descriptors);
return descriptors;
} } | public class class_name {
public synchronized Collection<ContainerShutdownDescriptor> removeShutdownDescriptors(GavLabel gavLabel) {
List<ContainerShutdownDescriptor> descriptors;
if (gavLabel != null) {
descriptors = removeFromPomLabelMap(gavLabel); // depends on control dependency: [if], data = [(gavLabel]
removeFromPerContainerMap(descriptors); // depends on control dependency: [if], data = [none]
} else {
// All entries are requested
descriptors = new ArrayList<>(shutdownDescriptorPerContainerMap.values()); // depends on control dependency: [if], data = [none]
clearAllMaps(); // depends on control dependency: [if], data = [none]
}
Collections.reverse(descriptors);
return descriptors;
} } |
public class class_name {
public ClassTypeSignature getTypeSignature() {
if (typeSignatureStr == null) {
return null;
}
if (typeSignature == null) {
try {
typeSignature = ClassTypeSignature.parse(typeSignatureStr, this);
typeSignature.setScanResult(scanResult);
} catch (final ParseException e) {
throw new IllegalArgumentException(e);
}
}
return typeSignature;
} } | public class class_name {
public ClassTypeSignature getTypeSignature() {
if (typeSignatureStr == null) {
return null; // depends on control dependency: [if], data = [none]
}
if (typeSignature == null) {
try {
typeSignature = ClassTypeSignature.parse(typeSignatureStr, this); // depends on control dependency: [try], data = [none]
typeSignature.setScanResult(scanResult); // depends on control dependency: [try], data = [none]
} catch (final ParseException e) {
throw new IllegalArgumentException(e);
} // depends on control dependency: [catch], data = [none]
}
return typeSignature;
} } |
public class class_name {
private void parseSegmentStartPayload(WsByteBuffer contextBuffer)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "parseSegmentStartPayload", contextBuffer);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) JFapUtils.debugTraceWsByteBufferInfo(this, tc, contextBuffer, "contextBuffer");
if (unparsedPayloadData == null)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "allocating unparsed payload data buffe, size="+segmentedTransmissionHeaderFields[primaryHeaderFields.priority].totalLength); // D191832.1
unparsedPayloadData =
allocateWsByteBuffer((int)segmentedTransmissionHeaderFields[primaryHeaderFields.priority].totalLength, primaryHeaderFields.isPooled); // D191832.1
unparsedPayloadData.position(0);
unparsedPayloadData.limit((int)segmentedTransmissionHeaderFields[primaryHeaderFields.priority].totalLength); // D191832.1
}
if (state != STATE_ERROR)
{
int amountCopied =
JFapUtils.copyWsByteBuffer(contextBuffer, unparsedPayloadData, transmissionPayloadRemaining);
transmissionPayloadRemaining -= amountCopied;
if (inFlightSegmentedTransmissions[primaryHeaderFields.priority] != null)
{
throwable = new SIConnectionLostException(nls.getFormattedMessage("TRANSPARSER_PROTOCOLERROR_SICJ0053", new Object[] {connection.remoteHostAddress, connection.chainName}, "TRANSPARSER_PROTOCOLERROR_SICJ0053")); // D226223
// This FFDC was generated because our peer sent us a duplicate start of a segmented
// transmission. I.e. we already had a partial segmented transmission built for a
// given priority level when our peer sent us the start of another.
FFDCFilter.processException(throwable, "com.ibm.ws.sib.jfapchannel.impl.InboundTransmissionParser", JFapChannelConstants.INBOUNDXMITPARSER_PARSESSPAYLOAD_01, getFormattedBytes(contextBuffer)); // D267629
state = STATE_ERROR;
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Received the start of a segmented transmission whilst already processing a segmented transmission at the same priority level");
}
else
{
needMoreData = (contextBuffer.remaining() == 0);
if (!needMoreData)
{
inFlightSegmentedTransmissions[primaryHeaderFields.priority] = unparsedPayloadData;
// begin F193735.3
if (type == Conversation.ME)
meReadBytes += unparsedPayloadData.remaining();
else if (type == Conversation.CLIENT)
clientReadBytes -= unparsedPayloadData.remaining();
// end F193735.3
reset();
}
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "parseSegmentStartPayload");
} } | public class class_name {
private void parseSegmentStartPayload(WsByteBuffer contextBuffer)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "parseSegmentStartPayload", contextBuffer);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) JFapUtils.debugTraceWsByteBufferInfo(this, tc, contextBuffer, "contextBuffer");
if (unparsedPayloadData == null)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "allocating unparsed payload data buffe, size="+segmentedTransmissionHeaderFields[primaryHeaderFields.priority].totalLength); // D191832.1
unparsedPayloadData =
allocateWsByteBuffer((int)segmentedTransmissionHeaderFields[primaryHeaderFields.priority].totalLength, primaryHeaderFields.isPooled); // D191832.1 // depends on control dependency: [if], data = [none]
unparsedPayloadData.position(0); // depends on control dependency: [if], data = [none]
unparsedPayloadData.limit((int)segmentedTransmissionHeaderFields[primaryHeaderFields.priority].totalLength); // D191832.1 // depends on control dependency: [if], data = [none]
}
if (state != STATE_ERROR)
{
int amountCopied =
JFapUtils.copyWsByteBuffer(contextBuffer, unparsedPayloadData, transmissionPayloadRemaining);
transmissionPayloadRemaining -= amountCopied; // depends on control dependency: [if], data = [none]
if (inFlightSegmentedTransmissions[primaryHeaderFields.priority] != null)
{
throwable = new SIConnectionLostException(nls.getFormattedMessage("TRANSPARSER_PROTOCOLERROR_SICJ0053", new Object[] {connection.remoteHostAddress, connection.chainName}, "TRANSPARSER_PROTOCOLERROR_SICJ0053")); // D226223 // depends on control dependency: [if], data = [none]
// This FFDC was generated because our peer sent us a duplicate start of a segmented
// transmission. I.e. we already had a partial segmented transmission built for a
// given priority level when our peer sent us the start of another.
FFDCFilter.processException(throwable, "com.ibm.ws.sib.jfapchannel.impl.InboundTransmissionParser", JFapChannelConstants.INBOUNDXMITPARSER_PARSESSPAYLOAD_01, getFormattedBytes(contextBuffer)); // D267629 // depends on control dependency: [if], data = [none]
state = STATE_ERROR; // depends on control dependency: [if], data = [none]
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Received the start of a segmented transmission whilst already processing a segmented transmission at the same priority level");
}
else
{
needMoreData = (contextBuffer.remaining() == 0); // depends on control dependency: [if], data = [none]
if (!needMoreData)
{
inFlightSegmentedTransmissions[primaryHeaderFields.priority] = unparsedPayloadData; // depends on control dependency: [if], data = [none]
// begin F193735.3
if (type == Conversation.ME)
meReadBytes += unparsedPayloadData.remaining();
else if (type == Conversation.CLIENT)
clientReadBytes -= unparsedPayloadData.remaining();
// end F193735.3
reset(); // depends on control dependency: [if], data = [none]
}
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "parseSegmentStartPayload");
} } |
public class class_name {
public static Chunk getChunk(Properties attributes) {
Chunk chunk = new Chunk();
chunk.setFont(FontFactory.getFont(attributes));
String value;
value = attributes.getProperty(ElementTags.ITEXT);
if (value != null) {
chunk.append(value);
}
value = attributes.getProperty(ElementTags.LOCALGOTO);
if (value != null) {
chunk.setLocalGoto(value);
}
value = attributes.getProperty(ElementTags.REMOTEGOTO);
if (value != null) {
String page = attributes.getProperty(ElementTags.PAGE);
if (page != null) {
chunk.setRemoteGoto(value, Integer.parseInt(page));
} else {
String destination = attributes
.getProperty(ElementTags.DESTINATION);
if (destination != null) {
chunk.setRemoteGoto(value, destination);
}
}
}
value = attributes.getProperty(ElementTags.LOCALDESTINATION);
if (value != null) {
chunk.setLocalDestination(value);
}
value = attributes.getProperty(ElementTags.SUBSUPSCRIPT);
if (value != null) {
chunk.setTextRise(Float.parseFloat(value + "f"));
}
value = attributes.getProperty(Markup.CSS_KEY_VERTICALALIGN);
if (value != null && value.endsWith("%")) {
float p = Float.parseFloat(value.substring(0, value.length() - 1)
+ "f") / 100f;
chunk.setTextRise(p * chunk.getFont().getSize());
}
value = attributes.getProperty(ElementTags.GENERICTAG);
if (value != null) {
chunk.setGenericTag(value);
}
value = attributes.getProperty(ElementTags.BACKGROUNDCOLOR);
if (value != null) {
chunk.setBackground(Markup.decodeColor(value));
}
return chunk;
} } | public class class_name {
public static Chunk getChunk(Properties attributes) {
Chunk chunk = new Chunk();
chunk.setFont(FontFactory.getFont(attributes));
String value;
value = attributes.getProperty(ElementTags.ITEXT);
if (value != null) {
chunk.append(value); // depends on control dependency: [if], data = [(value]
}
value = attributes.getProperty(ElementTags.LOCALGOTO);
if (value != null) {
chunk.setLocalGoto(value); // depends on control dependency: [if], data = [(value]
}
value = attributes.getProperty(ElementTags.REMOTEGOTO);
if (value != null) {
String page = attributes.getProperty(ElementTags.PAGE);
if (page != null) {
chunk.setRemoteGoto(value, Integer.parseInt(page)); // depends on control dependency: [if], data = [(page]
} else {
String destination = attributes
.getProperty(ElementTags.DESTINATION);
if (destination != null) {
chunk.setRemoteGoto(value, destination); // depends on control dependency: [if], data = [none]
}
}
}
value = attributes.getProperty(ElementTags.LOCALDESTINATION);
if (value != null) {
chunk.setLocalDestination(value); // depends on control dependency: [if], data = [(value]
}
value = attributes.getProperty(ElementTags.SUBSUPSCRIPT);
if (value != null) {
chunk.setTextRise(Float.parseFloat(value + "f")); // depends on control dependency: [if], data = [(value]
}
value = attributes.getProperty(Markup.CSS_KEY_VERTICALALIGN);
if (value != null && value.endsWith("%")) {
float p = Float.parseFloat(value.substring(0, value.length() - 1)
+ "f") / 100f;
chunk.setTextRise(p * chunk.getFont().getSize()); // depends on control dependency: [if], data = [none]
}
value = attributes.getProperty(ElementTags.GENERICTAG);
if (value != null) {
chunk.setGenericTag(value); // depends on control dependency: [if], data = [(value]
}
value = attributes.getProperty(ElementTags.BACKGROUNDCOLOR);
if (value != null) {
chunk.setBackground(Markup.decodeColor(value)); // depends on control dependency: [if], data = [(value]
}
return chunk;
} } |
public class class_name {
public DataSink<T> output(OutputFormat<T> outputFormat) {
Validate.notNull(outputFormat);
// configure the type if needed
if (outputFormat instanceof InputTypeConfigurable) {
((InputTypeConfigurable) outputFormat).setInputType(this.type);
}
DataSink<T> sink = new DataSink<T>(this, outputFormat, this.type);
this.context.registerDataSink(sink);
return sink;
} } | public class class_name {
public DataSink<T> output(OutputFormat<T> outputFormat) {
Validate.notNull(outputFormat);
// configure the type if needed
if (outputFormat instanceof InputTypeConfigurable) {
((InputTypeConfigurable) outputFormat).setInputType(this.type); // depends on control dependency: [if], data = [none]
}
DataSink<T> sink = new DataSink<T>(this, outputFormat, this.type);
this.context.registerDataSink(sink);
return sink;
} } |
public class class_name {
protected static String qualifiedNameFromIdAndContext(String name, String context) {
if (!name.contains(".")) {
return context + "." + name;
}
return name;
} } | public class class_name {
protected static String qualifiedNameFromIdAndContext(String name, String context) {
if (!name.contains(".")) {
return context + "." + name; // depends on control dependency: [if], data = [none]
}
return name;
} } |
public class class_name {
private void processLibraryJarPersistenceXml(JPAApplInfo applInfo, Container libContainer,
String archiveName, String rootPrefix,
JPAPuScope scope, ClassLoader classLaoder) {
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "processLibraryJarPersistenceXml : " + applInfo.getApplName() +
", " + (libContainer != null ? libContainer.getName() : "null") +
", " + archiveName + ", " + rootPrefix + ", " + scope);
if (libContainer != null) {
String puArchiveName = archiveName;
for (Entry entry : libContainer) {
if (isTraceOn && tc.isDebugEnabled()) {
Tr.debug(tc, "processing : " + entry.getName());
}
if (entry.getName().endsWith(".jar")) {
try {
Container jarContainer = entry.adapt(Container.class);
Entry pxml = jarContainer.getEntry(PERSISTENCE_XML_RESOURCE_NAME);
if (pxml != null) {
String appName = applInfo.getApplName();
if (rootPrefix != null) {
puArchiveName = rootPrefix + entry.getName();
}
URL puRoot = getPXmlRootURL(appName, archiveName, pxml);
applInfo.addPersistenceUnits(new OSGiJPAPXml(applInfo, puArchiveName, scope, puRoot, classLaoder, pxml));
}
} catch (UnableToAdaptException ex) {
// Not really a jar archive, just a poorly named file
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "processLibraryJarPersistenceXml: ignoring " + entry.getName(), ex);
}
}
}
}
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "processLibraryJarPersistenceXml : " + applInfo.getApplName() + ", " + rootPrefix);
} } | public class class_name {
private void processLibraryJarPersistenceXml(JPAApplInfo applInfo, Container libContainer,
String archiveName, String rootPrefix,
JPAPuScope scope, ClassLoader classLaoder) {
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "processLibraryJarPersistenceXml : " + applInfo.getApplName() +
", " + (libContainer != null ? libContainer.getName() : "null") +
", " + archiveName + ", " + rootPrefix + ", " + scope);
if (libContainer != null) {
String puArchiveName = archiveName;
for (Entry entry : libContainer) {
if (isTraceOn && tc.isDebugEnabled()) {
Tr.debug(tc, "processing : " + entry.getName()); // depends on control dependency: [if], data = [none]
}
if (entry.getName().endsWith(".jar")) {
try {
Container jarContainer = entry.adapt(Container.class);
Entry pxml = jarContainer.getEntry(PERSISTENCE_XML_RESOURCE_NAME);
if (pxml != null) {
String appName = applInfo.getApplName();
if (rootPrefix != null) {
puArchiveName = rootPrefix + entry.getName(); // depends on control dependency: [if], data = [none]
}
URL puRoot = getPXmlRootURL(appName, archiveName, pxml);
applInfo.addPersistenceUnits(new OSGiJPAPXml(applInfo, puArchiveName, scope, puRoot, classLaoder, pxml)); // depends on control dependency: [if], data = [none]
}
} catch (UnableToAdaptException ex) {
// Not really a jar archive, just a poorly named file
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "processLibraryJarPersistenceXml: ignoring " + entry.getName(), ex);
} // depends on control dependency: [catch], data = [none]
}
}
}
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "processLibraryJarPersistenceXml : " + applInfo.getApplName() + ", " + rootPrefix);
} } |
public class class_name {
public ClientResponseImpl shouldAccept(String name, AuthSystem.AuthUser user,
final StoredProcedureInvocation task,
final Procedure catProc) {
if (user.isAuthEnabled()) {
InvocationPermissionPolicy deniedPolicy = null;
InvocationPermissionPolicy.PolicyResult res = InvocationPermissionPolicy.PolicyResult.DENY;
for (InvocationPermissionPolicy policy : m_permissionpolicies) {
res = policy.shouldAccept(user, task, catProc);
if (res == InvocationPermissionPolicy.PolicyResult.ALLOW) {
deniedPolicy = null;
break;
}
if (res == InvocationPermissionPolicy.PolicyResult.DENY) {
if (deniedPolicy == null) {
//Take first denied response only.
deniedPolicy = policy;
}
}
}
if (deniedPolicy != null) {
return deniedPolicy.getErrorResponse(user, task, catProc);
}
//We must have an explicit allow on of the policy must grant access.
assert(res == InvocationPermissionPolicy.PolicyResult.ALLOW);
return null;
}
//User authentication is disabled. (auth disabled user)
return null;
} } | public class class_name {
public ClientResponseImpl shouldAccept(String name, AuthSystem.AuthUser user,
final StoredProcedureInvocation task,
final Procedure catProc) {
if (user.isAuthEnabled()) {
InvocationPermissionPolicy deniedPolicy = null;
InvocationPermissionPolicy.PolicyResult res = InvocationPermissionPolicy.PolicyResult.DENY;
for (InvocationPermissionPolicy policy : m_permissionpolicies) {
res = policy.shouldAccept(user, task, catProc); // depends on control dependency: [for], data = [policy]
if (res == InvocationPermissionPolicy.PolicyResult.ALLOW) {
deniedPolicy = null; // depends on control dependency: [if], data = [none]
break;
}
if (res == InvocationPermissionPolicy.PolicyResult.DENY) {
if (deniedPolicy == null) {
//Take first denied response only.
deniedPolicy = policy; // depends on control dependency: [if], data = [none]
}
}
}
if (deniedPolicy != null) {
return deniedPolicy.getErrorResponse(user, task, catProc); // depends on control dependency: [if], data = [none]
}
//We must have an explicit allow on of the policy must grant access.
assert(res == InvocationPermissionPolicy.PolicyResult.ALLOW); // depends on control dependency: [if], data = [none]
return null; // depends on control dependency: [if], data = [none]
}
//User authentication is disabled. (auth disabled user)
return null;
} } |
public class class_name {
@Override
public SchemaManager getSchemaManager(Map<String, Object> puProperties)
{
if (schemaManager == null)
{
initializePropertyReader();
setExternalProperties(puProperties);
schemaManager = new CouchbaseSchemaManager(CouchbaseClientFactory.class.getName(), puProperties,
kunderaMetadata);
}
return schemaManager;
} } | public class class_name {
@Override
public SchemaManager getSchemaManager(Map<String, Object> puProperties)
{
if (schemaManager == null)
{
initializePropertyReader(); // depends on control dependency: [if], data = [none]
setExternalProperties(puProperties); // depends on control dependency: [if], data = [none]
schemaManager = new CouchbaseSchemaManager(CouchbaseClientFactory.class.getName(), puProperties,
kunderaMetadata); // depends on control dependency: [if], data = [none]
}
return schemaManager;
} } |
public class class_name {
protected void __setOutput(String path) {
try {
w_ = new BufferedWriter(new FileWriter(path));
} catch (Exception e) {
throw new FastRuntimeException(e.getMessage());
}
} } | public class class_name {
protected void __setOutput(String path) {
try {
w_ = new BufferedWriter(new FileWriter(path)); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new FastRuntimeException(e.getMessage());
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public FunctionDescr function( PackageDescrBuilder pkg ) throws RecognitionException {
FunctionDescrBuilder function = null;
try {
function = helper.start( pkg,
FunctionDescrBuilder.class,
null );
// 'function'
match( input,
DRL5Lexer.ID,
DroolsSoftKeywords.FUNCTION,
null,
DroolsEditorType.KEYWORD );
if ( state.failed ) return null;
if ( input.LA( 1 ) != DRL5Lexer.ID || input.LA( 2 ) != DRL5Lexer.LEFT_PAREN ) {
// type
String type = type();
if ( state.failed ) return null;
if ( state.backtracking == 0 ) function.returnType( type );
}
// name
Token id = match( input,
DRL5Lexer.ID,
null,
null,
DroolsEditorType.IDENTIFIER );
if ( state.failed ) return null;
if ( state.backtracking == 0 ) {
function.name( id.getText() );
helper.setParaphrasesValue( DroolsParaphraseTypes.FUNCTION,
"\"" + id.getText() + "\"" );
}
// arguments
parameters( function,
true );
if ( state.failed ) return null;
// body
String body = chunk( DRL5Lexer.LEFT_CURLY,
DRL5Lexer.RIGHT_CURLY,
-1 );
if ( state.failed ) return null;
if ( state.backtracking == 0 ) function.body( body );
} catch ( RecognitionException re ) {
reportError( re );
} finally {
helper.end( FunctionDescrBuilder.class,
function );
}
return (function != null) ? function.getDescr() : null;
} } | public class class_name {
public FunctionDescr function( PackageDescrBuilder pkg ) throws RecognitionException {
FunctionDescrBuilder function = null;
try {
function = helper.start( pkg,
FunctionDescrBuilder.class,
null );
// 'function'
match( input,
DRL5Lexer.ID,
DroolsSoftKeywords.FUNCTION,
null,
DroolsEditorType.KEYWORD );
if ( state.failed ) return null;
if ( input.LA( 1 ) != DRL5Lexer.ID || input.LA( 2 ) != DRL5Lexer.LEFT_PAREN ) {
// type
String type = type();
if ( state.failed ) return null;
if ( state.backtracking == 0 ) function.returnType( type );
}
// name
Token id = match( input,
DRL5Lexer.ID,
null,
null,
DroolsEditorType.IDENTIFIER );
if ( state.failed ) return null;
if ( state.backtracking == 0 ) {
function.name( id.getText() ); // depends on control dependency: [if], data = [none]
helper.setParaphrasesValue( DroolsParaphraseTypes.FUNCTION,
"\"" + id.getText() + "\"" ); // depends on control dependency: [if], data = [none]
}
// arguments
parameters( function,
true );
if ( state.failed ) return null;
// body
String body = chunk( DRL5Lexer.LEFT_CURLY,
DRL5Lexer.RIGHT_CURLY,
-1 );
if ( state.failed ) return null;
if ( state.backtracking == 0 ) function.body( body );
} catch ( RecognitionException re ) {
reportError( re );
} finally {
helper.end( FunctionDescrBuilder.class,
function );
}
return (function != null) ? function.getDescr() : null;
} } |
public class class_name {
@Override
public void configureConstraintWeight(Rule rule, SimpleScore constraintWeight) {
super.configureConstraintWeight(rule, constraintWeight);
BiConsumer<RuleContext, Integer> matchExecutor;
if (constraintWeight.equals(SimpleScore.ZERO)) {
matchExecutor = (RuleContext kcontext, Integer matchWeight) -> {};
} else {
matchExecutor = (RuleContext kcontext, Integer matchWeight)
-> addConstraintMatch(kcontext, constraintWeight.getScore() * matchWeight);
}
matchExecutorByNumberMap.put(rule, matchExecutor);
} } | public class class_name {
@Override
public void configureConstraintWeight(Rule rule, SimpleScore constraintWeight) {
super.configureConstraintWeight(rule, constraintWeight);
BiConsumer<RuleContext, Integer> matchExecutor;
if (constraintWeight.equals(SimpleScore.ZERO)) {
matchExecutor = (RuleContext kcontext, Integer matchWeight) -> {};
} else {
matchExecutor = (RuleContext kcontext, Integer matchWeight)
-> addConstraintMatch(kcontext, constraintWeight.getScore() * matchWeight); // depends on control dependency: [if], data = [none]
}
matchExecutorByNumberMap.put(rule, matchExecutor);
} } |
public class class_name {
public void setOutboundInterface(InetSocketAddress inetSocketAddress) {
if(inetSocketAddress == null) {
throw new NullPointerException("outbound Interface param shouldn't be null");
}
String address = inetSocketAddress.getAddress().getHostAddress()
+ ":" + inetSocketAddress.getPort();
List<SipURI> list = this.sipFactoryImpl.getSipNetworkInterfaceManager().getOutboundInterfaces();
SipURI networkInterface = null;
for(SipURI networkInterfaceURI : list) {
if(networkInterfaceURI.toString().contains(address)) {
networkInterface = networkInterfaceURI;
break;
}
}
if(networkInterface == null) throw new IllegalArgumentException("Network interface for " +
address + " not found");
outboundInterface = networkInterface;
} } | public class class_name {
public void setOutboundInterface(InetSocketAddress inetSocketAddress) {
if(inetSocketAddress == null) {
throw new NullPointerException("outbound Interface param shouldn't be null");
}
String address = inetSocketAddress.getAddress().getHostAddress()
+ ":" + inetSocketAddress.getPort();
List<SipURI> list = this.sipFactoryImpl.getSipNetworkInterfaceManager().getOutboundInterfaces();
SipURI networkInterface = null;
for(SipURI networkInterfaceURI : list) {
if(networkInterfaceURI.toString().contains(address)) {
networkInterface = networkInterfaceURI;
// depends on control dependency: [if], data = [none]
break;
}
}
if(networkInterface == null) throw new IllegalArgumentException("Network interface for " +
address + " not found");
outboundInterface = networkInterface;
} } |
public class class_name {
public void setDedicatedIpPools(java.util.Collection<String> dedicatedIpPools) {
if (dedicatedIpPools == null) {
this.dedicatedIpPools = null;
return;
}
this.dedicatedIpPools = new java.util.ArrayList<String>(dedicatedIpPools);
} } | public class class_name {
public void setDedicatedIpPools(java.util.Collection<String> dedicatedIpPools) {
if (dedicatedIpPools == null) {
this.dedicatedIpPools = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.dedicatedIpPools = new java.util.ArrayList<String>(dedicatedIpPools);
} } |
public class class_name {
public boolean process(MessageEnvelope envelope) {
if (this.event == null) {
return false;
}
boolean triggered = this.event.verifyEventCondition(envelope);
if (triggered) {
beforeReply(envelope);
if (this.reply != null) {
this.reply.reply(envelope);
}
afterReply(envelope);
}
return triggered;
} } | public class class_name {
public boolean process(MessageEnvelope envelope) {
if (this.event == null) {
return false; // depends on control dependency: [if], data = [none]
}
boolean triggered = this.event.verifyEventCondition(envelope);
if (triggered) {
beforeReply(envelope); // depends on control dependency: [if], data = [none]
if (this.reply != null) {
this.reply.reply(envelope); // depends on control dependency: [if], data = [none]
}
afterReply(envelope); // depends on control dependency: [if], data = [none]
}
return triggered;
} } |
public class class_name {
public byte[] getBytes() {
if (token != null) {
try {
return token.getBytes();
} catch (Exception e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "Exception occurred getting bytes[] from token.", new Object[] { e });
return null;
}
} else
return new byte[0];
} } | public class class_name {
public byte[] getBytes() {
if (token != null) {
try {
return token.getBytes(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "Exception occurred getting bytes[] from token.", new Object[] { e });
return null;
} // depends on control dependency: [catch], data = [none]
} else
return new byte[0];
} } |
public class class_name {
public void close() {
for (Entry<String, OResourcePool<String, DB>> pool : pools.entrySet()) {
for (DB db : pool.getValue().getResources()) {
pool.getValue().close();
try {
OLogManager.instance().debug(this, "Closing pooled database '%s'...", db.getName());
((ODatabasePooled) db).forceClose();
OLogManager.instance().debug(this, "OK", db.getName());
} catch (Exception e) {
OLogManager.instance().debug(this, "Error: %d", e.toString());
}
}
}
} } | public class class_name {
public void close() {
for (Entry<String, OResourcePool<String, DB>> pool : pools.entrySet()) {
for (DB db : pool.getValue().getResources()) {
pool.getValue().close();
// depends on control dependency: [for], data = [none]
try {
OLogManager.instance().debug(this, "Closing pooled database '%s'...", db.getName());
// depends on control dependency: [try], data = [none]
((ODatabasePooled) db).forceClose();
// depends on control dependency: [try], data = [none]
OLogManager.instance().debug(this, "OK", db.getName());
// depends on control dependency: [try], data = [none]
} catch (Exception e) {
OLogManager.instance().debug(this, "Error: %d", e.toString());
}
// depends on control dependency: [catch], data = [none]
}
}
} } |
public class class_name {
public void setAutoVerifiedAttributes(java.util.Collection<String> autoVerifiedAttributes) {
if (autoVerifiedAttributes == null) {
this.autoVerifiedAttributes = null;
return;
}
this.autoVerifiedAttributes = new java.util.ArrayList<String>(autoVerifiedAttributes);
} } | public class class_name {
public void setAutoVerifiedAttributes(java.util.Collection<String> autoVerifiedAttributes) {
if (autoVerifiedAttributes == null) {
this.autoVerifiedAttributes = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.autoVerifiedAttributes = new java.util.ArrayList<String>(autoVerifiedAttributes);
} } |
public class class_name {
public DescribeSessionsRequest withFilters(SessionFilter... filters) {
if (this.filters == null) {
setFilters(new com.amazonaws.internal.SdkInternalList<SessionFilter>(filters.length));
}
for (SessionFilter ele : filters) {
this.filters.add(ele);
}
return this;
} } | public class class_name {
public DescribeSessionsRequest withFilters(SessionFilter... filters) {
if (this.filters == null) {
setFilters(new com.amazonaws.internal.SdkInternalList<SessionFilter>(filters.length)); // depends on control dependency: [if], data = [none]
}
for (SessionFilter ele : filters) {
this.filters.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
public void marshall(DescribeStreamProcessorRequest describeStreamProcessorRequest, ProtocolMarshaller protocolMarshaller) {
if (describeStreamProcessorRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(describeStreamProcessorRequest.getName(), NAME_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(DescribeStreamProcessorRequest describeStreamProcessorRequest, ProtocolMarshaller protocolMarshaller) {
if (describeStreamProcessorRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(describeStreamProcessorRequest.getName(), NAME_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 List<IUserLayoutNodeDescription> getFavoriteCollections(IUserLayout userLayout) {
if (null == userLayout) {
throw new IllegalArgumentException(
"Cannot get favorites collections from a null userLayout");
}
logger.trace("Extracting favorites collections from layout [{}].", userLayout);
Enumeration<String> nodeIds = userLayout.getChildIds(userLayout.getRootId());
List<IUserLayoutNodeDescription> results = new LinkedList<IUserLayoutNodeDescription>();
while (nodeIds.hasMoreElements()) {
String nodeId = nodeIds.nextElement();
try {
IUserLayoutNodeDescription nodeDescription = userLayout.getNodeDescription(nodeId);
String parentId = userLayout.getParentId(nodeId);
String nodeName = nodeDescription.getName();
IUserLayoutNodeDescription.LayoutNodeType nodeType = nodeDescription.getType();
if (FOLDER.equals(nodeType)
&& nodeDescription instanceof IUserLayoutFolderDescription) {
IUserLayoutFolderDescription folderDescription =
(IUserLayoutFolderDescription) nodeDescription;
String folderType = folderDescription.getFolderType();
if (FAVORITE_COLLECTION_TYPE.equals(folderType)) {
results.add(nodeDescription);
logger.trace(
"Selected node with id [{}] named [{}] with "
+ "folderType [{}] and type [{}] as a collection of favorites.",
nodeId,
nodeName,
folderType,
nodeType);
} else {
logger.trace(
"Rejected node with id [{}] named [{}] with "
+ "folderType [{}] and type [{}] as not a collection of favorites.",
nodeId,
nodeName,
folderType,
nodeType);
}
} else {
logger.trace(
"Rejected non-folder node with id [{}] named [{}] "
+ "with parentId [{}] and type [{}] as not a collection of favorites.",
nodeId,
nodeName,
parentId,
nodeType);
}
// if something goes wrong in processing a node, exclude it
} catch (Exception e) {
logger.error(
"Error determining whether to include layout node [{}]"
+ " as a collection of favorites. Excluding.",
nodeId,
e);
}
}
logger.debug("Extracted favorites collections [{}] from [{}]", results, userLayout);
return results;
} } | public class class_name {
public List<IUserLayoutNodeDescription> getFavoriteCollections(IUserLayout userLayout) {
if (null == userLayout) {
throw new IllegalArgumentException(
"Cannot get favorites collections from a null userLayout");
}
logger.trace("Extracting favorites collections from layout [{}].", userLayout);
Enumeration<String> nodeIds = userLayout.getChildIds(userLayout.getRootId());
List<IUserLayoutNodeDescription> results = new LinkedList<IUserLayoutNodeDescription>();
while (nodeIds.hasMoreElements()) {
String nodeId = nodeIds.nextElement();
try {
IUserLayoutNodeDescription nodeDescription = userLayout.getNodeDescription(nodeId);
String parentId = userLayout.getParentId(nodeId);
String nodeName = nodeDescription.getName();
IUserLayoutNodeDescription.LayoutNodeType nodeType = nodeDescription.getType();
if (FOLDER.equals(nodeType)
&& nodeDescription instanceof IUserLayoutFolderDescription) {
IUserLayoutFolderDescription folderDescription =
(IUserLayoutFolderDescription) nodeDescription;
String folderType = folderDescription.getFolderType();
if (FAVORITE_COLLECTION_TYPE.equals(folderType)) {
results.add(nodeDescription); // depends on control dependency: [if], data = [none]
logger.trace(
"Selected node with id [{}] named [{}] with "
+ "folderType [{}] and type [{}] as a collection of favorites.",
nodeId,
nodeName,
folderType,
nodeType); // depends on control dependency: [if], data = [none]
} else {
logger.trace(
"Rejected node with id [{}] named [{}] with "
+ "folderType [{}] and type [{}] as not a collection of favorites.",
nodeId,
nodeName,
folderType,
nodeType); // depends on control dependency: [if], data = [none]
}
} else {
logger.trace(
"Rejected non-folder node with id [{}] named [{}] "
+ "with parentId [{}] and type [{}] as not a collection of favorites.",
nodeId,
nodeName,
parentId,
nodeType); // depends on control dependency: [if], data = [none]
}
// if something goes wrong in processing a node, exclude it
} catch (Exception e) {
logger.error(
"Error determining whether to include layout node [{}]"
+ " as a collection of favorites. Excluding.",
nodeId,
e);
} // depends on control dependency: [catch], data = [none]
}
logger.debug("Extracted favorites collections [{}] from [{}]", results, userLayout);
return results;
} } |
public class class_name {
public void marshall(DataFormatConversionConfiguration dataFormatConversionConfiguration, ProtocolMarshaller protocolMarshaller) {
if (dataFormatConversionConfiguration == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(dataFormatConversionConfiguration.getSchemaConfiguration(), SCHEMACONFIGURATION_BINDING);
protocolMarshaller.marshall(dataFormatConversionConfiguration.getInputFormatConfiguration(), INPUTFORMATCONFIGURATION_BINDING);
protocolMarshaller.marshall(dataFormatConversionConfiguration.getOutputFormatConfiguration(), OUTPUTFORMATCONFIGURATION_BINDING);
protocolMarshaller.marshall(dataFormatConversionConfiguration.getEnabled(), ENABLED_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(DataFormatConversionConfiguration dataFormatConversionConfiguration, ProtocolMarshaller protocolMarshaller) {
if (dataFormatConversionConfiguration == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(dataFormatConversionConfiguration.getSchemaConfiguration(), SCHEMACONFIGURATION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(dataFormatConversionConfiguration.getInputFormatConfiguration(), INPUTFORMATCONFIGURATION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(dataFormatConversionConfiguration.getOutputFormatConfiguration(), OUTPUTFORMATCONFIGURATION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(dataFormatConversionConfiguration.getEnabled(), ENABLED_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 final EObject ruleOptionValue() throws RecognitionException {
EObject current = null;
Token lv_key_0_0=null;
Token otherlv_1=null;
Token otherlv_3=null;
AntlrDatatypeRuleToken lv_value_2_0 = null;
enterRule();
try {
// InternalSimpleAntlr.g:228:28: ( ( ( (lv_key_0_0= RULE_ID ) ) otherlv_1= '=' ( (lv_value_2_0= ruleIdOrInt ) ) otherlv_3= ';' ) )
// InternalSimpleAntlr.g:229:1: ( ( (lv_key_0_0= RULE_ID ) ) otherlv_1= '=' ( (lv_value_2_0= ruleIdOrInt ) ) otherlv_3= ';' )
{
// InternalSimpleAntlr.g:229:1: ( ( (lv_key_0_0= RULE_ID ) ) otherlv_1= '=' ( (lv_value_2_0= ruleIdOrInt ) ) otherlv_3= ';' )
// InternalSimpleAntlr.g:229:2: ( (lv_key_0_0= RULE_ID ) ) otherlv_1= '=' ( (lv_value_2_0= ruleIdOrInt ) ) otherlv_3= ';'
{
// InternalSimpleAntlr.g:229:2: ( (lv_key_0_0= RULE_ID ) )
// InternalSimpleAntlr.g:230:1: (lv_key_0_0= RULE_ID )
{
// InternalSimpleAntlr.g:230:1: (lv_key_0_0= RULE_ID )
// InternalSimpleAntlr.g:231:3: lv_key_0_0= RULE_ID
{
lv_key_0_0=(Token)match(input,RULE_ID,FOLLOW_9); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(lv_key_0_0, grammarAccess.getOptionValueAccess().getKeyIDTerminalRuleCall_0_0());
}
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElement(grammarAccess.getOptionValueRule());
}
setWithLastConsumed(
current,
"key",
lv_key_0_0,
"org.eclipse.xtext.generator.parser.antlr.debug.SimpleAntlr.ID");
}
}
}
otherlv_1=(Token)match(input,18,FOLLOW_10); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_1, grammarAccess.getOptionValueAccess().getEqualsSignKeyword_1());
}
// InternalSimpleAntlr.g:251:1: ( (lv_value_2_0= ruleIdOrInt ) )
// InternalSimpleAntlr.g:252:1: (lv_value_2_0= ruleIdOrInt )
{
// InternalSimpleAntlr.g:252:1: (lv_value_2_0= ruleIdOrInt )
// InternalSimpleAntlr.g:253:3: lv_value_2_0= ruleIdOrInt
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getOptionValueAccess().getValueIdOrIntParserRuleCall_2_0());
}
pushFollow(FOLLOW_4);
lv_value_2_0=ruleIdOrInt();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getOptionValueRule());
}
set(
current,
"value",
lv_value_2_0,
"org.eclipse.xtext.generator.parser.antlr.debug.SimpleAntlr.IdOrInt");
afterParserOrEnumRuleCall();
}
}
}
otherlv_3=(Token)match(input,14,FOLLOW_2); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_3, grammarAccess.getOptionValueAccess().getSemicolonKeyword_3());
}
}
}
if ( state.backtracking==0 ) {
leaveRule();
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
} } | public class class_name {
public final EObject ruleOptionValue() throws RecognitionException {
EObject current = null;
Token lv_key_0_0=null;
Token otherlv_1=null;
Token otherlv_3=null;
AntlrDatatypeRuleToken lv_value_2_0 = null;
enterRule();
try {
// InternalSimpleAntlr.g:228:28: ( ( ( (lv_key_0_0= RULE_ID ) ) otherlv_1= '=' ( (lv_value_2_0= ruleIdOrInt ) ) otherlv_3= ';' ) )
// InternalSimpleAntlr.g:229:1: ( ( (lv_key_0_0= RULE_ID ) ) otherlv_1= '=' ( (lv_value_2_0= ruleIdOrInt ) ) otherlv_3= ';' )
{
// InternalSimpleAntlr.g:229:1: ( ( (lv_key_0_0= RULE_ID ) ) otherlv_1= '=' ( (lv_value_2_0= ruleIdOrInt ) ) otherlv_3= ';' )
// InternalSimpleAntlr.g:229:2: ( (lv_key_0_0= RULE_ID ) ) otherlv_1= '=' ( (lv_value_2_0= ruleIdOrInt ) ) otherlv_3= ';'
{
// InternalSimpleAntlr.g:229:2: ( (lv_key_0_0= RULE_ID ) )
// InternalSimpleAntlr.g:230:1: (lv_key_0_0= RULE_ID )
{
// InternalSimpleAntlr.g:230:1: (lv_key_0_0= RULE_ID )
// InternalSimpleAntlr.g:231:3: lv_key_0_0= RULE_ID
{
lv_key_0_0=(Token)match(input,RULE_ID,FOLLOW_9); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(lv_key_0_0, grammarAccess.getOptionValueAccess().getKeyIDTerminalRuleCall_0_0()); // depends on control dependency: [if], data = [none]
}
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElement(grammarAccess.getOptionValueRule()); // depends on control dependency: [if], data = [none]
}
setWithLastConsumed(
current,
"key",
lv_key_0_0,
"org.eclipse.xtext.generator.parser.antlr.debug.SimpleAntlr.ID"); // depends on control dependency: [if], data = [none]
}
}
}
otherlv_1=(Token)match(input,18,FOLLOW_10); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_1, grammarAccess.getOptionValueAccess().getEqualsSignKeyword_1()); // depends on control dependency: [if], data = [none]
}
// InternalSimpleAntlr.g:251:1: ( (lv_value_2_0= ruleIdOrInt ) )
// InternalSimpleAntlr.g:252:1: (lv_value_2_0= ruleIdOrInt )
{
// InternalSimpleAntlr.g:252:1: (lv_value_2_0= ruleIdOrInt )
// InternalSimpleAntlr.g:253:3: lv_value_2_0= ruleIdOrInt
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getOptionValueAccess().getValueIdOrIntParserRuleCall_2_0()); // depends on control dependency: [if], data = [none]
}
pushFollow(FOLLOW_4);
lv_value_2_0=ruleIdOrInt();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getOptionValueRule()); // depends on control dependency: [if], data = [none]
}
set(
current,
"value",
lv_value_2_0,
"org.eclipse.xtext.generator.parser.antlr.debug.SimpleAntlr.IdOrInt"); // depends on control dependency: [if], data = [none]
afterParserOrEnumRuleCall(); // depends on control dependency: [if], data = [none]
}
}
}
otherlv_3=(Token)match(input,14,FOLLOW_2); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_3, grammarAccess.getOptionValueAccess().getSemicolonKeyword_3()); // depends on control dependency: [if], data = [none]
}
}
}
if ( state.backtracking==0 ) {
leaveRule(); // depends on control dependency: [if], data = [none]
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
} } |
public class class_name {
public void start() {
if (workers != null) throw new UnsupportedOperationException("Please shutdown connector!");
if (LOGGER.isLoggable(Level.INFO))
LOGGER.info("Starting " + name + " with " + config.getWorkerCount() + " workers");
handlers = new ConcurrentLinkedQueue<TcpServerHandler>();
handlers.add(new TcpServerAcceptor(config, handlers));
workers = new Thread[config.getWorkerCount()];
for (int i = 0; i < workers.length; i++) {
workers[i] = new TcpServerWorker(handlers);
}
for (final Thread worker : workers) worker.start();
if (LOGGER.isLoggable(Level.INFO))
LOGGER.info(name + " started");
} } | public class class_name {
public void start() {
if (workers != null) throw new UnsupportedOperationException("Please shutdown connector!");
if (LOGGER.isLoggable(Level.INFO))
LOGGER.info("Starting " + name + " with " + config.getWorkerCount() + " workers");
handlers = new ConcurrentLinkedQueue<TcpServerHandler>();
handlers.add(new TcpServerAcceptor(config, handlers));
workers = new Thread[config.getWorkerCount()];
for (int i = 0; i < workers.length; i++) {
workers[i] = new TcpServerWorker(handlers);
// depends on control dependency: [for], data = [i]
}
for (final Thread worker : workers) worker.start();
if (LOGGER.isLoggable(Level.INFO))
LOGGER.info(name + " started");
} } |
public class class_name {
public <R extends Runnable> AbstractModule run(final Class<R> klass) {
Closure initializer = new Closure() {
@Override
public void exec(Object... args) {
String m = "exec(Object...)";
try {
m = "creating task " + klass.getName();
RunnableCreator creator = GWT.create(RunnableCreator.class);
R runnable = creator.create(klass);
m = "creating binder for task " + klass.getName();
RunnableBinderFactory binderFactory = GWT.create(RunnableBinderFactory.class);
JSClosure binder = binderFactory.create(runnable);
if (binder != null) {
m = "injecting dependencies into task " + klass.getName();
binder.apply(args);
}
m = "running task " + klass.getName();
runnable.run();
} catch (Exception e) {
LOG.log(Level.WARNING, "Exception while " + m, e);
}
}
};
RunnableDependencyInspector inspector = GWT.create(RunnableDependencyInspector.class);
String[] dependencies = inspector.inspect(klass);
ngo.run(JSArray.create(dependencies), JSClosure.create(initializer));
return this;
} } | public class class_name {
public <R extends Runnable> AbstractModule run(final Class<R> klass) {
Closure initializer = new Closure() {
@Override
public void exec(Object... args) {
String m = "exec(Object...)";
try {
m = "creating task " + klass.getName();
RunnableCreator creator = GWT.create(RunnableCreator.class);
R runnable = creator.create(klass);
m = "creating binder for task " + klass.getName();
RunnableBinderFactory binderFactory = GWT.create(RunnableBinderFactory.class);
JSClosure binder = binderFactory.create(runnable);
if (binder != null) {
m = "injecting dependencies into task " + klass.getName(); // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
binder.apply(args); // depends on control dependency: [if], data = [none]
}
m = "running task " + klass.getName();
runnable.run();
} catch (Exception e) {
LOG.log(Level.WARNING, "Exception while " + m, e);
}
}
};
RunnableDependencyInspector inspector = GWT.create(RunnableDependencyInspector.class);
String[] dependencies = inspector.inspect(klass);
ngo.run(JSArray.create(dependencies), JSClosure.create(initializer));
return this;
} } |
public class class_name {
private static boolean isRpcTimeout(Annotation[] annotations) {
for (Annotation annotation : annotations) {
if (annotation.annotationType().equals(RpcTimeout.class)) {
return true;
}
}
return false;
} } | public class class_name {
private static boolean isRpcTimeout(Annotation[] annotations) {
for (Annotation annotation : annotations) {
if (annotation.annotationType().equals(RpcTimeout.class)) {
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
} } |
public class class_name {
public static byte[] fileAsByteArray(File file) {
try {
return inputStreamAsByteArray(new FileInputStream(file));
} catch(FileNotFoundException e) {
throw LOG.fileNotFoundException(file.getAbsolutePath(), e);
}
} } | public class class_name {
public static byte[] fileAsByteArray(File file) {
try {
return inputStreamAsByteArray(new FileInputStream(file)); // depends on control dependency: [try], data = [none]
} catch(FileNotFoundException e) {
throw LOG.fileNotFoundException(file.getAbsolutePath(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
public List<URL> getJarFileUrls() {
List<URL> urls = new ArrayList<>();
for (String url : persistenceUnitXml.getJarFile()) {
try {
urls.add(new URL(url));
} catch (MalformedURLException e) {
LOGGER.error("Cannot create an URL object from {}", url, e);
}
}
return urls;
} } | public class class_name {
@Override
public List<URL> getJarFileUrls() {
List<URL> urls = new ArrayList<>();
for (String url : persistenceUnitXml.getJarFile()) {
try {
urls.add(new URL(url)); // depends on control dependency: [try], data = [none]
} catch (MalformedURLException e) {
LOGGER.error("Cannot create an URL object from {}", url, e);
} // depends on control dependency: [catch], data = [none]
}
return urls;
} } |
public class class_name {
public String jsonToXml(String json){
String xml = "";
// 處理直接以陣列開頭的JSON,並指定給予 row 的 tag
if ( "[".equals( json.substring(0,1) ) ){
xml = XML.toString(new JSONArray(json), "row");
}else{
xml = XML.toString(new JSONObject(json));
}
return xml;
} } | public class class_name {
public String jsonToXml(String json){
String xml = "";
// 處理直接以陣列開頭的JSON,並指定給予 row 的 tag
if ( "[".equals( json.substring(0,1) ) ){
xml = XML.toString(new JSONArray(json), "row"); // depends on control dependency: [if], data = [none]
}else{
xml = XML.toString(new JSONObject(json)); // depends on control dependency: [if], data = [none]
}
return xml;
} } |
public class class_name {
public static String subPath(String rootDir, File file) {
try {
return subPath(rootDir, file.getCanonicalPath());
} catch (IOException e) {
throw new IORuntimeException(e);
}
} } | public class class_name {
public static String subPath(String rootDir, File file) {
try {
return subPath(rootDir, file.getCanonicalPath());
// depends on control dependency: [try], data = [none]
} catch (IOException e) {
throw new IORuntimeException(e);
}
// depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void orizzonte5( double delta, int quadrata, double beta, double alfa, RandomIter elevImageIterator,
WritableRaster curvatureImage, int[][] shadow ) {
int rows = curvatureImage.getHeight();
int cols = curvatureImage.getWidth();
/*=====================*/
int y, I, J;
double zenith;
/*======================*/
for( int j = quadrata; j >= 0; j-- ) {
I = -1;
J = -1;
y = 0;
for( int jj = j; jj < quadrata; jj++ ) {
for( int i = rows - (int) floor(1 / tan(beta) * (jj - j)) - 1; i >= rows
- (int) floor(1 / tan(beta) * (jj - j + 1)) - 1
&& i >= 0; i-- ) {
if (jj >= quadrata - cols && !isNovalue(elevImageIterator.getSampleDouble(jj - (quadrata - cols), i, 0))) {
/*shadow.element[i][jj-(quadrata-Z0.nch)]=j;}}}}*/
if (curvatureImage.getSampleDouble(jj - (quadrata - cols), i, 0) == 1 && I == -1) {
I = i;
J = jj - (quadrata - cols);
y = 1;
} else if (curvatureImage.getSampleDouble(jj - (quadrata - cols), i, 0) == 1 && I != -1) {
zenith = (elevImageIterator.getSampleDouble(J, I, 0) - elevImageIterator.getSampleDouble(jj
- (quadrata - cols), i, 0))
/ sqrt(pow((double) (I - i) * (double) delta, (double) 2)
+ pow((double) (J - (jj - (quadrata - cols))) * (double) delta, (double) 2));
if (zenith <= tan(alfa)) {
shadow[i][jj - (quadrata - cols)] = 0;
I = i;
J = jj - (quadrata - cols);
} else {
shadow[i][jj - (quadrata - cols)] = 1;
}
} else if (curvatureImage.getSampleDouble(jj - (quadrata - cols), i, 0) == 0 && y == 1) {
zenith = (elevImageIterator.getSampleDouble(J, I, 0) - elevImageIterator.getSampleDouble(jj
- (quadrata - cols), i, 0))
/ sqrt(pow((double) (I - i) * (double) delta, (double) 2)
+ pow((double) (J - (jj - (quadrata - cols))) * (double) delta, (double) 2));
if (zenith <= tan(alfa)) {
shadow[i][jj - (quadrata - cols)] = 0;
y = 0;
} else {
shadow[i][jj - (quadrata - cols)] = 1;
}
}
}
}
}
}
} } | public class class_name {
public void orizzonte5( double delta, int quadrata, double beta, double alfa, RandomIter elevImageIterator,
WritableRaster curvatureImage, int[][] shadow ) {
int rows = curvatureImage.getHeight();
int cols = curvatureImage.getWidth();
/*=====================*/
int y, I, J;
double zenith;
/*======================*/
for( int j = quadrata; j >= 0; j-- ) {
I = -1; // depends on control dependency: [for], data = [none]
J = -1; // depends on control dependency: [for], data = [none]
y = 0; // depends on control dependency: [for], data = [none]
for( int jj = j; jj < quadrata; jj++ ) {
for( int i = rows - (int) floor(1 / tan(beta) * (jj - j)) - 1; i >= rows
- (int) floor(1 / tan(beta) * (jj - j + 1)) - 1
&& i >= 0; i-- ) {
if (jj >= quadrata - cols && !isNovalue(elevImageIterator.getSampleDouble(jj - (quadrata - cols), i, 0))) {
/*shadow.element[i][jj-(quadrata-Z0.nch)]=j;}}}}*/
if (curvatureImage.getSampleDouble(jj - (quadrata - cols), i, 0) == 1 && I == -1) {
I = i; // depends on control dependency: [if], data = [none]
J = jj - (quadrata - cols); // depends on control dependency: [if], data = [none]
y = 1; // depends on control dependency: [if], data = [none]
} else if (curvatureImage.getSampleDouble(jj - (quadrata - cols), i, 0) == 1 && I != -1) {
zenith = (elevImageIterator.getSampleDouble(J, I, 0) - elevImageIterator.getSampleDouble(jj
- (quadrata - cols), i, 0))
/ sqrt(pow((double) (I - i) * (double) delta, (double) 2)
+ pow((double) (J - (jj - (quadrata - cols))) * (double) delta, (double) 2)); // depends on control dependency: [if], data = [none]
if (zenith <= tan(alfa)) {
shadow[i][jj - (quadrata - cols)] = 0; // depends on control dependency: [if], data = [none]
I = i; // depends on control dependency: [if], data = [none]
J = jj - (quadrata - cols); // depends on control dependency: [if], data = [none]
} else {
shadow[i][jj - (quadrata - cols)] = 1; // depends on control dependency: [if], data = [none]
}
} else if (curvatureImage.getSampleDouble(jj - (quadrata - cols), i, 0) == 0 && y == 1) {
zenith = (elevImageIterator.getSampleDouble(J, I, 0) - elevImageIterator.getSampleDouble(jj
- (quadrata - cols), i, 0))
/ sqrt(pow((double) (I - i) * (double) delta, (double) 2)
+ pow((double) (J - (jj - (quadrata - cols))) * (double) delta, (double) 2)); // depends on control dependency: [if], data = [none]
if (zenith <= tan(alfa)) {
shadow[i][jj - (quadrata - cols)] = 0; // depends on control dependency: [if], data = [none]
y = 0; // depends on control dependency: [if], data = [none]
} else {
shadow[i][jj - (quadrata - cols)] = 1; // depends on control dependency: [if], data = [none]
}
}
}
}
}
}
} } |
public class class_name {
public boolean remove(Object key, Object value) {
final Object curValue = get(key);
if (!Objects.equals(curValue, value) || (curValue == null && !containsKey(key))) {
return false;
}
remove(key);
return true;
} } | public class class_name {
public boolean remove(Object key, Object value) {
final Object curValue = get(key);
if (!Objects.equals(curValue, value) || (curValue == null && !containsKey(key))) {
return false;
// depends on control dependency: [if], data = [none]
}
remove(key);
return true;
} } |
public class class_name {
public static List<InetSocketAddress> getMasterRpcAddresses(AlluxioConfiguration conf) {
// First check whether rpc addresses are explicitly configured.
if (conf.isSet(PropertyKey.MASTER_RPC_ADDRESSES)) {
return parseInetSocketAddresses(conf.getList(PropertyKey.MASTER_RPC_ADDRESSES, ","));
}
// Fall back on server-side journal configuration.
int rpcPort = NetworkAddressUtils.getPort(NetworkAddressUtils.ServiceType.MASTER_RPC, conf);
return overridePort(getEmbeddedJournalAddresses(conf, ServiceType.MASTER_RAFT), rpcPort);
} } | public class class_name {
public static List<InetSocketAddress> getMasterRpcAddresses(AlluxioConfiguration conf) {
// First check whether rpc addresses are explicitly configured.
if (conf.isSet(PropertyKey.MASTER_RPC_ADDRESSES)) {
return parseInetSocketAddresses(conf.getList(PropertyKey.MASTER_RPC_ADDRESSES, ",")); // depends on control dependency: [if], data = [none]
}
// Fall back on server-side journal configuration.
int rpcPort = NetworkAddressUtils.getPort(NetworkAddressUtils.ServiceType.MASTER_RPC, conf);
return overridePort(getEmbeddedJournalAddresses(conf, ServiceType.MASTER_RAFT), rpcPort);
} } |
public class class_name {
private void onEventListenerComponentAdded(ComponentDescriptorAddedEvent event, ComponentManager componentManager,
ComponentDescriptor<EventListener> descriptor)
{
try {
EventListener eventListener = componentManager.getInstance(EventListener.class, event.getRoleHint());
if (getListener(eventListener.getName()) != eventListener) {
addListener(eventListener);
} else {
this.logger.warn("An Event Listener named [{}] already exists, ignoring the [{}] component",
eventListener.getName(), descriptor.getImplementation().getName());
}
} catch (ComponentLookupException e) {
this.logger.error("Failed to lookup the Event Listener [{}] corresponding to the Component registration "
+ "event for [{}]. Ignoring the event", new Object[] { event.getRoleHint(),
descriptor.getImplementation().getName(), e });
}
} } | public class class_name {
private void onEventListenerComponentAdded(ComponentDescriptorAddedEvent event, ComponentManager componentManager,
ComponentDescriptor<EventListener> descriptor)
{
try {
EventListener eventListener = componentManager.getInstance(EventListener.class, event.getRoleHint());
if (getListener(eventListener.getName()) != eventListener) {
addListener(eventListener); // depends on control dependency: [if], data = [eventListener)]
} else {
this.logger.warn("An Event Listener named [{}] already exists, ignoring the [{}] component",
eventListener.getName(), descriptor.getImplementation().getName()); // depends on control dependency: [if], data = [none]
}
} catch (ComponentLookupException e) {
this.logger.error("Failed to lookup the Event Listener [{}] corresponding to the Component registration "
+ "event for [{}]. Ignoring the event", new Object[] { event.getRoleHint(),
descriptor.getImplementation().getName(), e });
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private void onPopLevelProgress(Object source)
{
DefaultJobProgressStep parent = this.currentStep.getParent();
if (parent == null) {
LOGGER.warn("PopLevelProgressEvent was fired too many times. Don't forget "
+ "to match each PopLevelProgressEvent with a PushLevelProgressEvent.");
return;
}
// Try to find the right level based on the source
DefaultJobProgressStep level = findLevel(this.currentStep.getParent(), source);
if (level == null) {
LOGGER.warn("Could not find any matching step level for source [{}]. Ignoring PopLevelProgressEvent.",
source.toString());
return;
}
// Move to parent step
this.currentStep = level;
// Close the level
this.currentStep.finishLevel();
} } | public class class_name {
private void onPopLevelProgress(Object source)
{
DefaultJobProgressStep parent = this.currentStep.getParent();
if (parent == null) {
LOGGER.warn("PopLevelProgressEvent was fired too many times. Don't forget "
+ "to match each PopLevelProgressEvent with a PushLevelProgressEvent."); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
// Try to find the right level based on the source
DefaultJobProgressStep level = findLevel(this.currentStep.getParent(), source);
if (level == null) {
LOGGER.warn("Could not find any matching step level for source [{}]. Ignoring PopLevelProgressEvent.",
source.toString()); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
// Move to parent step
this.currentStep = level;
// Close the level
this.currentStep.finishLevel();
} } |
public class class_name {
public void combine(CRFClassifier<IN> crf, double weight) {
Timing timer = new Timing();
// Check the CRFClassifiers are compatible
if (!this.pad.equals(crf.pad)) {
throw new RuntimeException("Incompatible CRFClassifier: pad does not match");
}
if (this.windowSize != crf.windowSize) {
throw new RuntimeException("Incompatible CRFClassifier: windowSize does not match");
}
if (this.labelIndices.length != crf.labelIndices.length) {
// Should match since this should be same as the windowSize
throw new RuntimeException("Incompatible CRFClassifier: labelIndices length does not match");
}
this.classIndex.addAll(crf.classIndex.objectsList());
// Combine weights of the other classifier with this classifier,
// weighing the other classifier's weights by weight
// First merge the feature indicies
int oldNumFeatures1 = this.featureIndex.size();
int oldNumFeatures2 = crf.featureIndex.size();
int oldNumWeights1 = this.getNumWeights();
int oldNumWeights2 = crf.getNumWeights();
this.featureIndex.addAll(crf.featureIndex.objectsList());
this.knownLCWords.addAll(crf.knownLCWords);
assert (weights.length == oldNumFeatures1);
// Combine weights of this classifier with other classifier
for (int i = 0; i < labelIndices.length; i++) {
this.labelIndices[i].addAll(crf.labelIndices[i].objectsList());
}
System.err.println("Combining weights: will automatically match labelIndices");
combineWeights(crf, weight);
int numFeatures = featureIndex.size();
int numWeights = getNumWeights();
long elapsedMs = timer.stop();
System.err.println("numFeatures: orig1=" + oldNumFeatures1 + ", orig2=" + oldNumFeatures2 + ", combined="
+ numFeatures);
System.err
.println("numWeights: orig1=" + oldNumWeights1 + ", orig2=" + oldNumWeights2 + ", combined=" + numWeights);
System.err.println("Time to combine CRFClassifier: " + Timing.toSecondsString(elapsedMs) + " seconds");
} } | public class class_name {
public void combine(CRFClassifier<IN> crf, double weight) {
Timing timer = new Timing();
// Check the CRFClassifiers are compatible
if (!this.pad.equals(crf.pad)) {
throw new RuntimeException("Incompatible CRFClassifier: pad does not match");
}
if (this.windowSize != crf.windowSize) {
throw new RuntimeException("Incompatible CRFClassifier: windowSize does not match");
}
if (this.labelIndices.length != crf.labelIndices.length) {
// Should match since this should be same as the windowSize
throw new RuntimeException("Incompatible CRFClassifier: labelIndices length does not match");
}
this.classIndex.addAll(crf.classIndex.objectsList());
// Combine weights of the other classifier with this classifier,
// weighing the other classifier's weights by weight
// First merge the feature indicies
int oldNumFeatures1 = this.featureIndex.size();
int oldNumFeatures2 = crf.featureIndex.size();
int oldNumWeights1 = this.getNumWeights();
int oldNumWeights2 = crf.getNumWeights();
this.featureIndex.addAll(crf.featureIndex.objectsList());
this.knownLCWords.addAll(crf.knownLCWords);
assert (weights.length == oldNumFeatures1);
// Combine weights of this classifier with other classifier
for (int i = 0; i < labelIndices.length; i++) {
this.labelIndices[i].addAll(crf.labelIndices[i].objectsList());
// depends on control dependency: [for], data = [i]
}
System.err.println("Combining weights: will automatically match labelIndices");
combineWeights(crf, weight);
int numFeatures = featureIndex.size();
int numWeights = getNumWeights();
long elapsedMs = timer.stop();
System.err.println("numFeatures: orig1=" + oldNumFeatures1 + ", orig2=" + oldNumFeatures2 + ", combined="
+ numFeatures);
System.err
.println("numWeights: orig1=" + oldNumWeights1 + ", orig2=" + oldNumWeights2 + ", combined=" + numWeights);
System.err.println("Time to combine CRFClassifier: " + Timing.toSecondsString(elapsedMs) + " seconds");
} } |
public class class_name {
public void setLoadBalancerPorts(java.util.Collection<Integer> loadBalancerPorts) {
if (loadBalancerPorts == null) {
this.loadBalancerPorts = null;
return;
}
this.loadBalancerPorts = new com.amazonaws.internal.SdkInternalList<Integer>(loadBalancerPorts);
} } | public class class_name {
public void setLoadBalancerPorts(java.util.Collection<Integer> loadBalancerPorts) {
if (loadBalancerPorts == null) {
this.loadBalancerPorts = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.loadBalancerPorts = new com.amazonaws.internal.SdkInternalList<Integer>(loadBalancerPorts);
} } |
public class class_name {
public JobScheduleGetHeaders withLastModified(DateTime lastModified) {
if (lastModified == null) {
this.lastModified = null;
} else {
this.lastModified = new DateTimeRfc1123(lastModified);
}
return this;
} } | public class class_name {
public JobScheduleGetHeaders withLastModified(DateTime lastModified) {
if (lastModified == null) {
this.lastModified = null; // depends on control dependency: [if], data = [none]
} else {
this.lastModified = new DateTimeRfc1123(lastModified); // depends on control dependency: [if], data = [(lastModified]
}
return this;
} } |
public class class_name {
public boolean add(T element, Class<?> accessibleClass) {
boolean added = false;
while (accessibleClass != null && accessibleClass != this.baseClass) {
added |= this.addSingle(element, accessibleClass);
for (Class<?> interf : accessibleClass.getInterfaces()) {
this.addSingle(element, interf);
}
accessibleClass = accessibleClass.getSuperclass();
}
return added;
} } | public class class_name {
public boolean add(T element, Class<?> accessibleClass) {
boolean added = false;
while (accessibleClass != null && accessibleClass != this.baseClass) {
added |= this.addSingle(element, accessibleClass); // depends on control dependency: [while], data = [none]
for (Class<?> interf : accessibleClass.getInterfaces()) {
this.addSingle(element, interf); // depends on control dependency: [for], data = [interf]
}
accessibleClass = accessibleClass.getSuperclass(); // depends on control dependency: [while], data = [none]
}
return added;
} } |
public class class_name {
public void submitMetrics(MetricsRecord metricsRecord) {
List<PoolMetadata> poolMetadatas = getPoolMetadataList();
PoolFairnessCalculator.calculateFairness(poolMetadatas, metricsRecord);
for (SchedulerForType scheduler: schedulersForTypes.values()) {
scheduler.submitMetrics();
}
} } | public class class_name {
public void submitMetrics(MetricsRecord metricsRecord) {
List<PoolMetadata> poolMetadatas = getPoolMetadataList();
PoolFairnessCalculator.calculateFairness(poolMetadatas, metricsRecord);
for (SchedulerForType scheduler: schedulersForTypes.values()) {
scheduler.submitMetrics(); // depends on control dependency: [for], data = [scheduler]
}
} } |
public class class_name {
public boolean isSet(String propName) {
if (propName.equals("method")) {
return isSetMethod();
}
if (propName.equals("object")) {
return isSetObject();
}
if (propName.equals("attribute")) {
return isSetAttribute();
}
return false;
} } | public class class_name {
public boolean isSet(String propName) {
if (propName.equals("method")) {
return isSetMethod(); // depends on control dependency: [if], data = [none]
}
if (propName.equals("object")) {
return isSetObject(); // depends on control dependency: [if], data = [none]
}
if (propName.equals("attribute")) {
return isSetAttribute(); // depends on control dependency: [if], data = [none]
}
return false;
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.