code
stringlengths 130
281k
| code_dependency
stringlengths 182
306k
|
|---|---|
public class class_name {
@Override
protected List<ScenarioSpec> getChildren() {
TestPackageRoot rootPackageAnnotation = testClass.getAnnotation(TestPackageRoot.class);
JsonTestCases jsonTestCasesAnnotation = testClass.getAnnotation(JsonTestCases.class);
validateSuiteAnnotationPresent(rootPackageAnnotation, jsonTestCasesAnnotation);
if (rootPackageAnnotation != null) {
/*
* Different scenarios with same name -or- Same scenarios with same name more than once is prevented
*/
smartUtils.checkDuplicateScenarios(rootPackageAnnotation.value());
return smartUtils.getScenarioSpecListByPackage(rootPackageAnnotation.value());
} else {
List<JsonTestCase> jsonTestCases = Arrays.asList(testClass.getAnnotationsByType(JsonTestCase.class));
List<String> allEndPointFiles = jsonTestCases.stream()
.map(thisTestCase -> thisTestCase.value())
.collect(Collectors.toList());
return allEndPointFiles.stream()
.map(testResource -> {
try {
return smartUtils.jsonFileToJava(testResource, ScenarioSpec.class);
} catch (IOException e) {
throw new RuntimeException("Exception while deserializing to Spec. Details: " + e);
}
})
.collect(Collectors.toList());
}
} }
|
public class class_name {
@Override
protected List<ScenarioSpec> getChildren() {
TestPackageRoot rootPackageAnnotation = testClass.getAnnotation(TestPackageRoot.class);
JsonTestCases jsonTestCasesAnnotation = testClass.getAnnotation(JsonTestCases.class);
validateSuiteAnnotationPresent(rootPackageAnnotation, jsonTestCasesAnnotation);
if (rootPackageAnnotation != null) {
/*
* Different scenarios with same name -or- Same scenarios with same name more than once is prevented
*/
smartUtils.checkDuplicateScenarios(rootPackageAnnotation.value()); // depends on control dependency: [if], data = [(rootPackageAnnotation]
return smartUtils.getScenarioSpecListByPackage(rootPackageAnnotation.value()); // depends on control dependency: [if], data = [(rootPackageAnnotation]
} else {
List<JsonTestCase> jsonTestCases = Arrays.asList(testClass.getAnnotationsByType(JsonTestCase.class));
List<String> allEndPointFiles = jsonTestCases.stream()
.map(thisTestCase -> thisTestCase.value())
.collect(Collectors.toList());
return allEndPointFiles.stream()
.map(testResource -> {
try {
return smartUtils.jsonFileToJava(testResource, ScenarioSpec.class); // depends on control dependency: [if], data = [none]
} catch (IOException e) {
throw new RuntimeException("Exception while deserializing to Spec. Details: " + e);
}
})
.collect(Collectors.toList());
}
} }
|
public class class_name {
public static <E> void logNormalizeInPlace(Counter<E> c) {
double logsum = logSum(c);
// for (E key : c.keySet()) {
// c.incrementCount(key, -logsum);
// }
// This should be faster
for (Map.Entry<E, Double> e : c.entrySet()) {
e.setValue(e.getValue().doubleValue() - logsum);
}
} }
|
public class class_name {
public static <E> void logNormalizeInPlace(Counter<E> c) {
double logsum = logSum(c);
// for (E key : c.keySet()) {
// c.incrementCount(key, -logsum);
// }
// This should be faster
for (Map.Entry<E, Double> e : c.entrySet()) {
e.setValue(e.getValue().doubleValue() - logsum);
// depends on control dependency: [for], data = [e]
}
} }
|
public class class_name {
@SuppressWarnings("unchecked")
private List labeling(List<Sentence> obsvSeqs){
List labelSeqs = new ArrayList();
for (int i = 0; i < obsvSeqs.size(); ++i){//ith sentence
List sequence = new ArrayList();
Sentence sentence = obsvSeqs.get(i);
for (int j = 0; j < sentence.size(); ++j){//jth observation
Observation obsv = new Observation();
obsv.originalData = sentence.getWordAt(j);
String [] strCps = dataTagger.getContext(sentence, j);
ArrayList<Integer> tempCpsInt = new ArrayList<Integer>();
for (int k = 0; k < strCps.length; k++) {
Integer cpInt = (Integer) taggerMaps.cpStr2Int.get(strCps[k]);
if (cpInt == null) {
continue;
}
tempCpsInt.add(cpInt);
}
obsv.cps = new int[tempCpsInt.size()];
for (int k = 0; k < tempCpsInt.size(); ++k){
obsv.cps[k] = tempCpsInt.get(k).intValue();
}
sequence.add(obsv);
}
labelSeqs.add(sequence);
}
taggerModel.inferenceAll(labelSeqs);
//assign labels to list of sentences
for (int i = 0; i < obsvSeqs.size(); ++i){
Sentence sent = obsvSeqs.get(i);
List seq = (List) labelSeqs.get(i);
for (int j = 0; j < sent.size(); ++j){
Observation obsrv = (Observation) seq.get(j);
String label = (String) taggerMaps.lbInt2Str.get(obsrv.modelLabel);
sent.getTWordAt(j).setTag(label);
}
}
return obsvSeqs;
} }
|
public class class_name {
@SuppressWarnings("unchecked")
private List labeling(List<Sentence> obsvSeqs){
List labelSeqs = new ArrayList();
for (int i = 0; i < obsvSeqs.size(); ++i){//ith sentence
List sequence = new ArrayList();
Sentence sentence = obsvSeqs.get(i);
for (int j = 0; j < sentence.size(); ++j){//jth observation
Observation obsv = new Observation();
obsv.originalData = sentence.getWordAt(j);
// depends on control dependency: [for], data = [j]
String [] strCps = dataTagger.getContext(sentence, j);
ArrayList<Integer> tempCpsInt = new ArrayList<Integer>();
for (int k = 0; k < strCps.length; k++) {
Integer cpInt = (Integer) taggerMaps.cpStr2Int.get(strCps[k]);
if (cpInt == null) {
continue;
}
tempCpsInt.add(cpInt);
// depends on control dependency: [for], data = [none]
}
obsv.cps = new int[tempCpsInt.size()];
// depends on control dependency: [for], data = [none]
for (int k = 0; k < tempCpsInt.size(); ++k){
obsv.cps[k] = tempCpsInt.get(k).intValue();
// depends on control dependency: [for], data = [k]
}
sequence.add(obsv);
// depends on control dependency: [for], data = [none]
}
labelSeqs.add(sequence);
// depends on control dependency: [for], data = [none]
}
taggerModel.inferenceAll(labelSeqs);
//assign labels to list of sentences
for (int i = 0; i < obsvSeqs.size(); ++i){
Sentence sent = obsvSeqs.get(i);
List seq = (List) labelSeqs.get(i);
for (int j = 0; j < sent.size(); ++j){
Observation obsrv = (Observation) seq.get(j);
String label = (String) taggerMaps.lbInt2Str.get(obsrv.modelLabel);
sent.getTWordAt(j).setTag(label);
// depends on control dependency: [for], data = [j]
}
}
return obsvSeqs;
} }
|
public class class_name {
public static HashMap<String, Integer> getImageInfo(ImageInputStream input) {
HashMap<String, Integer> map = new HashMap<String, Integer>(2);
BufferedImage buff = null;
try {
buff = ImageIO.read(input);
map.put("width", buff.getWidth());
map.put("height", buff.getHeight());
return map;
} catch (IOException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
return null;
} }
|
public class class_name {
public static HashMap<String, Integer> getImageInfo(ImageInputStream input) {
HashMap<String, Integer> map = new HashMap<String, Integer>(2);
BufferedImage buff = null;
try {
buff = ImageIO.read(input); // depends on control dependency: [try], data = [none]
map.put("width", buff.getWidth()); // depends on control dependency: [try], data = [none]
map.put("height", buff.getHeight()); // depends on control dependency: [try], data = [none]
return map; // depends on control dependency: [try], data = [none]
} catch (IOException e) {
e.printStackTrace();
} catch (Exception e) { // depends on control dependency: [catch], data = [none]
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
return null;
} }
|
public class class_name {
@Pure
public static Double getAttributeDoubleWithDefault(Node document, boolean caseSensitive, Double defaultValue,
String... path) {
assert document != null : AssertMessages.notNullParameter(0);
final String v = getAttributeValue(document, caseSensitive, 0, path);
if (v != null) {
try {
return Double.parseDouble(v);
} catch (NumberFormatException e) {
//
}
}
return defaultValue;
} }
|
public class class_name {
@Pure
public static Double getAttributeDoubleWithDefault(Node document, boolean caseSensitive, Double defaultValue,
String... path) {
assert document != null : AssertMessages.notNullParameter(0);
final String v = getAttributeValue(document, caseSensitive, 0, path);
if (v != null) {
try {
return Double.parseDouble(v); // depends on control dependency: [try], data = [none]
} catch (NumberFormatException e) {
//
} // depends on control dependency: [catch], data = [none]
}
return defaultValue;
} }
|
public class class_name {
public static boolean isForceExpandParamSet(ODataUri oDataUri) {
if (isFunctionCallUri(oDataUri)) {
// Check if we have expand param set to true
Option<scala.collection.immutable.Map<String, String>> params = getFunctionCallParameters(oDataUri);
if (params.isDefined() && !params.get().isEmpty()) {
Map<String, String> parametersMap = JavaConverters.mapAsJavaMap(params.get());
if (parametersMap.containsKey(FORCE_EXPAND_PARAM)) {
return Boolean.parseBoolean(parametersMap.get(FORCE_EXPAND_PARAM));
}
}
}
return false;
} }
|
public class class_name {
public static boolean isForceExpandParamSet(ODataUri oDataUri) {
if (isFunctionCallUri(oDataUri)) {
// Check if we have expand param set to true
Option<scala.collection.immutable.Map<String, String>> params = getFunctionCallParameters(oDataUri);
if (params.isDefined() && !params.get().isEmpty()) {
Map<String, String> parametersMap = JavaConverters.mapAsJavaMap(params.get());
if (parametersMap.containsKey(FORCE_EXPAND_PARAM)) {
return Boolean.parseBoolean(parametersMap.get(FORCE_EXPAND_PARAM)); // depends on control dependency: [if], data = [none]
}
}
}
return false;
} }
|
public class class_name {
public byte[] getPrivKeyBytes() {
if (privKey == null) {
return null;
} else if (privKey instanceof BCECPrivateKey) {
return bigIntegerToBytes(((BCECPrivateKey) privKey).getD(), 32);
} else {
return null;
}
} }
|
public class class_name {
public byte[] getPrivKeyBytes() {
if (privKey == null) {
return null; // depends on control dependency: [if], data = [none]
} else if (privKey instanceof BCECPrivateKey) {
return bigIntegerToBytes(((BCECPrivateKey) privKey).getD(), 32); // depends on control dependency: [if], data = [none]
} else {
return null; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
void removeAll(BaseRow sortKey) {
Collection<BaseRow> list = treeMap.get(sortKey);
if (list != null) {
currentTopNum -= list.size();
treeMap.remove(sortKey);
}
} }
|
public class class_name {
void removeAll(BaseRow sortKey) {
Collection<BaseRow> list = treeMap.get(sortKey);
if (list != null) {
currentTopNum -= list.size(); // depends on control dependency: [if], data = [none]
treeMap.remove(sortKey); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public Object getActionResultWithoutCache(String name) {
if (activity.getProcessResult() != null) {
return activity.getProcessResult().getResultValue(name);
} else {
return null;
}
} }
|
public class class_name {
public Object getActionResultWithoutCache(String name) {
if (activity.getProcessResult() != null) {
return activity.getProcessResult().getResultValue(name); // depends on control dependency: [if], data = [none]
} else {
return null; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private String get_target_type (String ttype_tname)
{
String[] split;
try {
split = ttype_tname.split(LOGGING_SEPARATOR);
} catch (Exception e) {
return "unknown";
}
return split[0];
} }
|
public class class_name {
private String get_target_type (String ttype_tname)
{
String[] split;
try {
split = ttype_tname.split(LOGGING_SEPARATOR); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
return "unknown";
} // depends on control dependency: [catch], data = [none]
return split[0];
} }
|
public class class_name {
private static void addFunctionDependence(Function function, Procedure procedure, Statement catalogStmt) {
String funcDeps = function.getStmtdependers();
Set<String> stmtSet = new TreeSet<>();
for (String stmtName : funcDeps.split(",")) {
if (! stmtName.isEmpty()) {
stmtSet.add(stmtName);
}
}
String statementName = procedure.getTypeName() + ":" + catalogStmt.getTypeName();
if (stmtSet.contains(statementName)) {
return;
}
stmtSet.add(statementName);
StringBuilder sb = new StringBuilder();
// We will add this procedure:statement pair. So make sure we have
// an initial comma. Note that an empty set must be represented
// by an empty string. We represent the set {pp:ss, qq:tt},
// where "pp" and "qq" are procedures and "ss" and "tt" are
// statements in their procedures respectively, with
// the string ",pp:ss,qq:tt,". If we search for "pp:ss" we will
// never find "ppp:sss" by accident.
//
// Do to this, when we add something to string we start with a single
// comma, and then add "qq:tt," at the end.
sb.append(",");
for (String stmtName : stmtSet) {
sb.append(stmtName + ",");
}
function.setStmtdependers(sb.toString());
} }
|
public class class_name {
private static void addFunctionDependence(Function function, Procedure procedure, Statement catalogStmt) {
String funcDeps = function.getStmtdependers();
Set<String> stmtSet = new TreeSet<>();
for (String stmtName : funcDeps.split(",")) {
if (! stmtName.isEmpty()) {
stmtSet.add(stmtName); // depends on control dependency: [if], data = [none]
}
}
String statementName = procedure.getTypeName() + ":" + catalogStmt.getTypeName();
if (stmtSet.contains(statementName)) {
return; // depends on control dependency: [if], data = [none]
}
stmtSet.add(statementName);
StringBuilder sb = new StringBuilder();
// We will add this procedure:statement pair. So make sure we have
// an initial comma. Note that an empty set must be represented
// by an empty string. We represent the set {pp:ss, qq:tt},
// where "pp" and "qq" are procedures and "ss" and "tt" are
// statements in their procedures respectively, with
// the string ",pp:ss,qq:tt,". If we search for "pp:ss" we will
// never find "ppp:sss" by accident.
//
// Do to this, when we add something to string we start with a single
// comma, and then add "qq:tt," at the end.
sb.append(",");
for (String stmtName : stmtSet) {
sb.append(stmtName + ","); // depends on control dependency: [for], data = [stmtName]
}
function.setStmtdependers(sb.toString());
} }
|
public class class_name {
public V remove(Object key) {
V retval=get(key);
try {
MethodCall call=new MethodCall(REMOVE, key);
disp.callRemoteMethods(null, call, call_options);
}
catch(Exception e) {
throw new RuntimeException("remove(" + key + ") failed", e);
}
return retval;
} }
|
public class class_name {
public V remove(Object key) {
V retval=get(key);
try {
MethodCall call=new MethodCall(REMOVE, key);
disp.callRemoteMethods(null, call, call_options); // depends on control dependency: [try], data = [none]
}
catch(Exception e) {
throw new RuntimeException("remove(" + key + ") failed", e);
} // depends on control dependency: [catch], data = [none]
return retval;
} }
|
public class class_name {
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
// Load mImm
mImm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
if(mConstruct != null && mConstruct.getDesign().isMaterial()) {
// Apply construct to UI
if (mTitle != null && mMessage != null) {
if (mConstruct.getTitle() != null){
mTitle.setText(mConstruct.getTitle());
}else{
mTitle.setVisibility(View.GONE);
// Add padding to the message
int padding = getResources().getDimensionPixelSize(R.dimen.material_spacing);
mMessage.setPadding(0, padding, 0, 0);
}
if (mConstruct.getMessage() != null) {
if(mConstruct.getMovementMethod() != null)
mMessage.setMovementMethod(mConstruct.getMovementMethod());
mMessage.setAutoLinkMask(mConstruct.getAutoLinkMask());
mMessage.setText(mConstruct.getMessage());
}else
mContentFrame.removeView(mMessageScrollview);
if (mConstruct.getDesign().isMaterial()) {
FontLoader.applyTypeface(mTitle, Types.ROBOTO_MEDIUM);
FontLoader.applyTypeface(mMessage, Types.ROBOTO_REGULAR);
}
}
if (mButtonContainer != null && mConstruct.getButtonConfig().size() > 0) {
// Iterate through config, and setup the button states
LinkedHashMap<Integer, Delivery.ButtonConfig> config = mConstruct.getButtonConfig();
List<Integer> keys = new ArrayList<>(config.keySet());
// Sort the button keys for proper sorting
Collections.sort(keys, mButtonComparator);
int N = keys.size();
for (int i = 0; i < N; i++) {
final int key = keys.get(i);
final Delivery.ButtonConfig cfg = config.get(key);
// Pull button Color
int textColor = mConstruct.getButtonTextColor(key);
// Inflate the RippleView wrapped Button based on design
RippleView button = (RippleView)getActivity().getLayoutInflater()
.inflate(mConstruct.getDesign().isLight() ?
R.layout.material_light_dialog_button :
R.layout.material_dark_dialog_button, null, false);
// Load the Button from the ripple view
Button rippleButton = (Button) button.findViewById(R.id.ripple_button);
// Apply parameters to the button
FontLoader.applyTypeface(rippleButton, Types.ROBOTO_MEDIUM);
rippleButton.setId(key);
rippleButton.setText(cfg.title);
if(textColor != 0) rippleButton.setTextColor(textColor);
rippleButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
long delay = getActivity().getResources()
.getInteger(R.integer.ripple_duration) + DELAY_BUFFER;
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
cfg.listener.onClick(getDialog(), key);
if(mConstruct.getStyle() != null){
mConstruct.getStyle().onButtonClicked(key, getDialog());
}
}
}, delay);
}
});
// add to layout
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT,
getActivity().getResources().getDimensionPixelSize(R.dimen.material_button_height));
mButtonContainer.addView(button, params);
}
}else if(mButtonContainer != null && mConstruct.getButtonCount() == 0){
mButtonContainer.setVisibility(View.GONE);
}
// Load Content
if (mStyleContent != null && mConstruct.getStyle() != null) {
mStyleContent.addView(mConstruct.getStyle().getContentView());
}
}
if(mConstruct != null) {
// Lastly apply the other dialog options
setCancelable(mConstruct.isCancelable());
getDialog().setCanceledOnTouchOutside(mConstruct.isCanceledOnTouchOutside());
getDialog().setOnShowListener(new DialogInterface.OnShowListener() {
@Override
public void onShow(DialogInterface dialog) {
if (mConstruct.getOnShowListener() != null)
mConstruct.getOnShowListener().onShow(dialog);
if (mConstruct.getStyle() != null)
mConstruct.getStyle().onDialogShow(getDialog());
if (mConstruct.isShowKeyboardOnDisplay()) {
if (mConstruct.getStyle() instanceof EditTextStyle) {
EditText et = ((EditTextStyle) mConstruct.getStyle()).getEditTextView();
mImm.showSoftInput(et, InputMethodManager.SHOW_IMPLICIT);
}
}
}
});
}else{
dismiss();
}
} }
|
public class class_name {
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
// Load mImm
mImm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
if(mConstruct != null && mConstruct.getDesign().isMaterial()) {
// Apply construct to UI
if (mTitle != null && mMessage != null) {
if (mConstruct.getTitle() != null){
mTitle.setText(mConstruct.getTitle()); // depends on control dependency: [if], data = [(mConstruct.getTitle()]
}else{
mTitle.setVisibility(View.GONE); // depends on control dependency: [if], data = [none]
// Add padding to the message
int padding = getResources().getDimensionPixelSize(R.dimen.material_spacing);
mMessage.setPadding(0, padding, 0, 0); // depends on control dependency: [if], data = [none]
}
if (mConstruct.getMessage() != null) {
if(mConstruct.getMovementMethod() != null)
mMessage.setMovementMethod(mConstruct.getMovementMethod());
mMessage.setAutoLinkMask(mConstruct.getAutoLinkMask()); // depends on control dependency: [if], data = [none]
mMessage.setText(mConstruct.getMessage()); // depends on control dependency: [if], data = [(mConstruct.getMessage()]
}else
mContentFrame.removeView(mMessageScrollview);
if (mConstruct.getDesign().isMaterial()) {
FontLoader.applyTypeface(mTitle, Types.ROBOTO_MEDIUM); // depends on control dependency: [if], data = [none]
FontLoader.applyTypeface(mMessage, Types.ROBOTO_REGULAR); // depends on control dependency: [if], data = [none]
}
}
if (mButtonContainer != null && mConstruct.getButtonConfig().size() > 0) {
// Iterate through config, and setup the button states
LinkedHashMap<Integer, Delivery.ButtonConfig> config = mConstruct.getButtonConfig();
List<Integer> keys = new ArrayList<>(config.keySet());
// Sort the button keys for proper sorting
Collections.sort(keys, mButtonComparator); // depends on control dependency: [if], data = [none]
int N = keys.size();
for (int i = 0; i < N; i++) {
final int key = keys.get(i);
final Delivery.ButtonConfig cfg = config.get(key);
// Pull button Color
int textColor = mConstruct.getButtonTextColor(key);
// Inflate the RippleView wrapped Button based on design
RippleView button = (RippleView)getActivity().getLayoutInflater()
.inflate(mConstruct.getDesign().isLight() ?
R.layout.material_light_dialog_button :
R.layout.material_dark_dialog_button, null, false);
// Load the Button from the ripple view
Button rippleButton = (Button) button.findViewById(R.id.ripple_button);
// Apply parameters to the button
FontLoader.applyTypeface(rippleButton, Types.ROBOTO_MEDIUM); // depends on control dependency: [for], data = [none]
rippleButton.setId(key); // depends on control dependency: [for], data = [none]
rippleButton.setText(cfg.title); // depends on control dependency: [for], data = [none]
if(textColor != 0) rippleButton.setTextColor(textColor);
rippleButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
long delay = getActivity().getResources()
.getInteger(R.integer.ripple_duration) + DELAY_BUFFER;
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
cfg.listener.onClick(getDialog(), key);
if(mConstruct.getStyle() != null){
mConstruct.getStyle().onButtonClicked(key, getDialog()); // depends on control dependency: [if], data = [none]
}
}
}, delay);
}
}); // depends on control dependency: [for], data = [none]
// add to layout
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT,
getActivity().getResources().getDimensionPixelSize(R.dimen.material_button_height));
mButtonContainer.addView(button, params); // depends on control dependency: [for], data = [none]
}
}else if(mButtonContainer != null && mConstruct.getButtonCount() == 0){
mButtonContainer.setVisibility(View.GONE); // depends on control dependency: [if], data = [none]
}
// Load Content
if (mStyleContent != null && mConstruct.getStyle() != null) {
mStyleContent.addView(mConstruct.getStyle().getContentView()); // depends on control dependency: [if], data = [none]
}
}
if(mConstruct != null) {
// Lastly apply the other dialog options
setCancelable(mConstruct.isCancelable()); // depends on control dependency: [if], data = [(mConstruct]
getDialog().setCanceledOnTouchOutside(mConstruct.isCanceledOnTouchOutside()); // depends on control dependency: [if], data = [(mConstruct]
getDialog().setOnShowListener(new DialogInterface.OnShowListener() {
@Override
public void onShow(DialogInterface dialog) {
if (mConstruct.getOnShowListener() != null)
mConstruct.getOnShowListener().onShow(dialog);
if (mConstruct.getStyle() != null)
mConstruct.getStyle().onDialogShow(getDialog());
if (mConstruct.isShowKeyboardOnDisplay()) {
if (mConstruct.getStyle() instanceof EditTextStyle) {
EditText et = ((EditTextStyle) mConstruct.getStyle()).getEditTextView();
mImm.showSoftInput(et, InputMethodManager.SHOW_IMPLICIT); // depends on control dependency: [if], data = [none]
}
}
}
}); // depends on control dependency: [if], data = [none]
}else{
dismiss(); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static <E> Set<Set<E>> powerSet(Set<E> s) {
if (s.isEmpty()) {
Set<Set<E>> h = new HashSet<Set<E>>();
Set<E> h0 = new HashSet<E>(0);
h.add(h0);
return h;
} else {
Iterator<E> i = s.iterator();
E elt = i.next();
s.remove(elt);
Set<Set<E>> pow = powerSet(s);
Set<Set<E>> pow1 = powerSet(s);
// for (Iterator j = pow1.iterator(); j.hasNext();) {
for (Set<E> t : pow1) {
// Set<E> t = new HashSet<E>((Set<E>) j.next());
t.add(elt);
pow.add(t);
}
s.add(elt);
return pow;
}
} }
|
public class class_name {
public static <E> Set<Set<E>> powerSet(Set<E> s) {
if (s.isEmpty()) {
Set<Set<E>> h = new HashSet<Set<E>>();
Set<E> h0 = new HashSet<E>(0);
h.add(h0);
// depends on control dependency: [if], data = [none]
return h;
// depends on control dependency: [if], data = [none]
} else {
Iterator<E> i = s.iterator();
E elt = i.next();
s.remove(elt);
// depends on control dependency: [if], data = [none]
Set<Set<E>> pow = powerSet(s);
Set<Set<E>> pow1 = powerSet(s);
// for (Iterator j = pow1.iterator(); j.hasNext();) {
for (Set<E> t : pow1) {
// Set<E> t = new HashSet<E>((Set<E>) j.next());
t.add(elt);
// depends on control dependency: [for], data = [t]
pow.add(t);
// depends on control dependency: [for], data = [t]
}
s.add(elt);
// depends on control dependency: [if], data = [none]
return pow;
// depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void register(BeanMappingBuilder builder) {
if (builder != null) {
BeanMappingObject object = builder.get();
register(object);
}
} }
|
public class class_name {
public void register(BeanMappingBuilder builder) {
if (builder != null) {
BeanMappingObject object = builder.get();
register(object); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public ContainerRuntimeOptionType<T> value(String ... values)
{
if (values != null)
{
for(String name: values)
{
childNode.createChild("value").text(name);
}
}
return this;
} }
|
public class class_name {
public ContainerRuntimeOptionType<T> value(String ... values)
{
if (values != null)
{
for(String name: values)
{
childNode.createChild("value").text(name); // depends on control dependency: [for], data = [name]
}
}
return this;
} }
|
public class class_name {
public Object load(InputStream stream) throws PickleException, IOException {
stack = new UnpickleStack();
input = stream;
while (true) {
short key = PickleUtils.readbyte(input);
if (key == -1)
throw new IOException("premature end of file");
Object value = dispatch(key);
if (value != NO_RETURN_VALUE) {
return value;
}
}
} }
|
public class class_name {
public Object load(InputStream stream) throws PickleException, IOException {
stack = new UnpickleStack();
input = stream;
while (true) {
short key = PickleUtils.readbyte(input);
if (key == -1)
throw new IOException("premature end of file");
Object value = dispatch(key);
if (value != NO_RETURN_VALUE) {
return value; // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public Observable<ServiceResponse<Page<DeletedCertificateItem>>> getDeletedCertificatesNextWithServiceResponseAsync(final String nextPageLink) {
return getDeletedCertificatesNextSinglePageAsync(nextPageLink)
.concatMap(new Func1<ServiceResponse<Page<DeletedCertificateItem>>, Observable<ServiceResponse<Page<DeletedCertificateItem>>>>() {
@Override
public Observable<ServiceResponse<Page<DeletedCertificateItem>>> call(ServiceResponse<Page<DeletedCertificateItem>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(getDeletedCertificatesNextWithServiceResponseAsync(nextPageLink));
}
});
} }
|
public class class_name {
public Observable<ServiceResponse<Page<DeletedCertificateItem>>> getDeletedCertificatesNextWithServiceResponseAsync(final String nextPageLink) {
return getDeletedCertificatesNextSinglePageAsync(nextPageLink)
.concatMap(new Func1<ServiceResponse<Page<DeletedCertificateItem>>, Observable<ServiceResponse<Page<DeletedCertificateItem>>>>() {
@Override
public Observable<ServiceResponse<Page<DeletedCertificateItem>>> call(ServiceResponse<Page<DeletedCertificateItem>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page); // depends on control dependency: [if], data = [none]
}
return Observable.just(page).concatWith(getDeletedCertificatesNextWithServiceResponseAsync(nextPageLink));
}
});
} }
|
public class class_name {
public java.util.List<EnabledMetric> getEnabledMetrics() {
if (enabledMetrics == null) {
enabledMetrics = new com.amazonaws.internal.SdkInternalList<EnabledMetric>();
}
return enabledMetrics;
} }
|
public class class_name {
public java.util.List<EnabledMetric> getEnabledMetrics() {
if (enabledMetrics == null) {
enabledMetrics = new com.amazonaws.internal.SdkInternalList<EnabledMetric>(); // depends on control dependency: [if], data = [none]
}
return enabledMetrics;
} }
|
public class class_name {
public static double cor(int[] x, int[] y) {
if (x.length != y.length) {
throw new IllegalArgumentException("Arrays have different length.");
}
if (x.length < 3) {
throw new IllegalArgumentException("array length has to be at least 3.");
}
double Sxy = cov(x, y);
double Sxx = var(x);
double Syy = var(y);
if (Sxx == 0 || Syy == 0) {
return Double.NaN;
}
return Sxy / java.lang.Math.sqrt(Sxx * Syy);
} }
|
public class class_name {
public static double cor(int[] x, int[] y) {
if (x.length != y.length) {
throw new IllegalArgumentException("Arrays have different length.");
}
if (x.length < 3) {
throw new IllegalArgumentException("array length has to be at least 3.");
}
double Sxy = cov(x, y);
double Sxx = var(x);
double Syy = var(y);
if (Sxx == 0 || Syy == 0) {
return Double.NaN; // depends on control dependency: [if], data = [none]
}
return Sxy / java.lang.Math.sqrt(Sxx * Syy);
} }
|
public class class_name {
public static void downloadAsync(ImageRequest request) {
if (request == null) {
return;
}
// NOTE: This is the ONLY place where the original request's Url is read. From here on,
// we will keep track of the Url separately. This is because we might be dealing with a
// redirect response and the Url might change. We can't create our own new ImageRequests
// for these changed Urls since the caller might be doing some book-keeping with the request's
// object reference. So we keep the old references and just map them to new urls in the downloader
RequestKey key = new RequestKey(request.getImageUri(), request.getCallerTag());
synchronized (pendingRequests) {
DownloaderContext downloaderContext = pendingRequests.get(key);
if (downloaderContext != null) {
downloaderContext.request = request;
downloaderContext.isCancelled = false;
downloaderContext.workItem.moveToFront();
} else {
enqueueCacheRead(request, key, request.isCachedRedirectAllowed());
}
}
} }
|
public class class_name {
public static void downloadAsync(ImageRequest request) {
if (request == null) {
return; // depends on control dependency: [if], data = [none]
}
// NOTE: This is the ONLY place where the original request's Url is read. From here on,
// we will keep track of the Url separately. This is because we might be dealing with a
// redirect response and the Url might change. We can't create our own new ImageRequests
// for these changed Urls since the caller might be doing some book-keeping with the request's
// object reference. So we keep the old references and just map them to new urls in the downloader
RequestKey key = new RequestKey(request.getImageUri(), request.getCallerTag());
synchronized (pendingRequests) {
DownloaderContext downloaderContext = pendingRequests.get(key);
if (downloaderContext != null) {
downloaderContext.request = request; // depends on control dependency: [if], data = [none]
downloaderContext.isCancelled = false; // depends on control dependency: [if], data = [none]
downloaderContext.workItem.moveToFront(); // depends on control dependency: [if], data = [none]
} else {
enqueueCacheRead(request, key, request.isCachedRedirectAllowed()); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
protected AspImpl getAspForNullRc() {
// We know if null RC, ASP cannot be shared and AspFactory will
// have only one ASP
AspImpl aspImpl = (AspImpl) this.aspFactoryImpl.aspList.get(0);
if (this.aspFactoryImpl.aspList.size() > 1) {
// verify that AS to which this ASP is added is also having null
// RC or this asp is not shared by any other AS in which case we
// know messages are intended for same AS
ErrorCode errorCodeObj = this.aspFactoryImpl.parameterFactory.createErrorCode(ErrorCode.Invalid_Routing_Context);
sendError(null, errorCodeObj);
return null;
}
return aspImpl;
} }
|
public class class_name {
protected AspImpl getAspForNullRc() {
// We know if null RC, ASP cannot be shared and AspFactory will
// have only one ASP
AspImpl aspImpl = (AspImpl) this.aspFactoryImpl.aspList.get(0);
if (this.aspFactoryImpl.aspList.size() > 1) {
// verify that AS to which this ASP is added is also having null
// RC or this asp is not shared by any other AS in which case we
// know messages are intended for same AS
ErrorCode errorCodeObj = this.aspFactoryImpl.parameterFactory.createErrorCode(ErrorCode.Invalid_Routing_Context);
sendError(null, errorCodeObj); // depends on control dependency: [if], data = [none]
return null; // depends on control dependency: [if], data = [none]
}
return aspImpl;
} }
|
public class class_name {
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException,
ServletException
{
ExoContainer container = getContainer();
SessionProviderService providerService =
(SessionProviderService)container.getComponentInstanceOfType(SessionProviderService.class);
ConversationRegistry stateRegistry = (ConversationRegistry)container.getComponentInstanceOfType(ConversationRegistry.class);
HttpServletRequest httpRequest = (HttpServletRequest)request;
ConversationState state = ConversationState.getCurrent();
SessionProvider provider = null;
// NOTE not create new HTTP session, if session is not created yet
// this means some settings is incorrect, see web.xml for filter
// org.exoplatform.services.security.web.SetCurrentIdentityFilter
HttpSession httpSession = httpRequest.getSession(false);
if (state == null)
{
if (LOG.isDebugEnabled())
{
LOG.debug("Current conversation state is not set");
}
if (httpSession != null)
{
StateKey stateKey = new HttpSessionStateKey(httpSession);
// initialize thread local SessionProvider
state = stateRegistry.getState(stateKey);
if (state != null)
{
provider = new SessionProvider(state);
}
else if (LOG.isDebugEnabled())
{
LOG.debug("WARN: Conversation State is null, id " + httpSession.getId());
}
}
}
else
{
provider = new SessionProvider(state);
}
if (provider == null)
{
if (LOG.isDebugEnabled())
{
LOG.debug("Create SessionProvider for anonymous.");
}
provider = SessionProvider.createAnonimProvider();
}
try
{
if (ConversationState.getCurrent() != null)
{
ConversationState.getCurrent().setAttribute(SessionProvider.SESSION_PROVIDER, provider);
}
providerService.setSessionProvider(null, provider);
chain.doFilter(request, response);
}
finally
{
if (ConversationState.getCurrent() != null)
{
try
{
ConversationState.getCurrent().removeAttribute(SessionProvider.SESSION_PROVIDER);
}
catch (Exception e)
{
LOG.warn("An error occured while removing the session provider from the conversation state", e);
}
}
if (providerService.getSessionProvider(null) != null)
{
try
{
// remove SessionProvider
providerService.removeSessionProvider(null);
}
catch (Exception e)
{
LOG.warn("An error occured while cleaning the ThreadLocal", e);
}
}
}
} }
|
public class class_name {
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException,
ServletException
{
ExoContainer container = getContainer();
SessionProviderService providerService =
(SessionProviderService)container.getComponentInstanceOfType(SessionProviderService.class);
ConversationRegistry stateRegistry = (ConversationRegistry)container.getComponentInstanceOfType(ConversationRegistry.class);
HttpServletRequest httpRequest = (HttpServletRequest)request;
ConversationState state = ConversationState.getCurrent();
SessionProvider provider = null;
// NOTE not create new HTTP session, if session is not created yet
// this means some settings is incorrect, see web.xml for filter
// org.exoplatform.services.security.web.SetCurrentIdentityFilter
HttpSession httpSession = httpRequest.getSession(false);
if (state == null)
{
if (LOG.isDebugEnabled())
{
LOG.debug("Current conversation state is not set"); // depends on control dependency: [if], data = [none]
}
if (httpSession != null)
{
StateKey stateKey = new HttpSessionStateKey(httpSession);
// initialize thread local SessionProvider
state = stateRegistry.getState(stateKey); // depends on control dependency: [if], data = [none]
if (state != null)
{
provider = new SessionProvider(state); // depends on control dependency: [if], data = [(state]
}
else if (LOG.isDebugEnabled())
{
LOG.debug("WARN: Conversation State is null, id " + httpSession.getId()); // depends on control dependency: [if], data = [none]
}
}
}
else
{
provider = new SessionProvider(state);
}
if (provider == null)
{
if (LOG.isDebugEnabled())
{
LOG.debug("Create SessionProvider for anonymous."); // depends on control dependency: [if], data = [none]
}
provider = SessionProvider.createAnonimProvider();
}
try
{
if (ConversationState.getCurrent() != null)
{
ConversationState.getCurrent().setAttribute(SessionProvider.SESSION_PROVIDER, provider); // depends on control dependency: [if], data = [none]
}
providerService.setSessionProvider(null, provider);
chain.doFilter(request, response);
}
finally
{
if (ConversationState.getCurrent() != null)
{
try
{
ConversationState.getCurrent().removeAttribute(SessionProvider.SESSION_PROVIDER); // depends on control dependency: [try], data = [none]
}
catch (Exception e)
{
LOG.warn("An error occured while removing the session provider from the conversation state", e);
} // depends on control dependency: [catch], data = [none]
}
if (providerService.getSessionProvider(null) != null)
{
try
{
// remove SessionProvider
providerService.removeSessionProvider(null); // depends on control dependency: [try], data = [none]
}
catch (Exception e)
{
LOG.warn("An error occured while cleaning the ThreadLocal", e);
} // depends on control dependency: [catch], data = [none]
}
}
} }
|
public class class_name {
private boolean isToIgnore(CtElement element) {
if (element instanceof CtStatementList && !(element instanceof CtCase)) {
if (element.getRoleInParent() == CtRole.ELSE || element.getRoleInParent() == CtRole.THEN) {
return false;
}
return true;
}
return element.isImplicit() || element instanceof CtReference;
} }
|
public class class_name {
private boolean isToIgnore(CtElement element) {
if (element instanceof CtStatementList && !(element instanceof CtCase)) {
if (element.getRoleInParent() == CtRole.ELSE || element.getRoleInParent() == CtRole.THEN) {
return false; // depends on control dependency: [if], data = [none]
}
return true; // depends on control dependency: [if], data = [none]
}
return element.isImplicit() || element instanceof CtReference;
} }
|
public class class_name {
@Override
public boolean isIPC () {
String shr = this.getShare();
if ( shr == null || "IPC$".equals(getShare()) ) {
if ( log.isDebugEnabled() ) {
log.debug("Share is IPC " + this.share);
}
return true;
}
return false;
} }
|
public class class_name {
@Override
public boolean isIPC () {
String shr = this.getShare();
if ( shr == null || "IPC$".equals(getShare()) ) {
if ( log.isDebugEnabled() ) {
log.debug("Share is IPC " + this.share); // depends on control dependency: [if], data = [none]
}
return true; // depends on control dependency: [if], data = [none]
}
return false;
} }
|
public class class_name {
private static int findEndOfHeader(final ByteBuf buffer) {
final int n = buffer.readableBytes();
// per spec, the 15th and 16th bytes contain the address length in bytes
if (n < 16) {
return -1;
}
int offset = buffer.readerIndex() + 14;
// the total header length will be a fixed 16 byte sequence + the dynamic address information block
int totalHeaderBytes = 16 + buffer.getUnsignedShort(offset);
// ensure we actually have the full header available
if (n >= totalHeaderBytes) {
return totalHeaderBytes;
} else {
return -1;
}
} }
|
public class class_name {
private static int findEndOfHeader(final ByteBuf buffer) {
final int n = buffer.readableBytes();
// per spec, the 15th and 16th bytes contain the address length in bytes
if (n < 16) {
return -1; // depends on control dependency: [if], data = [none]
}
int offset = buffer.readerIndex() + 14;
// the total header length will be a fixed 16 byte sequence + the dynamic address information block
int totalHeaderBytes = 16 + buffer.getUnsignedShort(offset);
// ensure we actually have the full header available
if (n >= totalHeaderBytes) {
return totalHeaderBytes; // depends on control dependency: [if], data = [none]
} else {
return -1; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void visitClass(ClassNode node) {
// AIC are already done, doing them here again will lead to wrong scopes
if (isAnonymous(node)) return;
pushState();
prepareVisit(node);
super.visitClass(node);
if (recurseInnerClasses) {
Iterator<InnerClassNode> innerClasses = node.getInnerClasses();
while (innerClasses.hasNext()) {
visitClass(innerClasses.next());
}
}
popState();
} }
|
public class class_name {
public void visitClass(ClassNode node) {
// AIC are already done, doing them here again will lead to wrong scopes
if (isAnonymous(node)) return;
pushState();
prepareVisit(node);
super.visitClass(node);
if (recurseInnerClasses) {
Iterator<InnerClassNode> innerClasses = node.getInnerClasses();
while (innerClasses.hasNext()) {
visitClass(innerClasses.next()); // depends on control dependency: [while], data = [none]
}
}
popState();
} }
|
public class class_name {
@Override
protected void serializeNullValue( JsonWriter writer, JsonSerializationContext ctx, JsonSerializerParameters params ) {
if ( writer.getSerializeNulls() ) {
writer.setSerializeNulls( false );
writer.nullValue();
writer.setSerializeNulls( true );
} else {
writer.nullValue();
}
} }
|
public class class_name {
@Override
protected void serializeNullValue( JsonWriter writer, JsonSerializationContext ctx, JsonSerializerParameters params ) {
if ( writer.getSerializeNulls() ) {
writer.setSerializeNulls( false ); // depends on control dependency: [if], data = [none]
writer.nullValue(); // depends on control dependency: [if], data = [none]
writer.setSerializeNulls( true ); // depends on control dependency: [if], data = [none]
} else {
writer.nullValue(); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@Override
public String get() {
final String s = randomUUID().toString();
final String id;
if (count > 0 && length > 0) {
final StringJoiner joiner = new StringJoiner("/", "", "/" + s);
IntStream.rangeClosed(0, count - 1)
.forEach(x -> joiner.add(s.substring(x * length, (x + 1) * length)));
id = joiner.toString();
} else {
id = s;
}
return id;
} }
|
public class class_name {
@Override
public String get() {
final String s = randomUUID().toString();
final String id;
if (count > 0 && length > 0) {
final StringJoiner joiner = new StringJoiner("/", "", "/" + s);
IntStream.rangeClosed(0, count - 1)
.forEach(x -> joiner.add(s.substring(x * length, (x + 1) * length))); // depends on control dependency: [if], data = [none]
id = joiner.toString(); // depends on control dependency: [if], data = [none]
} else {
id = s; // depends on control dependency: [if], data = [none]
}
return id;
} }
|
public class class_name {
public static Method searchForMethod(Class<?> type, String name, Class<?>[] parms) {
try {
return type.getMethod(name, parms);
} catch (NoSuchMethodException e) {}
Method[] methods = type.getMethods();
for (int i = 0; i < methods.length; i++) {
// Has to be named the same of course.
if (!methods[i].getName().equals(name)) {
continue;
}
Class<?>[] types = methods[i].getParameterTypes();
// Does it have the same number of arguments that we're looking for.
if (types.length != parms.length) {
continue;
}
// Check for type compatibility
if (areTypesCompatible(types, parms)) {
return methods[i];
}
}
return null;
} }
|
public class class_name {
public static Method searchForMethod(Class<?> type, String name, Class<?>[] parms) {
try {
return type.getMethod(name, parms); // depends on control dependency: [try], data = [none]
} catch (NoSuchMethodException e) {} // depends on control dependency: [catch], data = [none]
Method[] methods = type.getMethods();
for (int i = 0; i < methods.length; i++) {
// Has to be named the same of course.
if (!methods[i].getName().equals(name)) {
continue;
}
Class<?>[] types = methods[i].getParameterTypes();
// Does it have the same number of arguments that we're looking for.
if (types.length != parms.length) {
continue;
}
// Check for type compatibility
if (areTypesCompatible(types, parms)) {
return methods[i]; // depends on control dependency: [if], data = [none]
}
}
return null;
} }
|
public class class_name {
public T include(final String... includes) {
for (String in : includes) {
rules.include(in);
}
return _this();
} }
|
public class class_name {
public T include(final String... includes) {
for (String in : includes) {
rules.include(in); // depends on control dependency: [for], data = [in]
}
return _this();
} }
|
public class class_name {
private LinkedHashSet<Formula> condenseOperandsOr(final Collection<? extends Formula> operands) {
final LinkedHashSet<Formula> ops = new LinkedHashSet<>();
this.cnfCheck = true;
for (final Formula form : operands)
if (form.type() == OR) {
for (final Formula f : ((NAryOperator) form).operands) {
this.addFormulaOr(ops, f);
if (!this.formulaAdditionResult[0])
return null;
if (!this.formulaAdditionResult[1])
this.cnfCheck = false;
}
} else {
this.addFormulaOr(ops, form);
if (!this.formulaAdditionResult[0])
return null;
if (!this.formulaAdditionResult[1])
this.cnfCheck = false;
}
return ops;
} }
|
public class class_name {
private LinkedHashSet<Formula> condenseOperandsOr(final Collection<? extends Formula> operands) {
final LinkedHashSet<Formula> ops = new LinkedHashSet<>();
this.cnfCheck = true;
for (final Formula form : operands)
if (form.type() == OR) {
for (final Formula f : ((NAryOperator) form).operands) {
this.addFormulaOr(ops, f); // depends on control dependency: [for], data = [f]
if (!this.formulaAdditionResult[0])
return null;
if (!this.formulaAdditionResult[1])
this.cnfCheck = false;
}
} else {
this.addFormulaOr(ops, form); // depends on control dependency: [if], data = [none]
if (!this.formulaAdditionResult[0])
return null;
if (!this.formulaAdditionResult[1])
this.cnfCheck = false;
}
return ops;
} }
|
public class class_name {
private Type createClassType(DeclaredType declaredType, TypeElement typeElement, boolean deep) {
// other
String name = typeElement.getQualifiedName().toString();
if (name.startsWith("java.")) {
Iterator<? extends TypeMirror> i = declaredType.getTypeArguments().iterator();
if (isAssignable(declaredType, mapType)) {
return createMapType(i, deep);
} else if (isAssignable(declaredType, listType)) {
return createCollectionType(Types.LIST, i, deep);
} else if (isAssignable(declaredType, setType)) {
return createCollectionType(Types.SET, i, deep);
} else if (isAssignable(declaredType, collectionType)) {
return createCollectionType(Types.COLLECTION, i, deep);
}
}
TypeCategory typeCategory = TypeCategory.get(name);
if (typeCategory != TypeCategory.NUMERIC
&& isAssignable(typeElement.asType(), comparableType)
&& isSubType(typeElement.asType(), numberType)) {
typeCategory = TypeCategory.NUMERIC;
} else if (!typeCategory.isSubCategoryOf(TypeCategory.COMPARABLE)
&& isAssignable(typeElement.asType(), comparableType)) {
typeCategory = TypeCategory.COMPARABLE;
} else if (typeCategory == TypeCategory.SIMPLE) {
for (Class<? extends Annotation> entityAnn : entityAnnotations) {
if (typeElement.getAnnotation(entityAnn) != null) {
typeCategory = TypeCategory.ENTITY;
}
}
}
List<? extends TypeMirror> arguments = declaredType.getTypeArguments();
// for intersection types etc
if (name.equals("")) {
TypeMirror type = objectType;
if (typeCategory == TypeCategory.COMPARABLE) {
type = comparableType;
}
// find most specific type of superTypes which is a subtype of type
List<? extends TypeMirror> superTypes = env.getTypeUtils().directSupertypes(declaredType);
for (TypeMirror superType : superTypes) {
if (env.getTypeUtils().isSubtype(superType, type)) {
type = superType;
}
}
typeElement = (TypeElement) env.getTypeUtils().asElement(type);
if (type instanceof DeclaredType) {
arguments = ((DeclaredType) type).getTypeArguments();
}
}
Type type = createType(typeElement, typeCategory, arguments, deep);
TypeMirror superType = typeElement.getSuperclass();
TypeElement superTypeElement = null;
if (superType instanceof DeclaredType) {
superTypeElement = (TypeElement) ((DeclaredType) superType).asElement();
}
// entity type
for (Class<? extends Annotation> entityAnn : entityAnnotations) {
if (typeElement.getAnnotation(entityAnn) != null ||
(superTypeElement != null && superTypeElement.getAnnotation(entityAnn) != null)) {
EntityType entityType = new EntityType(type, variableNameFunction);
typeMappings.register(entityType, queryTypeFactory.create(entityType));
return entityType;
}
}
return type;
} }
|
public class class_name {
private Type createClassType(DeclaredType declaredType, TypeElement typeElement, boolean deep) {
// other
String name = typeElement.getQualifiedName().toString();
if (name.startsWith("java.")) {
Iterator<? extends TypeMirror> i = declaredType.getTypeArguments().iterator(); // depends on control dependency: [if], data = [none]
if (isAssignable(declaredType, mapType)) {
return createMapType(i, deep); // depends on control dependency: [if], data = [none]
} else if (isAssignable(declaredType, listType)) {
return createCollectionType(Types.LIST, i, deep); // depends on control dependency: [if], data = [none]
} else if (isAssignable(declaredType, setType)) {
return createCollectionType(Types.SET, i, deep); // depends on control dependency: [if], data = [none]
} else if (isAssignable(declaredType, collectionType)) {
return createCollectionType(Types.COLLECTION, i, deep); // depends on control dependency: [if], data = [none]
}
}
TypeCategory typeCategory = TypeCategory.get(name);
if (typeCategory != TypeCategory.NUMERIC
&& isAssignable(typeElement.asType(), comparableType)
&& isSubType(typeElement.asType(), numberType)) {
typeCategory = TypeCategory.NUMERIC; // depends on control dependency: [if], data = [TypeCategory.NUMERIC]
} else if (!typeCategory.isSubCategoryOf(TypeCategory.COMPARABLE)
&& isAssignable(typeElement.asType(), comparableType)) {
typeCategory = TypeCategory.COMPARABLE; // depends on control dependency: [if], data = [none]
} else if (typeCategory == TypeCategory.SIMPLE) {
for (Class<? extends Annotation> entityAnn : entityAnnotations) {
if (typeElement.getAnnotation(entityAnn) != null) {
typeCategory = TypeCategory.ENTITY; // depends on control dependency: [if], data = [none]
}
}
}
List<? extends TypeMirror> arguments = declaredType.getTypeArguments();
// for intersection types etc
if (name.equals("")) {
TypeMirror type = objectType;
if (typeCategory == TypeCategory.COMPARABLE) {
type = comparableType; // depends on control dependency: [if], data = [none]
}
// find most specific type of superTypes which is a subtype of type
List<? extends TypeMirror> superTypes = env.getTypeUtils().directSupertypes(declaredType); // depends on control dependency: [if], data = [none]
for (TypeMirror superType : superTypes) {
if (env.getTypeUtils().isSubtype(superType, type)) {
type = superType; // depends on control dependency: [if], data = [none]
}
}
typeElement = (TypeElement) env.getTypeUtils().asElement(type); // depends on control dependency: [if], data = [none]
if (type instanceof DeclaredType) {
arguments = ((DeclaredType) type).getTypeArguments(); // depends on control dependency: [if], data = [none]
}
}
Type type = createType(typeElement, typeCategory, arguments, deep);
TypeMirror superType = typeElement.getSuperclass();
TypeElement superTypeElement = null;
if (superType instanceof DeclaredType) {
superTypeElement = (TypeElement) ((DeclaredType) superType).asElement(); // depends on control dependency: [if], data = [none]
}
// entity type
for (Class<? extends Annotation> entityAnn : entityAnnotations) {
if (typeElement.getAnnotation(entityAnn) != null ||
(superTypeElement != null && superTypeElement.getAnnotation(entityAnn) != null)) {
EntityType entityType = new EntityType(type, variableNameFunction);
typeMappings.register(entityType, queryTypeFactory.create(entityType)); // depends on control dependency: [if], data = [none]
return entityType; // depends on control dependency: [if], data = [none]
}
}
return type;
} }
|
public class class_name {
private InternalServerErrorException apiFailure(String path, AuthleteApiException e)
{
// Error message.
String message = String.format("Authlete %s API failed: %s", path, e.getMessage());
// Response body in the response from the Authlete server.
if (e.getResponseBody() != null)
{
// Append the content of the response body to the error message.
message = new StringBuilder(message)
.append(": ").append(e.getResponseBody()).toString();
}
// 500 Internal Server Error
return internalServerError(message, e);
} }
|
public class class_name {
private InternalServerErrorException apiFailure(String path, AuthleteApiException e)
{
// Error message.
String message = String.format("Authlete %s API failed: %s", path, e.getMessage());
// Response body in the response from the Authlete server.
if (e.getResponseBody() != null)
{
// Append the content of the response body to the error message.
message = new StringBuilder(message)
.append(": ").append(e.getResponseBody()).toString(); // depends on control dependency: [if], data = [none]
}
// 500 Internal Server Error
return internalServerError(message, e);
} }
|
public class class_name {
protected Serializer serializer() {
Serializer serializer = this.serializer;
if (serializer == null) {
synchronized (this) {
serializer = this.serializer;
if (serializer == null) {
NamespaceConfig config = this.config.getNamespaceConfig();
if (config == null) {
serializer = Serializer.using(Namespaces.BASIC);
} else {
serializer = Serializer.using(Namespace.builder()
.register(Namespaces.BASIC)
.nextId(Namespaces.BEGIN_USER_CUSTOM_ID)
.register(new Namespace(config))
.build());
}
this.serializer = serializer;
}
}
}
return serializer;
} }
|
public class class_name {
protected Serializer serializer() {
Serializer serializer = this.serializer;
if (serializer == null) {
synchronized (this) { // depends on control dependency: [if], data = [none]
serializer = this.serializer;
if (serializer == null) {
NamespaceConfig config = this.config.getNamespaceConfig();
if (config == null) {
serializer = Serializer.using(Namespaces.BASIC); // depends on control dependency: [if], data = [none]
} else {
serializer = Serializer.using(Namespace.builder()
.register(Namespaces.BASIC)
.nextId(Namespaces.BEGIN_USER_CUSTOM_ID)
.register(new Namespace(config))
.build()); // depends on control dependency: [if], data = [none]
}
this.serializer = serializer; // depends on control dependency: [if], data = [none]
}
}
}
return serializer;
} }
|
public class class_name {
@Override
public boolean isBeatWithinBarMeaningful() {
if (VirtualCdj.getInstance().isRunning()) {
return VirtualCdj.getInstance().getLatestStatusFor(this).isBeatWithinBarMeaningful();
}
return deviceNumber < 33;
} }
|
public class class_name {
@Override
public boolean isBeatWithinBarMeaningful() {
if (VirtualCdj.getInstance().isRunning()) {
return VirtualCdj.getInstance().getLatestStatusFor(this).isBeatWithinBarMeaningful(); // depends on control dependency: [if], data = [none]
}
return deviceNumber < 33;
} }
|
public class class_name {
protected synchronized void add(ValueSet idSet, int bufferType, int cause, int source, boolean fromDepIdTemplateInvalidation, boolean fireEvent,
boolean checkFull) {
final String methodName = "add(ValueSet)";
if (idSet == null || idSet.isEmpty()) {
return;
}
int size = idSet.size();
if (bufferType == EXPLICIT_BUFFER) {
byte info = 0;
if (cause != 0 && source != 0) {
info = (byte) cause;
if (source == CachePerf.REMOTE) {
info = (byte) (info | STATUS_REMOTE);
}
if (fromDepIdTemplateInvalidation) {
info = (byte) (info | STATUS_FROM_DEPID_TEMPLATE);
}
if (fireEvent) {
info = (byte) (info | STATUS_FIRE_EVENT);
}
}
Iterator it = idSet.iterator();
while (it.hasNext()) {
Object entryId = it.next();
this.explicitBuffer.put(entryId, new Byte(info));
}
if (!this.scanBuffer.isEmpty()) {
filter(this.scanBuffer, idSet);
}
} else if (bufferType == SCAN_BUFFER) {
if (!explicitBuffer.isEmpty()) {
filter(idSet, this.explicitBuffer);
}
this.scanBuffer.addAll(idSet);
} else if (bufferType == GC_BUFFER) {
this.garbageCollectorBuffer.addAll(idSet);
}
// if (size > 50) {
traceDebug(methodName, "cacheName=" + this.cod.cacheName + " idSet=" + size + " idSetFilter=" + idSet.size() + " bufferType=" + bufferType
+ " explicitBuffer=" + this.explicitBuffer.size() + " scanBuffer=" + this.scanBuffer.size() + " GCBuffer="
+ this.garbageCollectorBuffer.size());
// }
if ((checkFull && isFull()) || bufferType == GC_BUFFER) { // 3821 NK end
invokeBackgroundInvalidation(!SCAN);
}
} }
|
public class class_name {
protected synchronized void add(ValueSet idSet, int bufferType, int cause, int source, boolean fromDepIdTemplateInvalidation, boolean fireEvent,
boolean checkFull) {
final String methodName = "add(ValueSet)";
if (idSet == null || idSet.isEmpty()) {
return; // depends on control dependency: [if], data = [none]
}
int size = idSet.size();
if (bufferType == EXPLICIT_BUFFER) {
byte info = 0;
if (cause != 0 && source != 0) {
info = (byte) cause; // depends on control dependency: [if], data = [none]
if (source == CachePerf.REMOTE) {
info = (byte) (info | STATUS_REMOTE); // depends on control dependency: [if], data = [none]
}
if (fromDepIdTemplateInvalidation) {
info = (byte) (info | STATUS_FROM_DEPID_TEMPLATE); // depends on control dependency: [if], data = [none]
}
if (fireEvent) {
info = (byte) (info | STATUS_FIRE_EVENT); // depends on control dependency: [if], data = [none]
}
}
Iterator it = idSet.iterator();
while (it.hasNext()) {
Object entryId = it.next();
this.explicitBuffer.put(entryId, new Byte(info)); // depends on control dependency: [while], data = [none]
}
if (!this.scanBuffer.isEmpty()) {
filter(this.scanBuffer, idSet); // depends on control dependency: [if], data = [none]
}
} else if (bufferType == SCAN_BUFFER) {
if (!explicitBuffer.isEmpty()) {
filter(idSet, this.explicitBuffer); // depends on control dependency: [if], data = [none]
}
this.scanBuffer.addAll(idSet); // depends on control dependency: [if], data = [none]
} else if (bufferType == GC_BUFFER) {
this.garbageCollectorBuffer.addAll(idSet); // depends on control dependency: [if], data = [none]
}
// if (size > 50) {
traceDebug(methodName, "cacheName=" + this.cod.cacheName + " idSet=" + size + " idSetFilter=" + idSet.size() + " bufferType=" + bufferType
+ " explicitBuffer=" + this.explicitBuffer.size() + " scanBuffer=" + this.scanBuffer.size() + " GCBuffer="
+ this.garbageCollectorBuffer.size());
// }
if ((checkFull && isFull()) || bufferType == GC_BUFFER) { // 3821 NK end
invokeBackgroundInvalidation(!SCAN); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@Override
protected boolean removeMapping(Object o) {
Lock l = writeLock();
l.lock();
try {
return super.removeMapping(o);
} finally {
l.unlock();
}
} }
|
public class class_name {
@Override
protected boolean removeMapping(Object o) {
Lock l = writeLock();
l.lock();
try {
return super.removeMapping(o); // depends on control dependency: [try], data = [none]
} finally {
l.unlock();
}
} }
|
public class class_name {
protected OType deriveFieldType(ODocument iRecord, String fieldName, OType requestedFieldType) {
// Schema defined types can not be ignored
if (iRecord.getSchemaClass().existsProperty(fieldName)) {
return iRecord.getSchemaClass().getProperty(fieldName).getType();
}
// New type
if (requestedFieldType != null) {
return requestedFieldType;
}
// Existing type (not fixed by the schema)
return iRecord.fieldType(fieldName);
} }
|
public class class_name {
protected OType deriveFieldType(ODocument iRecord, String fieldName, OType requestedFieldType) {
// Schema defined types can not be ignored
if (iRecord.getSchemaClass().existsProperty(fieldName)) {
return iRecord.getSchemaClass().getProperty(fieldName).getType(); // depends on control dependency: [if], data = [none]
}
// New type
if (requestedFieldType != null) {
return requestedFieldType; // depends on control dependency: [if], data = [none]
}
// Existing type (not fixed by the schema)
return iRecord.fieldType(fieldName);
} }
|
public class class_name {
@Override
public boolean diff(Node right, Buffer rightBuffer) throws IOException {
if (right instanceof FileNode) {
if (size() != right.size()) {
return true;
}
}
return super.diff(right, rightBuffer);
} }
|
public class class_name {
@Override
public boolean diff(Node right, Buffer rightBuffer) throws IOException {
if (right instanceof FileNode) {
if (size() != right.size()) {
return true; // depends on control dependency: [if], data = [none]
}
}
return super.diff(right, rightBuffer);
} }
|
public class class_name {
@Override
protected void recycleAdViewWrapper(@NonNull ViewGroup wrapper, @NonNull NativeExpressAdView ad) {
for (int i = 0; i < wrapper.getChildCount(); i++) {
View v = wrapper.getChildAt(i);
if (v instanceof NativeExpressAdView) {
wrapper.removeViewAt(i);
break;
}
}
} }
|
public class class_name {
@Override
protected void recycleAdViewWrapper(@NonNull ViewGroup wrapper, @NonNull NativeExpressAdView ad) {
for (int i = 0; i < wrapper.getChildCount(); i++) {
View v = wrapper.getChildAt(i);
if (v instanceof NativeExpressAdView) {
wrapper.removeViewAt(i); // depends on control dependency: [if], data = [none]
break;
}
}
} }
|
public class class_name {
static String getFinalDefaultValue(XsdAbstractElement parent) {
if (parent == null) return null;
if (parent instanceof XsdSchema){
return ((XsdSchema)parent).getFinalDefault();
}
return getFinalDefaultValue(parent.getParent());
} }
|
public class class_name {
static String getFinalDefaultValue(XsdAbstractElement parent) {
if (parent == null) return null;
if (parent instanceof XsdSchema){
return ((XsdSchema)parent).getFinalDefault(); // depends on control dependency: [if], data = [none]
}
return getFinalDefaultValue(parent.getParent());
} }
|
public class class_name {
@Override
public void destroy() {
try {
super.destroy();
} finally {
if (myOwnJdbcHelper && defaultJdbcHelper != null
&& defaultJdbcHelper instanceof AbstractJdbcHelper) {
try {
((AbstractJdbcHelper) defaultJdbcHelper).destroy();
} catch (Exception e) {
LOGGER.warn(e.getMessage(), e);
} finally {
defaultJdbcHelper = null;
}
}
}
} }
|
public class class_name {
@Override
public void destroy() {
try {
super.destroy(); // depends on control dependency: [try], data = [none]
} finally {
if (myOwnJdbcHelper && defaultJdbcHelper != null
&& defaultJdbcHelper instanceof AbstractJdbcHelper) {
try {
((AbstractJdbcHelper) defaultJdbcHelper).destroy(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
LOGGER.warn(e.getMessage(), e);
} finally { // depends on control dependency: [catch], data = [none]
defaultJdbcHelper = null;
}
}
}
} }
|
public class class_name {
public Long zrank(Object key, Object member) {
Jedis jedis = getJedis();
try {
return jedis.zrank(keyToBytes(key), valueToBytes(member));
}
finally {close(jedis);}
} }
|
public class class_name {
public Long zrank(Object key, Object member) {
Jedis jedis = getJedis();
try {
return jedis.zrank(keyToBytes(key), valueToBytes(member));
// depends on control dependency: [try], data = [none]
}
finally {close(jedis);}
} }
|
public class class_name {
public final EObject ruleInitialisedVariableDeclaration() throws RecognitionException {
EObject current = null;
Token lv_writeable_1_0=null;
Token otherlv_2=null;
Token otherlv_6=null;
EObject lv_type_3_0 = null;
AntlrDatatypeRuleToken lv_name_4_0 = null;
AntlrDatatypeRuleToken lv_name_5_0 = null;
EObject lv_right_7_0 = null;
enterRule();
try {
// InternalPureXbase.g:506:2: ( ( () ( ( (lv_writeable_1_0= 'var' ) ) | otherlv_2= 'val' ) ( ( ( ( ( ( ruleJvmTypeReference ) ) ( ( ruleValidID ) ) ) )=> ( ( (lv_type_3_0= ruleJvmTypeReference ) ) ( (lv_name_4_0= ruleValidID ) ) ) ) | ( (lv_name_5_0= ruleValidID ) ) ) otherlv_6= '=' ( (lv_right_7_0= ruleXExpression ) ) ) )
// InternalPureXbase.g:507:2: ( () ( ( (lv_writeable_1_0= 'var' ) ) | otherlv_2= 'val' ) ( ( ( ( ( ( ruleJvmTypeReference ) ) ( ( ruleValidID ) ) ) )=> ( ( (lv_type_3_0= ruleJvmTypeReference ) ) ( (lv_name_4_0= ruleValidID ) ) ) ) | ( (lv_name_5_0= ruleValidID ) ) ) otherlv_6= '=' ( (lv_right_7_0= ruleXExpression ) ) )
{
// InternalPureXbase.g:507:2: ( () ( ( (lv_writeable_1_0= 'var' ) ) | otherlv_2= 'val' ) ( ( ( ( ( ( ruleJvmTypeReference ) ) ( ( ruleValidID ) ) ) )=> ( ( (lv_type_3_0= ruleJvmTypeReference ) ) ( (lv_name_4_0= ruleValidID ) ) ) ) | ( (lv_name_5_0= ruleValidID ) ) ) otherlv_6= '=' ( (lv_right_7_0= ruleXExpression ) ) )
// InternalPureXbase.g:508:3: () ( ( (lv_writeable_1_0= 'var' ) ) | otherlv_2= 'val' ) ( ( ( ( ( ( ruleJvmTypeReference ) ) ( ( ruleValidID ) ) ) )=> ( ( (lv_type_3_0= ruleJvmTypeReference ) ) ( (lv_name_4_0= ruleValidID ) ) ) ) | ( (lv_name_5_0= ruleValidID ) ) ) otherlv_6= '=' ( (lv_right_7_0= ruleXExpression ) )
{
// InternalPureXbase.g:508:3: ()
// InternalPureXbase.g:509:4:
{
if ( state.backtracking==0 ) {
current = forceCreateModelElement(
grammarAccess.getInitialisedVariableDeclarationAccess().getXVariableDeclarationAction_0(),
current);
}
}
// InternalPureXbase.g:515:3: ( ( (lv_writeable_1_0= 'var' ) ) | otherlv_2= 'val' )
int alt14=2;
int LA14_0 = input.LA(1);
if ( (LA14_0==18) ) {
alt14=1;
}
else if ( (LA14_0==19) ) {
alt14=2;
}
else {
if (state.backtracking>0) {state.failed=true; return current;}
NoViableAltException nvae =
new NoViableAltException("", 14, 0, input);
throw nvae;
}
switch (alt14) {
case 1 :
// InternalPureXbase.g:516:4: ( (lv_writeable_1_0= 'var' ) )
{
// InternalPureXbase.g:516:4: ( (lv_writeable_1_0= 'var' ) )
// InternalPureXbase.g:517:5: (lv_writeable_1_0= 'var' )
{
// InternalPureXbase.g:517:5: (lv_writeable_1_0= 'var' )
// InternalPureXbase.g:518:6: lv_writeable_1_0= 'var'
{
lv_writeable_1_0=(Token)match(input,18,FOLLOW_11); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(lv_writeable_1_0, grammarAccess.getInitialisedVariableDeclarationAccess().getWriteableVarKeyword_1_0_0());
}
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElement(grammarAccess.getInitialisedVariableDeclarationRule());
}
setWithLastConsumed(current, "writeable", true, "var");
}
}
}
}
break;
case 2 :
// InternalPureXbase.g:531:4: otherlv_2= 'val'
{
otherlv_2=(Token)match(input,19,FOLLOW_11); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_2, grammarAccess.getInitialisedVariableDeclarationAccess().getValKeyword_1_1());
}
}
break;
}
// InternalPureXbase.g:536:3: ( ( ( ( ( ( ruleJvmTypeReference ) ) ( ( ruleValidID ) ) ) )=> ( ( (lv_type_3_0= ruleJvmTypeReference ) ) ( (lv_name_4_0= ruleValidID ) ) ) ) | ( (lv_name_5_0= ruleValidID ) ) )
int alt15=2;
int LA15_0 = input.LA(1);
if ( (LA15_0==RULE_ID) ) {
int LA15_1 = input.LA(2);
if ( (LA15_1==20) ) {
alt15=2;
}
else if ( (LA15_1==54) && (synpred6_InternalPureXbase())) {
alt15=1;
}
else if ( (LA15_1==28) && (synpred6_InternalPureXbase())) {
alt15=1;
}
else if ( (LA15_1==61) && (synpred6_InternalPureXbase())) {
alt15=1;
}
else if ( (LA15_1==RULE_ID) && (synpred6_InternalPureXbase())) {
alt15=1;
}
else {
if (state.backtracking>0) {state.failed=true; return current;}
NoViableAltException nvae =
new NoViableAltException("", 15, 1, input);
throw nvae;
}
}
else if ( (LA15_0==15) && (synpred6_InternalPureXbase())) {
alt15=1;
}
else if ( (LA15_0==41) && (synpred6_InternalPureXbase())) {
alt15=1;
}
else {
if (state.backtracking>0) {state.failed=true; return current;}
NoViableAltException nvae =
new NoViableAltException("", 15, 0, input);
throw nvae;
}
switch (alt15) {
case 1 :
// InternalPureXbase.g:537:4: ( ( ( ( ( ruleJvmTypeReference ) ) ( ( ruleValidID ) ) ) )=> ( ( (lv_type_3_0= ruleJvmTypeReference ) ) ( (lv_name_4_0= ruleValidID ) ) ) )
{
// InternalPureXbase.g:537:4: ( ( ( ( ( ruleJvmTypeReference ) ) ( ( ruleValidID ) ) ) )=> ( ( (lv_type_3_0= ruleJvmTypeReference ) ) ( (lv_name_4_0= ruleValidID ) ) ) )
// InternalPureXbase.g:538:5: ( ( ( ( ruleJvmTypeReference ) ) ( ( ruleValidID ) ) ) )=> ( ( (lv_type_3_0= ruleJvmTypeReference ) ) ( (lv_name_4_0= ruleValidID ) ) )
{
// InternalPureXbase.g:551:5: ( ( (lv_type_3_0= ruleJvmTypeReference ) ) ( (lv_name_4_0= ruleValidID ) ) )
// InternalPureXbase.g:552:6: ( (lv_type_3_0= ruleJvmTypeReference ) ) ( (lv_name_4_0= ruleValidID ) )
{
// InternalPureXbase.g:552:6: ( (lv_type_3_0= ruleJvmTypeReference ) )
// InternalPureXbase.g:553:7: (lv_type_3_0= ruleJvmTypeReference )
{
// InternalPureXbase.g:553:7: (lv_type_3_0= ruleJvmTypeReference )
// InternalPureXbase.g:554:8: lv_type_3_0= ruleJvmTypeReference
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getInitialisedVariableDeclarationAccess().getTypeJvmTypeReferenceParserRuleCall_2_0_0_0_0());
}
pushFollow(FOLLOW_12);
lv_type_3_0=ruleJvmTypeReference();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getInitialisedVariableDeclarationRule());
}
set(
current,
"type",
lv_type_3_0,
"org.eclipse.xtext.xbase.Xtype.JvmTypeReference");
afterParserOrEnumRuleCall();
}
}
}
// InternalPureXbase.g:571:6: ( (lv_name_4_0= ruleValidID ) )
// InternalPureXbase.g:572:7: (lv_name_4_0= ruleValidID )
{
// InternalPureXbase.g:572:7: (lv_name_4_0= ruleValidID )
// InternalPureXbase.g:573:8: lv_name_4_0= ruleValidID
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getInitialisedVariableDeclarationAccess().getNameValidIDParserRuleCall_2_0_0_1_0());
}
pushFollow(FOLLOW_13);
lv_name_4_0=ruleValidID();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getInitialisedVariableDeclarationRule());
}
set(
current,
"name",
lv_name_4_0,
"org.eclipse.xtext.xbase.Xtype.ValidID");
afterParserOrEnumRuleCall();
}
}
}
}
}
}
break;
case 2 :
// InternalPureXbase.g:593:4: ( (lv_name_5_0= ruleValidID ) )
{
// InternalPureXbase.g:593:4: ( (lv_name_5_0= ruleValidID ) )
// InternalPureXbase.g:594:5: (lv_name_5_0= ruleValidID )
{
// InternalPureXbase.g:594:5: (lv_name_5_0= ruleValidID )
// InternalPureXbase.g:595:6: lv_name_5_0= ruleValidID
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getInitialisedVariableDeclarationAccess().getNameValidIDParserRuleCall_2_1_0());
}
pushFollow(FOLLOW_13);
lv_name_5_0=ruleValidID();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getInitialisedVariableDeclarationRule());
}
set(
current,
"name",
lv_name_5_0,
"org.eclipse.xtext.xbase.Xtype.ValidID");
afterParserOrEnumRuleCall();
}
}
}
}
break;
}
otherlv_6=(Token)match(input,20,FOLLOW_3); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_6, grammarAccess.getInitialisedVariableDeclarationAccess().getEqualsSignKeyword_3());
}
// InternalPureXbase.g:617:3: ( (lv_right_7_0= ruleXExpression ) )
// InternalPureXbase.g:618:4: (lv_right_7_0= ruleXExpression )
{
// InternalPureXbase.g:618:4: (lv_right_7_0= ruleXExpression )
// InternalPureXbase.g:619:5: lv_right_7_0= ruleXExpression
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getInitialisedVariableDeclarationAccess().getRightXExpressionParserRuleCall_4_0());
}
pushFollow(FOLLOW_2);
lv_right_7_0=ruleXExpression();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getInitialisedVariableDeclarationRule());
}
set(
current,
"right",
lv_right_7_0,
"org.eclipse.xtext.xbase.Xbase.XExpression");
afterParserOrEnumRuleCall();
}
}
}
}
}
if ( state.backtracking==0 ) {
leaveRule();
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
} }
|
public class class_name {
public final EObject ruleInitialisedVariableDeclaration() throws RecognitionException {
EObject current = null;
Token lv_writeable_1_0=null;
Token otherlv_2=null;
Token otherlv_6=null;
EObject lv_type_3_0 = null;
AntlrDatatypeRuleToken lv_name_4_0 = null;
AntlrDatatypeRuleToken lv_name_5_0 = null;
EObject lv_right_7_0 = null;
enterRule();
try {
// InternalPureXbase.g:506:2: ( ( () ( ( (lv_writeable_1_0= 'var' ) ) | otherlv_2= 'val' ) ( ( ( ( ( ( ruleJvmTypeReference ) ) ( ( ruleValidID ) ) ) )=> ( ( (lv_type_3_0= ruleJvmTypeReference ) ) ( (lv_name_4_0= ruleValidID ) ) ) ) | ( (lv_name_5_0= ruleValidID ) ) ) otherlv_6= '=' ( (lv_right_7_0= ruleXExpression ) ) ) )
// InternalPureXbase.g:507:2: ( () ( ( (lv_writeable_1_0= 'var' ) ) | otherlv_2= 'val' ) ( ( ( ( ( ( ruleJvmTypeReference ) ) ( ( ruleValidID ) ) ) )=> ( ( (lv_type_3_0= ruleJvmTypeReference ) ) ( (lv_name_4_0= ruleValidID ) ) ) ) | ( (lv_name_5_0= ruleValidID ) ) ) otherlv_6= '=' ( (lv_right_7_0= ruleXExpression ) ) )
{
// InternalPureXbase.g:507:2: ( () ( ( (lv_writeable_1_0= 'var' ) ) | otherlv_2= 'val' ) ( ( ( ( ( ( ruleJvmTypeReference ) ) ( ( ruleValidID ) ) ) )=> ( ( (lv_type_3_0= ruleJvmTypeReference ) ) ( (lv_name_4_0= ruleValidID ) ) ) ) | ( (lv_name_5_0= ruleValidID ) ) ) otherlv_6= '=' ( (lv_right_7_0= ruleXExpression ) ) )
// InternalPureXbase.g:508:3: () ( ( (lv_writeable_1_0= 'var' ) ) | otherlv_2= 'val' ) ( ( ( ( ( ( ruleJvmTypeReference ) ) ( ( ruleValidID ) ) ) )=> ( ( (lv_type_3_0= ruleJvmTypeReference ) ) ( (lv_name_4_0= ruleValidID ) ) ) ) | ( (lv_name_5_0= ruleValidID ) ) ) otherlv_6= '=' ( (lv_right_7_0= ruleXExpression ) )
{
// InternalPureXbase.g:508:3: ()
// InternalPureXbase.g:509:4:
{
if ( state.backtracking==0 ) {
current = forceCreateModelElement(
grammarAccess.getInitialisedVariableDeclarationAccess().getXVariableDeclarationAction_0(),
current); // depends on control dependency: [if], data = [none]
}
}
// InternalPureXbase.g:515:3: ( ( (lv_writeable_1_0= 'var' ) ) | otherlv_2= 'val' )
int alt14=2;
int LA14_0 = input.LA(1);
if ( (LA14_0==18) ) {
alt14=1; // depends on control dependency: [if], data = [none]
}
else if ( (LA14_0==19) ) {
alt14=2; // depends on control dependency: [if], data = [none]
}
else {
if (state.backtracking>0) {state.failed=true; return current;} // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
NoViableAltException nvae =
new NoViableAltException("", 14, 0, input);
throw nvae;
}
switch (alt14) {
case 1 :
// InternalPureXbase.g:516:4: ( (lv_writeable_1_0= 'var' ) )
{
// InternalPureXbase.g:516:4: ( (lv_writeable_1_0= 'var' ) )
// InternalPureXbase.g:517:5: (lv_writeable_1_0= 'var' )
{
// InternalPureXbase.g:517:5: (lv_writeable_1_0= 'var' )
// InternalPureXbase.g:518:6: lv_writeable_1_0= 'var'
{
lv_writeable_1_0=(Token)match(input,18,FOLLOW_11); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(lv_writeable_1_0, grammarAccess.getInitialisedVariableDeclarationAccess().getWriteableVarKeyword_1_0_0()); // depends on control dependency: [if], data = [none]
}
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElement(grammarAccess.getInitialisedVariableDeclarationRule()); // depends on control dependency: [if], data = [none]
}
setWithLastConsumed(current, "writeable", true, "var"); // depends on control dependency: [if], data = [none]
}
}
}
}
break;
case 2 :
// InternalPureXbase.g:531:4: otherlv_2= 'val'
{
otherlv_2=(Token)match(input,19,FOLLOW_11); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_2, grammarAccess.getInitialisedVariableDeclarationAccess().getValKeyword_1_1()); // depends on control dependency: [if], data = [none]
}
}
break;
}
// InternalPureXbase.g:536:3: ( ( ( ( ( ( ruleJvmTypeReference ) ) ( ( ruleValidID ) ) ) )=> ( ( (lv_type_3_0= ruleJvmTypeReference ) ) ( (lv_name_4_0= ruleValidID ) ) ) ) | ( (lv_name_5_0= ruleValidID ) ) )
int alt15=2;
int LA15_0 = input.LA(1);
if ( (LA15_0==RULE_ID) ) {
int LA15_1 = input.LA(2);
if ( (LA15_1==20) ) {
alt15=2; // depends on control dependency: [if], data = [none]
}
else if ( (LA15_1==54) && (synpred6_InternalPureXbase())) {
alt15=1; // depends on control dependency: [if], data = [none]
}
else if ( (LA15_1==28) && (synpred6_InternalPureXbase())) {
alt15=1; // depends on control dependency: [if], data = [none]
}
else if ( (LA15_1==61) && (synpred6_InternalPureXbase())) {
alt15=1; // depends on control dependency: [if], data = [none]
}
else if ( (LA15_1==RULE_ID) && (synpred6_InternalPureXbase())) {
alt15=1; // depends on control dependency: [if], data = [none]
}
else {
if (state.backtracking>0) {state.failed=true; return current;} // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
NoViableAltException nvae =
new NoViableAltException("", 15, 1, input);
throw nvae;
}
}
else if ( (LA15_0==15) && (synpred6_InternalPureXbase())) {
alt15=1; // depends on control dependency: [if], data = [none]
}
else if ( (LA15_0==41) && (synpred6_InternalPureXbase())) {
alt15=1; // depends on control dependency: [if], data = [none]
}
else {
if (state.backtracking>0) {state.failed=true; return current;} // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
NoViableAltException nvae =
new NoViableAltException("", 15, 0, input);
throw nvae;
}
switch (alt15) {
case 1 :
// InternalPureXbase.g:537:4: ( ( ( ( ( ruleJvmTypeReference ) ) ( ( ruleValidID ) ) ) )=> ( ( (lv_type_3_0= ruleJvmTypeReference ) ) ( (lv_name_4_0= ruleValidID ) ) ) )
{
// InternalPureXbase.g:537:4: ( ( ( ( ( ruleJvmTypeReference ) ) ( ( ruleValidID ) ) ) )=> ( ( (lv_type_3_0= ruleJvmTypeReference ) ) ( (lv_name_4_0= ruleValidID ) ) ) )
// InternalPureXbase.g:538:5: ( ( ( ( ruleJvmTypeReference ) ) ( ( ruleValidID ) ) ) )=> ( ( (lv_type_3_0= ruleJvmTypeReference ) ) ( (lv_name_4_0= ruleValidID ) ) )
{
// InternalPureXbase.g:551:5: ( ( (lv_type_3_0= ruleJvmTypeReference ) ) ( (lv_name_4_0= ruleValidID ) ) )
// InternalPureXbase.g:552:6: ( (lv_type_3_0= ruleJvmTypeReference ) ) ( (lv_name_4_0= ruleValidID ) )
{
// InternalPureXbase.g:552:6: ( (lv_type_3_0= ruleJvmTypeReference ) )
// InternalPureXbase.g:553:7: (lv_type_3_0= ruleJvmTypeReference )
{
// InternalPureXbase.g:553:7: (lv_type_3_0= ruleJvmTypeReference )
// InternalPureXbase.g:554:8: lv_type_3_0= ruleJvmTypeReference
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getInitialisedVariableDeclarationAccess().getTypeJvmTypeReferenceParserRuleCall_2_0_0_0_0()); // depends on control dependency: [if], data = [none]
}
pushFollow(FOLLOW_12);
lv_type_3_0=ruleJvmTypeReference();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getInitialisedVariableDeclarationRule()); // depends on control dependency: [if], data = [none]
}
set(
current,
"type",
lv_type_3_0,
"org.eclipse.xtext.xbase.Xtype.JvmTypeReference"); // depends on control dependency: [if], data = [none]
afterParserOrEnumRuleCall(); // depends on control dependency: [if], data = [none]
}
}
}
// InternalPureXbase.g:571:6: ( (lv_name_4_0= ruleValidID ) )
// InternalPureXbase.g:572:7: (lv_name_4_0= ruleValidID )
{
// InternalPureXbase.g:572:7: (lv_name_4_0= ruleValidID )
// InternalPureXbase.g:573:8: lv_name_4_0= ruleValidID
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getInitialisedVariableDeclarationAccess().getNameValidIDParserRuleCall_2_0_0_1_0()); // depends on control dependency: [if], data = [none]
}
pushFollow(FOLLOW_13);
lv_name_4_0=ruleValidID();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getInitialisedVariableDeclarationRule()); // depends on control dependency: [if], data = [none]
}
set(
current,
"name",
lv_name_4_0,
"org.eclipse.xtext.xbase.Xtype.ValidID"); // depends on control dependency: [if], data = [none]
afterParserOrEnumRuleCall(); // depends on control dependency: [if], data = [none]
}
}
}
}
}
}
break;
case 2 :
// InternalPureXbase.g:593:4: ( (lv_name_5_0= ruleValidID ) )
{
// InternalPureXbase.g:593:4: ( (lv_name_5_0= ruleValidID ) )
// InternalPureXbase.g:594:5: (lv_name_5_0= ruleValidID )
{
// InternalPureXbase.g:594:5: (lv_name_5_0= ruleValidID )
// InternalPureXbase.g:595:6: lv_name_5_0= ruleValidID
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getInitialisedVariableDeclarationAccess().getNameValidIDParserRuleCall_2_1_0()); // depends on control dependency: [if], data = [none]
}
pushFollow(FOLLOW_13);
lv_name_5_0=ruleValidID();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getInitialisedVariableDeclarationRule()); // depends on control dependency: [if], data = [none]
}
set(
current,
"name",
lv_name_5_0,
"org.eclipse.xtext.xbase.Xtype.ValidID"); // depends on control dependency: [if], data = [none]
afterParserOrEnumRuleCall(); // depends on control dependency: [if], data = [none]
}
}
}
}
break;
}
otherlv_6=(Token)match(input,20,FOLLOW_3); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_6, grammarAccess.getInitialisedVariableDeclarationAccess().getEqualsSignKeyword_3()); // depends on control dependency: [if], data = [none]
}
// InternalPureXbase.g:617:3: ( (lv_right_7_0= ruleXExpression ) )
// InternalPureXbase.g:618:4: (lv_right_7_0= ruleXExpression )
{
// InternalPureXbase.g:618:4: (lv_right_7_0= ruleXExpression )
// InternalPureXbase.g:619:5: lv_right_7_0= ruleXExpression
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getInitialisedVariableDeclarationAccess().getRightXExpressionParserRuleCall_4_0()); // depends on control dependency: [if], data = [none]
}
pushFollow(FOLLOW_2);
lv_right_7_0=ruleXExpression();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getInitialisedVariableDeclarationRule()); // depends on control dependency: [if], data = [none]
}
set(
current,
"right",
lv_right_7_0,
"org.eclipse.xtext.xbase.Xbase.XExpression");
afterParserOrEnumRuleCall(); // depends on control dependency: [if], data = [none]
}
}
}
}
}
if ( state.backtracking==0 ) {
leaveRule(); // depends on control dependency: [if], data = [none]
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
} }
|
public class class_name {
public void householderSymmetric( int row , double gamma )
{
int startU = row*N;
// compute v = -gamma*A*u
for( int i = row+1; i < N; i++ ) {
double totalReal = 0;
double totalImag = 0;
// the lower triangle is not written to so it needs to traverse upwards
// to get the information. Reduces the number of matrix writes need
// improving large matrix performance
for( int j = row+1; j < i; j++ ) {
double realA = QT.data[(j*N+i)*2];
double imagA = -QT.data[(j*N+i)*2+1];
double realU = QT.data[(startU+j)*2];
double imagU = QT.data[(startU+j)*2+1];
totalReal += realA*realU - imagA*imagU;
totalImag += realA*imagU + imagA*realU;
}
for( int j = i; j < N; j++ ) {
double realA = QT.data[(i*N+j)*2];
double imagA = QT.data[(i*N+j)*2+1];
double realU = QT.data[(startU+j)*2];
double imagU = QT.data[(startU+j)*2+1];
totalReal += realA*realU - imagA*imagU;
totalImag += realA*imagU + imagA*realU;
}
w[i*2] = -gamma*totalReal;
w[i*2+1] = -gamma*totalImag;
}
// alpha = -0.5*gamma*u^T*v
double realAplha = 0;
double imageAlpha = 0;
for( int i = row+1; i < N; i++ ) {
double realU = QT.data[(startU+i)*2];
double imagU = -QT.data[(startU+i)*2+1];
double realV = w[i*2];
double imagV = w[i*2+1];
realAplha += realU*realV - imagU*imagV;
imageAlpha += realU*imagV + imagU*realV;
}
realAplha *= -0.5*gamma;
imageAlpha *= -0.5*gamma;
// w = v + alpha*u
for( int i = row+1; i < N; i++ ) {
double realU = QT.data[(startU+i)*2];
double imagU = QT.data[(startU+i)*2+1];
w[i*2] += realAplha*realU - imageAlpha*imagU;
w[i*2+1] += realAplha*imagU + imageAlpha*realU;
}
// A = A + w*u^T + u*w^T
for( int i = row+1; i < N; i++ ) {
double realWW = w[i*2];
double imagWW = w[i*2+1];
double realUU = QT.data[(startU+i)*2];
double imagUU = QT.data[(startU+i)*2+1];
int indA = (i*N+i)*2;
for( int j = i; j < N; j++ ) {
// only write to the upper portion of the matrix
// this reduces the number of cache misses
double realU = QT.data[(startU+j)*2];
double imagU = -QT.data[(startU+j)*2+1];
double realW = w[j*2];
double imagW = -w[j*2+1];
QT.data[indA++] += realWW*realU - imagWW*imagU + realW*realUU - imagW*imagUU;
QT.data[indA++] += realWW*imagU + imagWW*realU + realW*imagUU + imagW*realUU;
}
}
} }
|
public class class_name {
public void householderSymmetric( int row , double gamma )
{
int startU = row*N;
// compute v = -gamma*A*u
for( int i = row+1; i < N; i++ ) {
double totalReal = 0;
double totalImag = 0;
// the lower triangle is not written to so it needs to traverse upwards
// to get the information. Reduces the number of matrix writes need
// improving large matrix performance
for( int j = row+1; j < i; j++ ) {
double realA = QT.data[(j*N+i)*2];
double imagA = -QT.data[(j*N+i)*2+1];
double realU = QT.data[(startU+j)*2];
double imagU = QT.data[(startU+j)*2+1];
totalReal += realA*realU - imagA*imagU; // depends on control dependency: [for], data = [none]
totalImag += realA*imagU + imagA*realU; // depends on control dependency: [for], data = [none]
}
for( int j = i; j < N; j++ ) {
double realA = QT.data[(i*N+j)*2];
double imagA = QT.data[(i*N+j)*2+1];
double realU = QT.data[(startU+j)*2];
double imagU = QT.data[(startU+j)*2+1];
totalReal += realA*realU - imagA*imagU; // depends on control dependency: [for], data = [none]
totalImag += realA*imagU + imagA*realU; // depends on control dependency: [for], data = [none]
}
w[i*2] = -gamma*totalReal; // depends on control dependency: [for], data = [i]
w[i*2+1] = -gamma*totalImag; // depends on control dependency: [for], data = [i]
}
// alpha = -0.5*gamma*u^T*v
double realAplha = 0;
double imageAlpha = 0;
for( int i = row+1; i < N; i++ ) {
double realU = QT.data[(startU+i)*2];
double imagU = -QT.data[(startU+i)*2+1];
double realV = w[i*2];
double imagV = w[i*2+1];
realAplha += realU*realV - imagU*imagV; // depends on control dependency: [for], data = [none]
imageAlpha += realU*imagV + imagU*realV; // depends on control dependency: [for], data = [none]
}
realAplha *= -0.5*gamma;
imageAlpha *= -0.5*gamma;
// w = v + alpha*u
for( int i = row+1; i < N; i++ ) {
double realU = QT.data[(startU+i)*2];
double imagU = QT.data[(startU+i)*2+1];
w[i*2] += realAplha*realU - imageAlpha*imagU; // depends on control dependency: [for], data = [i]
w[i*2+1] += realAplha*imagU + imageAlpha*realU; // depends on control dependency: [for], data = [i]
}
// A = A + w*u^T + u*w^T
for( int i = row+1; i < N; i++ ) {
double realWW = w[i*2];
double imagWW = w[i*2+1];
double realUU = QT.data[(startU+i)*2];
double imagUU = QT.data[(startU+i)*2+1];
int indA = (i*N+i)*2;
for( int j = i; j < N; j++ ) {
// only write to the upper portion of the matrix
// this reduces the number of cache misses
double realU = QT.data[(startU+j)*2];
double imagU = -QT.data[(startU+j)*2+1];
double realW = w[j*2];
double imagW = -w[j*2+1];
QT.data[indA++] += realWW*realU - imagWW*imagU + realW*realUU - imagW*imagUU; // depends on control dependency: [for], data = [none]
QT.data[indA++] += realWW*imagU + imagWW*realU + realW*imagUU + imagW*realUU; // depends on control dependency: [for], data = [none]
}
}
} }
|
public class class_name {
public static final Integer compare(Object a, Object b) {
if (a==b) return 0;
if (a==null || b==null) return null;
assert a!=null && b!=null;
if (a instanceof Number && b instanceof Number) {
Number an = (Number)a;
Number bn = (Number)b;
if (Double.isNaN(an.doubleValue()) || Double.isNaN(bn.doubleValue())) {
if (Double.isNaN(an.doubleValue()) && Double.isNaN(bn.doubleValue())) return 0;
else return null;
} else {
if (an.doubleValue()==bn.doubleValue()) {
// Long.compare(long,long) is only available since Java 1.7
//return Long.compare(an.longValue(),bn.longValue());
return Long.valueOf(an.longValue()).compareTo(Long.valueOf(bn.longValue()));
} else {
return Double.compare(an.doubleValue(),bn.doubleValue());
}
}
} else {
try {
return ((Comparable)a).compareTo(b);
} catch (Throwable e) {
log.debug("Could not compare elements: {} - {}",a,b);
return null;
}
}
} }
|
public class class_name {
public static final Integer compare(Object a, Object b) {
if (a==b) return 0;
if (a==null || b==null) return null;
assert a!=null && b!=null;
if (a instanceof Number && b instanceof Number) {
Number an = (Number)a;
Number bn = (Number)b;
if (Double.isNaN(an.doubleValue()) || Double.isNaN(bn.doubleValue())) {
if (Double.isNaN(an.doubleValue()) && Double.isNaN(bn.doubleValue())) return 0;
else return null;
} else {
if (an.doubleValue()==bn.doubleValue()) {
// Long.compare(long,long) is only available since Java 1.7
//return Long.compare(an.longValue(),bn.longValue());
return Long.valueOf(an.longValue()).compareTo(Long.valueOf(bn.longValue())); // depends on control dependency: [if], data = [none]
} else {
return Double.compare(an.doubleValue(),bn.doubleValue()); // depends on control dependency: [if], data = [(an.doubleValue()]
}
}
} else {
try {
return ((Comparable)a).compareTo(b); // depends on control dependency: [try], data = [none]
} catch (Throwable e) {
log.debug("Could not compare elements: {} - {}",a,b);
return null;
} // depends on control dependency: [catch], data = [none]
}
} }
|
public class class_name {
public static DMatrixRBlock identity(int numRows, int numCols, int blockLength ) {
DMatrixRBlock A = new DMatrixRBlock(numRows,numCols,blockLength);
int minLength = Math.min(numRows,numCols);
for( int i = 0; i < minLength; i += blockLength ) {
int h = Math.min(blockLength,A.numRows-i);
int w = Math.min(blockLength,A.numCols-i);
int index = i*A.numCols + h*i;
int m = Math.min(h,w);
for( int k = 0; k < m; k++ ) {
A.data[index + k*w + k ] = 1;
}
}
return A;
} }
|
public class class_name {
public static DMatrixRBlock identity(int numRows, int numCols, int blockLength ) {
DMatrixRBlock A = new DMatrixRBlock(numRows,numCols,blockLength);
int minLength = Math.min(numRows,numCols);
for( int i = 0; i < minLength; i += blockLength ) {
int h = Math.min(blockLength,A.numRows-i);
int w = Math.min(blockLength,A.numCols-i);
int index = i*A.numCols + h*i;
int m = Math.min(h,w);
for( int k = 0; k < m; k++ ) {
A.data[index + k*w + k ] = 1; // depends on control dependency: [for], data = [k]
}
}
return A;
} }
|
public class class_name {
private void minmax() {
gmin = Double.MAX_VALUE;
gmax = -Double.MAX_VALUE;
for (SupportVector v : sv) {
double g = -v.g[0];
double a = v.alpha[0];
if (g < gmin && a > 0.0) {
svmin = v;
gmin = g;
gminindex = 0;
}
if (g > gmax && a < v.C) {
svmax = v;
gmax = g;
gmaxindex = 0;
}
g = v.g[1];
a = v.alpha[1];
if (g < gmin && a < v.C) {
svmin = v;
gmin = g;
gminindex = 1;
}
if (g > gmax && a > 0.0) {
svmax = v;
gmax = g;
gmaxindex = 1;
}
}
} }
|
public class class_name {
private void minmax() {
gmin = Double.MAX_VALUE;
gmax = -Double.MAX_VALUE;
for (SupportVector v : sv) {
double g = -v.g[0];
double a = v.alpha[0];
if (g < gmin && a > 0.0) {
svmin = v; // depends on control dependency: [if], data = [none]
gmin = g; // depends on control dependency: [if], data = [none]
gminindex = 0; // depends on control dependency: [if], data = [none]
}
if (g > gmax && a < v.C) {
svmax = v; // depends on control dependency: [if], data = [none]
gmax = g; // depends on control dependency: [if], data = [none]
gmaxindex = 0; // depends on control dependency: [if], data = [none]
}
g = v.g[1]; // depends on control dependency: [for], data = [v]
a = v.alpha[1]; // depends on control dependency: [for], data = [v]
if (g < gmin && a < v.C) {
svmin = v; // depends on control dependency: [if], data = [none]
gmin = g; // depends on control dependency: [if], data = [none]
gminindex = 1; // depends on control dependency: [if], data = [none]
}
if (g > gmax && a > 0.0) {
svmax = v; // depends on control dependency: [if], data = [none]
gmax = g; // depends on control dependency: [if], data = [none]
gmaxindex = 1; // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
@SuppressWarnings("unchecked")
public static <T> T createInstance(Class<T> clazz) {
if (clazz.isInterface()) {
if (clazz == List.class) {
return (T) new ArrayList();
} else if (clazz == Map.class) {
return (T) new HashMap();
}
throw new UnsupportedOperationException("Interface types can not be instantiated.");
}
ObjectInstantiator instantiator = OBJENESIS.getInstantiatorOf(clazz);
return (T) instantiator.newInstance();
} }
|
public class class_name {
@SuppressWarnings("unchecked")
public static <T> T createInstance(Class<T> clazz) {
if (clazz.isInterface()) {
if (clazz == List.class) {
return (T) new ArrayList(); // depends on control dependency: [if], data = [none]
} else if (clazz == Map.class) {
return (T) new HashMap(); // depends on control dependency: [if], data = [none]
}
throw new UnsupportedOperationException("Interface types can not be instantiated.");
}
ObjectInstantiator instantiator = OBJENESIS.getInstantiatorOf(clazz);
return (T) instantiator.newInstance();
} }
|
public class class_name {
private static String encodeBase64(final byte[] buffer) {
final int l = buffer.length;
final char[] out = new char[l << 1];
int j = 0;
for (int i = 0; i < l; i++) {
out[j++] = DIGITS[(0xF0 & buffer[i]) >>> 4];
out[j++] = DIGITS[0x0F & buffer[i]];
}
return String.copyValueOf(out);
} }
|
public class class_name {
private static String encodeBase64(final byte[] buffer) {
final int l = buffer.length;
final char[] out = new char[l << 1];
int j = 0;
for (int i = 0; i < l; i++) {
out[j++] = DIGITS[(0xF0 & buffer[i]) >>> 4];
// depends on control dependency: [for], data = [i]
out[j++] = DIGITS[0x0F & buffer[i]];
// depends on control dependency: [for], data = [i]
}
return String.copyValueOf(out);
} }
|
public class class_name {
public boolean apply(WebContext context) {
Object result = context.result();
if (result instanceof Response) {
Response response = (Response) result;
response.to(context);
return true;
}
try {
Method method = context.method();
String contentType = "";
Generates generates = method.getAnnotation(Generates.class);
Negotiated negotiated = method.getAnnotation(Negotiated.class);
if (generates != null) {
logger.debug("Web endpoint ["
+ method.getDeclaringClass().getName() + "#" + method.getName()
+ "] is qualified by [" + generates + "]");
contentType = generates.value();
} else if (negotiated != null) {
logger.debug("Web endpoint ["
+ method.getDeclaringClass().getName() + "#" + method.getName()
+ "] is qualified by [" + negotiated + "]");
String header = context.request().getHeader("Accept");
if (header != null) {
// TODO: Parse.
contentType = header;
}
}
logger.debug("MIME media type is [" + contentType + "]");
Class<? extends Response> responseType = context.configuration().responseTypes().get(contentType);
if (responseType == null) {
throw new CannotSendResponseException(
HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE,
"Configuration [" + context.configuration().getClass().getName()
+ "] does not provide a response type corresponding to ["
+ contentType + "] media type");
}
Response response = responseType.newInstance();
response.mediaType(contentType);
response.entity(result);
response.to(context);
return true;
} catch (CannotSendResponseException exception) {
logger.warn("Failed to send HTTP response", exception);
try {
context.response().sendError(exception.status());
return false;
} catch (IOException e) {
throw new UncheckedException(e);
}
} catch (Exception e) {
throw new UncheckedException(e);
}
} }
|
public class class_name {
public boolean apply(WebContext context) {
Object result = context.result();
if (result instanceof Response) {
Response response = (Response) result;
response.to(context); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
try {
Method method = context.method();
String contentType = "";
Generates generates = method.getAnnotation(Generates.class);
Negotiated negotiated = method.getAnnotation(Negotiated.class);
if (generates != null) {
logger.debug("Web endpoint ["
+ method.getDeclaringClass().getName() + "#" + method.getName()
+ "] is qualified by [" + generates + "]"); // depends on control dependency: [if], data = [none]
contentType = generates.value(); // depends on control dependency: [if], data = [none]
} else if (negotiated != null) {
logger.debug("Web endpoint ["
+ method.getDeclaringClass().getName() + "#" + method.getName()
+ "] is qualified by [" + negotiated + "]"); // depends on control dependency: [if], data = [none]
String header = context.request().getHeader("Accept");
if (header != null) {
// TODO: Parse.
contentType = header; // depends on control dependency: [if], data = [none]
}
}
logger.debug("MIME media type is [" + contentType + "]"); // depends on control dependency: [try], data = [none]
Class<? extends Response> responseType = context.configuration().responseTypes().get(contentType);
if (responseType == null) {
throw new CannotSendResponseException(
HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE,
"Configuration [" + context.configuration().getClass().getName()
+ "] does not provide a response type corresponding to ["
+ contentType + "] media type");
}
Response response = responseType.newInstance();
response.mediaType(contentType); // depends on control dependency: [try], data = [none]
response.entity(result); // depends on control dependency: [try], data = [none]
response.to(context); // depends on control dependency: [try], data = [none]
return true; // depends on control dependency: [try], data = [none]
} catch (CannotSendResponseException exception) {
logger.warn("Failed to send HTTP response", exception);
try {
context.response().sendError(exception.status()); // depends on control dependency: [try], data = [exception]
return false; // depends on control dependency: [try], data = [none]
} catch (IOException e) {
throw new UncheckedException(e);
} // depends on control dependency: [catch], data = [none]
} catch (Exception e) { // depends on control dependency: [catch], data = [none]
throw new UncheckedException(e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
@Produces
@Dependent
@Claim
public JsonNumber getJsonNumber(InjectionPoint injectionPoint) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "getJsonNumber", injectionPoint);
}
JsonNumber instance = (JsonNumber) getAsJsonValue(getClaimName(injectionPoint));
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "getJsonNumber", instance);
}
return instance;
} }
|
public class class_name {
@Produces
@Dependent
@Claim
public JsonNumber getJsonNumber(InjectionPoint injectionPoint) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "getJsonNumber", injectionPoint); // depends on control dependency: [if], data = [none]
}
JsonNumber instance = (JsonNumber) getAsJsonValue(getClaimName(injectionPoint));
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "getJsonNumber", instance); // depends on control dependency: [if], data = [none]
}
return instance;
} }
|
public class class_name {
public static List<VariableSimpleIF> getWantedVariables(FeatureDatasetPoint fdPoint, SubsetParams ncssParams)
throws VariableNotContainedInDatasetException {
List<String> vars = ncssParams.getVariables();
if (vars.size() == 1 && vars.get(0).equals("all")) {
return fdPoint.getDataVariables(); // Return all variables.
}
// restrict to these variables
Map<String, VariableSimpleIF> dataVarsMap = new HashMap<>();
for (VariableSimpleIF dataVar : fdPoint.getDataVariables()) {
dataVarsMap.put(dataVar.getShortName(), dataVar);
}
List<String> allVarNames = new ArrayList<>(dataVarsMap.keySet());
List<VariableSimpleIF> wantedVars = new ArrayList<>();
for (String varName : vars) {
if (allVarNames.contains(varName)) {
VariableSimpleIF var = dataVarsMap.get(varName);
wantedVars.add(var);
} else {
throw new VariableNotContainedInDatasetException(
"Variable: " + varName + " is not contained in the requested dataset");
}
}
return wantedVars;
} }
|
public class class_name {
public static List<VariableSimpleIF> getWantedVariables(FeatureDatasetPoint fdPoint, SubsetParams ncssParams)
throws VariableNotContainedInDatasetException {
List<String> vars = ncssParams.getVariables();
if (vars.size() == 1 && vars.get(0).equals("all")) {
return fdPoint.getDataVariables(); // Return all variables.
}
// restrict to these variables
Map<String, VariableSimpleIF> dataVarsMap = new HashMap<>();
for (VariableSimpleIF dataVar : fdPoint.getDataVariables()) {
dataVarsMap.put(dataVar.getShortName(), dataVar);
}
List<String> allVarNames = new ArrayList<>(dataVarsMap.keySet());
List<VariableSimpleIF> wantedVars = new ArrayList<>();
for (String varName : vars) {
if (allVarNames.contains(varName)) {
VariableSimpleIF var = dataVarsMap.get(varName);
wantedVars.add(var); // depends on control dependency: [if], data = [none]
} else {
throw new VariableNotContainedInDatasetException(
"Variable: " + varName + " is not contained in the requested dataset");
}
}
return wantedVars;
} }
|
public class class_name {
@Override
public void storePortletEntity(HttpServletRequest request, final IPortletEntity portletEntity) {
Validate.notNull(portletEntity, "portletEntity can not be null");
final IUserInstance userInstance = this.userInstanceManager.getUserInstance(request);
final IPerson person = userInstance.getPerson();
if (person.isGuest()) {
// Never persist things for the guest user, just rely on in-memory storage
return;
}
final IPortletEntityId wrapperPortletEntityId = portletEntity.getPortletEntityId();
final Lock portletEntityLock = this.getPortletEntityLock(request, wrapperPortletEntityId);
portletEntityLock.lock();
try {
final boolean shouldBePersisted = this.shouldBePersisted(portletEntity);
if (portletEntity instanceof PersistentPortletEntityWrapper) {
// Unwrap the persistent entity
final IPortletEntity persistentEntity =
((PersistentPortletEntityWrapper) portletEntity).getPersistentEntity();
// Already persistent entity that still has prefs
if (shouldBePersisted) {
try {
this.portletEntityDao.updatePortletEntity(persistentEntity);
} catch (HibernateOptimisticLockingFailureException e) {
// Check if this exception is from the entity being deleted from under us.
final boolean exists =
this.portletEntityDao.portletEntityExists(
persistentEntity.getPortletEntityId());
if (!exists) {
this.logger.warn(
"The persistent portlet has already been deleted: "
+ persistentEntity
+ ". The passed entity should be persistent so a new persistent entity will be created");
this.deletePortletEntity(request, portletEntity, true);
this.createPersistentEntity(persistentEntity, wrapperPortletEntityId);
} else {
throw e;
}
}
}
// Already persistent entity that should not be, DELETE!
else {
// Capture identifiers needed to recreate the entity as session persistent
final IPortletDefinitionId portletDefinitionId =
portletEntity.getPortletDefinitionId();
final String layoutNodeId = portletEntity.getLayoutNodeId();
final int userId = portletEntity.getUserId();
// Delete the persistent entity
this.deletePortletEntity(request, portletEntity, false);
// Create a new entity and stick it in the cache
this.getOrCreatePortletEntity(
request, portletDefinitionId, layoutNodeId, userId);
}
} else if (portletEntity instanceof SessionPortletEntityImpl) {
// There are preferences on the interim entity, create an store it
if (shouldBePersisted) {
// Remove the session scoped entity from the request and session caches
this.deletePortletEntity(request, portletEntity, false);
final IPortletEntity persistentEntity =
createPersistentEntity(portletEntity, wrapperPortletEntityId);
if (this.logger.isTraceEnabled()) {
this.logger.trace(
"Session scoped entity "
+ wrapperPortletEntityId
+ " should now be persistent. Deleted it from session cache and created persistent portlet entity "
+ persistentEntity.getPortletEntityId());
}
}
// Session scoped entity that is still session scoped,
else {
// Look for a persistent entity and delete it
final String channelSubscribeId = portletEntity.getLayoutNodeId();
final int userId = portletEntity.getUserId();
IPortletEntity existingPersistentEntity =
this.portletEntityDao.getPortletEntity(channelSubscribeId, userId);
if (existingPersistentEntity != null) {
final IPortletEntityId consistentPortletEntityId =
this.createConsistentPortletEntityId(existingPersistentEntity);
existingPersistentEntity =
new PersistentPortletEntityWrapper(
existingPersistentEntity, consistentPortletEntityId);
this.logger.warn(
"A persistent portlet entity already exists: "
+ existingPersistentEntity
+ ". The passed entity has no preferences so the persistent version will be deleted");
this.deletePortletEntity(request, existingPersistentEntity, false);
// Add to request cache
final PortletEntityCache<IPortletEntity> portletEntityMap =
this.getPortletEntityMap(request);
portletEntityMap.storeIfAbsentEntity(portletEntity);
// Add to session cache
final PortletEntityCache<PortletEntityData> portletEntityDataMap =
this.getPortletEntityDataMap(request);
portletEntityDataMap.storeIfAbsentEntity(
((SessionPortletEntityImpl) portletEntity).getPortletEntityData());
}
}
} else {
throw new IllegalArgumentException(
"Invalid portlet entity implementation passed: "
+ portletEntity.getClass());
}
} finally {
portletEntityLock.unlock();
}
} }
|
public class class_name {
@Override
public void storePortletEntity(HttpServletRequest request, final IPortletEntity portletEntity) {
Validate.notNull(portletEntity, "portletEntity can not be null");
final IUserInstance userInstance = this.userInstanceManager.getUserInstance(request);
final IPerson person = userInstance.getPerson();
if (person.isGuest()) {
// Never persist things for the guest user, just rely on in-memory storage
return; // depends on control dependency: [if], data = [none]
}
final IPortletEntityId wrapperPortletEntityId = portletEntity.getPortletEntityId();
final Lock portletEntityLock = this.getPortletEntityLock(request, wrapperPortletEntityId);
portletEntityLock.lock();
try {
final boolean shouldBePersisted = this.shouldBePersisted(portletEntity);
if (portletEntity instanceof PersistentPortletEntityWrapper) {
// Unwrap the persistent entity
final IPortletEntity persistentEntity =
((PersistentPortletEntityWrapper) portletEntity).getPersistentEntity();
// Already persistent entity that still has prefs
if (shouldBePersisted) {
try {
this.portletEntityDao.updatePortletEntity(persistentEntity); // depends on control dependency: [try], data = [none]
} catch (HibernateOptimisticLockingFailureException e) {
// Check if this exception is from the entity being deleted from under us.
final boolean exists =
this.portletEntityDao.portletEntityExists(
persistentEntity.getPortletEntityId());
if (!exists) {
this.logger.warn(
"The persistent portlet has already been deleted: "
+ persistentEntity
+ ". The passed entity should be persistent so a new persistent entity will be created"); // depends on control dependency: [if], data = [none]
this.deletePortletEntity(request, portletEntity, true); // depends on control dependency: [if], data = [none]
this.createPersistentEntity(persistentEntity, wrapperPortletEntityId); // depends on control dependency: [if], data = [none]
} else {
throw e;
}
} // depends on control dependency: [catch], data = [none]
}
// Already persistent entity that should not be, DELETE!
else {
// Capture identifiers needed to recreate the entity as session persistent
final IPortletDefinitionId portletDefinitionId =
portletEntity.getPortletDefinitionId();
final String layoutNodeId = portletEntity.getLayoutNodeId();
final int userId = portletEntity.getUserId();
// Delete the persistent entity
this.deletePortletEntity(request, portletEntity, false); // depends on control dependency: [if], data = [none]
// Create a new entity and stick it in the cache
this.getOrCreatePortletEntity(
request, portletDefinitionId, layoutNodeId, userId); // depends on control dependency: [if], data = [none]
}
} else if (portletEntity instanceof SessionPortletEntityImpl) {
// There are preferences on the interim entity, create an store it
if (shouldBePersisted) {
// Remove the session scoped entity from the request and session caches
this.deletePortletEntity(request, portletEntity, false); // depends on control dependency: [if], data = [none]
final IPortletEntity persistentEntity =
createPersistentEntity(portletEntity, wrapperPortletEntityId);
if (this.logger.isTraceEnabled()) {
this.logger.trace(
"Session scoped entity "
+ wrapperPortletEntityId
+ " should now be persistent. Deleted it from session cache and created persistent portlet entity "
+ persistentEntity.getPortletEntityId()); // depends on control dependency: [if], data = [none]
}
}
// Session scoped entity that is still session scoped,
else {
// Look for a persistent entity and delete it
final String channelSubscribeId = portletEntity.getLayoutNodeId();
final int userId = portletEntity.getUserId();
IPortletEntity existingPersistentEntity =
this.portletEntityDao.getPortletEntity(channelSubscribeId, userId);
if (existingPersistentEntity != null) {
final IPortletEntityId consistentPortletEntityId =
this.createConsistentPortletEntityId(existingPersistentEntity);
existingPersistentEntity =
new PersistentPortletEntityWrapper(
existingPersistentEntity, consistentPortletEntityId); // depends on control dependency: [if], data = [none]
this.logger.warn(
"A persistent portlet entity already exists: "
+ existingPersistentEntity
+ ". The passed entity has no preferences so the persistent version will be deleted"); // depends on control dependency: [if], data = [none]
this.deletePortletEntity(request, existingPersistentEntity, false); // depends on control dependency: [if], data = [none]
// Add to request cache
final PortletEntityCache<IPortletEntity> portletEntityMap =
this.getPortletEntityMap(request);
portletEntityMap.storeIfAbsentEntity(portletEntity); // depends on control dependency: [if], data = [none]
// Add to session cache
final PortletEntityCache<PortletEntityData> portletEntityDataMap =
this.getPortletEntityDataMap(request);
portletEntityDataMap.storeIfAbsentEntity(
((SessionPortletEntityImpl) portletEntity).getPortletEntityData()); // depends on control dependency: [if], data = [none]
}
}
} else {
throw new IllegalArgumentException(
"Invalid portlet entity implementation passed: "
+ portletEntity.getClass());
}
} finally {
portletEntityLock.unlock();
}
} }
|
public class class_name {
@Override
public void notifyWatch(TableKraken table, byte []key)
{
WatchTable watchTable = _tableMap.get(table);
if (watchTable != null) {
watchTable.onPut(key, TableListener.TypePut.REMOTE);
}
} }
|
public class class_name {
@Override
public void notifyWatch(TableKraken table, byte []key)
{
WatchTable watchTable = _tableMap.get(table);
if (watchTable != null) {
watchTable.onPut(key, TableListener.TypePut.REMOTE); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
OutputStream append(String src, int buffersize, Progressable progress
) throws IOException {
checkOpen();
clearFileStatusCache();
FileStatus stat = null;
LocatedBlock lastBlock = null;
boolean success = false;
try {
stat = getFileInfo(src);
if (namenodeProtocolProxy != null
&& namenodeProtocolProxy.isMethodSupported(
"appendAndFetchOldGS", String.class, String.class)) {
LocatedBlockWithOldGS loc = namenode.appendAndFetchOldGS(src,
clientName);
lastBlock = loc;
if (loc != null) {
updateNamespaceIdIfNeeded(loc.getNamespaceID());
updateDataTransferProtocolVersionIfNeeded(loc.getDataProtocolVersion());
getNewNameNodeIfNeeded(loc.getMethodFingerPrint());
}
} else if (namenodeProtocolProxy != null
&& dataTransferVersion >= DataTransferProtocol.APPEND_BLOCK_VERSION) {
// fail the request if the data transfer version support the new append
// protocol, but the namenode method is not supported.
// This should not happen unless there is a bug.
throw new IOException ("DataTransferVersion " + dataTransferVersion +
"requires the method appendAndFetchOldGS is supported in Namenode");
} else if (namenodeProtocolProxy != null
&& namenodeProtocolProxy.isMethodSupported(
"appendAndFetchMetaInfo", String.class, String.class)) {
LocatedBlockWithMetaInfo loc = namenode.appendAndFetchMetaInfo(src,
clientName);
lastBlock = loc;
if (loc != null) {
updateNamespaceIdIfNeeded(loc.getNamespaceID());
updateDataTransferProtocolVersionIfNeeded(loc.getDataProtocolVersion());
getNewNameNodeIfNeeded(loc.getMethodFingerPrint());
}
} else {
lastBlock = namenode.append(src, clientName);
}
OutputStream result = new DFSOutputStream(this, src, buffersize, progress,
lastBlock, stat, conf.getInt("io.bytes.per.checksum", 512), namespaceId);
leasechecker.put(src, result);
success = true;
return result;
} catch(RemoteException re) {
throw re.unwrapRemoteException(FileNotFoundException.class,
AccessControlException.class,
NSQuotaExceededException.class,
DSQuotaExceededException.class);
} finally {
if (!success) {
try {
namenode.abandonFile(src, clientName);
} catch (RemoteException e) {
if (e.unwrapRemoteException() instanceof LeaseExpiredException) {
LOG.debug(String.format(
"client %s attempting to abandon file %s which it does not own",
clientName, src),
e
);
} else {
throw e;
}
}
}
}
} }
|
public class class_name {
OutputStream append(String src, int buffersize, Progressable progress
) throws IOException {
checkOpen();
clearFileStatusCache();
FileStatus stat = null;
LocatedBlock lastBlock = null;
boolean success = false;
try {
stat = getFileInfo(src);
if (namenodeProtocolProxy != null
&& namenodeProtocolProxy.isMethodSupported(
"appendAndFetchOldGS", String.class, String.class)) {
LocatedBlockWithOldGS loc = namenode.appendAndFetchOldGS(src,
clientName);
lastBlock = loc; // depends on control dependency: [if], data = [none]
if (loc != null) {
updateNamespaceIdIfNeeded(loc.getNamespaceID()); // depends on control dependency: [if], data = [(loc]
updateDataTransferProtocolVersionIfNeeded(loc.getDataProtocolVersion()); // depends on control dependency: [if], data = [(loc]
getNewNameNodeIfNeeded(loc.getMethodFingerPrint()); // depends on control dependency: [if], data = [(loc]
}
} else if (namenodeProtocolProxy != null
&& dataTransferVersion >= DataTransferProtocol.APPEND_BLOCK_VERSION) {
// fail the request if the data transfer version support the new append
// protocol, but the namenode method is not supported.
// This should not happen unless there is a bug.
throw new IOException ("DataTransferVersion " + dataTransferVersion +
"requires the method appendAndFetchOldGS is supported in Namenode");
} else if (namenodeProtocolProxy != null
&& namenodeProtocolProxy.isMethodSupported(
"appendAndFetchMetaInfo", String.class, String.class)) {
LocatedBlockWithMetaInfo loc = namenode.appendAndFetchMetaInfo(src,
clientName);
lastBlock = loc; // depends on control dependency: [if], data = [none]
if (loc != null) {
updateNamespaceIdIfNeeded(loc.getNamespaceID()); // depends on control dependency: [if], data = [(loc]
updateDataTransferProtocolVersionIfNeeded(loc.getDataProtocolVersion()); // depends on control dependency: [if], data = [(loc]
getNewNameNodeIfNeeded(loc.getMethodFingerPrint()); // depends on control dependency: [if], data = [(loc]
}
} else {
lastBlock = namenode.append(src, clientName); // depends on control dependency: [if], data = [none]
}
OutputStream result = new DFSOutputStream(this, src, buffersize, progress,
lastBlock, stat, conf.getInt("io.bytes.per.checksum", 512), namespaceId);
leasechecker.put(src, result);
success = true;
return result;
} catch(RemoteException re) {
throw re.unwrapRemoteException(FileNotFoundException.class,
AccessControlException.class,
NSQuotaExceededException.class,
DSQuotaExceededException.class);
} finally {
if (!success) {
try {
namenode.abandonFile(src, clientName); // depends on control dependency: [try], data = [none]
} catch (RemoteException e) {
if (e.unwrapRemoteException() instanceof LeaseExpiredException) {
LOG.debug(String.format(
"client %s attempting to abandon file %s which it does not own",
clientName, src),
e
); // depends on control dependency: [if], data = [none]
} else {
throw e;
}
} // depends on control dependency: [catch], data = [none]
}
}
} }
|
public class class_name {
public <T> T getInterface(String objectName, Class<T> clazz) {
Invocable inv = (Invocable) engine;
Object o = engine.get(objectName);
if (o == null) {
return null;
}
return inv.getInterface(o, clazz);
} }
|
public class class_name {
public <T> T getInterface(String objectName, Class<T> clazz) {
Invocable inv = (Invocable) engine;
Object o = engine.get(objectName);
if (o == null) {
return null; // depends on control dependency: [if], data = [none]
}
return inv.getInterface(o, clazz);
} }
|
public class class_name {
@Override
protected void removeRange(int fromIndex, int toIndex) {
rangeCheck(fromIndex, toIndex);
for (int i = fromIndex, j = toIndex; j < size; j++) {
elements[i] = elements[j];
}
size -= (toIndex - fromIndex);
} }
|
public class class_name {
@Override
protected void removeRange(int fromIndex, int toIndex) {
rangeCheck(fromIndex, toIndex);
for (int i = fromIndex, j = toIndex; j < size; j++) {
elements[i] = elements[j]; // depends on control dependency: [for], data = [i]
}
size -= (toIndex - fromIndex);
} }
|
public class class_name {
public void marshall(DataRetrievalRule dataRetrievalRule, ProtocolMarshaller protocolMarshaller) {
if (dataRetrievalRule == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(dataRetrievalRule.getStrategy(), STRATEGY_BINDING);
protocolMarshaller.marshall(dataRetrievalRule.getBytesPerHour(), BYTESPERHOUR_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(DataRetrievalRule dataRetrievalRule, ProtocolMarshaller protocolMarshaller) {
if (dataRetrievalRule == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(dataRetrievalRule.getStrategy(), STRATEGY_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(dataRetrievalRule.getBytesPerHour(), BYTESPERHOUR_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public void marshall(LambdaActivity lambdaActivity, ProtocolMarshaller protocolMarshaller) {
if (lambdaActivity == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(lambdaActivity.getName(), NAME_BINDING);
protocolMarshaller.marshall(lambdaActivity.getLambdaName(), LAMBDANAME_BINDING);
protocolMarshaller.marshall(lambdaActivity.getBatchSize(), BATCHSIZE_BINDING);
protocolMarshaller.marshall(lambdaActivity.getNext(), NEXT_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(LambdaActivity lambdaActivity, ProtocolMarshaller protocolMarshaller) {
if (lambdaActivity == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(lambdaActivity.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(lambdaActivity.getLambdaName(), LAMBDANAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(lambdaActivity.getBatchSize(), BATCHSIZE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(lambdaActivity.getNext(), NEXT_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 checkFallback(String elementType)
{
if (hasValidFallback)
{
hasValidFallback = false;
}
else
{
report.message(MessageId.MED_002,
EPUBLocation.create(path, parser.getLineNumber(), parser.getColumnNumber()), elementType);
}
} }
|
public class class_name {
protected void checkFallback(String elementType)
{
if (hasValidFallback)
{
hasValidFallback = false; // depends on control dependency: [if], data = [none]
}
else
{
report.message(MessageId.MED_002,
EPUBLocation.create(path, parser.getLineNumber(), parser.getColumnNumber()), elementType); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static String readString(ByteBuffer buf) {
if(buf.get() == 0)
return null;
int len=readInt(buf);
if(buf.isDirect()) {
byte[] bytes=new byte[len];
buf.get(bytes);
return new String(bytes);
}
else {
byte[] bytes=buf.array();
return new String(bytes, buf.arrayOffset() + buf.position(), len);
}
} }
|
public class class_name {
public static String readString(ByteBuffer buf) {
if(buf.get() == 0)
return null;
int len=readInt(buf);
if(buf.isDirect()) {
byte[] bytes=new byte[len];
buf.get(bytes); // depends on control dependency: [if], data = [none]
return new String(bytes); // depends on control dependency: [if], data = [none]
}
else {
byte[] bytes=buf.array();
return new String(bytes, buf.arrayOffset() + buf.position(), len); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@Override
public void handle(String chargingStationId, JsonObject commandObject, IdentityContext identityContext) throws UserIdentityUnauthorizedException {
ChargingStationId csId = new ChargingStationId(chargingStationId);
if (!commandAuthorizationService.isAuthorized(csId, identityContext.getUserIdentity(), GrantPermissionCommand.class)) {
throw new UserIdentityUnauthorizedException(chargingStationId, identityContext.getUserIdentity(), GrantPermissionCommand.class);
}
try {
ChargingStation chargingStation = repository.findOne(chargingStationId);
if (chargingStation != null && chargingStation.isAccepted()) {
GrantPermissionApiCommand command = gson.fromJson(commandObject, GrantPermissionApiCommand.class);
Class commandClass = Class.forName(command.getCommandClass());
UserIdentity userIdentity = new SimpleUserIdentity(command.getUserIdentity());
commandGateway.send(new GrantPermissionCommand(csId, userIdentity, commandClass, identityContext));
}
} catch (JsonSyntaxException ex) {
throw new IllegalArgumentException("Grant permission command not able to parse the payload, is your json correctly formatted?", ex);
} catch (ClassNotFoundException e) {
throw new IllegalArgumentException("Grant permission command cannot instantiate class object for command class, is the passed command class value a valid class?", e);
}
} }
|
public class class_name {
@Override
public void handle(String chargingStationId, JsonObject commandObject, IdentityContext identityContext) throws UserIdentityUnauthorizedException {
ChargingStationId csId = new ChargingStationId(chargingStationId);
if (!commandAuthorizationService.isAuthorized(csId, identityContext.getUserIdentity(), GrantPermissionCommand.class)) {
throw new UserIdentityUnauthorizedException(chargingStationId, identityContext.getUserIdentity(), GrantPermissionCommand.class);
}
try {
ChargingStation chargingStation = repository.findOne(chargingStationId);
if (chargingStation != null && chargingStation.isAccepted()) {
GrantPermissionApiCommand command = gson.fromJson(commandObject, GrantPermissionApiCommand.class);
Class commandClass = Class.forName(command.getCommandClass()); // depends on control dependency: [if], data = [none]
UserIdentity userIdentity = new SimpleUserIdentity(command.getUserIdentity());
commandGateway.send(new GrantPermissionCommand(csId, userIdentity, commandClass, identityContext)); // depends on control dependency: [if], data = [none]
}
} catch (JsonSyntaxException ex) {
throw new IllegalArgumentException("Grant permission command not able to parse the payload, is your json correctly formatted?", ex);
} catch (ClassNotFoundException e) {
throw new IllegalArgumentException("Grant permission command cannot instantiate class object for command class, is the passed command class value a valid class?", e);
}
} }
|
public class class_name {
private void processTaskEnterpriseColumns(FieldMap fieldMap, Task task, Var2Data taskVarData)
{
byte[] data = null;
Integer varDataKey = fieldMap.getVarDataKey(TaskField.ENTERPRISE_DATA);
if (varDataKey != null)
{
data = taskVarData.getByteArray(task.getUniqueID(), varDataKey);
}
if (data != null)
{
PropsBlock props = new PropsBlock(data);
//System.out.println(props);
for (Integer key : props.keySet())
{
int keyValue = key.intValue() - MPPTaskField.TASK_FIELD_BASE;
TaskField field = MPPTaskField.getInstance(keyValue);
if (field != null)
{
Object value = null;
switch (field.getDataType())
{
case CURRENCY:
{
value = Double.valueOf(props.getDouble(key) / 100);
break;
}
case DATE:
{
value = props.getTimestamp(key);
break;
}
case WORK:
{
double durationValueInHours = MPPUtility.getDouble(props.getByteArray(key), 0) / 60000;
value = Duration.getInstance(durationValueInHours, TimeUnit.HOURS);
break;
}
case DURATION:
{
byte[] durationData = props.getByteArray(key);
double durationValueInHours = ((double) MPPUtility.getInt(durationData, 0)) / 600;
TimeUnit durationUnits;
if (durationData.length < 6)
{
durationUnits = TimeUnit.DAYS;
}
else
{
durationUnits = MPPUtility.getDurationTimeUnits(MPPUtility.getShort(durationData, 4));
}
Duration duration = Duration.getInstance(durationValueInHours, TimeUnit.HOURS);
value = duration.convertUnits(durationUnits, m_file.getProjectProperties());
break;
}
case BOOLEAN:
{
field = null;
int bits = props.getInt(key);
task.set(TaskField.ENTERPRISE_FLAG1, Boolean.valueOf((bits & 0x00002) != 0));
task.set(TaskField.ENTERPRISE_FLAG2, Boolean.valueOf((bits & 0x00004) != 0));
task.set(TaskField.ENTERPRISE_FLAG3, Boolean.valueOf((bits & 0x00008) != 0));
task.set(TaskField.ENTERPRISE_FLAG4, Boolean.valueOf((bits & 0x00010) != 0));
task.set(TaskField.ENTERPRISE_FLAG5, Boolean.valueOf((bits & 0x00020) != 0));
task.set(TaskField.ENTERPRISE_FLAG6, Boolean.valueOf((bits & 0x00040) != 0));
task.set(TaskField.ENTERPRISE_FLAG7, Boolean.valueOf((bits & 0x00080) != 0));
task.set(TaskField.ENTERPRISE_FLAG8, Boolean.valueOf((bits & 0x00100) != 0));
task.set(TaskField.ENTERPRISE_FLAG9, Boolean.valueOf((bits & 0x00200) != 0));
task.set(TaskField.ENTERPRISE_FLAG10, Boolean.valueOf((bits & 0x00400) != 0));
task.set(TaskField.ENTERPRISE_FLAG11, Boolean.valueOf((bits & 0x00800) != 0));
task.set(TaskField.ENTERPRISE_FLAG12, Boolean.valueOf((bits & 0x01000) != 0));
task.set(TaskField.ENTERPRISE_FLAG13, Boolean.valueOf((bits & 0x02000) != 0));
task.set(TaskField.ENTERPRISE_FLAG14, Boolean.valueOf((bits & 0x04000) != 0));
task.set(TaskField.ENTERPRISE_FLAG15, Boolean.valueOf((bits & 0x08000) != 0));
task.set(TaskField.ENTERPRISE_FLAG16, Boolean.valueOf((bits & 0x10000) != 0));
task.set(TaskField.ENTERPRISE_FLAG17, Boolean.valueOf((bits & 0x20000) != 0));
task.set(TaskField.ENTERPRISE_FLAG18, Boolean.valueOf((bits & 0x40000) != 0));
task.set(TaskField.ENTERPRISE_FLAG19, Boolean.valueOf((bits & 0x80000) != 0));
task.set(TaskField.ENTERPRISE_FLAG20, Boolean.valueOf((bits & 0x100000) != 0));
break;
}
case NUMERIC:
{
value = Double.valueOf(props.getDouble(key));
break;
}
case STRING:
{
value = props.getUnicodeString(key);
break;
}
case PERCENTAGE:
{
value = Integer.valueOf(props.getShort(key));
break;
}
default:
{
break;
}
}
task.set(field, value);
}
}
}
} }
|
public class class_name {
private void processTaskEnterpriseColumns(FieldMap fieldMap, Task task, Var2Data taskVarData)
{
byte[] data = null;
Integer varDataKey = fieldMap.getVarDataKey(TaskField.ENTERPRISE_DATA);
if (varDataKey != null)
{
data = taskVarData.getByteArray(task.getUniqueID(), varDataKey); // depends on control dependency: [if], data = [none]
}
if (data != null)
{
PropsBlock props = new PropsBlock(data);
//System.out.println(props);
for (Integer key : props.keySet())
{
int keyValue = key.intValue() - MPPTaskField.TASK_FIELD_BASE;
TaskField field = MPPTaskField.getInstance(keyValue);
if (field != null)
{
Object value = null;
switch (field.getDataType())
{
case CURRENCY:
{
value = Double.valueOf(props.getDouble(key) / 100);
break;
}
case DATE:
{
value = props.getTimestamp(key);
break;
}
case WORK:
{
double durationValueInHours = MPPUtility.getDouble(props.getByteArray(key), 0) / 60000;
value = Duration.getInstance(durationValueInHours, TimeUnit.HOURS); // depends on control dependency: [if], data = [none]
break;
}
case DURATION:
{
byte[] durationData = props.getByteArray(key);
double durationValueInHours = ((double) MPPUtility.getInt(durationData, 0)) / 600;
TimeUnit durationUnits;
if (durationData.length < 6)
{
durationUnits = TimeUnit.DAYS; // depends on control dependency: [if], data = [none]
}
else
{
durationUnits = MPPUtility.getDurationTimeUnits(MPPUtility.getShort(durationData, 4)); // depends on control dependency: [if], data = [none]
}
Duration duration = Duration.getInstance(durationValueInHours, TimeUnit.HOURS);
value = duration.convertUnits(durationUnits, m_file.getProjectProperties());
break;
}
case BOOLEAN:
{
field = null;
int bits = props.getInt(key);
task.set(TaskField.ENTERPRISE_FLAG1, Boolean.valueOf((bits & 0x00002) != 0));
task.set(TaskField.ENTERPRISE_FLAG2, Boolean.valueOf((bits & 0x00004) != 0));
task.set(TaskField.ENTERPRISE_FLAG3, Boolean.valueOf((bits & 0x00008) != 0));
task.set(TaskField.ENTERPRISE_FLAG4, Boolean.valueOf((bits & 0x00010) != 0));
task.set(TaskField.ENTERPRISE_FLAG5, Boolean.valueOf((bits & 0x00020) != 0));
task.set(TaskField.ENTERPRISE_FLAG6, Boolean.valueOf((bits & 0x00040) != 0));
task.set(TaskField.ENTERPRISE_FLAG7, Boolean.valueOf((bits & 0x00080) != 0));
task.set(TaskField.ENTERPRISE_FLAG8, Boolean.valueOf((bits & 0x00100) != 0));
task.set(TaskField.ENTERPRISE_FLAG9, Boolean.valueOf((bits & 0x00200) != 0));
task.set(TaskField.ENTERPRISE_FLAG10, Boolean.valueOf((bits & 0x00400) != 0));
task.set(TaskField.ENTERPRISE_FLAG11, Boolean.valueOf((bits & 0x00800) != 0));
task.set(TaskField.ENTERPRISE_FLAG12, Boolean.valueOf((bits & 0x01000) != 0));
task.set(TaskField.ENTERPRISE_FLAG13, Boolean.valueOf((bits & 0x02000) != 0));
task.set(TaskField.ENTERPRISE_FLAG14, Boolean.valueOf((bits & 0x04000) != 0));
task.set(TaskField.ENTERPRISE_FLAG15, Boolean.valueOf((bits & 0x08000) != 0));
task.set(TaskField.ENTERPRISE_FLAG16, Boolean.valueOf((bits & 0x10000) != 0));
task.set(TaskField.ENTERPRISE_FLAG17, Boolean.valueOf((bits & 0x20000) != 0));
task.set(TaskField.ENTERPRISE_FLAG18, Boolean.valueOf((bits & 0x40000) != 0));
task.set(TaskField.ENTERPRISE_FLAG19, Boolean.valueOf((bits & 0x80000) != 0));
task.set(TaskField.ENTERPRISE_FLAG20, Boolean.valueOf((bits & 0x100000) != 0));
break;
}
case NUMERIC:
{
value = Double.valueOf(props.getDouble(key));
break;
}
case STRING:
{
value = props.getUnicodeString(key);
break;
}
case PERCENTAGE:
{
value = Integer.valueOf(props.getShort(key));
break;
}
default:
{
break;
}
}
task.set(field, value);
}
}
}
} }
|
public class class_name {
private static boolean inStaticContext(TreePath path) {
Tree prev = path.getLeaf();
path = path.getParentPath();
ClassSymbol enclosingClass =
ASTHelpers.getSymbol(ASTHelpers.findEnclosingNode(path, ClassTree.class));
ClassSymbol directSuperClass = (ClassSymbol) enclosingClass.getSuperclass().tsym;
for (Tree tree : path) {
switch (tree.getKind()) {
case METHOD:
return ASTHelpers.getSymbol(tree).isStatic();
case BLOCK: // static initializer
if (((BlockTree) tree).isStatic()) {
return true;
}
break;
case VARIABLE: // variable initializer of static variable
VariableTree variableTree = (VariableTree) tree;
VarSymbol variableSym = ASTHelpers.getSymbol(variableTree);
if (variableSym.getKind() == ElementKind.FIELD) {
return Objects.equals(variableTree.getInitializer(), prev) && variableSym.isStatic();
}
break;
case METHOD_INVOCATION: // JLS 8.8.7.1 explicit constructor invocation
MethodSymbol methodSym = ASTHelpers.getSymbol((MethodInvocationTree) tree);
if (methodSym == null) {
// sometimes javac can't resolve the symbol. In this case just assume that we are
// in a static context - this is a safe approximation in our context (checking
// visibility)
return true;
}
if (methodSym.isConstructor()
&& (Objects.equals(methodSym.owner, enclosingClass)
|| Objects.equals(methodSym.owner, directSuperClass))) {
return true;
}
break;
default:
break;
}
prev = tree;
}
return false;
} }
|
public class class_name {
private static boolean inStaticContext(TreePath path) {
Tree prev = path.getLeaf();
path = path.getParentPath();
ClassSymbol enclosingClass =
ASTHelpers.getSymbol(ASTHelpers.findEnclosingNode(path, ClassTree.class));
ClassSymbol directSuperClass = (ClassSymbol) enclosingClass.getSuperclass().tsym;
for (Tree tree : path) {
switch (tree.getKind()) {
case METHOD:
return ASTHelpers.getSymbol(tree).isStatic();
case BLOCK: // static initializer
if (((BlockTree) tree).isStatic()) {
return true; // depends on control dependency: [if], data = [none]
}
break;
case VARIABLE: // variable initializer of static variable
VariableTree variableTree = (VariableTree) tree;
VarSymbol variableSym = ASTHelpers.getSymbol(variableTree);
if (variableSym.getKind() == ElementKind.FIELD) {
return Objects.equals(variableTree.getInitializer(), prev) && variableSym.isStatic(); // depends on control dependency: [if], data = [none]
}
break;
case METHOD_INVOCATION: // JLS 8.8.7.1 explicit constructor invocation
MethodSymbol methodSym = ASTHelpers.getSymbol((MethodInvocationTree) tree);
if (methodSym == null) {
// sometimes javac can't resolve the symbol. In this case just assume that we are
// in a static context - this is a safe approximation in our context (checking
// visibility)
return true; // depends on control dependency: [if], data = [none]
}
if (methodSym.isConstructor()
&& (Objects.equals(methodSym.owner, enclosingClass)
|| Objects.equals(methodSym.owner, directSuperClass))) {
return true; // depends on control dependency: [if], data = [none]
}
break;
default:
break;
}
prev = tree; // depends on control dependency: [for], data = [tree]
}
return false;
} }
|
public class class_name {
public List<String> getAutoScalingMembers(String autoScalingGroupName) {
Preconditions.checkArgument(autoScalingGroupName != null && !autoScalingGroupName.isEmpty());
AutoScalingGroup autoScalingGroup = this.getAutoScalingGroup(autoScalingGroupName);
List<String> list = new ArrayList<>();
for (com.amazonaws.services.autoscaling.model.Instance instance : autoScalingGroup.getInstances()) {
if (instance.getHealthStatus().equals("Healthy")) {
list.add(instance.getInstanceId());
}
}
return list;
} }
|
public class class_name {
public List<String> getAutoScalingMembers(String autoScalingGroupName) {
Preconditions.checkArgument(autoScalingGroupName != null && !autoScalingGroupName.isEmpty());
AutoScalingGroup autoScalingGroup = this.getAutoScalingGroup(autoScalingGroupName);
List<String> list = new ArrayList<>();
for (com.amazonaws.services.autoscaling.model.Instance instance : autoScalingGroup.getInstances()) {
if (instance.getHealthStatus().equals("Healthy")) {
list.add(instance.getInstanceId()); // depends on control dependency: [if], data = [none]
}
}
return list;
} }
|
public class class_name {
static void rcvCreateTempDestination(CommsByteBuffer request, Conversation conversation,
int requestNumber, boolean allocatedFromBufferPool,
boolean partOfExchange)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "rcvCreateTempDestination",
new Object[]
{
request,
conversation,
""+requestNumber,
""+allocatedFromBufferPool,
""+partOfExchange
});
ConversationState convState = (ConversationState) conversation.getAttachment();
short connectionObjectID = request.getShort(); // BIT16 ConnectionObjectId
SICoreConnection connection =
((CATConnection) convState.getObject(connectionObjectID)).getSICoreConnection();
short dist = request.getShort();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
SibTr.debug(tc, "SICoreConnection Id:", connectionObjectID);
SibTr.debug(tc, "Distribution", dist);
}
/**************************************************************/
/* Distribution */
/**************************************************************/
Distribution distribution = Distribution.getDistribution(dist);
/**************************************************************/
/* Destination name prefix */
/**************************************************************/
String destinationNamePrefix = request.getString();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Destination prefix;", destinationNamePrefix);
try
{
JsDestinationAddress destAddress =
(JsDestinationAddress) connection.createTemporaryDestination(distribution,
destinationNamePrefix);
CommsByteBuffer reply = poolManager.allocate();
reply.putSIDestinationAddress(destAddress, conversation.getHandshakeProperties().getFapLevel());
try
{
// Inform the client
conversation.send(reply,
JFapChannelConstants.SEG_CREATE_TEMP_DESTINATION_R,
requestNumber,
JFapChannelConstants.PRIORITY_MEDIUM,
true,
ThrottlingPolicy.BLOCK_THREAD,
null);
}
catch (SIException e)
{
FFDCFilter.processException(e,
CLASS_NAME + ".rcvCreateTempDestination",
CommsConstants.STATICCATDESTINATION_DESTCREATE_01);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, e.getMessage(), e);
SibTr.error(tc, "COMMUNICATION_ERROR_SICO2022", e);
}
}
catch (SINotAuthorizedException e)
{
// No FFDC Code Needed
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, e.getMessage(), e);
StaticCATHelper.sendExceptionToClient(e,
null,
conversation, requestNumber);
}
catch (SIException e)
{
//No FFDC code needed
//Only FFDC if we haven't received a meTerminated event.
if(!convState.hasMETerminated())
{
FFDCFilter.processException(e,
CLASS_NAME + ".rcvCreateTempDestination",
CommsConstants.STATICCATDESTINATION_DESTCREATE_02);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, e.getMessage(), e);
StaticCATHelper.sendExceptionToClient(e,
CommsConstants.STATICCATDESTINATION_DESTCREATE_02,
conversation, requestNumber);
}
request.release(allocatedFromBufferPool);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "rcvCreateTempDestination");
} }
|
public class class_name {
static void rcvCreateTempDestination(CommsByteBuffer request, Conversation conversation,
int requestNumber, boolean allocatedFromBufferPool,
boolean partOfExchange)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "rcvCreateTempDestination",
new Object[]
{
request,
conversation,
""+requestNumber,
""+allocatedFromBufferPool,
""+partOfExchange
});
ConversationState convState = (ConversationState) conversation.getAttachment();
short connectionObjectID = request.getShort(); // BIT16 ConnectionObjectId
SICoreConnection connection =
((CATConnection) convState.getObject(connectionObjectID)).getSICoreConnection();
short dist = request.getShort();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
SibTr.debug(tc, "SICoreConnection Id:", connectionObjectID); // depends on control dependency: [if], data = [none]
SibTr.debug(tc, "Distribution", dist); // depends on control dependency: [if], data = [none]
}
/**************************************************************/
/* Distribution */
/**************************************************************/
Distribution distribution = Distribution.getDistribution(dist);
/**************************************************************/
/* Destination name prefix */
/**************************************************************/
String destinationNamePrefix = request.getString();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Destination prefix;", destinationNamePrefix);
try
{
JsDestinationAddress destAddress =
(JsDestinationAddress) connection.createTemporaryDestination(distribution,
destinationNamePrefix);
CommsByteBuffer reply = poolManager.allocate();
reply.putSIDestinationAddress(destAddress, conversation.getHandshakeProperties().getFapLevel()); // depends on control dependency: [try], data = [none]
try
{
// Inform the client
conversation.send(reply,
JFapChannelConstants.SEG_CREATE_TEMP_DESTINATION_R,
requestNumber,
JFapChannelConstants.PRIORITY_MEDIUM,
true,
ThrottlingPolicy.BLOCK_THREAD,
null); // depends on control dependency: [try], data = [none]
}
catch (SIException e)
{
FFDCFilter.processException(e,
CLASS_NAME + ".rcvCreateTempDestination",
CommsConstants.STATICCATDESTINATION_DESTCREATE_01);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, e.getMessage(), e);
SibTr.error(tc, "COMMUNICATION_ERROR_SICO2022", e);
} // depends on control dependency: [catch], data = [none]
}
catch (SINotAuthorizedException e)
{
// No FFDC Code Needed
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, e.getMessage(), e);
StaticCATHelper.sendExceptionToClient(e,
null,
conversation, requestNumber);
} // depends on control dependency: [catch], data = [none]
catch (SIException e)
{
//No FFDC code needed
//Only FFDC if we haven't received a meTerminated event.
if(!convState.hasMETerminated())
{
FFDCFilter.processException(e,
CLASS_NAME + ".rcvCreateTempDestination",
CommsConstants.STATICCATDESTINATION_DESTCREATE_02); // depends on control dependency: [if], data = [none]
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, e.getMessage(), e);
StaticCATHelper.sendExceptionToClient(e,
CommsConstants.STATICCATDESTINATION_DESTCREATE_02,
conversation, requestNumber);
} // depends on control dependency: [catch], data = [none]
request.release(allocatedFromBufferPool);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "rcvCreateTempDestination");
} }
|
public class class_name {
public Policy withResourceTypeList(String... resourceTypeList) {
if (this.resourceTypeList == null) {
setResourceTypeList(new java.util.ArrayList<String>(resourceTypeList.length));
}
for (String ele : resourceTypeList) {
this.resourceTypeList.add(ele);
}
return this;
} }
|
public class class_name {
public Policy withResourceTypeList(String... resourceTypeList) {
if (this.resourceTypeList == null) {
setResourceTypeList(new java.util.ArrayList<String>(resourceTypeList.length)); // depends on control dependency: [if], data = [none]
}
for (String ele : resourceTypeList) {
this.resourceTypeList.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} }
|
public class class_name {
@Override
public void pausePlayback()
{
if (isNotPausingNorPaused() && isNotStoppingNorStopped())
{
setIsPausing();
while (!isPaused() && !isStopped())
{
try { Thread.sleep(1); } catch (InterruptedException ex) { /*noop*/ }
}
stopLine();
}
else
if (isPaused())
{
startLine();
setIsPlaying();
}
} }
|
public class class_name {
@Override
public void pausePlayback()
{
if (isNotPausingNorPaused() && isNotStoppingNorStopped())
{
setIsPausing(); // depends on control dependency: [if], data = [none]
while (!isPaused() && !isStopped())
{
try { Thread.sleep(1); } catch (InterruptedException ex) { /*noop*/ } // depends on control dependency: [try], data = [none] // depends on control dependency: [catch], data = [none]
}
stopLine(); // depends on control dependency: [if], data = [none]
}
else
if (isPaused())
{
startLine(); // depends on control dependency: [if], data = [none]
setIsPlaying(); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private static List<String> addToList(List<String> list, String part, boolean isTrim, boolean ignoreEmpty){
if(isTrim){
part = StrUtil.trim(part);
}
if(false == ignoreEmpty || false == part.isEmpty()){
list.add(part);
}
return list;
} }
|
public class class_name {
private static List<String> addToList(List<String> list, String part, boolean isTrim, boolean ignoreEmpty){
if(isTrim){
part = StrUtil.trim(part);
// depends on control dependency: [if], data = [none]
}
if(false == ignoreEmpty || false == part.isEmpty()){
list.add(part);
// depends on control dependency: [if], data = [none]
}
return list;
} }
|
public class class_name {
void registerTaskStarted(Task task) {
synchronized (m_activeTasks) {
String mapKey = createMapKey(task.getTenant(), task.getTaskID());
if (m_activeTasks.put(mapKey, task) != null) {
m_logger.warn("Task {} registered as started but was already running", mapKey);
}
}
} }
|
public class class_name {
void registerTaskStarted(Task task) {
synchronized (m_activeTasks) {
String mapKey = createMapKey(task.getTenant(), task.getTaskID());
if (m_activeTasks.put(mapKey, task) != null) {
m_logger.warn("Task {} registered as started but was already running", mapKey); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public void setCookies(final Cookie[] cookies) {
this.cookies.clear();
if (cookies != null) {
for (final Cookie cookie : cookies) {
cookie(cookie);
}
}
} }
|
public class class_name {
public void setCookies(final Cookie[] cookies) {
this.cookies.clear();
if (cookies != null) {
for (final Cookie cookie : cookies) {
cookie(cookie); // depends on control dependency: [for], data = [cookie]
}
}
} }
|
public class class_name {
@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) {
if (msg instanceof Frame) {
Frame frame = (Frame) msg;
if (hasCurrentTransaction()) {
String tid = currentDataFrameTransaction.getId();
logger.trace("Received frame within transaction ({}) context: {}", tid, frame);
// give new frame to current transaction
NettyZWaveChannelContext zctx = new NettyZWaveChannelContext();
if (currentDataFrameTransaction.addFrame(zctx, frame)) {
if (currentDataFrameTransaction.isComplete()) {
logger.trace("*** Data frame transaction ({}) completed", tid);
logger.trace("");
cancelTimeoutCallback();
}
zctx.process(ctx);
// if transaction didn't consume frame, then pass it down the pipeline
} else {
logger.trace("Transaction ignored frame so passing it along");
ctx.fireChannelRead(msg);
}
} else if (msg instanceof AddNodeToNetwork) {
logger.trace("Received ADD_NODE_STATUS_NODE_FOUND; starting transaction");
NettyZWaveChannelContext zctx = new NettyZWaveChannelContext();
currentDataFrameTransaction = new NodeInclusionTransaction(zctx, (DataFrame)msg);
zctx.process(ctx);
} else {
logger.trace("Received frame outside of transaction context so passing it along: {}", frame);
ctx.fireChannelRead(msg);
}
}
} }
|
public class class_name {
@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) {
if (msg instanceof Frame) {
Frame frame = (Frame) msg;
if (hasCurrentTransaction()) {
String tid = currentDataFrameTransaction.getId();
logger.trace("Received frame within transaction ({}) context: {}", tid, frame); // depends on control dependency: [if], data = [none]
// give new frame to current transaction
NettyZWaveChannelContext zctx = new NettyZWaveChannelContext();
if (currentDataFrameTransaction.addFrame(zctx, frame)) {
if (currentDataFrameTransaction.isComplete()) {
logger.trace("*** Data frame transaction ({}) completed", tid); // depends on control dependency: [if], data = [none]
logger.trace(""); // depends on control dependency: [if], data = [none]
cancelTimeoutCallback(); // depends on control dependency: [if], data = [none]
}
zctx.process(ctx); // depends on control dependency: [if], data = [none]
// if transaction didn't consume frame, then pass it down the pipeline
} else {
logger.trace("Transaction ignored frame so passing it along"); // depends on control dependency: [if], data = [none]
ctx.fireChannelRead(msg); // depends on control dependency: [if], data = [none]
}
} else if (msg instanceof AddNodeToNetwork) {
logger.trace("Received ADD_NODE_STATUS_NODE_FOUND; starting transaction"); // depends on control dependency: [if], data = [none]
NettyZWaveChannelContext zctx = new NettyZWaveChannelContext();
currentDataFrameTransaction = new NodeInclusionTransaction(zctx, (DataFrame)msg); // depends on control dependency: [if], data = [none]
zctx.process(ctx); // depends on control dependency: [if], data = [none]
} else {
logger.trace("Received frame outside of transaction context so passing it along: {}", frame); // depends on control dependency: [if], data = [none]
ctx.fireChannelRead(msg); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public int syncRecords()
{ // Read a valid record
try
{
Object bookmark = this.getOwner().getBaseRecord().getHandle(DBConstants.BOOKMARK_HANDLE);
RecordOwner recordOwner = this.getRecordOwner(); // Get the record owner of the record to sync
if ((recordOwner instanceof ScreenComponent)
/*&& (((ScreenField)recordOwner).getScreenFieldView() != null)*/)
{ // NOTE: This is not a real message, I send it directly to the record.
RecordMessage message = this.createMessage(bookmark);
recordOwner.handleMessage(message);
}
else
{ // Kinda HACK - Since there is no screen, just read the record.
Record record = this.getRecordToSync();
if (bookmark != null)
record = record.setHandle(bookmark, DBConstants.BOOKMARK_HANDLE);
if ((record == null) || (bookmark == null))
record.addNew(); // Not found, start with a NEW record!
}
} catch (DBException ex) {
ex.printStackTrace();
}
return DBConstants.NORMAL_RETURN;
} }
|
public class class_name {
public int syncRecords()
{ // Read a valid record
try
{
Object bookmark = this.getOwner().getBaseRecord().getHandle(DBConstants.BOOKMARK_HANDLE);
RecordOwner recordOwner = this.getRecordOwner(); // Get the record owner of the record to sync
if ((recordOwner instanceof ScreenComponent)
/*&& (((ScreenField)recordOwner).getScreenFieldView() != null)*/)
{ // NOTE: This is not a real message, I send it directly to the record.
RecordMessage message = this.createMessage(bookmark);
recordOwner.handleMessage(message); // depends on control dependency: [if], data = [none]
}
else
{ // Kinda HACK - Since there is no screen, just read the record.
Record record = this.getRecordToSync();
if (bookmark != null)
record = record.setHandle(bookmark, DBConstants.BOOKMARK_HANDLE);
if ((record == null) || (bookmark == null))
record.addNew(); // Not found, start with a NEW record!
}
} catch (DBException ex) {
ex.printStackTrace();
} // depends on control dependency: [catch], data = [none]
return DBConstants.NORMAL_RETURN;
} }
|
public class class_name {
public AwsSecurityFindingFilters withCreatedAt(DateFilter... createdAt) {
if (this.createdAt == null) {
setCreatedAt(new java.util.ArrayList<DateFilter>(createdAt.length));
}
for (DateFilter ele : createdAt) {
this.createdAt.add(ele);
}
return this;
} }
|
public class class_name {
public AwsSecurityFindingFilters withCreatedAt(DateFilter... createdAt) {
if (this.createdAt == null) {
setCreatedAt(new java.util.ArrayList<DateFilter>(createdAt.length)); // depends on control dependency: [if], data = [none]
}
for (DateFilter ele : createdAt) {
this.createdAt.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} }
|
public class class_name {
public void addBookmarkFilter(Object bookmark)
{
if (m_recordMessageFilter != null)
{
if (bookmark == null) // Never
bookmark = NO_BOOKMARK;
Hashtable<String,Object> properties = new Hashtable<String,Object>();
properties.put(GridRecordMessageFilter.ADD_BOOKMARK, bookmark);
m_recordMessageFilter.updateFilterMap(properties);
}
} }
|
public class class_name {
public void addBookmarkFilter(Object bookmark)
{
if (m_recordMessageFilter != null)
{
if (bookmark == null) // Never
bookmark = NO_BOOKMARK;
Hashtable<String,Object> properties = new Hashtable<String,Object>();
properties.put(GridRecordMessageFilter.ADD_BOOKMARK, bookmark); // depends on control dependency: [if], data = [none]
m_recordMessageFilter.updateFilterMap(properties); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@Unbind
public void unbindFactory(Factory factory) {
try {
lock.lock();
InstanceDeclaration declaration = getDeclarationByFactory(factory);
if (declaration != null) {
LOGGER.info("Disposing instance created by");
declaration.dispose();
declarations.remove(declaration);
}
} finally {
lock.unlock();
}
} }
|
public class class_name {
@Unbind
public void unbindFactory(Factory factory) {
try {
lock.lock(); // depends on control dependency: [try], data = [none]
InstanceDeclaration declaration = getDeclarationByFactory(factory);
if (declaration != null) {
LOGGER.info("Disposing instance created by"); // depends on control dependency: [if], data = [none]
declaration.dispose(); // depends on control dependency: [if], data = [none]
declarations.remove(declaration); // depends on control dependency: [if], data = [(declaration]
}
} finally {
lock.unlock();
}
} }
|
public class class_name {
private boolean isReversed(String s1, String s2) {
if (s1 == null || s2 == null) {
return false;
}
return s1.compareToIgnoreCase(s2) > 0;
} }
|
public class class_name {
private boolean isReversed(String s1, String s2) {
if (s1 == null || s2 == null) {
return false; // depends on control dependency: [if], data = [none]
}
return s1.compareToIgnoreCase(s2) > 0;
} }
|
public class class_name {
private void configureStateAuth() {
setIsControlEnable(authButton, false);
if(isAuthenticated()) {
authStatusLabel.setText(I18nLabelsLoader.ADDON_LOGIN_STATUS_OK);
setDefaultButton(nextButtonName, true);
if(userPasswordText.getText() != null && userPasswordText.getText().length() == 0) {
userPasswordText.setText("********");
}
setDefaultButton(authButton, false);
setDefaultButton(cancelButtonName, false);
setDefaultButton(nextButtonName, true);
} else if (gotCommunicationError) {
// leave previous state
setIsControlEnable(authButton, true);
setDefaultButton(cancelButtonName, true);
}
} }
|
public class class_name {
private void configureStateAuth() {
setIsControlEnable(authButton, false);
if(isAuthenticated()) {
authStatusLabel.setText(I18nLabelsLoader.ADDON_LOGIN_STATUS_OK); // depends on control dependency: [if], data = [none]
setDefaultButton(nextButtonName, true); // depends on control dependency: [if], data = [none]
if(userPasswordText.getText() != null && userPasswordText.getText().length() == 0) {
userPasswordText.setText("********"); // depends on control dependency: [if], data = [none]
}
setDefaultButton(authButton, false); // depends on control dependency: [if], data = [none]
setDefaultButton(cancelButtonName, false); // depends on control dependency: [if], data = [none]
setDefaultButton(nextButtonName, true); // depends on control dependency: [if], data = [none]
} else if (gotCommunicationError) {
// leave previous state
setIsControlEnable(authButton, true); // depends on control dependency: [if], data = [none]
setDefaultButton(cancelButtonName, true); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@Override
public DescriptorValue calculate(IAtom atom, IAtomContainer container) {
IAtomType atomType;
try {
atomType = CDKAtomTypeMatcher.getInstance(atom.getBuilder()).findMatchingAtomType(container, atom);
} catch (CDKException e) {
return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), new IntegerResult(
(int) Double.NaN), // does that work??
getDescriptorNames(), new CDKException("Atom type was null"));
}
if (atomType == null) {
return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), new IntegerResult(
(int) Double.NaN), // does that work??
getDescriptorNames(), new CDKException("Atom type was null"));
}
if (atomType.getHybridization() == null) {
return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), new IntegerResult(
(int) Double.NaN), // does that work??
getDescriptorNames(), new CDKException("Hybridization was null"));
}
int hybridizationCDK = atomType.getHybridization().ordinal();
return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), new IntegerResult(
hybridizationCDK), getDescriptorNames());
} }
|
public class class_name {
@Override
public DescriptorValue calculate(IAtom atom, IAtomContainer container) {
IAtomType atomType;
try {
atomType = CDKAtomTypeMatcher.getInstance(atom.getBuilder()).findMatchingAtomType(container, atom); // depends on control dependency: [try], data = [none]
} catch (CDKException e) {
return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), new IntegerResult(
(int) Double.NaN), // does that work??
getDescriptorNames(), new CDKException("Atom type was null"));
} // depends on control dependency: [catch], data = [none]
if (atomType == null) {
return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), new IntegerResult(
(int) Double.NaN), // does that work??
getDescriptorNames(), new CDKException("Atom type was null")); // depends on control dependency: [if], data = [none]
}
if (atomType.getHybridization() == null) {
return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), new IntegerResult(
(int) Double.NaN), // does that work??
getDescriptorNames(), new CDKException("Hybridization was null")); // depends on control dependency: [if], data = [none]
}
int hybridizationCDK = atomType.getHybridization().ordinal();
return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), new IntegerResult(
hybridizationCDK), getDescriptorNames());
} }
|
public class class_name {
public static <T> T selectFirst(Iterator<T> nodeIterator, Predicate<T> filter)
{
while (nodeIterator.hasNext())
{
T element = nodeIterator.next();
if (filter.accept(element))
{
return element;
}
}
return null;
} }
|
public class class_name {
public static <T> T selectFirst(Iterator<T> nodeIterator, Predicate<T> filter)
{
while (nodeIterator.hasNext())
{
T element = nodeIterator.next();
if (filter.accept(element))
{
return element; // depends on control dependency: [if], data = [none]
}
}
return null;
} }
|
public class class_name {
private void appendBranched(int startOffset, int pastEnd) {
// Main tricky thing here is just replacing of linefeeds...
if (mConvertLFs) {
char[] inBuf = mBuffer;
/* this will also unshare() and ensure there's room for at
* least one more char
*/
char[] outBuf = mBranchBuffer.getCurrentSegment();
int outPtr = mBranchBuffer.getCurrentSegmentSize();
// Pending \n to skip?
if (mGotCR) {
if (inBuf[startOffset] == '\n') {
++startOffset;
}
}
while (startOffset < pastEnd) {
char c = inBuf[startOffset++];
if (c == '\r') {
if (startOffset < pastEnd) {
if (inBuf[startOffset] == '\n') {
++startOffset;
}
} else {
mGotCR = true;
}
c = '\n';
}
// Ok, let's add char to output:
outBuf[outPtr++] = c;
// Need more room?
if (outPtr >= outBuf.length) {
outBuf = mBranchBuffer.finishCurrentSegment();
outPtr = 0;
}
}
mBranchBuffer.setCurrentLength(outPtr);
} else {
mBranchBuffer.append(mBuffer, startOffset, pastEnd-startOffset);
}
} }
|
public class class_name {
private void appendBranched(int startOffset, int pastEnd) {
// Main tricky thing here is just replacing of linefeeds...
if (mConvertLFs) {
char[] inBuf = mBuffer;
/* this will also unshare() and ensure there's room for at
* least one more char
*/
char[] outBuf = mBranchBuffer.getCurrentSegment();
int outPtr = mBranchBuffer.getCurrentSegmentSize();
// Pending \n to skip?
if (mGotCR) {
if (inBuf[startOffset] == '\n') {
++startOffset; // depends on control dependency: [if], data = [none]
}
}
while (startOffset < pastEnd) {
char c = inBuf[startOffset++];
if (c == '\r') {
if (startOffset < pastEnd) {
if (inBuf[startOffset] == '\n') {
++startOffset; // depends on control dependency: [if], data = [none]
}
} else {
mGotCR = true; // depends on control dependency: [if], data = [none]
}
c = '\n'; // depends on control dependency: [if], data = [none]
}
// Ok, let's add char to output:
outBuf[outPtr++] = c; // depends on control dependency: [while], data = [none]
// Need more room?
if (outPtr >= outBuf.length) {
outBuf = mBranchBuffer.finishCurrentSegment(); // depends on control dependency: [if], data = [none]
outPtr = 0; // depends on control dependency: [if], data = [none]
}
}
mBranchBuffer.setCurrentLength(outPtr); // depends on control dependency: [if], data = [none]
} else {
mBranchBuffer.append(mBuffer, startOffset, pastEnd-startOffset); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public List<T> getDomainObjectsAsList(Set<? extends KEY> keys) {
// it is not "possible" to use huge number of parameters in a
// Restrictions.in criterion and therefore we chunk the query
// into pieces
List<T> all = new ArrayList<T>();
Iterator<? extends KEY> iter = keys.iterator();
List<KEY> chunkKeys = new ArrayList<KEY>();
for (int i = 1; iter.hasNext(); i++) {
KEY element = iter.next();
chunkKeys.add(element);
if ((i % CHUNK_SIZE) == 0) {
all.addAll(getChunk(chunkKeys));
chunkKeys = new ArrayList<KEY>();
}
}
// and then the last part
if (!chunkKeys.isEmpty()) {
all.addAll(getChunk(chunkKeys));
}
return all;
} }
|
public class class_name {
public List<T> getDomainObjectsAsList(Set<? extends KEY> keys) {
// it is not "possible" to use huge number of parameters in a
// Restrictions.in criterion and therefore we chunk the query
// into pieces
List<T> all = new ArrayList<T>();
Iterator<? extends KEY> iter = keys.iterator();
List<KEY> chunkKeys = new ArrayList<KEY>();
for (int i = 1; iter.hasNext(); i++) {
KEY element = iter.next();
chunkKeys.add(element);
// depends on control dependency: [for], data = [none]
if ((i % CHUNK_SIZE) == 0) {
all.addAll(getChunk(chunkKeys));
// depends on control dependency: [if], data = [none]
chunkKeys = new ArrayList<KEY>();
// depends on control dependency: [if], data = [none]
}
}
// and then the last part
if (!chunkKeys.isEmpty()) {
all.addAll(getChunk(chunkKeys));
// depends on control dependency: [if], data = [none]
}
return all;
} }
|
public class class_name {
synchronized void deactivate() {
paused = false;
if (activeTask != null) {
activeTask.cancel();
activeTask = null;
}
this.threadPool = null;
} }
|
public class class_name {
synchronized void deactivate() {
paused = false;
if (activeTask != null) {
activeTask.cancel(); // depends on control dependency: [if], data = [none]
activeTask = null; // depends on control dependency: [if], data = [none]
}
this.threadPool = null;
} }
|
public class class_name {
public double magnitude() {
// Check whether the current magnitude is valid and if not, recompute it
if (magnitude < 0) {
double m = 0;
for (int nz : getNonZeroIndices()) {
int i = intArray.get(nz);
m += i * i;
}
magnitude = Math.sqrt(m);
}
return magnitude;
} }
|
public class class_name {
public double magnitude() {
// Check whether the current magnitude is valid and if not, recompute it
if (magnitude < 0) {
double m = 0;
for (int nz : getNonZeroIndices()) {
int i = intArray.get(nz);
m += i * i; // depends on control dependency: [for], data = [none]
}
magnitude = Math.sqrt(m); // depends on control dependency: [if], data = [none]
}
return magnitude;
} }
|
public class class_name {
@Override
protected void preparePaintComponent(final Request request) {
StringBuffer text = new StringBuffer("Options: ");
for (Object option : shuffler.getOptions()) {
text.append(option).append(", ");
}
order.setText(text.toString());
} }
|
public class class_name {
@Override
protected void preparePaintComponent(final Request request) {
StringBuffer text = new StringBuffer("Options: ");
for (Object option : shuffler.getOptions()) {
text.append(option).append(", "); // depends on control dependency: [for], data = [option]
}
order.setText(text.toString());
} }
|
public class class_name {
public EClass getIfcImageTexture() {
if (ifcImageTextureEClass == null) {
ifcImageTextureEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(280);
}
return ifcImageTextureEClass;
} }
|
public class class_name {
public EClass getIfcImageTexture() {
if (ifcImageTextureEClass == null) {
ifcImageTextureEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(280);
// depends on control dependency: [if], data = [none]
}
return ifcImageTextureEClass;
} }
|
public class class_name {
protected void generateFetchMethods(TableDefinition table, JavaWriter out){
VertxJavaWriter vOut = (VertxJavaWriter) out;
String pType = vOut.ref(getStrategy().getFullJavaClassName(table, GeneratorStrategy.Mode.POJO));
UniqueKeyDefinition primaryKey = table.getPrimaryKey();
ColumnDefinition firstPrimaryKeyColumn = primaryKey.getKeyColumns().get(0);
for (ColumnDefinition column : table.getColumns()) {
final String colName = column.getOutputName();
final String colClass = getStrategy().getJavaClassName(column);
final String colType = vOut.ref(getJavaType(column.getType()));
final String colIdentifier = vOut.ref(getStrategy().getFullJavaIdentifier(column), colRefSegments(column));
//fetchById is already defined in VertxDAO
if(!firstPrimaryKeyColumn.equals(column)){
// fetchBy[Column]([T]...)
// -----------------------
generateFindManyByMethods(out, pType, colName, colClass, colType, colIdentifier);
}
ukLoop:
for (UniqueKeyDefinition uk : column.getUniqueKeys()) {
// If column is part of a single-column unique key...
if (uk.getKeyColumns().size() == 1 && uk.getKeyColumns().get(0).equals(column) && !uk.isPrimaryKey()) {
// fetchOneBy[Column]([T])
// -----------------------
generateFindOneByMethods(out, pType, colName, colClass, colType, colIdentifier);
break ukLoop;
}
}
}
} }
|
public class class_name {
protected void generateFetchMethods(TableDefinition table, JavaWriter out){
VertxJavaWriter vOut = (VertxJavaWriter) out;
String pType = vOut.ref(getStrategy().getFullJavaClassName(table, GeneratorStrategy.Mode.POJO));
UniqueKeyDefinition primaryKey = table.getPrimaryKey();
ColumnDefinition firstPrimaryKeyColumn = primaryKey.getKeyColumns().get(0);
for (ColumnDefinition column : table.getColumns()) {
final String colName = column.getOutputName();
final String colClass = getStrategy().getJavaClassName(column);
final String colType = vOut.ref(getJavaType(column.getType()));
final String colIdentifier = vOut.ref(getStrategy().getFullJavaIdentifier(column), colRefSegments(column));
//fetchById is already defined in VertxDAO
if(!firstPrimaryKeyColumn.equals(column)){
// fetchBy[Column]([T]...)
// -----------------------
generateFindManyByMethods(out, pType, colName, colClass, colType, colIdentifier); // depends on control dependency: [if], data = [none]
}
ukLoop:
for (UniqueKeyDefinition uk : column.getUniqueKeys()) {
// If column is part of a single-column unique key...
if (uk.getKeyColumns().size() == 1 && uk.getKeyColumns().get(0).equals(column) && !uk.isPrimaryKey()) {
// fetchOneBy[Column]([T])
// -----------------------
generateFindOneByMethods(out, pType, colName, colClass, colType, colIdentifier); // depends on control dependency: [if], data = [none]
break ukLoop;
}
}
}
} }
|
public class class_name {
private void checkSizeOfMarkupBlocksStructure(final int markupLevel) {
if (markupLevel >= this.markupBlocks.length) {
final int newLen = Math.max(markupLevel + 1, this.markupBlocks.length + MARKUP_BLOCKS_LEN);
final int[] newMarkupBlocks = new int[newLen];
Arrays.fill(newMarkupBlocks, 0);
System.arraycopy(this.markupBlocks, 0, newMarkupBlocks, 0, this.markupBlocks.length);
this.markupBlocks = newMarkupBlocks;
}
} }
|
public class class_name {
private void checkSizeOfMarkupBlocksStructure(final int markupLevel) {
if (markupLevel >= this.markupBlocks.length) {
final int newLen = Math.max(markupLevel + 1, this.markupBlocks.length + MARKUP_BLOCKS_LEN);
final int[] newMarkupBlocks = new int[newLen];
Arrays.fill(newMarkupBlocks, 0); // depends on control dependency: [if], data = [none]
System.arraycopy(this.markupBlocks, 0, newMarkupBlocks, 0, this.markupBlocks.length); // depends on control dependency: [if], data = [none]
this.markupBlocks = newMarkupBlocks; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
protected static void fireArrayStartEvent( JsonConfig jsonConfig ) {
if( jsonConfig.isEventTriggeringEnabled() ){
for( Iterator listeners = jsonConfig.getJsonEventListeners()
.iterator(); listeners.hasNext(); ){
JsonEventListener listener = (JsonEventListener) listeners.next();
try{
listener.onArrayStart();
}catch( RuntimeException e ){
log.warn( e );
}
}
}
} }
|
public class class_name {
protected static void fireArrayStartEvent( JsonConfig jsonConfig ) {
if( jsonConfig.isEventTriggeringEnabled() ){
for( Iterator listeners = jsonConfig.getJsonEventListeners()
.iterator(); listeners.hasNext(); ){
JsonEventListener listener = (JsonEventListener) listeners.next();
try{
listener.onArrayStart(); // depends on control dependency: [try], data = [none]
}catch( RuntimeException e ){
log.warn( e );
} // depends on control dependency: [catch], data = [none]
}
}
} }
|
public class class_name {
@Override
public void sawOpcode(int seen) {
Units unit = null;
try {
stack.precomputation(this);
switch (seen) {
case Const.INVOKEVIRTUAL:
case Const.INVOKEINTERFACE:
case Const.INVOKESTATIC:
unit = processInvoke();
break;
case Const.GETSTATIC:
String clsName = getClassConstantOperand();
if ("java/util/concurrent/TimeUnit".equals(clsName) || "edu/emory/matchcs/backport/java/util/concurrent/TimeUnit".equals(clsName)) {
unit = TIMEUNIT_TO_UNITS.get(getNameConstantOperand());
}
break;
case Const.L2I:
case Const.I2L:
if (stack.getStackDepth() > 0) {
OpcodeStack.Item item = stack.getStackItem(0);
unit = (Units) item.getUserValue();
}
break;
case Const.IADD:
case Const.ISUB:
case Const.IMUL:
case Const.IDIV:
case Const.IREM:
case Const.LADD:
case Const.LSUB:
case Const.LMUL:
case Const.LDIV:
case Const.LREM:
processArithmetic();
break;
default:
break;
}
} finally {
stack.sawOpcode(this, seen);
if ((unit != null) && (stack.getStackDepth() > 0)) {
OpcodeStack.Item item = stack.getStackItem(0);
item.setUserValue(unit);
}
}
} }
|
public class class_name {
@Override
public void sawOpcode(int seen) {
Units unit = null;
try {
stack.precomputation(this); // depends on control dependency: [try], data = [none]
switch (seen) {
case Const.INVOKEVIRTUAL:
case Const.INVOKEINTERFACE:
case Const.INVOKESTATIC:
unit = processInvoke();
break;
case Const.GETSTATIC:
String clsName = getClassConstantOperand();
if ("java/util/concurrent/TimeUnit".equals(clsName) || "edu/emory/matchcs/backport/java/util/concurrent/TimeUnit".equals(clsName)) {
unit = TIMEUNIT_TO_UNITS.get(getNameConstantOperand()); // depends on control dependency: [if], data = [none]
}
break;
case Const.L2I:
case Const.I2L:
if (stack.getStackDepth() > 0) {
OpcodeStack.Item item = stack.getStackItem(0);
unit = (Units) item.getUserValue(); // depends on control dependency: [if], data = [none]
}
break;
case Const.IADD:
case Const.ISUB:
case Const.IMUL:
case Const.IDIV:
case Const.IREM:
case Const.LADD:
case Const.LSUB:
case Const.LMUL:
case Const.LDIV:
case Const.LREM:
processArithmetic();
break;
default:
break;
}
} finally {
stack.sawOpcode(this, seen);
if ((unit != null) && (stack.getStackDepth() > 0)) {
OpcodeStack.Item item = stack.getStackItem(0);
item.setUserValue(unit); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
private boolean isDdlDatas(List<EventData> eventDatas) {
boolean result = false;
for (EventData eventData : eventDatas) {
result |= eventData.getEventType().isDdl();
if (result && !eventData.getEventType().isDdl()) {
throw new LoadException("ddl/dml can't be in one batch, it's may be a bug , pls submit issues.",
DbLoadDumper.dumpEventDatas(eventDatas));
}
}
return result;
} }
|
public class class_name {
private boolean isDdlDatas(List<EventData> eventDatas) {
boolean result = false;
for (EventData eventData : eventDatas) {
result |= eventData.getEventType().isDdl(); // depends on control dependency: [for], data = [eventData]
if (result && !eventData.getEventType().isDdl()) {
throw new LoadException("ddl/dml can't be in one batch, it's may be a bug , pls submit issues.",
DbLoadDumper.dumpEventDatas(eventDatas));
}
}
return result;
} }
|
public class class_name {
public boolean process(final byte[] newData) {
if (newData != null) {
buffer.write(newData);
}
boolean done = false;
while (!done) {
final int index = buffer.getReaderIndex();
final State currentState = state;
state = actions[state.ordinal()].apply(buffer);
done = state == currentState && buffer.getReaderIndex() == index;
}
return state == State.DONE;
} }
|
public class class_name {
public boolean process(final byte[] newData) {
if (newData != null) {
buffer.write(newData); // depends on control dependency: [if], data = [(newData]
}
boolean done = false;
while (!done) {
final int index = buffer.getReaderIndex();
final State currentState = state;
state = actions[state.ordinal()].apply(buffer); // depends on control dependency: [while], data = [none]
done = state == currentState && buffer.getReaderIndex() == index; // depends on control dependency: [while], data = [none]
}
return state == State.DONE;
} }
|
public class class_name {
@SuppressWarnings("unchecked")
@Override
public <V> V get(String key) {
V returnValue = null;
try{
returnValue = (V) _jedisClusterClient.get(key);
}catch (Exception ex) {
_logger.error("Exception in cache service: {} ", ex.getMessage());
}
return returnValue;
} }
|
public class class_name {
@SuppressWarnings("unchecked")
@Override
public <V> V get(String key) {
V returnValue = null;
try{
returnValue = (V) _jedisClusterClient.get(key); // depends on control dependency: [try], data = [none]
}catch (Exception ex) {
_logger.error("Exception in cache service: {} ", ex.getMessage());
} // depends on control dependency: [catch], data = [none]
return returnValue;
} }
|
public class class_name {
private static void track(String historyToken) {
if (historyToken == null) {
historyToken = "historyToken_null";
}
historyToken = URL.encode("/WWARN-GWT-Analytics/V1.0/" + historyToken);
boolean hasErrored = false;
try{
trackGoogleAnalytics(historyToken);
}catch (JavaScriptException e){
hasErrored = true;
GWT.log("Unable to track" ,e);
}
if(!hasErrored) GWT.log("Tracked " + historyToken);
} }
|
public class class_name {
private static void track(String historyToken) {
if (historyToken == null) {
historyToken = "historyToken_null"; // depends on control dependency: [if], data = [none]
}
historyToken = URL.encode("/WWARN-GWT-Analytics/V1.0/" + historyToken);
boolean hasErrored = false;
try{
trackGoogleAnalytics(historyToken); // depends on control dependency: [try], data = [none]
}catch (JavaScriptException e){
hasErrored = true;
GWT.log("Unable to track" ,e);
} // depends on control dependency: [catch], data = [none]
if(!hasErrored) GWT.log("Tracked " + historyToken);
} }
|
public class class_name {
public static void readBySax(String path, int sheetIndex, RowHandler rowHandler) {
BufferedInputStream in = null;
try {
in = FileUtil.getInputStream(path);
readBySax(in, sheetIndex, rowHandler);
} finally {
IoUtil.close(in);
}
} }
|
public class class_name {
public static void readBySax(String path, int sheetIndex, RowHandler rowHandler) {
BufferedInputStream in = null;
try {
in = FileUtil.getInputStream(path);
// depends on control dependency: [try], data = [none]
readBySax(in, sheetIndex, rowHandler);
// depends on control dependency: [try], data = [none]
} finally {
IoUtil.close(in);
}
} }
|
public class class_name {
private int buildGrid(SubMenuItem subMenu, int inset, int gridPosition) {
// inset is the amount of offset to apply to the left, to make the tree look realistic
// gridPosition is the row in the grid we populating.
// while there are more menuitems in the current level
for (MenuItem item : menuTree.getMenuItems(subMenu)) {
if (item.hasChildren()) {
//
// for submenus, we make single label and call back on ourselves with the next level down
//
Label itemLbl = new Label("SubMenu " + item.getName());
itemLbl.setPadding(new Insets(12, 10, 12, inset));
itemLbl.setStyle("-fx-font-weight: bold; -fx-font-size: 120%;");
itemGrid.add(itemLbl, 0, gridPosition++, 2, 1);
gridPosition = buildGrid(MenuItemHelper.asSubMenu(item), inset + 10, gridPosition);
} else {
//
// otherwise for child items we create the controls that display the value and allow
// editing.
//
Label itemLbl = new Label(item.getName());
itemLbl.setPadding(new Insets(3, 10, 3, inset));
itemGrid.add(itemLbl, 0, gridPosition);
itemGrid.add(createUiControlForItem(item), 1, gridPosition);
renderItemValue(item);
gridPosition++;
}
}
return gridPosition;
} }
|
public class class_name {
private int buildGrid(SubMenuItem subMenu, int inset, int gridPosition) {
// inset is the amount of offset to apply to the left, to make the tree look realistic
// gridPosition is the row in the grid we populating.
// while there are more menuitems in the current level
for (MenuItem item : menuTree.getMenuItems(subMenu)) {
if (item.hasChildren()) {
//
// for submenus, we make single label and call back on ourselves with the next level down
//
Label itemLbl = new Label("SubMenu " + item.getName());
itemLbl.setPadding(new Insets(12, 10, 12, inset)); // depends on control dependency: [if], data = [none]
itemLbl.setStyle("-fx-font-weight: bold; -fx-font-size: 120%;"); // depends on control dependency: [if], data = [none]
itemGrid.add(itemLbl, 0, gridPosition++, 2, 1); // depends on control dependency: [if], data = [none]
gridPosition = buildGrid(MenuItemHelper.asSubMenu(item), inset + 10, gridPosition); // depends on control dependency: [if], data = [none]
} else {
//
// otherwise for child items we create the controls that display the value and allow
// editing.
//
Label itemLbl = new Label(item.getName());
itemLbl.setPadding(new Insets(3, 10, 3, inset)); // depends on control dependency: [if], data = [none]
itemGrid.add(itemLbl, 0, gridPosition); // depends on control dependency: [if], data = [none]
itemGrid.add(createUiControlForItem(item), 1, gridPosition); // depends on control dependency: [if], data = [none]
renderItemValue(item); // depends on control dependency: [if], data = [none]
gridPosition++; // depends on control dependency: [if], data = [none]
}
}
return gridPosition;
} }
|
public class class_name {
public Set<String> getDependenciesNotation() {
Set<String> notations = new HashSet<String>();
for (Dependency dependency : currentDependencies() ) {
notations.add(Notation.generate(dependency));
}
return notations;
} }
|
public class class_name {
public Set<String> getDependenciesNotation() {
Set<String> notations = new HashSet<String>();
for (Dependency dependency : currentDependencies() ) {
notations.add(Notation.generate(dependency)); // depends on control dependency: [for], data = [dependency]
}
return notations;
} }
|
public class class_name {
@Override
protected int writeBytesWireFormat ( byte[] dst, int dstIndex ) {
int start = dstIndex;
SMBUtil.writeInt2(33, dst, dstIndex);
dst[ dstIndex + 2 ] = this.fileInformationClass;
dst[ dstIndex + 3 ] = this.queryFlags;
dstIndex += 4;
SMBUtil.writeInt4(this.fileIndex, dst, dstIndex);
dstIndex += 4;
System.arraycopy(this.fileId, 0, dst, dstIndex, 16);
dstIndex += 16;
int fnOffsetOffset = dstIndex;
int fnLengthOffset = dstIndex + 2;
dstIndex += 4;
SMBUtil.writeInt4(this.outputBufferLength, dst, dstIndex);
dstIndex += 4;
if ( this.fileName == null ) {
SMBUtil.writeInt2(0, dst, fnOffsetOffset);
SMBUtil.writeInt2(0, dst, fnLengthOffset);
}
else {
byte[] fnBytes = this.fileName.getBytes(StandardCharsets.UTF_16LE);
SMBUtil.writeInt2(dstIndex - getHeaderStart(), dst, fnOffsetOffset);
SMBUtil.writeInt2(fnBytes.length, dst, fnLengthOffset);
System.arraycopy(fnBytes, 0, dst, dstIndex, fnBytes.length);
dstIndex += fnBytes.length;
}
return dstIndex - start;
} }
|
public class class_name {
@Override
protected int writeBytesWireFormat ( byte[] dst, int dstIndex ) {
int start = dstIndex;
SMBUtil.writeInt2(33, dst, dstIndex);
dst[ dstIndex + 2 ] = this.fileInformationClass;
dst[ dstIndex + 3 ] = this.queryFlags;
dstIndex += 4;
SMBUtil.writeInt4(this.fileIndex, dst, dstIndex);
dstIndex += 4;
System.arraycopy(this.fileId, 0, dst, dstIndex, 16);
dstIndex += 16;
int fnOffsetOffset = dstIndex;
int fnLengthOffset = dstIndex + 2;
dstIndex += 4;
SMBUtil.writeInt4(this.outputBufferLength, dst, dstIndex);
dstIndex += 4;
if ( this.fileName == null ) {
SMBUtil.writeInt2(0, dst, fnOffsetOffset); // depends on control dependency: [if], data = [none]
SMBUtil.writeInt2(0, dst, fnLengthOffset); // depends on control dependency: [if], data = [none]
}
else {
byte[] fnBytes = this.fileName.getBytes(StandardCharsets.UTF_16LE);
SMBUtil.writeInt2(dstIndex - getHeaderStart(), dst, fnOffsetOffset); // depends on control dependency: [if], data = [none]
SMBUtil.writeInt2(fnBytes.length, dst, fnLengthOffset); // depends on control dependency: [if], data = [none]
System.arraycopy(fnBytes, 0, dst, dstIndex, fnBytes.length); // depends on control dependency: [if], data = [none]
dstIndex += fnBytes.length; // depends on control dependency: [if], data = [none]
}
return dstIndex - start;
} }
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.