code stringlengths 130 281k | code_dependency stringlengths 182 306k |
|---|---|
public class class_name {
public EClass getTLE() {
if (tleEClass == null) {
tleEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(320);
}
return tleEClass;
} } | public class class_name {
public EClass getTLE() {
if (tleEClass == null) {
tleEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(320); // depends on control dependency: [if], data = [none]
}
return tleEClass;
} } |
public class class_name {
public JcsegServer initFromGlobalConfig(JSONObject globalConfig)
throws CloneNotSupportedException, JcsegException
{
/*
* parse and initialize the server according to the global config
*/
if ( globalConfig.has("server_config") ) {
JSONObject serverSetting = globalConfig.getJSONObject("server_config");
if ( serverSetting.has("host") ) {
config.setHost(serverSetting.getString("host"));
}
if ( serverSetting.has("port") ) {
config.setPort(serverSetting.getInt("port"));
}
if ( serverSetting.has("charset") ) {
config.setCharset(serverSetting.getString("charset"));
}
if ( serverSetting.has("max_thread_pool_size") ) {
config.setMaxThreadPoolSize(serverSetting.getInt("max_thread_pool_size"));
}
if ( serverSetting.has("thread_idle_timeout") ) {
config.setThreadIdleTimeout(serverSetting.getInt("thread_idle_timeout"));
}
if ( serverSetting.has("http_output_buffer_size") ) {
config.setOutputBufferSize(serverSetting.getInt("http_output_buffer_size"));
}
if ( serverSetting.has("http_request_header_size") ) {
config.setRequestHeaderSize(serverSetting.getInt("http_request_header_size"));
}
if ( serverSetting.has("http_response_header_size") ) {
config.setResponseHeaderSize(serverSetting.getInt("http_connection_idle_timeout"));
}
}
//create a global JcsegTaskConfig and initialize from the global_setting
JcsegTaskConfig globalJcsegTaskConfig = new JcsegTaskConfig(false);
if ( globalConfig.has("jcseg_global_config") ) {
JSONObject globalSetting = globalConfig.getJSONObject("jcseg_global_config");
resetJcsegTaskConfig(globalJcsegTaskConfig, globalSetting);
}
/*
* create the dictionaries according to the definition of dict
* and we will make a copy of the globalSetting for dictionary load
*
* reset the max length to pass the dictionary words length limitation
*/
JcsegTaskConfig dictLoadConfig = globalJcsegTaskConfig.clone();
dictLoadConfig.setMaxLength(100);
if ( globalConfig.has("jcseg_dict") ) {
JSONObject dictSetting = globalConfig.getJSONObject("jcseg_dict");
String[] dictNames = JSONObject.getNames(dictSetting);
for ( String name : dictNames ) {
JSONObject dicJson = dictSetting.getJSONObject(name);
if ( ! dicJson.has("path") ) {
throw new JcsegException("Missing path for dict instance " + name);
}
String[] lexPath = null;
if ( ! dicJson.isNull("path") ) {
//process the lexPath
JSONArray path = dicJson.getJSONArray("path");
List<String> dicPath = new ArrayList<String>();
for ( int i = 0; i < path.length(); i++ ) {
String filePath = path.get(i).toString();
if ( filePath.indexOf("{jar.dir}") > -1 ) {
filePath = filePath.replace("{jar.dir}", Util.getJarHome(this));
}
dicPath.add(filePath);
}
lexPath = new String[dicPath.size()];
dicPath.toArray(lexPath);
dicPath.clear(); dicPath = null;
}
boolean loadpos = dicJson.has("loadpos")
? dicJson.getBoolean("loadpos") : true;
boolean loadpinyin = dicJson.has("loadpinyin")
? dicJson.getBoolean("loadpinyin") : true;
boolean loadsyn = dicJson.has("loadsyn")
? dicJson.getBoolean("loadsyn") : true;
boolean loadentity = dicJson.has("loadentity")
? dicJson.getBoolean("loadentity") : true;
boolean autoload = dicJson.has("autoload")
? dicJson.getBoolean("autoload") : false;
int polltime = dicJson.has("polltime")
? dicJson.getInt("polltime") : 300;
dictLoadConfig.setLoadCJKPinyin(loadpinyin);
dictLoadConfig.setLoadCJKPos(loadpos);
dictLoadConfig.setLoadCJKSyn(loadsyn);
dictLoadConfig.setLoadEntity(loadentity);
dictLoadConfig.setAutoload(autoload);
dictLoadConfig.setPollTime(polltime);
dictLoadConfig.setLexiconPath(lexPath);
//create and register the global dictionary resource
ADictionary dic = DictionaryFactory.createDefaultDictionary(dictLoadConfig);
resourcePool.addDict(name, dic);
}
}
dictLoadConfig = null;
/*
* create the JcsegTaskConfig instance according to the definition config
*/
if ( globalConfig.has("jcseg_config") ) {
JSONObject configSetting = globalConfig.getJSONObject("jcseg_config");
String[] configNames = JSONObject.getNames(configSetting);
for ( String name : configNames ) {
JSONObject configJson = configSetting.getJSONObject(name);
//clone the globalJcsegTaskConfig
//and do the override working by local defination
JcsegTaskConfig config = globalJcsegTaskConfig.clone();
if ( configJson.length() > 0 ) {
resetJcsegTaskConfig(config, configJson);
}
//register the global resource
resourcePool.addConfig(name, config);
}
}
/*
* create the tokenizer instance according the definition of tokenizer
*/
if ( globalConfig.has("jcseg_tokenizer") ) {
JSONObject tokenizerSetting = globalConfig.getJSONObject("jcseg_tokenizer");
String[] tokenizerNames = JSONObject.getNames(tokenizerSetting);
for ( String name : tokenizerNames ) {
JSONObject tokenizerJson = tokenizerSetting.getJSONObject(name);
int algorithm = tokenizerJson.has("algorithm")
? tokenizerJson.getInt("algorithm") : JcsegTaskConfig.COMPLEX_MODE;
if ( ! tokenizerJson.has("dict") ) {
throw new JcsegException("Missing dict setting for tokenizer " + name);
}
if ( ! tokenizerJson.has("config") ) {
throw new JcsegException("Missing config setting for tokenizer " + name);
}
ADictionary dic = resourcePool.getDict(tokenizerJson.getString("dict"));
JcsegTaskConfig config = resourcePool.getConfig(tokenizerJson.getString("config"));
if ( dic == null ) {
throw new JcsegException("Unknow dict instance "
+ tokenizerJson.getString("dict") + " for tokenizer " + name);
}
if ( config == null ) {
throw new JcsegException("Unknow config instance "
+ tokenizerJson.getString("config") + " for tokenizer " + name);
}
resourcePool.addTokenizerEntry(name, new JcsegTokenizerEntry(algorithm, config, dic));
}
}
//now, initialize the server
init();
return this;
} } | public class class_name {
public JcsegServer initFromGlobalConfig(JSONObject globalConfig)
throws CloneNotSupportedException, JcsegException
{
/*
* parse and initialize the server according to the global config
*/
if ( globalConfig.has("server_config") ) {
JSONObject serverSetting = globalConfig.getJSONObject("server_config");
if ( serverSetting.has("host") ) {
config.setHost(serverSetting.getString("host")); // depends on control dependency: [if], data = [none]
}
if ( serverSetting.has("port") ) {
config.setPort(serverSetting.getInt("port")); // depends on control dependency: [if], data = [none]
}
if ( serverSetting.has("charset") ) {
config.setCharset(serverSetting.getString("charset")); // depends on control dependency: [if], data = [none]
}
if ( serverSetting.has("max_thread_pool_size") ) {
config.setMaxThreadPoolSize(serverSetting.getInt("max_thread_pool_size")); // depends on control dependency: [if], data = [none]
}
if ( serverSetting.has("thread_idle_timeout") ) {
config.setThreadIdleTimeout(serverSetting.getInt("thread_idle_timeout")); // depends on control dependency: [if], data = [none]
}
if ( serverSetting.has("http_output_buffer_size") ) {
config.setOutputBufferSize(serverSetting.getInt("http_output_buffer_size")); // depends on control dependency: [if], data = [none]
}
if ( serverSetting.has("http_request_header_size") ) {
config.setRequestHeaderSize(serverSetting.getInt("http_request_header_size")); // depends on control dependency: [if], data = [none]
}
if ( serverSetting.has("http_response_header_size") ) {
config.setResponseHeaderSize(serverSetting.getInt("http_connection_idle_timeout")); // depends on control dependency: [if], data = [none]
}
}
//create a global JcsegTaskConfig and initialize from the global_setting
JcsegTaskConfig globalJcsegTaskConfig = new JcsegTaskConfig(false);
if ( globalConfig.has("jcseg_global_config") ) {
JSONObject globalSetting = globalConfig.getJSONObject("jcseg_global_config");
resetJcsegTaskConfig(globalJcsegTaskConfig, globalSetting);
}
/*
* create the dictionaries according to the definition of dict
* and we will make a copy of the globalSetting for dictionary load
*
* reset the max length to pass the dictionary words length limitation
*/
JcsegTaskConfig dictLoadConfig = globalJcsegTaskConfig.clone();
dictLoadConfig.setMaxLength(100);
if ( globalConfig.has("jcseg_dict") ) {
JSONObject dictSetting = globalConfig.getJSONObject("jcseg_dict");
String[] dictNames = JSONObject.getNames(dictSetting);
for ( String name : dictNames ) {
JSONObject dicJson = dictSetting.getJSONObject(name);
if ( ! dicJson.has("path") ) {
throw new JcsegException("Missing path for dict instance " + name);
}
String[] lexPath = null;
if ( ! dicJson.isNull("path") ) {
//process the lexPath
JSONArray path = dicJson.getJSONArray("path");
List<String> dicPath = new ArrayList<String>();
for ( int i = 0; i < path.length(); i++ ) {
String filePath = path.get(i).toString();
if ( filePath.indexOf("{jar.dir}") > -1 ) {
filePath = filePath.replace("{jar.dir}", Util.getJarHome(this)); // depends on control dependency: [if], data = [none]
}
dicPath.add(filePath); // depends on control dependency: [for], data = [none]
}
lexPath = new String[dicPath.size()]; // depends on control dependency: [if], data = [none]
dicPath.toArray(lexPath); // depends on control dependency: [if], data = [none]
dicPath.clear(); dicPath = null; // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
}
boolean loadpos = dicJson.has("loadpos")
? dicJson.getBoolean("loadpos") : true;
boolean loadpinyin = dicJson.has("loadpinyin")
? dicJson.getBoolean("loadpinyin") : true;
boolean loadsyn = dicJson.has("loadsyn")
? dicJson.getBoolean("loadsyn") : true;
boolean loadentity = dicJson.has("loadentity")
? dicJson.getBoolean("loadentity") : true;
boolean autoload = dicJson.has("autoload")
? dicJson.getBoolean("autoload") : false;
int polltime = dicJson.has("polltime")
? dicJson.getInt("polltime") : 300;
dictLoadConfig.setLoadCJKPinyin(loadpinyin); // depends on control dependency: [for], data = [none]
dictLoadConfig.setLoadCJKPos(loadpos); // depends on control dependency: [for], data = [none]
dictLoadConfig.setLoadCJKSyn(loadsyn); // depends on control dependency: [for], data = [none]
dictLoadConfig.setLoadEntity(loadentity); // depends on control dependency: [for], data = [none]
dictLoadConfig.setAutoload(autoload); // depends on control dependency: [for], data = [none]
dictLoadConfig.setPollTime(polltime); // depends on control dependency: [for], data = [none]
dictLoadConfig.setLexiconPath(lexPath); // depends on control dependency: [for], data = [none]
//create and register the global dictionary resource
ADictionary dic = DictionaryFactory.createDefaultDictionary(dictLoadConfig);
resourcePool.addDict(name, dic); // depends on control dependency: [for], data = [name]
}
}
dictLoadConfig = null;
/*
* create the JcsegTaskConfig instance according to the definition config
*/
if ( globalConfig.has("jcseg_config") ) {
JSONObject configSetting = globalConfig.getJSONObject("jcseg_config");
String[] configNames = JSONObject.getNames(configSetting);
for ( String name : configNames ) {
JSONObject configJson = configSetting.getJSONObject(name);
//clone the globalJcsegTaskConfig
//and do the override working by local defination
JcsegTaskConfig config = globalJcsegTaskConfig.clone();
if ( configJson.length() > 0 ) {
resetJcsegTaskConfig(config, configJson); // depends on control dependency: [if], data = [none]
}
//register the global resource
resourcePool.addConfig(name, config); // depends on control dependency: [for], data = [name]
}
}
/*
* create the tokenizer instance according the definition of tokenizer
*/
if ( globalConfig.has("jcseg_tokenizer") ) {
JSONObject tokenizerSetting = globalConfig.getJSONObject("jcseg_tokenizer");
String[] tokenizerNames = JSONObject.getNames(tokenizerSetting);
for ( String name : tokenizerNames ) {
JSONObject tokenizerJson = tokenizerSetting.getJSONObject(name);
int algorithm = tokenizerJson.has("algorithm")
? tokenizerJson.getInt("algorithm") : JcsegTaskConfig.COMPLEX_MODE;
if ( ! tokenizerJson.has("dict") ) {
throw new JcsegException("Missing dict setting for tokenizer " + name);
}
if ( ! tokenizerJson.has("config") ) {
throw new JcsegException("Missing config setting for tokenizer " + name);
}
ADictionary dic = resourcePool.getDict(tokenizerJson.getString("dict"));
JcsegTaskConfig config = resourcePool.getConfig(tokenizerJson.getString("config"));
if ( dic == null ) {
throw new JcsegException("Unknow dict instance "
+ tokenizerJson.getString("dict") + " for tokenizer " + name);
}
if ( config == null ) {
throw new JcsegException("Unknow config instance "
+ tokenizerJson.getString("config") + " for tokenizer " + name);
}
resourcePool.addTokenizerEntry(name, new JcsegTokenizerEntry(algorithm, config, dic)); // depends on control dependency: [for], data = [name]
}
}
//now, initialize the server
init();
return this;
} } |
public class class_name {
public PointList copy(int from, int end) {
if (from > end)
throw new IllegalArgumentException("from must be smaller or equal to end");
if (from < 0 || end > getSize())
throw new IllegalArgumentException("Illegal interval: " + from + ", " + end + ", size:" + getSize());
PointList thisPL = this;
if (this instanceof ShallowImmutablePointList) {
ShallowImmutablePointList spl = (ShallowImmutablePointList) this;
thisPL = spl.wrappedPointList;
from = spl.fromOffset + from;
end = spl.fromOffset + end;
}
int len = end - from;
PointList copyPL = new PointList(len, is3D());
copyPL.size = len;
copyPL.isImmutable = isImmutable();
System.arraycopy(thisPL.latitudes, from, copyPL.latitudes, 0, len);
System.arraycopy(thisPL.longitudes, from, copyPL.longitudes, 0, len);
if (is3D())
System.arraycopy(thisPL.elevations, from, copyPL.elevations, 0, len);
return copyPL;
} } | public class class_name {
public PointList copy(int from, int end) {
if (from > end)
throw new IllegalArgumentException("from must be smaller or equal to end");
if (from < 0 || end > getSize())
throw new IllegalArgumentException("Illegal interval: " + from + ", " + end + ", size:" + getSize());
PointList thisPL = this;
if (this instanceof ShallowImmutablePointList) {
ShallowImmutablePointList spl = (ShallowImmutablePointList) this;
thisPL = spl.wrappedPointList; // depends on control dependency: [if], data = [none]
from = spl.fromOffset + from; // depends on control dependency: [if], data = [none]
end = spl.fromOffset + end; // depends on control dependency: [if], data = [none]
}
int len = end - from;
PointList copyPL = new PointList(len, is3D());
copyPL.size = len;
copyPL.isImmutable = isImmutable();
System.arraycopy(thisPL.latitudes, from, copyPL.latitudes, 0, len);
System.arraycopy(thisPL.longitudes, from, copyPL.longitudes, 0, len);
if (is3D())
System.arraycopy(thisPL.elevations, from, copyPL.elevations, 0, len);
return copyPL;
} } |
public class class_name {
private static boolean isNameCase(String str) {
if (str.length() < 2) {
return false;
}
if (!(Character.isUpperCase(str.charAt(0)) || Character.isTitleCase(str.charAt(0)))) {
return false;
}
for (int i = 1; i < str.length(); i++) {
if (Character.isUpperCase(str.charAt(i))) {
return false;
}
}
return true;
} } | public class class_name {
private static boolean isNameCase(String str) {
if (str.length() < 2) {
return false;
// depends on control dependency: [if], data = [none]
}
if (!(Character.isUpperCase(str.charAt(0)) || Character.isTitleCase(str.charAt(0)))) {
return false;
// depends on control dependency: [if], data = [none]
}
for (int i = 1; i < str.length(); i++) {
if (Character.isUpperCase(str.charAt(i))) {
return false;
// depends on control dependency: [if], data = [none]
}
}
return true;
} } |
public class class_name {
public EClass getEAG() {
if (eagEClass == null) {
eagEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(233);
}
return eagEClass;
} } | public class class_name {
public EClass getEAG() {
if (eagEClass == null) {
eagEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(233); // depends on control dependency: [if], data = [none]
}
return eagEClass;
} } |
public class class_name {
public synchronized void start(boolean android, boolean secure) {
isAndroid = android;
mIsSecure = secure;
// Cancel any thread attempting to make a connection
if (mConnectThread != null) {mConnectThread.cancel(); mConnectThread = null;}
// Cancel any thread currently running a connection
if (mConnectedThread != null) {mConnectedThread.cancel(); mConnectedThread = null;}
setState(BluetoothService.STATE_LISTEN);
// Start the thread to listen on a BluetoothServerSocket
if (mSecureAcceptThread == null) {
mSecureAcceptThread = new AcceptThread(isAndroid, mIsSecure);
mSecureAcceptThread.start();
}
} } | public class class_name {
public synchronized void start(boolean android, boolean secure) {
isAndroid = android;
mIsSecure = secure;
// Cancel any thread attempting to make a connection
if (mConnectThread != null) {mConnectThread.cancel(); mConnectThread = null;} // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
// Cancel any thread currently running a connection
if (mConnectedThread != null) {mConnectedThread.cancel(); mConnectedThread = null;} // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
setState(BluetoothService.STATE_LISTEN);
// Start the thread to listen on a BluetoothServerSocket
if (mSecureAcceptThread == null) {
mSecureAcceptThread = new AcceptThread(isAndroid, mIsSecure); // depends on control dependency: [if], data = [none]
mSecureAcceptThread.start(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void marshall(Http http, ProtocolMarshaller protocolMarshaller) {
if (http == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(http.getHttpURL(), HTTPURL_BINDING);
protocolMarshaller.marshall(http.getHttpStatus(), HTTPSTATUS_BINDING);
protocolMarshaller.marshall(http.getHttpMethod(), HTTPMETHOD_BINDING);
protocolMarshaller.marshall(http.getUserAgent(), USERAGENT_BINDING);
protocolMarshaller.marshall(http.getClientIp(), CLIENTIP_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(Http http, ProtocolMarshaller protocolMarshaller) {
if (http == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(http.getHttpURL(), HTTPURL_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(http.getHttpStatus(), HTTPSTATUS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(http.getHttpMethod(), HTTPMETHOD_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(http.getUserAgent(), USERAGENT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(http.getClientIp(), CLIENTIP_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private void sawMethodOpcode(int seen) {
boolean isSyncCollection = false;
try {
stack.mergeJumps(this);
isSyncCollection = isSyncCollectionCreation(seen);
switch (seen) {
case Const.INVOKEVIRTUAL:
case Const.INVOKEINTERFACE:
String methodName = getNameConstantOperand();
if (modifyingMethods.contains(methodName)) {
String signature = getSigConstantOperand();
int parmCount = SignatureUtils.getNumParameters(signature);
if (stack.getStackDepth() > parmCount) {
OpcodeStack.Item item = stack.getStackItem(parmCount);
XField field = item.getXField();
if (field != null) {
collectionFields.remove(field.getName());
} else {
int reg = item.getRegisterNumber();
if (reg >= 0) {
Integer register = Integer.valueOf(reg);
String fName = aliases.get(register);
if (fName != null) {
collectionFields.remove(fName);
aliases.remove(register);
}
}
}
}
}
removeCollectionParameters();
break;
case Const.INVOKESTATIC:
removeCollectionParameters();
break;
case Const.ARETURN:
if (stack.getStackDepth() > 0) {
OpcodeStack.Item item = stack.getStackItem(0);
XField field = item.getXField();
if (field != null) {
collectionFields.remove(field.getName());
}
}
break;
case Const.PUTFIELD:
case Const.PUTSTATIC:
String fieldName = getNameConstantOperand();
collectionFields.remove(fieldName);
break;
case Const.GOTO:
case Const.GOTO_W:
if (stack.getStackDepth() > 0) {
OpcodeStack.Item item = stack.getStackItem(0);
XField field = item.getXField();
if (field != null) {
collectionFields.remove(field.getName());
}
}
break;
default:
break;
}
} finally {
TernaryPatcher.pre(stack, seen);
stack.sawOpcode(this, seen);
TernaryPatcher.post(stack, seen);
if (isSyncCollection && (stack.getStackDepth() > 0)) {
OpcodeStack.Item item = stack.getStackItem(0);
item.setUserValue(Boolean.TRUE);
}
}
} } | public class class_name {
private void sawMethodOpcode(int seen) {
boolean isSyncCollection = false;
try {
stack.mergeJumps(this); // depends on control dependency: [try], data = [none]
isSyncCollection = isSyncCollectionCreation(seen); // depends on control dependency: [try], data = [none]
switch (seen) {
case Const.INVOKEVIRTUAL:
case Const.INVOKEINTERFACE:
String methodName = getNameConstantOperand();
if (modifyingMethods.contains(methodName)) {
String signature = getSigConstantOperand();
int parmCount = SignatureUtils.getNumParameters(signature);
if (stack.getStackDepth() > parmCount) {
OpcodeStack.Item item = stack.getStackItem(parmCount);
XField field = item.getXField();
if (field != null) {
collectionFields.remove(field.getName()); // depends on control dependency: [if], data = [(field]
} else {
int reg = item.getRegisterNumber();
if (reg >= 0) {
Integer register = Integer.valueOf(reg);
String fName = aliases.get(register);
if (fName != null) {
collectionFields.remove(fName); // depends on control dependency: [if], data = [(fName]
aliases.remove(register); // depends on control dependency: [if], data = [none]
}
}
}
}
}
removeCollectionParameters();
break;
case Const.INVOKESTATIC:
removeCollectionParameters();
break;
case Const.ARETURN:
if (stack.getStackDepth() > 0) {
OpcodeStack.Item item = stack.getStackItem(0);
XField field = item.getXField();
if (field != null) {
collectionFields.remove(field.getName()); // depends on control dependency: [if], data = [(field]
}
}
break;
case Const.PUTFIELD:
case Const.PUTSTATIC:
String fieldName = getNameConstantOperand();
collectionFields.remove(fieldName);
break;
case Const.GOTO:
case Const.GOTO_W:
if (stack.getStackDepth() > 0) {
OpcodeStack.Item item = stack.getStackItem(0);
XField field = item.getXField();
if (field != null) {
collectionFields.remove(field.getName()); // depends on control dependency: [if], data = [(field]
}
}
break;
default:
break;
}
} finally {
TernaryPatcher.pre(stack, seen);
stack.sawOpcode(this, seen);
TernaryPatcher.post(stack, seen);
if (isSyncCollection && (stack.getStackDepth() > 0)) {
OpcodeStack.Item item = stack.getStackItem(0);
item.setUserValue(Boolean.TRUE); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
protected void updateApiVersion(HasMetadata hasMetadata) {
String version = getApiVersion();
if (hasMetadata != null && version != null && version.length() > 0) {
String current = hasMetadata.getApiVersion();
// lets overwrite the api version if its currently missing, the resource uses an API Group with '/'
// or we have the default of 'v1' when using an API group version like 'build.openshift.io/v1'
if (current == null || "v1".equals(current) || current.indexOf('/') < 0 && version.indexOf('/') > 0) {
hasMetadata.setApiVersion(version);
}
}
} } | public class class_name {
protected void updateApiVersion(HasMetadata hasMetadata) {
String version = getApiVersion();
if (hasMetadata != null && version != null && version.length() > 0) {
String current = hasMetadata.getApiVersion();
// lets overwrite the api version if its currently missing, the resource uses an API Group with '/'
// or we have the default of 'v1' when using an API group version like 'build.openshift.io/v1'
if (current == null || "v1".equals(current) || current.indexOf('/') < 0 && version.indexOf('/') > 0) {
hasMetadata.setApiVersion(version); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
DirContextAdapter constructAdapterFromName(Attributes attrs, Name name, String nameInNamespace) {
String nameString;
String referralUrl = "";
if (name instanceof CompositeName) {
// Which it most certainly will be, and therein lies the
// problem. CompositeName.toString() completely screws up the
// formatting
// in some cases, particularly when backslashes are involved.
nameString = LdapUtils
.convertCompositeNameToString((CompositeName) name);
}
else {
LOG
.warn("Expecting a CompositeName as input to getObjectInstance but received a '"
+ name.getClass().toString()
+ "' - using toString and proceeding with undefined results");
nameString = name.toString();
}
if (nameString.startsWith(LDAP_PROTOCOL_PREFIX) || nameString.startsWith(LDAPS_PROTOCOL_PREFIX)) {
if (LOG.isDebugEnabled()) {
LOG.debug("Received name '" + nameString + "' contains protocol delimiter; indicating a referral."
+ "Stripping protocol and address info to enable construction of a proper LdapName");
}
try {
URI url = new URI(nameString);
String pathString = url.getPath();
referralUrl = nameString.substring(0, nameString.length() - pathString.length());
if (StringUtils.hasLength(pathString) && pathString.startsWith("/")) {
// We don't want any slash in the beginning of the
// Distinguished Name.
pathString = pathString.substring(1);
}
nameString = pathString;
}
catch (URISyntaxException e) {
throw new IllegalArgumentException(
"Supplied name starts with protocol prefix indicating a referral,"
+ " but is not possible to parse to an URI",
e);
}
if (LOG.isDebugEnabled()) {
LOG.debug("Resulting name after removal of referral information: '" + nameString + "'");
}
}
DirContextAdapter dirContextAdapter = new DirContextAdapter(attrs, LdapUtils.newLdapName(nameString),
LdapUtils.newLdapName(nameInNamespace), referralUrl);
dirContextAdapter.setUpdateMode(true);
return dirContextAdapter;
} } | public class class_name {
DirContextAdapter constructAdapterFromName(Attributes attrs, Name name, String nameInNamespace) {
String nameString;
String referralUrl = "";
if (name instanceof CompositeName) {
// Which it most certainly will be, and therein lies the
// problem. CompositeName.toString() completely screws up the
// formatting
// in some cases, particularly when backslashes are involved.
nameString = LdapUtils
.convertCompositeNameToString((CompositeName) name); // depends on control dependency: [if], data = [none]
}
else {
LOG
.warn("Expecting a CompositeName as input to getObjectInstance but received a '"
+ name.getClass().toString()
+ "' - using toString and proceeding with undefined results"); // depends on control dependency: [if], data = [none]
nameString = name.toString(); // depends on control dependency: [if], data = [none]
}
if (nameString.startsWith(LDAP_PROTOCOL_PREFIX) || nameString.startsWith(LDAPS_PROTOCOL_PREFIX)) {
if (LOG.isDebugEnabled()) {
LOG.debug("Received name '" + nameString + "' contains protocol delimiter; indicating a referral." // depends on control dependency: [if], data = [none]
+ "Stripping protocol and address info to enable construction of a proper LdapName"); // depends on control dependency: [if], data = [none]
}
try {
URI url = new URI(nameString);
String pathString = url.getPath();
referralUrl = nameString.substring(0, nameString.length() - pathString.length()); // depends on control dependency: [try], data = [none]
if (StringUtils.hasLength(pathString) && pathString.startsWith("/")) {
// We don't want any slash in the beginning of the
// Distinguished Name.
pathString = pathString.substring(1); // depends on control dependency: [if], data = [none]
}
nameString = pathString; // depends on control dependency: [try], data = [none]
}
catch (URISyntaxException e) {
throw new IllegalArgumentException(
"Supplied name starts with protocol prefix indicating a referral,"
+ " but is not possible to parse to an URI",
e);
} // depends on control dependency: [catch], data = [none]
if (LOG.isDebugEnabled()) {
LOG.debug("Resulting name after removal of referral information: '" + nameString + "'"); // depends on control dependency: [if], data = [none]
}
}
DirContextAdapter dirContextAdapter = new DirContextAdapter(attrs, LdapUtils.newLdapName(nameString),
LdapUtils.newLdapName(nameInNamespace), referralUrl);
dirContextAdapter.setUpdateMode(true);
return dirContextAdapter;
} } |
public class class_name {
public DescribeFleetCapacityResult withFleetCapacity(FleetCapacity... fleetCapacity) {
if (this.fleetCapacity == null) {
setFleetCapacity(new java.util.ArrayList<FleetCapacity>(fleetCapacity.length));
}
for (FleetCapacity ele : fleetCapacity) {
this.fleetCapacity.add(ele);
}
return this;
} } | public class class_name {
public DescribeFleetCapacityResult withFleetCapacity(FleetCapacity... fleetCapacity) {
if (this.fleetCapacity == null) {
setFleetCapacity(new java.util.ArrayList<FleetCapacity>(fleetCapacity.length)); // depends on control dependency: [if], data = [none]
}
for (FleetCapacity ele : fleetCapacity) {
this.fleetCapacity.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
static Method getMethodUnchecked(
Class<?> type, String methodName, Class<?>... parameterTypes)
{
try
{
return type.getMethod(methodName, parameterTypes);
}
catch (SecurityException e)
{
throw new IllegalArgumentException(e);
}
catch (NoSuchMethodException e)
{
throw new IllegalArgumentException(e);
}
} } | public class class_name {
static Method getMethodUnchecked(
Class<?> type, String methodName, Class<?>... parameterTypes)
{
try
{
return type.getMethod(methodName, parameterTypes);
// depends on control dependency: [try], data = [none]
}
catch (SecurityException e)
{
throw new IllegalArgumentException(e);
}
// depends on control dependency: [catch], data = [none]
catch (NoSuchMethodException e)
{
throw new IllegalArgumentException(e);
}
// depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public DBCluster withDBClusterMembers(DBClusterMember... dBClusterMembers) {
if (this.dBClusterMembers == null) {
setDBClusterMembers(new com.amazonaws.internal.SdkInternalList<DBClusterMember>(dBClusterMembers.length));
}
for (DBClusterMember ele : dBClusterMembers) {
this.dBClusterMembers.add(ele);
}
return this;
} } | public class class_name {
public DBCluster withDBClusterMembers(DBClusterMember... dBClusterMembers) {
if (this.dBClusterMembers == null) {
setDBClusterMembers(new com.amazonaws.internal.SdkInternalList<DBClusterMember>(dBClusterMembers.length)); // depends on control dependency: [if], data = [none]
}
for (DBClusterMember ele : dBClusterMembers) {
this.dBClusterMembers.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
@Override
public void writeBytes(byte[] bytes, int start, int len) throws IOException {
for (int i = start; i < start + len; ++i) {
if (bytes[i] == 0x00) {
out.write(0);
out.write(1);
} else {
out.write((int) bytes[i]);
}
}
out.write(0);
out.write(0);
} } | public class class_name {
@Override
public void writeBytes(byte[] bytes, int start, int len) throws IOException {
for (int i = start; i < start + len; ++i) {
if (bytes[i] == 0x00) {
out.write(0); // depends on control dependency: [if], data = [none]
out.write(1); // depends on control dependency: [if], data = [none]
} else {
out.write((int) bytes[i]); // depends on control dependency: [if], data = [none]
}
}
out.write(0);
out.write(0);
} } |
public class class_name {
@Override
public void start() {
super.start();
logger.finer("-> start method");
try {
startSimulation();
} catch (ShanksException e) {
logger.severe("ShanksException: " + e.getMessage());
e.printStackTrace();
}
} } | public class class_name {
@Override
public void start() {
super.start();
logger.finer("-> start method");
try {
startSimulation(); // depends on control dependency: [try], data = [none]
} catch (ShanksException e) {
logger.severe("ShanksException: " + e.getMessage());
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private Matrix calculateEdgeSimMatrix(
final List<Edge> edgeList, final SparseMatrix sm) {
final int numEdges = edgeList.size();
final Matrix edgeSimMatrix =
new SparseSymmetricMatrix(
new SparseHashMatrix(numEdges, numEdges));
Object key = workQueue.registerTaskGroup(numEdges);
for (int i = 0; i < numEdges; ++i) {
final int row = i;
workQueue.add(key, new Runnable() {
public void run() {
for (int j = row; j < numEdges; ++j) {
Edge e1 = edgeList.get(row);
Edge e2 = edgeList.get(j);
double sim = getEdgeSimilarity(sm, e1, e2);
if (sim > 0) {
// The symmetric matrix handles the (j,i) case
edgeSimMatrix.set(row, j, sim);
}
}
}
});
}
workQueue.await(key);
return edgeSimMatrix;
} } | public class class_name {
private Matrix calculateEdgeSimMatrix(
final List<Edge> edgeList, final SparseMatrix sm) {
final int numEdges = edgeList.size();
final Matrix edgeSimMatrix =
new SparseSymmetricMatrix(
new SparseHashMatrix(numEdges, numEdges));
Object key = workQueue.registerTaskGroup(numEdges);
for (int i = 0; i < numEdges; ++i) {
final int row = i;
workQueue.add(key, new Runnable() {
public void run() {
for (int j = row; j < numEdges; ++j) {
Edge e1 = edgeList.get(row);
Edge e2 = edgeList.get(j);
double sim = getEdgeSimilarity(sm, e1, e2);
if (sim > 0) {
// The symmetric matrix handles the (j,i) case
edgeSimMatrix.set(row, j, sim); // depends on control dependency: [if], data = [none]
}
}
}
}); // depends on control dependency: [for], data = [none]
}
workQueue.await(key);
return edgeSimMatrix;
} } |
public class class_name {
public boolean runCopyTrans(final String zanataId, boolean waitForFinish) {
log.debug("Running Zanata CopyTrans for " + zanataId);
try {
final CopyTransResource copyTransResource = proxyFactory.getCopyTransResource();
copyTransResource.startCopyTrans(details.getProject(), details.getVersion(), zanataId);
performZanataRESTCallWaiting();
if (waitForFinish) {
while (!isCopyTransCompleteForSourceDocument(copyTransResource, zanataId)) {
// Sleep for 3/4 of a second
Thread.sleep(750);
}
}
return true;
} catch (Exception e) {
log.error("Failed to run copyTrans for " + zanataId, e);
} finally {
performZanataRESTCallWaiting();
}
return false;
} } | public class class_name {
public boolean runCopyTrans(final String zanataId, boolean waitForFinish) {
log.debug("Running Zanata CopyTrans for " + zanataId);
try {
final CopyTransResource copyTransResource = proxyFactory.getCopyTransResource();
copyTransResource.startCopyTrans(details.getProject(), details.getVersion(), zanataId); // depends on control dependency: [try], data = [none]
performZanataRESTCallWaiting(); // depends on control dependency: [try], data = [none]
if (waitForFinish) {
while (!isCopyTransCompleteForSourceDocument(copyTransResource, zanataId)) {
// Sleep for 3/4 of a second
Thread.sleep(750); // depends on control dependency: [while], data = [none]
}
}
return true; // depends on control dependency: [try], data = [none]
} catch (Exception e) {
log.error("Failed to run copyTrans for " + zanataId, e);
} finally { // depends on control dependency: [catch], data = [none]
performZanataRESTCallWaiting();
}
return false;
} } |
public class class_name {
public String generateCodeForTable(final TableModel table, final boolean enableVisualizationSupport) {
final ST template = this.stGroup.getInstanceOf("tableClass");
LOG.debug("Filling template...");
template.add("table", table);
LOG.debug("Package is {} | Class name is {}", table.getPackageName(), table.getClassName());
template.add("colAndForeignKeys", table.hasColumnsAndForeignKeys());
template.add("firstRowComma", (!table.getNullableForeignKeys().isEmpty() || table.hasColumnsAndForeignKeys()) && !table.getNotNullForeignKeys().isEmpty());
template.add("secondRowComma", table.hasColumnsAndForeignKeys() && !table.getNullableForeignKeys().isEmpty());
try {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(baos);
oos.writeObject(table);
oos.close();
String serializedData = Base64.getEncoder().encodeToString(baos.toByteArray());
template.add("serializedTableModelString", serializedData);
} catch (IOException e) {
LOG.error("Could not serialize table model. Model will not be included in the file", e);
}
template.add("enableVisualizationSupport", enableVisualizationSupport);
LOG.debug("Rendering template...");
return template.render();
} } | public class class_name {
public String generateCodeForTable(final TableModel table, final boolean enableVisualizationSupport) {
final ST template = this.stGroup.getInstanceOf("tableClass");
LOG.debug("Filling template...");
template.add("table", table);
LOG.debug("Package is {} | Class name is {}", table.getPackageName(), table.getClassName());
template.add("colAndForeignKeys", table.hasColumnsAndForeignKeys());
template.add("firstRowComma", (!table.getNullableForeignKeys().isEmpty() || table.hasColumnsAndForeignKeys()) && !table.getNotNullForeignKeys().isEmpty());
template.add("secondRowComma", table.hasColumnsAndForeignKeys() && !table.getNullableForeignKeys().isEmpty());
try {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(baos);
oos.writeObject(table);
// depends on control dependency: [try], data = [none]
oos.close();
// depends on control dependency: [try], data = [none]
String serializedData = Base64.getEncoder().encodeToString(baos.toByteArray());
template.add("serializedTableModelString", serializedData);
// depends on control dependency: [try], data = [none]
} catch (IOException e) {
LOG.error("Could not serialize table model. Model will not be included in the file", e);
}
// depends on control dependency: [catch], data = [none]
template.add("enableVisualizationSupport", enableVisualizationSupport);
LOG.debug("Rendering template...");
return template.render();
} } |
public class class_name {
public void merge(final ByteRange range) {
// always use copies of objects
ByteRange newRange = new ByteRange(range);
logger.debug( this.toFtpCmdArgument() + " + " + newRange.toString());
int oldSize = vector.size();
int index = 0;
final int NOT_YET = -1;
int merged = NOT_YET;
if (oldSize == 0) {
vector.add(newRange);
return;
}
for (int i = 0; i < oldSize; i++) {
int result = newRange.merge((ByteRange)vector.elementAt(index));
switch (result) {
case ByteRange.THIS_ABOVE :
//last_below = index;
index ++;
break;
case ByteRange.ADJACENT :
case ByteRange.THIS_SUBSET :
case ByteRange.THIS_SUPERSET :
if (merged == NOT_YET) {
vector.remove(index);
vector.add(index, newRange);
merged = index;
index++;
} else {
vector.remove(index);
//do not augment index
}
break;
case ByteRange.THIS_BELOW :
if (merged == NOT_YET) {
vector.add(index, newRange);
}
return;
}
}
if (merged == NOT_YET) {
vector.add(newRange);
}
} } | public class class_name {
public void merge(final ByteRange range) {
// always use copies of objects
ByteRange newRange = new ByteRange(range);
logger.debug( this.toFtpCmdArgument() + " + " + newRange.toString());
int oldSize = vector.size();
int index = 0;
final int NOT_YET = -1;
int merged = NOT_YET;
if (oldSize == 0) {
vector.add(newRange); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
for (int i = 0; i < oldSize; i++) {
int result = newRange.merge((ByteRange)vector.elementAt(index));
switch (result) {
case ByteRange.THIS_ABOVE :
//last_below = index;
index ++;
break;
case ByteRange.ADJACENT :
case ByteRange.THIS_SUBSET :
case ByteRange.THIS_SUPERSET :
if (merged == NOT_YET) {
vector.remove(index); // depends on control dependency: [if], data = [none]
vector.add(index, newRange); // depends on control dependency: [if], data = [none]
merged = index; // depends on control dependency: [if], data = [none]
index++; // depends on control dependency: [if], data = [none]
} else {
vector.remove(index); // depends on control dependency: [if], data = [none]
//do not augment index
}
break;
case ByteRange.THIS_BELOW :
if (merged == NOT_YET) {
vector.add(index, newRange); // depends on control dependency: [if], data = [none]
}
return;
}
}
if (merged == NOT_YET) {
vector.add(newRange); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void marshall(DeletePortfolioRequest deletePortfolioRequest, ProtocolMarshaller protocolMarshaller) {
if (deletePortfolioRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deletePortfolioRequest.getAcceptLanguage(), ACCEPTLANGUAGE_BINDING);
protocolMarshaller.marshall(deletePortfolioRequest.getId(), ID_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(DeletePortfolioRequest deletePortfolioRequest, ProtocolMarshaller protocolMarshaller) {
if (deletePortfolioRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deletePortfolioRequest.getAcceptLanguage(), ACCEPTLANGUAGE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(deletePortfolioRequest.getId(), ID_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 Object getValue(byte[] bs, Charset charset) {
if (String.class == field.getType()) {
if (isDynamicField()) {
return (new String(bs, offsize, bs.length - offsize, charset)).trim();
}
return (new String(bs, offsize, size, charset)).trim();
} else if (long.class == field.getType()) {
return BytesUtil.buff2long(bs, offsize);
} else if (int.class == field.getType()) {
return (int) BytesUtil.buff2long(bs, offsize);
} else if (java.util.Date.class == field.getType()) {
return new Date(BytesUtil.buff2long(bs, offsize) * 1000);
} else if (byte.class == field.getType()) {
return bs[offsize];
} else if (boolean.class == field.getType()) {
return bs[offsize] != 0;
}
throw new FdfsColumnMapException(field.getName() + "获取值时未识别的FdfsColumn类型" + field.getType());
} } | public class class_name {
public Object getValue(byte[] bs, Charset charset) {
if (String.class == field.getType()) {
if (isDynamicField()) {
return (new String(bs, offsize, bs.length - offsize, charset)).trim(); // depends on control dependency: [if], data = [none]
}
return (new String(bs, offsize, size, charset)).trim(); // depends on control dependency: [if], data = [none]
} else if (long.class == field.getType()) {
return BytesUtil.buff2long(bs, offsize); // depends on control dependency: [if], data = [none]
} else if (int.class == field.getType()) {
return (int) BytesUtil.buff2long(bs, offsize); // depends on control dependency: [if], data = [none]
} else if (java.util.Date.class == field.getType()) {
return new Date(BytesUtil.buff2long(bs, offsize) * 1000); // depends on control dependency: [if], data = [none]
} else if (byte.class == field.getType()) {
return bs[offsize]; // depends on control dependency: [if], data = [none]
} else if (boolean.class == field.getType()) {
return bs[offsize] != 0; // depends on control dependency: [if], data = [none]
}
throw new FdfsColumnMapException(field.getName() + "获取值时未识别的FdfsColumn类型" + field.getType());
} } |
public class class_name {
public final Session getSession (final Configuration initConfiguration, final String initTargetName, final InetSocketAddress inetAddress) {
try {
// Create a new Session
final Session newSession = new Session(this, initConfiguration, initTargetName, inetAddress, Executors.newSingleThreadExecutor());
return newSession;
} catch (Exception e) {
LOGGER.error("This exception is thrown: " + e);
e.printStackTrace();
return null;
}
} } | public class class_name {
public final Session getSession (final Configuration initConfiguration, final String initTargetName, final InetSocketAddress inetAddress) {
try {
// Create a new Session
final Session newSession = new Session(this, initConfiguration, initTargetName, inetAddress, Executors.newSingleThreadExecutor());
return newSession; // depends on control dependency: [try], data = [none]
} catch (Exception e) {
LOGGER.error("This exception is thrown: " + e);
e.printStackTrace();
return null;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void setCurrentObject(Object obj) {
if (((obj == null) && (this.nullString != null))
|| this.requiredType.isInstance(obj)
|| (obj instanceof String)
|| (obj instanceof File)
|| ((obj instanceof Task) && this.requiredType.isAssignableFrom(((Task) obj).getTaskResultType()))) {
this.currentValue = obj;
} else {
throw new IllegalArgumentException("Object not of required type.");
}
} } | public class class_name {
public void setCurrentObject(Object obj) {
if (((obj == null) && (this.nullString != null))
|| this.requiredType.isInstance(obj)
|| (obj instanceof String)
|| (obj instanceof File)
|| ((obj instanceof Task) && this.requiredType.isAssignableFrom(((Task) obj).getTaskResultType()))) {
this.currentValue = obj; // depends on control dependency: [if], data = [none]
} else {
throw new IllegalArgumentException("Object not of required type.");
}
} } |
public class class_name {
public void marshall(ModifyWorkspacePropertiesRequest modifyWorkspacePropertiesRequest, ProtocolMarshaller protocolMarshaller) {
if (modifyWorkspacePropertiesRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(modifyWorkspacePropertiesRequest.getWorkspaceId(), WORKSPACEID_BINDING);
protocolMarshaller.marshall(modifyWorkspacePropertiesRequest.getWorkspaceProperties(), WORKSPACEPROPERTIES_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(ModifyWorkspacePropertiesRequest modifyWorkspacePropertiesRequest, ProtocolMarshaller protocolMarshaller) {
if (modifyWorkspacePropertiesRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(modifyWorkspacePropertiesRequest.getWorkspaceId(), WORKSPACEID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(modifyWorkspacePropertiesRequest.getWorkspaceProperties(), WORKSPACEPROPERTIES_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static base_responses delete(nitro_service client, String fieldname[]) throws Exception {
base_responses result = null;
if (fieldname != null && fieldname.length > 0) {
appfwconfidfield deleteresources[] = new appfwconfidfield[fieldname.length];
for (int i=0;i<fieldname.length;i++){
deleteresources[i] = new appfwconfidfield();
deleteresources[i].fieldname = fieldname[i];
}
result = delete_bulk_request(client, deleteresources);
}
return result;
} } | public class class_name {
public static base_responses delete(nitro_service client, String fieldname[]) throws Exception {
base_responses result = null;
if (fieldname != null && fieldname.length > 0) {
appfwconfidfield deleteresources[] = new appfwconfidfield[fieldname.length];
for (int i=0;i<fieldname.length;i++){
deleteresources[i] = new appfwconfidfield(); // depends on control dependency: [for], data = [i]
deleteresources[i].fieldname = fieldname[i]; // depends on control dependency: [for], data = [i]
}
result = delete_bulk_request(client, deleteresources);
}
return result;
} } |
public class class_name {
@SuppressWarnings("all")
public static <T> List<T> toTypedList(Object data, Class<T> type) {
List<T> listResult = new ArrayList<>();
if (data == null) {
return listResult;
}
if (data instanceof Collection) {
Collection collection = (Collection) data;
for (Object o : collection) {
listResult.add(Reflection.toType(o, type));
}
return listResult;
}
if (data.getClass().isArray()) {
for (Object o : ArrayUtil.toObjectArray(data)) {
listResult.add(Reflection.toType(o, type));
}
return listResult;
}
listResult.add(Reflection.toType(data, type));
return listResult;
} } | public class class_name {
@SuppressWarnings("all")
public static <T> List<T> toTypedList(Object data, Class<T> type) {
List<T> listResult = new ArrayList<>();
if (data == null) {
return listResult; // depends on control dependency: [if], data = [none]
}
if (data instanceof Collection) {
Collection collection = (Collection) data;
for (Object o : collection) {
listResult.add(Reflection.toType(o, type)); // depends on control dependency: [for], data = [o]
}
return listResult; // depends on control dependency: [if], data = [none]
}
if (data.getClass().isArray()) {
for (Object o : ArrayUtil.toObjectArray(data)) {
listResult.add(Reflection.toType(o, type)); // depends on control dependency: [for], data = [o]
}
return listResult; // depends on control dependency: [if], data = [none]
}
listResult.add(Reflection.toType(data, type));
return listResult;
} } |
public class class_name {
@Override
public HTable getTable(String tableName) {
logger.debug("NATIVE Begin of getTable for " + tableName);
HTable table = tableNameHandleMap.get(tableName);
if (table != null) {
logger.debug("NATIVE Found a cached handle for table " + tableName);
return table;
}
try {
logger.debug("NATIVE Looking for a handle of table: " + tableName);
HBaseAdmin admin = new HBaseAdmin(this.getHbcfg());
HTableDescriptor[] resources = admin.listTables(tableName);
Preconditions.checkElementIndex(0, resources.length, "no table " + tableName + " found");
admin.close();
table = new HTable(this.getHbcfg(), tableName);
} catch (IOException e) {
logger.error("NATIVE Error while trying to obtain table: " + tableName);
logger.error(e.getMessage());
};
tableNameHandleMap.put(tableName, table);
logger.debug("NATIVE Cached a handle of table: " + tableName);
return table;
} } | public class class_name {
@Override
public HTable getTable(String tableName) {
logger.debug("NATIVE Begin of getTable for " + tableName);
HTable table = tableNameHandleMap.get(tableName);
if (table != null) {
logger.debug("NATIVE Found a cached handle for table " + tableName); // depends on control dependency: [if], data = [none]
return table; // depends on control dependency: [if], data = [none]
}
try {
logger.debug("NATIVE Looking for a handle of table: " + tableName); // depends on control dependency: [try], data = [none]
HBaseAdmin admin = new HBaseAdmin(this.getHbcfg());
HTableDescriptor[] resources = admin.listTables(tableName);
Preconditions.checkElementIndex(0, resources.length, "no table " + tableName + " found"); // depends on control dependency: [try], data = [none]
admin.close(); // depends on control dependency: [try], data = [none]
table = new HTable(this.getHbcfg(), tableName); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
logger.error("NATIVE Error while trying to obtain table: " + tableName);
logger.error(e.getMessage());
}; // depends on control dependency: [catch], data = [none]
tableNameHandleMap.put(tableName, table);
logger.debug("NATIVE Cached a handle of table: " + tableName);
return table;
} } |
public class class_name {
AsteriskQueueMemberImpl getMemberByLocation(String location)
{
AsteriskQueueMemberImpl member;
synchronized (members)
{
member = members.get(location);
}
if (member == null)
{
logger.error("Requested member at location " + location + " not found!");
}
return member;
} } | public class class_name {
AsteriskQueueMemberImpl getMemberByLocation(String location)
{
AsteriskQueueMemberImpl member;
synchronized (members)
{
member = members.get(location);
}
if (member == null)
{
logger.error("Requested member at location " + location + " not found!"); // depends on control dependency: [if], data = [none]
}
return member;
} } |
public class class_name {
private List<InvPair> createInvarLabel(IAtomContainer atomContainer) {
Iterator<IAtom> atoms = atomContainer.atoms().iterator();
IAtom a;
StringBuffer inv;
List<InvPair> vect = new ArrayList<InvPair>();
while (atoms.hasNext()) {
a = (IAtom) atoms.next();
inv = new StringBuffer();
inv.append(atomContainer.getConnectedAtomsList(a).size()
+ (a.getImplicitHydrogenCount() == CDKConstants.UNSET ? 0 : a.getImplicitHydrogenCount())); //Num connections
inv.append(atomContainer.getConnectedAtomsList(a).size()); //Num of non H bonds
inv.append(PeriodicTable.getAtomicNumber(a.getSymbol()));
Double charge = a.getCharge();
if (charge == CDKConstants.UNSET) charge = 0.0;
if (charge < 0) //Sign of charge
inv.append(1);
else
inv.append(0); //Absolute charge
inv.append((int) Math.abs((a.getFormalCharge() == CDKConstants.UNSET ? 0.0 : a.getFormalCharge()))); //Hydrogen count
inv.append((a.getImplicitHydrogenCount() == CDKConstants.UNSET ? 0 : a.getImplicitHydrogenCount()));
vect.add(new InvPair(Long.parseLong(inv.toString()), a));
}
return vect;
} } | public class class_name {
private List<InvPair> createInvarLabel(IAtomContainer atomContainer) {
Iterator<IAtom> atoms = atomContainer.atoms().iterator();
IAtom a;
StringBuffer inv;
List<InvPair> vect = new ArrayList<InvPair>();
while (atoms.hasNext()) {
a = (IAtom) atoms.next(); // depends on control dependency: [while], data = [none]
inv = new StringBuffer(); // depends on control dependency: [while], data = [none]
inv.append(atomContainer.getConnectedAtomsList(a).size()
+ (a.getImplicitHydrogenCount() == CDKConstants.UNSET ? 0 : a.getImplicitHydrogenCount())); //Num connections // depends on control dependency: [while], data = [none]
inv.append(atomContainer.getConnectedAtomsList(a).size()); //Num of non H bonds // depends on control dependency: [while], data = [none]
inv.append(PeriodicTable.getAtomicNumber(a.getSymbol())); // depends on control dependency: [while], data = [none]
Double charge = a.getCharge();
if (charge == CDKConstants.UNSET) charge = 0.0;
if (charge < 0) //Sign of charge
inv.append(1);
else
inv.append(0); //Absolute charge
inv.append((int) Math.abs((a.getFormalCharge() == CDKConstants.UNSET ? 0.0 : a.getFormalCharge()))); //Hydrogen count // depends on control dependency: [while], data = [none]
inv.append((a.getImplicitHydrogenCount() == CDKConstants.UNSET ? 0 : a.getImplicitHydrogenCount())); // depends on control dependency: [while], data = [none]
vect.add(new InvPair(Long.parseLong(inv.toString()), a)); // depends on control dependency: [while], data = [none]
}
return vect;
} } |
public class class_name {
@Override
public ScheduledFuture<?> scheduleAtFixedRate(Runnable task, long period) {
ScheduledExecutorService executor = getScheduledExecutor();
try {
return executor.scheduleAtFixedRate(errorHandlingTask(task, true), 0, period, TimeUnit.MILLISECONDS);
} catch (RejectedExecutionException ex) {
throw new TaskRejectedException("Executor [" + executor + "] did not accept task: " + task, ex);
}
} } | public class class_name {
@Override
public ScheduledFuture<?> scheduleAtFixedRate(Runnable task, long period) {
ScheduledExecutorService executor = getScheduledExecutor();
try {
return executor.scheduleAtFixedRate(errorHandlingTask(task, true), 0, period, TimeUnit.MILLISECONDS); // depends on control dependency: [try], data = [none]
} catch (RejectedExecutionException ex) {
throw new TaskRejectedException("Executor [" + executor + "] did not accept task: " + task, ex);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void updateMode(ConnectionMode connectionMode) {
switch (connectionMode) {
case SEND_ONLY:
this.rtpHandler.setReceivable(false);
this.rtpHandler.setLoopable(false);
audioComponent.updateMode(false, true);
oobComponent.updateMode(false, true);
this.rtpHandler.deactivate();
this.transmitter.activate();
break;
case RECV_ONLY:
this.rtpHandler.setReceivable(true);
this.rtpHandler.setLoopable(false);
audioComponent.updateMode(true, false);
oobComponent.updateMode(true, false);
this.rtpHandler.activate();
this.transmitter.deactivate();
break;
case INACTIVE:
this.rtpHandler.setReceivable(false);
this.rtpHandler.setLoopable(false);
audioComponent.updateMode(false, false);
oobComponent.updateMode(false, false);
this.rtpHandler.deactivate();
this.transmitter.deactivate();
break;
case SEND_RECV:
case CONFERENCE:
this.rtpHandler.setReceivable(true);
this.rtpHandler.setLoopable(false);
audioComponent.updateMode(true, true);
oobComponent.updateMode(true, true);
this.rtpHandler.activate();
this.transmitter.activate();
break;
case NETWORK_LOOPBACK:
this.rtpHandler.setReceivable(false);
this.rtpHandler.setLoopable(true);
audioComponent.updateMode(false, false);
oobComponent.updateMode(false, false);
this.rtpHandler.deactivate();
this.transmitter.deactivate();
break;
default:
break;
}
boolean connectImmediately = false;
if (this.remotePeer != null) {
connectImmediately = udpManager.connectImmediately((InetSocketAddress) this.remotePeer);
}
if (udpManager.getRtpTimeout() > 0 && this.remotePeer != null && !connectImmediately) {
if (this.rtpHandler.isReceivable()) {
this.statistics.setLastHeartbeat(scheduler.getClock().getTime());
scheduler.submitHeatbeat(heartBeat);
} else {
heartBeat.cancel();
}
}
} } | public class class_name {
public void updateMode(ConnectionMode connectionMode) {
switch (connectionMode) {
case SEND_ONLY:
this.rtpHandler.setReceivable(false);
this.rtpHandler.setLoopable(false);
audioComponent.updateMode(false, true);
oobComponent.updateMode(false, true);
this.rtpHandler.deactivate();
this.transmitter.activate();
break;
case RECV_ONLY:
this.rtpHandler.setReceivable(true);
this.rtpHandler.setLoopable(false);
audioComponent.updateMode(true, false);
oobComponent.updateMode(true, false);
this.rtpHandler.activate();
this.transmitter.deactivate();
break;
case INACTIVE:
this.rtpHandler.setReceivable(false);
this.rtpHandler.setLoopable(false);
audioComponent.updateMode(false, false);
oobComponent.updateMode(false, false);
this.rtpHandler.deactivate();
this.transmitter.deactivate();
break;
case SEND_RECV:
case CONFERENCE:
this.rtpHandler.setReceivable(true);
this.rtpHandler.setLoopable(false);
audioComponent.updateMode(true, true);
oobComponent.updateMode(true, true);
this.rtpHandler.activate();
this.transmitter.activate();
break;
case NETWORK_LOOPBACK:
this.rtpHandler.setReceivable(false);
this.rtpHandler.setLoopable(true);
audioComponent.updateMode(false, false);
oobComponent.updateMode(false, false);
this.rtpHandler.deactivate();
this.transmitter.deactivate();
break;
default:
break;
}
boolean connectImmediately = false;
if (this.remotePeer != null) {
connectImmediately = udpManager.connectImmediately((InetSocketAddress) this.remotePeer); // depends on control dependency: [if], data = [none]
}
if (udpManager.getRtpTimeout() > 0 && this.remotePeer != null && !connectImmediately) {
if (this.rtpHandler.isReceivable()) {
this.statistics.setLastHeartbeat(scheduler.getClock().getTime()); // depends on control dependency: [if], data = [none]
scheduler.submitHeatbeat(heartBeat); // depends on control dependency: [if], data = [none]
} else {
heartBeat.cancel(); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public void marshall(SecurityGroupMembership securityGroupMembership, ProtocolMarshaller protocolMarshaller) {
if (securityGroupMembership == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(securityGroupMembership.getSecurityGroupIdentifier(), SECURITYGROUPIDENTIFIER_BINDING);
protocolMarshaller.marshall(securityGroupMembership.getStatus(), STATUS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(SecurityGroupMembership securityGroupMembership, ProtocolMarshaller protocolMarshaller) {
if (securityGroupMembership == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(securityGroupMembership.getSecurityGroupIdentifier(), SECURITYGROUPIDENTIFIER_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(securityGroupMembership.getStatus(), STATUS_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static MemberSummaryBuilder getInstance(
ClassWriter classWriter, Context context) {
MemberSummaryBuilder builder = new MemberSummaryBuilder(context,
classWriter.getTypeElement());
WriterFactory wf = context.configuration.getWriterFactory();
for (VisibleMemberMap.Kind kind : VisibleMemberMap.Kind.values()) {
MemberSummaryWriter msw = builder.getVisibleMemberMap(kind).noVisibleMembers()
? null
: wf.getMemberSummaryWriter(classWriter, kind);
builder.memberSummaryWriters.put(kind, msw);
}
return builder;
} } | public class class_name {
public static MemberSummaryBuilder getInstance(
ClassWriter classWriter, Context context) {
MemberSummaryBuilder builder = new MemberSummaryBuilder(context,
classWriter.getTypeElement());
WriterFactory wf = context.configuration.getWriterFactory();
for (VisibleMemberMap.Kind kind : VisibleMemberMap.Kind.values()) {
MemberSummaryWriter msw = builder.getVisibleMemberMap(kind).noVisibleMembers()
? null
: wf.getMemberSummaryWriter(classWriter, kind);
builder.memberSummaryWriters.put(kind, msw); // depends on control dependency: [for], data = [kind]
}
return builder;
} } |
public class class_name {
private void genOptTypeArguments(List<? extends TypeMirror> typeArguments, StringBuilder sb) {
if (!typeArguments.isEmpty()) {
sb.append('<');
for (TypeMirror typeParam : typeArguments) {
genTypeSignature(typeParam, sb);
}
sb.append('>');
}
} } | public class class_name {
private void genOptTypeArguments(List<? extends TypeMirror> typeArguments, StringBuilder sb) {
if (!typeArguments.isEmpty()) {
sb.append('<'); // depends on control dependency: [if], data = [none]
for (TypeMirror typeParam : typeArguments) {
genTypeSignature(typeParam, sb); // depends on control dependency: [for], data = [typeParam]
}
sb.append('>'); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public Boolean getApplicationExceptionRollback(Throwable t) // F743-14982
{
Class<?> klass = t.getClass();
ApplicationException ae = getApplicationException(klass);
Boolean rollback = null;
if (ae != null)
{
rollback = ae.rollback();
}
// Prior to EJB 3.1, the specification did not explicitly state that
// application exception status was inherited, so for efficiency, we
// assumed it did not. The EJB 3.1 specification clarified this but
// used a different default.
else if (!ContainerProperties.EE5Compatibility) // F743-14982CdRv
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
Tr.debug(tc, "searching for inherited application exception for " + klass.getName());
}
for (Class<?> superClass = klass.getSuperclass(); superClass != Throwable.class; superClass = superClass.getSuperclass())
{
ae = getApplicationException(superClass);
if (ae != null)
{
// The exception class itself has already been checked.
// If a super-class indicates that application exception
// status is not inherited, then the exception is not
// an application exception, so leave rollback null.
if (ae.inherited())
{
rollback = ae.rollback();
}
break;
}
}
}
return rollback;
} } | public class class_name {
public Boolean getApplicationExceptionRollback(Throwable t) // F743-14982
{
Class<?> klass = t.getClass();
ApplicationException ae = getApplicationException(klass);
Boolean rollback = null;
if (ae != null)
{
rollback = ae.rollback(); // depends on control dependency: [if], data = [none]
}
// Prior to EJB 3.1, the specification did not explicitly state that
// application exception status was inherited, so for efficiency, we
// assumed it did not. The EJB 3.1 specification clarified this but
// used a different default.
else if (!ContainerProperties.EE5Compatibility) // F743-14982CdRv
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
Tr.debug(tc, "searching for inherited application exception for " + klass.getName()); // depends on control dependency: [if], data = [none]
}
for (Class<?> superClass = klass.getSuperclass(); superClass != Throwable.class; superClass = superClass.getSuperclass())
{
ae = getApplicationException(superClass); // depends on control dependency: [for], data = [superClass]
if (ae != null)
{
// The exception class itself has already been checked.
// If a super-class indicates that application exception
// status is not inherited, then the exception is not
// an application exception, so leave rollback null.
if (ae.inherited())
{
rollback = ae.rollback(); // depends on control dependency: [if], data = [none]
}
break;
}
}
}
return rollback;
} } |
public class class_name {
public AsImpl getAs(int dpc, int opc, short si) {
for (FastList.Node<DPCNode> n = dpcList.head(), end = dpcList.tail(); (n = n.getNext()) != end;) {
DPCNode dpcNode = n.getValue();
if (dpcNode.dpc == dpc) {
return dpcNode.getAs(opc, si);
}
}
return null;
} } | public class class_name {
public AsImpl getAs(int dpc, int opc, short si) {
for (FastList.Node<DPCNode> n = dpcList.head(), end = dpcList.tail(); (n = n.getNext()) != end;) {
DPCNode dpcNode = n.getValue();
if (dpcNode.dpc == dpc) {
return dpcNode.getAs(opc, si); // depends on control dependency: [if], data = [none]
}
}
return null;
} } |
public class class_name {
public void setSqlValuesFormatter(final SQLValuesFormatter sqlValuesFormatter) {
if (entities.size() > 0) {
throw new IllegalStateException("The SQL values formatter cannot be changed after an entity was generated!");
}
if (sqlValuesFormatter == null) {
this.sqlValuesFormatter = new DefaultSQLValuesFormatter();
} else {
this.sqlValuesFormatter = sqlValuesFormatter;
}
} } | public class class_name {
public void setSqlValuesFormatter(final SQLValuesFormatter sqlValuesFormatter) {
if (entities.size() > 0) {
throw new IllegalStateException("The SQL values formatter cannot be changed after an entity was generated!");
}
if (sqlValuesFormatter == null) {
this.sqlValuesFormatter = new DefaultSQLValuesFormatter();
// depends on control dependency: [if], data = [none]
} else {
this.sqlValuesFormatter = sqlValuesFormatter;
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
String getTableName() {
if (opType == OpTypes.MULTICOLUMN) {
return tableName;
}
if (opType == OpTypes.COLUMN) {
if (rangeVariable == null) {
return tableName;
}
return rangeVariable.getTable().getName().name;
}
return "";
} } | public class class_name {
String getTableName() {
if (opType == OpTypes.MULTICOLUMN) {
return tableName; // depends on control dependency: [if], data = [none]
}
if (opType == OpTypes.COLUMN) {
if (rangeVariable == null) {
return tableName; // depends on control dependency: [if], data = [none]
}
return rangeVariable.getTable().getName().name; // depends on control dependency: [if], data = [none]
}
return "";
} } |
public class class_name {
public void marshall(S3Action s3Action, ProtocolMarshaller protocolMarshaller) {
if (s3Action == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(s3Action.getRoleArn(), ROLEARN_BINDING);
protocolMarshaller.marshall(s3Action.getBucketName(), BUCKETNAME_BINDING);
protocolMarshaller.marshall(s3Action.getKey(), KEY_BINDING);
protocolMarshaller.marshall(s3Action.getCannedAcl(), CANNEDACL_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(S3Action s3Action, ProtocolMarshaller protocolMarshaller) {
if (s3Action == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(s3Action.getRoleArn(), ROLEARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(s3Action.getBucketName(), BUCKETNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(s3Action.getKey(), KEY_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(s3Action.getCannedAcl(), CANNEDACL_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 Set<String> serviceNames() {
Set<String> result = new LinkedHashSet<>();
for (V1Annotation a : annotations) {
if (a.endpoint == null) continue;
if (a.endpoint.serviceName() == null) continue;
result.add(a.endpoint.serviceName());
}
for (V1BinaryAnnotation a : binaryAnnotations) {
if (a.endpoint == null) continue;
if (a.endpoint.serviceName() == null) continue;
result.add(a.endpoint.serviceName());
}
return result;
} } | public class class_name {
public Set<String> serviceNames() {
Set<String> result = new LinkedHashSet<>();
for (V1Annotation a : annotations) {
if (a.endpoint == null) continue;
if (a.endpoint.serviceName() == null) continue;
result.add(a.endpoint.serviceName()); // depends on control dependency: [for], data = [a]
}
for (V1BinaryAnnotation a : binaryAnnotations) {
if (a.endpoint == null) continue;
if (a.endpoint.serviceName() == null) continue;
result.add(a.endpoint.serviceName()); // depends on control dependency: [for], data = [a]
}
return result;
} } |
public class class_name {
public static DecimalType inferRoundType(int precision, int scale, int r) {
if (r >= scale) {
return new DecimalType(precision, scale);
} else if (r < 0) {
return new DecimalType(Math.min(38, 1 + precision - scale), 0);
} else { // 0 <= r < s
return new DecimalType(1 + precision - scale + r, r);
}
// NOTE: rounding may increase the digits by 1, therefore we need +1 on precisions.
} } | public class class_name {
public static DecimalType inferRoundType(int precision, int scale, int r) {
if (r >= scale) {
return new DecimalType(precision, scale); // depends on control dependency: [if], data = [none]
} else if (r < 0) {
return new DecimalType(Math.min(38, 1 + precision - scale), 0); // depends on control dependency: [if], data = [0)]
} else { // 0 <= r < s
return new DecimalType(1 + precision - scale + r, r); // depends on control dependency: [if], data = [none]
}
// NOTE: rounding may increase the digits by 1, therefore we need +1 on precisions.
} } |
public class class_name {
public ListResourceDataSyncResult withResourceDataSyncItems(ResourceDataSyncItem... resourceDataSyncItems) {
if (this.resourceDataSyncItems == null) {
setResourceDataSyncItems(new com.amazonaws.internal.SdkInternalList<ResourceDataSyncItem>(resourceDataSyncItems.length));
}
for (ResourceDataSyncItem ele : resourceDataSyncItems) {
this.resourceDataSyncItems.add(ele);
}
return this;
} } | public class class_name {
public ListResourceDataSyncResult withResourceDataSyncItems(ResourceDataSyncItem... resourceDataSyncItems) {
if (this.resourceDataSyncItems == null) {
setResourceDataSyncItems(new com.amazonaws.internal.SdkInternalList<ResourceDataSyncItem>(resourceDataSyncItems.length)); // depends on control dependency: [if], data = [none]
}
for (ResourceDataSyncItem ele : resourceDataSyncItems) {
this.resourceDataSyncItems.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
public static JapaneseEra valueOf(String japaneseEra) {
Jdk8Methods.requireNonNull(japaneseEra, "japaneseEra");
JapaneseEra[] known = KNOWN_ERAS.get();
for (JapaneseEra era : known) {
if (japaneseEra.equals(era.name)) {
return era;
}
}
throw new IllegalArgumentException("Era not found: " + japaneseEra);
} } | public class class_name {
public static JapaneseEra valueOf(String japaneseEra) {
Jdk8Methods.requireNonNull(japaneseEra, "japaneseEra");
JapaneseEra[] known = KNOWN_ERAS.get();
for (JapaneseEra era : known) {
if (japaneseEra.equals(era.name)) {
return era; // depends on control dependency: [if], data = [none]
}
}
throw new IllegalArgumentException("Era not found: " + japaneseEra);
} } |
public class class_name {
private static double hslaHue(double h, double m1, double m2) {
h = h < 0 ? h + 1 : (h > 1 ? h - 1 : h);
if (h * 6 < 1) { return m1 + (m2 - m1) * h * 6; }
else if (h * 2 < 1) { return m2; }
else if (h * 3 < 2) { return m1 + (m2 - m1) * (2F/3 - h) * 6; }
else { return m1; }
} } | public class class_name {
private static double hslaHue(double h, double m1, double m2) {
h = h < 0 ? h + 1 : (h > 1 ? h - 1 : h);
if (h * 6 < 1) { return m1 + (m2 - m1) * h * 6; } // depends on control dependency: [if], data = [1)]
else if (h * 2 < 1) { return m2; } // depends on control dependency: [if], data = [none]
else if (h * 3 < 2) { return m1 + (m2 - m1) * (2F/3 - h) * 6; } // depends on control dependency: [if], data = [none]
else { return m1; } // depends on control dependency: [if], data = [none]
} } |
public class class_name {
static @Nullable LogMonitorSession readSessionFromJWT(String token) {
try {
final Jwt jwt = Jwt.decode(token);
JSONObject payload = jwt.getPayload();
LogMonitorSession config = new LogMonitorSession();
// recipients
JSONArray recipientsJson = payload.optJSONArray("recipients");
if (recipientsJson != null) {
String[] recipients = new String[recipientsJson.length()];
for (int i = 0; i < recipientsJson.length(); ++i) {
recipients[i] = recipientsJson.optString(i);
}
config.emailRecipients = recipients;
}
return config;
} catch (Exception e) {
ApptentiveLog.e(e, "Exception while parsing access token: '%s'", token);
logException(e);
return null;
}
} } | public class class_name {
static @Nullable LogMonitorSession readSessionFromJWT(String token) {
try {
final Jwt jwt = Jwt.decode(token);
JSONObject payload = jwt.getPayload();
LogMonitorSession config = new LogMonitorSession();
// recipients
JSONArray recipientsJson = payload.optJSONArray("recipients");
if (recipientsJson != null) {
String[] recipients = new String[recipientsJson.length()];
for (int i = 0; i < recipientsJson.length(); ++i) {
recipients[i] = recipientsJson.optString(i); // depends on control dependency: [for], data = [i]
}
config.emailRecipients = recipients; // depends on control dependency: [if], data = [none]
}
return config; // depends on control dependency: [try], data = [none]
} catch (Exception e) {
ApptentiveLog.e(e, "Exception while parsing access token: '%s'", token);
logException(e);
return null;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public boolean isConnectionAllowed(IConnection conn) {
if (log.isDebugEnabled()) {
log.debug("isConnectionAllowed: {}", conn);
}
if (securityHandlers != null) {
if (log.isDebugEnabled()) {
log.debug("securityHandlers: {}", securityHandlers);
}
// loop through the handlers
for (IScopeSecurityHandler handler : securityHandlers) {
// if allowed continue to the next handler
if (handler.allowed(conn)) {
continue;
} else {
// if any handlers deny we return false
return false;
}
}
}
// default is to allow
return true;
} } | public class class_name {
public boolean isConnectionAllowed(IConnection conn) {
if (log.isDebugEnabled()) {
log.debug("isConnectionAllowed: {}", conn);
// depends on control dependency: [if], data = [none]
}
if (securityHandlers != null) {
if (log.isDebugEnabled()) {
log.debug("securityHandlers: {}", securityHandlers);
// depends on control dependency: [if], data = [none]
}
// loop through the handlers
for (IScopeSecurityHandler handler : securityHandlers) {
// if allowed continue to the next handler
if (handler.allowed(conn)) {
continue;
} else {
// if any handlers deny we return false
return false;
// depends on control dependency: [if], data = [none]
}
}
}
// default is to allow
return true;
} } |
public class class_name {
protected String build(Response response) {
StringBuilder sb = new StringBuilder();
sb.append("<div class='container'>");
sb.append("<div class='row-fluid'>");
sb.append("<div class='span12'>");
sb.append(buildJSONResponseBox(response));
if( response._status == Response.Status.done ) response.toJava(sb);
sb.append(buildResponseHeader(response));
Builder builder = response.getBuilderFor(ROOT_OBJECT);
if (builder == null) {
sb.append("<h3>"+name()+"</h3>");
builder = OBJECT_BUILDER;
}
for( String h : response.getHeaders() ) sb.append(h);
if( response._response==null ) {
boolean done = response._req.toHTML(sb);
if(!done) {
JsonParser parser = new JsonParser();
String json = new String(response._req.writeJSON(new AutoBuffer()).buf());
JsonObject o = (JsonObject) parser.parse(json);
sb.append(builder.build(response, o, ""));
}
} else sb.append(builder.build(response,response._response,""));
sb.append("</div></div></div>");
return sb.toString();
} } | public class class_name {
protected String build(Response response) {
StringBuilder sb = new StringBuilder();
sb.append("<div class='container'>");
sb.append("<div class='row-fluid'>");
sb.append("<div class='span12'>");
sb.append(buildJSONResponseBox(response));
if( response._status == Response.Status.done ) response.toJava(sb);
sb.append(buildResponseHeader(response));
Builder builder = response.getBuilderFor(ROOT_OBJECT);
if (builder == null) {
sb.append("<h3>"+name()+"</h3>"); // depends on control dependency: [if], data = [none]
builder = OBJECT_BUILDER; // depends on control dependency: [if], data = [none]
}
for( String h : response.getHeaders() ) sb.append(h);
if( response._response==null ) {
boolean done = response._req.toHTML(sb);
if(!done) {
JsonParser parser = new JsonParser();
String json = new String(response._req.writeJSON(new AutoBuffer()).buf());
JsonObject o = (JsonObject) parser.parse(json);
sb.append(builder.build(response, o, "")); // depends on control dependency: [if], data = [none]
}
} else sb.append(builder.build(response,response._response,""));
sb.append("</div></div></div>");
return sb.toString();
} } |
public class class_name {
private void uninstallMouseListeners() {
if (mouseListener != null) {
getComponent().removeMouseListener(mouseListener);
getComponent().removeMouseMotionListener(mouseListener);
mouseListener = null;
}
} } | public class class_name {
private void uninstallMouseListeners() {
if (mouseListener != null) {
getComponent().removeMouseListener(mouseListener); // depends on control dependency: [if], data = [(mouseListener]
getComponent().removeMouseMotionListener(mouseListener); // depends on control dependency: [if], data = [(mouseListener]
mouseListener = null; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public boolean getBooleanValue(String name, boolean defaultValue) {
String value = getValue(name);
if (value == null) {
return defaultValue;
} else {
return value.equals("true");
}
} } | public class class_name {
public boolean getBooleanValue(String name, boolean defaultValue) {
String value = getValue(name);
if (value == null) {
return defaultValue; // depends on control dependency: [if], data = [none]
} else {
return value.equals("true"); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private int skipDigits() {
char ch;
int i = 0;
while (index < format.length()) {
if (Character.isDigit(ch = format.charAt(index))) {
index++;
i = i * 10 + Character.digit(ch, 10);
} else {
break;
}
}
return i;
} } | public class class_name {
private int skipDigits() {
char ch;
int i = 0;
while (index < format.length()) {
if (Character.isDigit(ch = format.charAt(index))) {
index++; // depends on control dependency: [if], data = [none]
i = i * 10 + Character.digit(ch, 10); // depends on control dependency: [if], data = [none]
} else {
break;
}
}
return i;
} } |
public class class_name {
@SuppressWarnings("unchecked")
public static <T> Optional<Key<T>> resolveDefaultQualifier(Map<Key<?>, Class<?>> bindings,
ClassConfiguration<?> classConfiguration, String property, Class<?> qualifiedClass,
TypeLiteral<T> genericInterface) {
Key<T> key = null;
if (classConfiguration != null && !classConfiguration.isEmpty()) {
String qualifierName = classConfiguration.get(property);
if (qualifierName != null && !"".equals(qualifierName)) {
try {
ClassLoader classLoader = ClassLoaders.findMostCompleteClassLoader(BusinessUtils.class);
Class<?> qualifierClass = classLoader.loadClass(qualifierName);
if (Annotation.class.isAssignableFrom(qualifierClass)) {
key = Key.get(genericInterface, (Class<? extends Annotation>) qualifierClass);
} else {
throw BusinessException.createNew(BusinessErrorCode.CLASS_IS_NOT_AN_ANNOTATION)
.put("class", qualifiedClass)
.put("qualifier", qualifierName);
}
} catch (ClassNotFoundException e) {
key = Key.get(genericInterface, Names.named(qualifierName));
}
}
}
if (key == null || bindings.containsKey(Key.get(key.getTypeLiteral()))) {
return Optional.empty();
} else {
return Optional.of(key);
}
} } | public class class_name {
@SuppressWarnings("unchecked")
public static <T> Optional<Key<T>> resolveDefaultQualifier(Map<Key<?>, Class<?>> bindings,
ClassConfiguration<?> classConfiguration, String property, Class<?> qualifiedClass,
TypeLiteral<T> genericInterface) {
Key<T> key = null;
if (classConfiguration != null && !classConfiguration.isEmpty()) {
String qualifierName = classConfiguration.get(property);
if (qualifierName != null && !"".equals(qualifierName)) {
try {
ClassLoader classLoader = ClassLoaders.findMostCompleteClassLoader(BusinessUtils.class);
Class<?> qualifierClass = classLoader.loadClass(qualifierName);
if (Annotation.class.isAssignableFrom(qualifierClass)) {
key = Key.get(genericInterface, (Class<? extends Annotation>) qualifierClass); // depends on control dependency: [if], data = [none]
} else {
throw BusinessException.createNew(BusinessErrorCode.CLASS_IS_NOT_AN_ANNOTATION)
.put("class", qualifiedClass)
.put("qualifier", qualifierName);
}
} catch (ClassNotFoundException e) {
key = Key.get(genericInterface, Names.named(qualifierName));
} // depends on control dependency: [catch], data = [none]
}
}
if (key == null || bindings.containsKey(Key.get(key.getTypeLiteral()))) {
return Optional.empty();
} else {
return Optional.of(key);
}
} } |
public class class_name {
@Override
public String initValues(final FieldCase ca) {
if (ca != null) {
/*
* If a FieldCase is given all fields will be generated anew, independent of the case
* combination.
*/
for (Constraint c : constraints) {
c.resetValues();
}
}
for (Constraint c : constraints) {
c.initValues(ca);
}
return null;
} } | public class class_name {
@Override
public String initValues(final FieldCase ca) {
if (ca != null) {
/*
* If a FieldCase is given all fields will be generated anew, independent of the case
* combination.
*/
for (Constraint c : constraints) {
c.resetValues();
// depends on control dependency: [for], data = [c]
}
}
for (Constraint c : constraints) {
c.initValues(ca);
// depends on control dependency: [for], data = [c]
}
return null;
} } |
public class class_name {
public static boolean isEncoded (final HttpEntity entity) {
Header h = entity.getContentType();
if (h != null) {
HeaderElement[] elems = h.getElements();
if (elems.length > 0) {
String contentType = elems[0].getName();
return contentType.equalsIgnoreCase(CONTENT_TYPE);
} else {
return false;
}
} else {
return false;
}
} } | public class class_name {
public static boolean isEncoded (final HttpEntity entity) {
Header h = entity.getContentType();
if (h != null) {
HeaderElement[] elems = h.getElements();
if (elems.length > 0) {
String contentType = elems[0].getName();
return contentType.equalsIgnoreCase(CONTENT_TYPE); // depends on control dependency: [if], data = [none]
} else {
return false; // depends on control dependency: [if], data = [none]
}
} else {
return false; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private void initWriteBufferWaterMark() {
int lowWaterMark = this.netty_buffer_low_watermark();
int highWaterMark = this.netty_buffer_high_watermark();
if (lowWaterMark > highWaterMark) {
throw new IllegalArgumentException(
String
.format(
"[server side] bolt netty high water mark {%s} should not be smaller than low water mark {%s} bytes)",
highWaterMark, lowWaterMark));
} else {
logger.warn(
"[server side] bolt netty low water mark is {} bytes, high water mark is {} bytes",
lowWaterMark, highWaterMark);
}
this.bootstrap.childOption(ChannelOption.WRITE_BUFFER_WATER_MARK, new WriteBufferWaterMark(
lowWaterMark, highWaterMark));
} } | public class class_name {
private void initWriteBufferWaterMark() {
int lowWaterMark = this.netty_buffer_low_watermark();
int highWaterMark = this.netty_buffer_high_watermark();
if (lowWaterMark > highWaterMark) {
throw new IllegalArgumentException(
String
.format(
"[server side] bolt netty high water mark {%s} should not be smaller than low water mark {%s} bytes)",
highWaterMark, lowWaterMark));
} else {
logger.warn(
"[server side] bolt netty low water mark is {} bytes, high water mark is {} bytes",
lowWaterMark, highWaterMark); // depends on control dependency: [if], data = [none]
}
this.bootstrap.childOption(ChannelOption.WRITE_BUFFER_WATER_MARK, new WriteBufferWaterMark(
lowWaterMark, highWaterMark));
} } |
public class class_name {
private void insertSpan(TokenImageSpan tokenSpan) {
CharSequence ssb = tokenizer.wrapTokenValue(tokenToString(tokenSpan.token));
Editable editable = getText();
if (editable == null) return;
// If we haven't hidden any objects yet, we can try adding it
if (hiddenContent == null) {
internalEditInProgress = true;
int offset = editable.length();
//There might be a hint visible...
if (hintVisible) {
//...so we need to put the object in in front of the hint
offset = prefix.length();
} else {
Range currentRange = getCurrentCandidateTokenRange();
if (currentRange.length() > 0) {
// The user has entered some text that has not yet been tokenized.
// Find the beginning of this text and insert the new token there.
offset = currentRange.start;
}
}
editable.insert(offset, ssb);
editable.insert(offset + ssb.length(), " ");
editable.setSpan(tokenSpan, offset, offset + ssb.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
internalEditInProgress = false;
} else {
CharSequence tokenText = tokenizer.wrapTokenValue(tokenToString(tokenSpan.getToken()));
int start = hiddenContent.length();
hiddenContent.append(tokenText);
hiddenContent.append(" ");
hiddenContent.setSpan(tokenSpan, start, start + tokenText.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
updateCountSpan();
}
} } | public class class_name {
private void insertSpan(TokenImageSpan tokenSpan) {
CharSequence ssb = tokenizer.wrapTokenValue(tokenToString(tokenSpan.token));
Editable editable = getText();
if (editable == null) return;
// If we haven't hidden any objects yet, we can try adding it
if (hiddenContent == null) {
internalEditInProgress = true; // depends on control dependency: [if], data = [none]
int offset = editable.length();
//There might be a hint visible...
if (hintVisible) {
//...so we need to put the object in in front of the hint
offset = prefix.length(); // depends on control dependency: [if], data = [none]
} else {
Range currentRange = getCurrentCandidateTokenRange();
if (currentRange.length() > 0) {
// The user has entered some text that has not yet been tokenized.
// Find the beginning of this text and insert the new token there.
offset = currentRange.start; // depends on control dependency: [if], data = [none]
}
}
editable.insert(offset, ssb); // depends on control dependency: [if], data = [none]
editable.insert(offset + ssb.length(), " "); // depends on control dependency: [if], data = [none]
editable.setSpan(tokenSpan, offset, offset + ssb.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); // depends on control dependency: [if], data = [none]
internalEditInProgress = false; // depends on control dependency: [if], data = [none]
} else {
CharSequence tokenText = tokenizer.wrapTokenValue(tokenToString(tokenSpan.getToken()));
int start = hiddenContent.length();
hiddenContent.append(tokenText); // depends on control dependency: [if], data = [none]
hiddenContent.append(" "); // depends on control dependency: [if], data = [none]
hiddenContent.setSpan(tokenSpan, start, start + tokenText.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); // depends on control dependency: [if], data = [none]
updateCountSpan(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static Dialect guessDialect(DataSource dataSource) {
Dialect result = dataSourceDialectCache.get(dataSource);
if (result != null)
return result;
Connection con = null;
try {
con = dataSource.getConnection();
result = guessDialect(con);
if (result == null)
return (Dialect) DialectException
.throwEX("Can not get dialect from DataSource, please submit this bug.");
dataSourceDialectCache.put(dataSource, result);
return result;
} catch (SQLException e) {
return (Dialect) DialectException.throwEX(e);
} finally {
try {
if (con != null && !con.isClosed()) {
try {// NOSONAR
con.close();
} catch (SQLException e) {
DialectException.throwEX(e);
}
}
} catch (SQLException e) {
DialectException.throwEX(e);
}
}
} } | public class class_name {
public static Dialect guessDialect(DataSource dataSource) {
Dialect result = dataSourceDialectCache.get(dataSource);
if (result != null)
return result;
Connection con = null;
try {
con = dataSource.getConnection(); // depends on control dependency: [try], data = [none]
result = guessDialect(con); // depends on control dependency: [try], data = [none]
if (result == null)
return (Dialect) DialectException
.throwEX("Can not get dialect from DataSource, please submit this bug.");
dataSourceDialectCache.put(dataSource, result); // depends on control dependency: [try], data = [none]
return result; // depends on control dependency: [try], data = [none]
} catch (SQLException e) {
return (Dialect) DialectException.throwEX(e);
} finally { // depends on control dependency: [catch], data = [none]
try {
if (con != null && !con.isClosed()) {
try {// NOSONAR
con.close(); // depends on control dependency: [try], data = [none]
} catch (SQLException e) {
DialectException.throwEX(e);
} // depends on control dependency: [catch], data = [none]
}
} catch (SQLException e) {
DialectException.throwEX(e);
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
protected void runAllStepsInLoop(List<GherkinConditionedLoopedStep> loopedSteps) throws TechnicalException {
for (final GherkinConditionedLoopedStep loopedStep : loopedSteps) {
final List<GherkinStepCondition> stepConditions = new ArrayList<>();
final String[] expecteds = loopedStep.getExpected().split(";");
final String[] actuals = loopedStep.getActual().split(";");
if (actuals.length != expecteds.length) {
throw new TechnicalException(Messages.getMessage(TechnicalException.TECHNICAL_EXPECTED_ACTUAL_SIZE_DIFFERENT));
}
for (int i = 0; i < expecteds.length; i++) {
stepConditions.add(new GherkinStepCondition(loopedStep.getKey(), expecteds[i], actuals[i]));
}
boolean found = false;
for (final Entry<String, Method> elem : Context.getCucumberMethods().entrySet()) {
final Matcher matcher = Pattern.compile("value=(.*)\\)").matcher(elem.getKey());
if (matcher.find()) {
final Matcher matcher2 = Pattern.compile(matcher.group(1)).matcher(loopedStep.getStep());
if (matcher2.find()) {
Object[] tab;
if (elem.getValue().isAnnotationPresent(Conditioned.class)) {
tab = new Object[matcher2.groupCount() + 1];
tab[matcher2.groupCount()] = stepConditions;
} else {
tab = new Object[matcher2.groupCount()];
}
for (int i = 0; i < matcher2.groupCount(); i++) {
final Parameter param = elem.getValue().getParameters()[i];
if (param.getType() == int.class) {
final int ii = Integer.parseInt(matcher2.group(i + 1));
tab[i] = ii;
} else if (param.getType() == boolean.class) {
tab[i] = Boolean.parseBoolean(matcher2.group(i + 1));
} else {
tab[i] = matcher2.group(i + 1);
}
}
try {
found = true;
elem.getValue().invoke(NoraUiInjector.getNoraUiInjectorSource().getInstance(elem.getValue().getDeclaringClass()), tab);
break;
} catch (final Exception e) {
throw new TechnicalException("\"" + loopedStep.getStep() + "\"", e.getCause());
}
}
}
}
if (!found) {
throw new TechnicalException(String.format(Messages.getMessage(TechnicalException.TECHNICAL_ERROR_STEP_UNDEFINED), loopedStep.getStep()));
}
}
} } | public class class_name {
protected void runAllStepsInLoop(List<GherkinConditionedLoopedStep> loopedSteps) throws TechnicalException {
for (final GherkinConditionedLoopedStep loopedStep : loopedSteps) {
final List<GherkinStepCondition> stepConditions = new ArrayList<>();
final String[] expecteds = loopedStep.getExpected().split(";");
final String[] actuals = loopedStep.getActual().split(";");
if (actuals.length != expecteds.length) {
throw new TechnicalException(Messages.getMessage(TechnicalException.TECHNICAL_EXPECTED_ACTUAL_SIZE_DIFFERENT));
}
for (int i = 0; i < expecteds.length; i++) {
stepConditions.add(new GherkinStepCondition(loopedStep.getKey(), expecteds[i], actuals[i]));
// depends on control dependency: [for], data = [i]
}
boolean found = false;
for (final Entry<String, Method> elem : Context.getCucumberMethods().entrySet()) {
final Matcher matcher = Pattern.compile("value=(.*)\\)").matcher(elem.getKey());
if (matcher.find()) {
final Matcher matcher2 = Pattern.compile(matcher.group(1)).matcher(loopedStep.getStep());
if (matcher2.find()) {
Object[] tab;
if (elem.getValue().isAnnotationPresent(Conditioned.class)) {
tab = new Object[matcher2.groupCount() + 1];
// depends on control dependency: [if], data = [none]
tab[matcher2.groupCount()] = stepConditions;
// depends on control dependency: [if], data = [none]
} else {
tab = new Object[matcher2.groupCount()];
// depends on control dependency: [if], data = [none]
}
for (int i = 0; i < matcher2.groupCount(); i++) {
final Parameter param = elem.getValue().getParameters()[i];
if (param.getType() == int.class) {
final int ii = Integer.parseInt(matcher2.group(i + 1));
tab[i] = ii;
// depends on control dependency: [if], data = [none]
} else if (param.getType() == boolean.class) {
tab[i] = Boolean.parseBoolean(matcher2.group(i + 1));
// depends on control dependency: [if], data = [none]
} else {
tab[i] = matcher2.group(i + 1);
// depends on control dependency: [if], data = [none]
}
}
try {
found = true;
// depends on control dependency: [try], data = [none]
elem.getValue().invoke(NoraUiInjector.getNoraUiInjectorSource().getInstance(elem.getValue().getDeclaringClass()), tab);
// depends on control dependency: [try], data = [none]
break;
} catch (final Exception e) {
throw new TechnicalException("\"" + loopedStep.getStep() + "\"", e.getCause());
}
// depends on control dependency: [catch], data = [none]
}
}
}
if (!found) {
throw new TechnicalException(String.format(Messages.getMessage(TechnicalException.TECHNICAL_ERROR_STEP_UNDEFINED), loopedStep.getStep()));
}
}
} } |
public class class_name {
public void createObjectPool(final ProfileTableImpl profileTable,
final SleeTransactionManager sleeTransactionManager) {
if (logger.isTraceEnabled()) {
logger.trace("Creating Pool for " + profileTable);
}
createObjectPool(profileTable);
if (sleeTransactionManager != null) {
// add a rollback action to remove sbb object pool
TransactionalAction action = new TransactionalAction() {
public void execute() {
if (logger.isDebugEnabled()) {
logger
.debug("Due to tx rollback, removing pool for " + profileTable);
}
try {
removeObjectPool(profileTable);
} catch (Throwable e) {
logger.error("Failed to remove table's " + profileTable + " object pool", e);
}
}
};
sleeTransactionManager.getTransactionContext().getAfterRollbackActions().add(action);
}
} } | public class class_name {
public void createObjectPool(final ProfileTableImpl profileTable,
final SleeTransactionManager sleeTransactionManager) {
if (logger.isTraceEnabled()) {
logger.trace("Creating Pool for " + profileTable); // depends on control dependency: [if], data = [none]
}
createObjectPool(profileTable);
if (sleeTransactionManager != null) {
// add a rollback action to remove sbb object pool
TransactionalAction action = new TransactionalAction() {
public void execute() {
if (logger.isDebugEnabled()) {
logger
.debug("Due to tx rollback, removing pool for " + profileTable); // depends on control dependency: [if], data = [none]
}
try {
removeObjectPool(profileTable); // depends on control dependency: [try], data = [none]
} catch (Throwable e) {
logger.error("Failed to remove table's " + profileTable + " object pool", e);
} // depends on control dependency: [catch], data = [none]
}
};
sleeTransactionManager.getTransactionContext().getAfterRollbackActions().add(action); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public PlatformTransactionManager getPlatformTransactionManager() {
if (transactionManager != null) {
return transactionManager;
}
transactionManager = (PlatformTransactionManager) ContainerManager.getComponent("transactionManager");
return transactionManager;
} } | public class class_name {
public PlatformTransactionManager getPlatformTransactionManager() {
if (transactionManager != null) {
return transactionManager; // depends on control dependency: [if], data = [none]
}
transactionManager = (PlatformTransactionManager) ContainerManager.getComponent("transactionManager");
return transactionManager;
} } |
public class class_name {
private String getElementID(final String relativePath) {
final String fragment = getFragment(relativePath);
if (fragment != null) {
if (fragment.lastIndexOf(SLASH) != -1) {
return fragment.substring(fragment.lastIndexOf(SLASH) + 1);
} else {
return fragment;
}
}
return null;
} } | public class class_name {
private String getElementID(final String relativePath) {
final String fragment = getFragment(relativePath);
if (fragment != null) {
if (fragment.lastIndexOf(SLASH) != -1) {
return fragment.substring(fragment.lastIndexOf(SLASH) + 1); // depends on control dependency: [if], data = [(fragment.lastIndexOf(SLASH)]
} else {
return fragment; // depends on control dependency: [if], data = [none]
}
}
return null;
} } |
public class class_name {
public String getHeader(String name)
{
HeaderField f = getHeaderField(name);
if (f != null)
{
return f.getStringValue();
}
else
{
return null;
}
} } | public class class_name {
public String getHeader(String name)
{
HeaderField f = getHeaderField(name);
if (f != null)
{
return f.getStringValue(); // depends on control dependency: [if], data = [none]
}
else
{
return null; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void setLedColor(final Color COLOR) {
if (null == ledColor) {
_ledColor = null == COLOR ? Color.RED : COLOR;
fireUpdateEvent(REDRAW_EVENT);
} else {
ledColor.set(COLOR);
}
} } | public class class_name {
public void setLedColor(final Color COLOR) {
if (null == ledColor) {
_ledColor = null == COLOR ? Color.RED : COLOR; // depends on control dependency: [if], data = [none]
fireUpdateEvent(REDRAW_EVENT); // depends on control dependency: [if], data = [none]
} else {
ledColor.set(COLOR); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private void popUIComponentClassicTagBase() {
List list = (List) context.getAttributes().get(COMPONENT_TAG_STACK_ATTR);
// if an exception occurred in a nested tag,
//there could be a few tags left in the stack.
UIComponentClassicTagBase uic = null;
while (list != null && uic != this) {
int idx = list.size() - 1;
uic = (UIComponentClassicTagBase) list.get(idx);
list.remove(idx);
if (idx < 1) {
context.getAttributes().remove(COMPONENT_TAG_STACK_ATTR);
list = null;
}
}
} } | public class class_name {
private void popUIComponentClassicTagBase() {
List list = (List) context.getAttributes().get(COMPONENT_TAG_STACK_ATTR);
// if an exception occurred in a nested tag,
//there could be a few tags left in the stack.
UIComponentClassicTagBase uic = null;
while (list != null && uic != this) {
int idx = list.size() - 1;
uic = (UIComponentClassicTagBase) list.get(idx); // depends on control dependency: [while], data = [none]
list.remove(idx); // depends on control dependency: [while], data = [none]
if (idx < 1) {
context.getAttributes().remove(COMPONENT_TAG_STACK_ATTR); // depends on control dependency: [if], data = [none]
list = null; // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public static void fill(Object entity) {
final Class<?> entityClass = entity.getClass();
if (N.isEntity(entityClass) == false) {
throw new IllegalArgumentException(entityClass.getCanonicalName() + " is not a valid entity class with property getter/setter method");
}
Type<Object> type = null;
Class<?> parameterClass = null;
Object propValue = null;
for (Method method : ClassUtil.getPropSetMethodList(entityClass).values()) {
parameterClass = method.getParameterTypes()[0];
type = N.typeOf(parameterClass);
if (String.class.equals(parameterClass)) {
propValue = N.uuid().substring(0, 16);
} else if (boolean.class.equals(parameterClass) || Boolean.class.equals(parameterClass)) {
propValue = RAND.nextInt() % 2 == 0 ? false : true;
} else if (char.class.equals(parameterClass) || Character.class.equals(parameterClass)) {
propValue = (char) ('a' + RAND.nextInt() % 26);
} else if (int.class.equals(parameterClass) || Integer.class.equals(parameterClass)) {
propValue = RAND.nextInt();
} else if (long.class.equals(parameterClass) || Long.class.equals(parameterClass)) {
propValue = RAND.nextLong();
} else if (float.class.equals(parameterClass) || Float.class.equals(parameterClass)) {
propValue = RAND.nextFloat();
} else if (double.class.equals(parameterClass) || Double.class.equals(parameterClass)) {
propValue = RAND.nextDouble();
} else if (byte.class.equals(parameterClass) || Byte.class.equals(parameterClass)) {
propValue = Integer.valueOf(RAND.nextInt()).byteValue();
} else if (short.class.equals(parameterClass) || Short.class.equals(parameterClass)) {
propValue = Integer.valueOf(RAND.nextInt()).shortValue();
} else if (Number.class.isAssignableFrom(parameterClass)) {
propValue = type.valueOf(String.valueOf(RAND.nextInt()));
} else if (java.util.Date.class.isAssignableFrom(parameterClass) || Calendar.class.isAssignableFrom(parameterClass)) {
propValue = type.valueOf(String.valueOf(System.currentTimeMillis()));
} else if (N.isEntity(parameterClass)) {
propValue = fill(parameterClass);
} else {
propValue = type.defaultValue();
}
ClassUtil.setPropValue(entity, method, propValue);
}
} } | public class class_name {
public static void fill(Object entity) {
final Class<?> entityClass = entity.getClass();
if (N.isEntity(entityClass) == false) {
throw new IllegalArgumentException(entityClass.getCanonicalName() + " is not a valid entity class with property getter/setter method");
}
Type<Object> type = null;
Class<?> parameterClass = null;
Object propValue = null;
for (Method method : ClassUtil.getPropSetMethodList(entityClass).values()) {
parameterClass = method.getParameterTypes()[0];
// depends on control dependency: [for], data = [method]
type = N.typeOf(parameterClass);
// depends on control dependency: [for], data = [none]
if (String.class.equals(parameterClass)) {
propValue = N.uuid().substring(0, 16);
// depends on control dependency: [if], data = [none]
} else if (boolean.class.equals(parameterClass) || Boolean.class.equals(parameterClass)) {
propValue = RAND.nextInt() % 2 == 0 ? false : true;
// depends on control dependency: [if], data = [none]
} else if (char.class.equals(parameterClass) || Character.class.equals(parameterClass)) {
propValue = (char) ('a' + RAND.nextInt() % 26);
// depends on control dependency: [if], data = [none]
} else if (int.class.equals(parameterClass) || Integer.class.equals(parameterClass)) {
propValue = RAND.nextInt();
// depends on control dependency: [if], data = [none]
} else if (long.class.equals(parameterClass) || Long.class.equals(parameterClass)) {
propValue = RAND.nextLong();
// depends on control dependency: [if], data = [none]
} else if (float.class.equals(parameterClass) || Float.class.equals(parameterClass)) {
propValue = RAND.nextFloat();
// depends on control dependency: [if], data = [none]
} else if (double.class.equals(parameterClass) || Double.class.equals(parameterClass)) {
propValue = RAND.nextDouble();
// depends on control dependency: [if], data = [none]
} else if (byte.class.equals(parameterClass) || Byte.class.equals(parameterClass)) {
propValue = Integer.valueOf(RAND.nextInt()).byteValue();
// depends on control dependency: [if], data = [none]
} else if (short.class.equals(parameterClass) || Short.class.equals(parameterClass)) {
propValue = Integer.valueOf(RAND.nextInt()).shortValue();
// depends on control dependency: [if], data = [none]
} else if (Number.class.isAssignableFrom(parameterClass)) {
propValue = type.valueOf(String.valueOf(RAND.nextInt()));
// depends on control dependency: [if], data = [none]
} else if (java.util.Date.class.isAssignableFrom(parameterClass) || Calendar.class.isAssignableFrom(parameterClass)) {
propValue = type.valueOf(String.valueOf(System.currentTimeMillis()));
// depends on control dependency: [if], data = [none]
} else if (N.isEntity(parameterClass)) {
propValue = fill(parameterClass);
// depends on control dependency: [if], data = [none]
} else {
propValue = type.defaultValue();
// depends on control dependency: [if], data = [none]
}
ClassUtil.setPropValue(entity, method, propValue);
// depends on control dependency: [for], data = [method]
}
} } |
public class class_name {
@Override
public void removeByCompanyId(long companyId) {
for (CPDefinitionOptionRel cpDefinitionOptionRel : findByCompanyId(
companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
remove(cpDefinitionOptionRel);
}
} } | public class class_name {
@Override
public void removeByCompanyId(long companyId) {
for (CPDefinitionOptionRel cpDefinitionOptionRel : findByCompanyId(
companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
remove(cpDefinitionOptionRel); // depends on control dependency: [for], data = [cpDefinitionOptionRel]
}
} } |
public class class_name {
public void printStackTrace(PrintStream stream) {
if (getRootCause() != null) {
stream.println(this.getMessage());
getRootCause().printStackTrace(stream);
} else {
this.printStackTrace(stream);
}
} } | public class class_name {
public void printStackTrace(PrintStream stream) {
if (getRootCause() != null) {
stream.println(this.getMessage()); // depends on control dependency: [if], data = [none]
getRootCause().printStackTrace(stream); // depends on control dependency: [if], data = [none]
} else {
this.printStackTrace(stream); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public @Nullable String getLinkRootPath(@NotNull Page page, @NotNull String linkTypeId) {
if (StringUtils.equals(linkTypeId, InternalLinkType.ID)) {
// inside an experience fragment it does not make sense to use a site root path
if (Path.isExperienceFragmentPath(page.getPath())) {
return DEFAULT_ROOT_PATH_CONTENT;
}
return AdaptTo.notNull(page.getContentResource(), SiteRoot.class).getRootPath(page);
}
else if (StringUtils.equals(linkTypeId, InternalCrossContextLinkType.ID)) {
return DEFAULT_ROOT_PATH_CONTENT;
}
else if (StringUtils.equals(linkTypeId, MediaLinkType.ID)) {
return DEFAULT_ROOT_PATH_MEDIA;
}
return null;
} } | public class class_name {
public @Nullable String getLinkRootPath(@NotNull Page page, @NotNull String linkTypeId) {
if (StringUtils.equals(linkTypeId, InternalLinkType.ID)) {
// inside an experience fragment it does not make sense to use a site root path
if (Path.isExperienceFragmentPath(page.getPath())) {
return DEFAULT_ROOT_PATH_CONTENT; // depends on control dependency: [if], data = [none]
}
return AdaptTo.notNull(page.getContentResource(), SiteRoot.class).getRootPath(page); // depends on control dependency: [if], data = [none]
}
else if (StringUtils.equals(linkTypeId, InternalCrossContextLinkType.ID)) {
return DEFAULT_ROOT_PATH_CONTENT; // depends on control dependency: [if], data = [none]
}
else if (StringUtils.equals(linkTypeId, MediaLinkType.ID)) {
return DEFAULT_ROOT_PATH_MEDIA; // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
public alluxio.grpc.Chunk getChunk() {
if (valueCase_ == 2) {
return (alluxio.grpc.Chunk) value_;
}
return alluxio.grpc.Chunk.getDefaultInstance();
} } | public class class_name {
public alluxio.grpc.Chunk getChunk() {
if (valueCase_ == 2) {
return (alluxio.grpc.Chunk) value_; // depends on control dependency: [if], data = [none]
}
return alluxio.grpc.Chunk.getDefaultInstance();
} } |
public class class_name {
void performCleanUp(@Nullable Runnable task) {
evictionLock.lock();
try {
maintenance(task);
} finally {
evictionLock.unlock();
}
if ((drainStatus() == REQUIRED) && (executor == ForkJoinPool.commonPool())) {
scheduleDrainBuffers();
}
} } | public class class_name {
void performCleanUp(@Nullable Runnable task) {
evictionLock.lock();
try {
maintenance(task); // depends on control dependency: [try], data = [none]
} finally {
evictionLock.unlock();
}
if ((drainStatus() == REQUIRED) && (executor == ForkJoinPool.commonPool())) {
scheduleDrainBuffers(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public Xid[] recover(int flag) throws XAException {
// Check preconditions
if (flag != TMSTARTRSCAN && flag != TMENDRSCAN && flag != TMNOFLAGS
&& flag != (TMSTARTRSCAN | TMENDRSCAN)) {
throw new CloudSpannerXAException(CloudSpannerXAException.INVALID_FLAGS,
Code.INVALID_ARGUMENT, XAException.XAER_INVAL);
}
// We don't check for precondition 2, because we would have to add some
// additional state in
// this object to keep track of recovery scans.
// All clear. We return all the xids in the first TMSTARTRSCAN call, and
// always return
// an empty array otherwise.
if ((flag & TMSTARTRSCAN) == 0) {
return new Xid[0];
} else {
try (Statement stmt = conn.createStatement()) {
// If this connection is simultaneously used for a
// transaction,
// this query gets executed inside that transaction. It's
// OK,
// except if the transaction is in abort-only state and the
// backed refuses to process new queries. Hopefully not a
// problem
// in practise.
try (ResultSet rs = stmt.executeQuery(
"SELECT DISTINCT " + XA_XID_COLUMN + " FROM " + XA_PREPARED_MUTATIONS_TABLE)) {
LinkedList<Xid> l = new LinkedList<>();
while (rs.next()) {
Xid recoveredXid = RecoveredXid.stringToXid(rs.getString(1));
if (recoveredXid != null) {
l.add(recoveredXid);
}
}
return l.toArray(new Xid[l.size()]);
}
} catch (CloudSpannerSQLException ex) {
throw new CloudSpannerXAException(CloudSpannerXAException.ERROR_RECOVER, ex,
XAException.XAER_RMERR);
} catch (SQLException ex) {
throw new CloudSpannerXAException(CloudSpannerXAException.ERROR_RECOVER, ex, Code.UNKNOWN,
XAException.XAER_RMERR);
}
}
} } | public class class_name {
@Override
public Xid[] recover(int flag) throws XAException {
// Check preconditions
if (flag != TMSTARTRSCAN && flag != TMENDRSCAN && flag != TMNOFLAGS
&& flag != (TMSTARTRSCAN | TMENDRSCAN)) {
throw new CloudSpannerXAException(CloudSpannerXAException.INVALID_FLAGS,
Code.INVALID_ARGUMENT, XAException.XAER_INVAL);
}
// We don't check for precondition 2, because we would have to add some
// additional state in
// this object to keep track of recovery scans.
// All clear. We return all the xids in the first TMSTARTRSCAN call, and
// always return
// an empty array otherwise.
if ((flag & TMSTARTRSCAN) == 0) {
return new Xid[0];
} else {
try (Statement stmt = conn.createStatement()) {
// If this connection is simultaneously used for a
// transaction,
// this query gets executed inside that transaction. It's
// OK,
// except if the transaction is in abort-only state and the
// backed refuses to process new queries. Hopefully not a
// problem
// in practise.
try (ResultSet rs = stmt.executeQuery(
"SELECT DISTINCT " + XA_XID_COLUMN + " FROM " + XA_PREPARED_MUTATIONS_TABLE)) {
LinkedList<Xid> l = new LinkedList<>();
while (rs.next()) {
Xid recoveredXid = RecoveredXid.stringToXid(rs.getString(1));
if (recoveredXid != null) {
l.add(recoveredXid);
// depends on control dependency: [if], data = [(recoveredXid]
}
}
return l.toArray(new Xid[l.size()]);
}
} catch (CloudSpannerSQLException ex) {
throw new CloudSpannerXAException(CloudSpannerXAException.ERROR_RECOVER, ex,
XAException.XAER_RMERR);
} catch (SQLException ex) {
throw new CloudSpannerXAException(CloudSpannerXAException.ERROR_RECOVER, ex, Code.UNKNOWN,
XAException.XAER_RMERR);
}
}
} } |
public class class_name {
public static <T> T newInstance(Class<T> clazz) throws SofaRpcRuntimeException {
if (clazz.isPrimitive()) {
return (T) getDefaultPrimitiveValue(clazz);
}
T t = getDefaultWrapperValue(clazz);
if (t != null) {
return t;
}
try {
// 普通类,如果是成员类(需要多传一个父类参数)
if (!(clazz.isMemberClass() && !Modifier.isStatic(clazz.getModifiers()))) {
try {
// 先找一个空的构造函数
Constructor<T> constructor = clazz.getDeclaredConstructor();
constructor.setAccessible(true);
return constructor.newInstance();
} catch (Exception ignore) { // NOPMD
}
}
// 不行的话,找一个最少参数的构造函数
Constructor<T>[] constructors = (Constructor<T>[]) clazz.getDeclaredConstructors();
if (constructors == null || constructors.length == 0) {
throw new SofaRpcRuntimeException("The " + clazz.getCanonicalName()
+ " has no default constructor!");
}
Constructor<T> constructor = constructors[0];
if (constructor.getParameterTypes().length > 0) {
for (Constructor<T> c : constructors) {
if (c.getParameterTypes().length < constructor.getParameterTypes().length) {
constructor = c;
if (constructor.getParameterTypes().length == 0) {
break;
}
}
}
}
constructor.setAccessible(true);
// 虚拟构造函数的参数值,基本类型使用默认值,其它类型使用null
Class<?>[] argTypes = constructor.getParameterTypes();
Object[] args = new Object[argTypes.length];
for (int i = 0; i < args.length; i++) {
args[i] = getDefaultPrimitiveValue(argTypes[i]);
}
return constructor.newInstance(args);
} catch (SofaRpcRuntimeException e) {
throw e;
} catch (Throwable e) {
throw new SofaRpcRuntimeException(e.getMessage(), e);
}
} } | public class class_name {
public static <T> T newInstance(Class<T> clazz) throws SofaRpcRuntimeException {
if (clazz.isPrimitive()) {
return (T) getDefaultPrimitiveValue(clazz);
}
T t = getDefaultWrapperValue(clazz);
if (t != null) {
return t;
}
try {
// 普通类,如果是成员类(需要多传一个父类参数)
if (!(clazz.isMemberClass() && !Modifier.isStatic(clazz.getModifiers()))) {
try {
// 先找一个空的构造函数
Constructor<T> constructor = clazz.getDeclaredConstructor();
constructor.setAccessible(true); // depends on control dependency: [try], data = [none]
return constructor.newInstance(); // depends on control dependency: [try], data = [none]
} catch (Exception ignore) { // NOPMD
} // depends on control dependency: [catch], data = [none]
}
// 不行的话,找一个最少参数的构造函数
Constructor<T>[] constructors = (Constructor<T>[]) clazz.getDeclaredConstructors();
if (constructors == null || constructors.length == 0) {
throw new SofaRpcRuntimeException("The " + clazz.getCanonicalName()
+ " has no default constructor!");
}
Constructor<T> constructor = constructors[0];
if (constructor.getParameterTypes().length > 0) {
for (Constructor<T> c : constructors) {
if (c.getParameterTypes().length < constructor.getParameterTypes().length) {
constructor = c; // depends on control dependency: [if], data = [none]
if (constructor.getParameterTypes().length == 0) {
break;
}
}
}
}
constructor.setAccessible(true);
// 虚拟构造函数的参数值,基本类型使用默认值,其它类型使用null
Class<?>[] argTypes = constructor.getParameterTypes();
Object[] args = new Object[argTypes.length];
for (int i = 0; i < args.length; i++) {
args[i] = getDefaultPrimitiveValue(argTypes[i]); // depends on control dependency: [for], data = [i]
}
return constructor.newInstance(args);
} catch (SofaRpcRuntimeException e) {
throw e;
} catch (Throwable e) {
throw new SofaRpcRuntimeException(e.getMessage(), e);
}
} } |
public class class_name {
protected boolean prevalidate(String component, BitSet disallowed) {
// prevalidate the given component by disallowed characters
if (component == null) {
return false; // undefined
}
char[] target = component.toCharArray();
for (int i = 0; i < target.length; i++) {
if (disallowed.get(target[i])) {
return false;
}
}
return true;
} } | public class class_name {
protected boolean prevalidate(String component, BitSet disallowed) {
// prevalidate the given component by disallowed characters
if (component == null) {
return false; // undefined // depends on control dependency: [if], data = [none]
}
char[] target = component.toCharArray();
for (int i = 0; i < target.length; i++) {
if (disallowed.get(target[i])) {
return false; // depends on control dependency: [if], data = [none]
}
}
return true;
} } |
public class class_name {
public FieldDescriptor[] getNonPkFields()
{
if (m_nonPkFieldDescriptors == null)
{
// 1. collect all Primary Key fields from Field list
Vector vec = new Vector();
for (int i = 0; i < m_FieldDescriptions.length; i++)
{
FieldDescriptor fd = m_FieldDescriptions[i];
if (!fd.isPrimaryKey())
{
vec.add(fd);
}
}
// 2. Sort fields according to their getOrder() Property
Collections.sort(vec, FieldDescriptor.getComparator());
m_nonPkFieldDescriptors =
(FieldDescriptor[]) vec.toArray(new FieldDescriptor[vec.size()]);
}
return m_nonPkFieldDescriptors;
} } | public class class_name {
public FieldDescriptor[] getNonPkFields()
{
if (m_nonPkFieldDescriptors == null)
{
// 1. collect all Primary Key fields from Field list
Vector vec = new Vector();
for (int i = 0; i < m_FieldDescriptions.length; i++)
{
FieldDescriptor fd = m_FieldDescriptions[i];
if (!fd.isPrimaryKey())
{
vec.add(fd);
// depends on control dependency: [if], data = [none]
}
}
// 2. Sort fields according to their getOrder() Property
Collections.sort(vec, FieldDescriptor.getComparator());
// depends on control dependency: [if], data = [none]
m_nonPkFieldDescriptors =
(FieldDescriptor[]) vec.toArray(new FieldDescriptor[vec.size()]);
// depends on control dependency: [if], data = [none]
}
return m_nonPkFieldDescriptors;
} } |
public class class_name {
public void writeHtmlDescription(Formatter out, Dataset ds,
boolean complete, boolean isServer,
boolean datasetEvents, boolean catrefEvents,
boolean resolveRelativeUrls) {
if (ds == null) return;
if (complete) {
out.format("<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"%n");
out.format(" \"http://www.w3.org/TR/html4/loose.dtd\">%n");
out.format("<html>%n");
out.format("<head>%n");
out.format("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">%n");
out.format("</head>%n");
out.format("<body>%n");
}
out.format("<h2>Dataset: %s</h2>%n<ul>", ds.getName());
if (ds.getDataFormatName() != null)
out.format(" <li><em>Data format: </em>%s</li>%n", htmlEscaper.escape(ds.getDataFormatName()));
if ((ds.getDataSize() > 0))
out.format(" <li><em>Data size: </em>%s</li>%n", Format.formatByteSize(ds.getDataSize()));
if (ds.getFeatureTypeName() != null)
out.format(" <li><em>Feature type: </em>%s</li>%n", htmlEscaper.escape(ds.getFeatureTypeName()));
if (ds.getCollectionType() != null)
out.format(" <li><em>Collection type: </em>%s</li>%n", htmlEscaper.escape(ds.getCollectionType()));
if (ds.isHarvest())
out.format(" <li><em>Harvest:</em> true</li>%n");
if (ds.getAuthority() != null)
out.format(" <li><em>Naming Authority: </em>%s</li>%n%n", htmlEscaper.escape(ds.getAuthority()));
if (ds.getId() != null)
out.format(" <li><em>ID: </em>%s</li>%n", htmlEscaper.escape(ds.getId()));
if (ds.getRestrictAccess() != null)
out.format(" <li><em>RestrictAccess: </em>%s</li>%n", htmlEscaper.escape(ds.getRestrictAccess()));
if (ds instanceof CatalogRef) {
CatalogRef catref = (CatalogRef) ds;
String href = resolveRelativeUrls | catrefEvents ? resolve(ds, catref.getXlinkHref()) : catref.getXlinkHref();
if (catrefEvents) href = "catref:" + href;
out.format(" <li><em>CatalogRef: </em>%s</li>%n", makeHref(href, null, null));
}
out.format("</ul>%n");
java.util.List<Documentation> docs = ds.getDocumentation();
if (docs.size() > 0) {
out.format("<h3>Documentation:</h3>%n<ul>%n");
for (Documentation doc : docs) {
String type = (doc.getType() == null) ? "" : "<strong>" + htmlEscaper.escape(doc.getType()) + ":</strong> ";
String inline = doc.getInlineContent();
if ((inline != null) && (inline.length() > 0))
out.format(" <li>%s %s</li>%n", type, htmlEscaper.escape(inline));
if (doc.hasXlink()) {
out.format(" <li>%s %s</li>%n", type, makeHref(doc.getXlinkHref(), null, doc.getXlinkTitle()));
}
}
out.format("</ul>%n");
}
java.util.List<Access> access = ds.getAccess();
if (access.size() > 0) {
out.format("<h3>Access:</h3>%n<ol>%n");
for (Access a : access) {
Service s = a.getService();
String urlString = resolveRelativeUrls || datasetEvents ? a.getStandardUrlName() : a.getUnresolvedUrlName();
String queryString = null;
// String fullUrlString = urlString;
if (datasetEvents) urlString = "dataset:" + urlString;
ServiceType stype = s.getType();
if (isServer && stype != null)
switch (stype) {
case OPENDAP:
case DODS:
urlString = urlString + ".html";
break;
case DAP4:
urlString = urlString + ".dmr.xml";
break;
case WCS:
queryString = "service=WCS&version=1.0.0&request=GetCapabilities";
break;
case WMS:
queryString = "service=WMS&version=1.3.0&request=GetCapabilities";
break;
case NCML:
case UDDC:
case ISO:
String catalogUrl = ds.getCatalogUrl();
String datasetId = ds.getId();
if (catalogUrl != null && datasetId != null) {
if (catalogUrl.indexOf('#') > 0)
catalogUrl = catalogUrl.substring(0, catalogUrl.lastIndexOf('#'));
/* try {
catalogUrl = URLEncoder.encode(catalogUrl, "UTF-8");
datasetId = URLEncoder.encode(datasetId, "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
} */
queryString = "catalog=" + urlParamEscaper.escape(catalogUrl) + "&dataset=" + urlParamEscaper.escape(datasetId);
}
break;
case NetcdfSubset:
urlString = urlString + "/dataset.html";
break;
case CdmRemote:
queryString = "req=cdl";
break;
case CdmrFeature:
queryString = "req=form";
}
out.format(" <li> <b>%s: </b>%s</li>%n", s.getServiceTypeName(), makeHref(urlString, queryString, null));
}
out.format("</ol>%n");
}
java.util.List<ThreddsMetadata.Contributor> contributors = ds.getContributors();
if (contributors.size() > 0) {
out.format("<h3>Contributors:</h3>%n<ul>%n");
for (ThreddsMetadata.Contributor t : contributors) {
String role = (t.getRole() == null) ? "" : "<strong> (" + htmlEscaper.escape(t.getRole()) + ")</strong> ";
out.format(" <li>%s %s</li>%n", htmlEscaper.escape(t.getName()), role);
}
out.format("</ul>%n");
}
java.util.List<ThreddsMetadata.Vocab> keywords = ds.getKeywords();
if (keywords.size() > 0) {
out.format("<h3>Keywords:</h3>%n<ul>%n");
for (ThreddsMetadata.Vocab t : keywords) {
String vocab = (t.getVocabulary() == null) ? "" : " <strong>(" + htmlEscaper.escape(t.getVocabulary()) + ")</strong> ";
out.format(" <li>%s %s</li>%n", htmlEscaper.escape(t.getText()), vocab);
}
out.format("</ul>%n");
}
java.util.List<DateType> dates = ds.getDates();
if (dates.size() > 0) {
out.format("<h3>Dates:</h3>%n<ul>%n");
for (DateType d : dates) {
String type = (d.getType() == null) ? "" : " <strong>(" + htmlEscaper.escape(d.getType()) + ")</strong> ";
out.format(" <li>%s %s</li>%n", htmlEscaper.escape(d.getText()), type);
}
out.format("</ul>%n");
}
java.util.List<ThreddsMetadata.Vocab> projects = ds.getProjects();
if (projects.size() > 0) {
out.format("<h3>Projects:</h3>%n<ul>%n");
for (ThreddsMetadata.Vocab t : projects) {
String vocab = (t.getVocabulary() == null) ? "" : " <strong>(" + htmlEscaper.escape(t.getVocabulary()) + ")</strong> ";
out.format(" <li>%s %s</li>%n", htmlEscaper.escape(t.getText()), vocab);
}
out.format("</ul>%n");
}
java.util.List<ThreddsMetadata.Source> creators = ds.getCreators();
if (creators.size() > 0) {
out.format("<h3>Creators:</h3>%n<ul>%n");
for (ThreddsMetadata.Source t : creators) {
out.format(" <li><strong>%s</strong><ul>%n", htmlEscaper.escape(t.getName()));
out.format(" <li><em>email: </em>%s</li>%n", htmlEscaper.escape(t.getEmail()));
if (t.getUrl() != null) {
String newUrl = resolveRelativeUrls ? makeHrefResolve(ds, t.getUrl(), null) : makeHref(t.getUrl(), null, null);
out.format(" <li> <em>%s</em></li>%n", newUrl);
}
out.format(" </ul></li>%n");
}
out.format("</ul>%n");
}
java.util.List<ThreddsMetadata.Source> publishers = ds.getPublishers();
if (publishers.size() > 0) {
out.format("<h3>Publishers:</h3>%n<ul>%n");
for (ThreddsMetadata.Source t : publishers) {
out.format(" <li><strong>%s</strong><ul>%n", htmlEscaper.escape(t.getName()));
out.format(" <li><em>email: </em>%s%n", htmlEscaper.escape(t.getEmail()));
if (t.getUrl() != null) {
String urlLink = resolveRelativeUrls ? makeHrefResolve(ds, t.getUrl(), null) : makeHref(t.getUrl(), null, null);
out.format(" <li> <em>%s</em></li>%n", urlLink);
}
out.format(" </ul>%n");
}
out.format("</ul>%n");
}
/*
4.2:
<h3>Variables:</h3>
<ul>
<li><em>Vocabulary</em> [DIF]:
<ul>
<li><strong>Reflectivity</strong> = <i></i> = EARTH SCIENCE > Spectral/Engineering > Radar > Radar Reflectivity (db)
<li><strong>Velocity</strong> = <i></i> = EARTH SCIENCE > Spectral/Engineering > Radar > Doppler Velocity (m/s)
<li><strong>SpectrumWidth</strong> = <i></i> = EARTH SCIENCE > Spectral/Engineering > Radar > Doppler Spectrum Width (m/s)
</ul>
</ul>
</ul>
4.3:
<h3>Variables:</h3>
<ul>
<li><em>Vocabulary</em> [CF-1.0]:
<ul>
<li><strong>d3d (meters) </strong> = <i>3D Depth at Nodes
<p> </i> = depth_at_nodes
<li><strong>depth (meters) </strong> = <i>Bathymetry</i> = depth
<li><strong>eta (m) </strong> = <i></i> =
<li><strong>temp (Celsius) </strong> = <i>Temperature
<p> </i> = sea_water_temperature
<li><strong>u (m/s) </strong> = <i>Eastward Water
<p> Velocity
<p> </i> = eastward_sea_water_velocity
<li><strong>v (m/s) </strong> = <i>Northward Water
<p> Velocity
<p> </i> = northward_sea_water_velocity
</ul>
</ul>
*/
java.util.List<ThreddsMetadata.VariableGroup> vars = ds.getVariables();
if (vars.size() > 0) {
out.format("<h3>Variables:</h3>%n<ul>%n");
for (ThreddsMetadata.VariableGroup t : vars) {
out.format("<li><em>Vocabulary</em> [");
if (t.getVocabUri() != null) {
ThreddsMetadata.UriResolved uri = t.getVocabUri();
String vocabLink = resolveRelativeUrls ? makeHref(uri.resolved.toString(), null, t.getVocabulary()) : makeHref(uri.href, null, t.getVocabulary());
out.format(vocabLink);
} else {
out.format(htmlEscaper.escape(t.getVocabulary()));
}
out.format("]:%n<ul>%n");
java.util.List<ThreddsMetadata.Variable> vlist = t.getVariableList();
if (vlist.size() > 0) {
for (ThreddsMetadata.Variable v : vlist) {
String units = (v.getUnits() == null || v.getUnits().length() == 0) ? "" : " (" + v.getUnits() + ") ";
out.format(" <li><strong>%s</strong> = ", htmlEscaper.escape(v.getName() + units));
if (v.getDescription() != null)
out.format(" <i>%s</i> = ", htmlEscaper.escape(v.getDescription()));
if (v.getVocabularyName() != null)
out.format("%s", htmlEscaper.escape(v.getVocabularyName()));
out.format("%n");
}
}
out.format("</ul>%n");
}
out.format("</ul>%n");
}
// LOOK what about VariableMapLink string ??
if (ds.getVariableMapLink() != null) {
out.format("<h3>Variables:</h3>%n");
ThreddsMetadata.UriResolved uri = ds.getVariableMapLink();
out.format("<ul><li>%s</li></ul>%n", makeHref(uri.resolved.toASCIIString(), null, "VariableMap"));
}
ThreddsMetadata.GeospatialCoverage gc = ds.getGeospatialCoverage();
if (gc != null) {
out.format("<h3>GeospatialCoverage:</h3>%n<ul>%n");
// if (gc.isGlobal()) out.format(" <li><em> Global </em>%n");
out.format(" <li><em> Longitude: </em> %s</li>%n", rangeString(gc.getEastWestRange()));
out.format(" <li><em> Latitude: </em> %s</li>%n", rangeString(gc.getNorthSouthRange()));
if (gc.getUpDownRange() != null) {
out.format(" <li><em> Altitude: </em> %s (positive is <strong>%s)</strong></li>%n", rangeString(gc.getUpDownRange()), gc.getZPositive());
}
java.util.List<ThreddsMetadata.Vocab> nlist = gc.getNames();
if ((nlist != null) && (nlist.size() > 0)) {
out.format(" <li><em> Names: </em> <ul>%n");
for (ThreddsMetadata.Vocab elem : nlist) {
out.format(" <li>%s</li>%n", htmlEscaper.escape(elem.getText()));
}
out.format(" </ul>%n");
}
out.format(" </ul>%n");
}
DateRange tc = ds.getTimeCoverage();
if (tc != null) {
out.format("<h3>TimeCoverage:</h3>%n<ul>%n");
DateType start = tc.getStart();
if (start != null)
out.format(" <li><em> Start: </em> %s</li>%n", start.toString());
DateType end = tc.getEnd();
if (end != null) {
out.format(" <li><em> End: </em> %s</li>%n", end.toString());
}
TimeDuration duration = tc.getDuration();
if (duration != null)
out.format(" <li><em> Duration: </em> %s</li>%n", htmlEscaper.escape(duration.toString()));
TimeDuration resolution = tc.getResolution();
if (resolution != null) {
out.format(" <li><em> Resolution: </em> %s</li>%n", htmlEscaper.escape(resolution.toString()));
}
out.format(" </ul>%n");
}
java.util.List<ThreddsMetadata.MetadataOther> metadata = ds.getMetadataOther();
boolean gotSomeMetadata = false;
for (ThreddsMetadata.MetadataOther m : metadata) {
if (m.getXlinkHref() != null) gotSomeMetadata = true;
}
if (gotSomeMetadata) {
out.format("<h3>Metadata:</h3>%n<ul>%n");
for (ThreddsMetadata.MetadataOther m : metadata) {
String type = (m.getType() == null) ? "" : m.getType();
if (m.getXlinkHref() != null) {
String title = (m.getTitle() == null) ? "Type " + type : m.getTitle();
String mdLink = resolveRelativeUrls ? makeHrefResolve(ds, m.getXlinkHref(), title) : makeHref(m.getXlinkHref(), null, title);
out.format(" <li> %s</li>%n", mdLink);
} //else {
//out.format(" <li> <pre>"+m.getMetadataType()+" "+m.getContentObject()+"</pre>%n");
//}
}
out.format("</ul>%n");
}
java.util.List<Property> propsOrg = ds.getProperties();
java.util.List<Property> props = new ArrayList<>(ds.getProperties().size());
for (Property p : propsOrg) {
if (!p.getName().startsWith("viewer")) // eliminate the viewer properties from the html view
props.add(p);
}
if (props.size() > 0) {
out.format("<h3>Properties:</h3>%n<ul>%n");
for (Property p : props) {
if (p.getName().equals("attachments")) { // LOOK whats this ?
String attachLink = resolveRelativeUrls ? makeHrefResolve(ds, p.getValue(), p.getName()) : makeHref(p.getValue(), null, p.getName());
out.format(" <li>%s</li>%n", attachLink);
} else {
out.format(" <li>%s = \"%s\"</li>%n", htmlEscaper.escape(p.getName()), htmlEscaper.escape(p.getValue()));
}
}
out.format("</ul>%n");
}
if (complete) out.format("</body></html>");
} } | public class class_name {
public void writeHtmlDescription(Formatter out, Dataset ds,
boolean complete, boolean isServer,
boolean datasetEvents, boolean catrefEvents,
boolean resolveRelativeUrls) {
if (ds == null) return;
if (complete) {
out.format("<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"%n"); // depends on control dependency: [if], data = [none]
out.format(" \"http://www.w3.org/TR/html4/loose.dtd\">%n");
out.format("<html>%n"); // depends on control dependency: [if], data = [none]
out.format("<head>%n"); // depends on control dependency: [if], data = [none]
out.format("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">%n"); // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
out.format("</head>%n"); // depends on control dependency: [if], data = [none]
out.format("<body>%n"); // depends on control dependency: [if], data = [none]
}
out.format("<h2>Dataset: %s</h2>%n<ul>", ds.getName());
if (ds.getDataFormatName() != null)
out.format(" <li><em>Data format: </em>%s</li>%n", htmlEscaper.escape(ds.getDataFormatName()));
if ((ds.getDataSize() > 0))
out.format(" <li><em>Data size: </em>%s</li>%n", Format.formatByteSize(ds.getDataSize()));
if (ds.getFeatureTypeName() != null)
out.format(" <li><em>Feature type: </em>%s</li>%n", htmlEscaper.escape(ds.getFeatureTypeName()));
if (ds.getCollectionType() != null)
out.format(" <li><em>Collection type: </em>%s</li>%n", htmlEscaper.escape(ds.getCollectionType()));
if (ds.isHarvest())
out.format(" <li><em>Harvest:</em> true</li>%n");
if (ds.getAuthority() != null)
out.format(" <li><em>Naming Authority: </em>%s</li>%n%n", htmlEscaper.escape(ds.getAuthority()));
if (ds.getId() != null)
out.format(" <li><em>ID: </em>%s</li>%n", htmlEscaper.escape(ds.getId()));
if (ds.getRestrictAccess() != null)
out.format(" <li><em>RestrictAccess: </em>%s</li>%n", htmlEscaper.escape(ds.getRestrictAccess()));
if (ds instanceof CatalogRef) {
CatalogRef catref = (CatalogRef) ds;
String href = resolveRelativeUrls | catrefEvents ? resolve(ds, catref.getXlinkHref()) : catref.getXlinkHref();
if (catrefEvents) href = "catref:" + href;
out.format(" <li><em>CatalogRef: </em>%s</li>%n", makeHref(href, null, null)); // depends on control dependency: [if], data = [none]
}
out.format("</ul>%n");
java.util.List<Documentation> docs = ds.getDocumentation();
if (docs.size() > 0) {
out.format("<h3>Documentation:</h3>%n<ul>%n"); // depends on control dependency: [if], data = [none]
for (Documentation doc : docs) {
String type = (doc.getType() == null) ? "" : "<strong>" + htmlEscaper.escape(doc.getType()) + ":</strong> ";
String inline = doc.getInlineContent();
if ((inline != null) && (inline.length() > 0))
out.format(" <li>%s %s</li>%n", type, htmlEscaper.escape(inline));
if (doc.hasXlink()) {
out.format(" <li>%s %s</li>%n", type, makeHref(doc.getXlinkHref(), null, doc.getXlinkTitle())); // depends on control dependency: [if], data = [none]
}
}
out.format("</ul>%n"); // depends on control dependency: [if], data = [none]
}
java.util.List<Access> access = ds.getAccess();
if (access.size() > 0) {
out.format("<h3>Access:</h3>%n<ol>%n"); // depends on control dependency: [if], data = [none]
for (Access a : access) {
Service s = a.getService();
String urlString = resolveRelativeUrls || datasetEvents ? a.getStandardUrlName() : a.getUnresolvedUrlName();
String queryString = null;
// String fullUrlString = urlString;
if (datasetEvents) urlString = "dataset:" + urlString;
ServiceType stype = s.getType();
if (isServer && stype != null)
switch (stype) {
case OPENDAP:
case DODS:
urlString = urlString + ".html";
break;
case DAP4:
urlString = urlString + ".dmr.xml";
break;
case WCS:
queryString = "service=WCS&version=1.0.0&request=GetCapabilities";
break;
case WMS:
queryString = "service=WMS&version=1.3.0&request=GetCapabilities";
break;
case NCML:
case UDDC:
case ISO:
String catalogUrl = ds.getCatalogUrl();
String datasetId = ds.getId();
if (catalogUrl != null && datasetId != null) {
if (catalogUrl.indexOf('#') > 0)
catalogUrl = catalogUrl.substring(0, catalogUrl.lastIndexOf('#'));
/* try {
catalogUrl = URLEncoder.encode(catalogUrl, "UTF-8");
datasetId = URLEncoder.encode(datasetId, "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
} */
queryString = "catalog=" + urlParamEscaper.escape(catalogUrl) + "&dataset=" + urlParamEscaper.escape(datasetId); // depends on control dependency: [if], data = [(catalogUrl]
}
break;
case NetcdfSubset:
urlString = urlString + "/dataset.html";
break;
case CdmRemote:
queryString = "req=cdl";
break;
case CdmrFeature:
queryString = "req=form";
}
out.format(" <li> <b>%s: </b>%s</li>%n", s.getServiceTypeName(), makeHref(urlString, queryString, null)); // depends on control dependency: [for], data = [a]
}
out.format("</ol>%n"); // depends on control dependency: [if], data = [none]
}
java.util.List<ThreddsMetadata.Contributor> contributors = ds.getContributors();
if (contributors.size() > 0) {
out.format("<h3>Contributors:</h3>%n<ul>%n"); // depends on control dependency: [if], data = [none]
for (ThreddsMetadata.Contributor t : contributors) {
String role = (t.getRole() == null) ? "" : "<strong> (" + htmlEscaper.escape(t.getRole()) + ")</strong> ";
out.format(" <li>%s %s</li>%n", htmlEscaper.escape(t.getName()), role);
}
out.format("</ul>%n"); // depends on control dependency: [if], data = [none]
}
java.util.List<ThreddsMetadata.Vocab> keywords = ds.getKeywords();
if (keywords.size() > 0) {
out.format("<h3>Keywords:</h3>%n<ul>%n"); // depends on control dependency: [if], data = [none]
for (ThreddsMetadata.Vocab t : keywords) {
String vocab = (t.getVocabulary() == null) ? "" : " <strong>(" + htmlEscaper.escape(t.getVocabulary()) + ")</strong> ";
out.format(" <li>%s %s</li>%n", htmlEscaper.escape(t.getText()), vocab);
}
out.format("</ul>%n"); // depends on control dependency: [if], data = [none]
}
java.util.List<DateType> dates = ds.getDates();
if (dates.size() > 0) {
out.format("<h3>Dates:</h3>%n<ul>%n"); // depends on control dependency: [if], data = [none]
for (DateType d : dates) {
String type = (d.getType() == null) ? "" : " <strong>(" + htmlEscaper.escape(d.getType()) + ")</strong> ";
out.format(" <li>%s %s</li>%n", htmlEscaper.escape(d.getText()), type);
}
out.format("</ul>%n"); // depends on control dependency: [if], data = [none]
}
java.util.List<ThreddsMetadata.Vocab> projects = ds.getProjects();
if (projects.size() > 0) {
out.format("<h3>Projects:</h3>%n<ul>%n"); // depends on control dependency: [if], data = [none]
for (ThreddsMetadata.Vocab t : projects) {
String vocab = (t.getVocabulary() == null) ? "" : " <strong>(" + htmlEscaper.escape(t.getVocabulary()) + ")</strong> ";
out.format(" <li>%s %s</li>%n", htmlEscaper.escape(t.getText()), vocab);
}
out.format("</ul>%n"); // depends on control dependency: [if], data = [none]
}
java.util.List<ThreddsMetadata.Source> creators = ds.getCreators();
if (creators.size() > 0) {
out.format("<h3>Creators:</h3>%n<ul>%n"); // depends on control dependency: [if], data = [none]
for (ThreddsMetadata.Source t : creators) {
out.format(" <li><strong>%s</strong><ul>%n", htmlEscaper.escape(t.getName())); // depends on control dependency: [for], data = [t]
out.format(" <li><em>email: </em>%s</li>%n", htmlEscaper.escape(t.getEmail())); // depends on control dependency: [for], data = [t]
if (t.getUrl() != null) {
String newUrl = resolveRelativeUrls ? makeHrefResolve(ds, t.getUrl(), null) : makeHref(t.getUrl(), null, null);
out.format(" <li> <em>%s</em></li>%n", newUrl); // depends on control dependency: [if], data = [none]
}
out.format(" </ul></li>%n"); // depends on control dependency: [for], data = [t]
}
out.format("</ul>%n"); // depends on control dependency: [if], data = [none]
}
java.util.List<ThreddsMetadata.Source> publishers = ds.getPublishers();
if (publishers.size() > 0) {
out.format("<h3>Publishers:</h3>%n<ul>%n"); // depends on control dependency: [if], data = [none]
for (ThreddsMetadata.Source t : publishers) {
out.format(" <li><strong>%s</strong><ul>%n", htmlEscaper.escape(t.getName())); // depends on control dependency: [for], data = [t]
out.format(" <li><em>email: </em>%s%n", htmlEscaper.escape(t.getEmail())); // depends on control dependency: [for], data = [t]
if (t.getUrl() != null) {
String urlLink = resolveRelativeUrls ? makeHrefResolve(ds, t.getUrl(), null) : makeHref(t.getUrl(), null, null);
out.format(" <li> <em>%s</em></li>%n", urlLink); // depends on control dependency: [if], data = [none]
}
out.format(" </ul>%n"); // depends on control dependency: [for], data = [t]
}
out.format("</ul>%n"); // depends on control dependency: [if], data = [none]
}
/*
4.2:
<h3>Variables:</h3>
<ul>
<li><em>Vocabulary</em> [DIF]:
<ul>
<li><strong>Reflectivity</strong> = <i></i> = EARTH SCIENCE > Spectral/Engineering > Radar > Radar Reflectivity (db)
<li><strong>Velocity</strong> = <i></i> = EARTH SCIENCE > Spectral/Engineering > Radar > Doppler Velocity (m/s)
<li><strong>SpectrumWidth</strong> = <i></i> = EARTH SCIENCE > Spectral/Engineering > Radar > Doppler Spectrum Width (m/s)
</ul>
</ul>
</ul>
4.3:
<h3>Variables:</h3>
<ul>
<li><em>Vocabulary</em> [CF-1.0]:
<ul>
<li><strong>d3d (meters) </strong> = <i>3D Depth at Nodes
<p> </i> = depth_at_nodes
<li><strong>depth (meters) </strong> = <i>Bathymetry</i> = depth
<li><strong>eta (m) </strong> = <i></i> =
<li><strong>temp (Celsius) </strong> = <i>Temperature
<p> </i> = sea_water_temperature
<li><strong>u (m/s) </strong> = <i>Eastward Water
<p> Velocity
<p> </i> = eastward_sea_water_velocity
<li><strong>v (m/s) </strong> = <i>Northward Water
<p> Velocity
<p> </i> = northward_sea_water_velocity
</ul>
</ul>
*/
java.util.List<ThreddsMetadata.VariableGroup> vars = ds.getVariables();
if (vars.size() > 0) {
out.format("<h3>Variables:</h3>%n<ul>%n"); // depends on control dependency: [if], data = [none]
for (ThreddsMetadata.VariableGroup t : vars) {
out.format("<li><em>Vocabulary</em> ["); // depends on control dependency: [for], data = [t]
if (t.getVocabUri() != null) {
ThreddsMetadata.UriResolved uri = t.getVocabUri();
String vocabLink = resolveRelativeUrls ? makeHref(uri.resolved.toString(), null, t.getVocabulary()) : makeHref(uri.href, null, t.getVocabulary());
out.format(vocabLink); // depends on control dependency: [if], data = [none]
} else {
out.format(htmlEscaper.escape(t.getVocabulary())); // depends on control dependency: [if], data = [none]
}
out.format("]:%n<ul>%n"); // depends on control dependency: [for], data = [t]
java.util.List<ThreddsMetadata.Variable> vlist = t.getVariableList();
if (vlist.size() > 0) {
for (ThreddsMetadata.Variable v : vlist) {
String units = (v.getUnits() == null || v.getUnits().length() == 0) ? "" : " (" + v.getUnits() + ") ";
out.format(" <li><strong>%s</strong> = ", htmlEscaper.escape(v.getName() + units)); // depends on control dependency: [for], data = [v]
if (v.getDescription() != null)
out.format(" <i>%s</i> = ", htmlEscaper.escape(v.getDescription()));
if (v.getVocabularyName() != null)
out.format("%s", htmlEscaper.escape(v.getVocabularyName()));
out.format("%n"); // depends on control dependency: [for], data = [none]
}
}
out.format("</ul>%n"); // depends on control dependency: [for], data = [t]
}
out.format("</ul>%n"); // depends on control dependency: [if], data = [none]
}
// LOOK what about VariableMapLink string ??
if (ds.getVariableMapLink() != null) {
out.format("<h3>Variables:</h3>%n"); // depends on control dependency: [if], data = [none]
ThreddsMetadata.UriResolved uri = ds.getVariableMapLink();
out.format("<ul><li>%s</li></ul>%n", makeHref(uri.resolved.toASCIIString(), null, "VariableMap")); // depends on control dependency: [if], data = [none]
}
ThreddsMetadata.GeospatialCoverage gc = ds.getGeospatialCoverage();
if (gc != null) {
out.format("<h3>GeospatialCoverage:</h3>%n<ul>%n"); // depends on control dependency: [if], data = [none]
// if (gc.isGlobal()) out.format(" <li><em> Global </em>%n");
out.format(" <li><em> Longitude: </em> %s</li>%n", rangeString(gc.getEastWestRange())); // depends on control dependency: [if], data = [(gc]
out.format(" <li><em> Latitude: </em> %s</li>%n", rangeString(gc.getNorthSouthRange())); // depends on control dependency: [if], data = [(gc]
if (gc.getUpDownRange() != null) {
out.format(" <li><em> Altitude: </em> %s (positive is <strong>%s)</strong></li>%n", rangeString(gc.getUpDownRange()), gc.getZPositive()); // depends on control dependency: [if], data = [none]
}
java.util.List<ThreddsMetadata.Vocab> nlist = gc.getNames();
if ((nlist != null) && (nlist.size() > 0)) {
out.format(" <li><em> Names: </em> <ul>%n"); // depends on control dependency: [if], data = [none]
for (ThreddsMetadata.Vocab elem : nlist) {
out.format(" <li>%s</li>%n", htmlEscaper.escape(elem.getText())); // depends on control dependency: [for], data = [elem]
}
out.format(" </ul>%n"); // depends on control dependency: [if], data = [none]
}
out.format(" </ul>%n"); // depends on control dependency: [if], data = [none]
}
DateRange tc = ds.getTimeCoverage();
if (tc != null) {
out.format("<h3>TimeCoverage:</h3>%n<ul>%n"); // depends on control dependency: [if], data = [none]
DateType start = tc.getStart();
if (start != null)
out.format(" <li><em> Start: </em> %s</li>%n", start.toString());
DateType end = tc.getEnd();
if (end != null) {
out.format(" <li><em> End: </em> %s</li>%n", end.toString()); // depends on control dependency: [if], data = [none]
}
TimeDuration duration = tc.getDuration();
if (duration != null)
out.format(" <li><em> Duration: </em> %s</li>%n", htmlEscaper.escape(duration.toString()));
TimeDuration resolution = tc.getResolution();
if (resolution != null) {
out.format(" <li><em> Resolution: </em> %s</li>%n", htmlEscaper.escape(resolution.toString())); // depends on control dependency: [if], data = [(resolution]
}
out.format(" </ul>%n"); // depends on control dependency: [if], data = [none]
}
java.util.List<ThreddsMetadata.MetadataOther> metadata = ds.getMetadataOther();
boolean gotSomeMetadata = false;
for (ThreddsMetadata.MetadataOther m : metadata) {
if (m.getXlinkHref() != null) gotSomeMetadata = true;
}
if (gotSomeMetadata) {
out.format("<h3>Metadata:</h3>%n<ul>%n"); // depends on control dependency: [if], data = [none]
for (ThreddsMetadata.MetadataOther m : metadata) {
String type = (m.getType() == null) ? "" : m.getType();
if (m.getXlinkHref() != null) {
String title = (m.getTitle() == null) ? "Type " + type : m.getTitle();
String mdLink = resolveRelativeUrls ? makeHrefResolve(ds, m.getXlinkHref(), title) : makeHref(m.getXlinkHref(), null, title);
out.format(" <li> %s</li>%n", mdLink); // depends on control dependency: [if], data = [none]
} //else {
//out.format(" <li> <pre>"+m.getMetadataType()+" "+m.getContentObject()+"</pre>%n");
//}
}
out.format("</ul>%n"); // depends on control dependency: [if], data = [none]
}
java.util.List<Property> propsOrg = ds.getProperties();
java.util.List<Property> props = new ArrayList<>(ds.getProperties().size());
for (Property p : propsOrg) {
if (!p.getName().startsWith("viewer")) // eliminate the viewer properties from the html view
props.add(p);
}
if (props.size() > 0) {
out.format("<h3>Properties:</h3>%n<ul>%n"); // depends on control dependency: [if], data = [none]
for (Property p : props) {
if (p.getName().equals("attachments")) { // LOOK whats this ?
String attachLink = resolveRelativeUrls ? makeHrefResolve(ds, p.getValue(), p.getName()) : makeHref(p.getValue(), null, p.getName());
out.format(" <li>%s</li>%n", attachLink); // depends on control dependency: [if], data = [none]
} else {
out.format(" <li>%s = \"%s\"</li>%n", htmlEscaper.escape(p.getName()), htmlEscaper.escape(p.getValue())); // depends on control dependency: [if], data = [none]
}
}
out.format("</ul>%n"); // depends on control dependency: [if], data = [none]
}
if (complete) out.format("</body></html>");
} } |
public class class_name {
public void marshall(RegisterOnPremisesInstanceRequest registerOnPremisesInstanceRequest, ProtocolMarshaller protocolMarshaller) {
if (registerOnPremisesInstanceRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(registerOnPremisesInstanceRequest.getInstanceName(), INSTANCENAME_BINDING);
protocolMarshaller.marshall(registerOnPremisesInstanceRequest.getIamSessionArn(), IAMSESSIONARN_BINDING);
protocolMarshaller.marshall(registerOnPremisesInstanceRequest.getIamUserArn(), IAMUSERARN_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(RegisterOnPremisesInstanceRequest registerOnPremisesInstanceRequest, ProtocolMarshaller protocolMarshaller) {
if (registerOnPremisesInstanceRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(registerOnPremisesInstanceRequest.getInstanceName(), INSTANCENAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(registerOnPremisesInstanceRequest.getIamSessionArn(), IAMSESSIONARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(registerOnPremisesInstanceRequest.getIamUserArn(), IAMUSERARN_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static byte[] gzip(String input) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
GZIPOutputStream gzos = null;
try {
gzos = new GZIPOutputStream(baos);
gzos.write(input.getBytes("UTF-8"));
} catch (IOException e) {
e.printStackTrace();
} finally {
if (gzos != null) {
try {
gzos.close();
} catch (IOException ignore) {
}
}
}
return baos.toByteArray();
} } | public class class_name {
public static byte[] gzip(String input) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
GZIPOutputStream gzos = null;
try {
gzos = new GZIPOutputStream(baos); // depends on control dependency: [try], data = [none]
gzos.write(input.getBytes("UTF-8")); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
e.printStackTrace();
} finally { // depends on control dependency: [catch], data = [none]
if (gzos != null) {
try {
gzos.close(); // depends on control dependency: [try], data = [none]
} catch (IOException ignore) {
} // depends on control dependency: [catch], data = [none]
}
}
return baos.toByteArray();
} } |
public class class_name {
public static Set<MediaType> set(String... types) {
Set<MediaType> set = new HashSet<MediaType>();
for (String type : types) {
MediaType mt = parse(type);
if (mt != null) {
set.add(mt);
}
}
return Collections.unmodifiableSet(set);
} } | public class class_name {
public static Set<MediaType> set(String... types) {
Set<MediaType> set = new HashSet<MediaType>();
for (String type : types) {
MediaType mt = parse(type);
if (mt != null) {
set.add(mt); // depends on control dependency: [if], data = [(mt]
}
}
return Collections.unmodifiableSet(set);
} } |
public class class_name {
static Set<DagNode<JobExecutionPlan>> getNext(Dag<JobExecutionPlan> dag) {
Set<DagNode<JobExecutionPlan>> nextNodesToExecute = new HashSet<>();
LinkedList<DagNode<JobExecutionPlan>> nodesToExpand = Lists.newLinkedList(dag.getStartNodes());
FailureOption failureOption = getFailureOption(dag);
while (!nodesToExpand.isEmpty()) {
DagNode<JobExecutionPlan> node = nodesToExpand.poll();
ExecutionStatus executionStatus = getExecutionStatus(node);
boolean addFlag = true;
if (executionStatus == ExecutionStatus.$UNKNOWN) {
//Add a node to be executed next, only if all of its parent nodes are COMPLETE.
List<DagNode<JobExecutionPlan>> parentNodes = dag.getParents(node);
for (DagNode<JobExecutionPlan> parentNode : parentNodes) {
if (getExecutionStatus(parentNode) != ExecutionStatus.COMPLETE) {
addFlag = false;
break;
}
}
if (addFlag) {
nextNodesToExecute.add(node);
}
} else if (executionStatus == ExecutionStatus.COMPLETE) {
//Explore the children of COMPLETED node as next candidates for execution.
nodesToExpand.addAll(dag.getChildren(node));
} else if ((executionStatus == ExecutionStatus.FAILED) || (executionStatus == ExecutionStatus.CANCELLED)) {
switch (failureOption) {
case FINISH_RUNNING:
return new HashSet<>();
case FINISH_ALL_POSSIBLE:
default:
break;
}
}
}
return nextNodesToExecute;
} } | public class class_name {
static Set<DagNode<JobExecutionPlan>> getNext(Dag<JobExecutionPlan> dag) {
Set<DagNode<JobExecutionPlan>> nextNodesToExecute = new HashSet<>();
LinkedList<DagNode<JobExecutionPlan>> nodesToExpand = Lists.newLinkedList(dag.getStartNodes());
FailureOption failureOption = getFailureOption(dag);
while (!nodesToExpand.isEmpty()) {
DagNode<JobExecutionPlan> node = nodesToExpand.poll();
ExecutionStatus executionStatus = getExecutionStatus(node);
boolean addFlag = true;
if (executionStatus == ExecutionStatus.$UNKNOWN) {
//Add a node to be executed next, only if all of its parent nodes are COMPLETE.
List<DagNode<JobExecutionPlan>> parentNodes = dag.getParents(node);
for (DagNode<JobExecutionPlan> parentNode : parentNodes) {
if (getExecutionStatus(parentNode) != ExecutionStatus.COMPLETE) {
addFlag = false; // depends on control dependency: [if], data = [none]
break;
}
}
if (addFlag) {
nextNodesToExecute.add(node); // depends on control dependency: [if], data = [none]
}
} else if (executionStatus == ExecutionStatus.COMPLETE) {
//Explore the children of COMPLETED node as next candidates for execution.
nodesToExpand.addAll(dag.getChildren(node)); // depends on control dependency: [if], data = [none]
} else if ((executionStatus == ExecutionStatus.FAILED) || (executionStatus == ExecutionStatus.CANCELLED)) {
switch (failureOption) {
case FINISH_RUNNING:
return new HashSet<>();
case FINISH_ALL_POSSIBLE:
default:
break;
}
}
}
return nextNodesToExecute;
} } |
public class class_name {
public synchronized String requestBlock(String name) {
if (blocks.isEmpty()) {
return "exit";
}
remainingBlocks.decrementAndGet();
return blocks.poll().createResponse();
} } | public class class_name {
public synchronized String requestBlock(String name) {
if (blocks.isEmpty()) {
return "exit"; // depends on control dependency: [if], data = [none]
}
remainingBlocks.decrementAndGet();
return blocks.poll().createResponse();
} } |
public class class_name {
public long get(K key)
{
if (key == null)
return _nullValue;
int hash = key.hashCode() & _mask;
while (true) {
K mapKey = _keys[hash];
if (mapKey == key)
return _values[hash];
else if (mapKey == null) {
if ((_flags[hash] & DELETED) == 0)
return NULL;
}
else if (mapKey.equals(key))
return _values[hash];
hash = (hash + 1) & _mask;
}
} } | public class class_name {
public long get(K key)
{
if (key == null)
return _nullValue;
int hash = key.hashCode() & _mask;
while (true) {
K mapKey = _keys[hash];
if (mapKey == key)
return _values[hash];
else if (mapKey == null) {
if ((_flags[hash] & DELETED) == 0)
return NULL;
}
else if (mapKey.equals(key))
return _values[hash];
hash = (hash + 1) & _mask; // depends on control dependency: [while], data = [none]
}
} } |
public class class_name {
public DescribeRegionsResult withRegions(Region... regions) {
if (this.regions == null) {
setRegions(new com.amazonaws.internal.SdkInternalList<Region>(regions.length));
}
for (Region ele : regions) {
this.regions.add(ele);
}
return this;
} } | public class class_name {
public DescribeRegionsResult withRegions(Region... regions) {
if (this.regions == null) {
setRegions(new com.amazonaws.internal.SdkInternalList<Region>(regions.length)); // depends on control dependency: [if], data = [none]
}
for (Region ele : regions) {
this.regions.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
public String print(GraphQLSchema schema) {
StringWriter sw = new StringWriter();
PrintWriter out = new PrintWriter(sw);
GraphqlFieldVisibility visibility = schema.getCodeRegistry().getFieldVisibility();
printer(schema.getClass()).print(out, schema, visibility);
List<GraphQLType> typesAsList = schema.getAllTypesAsList()
.stream()
.sorted(Comparator.comparing(GraphQLType::getName))
.collect(toList());
printType(out, typesAsList, GraphQLInterfaceType.class, visibility);
printType(out, typesAsList, GraphQLUnionType.class, visibility);
printType(out, typesAsList, GraphQLObjectType.class, visibility);
printType(out, typesAsList, GraphQLEnumType.class, visibility);
printType(out, typesAsList, GraphQLScalarType.class, visibility);
printType(out, typesAsList, GraphQLInputObjectType.class, visibility);
String result = sw.toString();
if (result.endsWith("\n\n")) {
result = result.substring(0, result.length() - 1);
}
return result;
} } | public class class_name {
public String print(GraphQLSchema schema) {
StringWriter sw = new StringWriter();
PrintWriter out = new PrintWriter(sw);
GraphqlFieldVisibility visibility = schema.getCodeRegistry().getFieldVisibility();
printer(schema.getClass()).print(out, schema, visibility);
List<GraphQLType> typesAsList = schema.getAllTypesAsList()
.stream()
.sorted(Comparator.comparing(GraphQLType::getName))
.collect(toList());
printType(out, typesAsList, GraphQLInterfaceType.class, visibility);
printType(out, typesAsList, GraphQLUnionType.class, visibility);
printType(out, typesAsList, GraphQLObjectType.class, visibility);
printType(out, typesAsList, GraphQLEnumType.class, visibility);
printType(out, typesAsList, GraphQLScalarType.class, visibility);
printType(out, typesAsList, GraphQLInputObjectType.class, visibility);
String result = sw.toString();
if (result.endsWith("\n\n")) {
result = result.substring(0, result.length() - 1); // depends on control dependency: [if], data = [none]
}
return result;
} } |
public class class_name {
public JSONObject wordSimEmbedding(String word1, String word2, HashMap<String, Object> options) {
AipRequest request = new AipRequest();
preOperation(request);
request.addBody("word_1", word1);
request.addBody("word_2", word2);
if (options != null) {
request.addBody(options);
}
request.setUri(NlpConsts.WORD_SIM_EMBEDDING);
request.addHeader(Headers.CONTENT_ENCODING, HttpCharacterEncoding.ENCODE_GBK);
request.addHeader(Headers.CONTENT_TYPE, HttpContentType.JSON_DATA);
request.setBodyFormat(EBodyFormat.RAW_JSON);
postOperation(request);
return requestServer(request);
} } | public class class_name {
public JSONObject wordSimEmbedding(String word1, String word2, HashMap<String, Object> options) {
AipRequest request = new AipRequest();
preOperation(request);
request.addBody("word_1", word1);
request.addBody("word_2", word2);
if (options != null) {
request.addBody(options); // depends on control dependency: [if], data = [(options]
}
request.setUri(NlpConsts.WORD_SIM_EMBEDDING);
request.addHeader(Headers.CONTENT_ENCODING, HttpCharacterEncoding.ENCODE_GBK);
request.addHeader(Headers.CONTENT_TYPE, HttpContentType.JSON_DATA);
request.setBodyFormat(EBodyFormat.RAW_JSON);
postOperation(request);
return requestServer(request);
} } |
public class class_name {
public static boolean isEmptyCollectionOrMap(Object obj) {
if (obj instanceof Collection) {
return ((Collection) obj).isEmpty();
}
return (obj instanceof Map && ((Map) obj).isEmpty());
} } | public class class_name {
public static boolean isEmptyCollectionOrMap(Object obj) {
if (obj instanceof Collection) {
return ((Collection) obj).isEmpty(); // depends on control dependency: [if], data = [none]
}
return (obj instanceof Map && ((Map) obj).isEmpty());
} } |
public class class_name {
public Optional<Long> maybeGetFileOffsetFor(DataDirectoryKey dataDirKey) {
Optional<DataDirEntry> dataDir = optHeader
.maybeGetDataDirEntry(dataDirKey);
if (dataDir.isPresent()) {
long rva = dataDir.get().getVirtualAddress();
return Optional.of(getFileOffset(rva));
}
return Optional.absent();
} } | public class class_name {
public Optional<Long> maybeGetFileOffsetFor(DataDirectoryKey dataDirKey) {
Optional<DataDirEntry> dataDir = optHeader
.maybeGetDataDirEntry(dataDirKey);
if (dataDir.isPresent()) {
long rva = dataDir.get().getVirtualAddress();
return Optional.of(getFileOffset(rva)); // depends on control dependency: [if], data = [none]
}
return Optional.absent();
} } |
public class class_name {
protected CmsJlanNetworkFile nextFile() {
if (!hasMoreFiles()) {
return null;
}
CmsJlanNetworkFile file = m_files.get(m_position);
m_position += 1;
return file;
} } | public class class_name {
protected CmsJlanNetworkFile nextFile() {
if (!hasMoreFiles()) {
return null;
// depends on control dependency: [if], data = [none]
}
CmsJlanNetworkFile file = m_files.get(m_position);
m_position += 1;
return file;
} } |
public class class_name {
public void shutdown(boolean clear) {
if (executionQueue != null) {
executionQueue.shutdownNow();
}
if (joynrInjector != null) {
// switch to lp receiver and call servlet shutdown to be able to receive responses
ServletMessageReceiver servletReceiver = joynrInjector.getInstance(ServletMessageReceiver.class);
servletReceiver.switchToLongPolling();
for (JoynrApplication app : apps) {
try {
app.shutdown();
} catch (Exception e) {
logger.debug("error shutting down app: " + app.getClass(), e);
}
}
servletReceiver.shutdown(clear);
}
try {
if (executionQueue != null) {
executionQueue.awaitTermination(timeout, TimeUnit.SECONDS);
}
} catch (InterruptedException e) {
return;
}
} } | public class class_name {
public void shutdown(boolean clear) {
if (executionQueue != null) {
executionQueue.shutdownNow(); // depends on control dependency: [if], data = [none]
}
if (joynrInjector != null) {
// switch to lp receiver and call servlet shutdown to be able to receive responses
ServletMessageReceiver servletReceiver = joynrInjector.getInstance(ServletMessageReceiver.class);
servletReceiver.switchToLongPolling(); // depends on control dependency: [if], data = [none]
for (JoynrApplication app : apps) {
try {
app.shutdown(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
logger.debug("error shutting down app: " + app.getClass(), e);
} // depends on control dependency: [catch], data = [none]
}
servletReceiver.shutdown(clear); // depends on control dependency: [if], data = [none]
}
try {
if (executionQueue != null) {
executionQueue.awaitTermination(timeout, TimeUnit.SECONDS); // depends on control dependency: [if], data = [none]
}
} catch (InterruptedException e) {
return;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void marshall(PresignedUrlConfig presignedUrlConfig, ProtocolMarshaller protocolMarshaller) {
if (presignedUrlConfig == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(presignedUrlConfig.getRoleArn(), ROLEARN_BINDING);
protocolMarshaller.marshall(presignedUrlConfig.getExpiresInSec(), EXPIRESINSEC_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(PresignedUrlConfig presignedUrlConfig, ProtocolMarshaller protocolMarshaller) {
if (presignedUrlConfig == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(presignedUrlConfig.getRoleArn(), ROLEARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(presignedUrlConfig.getExpiresInSec(), EXPIRESINSEC_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static Path decodePathFromReference(CheckpointStorageLocationReference reference) {
if (reference.isDefaultReference()) {
throw new IllegalArgumentException("Cannot decode default reference");
}
final byte[] bytes = reference.getReferenceBytes();
final int headerLen = REFERENCE_MAGIC_NUMBER.length;
if (bytes.length > headerLen) {
// compare magic number
for (int i = 0; i < headerLen; i++) {
if (bytes[i] != REFERENCE_MAGIC_NUMBER[i]) {
throw new IllegalArgumentException("Reference starts with the wrong magic number");
}
}
// covert to string and path
try {
return new Path(new String(bytes, headerLen, bytes.length - headerLen, StandardCharsets.UTF_8));
}
catch (Exception e) {
throw new IllegalArgumentException("Reference cannot be decoded to a path", e);
}
}
else {
throw new IllegalArgumentException("Reference too short.");
}
} } | public class class_name {
public static Path decodePathFromReference(CheckpointStorageLocationReference reference) {
if (reference.isDefaultReference()) {
throw new IllegalArgumentException("Cannot decode default reference");
}
final byte[] bytes = reference.getReferenceBytes();
final int headerLen = REFERENCE_MAGIC_NUMBER.length;
if (bytes.length > headerLen) {
// compare magic number
for (int i = 0; i < headerLen; i++) {
if (bytes[i] != REFERENCE_MAGIC_NUMBER[i]) {
throw new IllegalArgumentException("Reference starts with the wrong magic number");
}
}
// covert to string and path
try {
return new Path(new String(bytes, headerLen, bytes.length - headerLen, StandardCharsets.UTF_8)); // depends on control dependency: [try], data = [none]
}
catch (Exception e) {
throw new IllegalArgumentException("Reference cannot be decoded to a path", e);
} // depends on control dependency: [catch], data = [none]
}
else {
throw new IllegalArgumentException("Reference too short.");
}
} } |
public class class_name {
protected void logError(Exception e, boolean logToErrorChannel) {
if (logToErrorChannel) {
LOG.error(e.getLocalizedMessage(), e);
} else {
LOG.info(e.getLocalizedMessage(), e);
}
// if an error was logged make sure that the flag to schedule a reload is reset
setReloadScheduled(false);
} } | public class class_name {
protected void logError(Exception e, boolean logToErrorChannel) {
if (logToErrorChannel) {
LOG.error(e.getLocalizedMessage(), e);
// depends on control dependency: [if], data = [none]
} else {
LOG.info(e.getLocalizedMessage(), e);
// depends on control dependency: [if], data = [none]
}
// if an error was logged make sure that the flag to schedule a reload is reset
setReloadScheduled(false);
} } |
public class class_name {
public void exhaust(Long pipelineId) {
Assert.notNull(pipelineId);
TerminMonitor terminMonitor = ArbitrateFactory.getInstance(pipelineId, TerminMonitor.class);
int size = terminMonitor.size();
try {
for (int i = 0; i < size; i++) {
Long processId;
processId = terminMonitor.waitForProcess();
TerminEventData data = new TerminEventData();
data.setPipelineId(pipelineId);
data.setProcessId(processId);
ack(data);
}
} catch (InterruptedException e) {
throw new ArbitrateException(e);
}
} } | public class class_name {
public void exhaust(Long pipelineId) {
Assert.notNull(pipelineId);
TerminMonitor terminMonitor = ArbitrateFactory.getInstance(pipelineId, TerminMonitor.class);
int size = terminMonitor.size();
try {
for (int i = 0; i < size; i++) {
Long processId;
processId = terminMonitor.waitForProcess(); // depends on control dependency: [for], data = [none]
TerminEventData data = new TerminEventData();
data.setPipelineId(pipelineId); // depends on control dependency: [for], data = [none]
data.setProcessId(processId); // depends on control dependency: [for], data = [none]
ack(data); // depends on control dependency: [for], data = [none]
}
} catch (InterruptedException e) {
throw new ArbitrateException(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public String getCanonicalTypeName(Object object) {
ensureNotNull("object", object);
for (TypeDetector typeDetector : typeDetectors) {
if (typeDetector.canHandle(object)) {
return typeDetector.detectType(object);
}
}
throw LOG.unableToDetectCanonicalType(object);
} } | public class class_name {
public String getCanonicalTypeName(Object object) {
ensureNotNull("object", object);
for (TypeDetector typeDetector : typeDetectors) {
if (typeDetector.canHandle(object)) {
return typeDetector.detectType(object); // depends on control dependency: [if], data = [none]
}
}
throw LOG.unableToDetectCanonicalType(object);
} } |
public class class_name {
public Vector3 findClosePoint(Vector3 pointToDelete) {
Triangle triangle = find(pointToDelete);
Vector3 p1 = triangle.p1();
Vector3 p2 = triangle.p2();
double d1 = distanceXY(p1, pointToDelete);
double d2 = distanceXY(p2, pointToDelete);
if(triangle.isHalfplane()) {
if(d1<=d2) {
return p1;
}
else {
return p2;
}
} else {
Vector3 p3 = triangle.p3();
double d3 = distanceXY(p3, pointToDelete);
if(d1<=d2 && d1<=d3) {
return p1;
}
else if(d2<=d1 && d2<=d3) {
return p2;
}
else {
return p3;
}
}
} } | public class class_name {
public Vector3 findClosePoint(Vector3 pointToDelete) {
Triangle triangle = find(pointToDelete);
Vector3 p1 = triangle.p1();
Vector3 p2 = triangle.p2();
double d1 = distanceXY(p1, pointToDelete);
double d2 = distanceXY(p2, pointToDelete);
if(triangle.isHalfplane()) {
if(d1<=d2) {
return p1;
// depends on control dependency: [if], data = [none]
}
else {
return p2;
// depends on control dependency: [if], data = [none]
}
} else {
Vector3 p3 = triangle.p3();
double d3 = distanceXY(p3, pointToDelete);
if(d1<=d2 && d1<=d3) {
return p1;
// depends on control dependency: [if], data = [none]
}
else if(d2<=d1 && d2<=d3) {
return p2;
// depends on control dependency: [if], data = [none]
}
else {
return p3;
// depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public static Map<String, Set<InetAddress>> getNetworkInterfaceAddresses(boolean includeLoopback) {
//JVM returns interfaces in a non-predictable order, so to make this more predictable
//let's have them sort by interface name (by using a TreeMap).
Map<String, Set<InetAddress>> interfaceAddressMap = new TreeMap<>();
try {
Enumeration ifaces = NetworkInterface.getNetworkInterfaces();
while (ifaces.hasMoreElements()) {
NetworkInterface iface = (NetworkInterface) ifaces.nextElement();
//We only care about usable interfaces.
if (!iface.isUp()) {
continue;
}
if (!includeLoopback && iface.isLoopback()) {
continue;
}
String name = iface.getName();
Enumeration<InetAddress> ifaceAdresses = iface.getInetAddresses();
while (ifaceAdresses.hasMoreElements()) {
InetAddress ia = ifaceAdresses.nextElement();
if (!includeLoopback && ia.isLoopbackAddress()) {
continue;
}
// We want to filter out mac addresses
// Let's filter out docker interfaces too
if (!ia.getHostAddress().contains(":") && !(name != null && name.toLowerCase().contains("docker"))) {
Set<InetAddress> addresses = interfaceAddressMap.get(name);
if (addresses == null) {
addresses = new LinkedHashSet<>();
}
addresses.add(ia);
interfaceAddressMap.put(name, addresses);
}
}
}
} catch (SocketException ex) {
//noop
}
return interfaceAddressMap;
} } | public class class_name {
public static Map<String, Set<InetAddress>> getNetworkInterfaceAddresses(boolean includeLoopback) {
//JVM returns interfaces in a non-predictable order, so to make this more predictable
//let's have them sort by interface name (by using a TreeMap).
Map<String, Set<InetAddress>> interfaceAddressMap = new TreeMap<>();
try {
Enumeration ifaces = NetworkInterface.getNetworkInterfaces();
while (ifaces.hasMoreElements()) {
NetworkInterface iface = (NetworkInterface) ifaces.nextElement();
//We only care about usable interfaces.
if (!iface.isUp()) {
continue;
}
if (!includeLoopback && iface.isLoopback()) {
continue;
}
String name = iface.getName();
Enumeration<InetAddress> ifaceAdresses = iface.getInetAddresses();
while (ifaceAdresses.hasMoreElements()) {
InetAddress ia = ifaceAdresses.nextElement();
if (!includeLoopback && ia.isLoopbackAddress()) {
continue;
}
// We want to filter out mac addresses
// Let's filter out docker interfaces too
if (!ia.getHostAddress().contains(":") && !(name != null && name.toLowerCase().contains("docker"))) {
Set<InetAddress> addresses = interfaceAddressMap.get(name);
if (addresses == null) {
addresses = new LinkedHashSet<>(); // depends on control dependency: [if], data = [none]
}
addresses.add(ia); // depends on control dependency: [if], data = [none]
interfaceAddressMap.put(name, addresses); // depends on control dependency: [if], data = [none]
}
}
}
} catch (SocketException ex) {
//noop
} // depends on control dependency: [catch], data = [none]
return interfaceAddressMap;
} } |
public class class_name {
protected void processPackage(PackageDoc doc) {
// (#1) Set foundDoc to false if possible.
// foundDoc will be set to true when setRawCommentText() is called, if the method
// is called again, JavaDoc will issue a warning about multiple sources for the
// package documentation. If there actually *are* multiple sources, the warning
// has already been issued at this point, we will, however, use it to set the
// resulting HTML. So, we're setting it back to false here, to suppress the
// warning.
try {
Field foundDoc = doc.getClass().getDeclaredField("foundDoc");
foundDoc.setAccessible(true);
foundDoc.set(doc, false);
}
catch ( Exception e ) {
printWarning(doc.position(), "Cannot suppress warning about multiple package sources: " + e + "\n"
+ "Please report this at https://github.com/Abnaxos/markdown-doclet/issues with the exact JavaDoc version you're using");
}
defaultProcess(doc, true);
} } | public class class_name {
protected void processPackage(PackageDoc doc) {
// (#1) Set foundDoc to false if possible.
// foundDoc will be set to true when setRawCommentText() is called, if the method
// is called again, JavaDoc will issue a warning about multiple sources for the
// package documentation. If there actually *are* multiple sources, the warning
// has already been issued at this point, we will, however, use it to set the
// resulting HTML. So, we're setting it back to false here, to suppress the
// warning.
try {
Field foundDoc = doc.getClass().getDeclaredField("foundDoc");
foundDoc.setAccessible(true); // depends on control dependency: [try], data = [none]
foundDoc.set(doc, false); // depends on control dependency: [try], data = [none]
}
catch ( Exception e ) {
printWarning(doc.position(), "Cannot suppress warning about multiple package sources: " + e + "\n"
+ "Please report this at https://github.com/Abnaxos/markdown-doclet/issues with the exact JavaDoc version you're using");
}
defaultProcess(doc, true);
} } // depends on control dependency: [catch], data = [none] |
public class class_name {
public void marshall(ScriptBootstrapActionConfig scriptBootstrapActionConfig, ProtocolMarshaller protocolMarshaller) {
if (scriptBootstrapActionConfig == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(scriptBootstrapActionConfig.getPath(), PATH_BINDING);
protocolMarshaller.marshall(scriptBootstrapActionConfig.getArgs(), ARGS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(ScriptBootstrapActionConfig scriptBootstrapActionConfig, ProtocolMarshaller protocolMarshaller) {
if (scriptBootstrapActionConfig == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(scriptBootstrapActionConfig.getPath(), PATH_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(scriptBootstrapActionConfig.getArgs(), ARGS_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
protected void setCurrentLedImage(final BufferedImage CURRENT_LED_IMAGE) {
if (currentLedImage != null) {
currentLedImage.flush();
}
currentLedImage = CURRENT_LED_IMAGE;
repaint(getInnerBounds());
} } | public class class_name {
protected void setCurrentLedImage(final BufferedImage CURRENT_LED_IMAGE) {
if (currentLedImage != null) {
currentLedImage.flush(); // depends on control dependency: [if], data = [none]
}
currentLedImage = CURRENT_LED_IMAGE;
repaint(getInnerBounds());
} } |
public class class_name {
private static void maskOutWord(int[] array, int index, int from, int to) {
if (from == to) {
return;
}
int word = wordAt(array, index);
if (word == 0) {
return;
}
int mask;
if (from != 0) {
mask = 0xffffffff >>> (32 - from);
} else {
mask = 0;
}
// Shifting by 32 is the same as shifting by 0.
if (to != 32) {
mask |= 0xffffffff << to;
}
word &= mask;
array[index] = word & WORD_MASK;
} } | public class class_name {
private static void maskOutWord(int[] array, int index, int from, int to) {
if (from == to) {
return; // depends on control dependency: [if], data = [none]
}
int word = wordAt(array, index);
if (word == 0) {
return; // depends on control dependency: [if], data = [none]
}
int mask;
if (from != 0) {
mask = 0xffffffff >>> (32 - from); // depends on control dependency: [if], data = [none]
} else {
mask = 0; // depends on control dependency: [if], data = [none]
}
// Shifting by 32 is the same as shifting by 0.
if (to != 32) {
mask |= 0xffffffff << to; // depends on control dependency: [if], data = [none]
}
word &= mask;
array[index] = word & WORD_MASK;
} } |
public class class_name {
protected LinkedList<APIParameter> parseCustomizedParameters(MethodDoc methodDoc) {
Tag[] tags = methodDoc.tags(WRParamTaglet.NAME);
LinkedList<APIParameter> result = new LinkedList<APIParameter>();
for (int i = 0; i < tags.length; i++) {
result.add(WRParamTaglet.parse(tags[i].text()));
}
return result;
} } | public class class_name {
protected LinkedList<APIParameter> parseCustomizedParameters(MethodDoc methodDoc) {
Tag[] tags = methodDoc.tags(WRParamTaglet.NAME);
LinkedList<APIParameter> result = new LinkedList<APIParameter>();
for (int i = 0; i < tags.length; i++) {
result.add(WRParamTaglet.parse(tags[i].text())); // depends on control dependency: [for], data = [i]
}
return result;
} } |
public class class_name {
@Override
public void decode(FacesContext context, UIComponent component) {
Slider2 slider = (Slider2) component;
if (slider.isDisabled() || slider.isReadonly()) {
return;
}
decodeBehaviors(context, slider);
String clientId = slider.getClientId(context);
Number submittedValue = convert(component, Float.valueOf(getRequestParameter(context, clientId)));
if (submittedValue != null) {
slider.setSubmittedValue(submittedValue);
}
new AJAXRenderer().decode(context, component, clientId);
} } | public class class_name {
@Override
public void decode(FacesContext context, UIComponent component) {
Slider2 slider = (Slider2) component;
if (slider.isDisabled() || slider.isReadonly()) {
return; // depends on control dependency: [if], data = [none]
}
decodeBehaviors(context, slider);
String clientId = slider.getClientId(context);
Number submittedValue = convert(component, Float.valueOf(getRequestParameter(context, clientId)));
if (submittedValue != null) {
slider.setSubmittedValue(submittedValue); // depends on control dependency: [if], data = [(submittedValue]
}
new AJAXRenderer().decode(context, component, clientId);
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.