code
stringlengths 130
281k
| code_dependency
stringlengths 182
306k
|
|---|---|
public class class_name {
public Dateitem findMatchingItem(DateRange range) {
for (BaseComponent item : getChildren()) {
if (range.equals(item.getData())) {
return (Dateitem) item;
}
}
return null;
} }
|
public class class_name {
public Dateitem findMatchingItem(DateRange range) {
for (BaseComponent item : getChildren()) {
if (range.equals(item.getData())) {
return (Dateitem) item; // depends on control dependency: [if], data = [none]
}
}
return null;
} }
|
public class class_name {
@VisibleForTesting
RangeSet<RowKeyWrapper> rowSetToRangeSet(RowSet btRowSet) {
RangeSet<RowKeyWrapper> rangeSet = TreeRangeSet.create();
for (RowRange btRowRange : btRowSet.getRowRangesList()) {
rangeSet.add(rowRangeToRange(btRowRange));
}
for (ByteString key : btRowSet.getRowKeysList()) {
rangeSet.add(Range.singleton(new RowKeyWrapper(key)));
}
return rangeSet;
} }
|
public class class_name {
@VisibleForTesting
RangeSet<RowKeyWrapper> rowSetToRangeSet(RowSet btRowSet) {
RangeSet<RowKeyWrapper> rangeSet = TreeRangeSet.create();
for (RowRange btRowRange : btRowSet.getRowRangesList()) {
rangeSet.add(rowRangeToRange(btRowRange)); // depends on control dependency: [for], data = [btRowRange]
}
for (ByteString key : btRowSet.getRowKeysList()) {
rangeSet.add(Range.singleton(new RowKeyWrapper(key))); // depends on control dependency: [for], data = [key]
}
return rangeSet;
} }
|
public class class_name {
private void prepareJavaSERuntime(final List<File> artifacts) throws MojoExecutionException {
final File artifact = getProjectJarArtifact(artifacts);
if (artifact == null) {
return;
}
switch (runtimeSetting.getOsEnum()) {
case Windows:
// Windows: Generate web.config to staging folder
try {
WebAppUtils.generateWebConfigFile(artifact.getName(), log, stagingDirectoryPath, this.getClass());
} catch (IOException e) {
throw new MojoExecutionException("Failed to generate web.config file");
}
break;
case Linux:
// Linux: Rename project artifact to app.jar
log.info(String.format(RENAMING_MESSAGE, artifact.getAbsolutePath(), DEFAULT_LINUX_JAR_NAME));
artifact.renameTo(new File(artifact.getParent(), DEFAULT_LINUX_JAR_NAME));
break;
default:
return;
}
} }
|
public class class_name {
private void prepareJavaSERuntime(final List<File> artifacts) throws MojoExecutionException {
final File artifact = getProjectJarArtifact(artifacts);
if (artifact == null) {
return;
}
switch (runtimeSetting.getOsEnum()) {
case Windows:
// Windows: Generate web.config to staging folder
try {
WebAppUtils.generateWebConfigFile(artifact.getName(), log, stagingDirectoryPath, this.getClass()); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
throw new MojoExecutionException("Failed to generate web.config file");
} // depends on control dependency: [catch], data = [none]
break;
case Linux:
// Linux: Rename project artifact to app.jar
log.info(String.format(RENAMING_MESSAGE, artifact.getAbsolutePath(), DEFAULT_LINUX_JAR_NAME));
artifact.renameTo(new File(artifact.getParent(), DEFAULT_LINUX_JAR_NAME));
break;
default:
return;
}
} }
|
public class class_name {
public static byte[] textToNumericFormatV4(final String src) {
if (src.length() == 0) {
return null;
}
final byte[] res = new byte[INADDR4SZ];
final String[] s = src.split("\\.", -1);
long val;
try {
switch (s.length) {
case 1:
/*
* When only one part is given, the value is stored directly in the network address
* without any byte rearrangement.
*/
val = Long.parseLong(s[0]);
if (val < 0 || val > 0xffffffffL) {
return null;
}
res[0] = (byte) (val >> 24 & 0xff);
res[1] = (byte) ((val & 0xffffff) >> 16 & 0xff);
res[2] = (byte) ((val & 0xffff) >> 8 & 0xff);
res[3] = (byte) (val & 0xff);
break;
case 2:
/*
* When a two part address is supplied, the last part is interpreted as a 24-bit quantity
* and placed in the right most three bytes of the network address. This makes the two
* part address format convenient for specifying Class A network addresses as net.host.
*/
val = Integer.parseInt(s[0]);
if (val < 0 || val > 0xff) {
return null;
}
res[0] = (byte) (val & 0xff);
val = Integer.parseInt(s[1]);
if (val < 0 || val > 0xffffff) {
return null;
}
res[1] = (byte) (val >> 16 & 0xff);
res[2] = (byte) ((val & 0xffff) >> 8 & 0xff);
res[3] = (byte) (val & 0xff);
break;
case 3:
/*
* When a three part address is specified, the last part is interpreted as a 16-bit
* quantity and placed in the right most two bytes of the network address. This makes the
* three part address format convenient for specifying Class B net- work addresses as
* 128.net.host.
*/
for (int i = 0; i < 2; i++) {
val = Integer.parseInt(s[i]);
if (val < 0 || val > 0xff) {
return null;
}
res[i] = (byte) (val & 0xff);
}
val = Integer.parseInt(s[2]);
if (val < 0 || val > 0xffff) {
return null;
}
res[2] = (byte) (val >> 8 & 0xff);
res[3] = (byte) (val & 0xff);
break;
case 4:
/*
* When four parts are specified, each is interpreted as a byte of data and assigned, from
* left to right, to the four bytes of an IPv4 address.
*/
for (int i = 0; i < 4; i++) {
val = Integer.parseInt(s[i]);
if (val < 0 || val > 0xff) {
return null;
}
res[i] = (byte) (val & 0xff);
}
break;
default:
return null;
}
} catch (final NumberFormatException e) {
return null;
}
return res;
} }
|
public class class_name {
public static byte[] textToNumericFormatV4(final String src) {
if (src.length() == 0) {
return null; // depends on control dependency: [if], data = [none]
}
final byte[] res = new byte[INADDR4SZ];
final String[] s = src.split("\\.", -1);
long val;
try {
switch (s.length) {
case 1:
/*
* When only one part is given, the value is stored directly in the network address
* without any byte rearrangement.
*/
val = Long.parseLong(s[0]);
if (val < 0 || val > 0xffffffffL) {
return null; // depends on control dependency: [if], data = [none]
}
res[0] = (byte) (val >> 24 & 0xff);
res[1] = (byte) ((val & 0xffffff) >> 16 & 0xff);
res[2] = (byte) ((val & 0xffff) >> 8 & 0xff);
res[3] = (byte) (val & 0xff);
break;
case 2:
/*
* When a two part address is supplied, the last part is interpreted as a 24-bit quantity
* and placed in the right most three bytes of the network address. This makes the two
* part address format convenient for specifying Class A network addresses as net.host.
*/
val = Integer.parseInt(s[0]);
if (val < 0 || val > 0xff) {
return null; // depends on control dependency: [if], data = [none]
}
res[0] = (byte) (val & 0xff);
val = Integer.parseInt(s[1]);
if (val < 0 || val > 0xffffff) {
return null; // depends on control dependency: [if], data = [none]
}
res[1] = (byte) (val >> 16 & 0xff);
res[2] = (byte) ((val & 0xffff) >> 8 & 0xff);
res[3] = (byte) (val & 0xff);
break;
case 3:
/*
* When a three part address is specified, the last part is interpreted as a 16-bit
* quantity and placed in the right most two bytes of the network address. This makes the
* three part address format convenient for specifying Class B net- work addresses as
* 128.net.host.
*/
for (int i = 0; i < 2; i++) {
val = Integer.parseInt(s[i]); // depends on control dependency: [for], data = [i]
if (val < 0 || val > 0xff) {
return null; // depends on control dependency: [if], data = [none]
}
res[i] = (byte) (val & 0xff); // depends on control dependency: [for], data = [i]
}
val = Integer.parseInt(s[2]);
if (val < 0 || val > 0xffff) {
return null; // depends on control dependency: [if], data = [none]
}
res[2] = (byte) (val >> 8 & 0xff);
res[3] = (byte) (val & 0xff);
break;
case 4:
/*
* When four parts are specified, each is interpreted as a byte of data and assigned, from
* left to right, to the four bytes of an IPv4 address.
*/
for (int i = 0; i < 4; i++) {
val = Integer.parseInt(s[i]); // depends on control dependency: [for], data = [i]
if (val < 0 || val > 0xff) {
return null; // depends on control dependency: [if], data = [none]
}
res[i] = (byte) (val & 0xff); // depends on control dependency: [for], data = [i]
}
break;
default:
return null;
}
} catch (final NumberFormatException e) {
return null;
} // depends on control dependency: [catch], data = [none]
return res;
} }
|
public class class_name {
public static WebXML getInstance(String webxml) {
WebXML wx = null;
BeanReader reader = new BeanReader();
reader.getXMLIntrospector().getConfiguration()
.setAttributesForPrimitives(false);
reader.getBindingConfiguration().setMapIDs(false);
try {
reader.registerMultiMapping(getBetwixtMapping());
wx = (WebXML) reader.parse(new File(webxml).toURI().toString());
} catch (IntrospectionException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SAXException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return wx;
} }
|
public class class_name {
public static WebXML getInstance(String webxml) {
WebXML wx = null;
BeanReader reader = new BeanReader();
reader.getXMLIntrospector().getConfiguration()
.setAttributesForPrimitives(false);
reader.getBindingConfiguration().setMapIDs(false);
try {
reader.registerMultiMapping(getBetwixtMapping()); // depends on control dependency: [try], data = [none]
wx = (WebXML) reader.parse(new File(webxml).toURI().toString()); // depends on control dependency: [try], data = [none]
} catch (IntrospectionException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) { // depends on control dependency: [catch], data = [none]
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SAXException e) { // depends on control dependency: [catch], data = [none]
// TODO Auto-generated catch block
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
return wx;
} }
|
public class class_name {
public static String printArray(int[] array)
{
String result = "[";
for (int i = 0; i < array.length; i++)
{
result += array[i];
result += (i < (array.length - 1)) ? ", " : "";
}
result += "]";
return result;
} }
|
public class class_name {
public static String printArray(int[] array)
{
String result = "[";
for (int i = 0; i < array.length; i++)
{
result += array[i]; // depends on control dependency: [for], data = [i]
result += (i < (array.length - 1)) ? ", " : ""; // depends on control dependency: [for], data = [i]
}
result += "]";
return result;
} }
|
public class class_name {
public E set(int index, E element) {
try {
ListIterator<E> e = listIterator(index);
E oldVal = e.next();
e.set(element);
return oldVal;
} catch (NoSuchElementException exc) {
throw new IndexOutOfBoundsException("Index: "+index);
}
} }
|
public class class_name {
public E set(int index, E element) {
try {
ListIterator<E> e = listIterator(index);
E oldVal = e.next();
e.set(element); // depends on control dependency: [try], data = [none]
return oldVal; // depends on control dependency: [try], data = [none]
} catch (NoSuchElementException exc) {
throw new IndexOutOfBoundsException("Index: "+index);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public String serializeConditionList(List<Condition> list) {
ObjectMapper om = getObjectMapper();
try {
return om.writeValueAsString(new ListWrappers.ConditionList(list));
} catch (Exception e) {
throw new RuntimeException(e);
}
} }
|
public class class_name {
public String serializeConditionList(List<Condition> list) {
ObjectMapper om = getObjectMapper();
try {
return om.writeValueAsString(new ListWrappers.ConditionList(list)); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public synchronized void highlight(Parent pane, String query) {
if (this.parent != null && !boxes.isEmpty()) {
clear();
}
if(query == null || query.isEmpty()) return;
this.parent = pane;
Set<Node> nodes = getTextNodes(pane);
ArrayList<Rectangle> allRectangles = new ArrayList<>();
for (Node node : nodes) {
Text text = ((Text) node);
final int beginIndex = text.getText().toLowerCase().indexOf(query.toLowerCase());
if (beginIndex > -1 && node.impl_isTreeVisible()) {
ArrayList<Bounds> boundingBoxes = getMatchingBounds(query, text);
ArrayList<Rectangle> rectangles = new ArrayList<>();
for (Bounds boundingBox : boundingBoxes) {
HighLightRectangle rect = new HighLightRectangle(text);
rect.setCacheHint(CacheHint.SPEED);
rect.setCache(true);
rect.setMouseTransparent(true);
rect.setBlendMode(BlendMode.MULTIPLY);
rect.fillProperty().bind(paintProperty());
rect.setManaged(false);
rect.setX(boundingBox.getMinX());
rect.setY(boundingBox.getMinY());
rect.setWidth(boundingBox.getWidth());
rect.setHeight(boundingBox.getHeight());
rectangles.add(rect);
allRectangles.add(rect);
}
boxes.put(node, rectangles);
}
}
Platform.runLater(()-> getParentChildren(pane).addAll(allRectangles));
} }
|
public class class_name {
public synchronized void highlight(Parent pane, String query) {
if (this.parent != null && !boxes.isEmpty()) {
clear(); // depends on control dependency: [if], data = [none]
}
if(query == null || query.isEmpty()) return;
this.parent = pane;
Set<Node> nodes = getTextNodes(pane);
ArrayList<Rectangle> allRectangles = new ArrayList<>();
for (Node node : nodes) {
Text text = ((Text) node);
final int beginIndex = text.getText().toLowerCase().indexOf(query.toLowerCase());
if (beginIndex > -1 && node.impl_isTreeVisible()) {
ArrayList<Bounds> boundingBoxes = getMatchingBounds(query, text);
ArrayList<Rectangle> rectangles = new ArrayList<>();
for (Bounds boundingBox : boundingBoxes) {
HighLightRectangle rect = new HighLightRectangle(text);
rect.setCacheHint(CacheHint.SPEED); // depends on control dependency: [for], data = [none]
rect.setCache(true); // depends on control dependency: [for], data = [none]
rect.setMouseTransparent(true); // depends on control dependency: [for], data = [none]
rect.setBlendMode(BlendMode.MULTIPLY); // depends on control dependency: [for], data = [none]
rect.fillProperty().bind(paintProperty()); // depends on control dependency: [for], data = [none]
rect.setManaged(false); // depends on control dependency: [for], data = [none]
rect.setX(boundingBox.getMinX()); // depends on control dependency: [for], data = [boundingBox]
rect.setY(boundingBox.getMinY()); // depends on control dependency: [for], data = [boundingBox]
rect.setWidth(boundingBox.getWidth()); // depends on control dependency: [for], data = [boundingBox]
rect.setHeight(boundingBox.getHeight()); // depends on control dependency: [for], data = [boundingBox]
rectangles.add(rect); // depends on control dependency: [for], data = [none]
allRectangles.add(rect); // depends on control dependency: [for], data = [none]
}
boxes.put(node, rectangles); // depends on control dependency: [if], data = [none]
}
}
Platform.runLater(()-> getParentChildren(pane).addAll(allRectangles));
} }
|
public class class_name {
public static String escape(String string) {
StringBuilder sb = new StringBuilder(string.length());
for (final int cp : codePointIterator(string)) {
switch (cp) {
case '&':
sb.append("&");
break;
case '<':
sb.append("<");
break;
case '>':
sb.append(">");
break;
case '"':
sb.append(""");
break;
case '\'':
sb.append("'");
break;
default:
if (mustEscape(cp)) {
sb.append("&#x");
sb.append(Integer.toHexString(cp));
sb.append(';');
} else {
sb.appendCodePoint(cp);
}
}
}
return sb.toString();
} }
|
public class class_name {
public static String escape(String string) {
StringBuilder sb = new StringBuilder(string.length());
for (final int cp : codePointIterator(string)) {
switch (cp) {
case '&':
sb.append("&");
break;
case '<':
sb.append("<");
break;
case '>':
sb.append(">");
break;
case '"':
sb.append(""");
break;
case '\'':
sb.append("'");
break;
default:
if (mustEscape(cp)) {
sb.append("&#x"); // depends on control dependency: [if], data = [none]
sb.append(Integer.toHexString(cp)); // depends on control dependency: [if], data = [none]
sb.append(';'); // depends on control dependency: [if], data = [none]
} else {
sb.appendCodePoint(cp); // depends on control dependency: [if], data = [none]
}
}
}
return sb.toString();
} }
|
public class class_name {
protected void configureThresholdEvaluatorBuilder(final ThresholdsEvaluatorBuilder thrb, final ICommandLine cl) throws BadThresholdException {
if (cl.hasOption("th")) {
for (Object obj : cl.getOptionValues("th")) {
thrb.withThreshold(obj.toString());
}
}
} }
|
public class class_name {
protected void configureThresholdEvaluatorBuilder(final ThresholdsEvaluatorBuilder thrb, final ICommandLine cl) throws BadThresholdException {
if (cl.hasOption("th")) {
for (Object obj : cl.getOptionValues("th")) {
thrb.withThreshold(obj.toString()); // depends on control dependency: [for], data = [obj]
}
}
} }
|
public class class_name {
@SuppressWarnings("unchecked")
private void callCommand(final Wave wave) {
// Use the Wave UID to guarantee that a new fresh command is built and used !
final Command command = wave.contains(JRebirthWaves.REUSE_COMMAND) && wave.get(JRebirthWaves.REUSE_COMMAND)
? globalFacade().commandFacade().retrieve((Class<Command>) wave.componentClass())
: globalFacade().commandFacade().retrieve((Class<Command>) wave.componentClass(), wave.wUID());
if (command == null) {
LOGGER.error(COMMAND_NOT_FOUND_ERROR, wave.toString());
// When developer mode is activated an error will be thrown by logger
// Otherwise the wave will be managed by UnprocessedWaveHandler
this.unprocessedWaveHandler.manageUnprocessedWave(COMMAND_NOT_FOUND_MESSAGE.getText(), wave);
} else {
// Run the command into the predefined thread
command.run(wave);
}
} }
|
public class class_name {
@SuppressWarnings("unchecked")
private void callCommand(final Wave wave) {
// Use the Wave UID to guarantee that a new fresh command is built and used !
final Command command = wave.contains(JRebirthWaves.REUSE_COMMAND) && wave.get(JRebirthWaves.REUSE_COMMAND)
? globalFacade().commandFacade().retrieve((Class<Command>) wave.componentClass())
: globalFacade().commandFacade().retrieve((Class<Command>) wave.componentClass(), wave.wUID());
if (command == null) {
LOGGER.error(COMMAND_NOT_FOUND_ERROR, wave.toString()); // depends on control dependency: [if], data = [none]
// When developer mode is activated an error will be thrown by logger
// Otherwise the wave will be managed by UnprocessedWaveHandler
this.unprocessedWaveHandler.manageUnprocessedWave(COMMAND_NOT_FOUND_MESSAGE.getText(), wave); // depends on control dependency: [if], data = [none]
} else {
// Run the command into the predefined thread
command.run(wave); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private static Map<WriterKind, PrintWriter> initWriters(Context context) {
PrintWriter out = context.get(outKey);
PrintWriter err = context.get(errKey);
if (out == null && err == null) {
out = new PrintWriter(System.out, true);
err = new PrintWriter(System.err, true);
return initWriters(out, err);
} else if (out == null || err == null) {
PrintWriter pw = (out != null) ? out : err;
return initWriters(pw, pw);
} else {
return initWriters(out, err);
}
} }
|
public class class_name {
private static Map<WriterKind, PrintWriter> initWriters(Context context) {
PrintWriter out = context.get(outKey);
PrintWriter err = context.get(errKey);
if (out == null && err == null) {
out = new PrintWriter(System.out, true); // depends on control dependency: [if], data = [none]
err = new PrintWriter(System.err, true); // depends on control dependency: [if], data = [none]
return initWriters(out, err); // depends on control dependency: [if], data = [(out]
} else if (out == null || err == null) {
PrintWriter pw = (out != null) ? out : err;
return initWriters(pw, pw); // depends on control dependency: [if], data = [none]
} else {
return initWriters(out, err); // depends on control dependency: [if], data = [(out]
}
} }
|
public class class_name {
@SuppressWarnings("unchecked")
@Override public E get() {
if (getPreferences().contains(getKey())) {
return (E) enumValues[getPreferences().getInt(getKey(), 0)];
} else {
return getDefaultValue();
}
} }
|
public class class_name {
@SuppressWarnings("unchecked")
@Override public E get() {
if (getPreferences().contains(getKey())) {
return (E) enumValues[getPreferences().getInt(getKey(), 0)]; // depends on control dependency: [if], data = [none]
} else {
return getDefaultValue(); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static CmsObject convertCmsObject(Object input) {
CmsObject result;
if (input instanceof CmsObject) {
result = (CmsObject)input;
} else if (input instanceof ServletRequest) {
result = CmsFlexController.getCmsObject((ServletRequest)input);
} else if (input instanceof PageContext) {
result = CmsFlexController.getCmsObject(((PageContext)input).getRequest());
} else {
try {
// try to use the given name as user name
result = OpenCms.initCmsObject(String.valueOf(input));
// try to set the right site root
ServletRequest req = convertRequest(input);
if (req instanceof HttpServletRequest) {
result.getRequestContext().setSiteRoot(
OpenCms.getSiteManager().matchRequest((HttpServletRequest)req).getSiteRoot());
}
} catch (CmsException e) {
LOG.warn(e.getLocalizedMessage(), e);
result = null;
}
}
if (result == null) {
try {
result = OpenCms.initCmsObject(OpenCms.getDefaultUsers().getUserGuest());
// try to set the right site root
ServletRequest req = convertRequest(input);
if (req instanceof HttpServletRequest) {
result.getRequestContext().setSiteRoot(
OpenCms.getSiteManager().matchRequest((HttpServletRequest)req).getSiteRoot());
}
} catch (CmsException e1) {
// this should never fail since we can always create a "Guest" user
}
}
return result;
} }
|
public class class_name {
public static CmsObject convertCmsObject(Object input) {
CmsObject result;
if (input instanceof CmsObject) {
result = (CmsObject)input; // depends on control dependency: [if], data = [none]
} else if (input instanceof ServletRequest) {
result = CmsFlexController.getCmsObject((ServletRequest)input); // depends on control dependency: [if], data = [none]
} else if (input instanceof PageContext) {
result = CmsFlexController.getCmsObject(((PageContext)input).getRequest()); // depends on control dependency: [if], data = [none]
} else {
try {
// try to use the given name as user name
result = OpenCms.initCmsObject(String.valueOf(input)); // depends on control dependency: [try], data = [none]
// try to set the right site root
ServletRequest req = convertRequest(input);
if (req instanceof HttpServletRequest) {
result.getRequestContext().setSiteRoot(
OpenCms.getSiteManager().matchRequest((HttpServletRequest)req).getSiteRoot()); // depends on control dependency: [if], data = [none]
}
} catch (CmsException e) {
LOG.warn(e.getLocalizedMessage(), e);
result = null;
} // depends on control dependency: [catch], data = [none]
}
if (result == null) {
try {
result = OpenCms.initCmsObject(OpenCms.getDefaultUsers().getUserGuest()); // depends on control dependency: [try], data = [none]
// try to set the right site root
ServletRequest req = convertRequest(input);
if (req instanceof HttpServletRequest) {
result.getRequestContext().setSiteRoot(
OpenCms.getSiteManager().matchRequest((HttpServletRequest)req).getSiteRoot()); // depends on control dependency: [if], data = [none]
}
} catch (CmsException e1) {
// this should never fail since we can always create a "Guest" user
} // depends on control dependency: [catch], data = [none]
}
return result;
} }
|
public class class_name {
private static MessageDigest getMessageDigest(String algorithm) {
try {
return MessageDigest.getInstance(algorithm);
} catch (NoSuchAlgorithmException e) {
LOGGER.error(e.getMessage());
final String msg = String.format("Failed to obtain the %s message digest.", algorithm);
throw new IllegalStateException(msg, e);
}
} }
|
public class class_name {
private static MessageDigest getMessageDigest(String algorithm) {
try {
return MessageDigest.getInstance(algorithm); // depends on control dependency: [try], data = [none]
} catch (NoSuchAlgorithmException e) {
LOGGER.error(e.getMessage());
final String msg = String.format("Failed to obtain the %s message digest.", algorithm);
throw new IllegalStateException(msg, e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public static String getFirstComparableOrPrimitiveFromClass( Class<?> clz ) {
List<Field> fields = Reflection.getAllFields( clz );
for ( Field field : fields ) {
if ( ( field.getType().isPrimitive() || Typ.isComparable( field.getType() )
&& !Modifier.isStatic( field.getModifiers() )
&& field.getDeclaringClass() == clz )
) {
return field.getName();
}
}
return null;
} }
|
public class class_name {
public static String getFirstComparableOrPrimitiveFromClass( Class<?> clz ) {
List<Field> fields = Reflection.getAllFields( clz );
for ( Field field : fields ) {
if ( ( field.getType().isPrimitive() || Typ.isComparable( field.getType() )
&& !Modifier.isStatic( field.getModifiers() )
&& field.getDeclaringClass() == clz )
) {
return field.getName(); // depends on control dependency: [if], data = [none]
}
}
return null;
} }
|
public class class_name {
public static <T> T queryForObject(String sql, Class<T> clz, Object... args) {
T result = null;
List<T> list = queryForList(sql, clz, args);
if (list.size() > 0) {
result = list.get(0);
}
return result;
} }
|
public class class_name {
public static <T> T queryForObject(String sql, Class<T> clz, Object... args) {
T result = null;
List<T> list = queryForList(sql, clz, args);
if (list.size() > 0) {
result = list.get(0); // depends on control dependency: [if], data = [0)]
}
return result;
} }
|
public class class_name {
public void removeNodeMetaData(Object key) {
if (key==null) throw new GroovyBugError("Tried to remove meta data with null key "+this+".");
if (metaDataMap == null) {
return;
}
metaDataMap.remove(key);
} }
|
public class class_name {
public void removeNodeMetaData(Object key) {
if (key==null) throw new GroovyBugError("Tried to remove meta data with null key "+this+".");
if (metaDataMap == null) {
return; // depends on control dependency: [if], data = [none]
}
metaDataMap.remove(key);
} }
|
public class class_name {
@Override
public Map<String, String> getArgumentsAsMap() {
Map<String, String> variables = new VariableFromCsvFileReader(getFileName()).getDataAsMap(getVariablePrefix(), getSeparator(), getSkipLines());
//store in System Properties also
if (isStoreAsSystemProperty()) {
for (Map.Entry<String, String> element : variables.entrySet()) {
String variable = element.getKey();
if (System.getProperty(variable) == null) {
System.setProperty(variable, element.getValue());
}
}
}
return variables;
} }
|
public class class_name {
@Override
public Map<String, String> getArgumentsAsMap() {
Map<String, String> variables = new VariableFromCsvFileReader(getFileName()).getDataAsMap(getVariablePrefix(), getSeparator(), getSkipLines());
//store in System Properties also
if (isStoreAsSystemProperty()) {
for (Map.Entry<String, String> element : variables.entrySet()) {
String variable = element.getKey();
if (System.getProperty(variable) == null) {
System.setProperty(variable, element.getValue()); // depends on control dependency: [if], data = [none]
}
}
}
return variables;
} }
|
public class class_name {
public static <KeyType> int requiredBufferCapacity(
KeySerde<KeyType> keySerde,
AggregatorFactory[] aggregatorFactories
)
{
int recordSize = keySerde.keySize();
for (AggregatorFactory aggregatorFactory : aggregatorFactories) {
recordSize += aggregatorFactory.getMaxIntermediateSizeWithNulls();
}
return recordSize * 3;
} }
|
public class class_name {
public static <KeyType> int requiredBufferCapacity(
KeySerde<KeyType> keySerde,
AggregatorFactory[] aggregatorFactories
)
{
int recordSize = keySerde.keySize();
for (AggregatorFactory aggregatorFactory : aggregatorFactories) {
recordSize += aggregatorFactory.getMaxIntermediateSizeWithNulls(); // depends on control dependency: [for], data = [aggregatorFactory]
}
return recordSize * 3;
} }
|
public class class_name {
public void load(String soundFile)
{
if (mSoundFile != null)
{
unload();
}
mSoundFile = soundFile;
if (mAudioListener != null)
{
mAudioListener.getAudioEngine().preloadSoundFile(soundFile);
Log.d("SOUND", "loaded audio file %s", getSoundFile());
}
} }
|
public class class_name {
public void load(String soundFile)
{
if (mSoundFile != null)
{
unload(); // depends on control dependency: [if], data = [none]
}
mSoundFile = soundFile;
if (mAudioListener != null)
{
mAudioListener.getAudioEngine().preloadSoundFile(soundFile); // depends on control dependency: [if], data = [none]
Log.d("SOUND", "loaded audio file %s", getSoundFile()); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public Element collectionToElement() {
final Collection collection = this;
final Element element = new Element("collection", AtomService.ATOM_PROTOCOL);
element.setAttribute("href", collection.getHref());
final Element titleElem = new Element("title", AtomService.ATOM_FORMAT);
titleElem.setText(collection.getTitle());
if (collection.getTitleType() != null && !collection.getTitleType().equals("TEXT")) {
titleElem.setAttribute("type", collection.getTitleType(), AtomService.ATOM_FORMAT);
}
element.addContent(titleElem);
// Loop to create <app:categories> elements
for (final Object element2 : collection.getCategories()) {
final Categories cats = (Categories) element2;
element.addContent(cats.categoriesToElement());
}
for (final Object element2 : collection.getAccepts()) {
final String range = (String) element2;
final Element acceptElem = new Element("accept", AtomService.ATOM_PROTOCOL);
acceptElem.setText(range);
element.addContent(acceptElem);
}
return element;
} }
|
public class class_name {
public Element collectionToElement() {
final Collection collection = this;
final Element element = new Element("collection", AtomService.ATOM_PROTOCOL);
element.setAttribute("href", collection.getHref());
final Element titleElem = new Element("title", AtomService.ATOM_FORMAT);
titleElem.setText(collection.getTitle());
if (collection.getTitleType() != null && !collection.getTitleType().equals("TEXT")) {
titleElem.setAttribute("type", collection.getTitleType(), AtomService.ATOM_FORMAT); // depends on control dependency: [if], data = [none]
}
element.addContent(titleElem);
// Loop to create <app:categories> elements
for (final Object element2 : collection.getCategories()) {
final Categories cats = (Categories) element2;
element.addContent(cats.categoriesToElement()); // depends on control dependency: [for], data = [none]
}
for (final Object element2 : collection.getAccepts()) {
final String range = (String) element2;
final Element acceptElem = new Element("accept", AtomService.ATOM_PROTOCOL);
acceptElem.setText(range); // depends on control dependency: [for], data = [none]
element.addContent(acceptElem); // depends on control dependency: [for], data = [none]
}
return element;
} }
|
public class class_name {
public void forEachIndexed(int from, int step,
@NotNull IndexedIntConsumer action) {
int index = from;
while (iterator.hasNext()) {
action.accept(index, iterator.nextInt());
index += step;
}
} }
|
public class class_name {
public void forEachIndexed(int from, int step,
@NotNull IndexedIntConsumer action) {
int index = from;
while (iterator.hasNext()) {
action.accept(index, iterator.nextInt()); // depends on control dependency: [while], data = [none]
index += step; // depends on control dependency: [while], data = [none]
}
} }
|
public class class_name {
protected void setupMavenPaths() {
if (getAddCompileSourceRoot()) {
getProject().addCompileSourceRoot(getGenerateDirectory().getPath());
}
if (getAddTestCompileSourceRoot()) {
getProject().addTestCompileSourceRoot(getGenerateDirectory().getPath());
}
if (getEpisode() && getEpisodeFile() != null) {
final String episodeFilePath = getEpisodeFile().getAbsolutePath();
final String generatedDirectoryPath = getGenerateDirectory().getAbsolutePath();
if (episodeFilePath.startsWith(generatedDirectoryPath + File.separator)) {
final String path = episodeFilePath.substring(generatedDirectoryPath.length() + 1);
final Resource resource = new Resource();
resource.setDirectory(generatedDirectoryPath);
resource.addInclude(path);
if (getAddCompileSourceRoot()) {
getProject().addResource(resource);
}
if (getAddTestCompileSourceRoot()) {
getProject().addTestResource(resource);
}
}
}
} }
|
public class class_name {
protected void setupMavenPaths() {
if (getAddCompileSourceRoot()) {
getProject().addCompileSourceRoot(getGenerateDirectory().getPath());
// depends on control dependency: [if], data = [none]
}
if (getAddTestCompileSourceRoot()) {
getProject().addTestCompileSourceRoot(getGenerateDirectory().getPath());
// depends on control dependency: [if], data = [none]
}
if (getEpisode() && getEpisodeFile() != null) {
final String episodeFilePath = getEpisodeFile().getAbsolutePath();
final String generatedDirectoryPath = getGenerateDirectory().getAbsolutePath();
if (episodeFilePath.startsWith(generatedDirectoryPath + File.separator)) {
final String path = episodeFilePath.substring(generatedDirectoryPath.length() + 1);
final Resource resource = new Resource();
resource.setDirectory(generatedDirectoryPath);
// depends on control dependency: [if], data = [none]
resource.addInclude(path);
// depends on control dependency: [if], data = [none]
if (getAddCompileSourceRoot()) {
getProject().addResource(resource);
// depends on control dependency: [if], data = [none]
}
if (getAddTestCompileSourceRoot()) {
getProject().addTestResource(resource);
// depends on control dependency: [if], data = [none]
}
}
}
} }
|
public class class_name {
public java.util.List<String> getIamRoles() {
if (iamRoles == null) {
iamRoles = new com.amazonaws.internal.SdkInternalList<String>();
}
return iamRoles;
} }
|
public class class_name {
public java.util.List<String> getIamRoles() {
if (iamRoles == null) {
iamRoles = new com.amazonaws.internal.SdkInternalList<String>(); // depends on control dependency: [if], data = [none]
}
return iamRoles;
} }
|
public class class_name {
public AwsSecurityFindingFilters withMalwareState(StringFilter... malwareState) {
if (this.malwareState == null) {
setMalwareState(new java.util.ArrayList<StringFilter>(malwareState.length));
}
for (StringFilter ele : malwareState) {
this.malwareState.add(ele);
}
return this;
} }
|
public class class_name {
public AwsSecurityFindingFilters withMalwareState(StringFilter... malwareState) {
if (this.malwareState == null) {
setMalwareState(new java.util.ArrayList<StringFilter>(malwareState.length)); // depends on control dependency: [if], data = [none]
}
for (StringFilter ele : malwareState) {
this.malwareState.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} }
|
public class class_name {
private <X> void populateRelationMetaData(EntityType entityType, Class<X> clazz, EntityMetadata metadata)
{
Set<Attribute> attributes = entityType.getAttributes();
for (Attribute attribute : attributes)
{
if (attribute.isAssociation())
{
addRelationIntoMetadata(clazz, (Field) attribute.getJavaMember(), metadata);
}
}
} }
|
public class class_name {
private <X> void populateRelationMetaData(EntityType entityType, Class<X> clazz, EntityMetadata metadata)
{
Set<Attribute> attributes = entityType.getAttributes();
for (Attribute attribute : attributes)
{
if (attribute.isAssociation())
{
addRelationIntoMetadata(clazz, (Field) attribute.getJavaMember(), metadata); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public static Map<String, I_CmsFormField> createFields(Collection<CmsXmlContentProperty> propertyConfigurations) {
// using LinkedHashMap to preserve the order
Map<String, I_CmsFormField> result = new LinkedHashMap<String, I_CmsFormField>();
for (CmsXmlContentProperty propConfig : propertyConfigurations) {
CmsBasicFormField field = createField(propConfig);
result.put(propConfig.getName(), field);
}
return result;
} }
|
public class class_name {
public static Map<String, I_CmsFormField> createFields(Collection<CmsXmlContentProperty> propertyConfigurations) {
// using LinkedHashMap to preserve the order
Map<String, I_CmsFormField> result = new LinkedHashMap<String, I_CmsFormField>();
for (CmsXmlContentProperty propConfig : propertyConfigurations) {
CmsBasicFormField field = createField(propConfig);
result.put(propConfig.getName(), field); // depends on control dependency: [for], data = [propConfig]
}
return result;
} }
|
public class class_name {
@SuppressWarnings({ "PMD.CyclomaticComplexity", "PMD.NPathComplexity",
"PMD.CollapsibleIfStatements", "PMD.DataflowAnomalyAnalysis" })
public int matches(URI resource) {
if (protocol != null && !protocol.equals("*")) {
if (resource.getScheme() == null) {
return -1;
}
if (Arrays.stream(protocol.split(","))
.noneMatch(proto -> proto.equals(resource.getScheme()))) {
return -1;
}
}
if (host != null && !host.equals("*")) {
if (resource.getHost() == null
|| !resource.getHost().equals(host)) {
return -1;
}
}
if (port != null && !port.equals("*")) {
if (Integer.parseInt(port) != resource.getPort()) {
return -1;
}
}
String[] reqElements = PathSpliterator.stream(resource.getPath())
.skip(1).toArray(size -> new String[size]);
String[] reqElementsPlus = null; // Created lazily
for (int pathIdx = 0; pathIdx < pathPatternElements.length; pathIdx++) {
String[] pathPattern = pathPatternElements[pathIdx];
if (prefixSegs[pathIdx] == pathPattern.length - 1
&& lastIsEmpty(pathPattern)) {
// Special case, pattern ends with vertical bar
if (reqElementsPlus == null) {
reqElementsPlus = reqElements;
if (!lastIsEmpty(reqElementsPlus)) {
reqElementsPlus = Arrays.copyOf(
reqElementsPlus, reqElementsPlus.length + 1);
reqElementsPlus[reqElementsPlus.length - 1] = "";
}
}
if (matchPath(pathPattern, reqElementsPlus)) {
return prefixSegs[pathIdx];
}
} else {
if (matchPath(pathPattern, reqElements)) {
return prefixSegs[pathIdx];
}
}
}
return -1;
} }
|
public class class_name {
@SuppressWarnings({ "PMD.CyclomaticComplexity", "PMD.NPathComplexity",
"PMD.CollapsibleIfStatements", "PMD.DataflowAnomalyAnalysis" })
public int matches(URI resource) {
if (protocol != null && !protocol.equals("*")) {
if (resource.getScheme() == null) {
return -1; // depends on control dependency: [if], data = [none]
}
if (Arrays.stream(protocol.split(","))
.noneMatch(proto -> proto.equals(resource.getScheme()))) {
return -1; // depends on control dependency: [if], data = [none]
}
}
if (host != null && !host.equals("*")) {
if (resource.getHost() == null
|| !resource.getHost().equals(host)) {
return -1; // depends on control dependency: [if], data = [none]
}
}
if (port != null && !port.equals("*")) {
if (Integer.parseInt(port) != resource.getPort()) {
return -1; // depends on control dependency: [if], data = [none]
}
}
String[] reqElements = PathSpliterator.stream(resource.getPath())
.skip(1).toArray(size -> new String[size]);
String[] reqElementsPlus = null; // Created lazily
for (int pathIdx = 0; pathIdx < pathPatternElements.length; pathIdx++) {
String[] pathPattern = pathPatternElements[pathIdx];
if (prefixSegs[pathIdx] == pathPattern.length - 1
&& lastIsEmpty(pathPattern)) {
// Special case, pattern ends with vertical bar
if (reqElementsPlus == null) {
reqElementsPlus = reqElements; // depends on control dependency: [if], data = [none]
if (!lastIsEmpty(reqElementsPlus)) {
reqElementsPlus = Arrays.copyOf(
reqElementsPlus, reqElementsPlus.length + 1); // depends on control dependency: [if], data = [none]
reqElementsPlus[reqElementsPlus.length - 1] = ""; // depends on control dependency: [if], data = [none]
}
}
if (matchPath(pathPattern, reqElementsPlus)) {
return prefixSegs[pathIdx]; // depends on control dependency: [if], data = [none]
}
} else {
if (matchPath(pathPattern, reqElements)) {
return prefixSegs[pathIdx]; // depends on control dependency: [if], data = [none]
}
}
}
return -1;
} }
|
public class class_name {
public void marshall(DisableKeyRequest disableKeyRequest, ProtocolMarshaller protocolMarshaller) {
if (disableKeyRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(disableKeyRequest.getKeyId(), KEYID_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(DisableKeyRequest disableKeyRequest, ProtocolMarshaller protocolMarshaller) {
if (disableKeyRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(disableKeyRequest.getKeyId(), KEYID_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
@Override
public EClass getIfcStructuralAction() {
if (ifcStructuralActionEClass == null) {
ifcStructuralActionEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(628);
}
return ifcStructuralActionEClass;
} }
|
public class class_name {
@Override
public EClass getIfcStructuralAction() {
if (ifcStructuralActionEClass == null) {
ifcStructuralActionEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(628);
// depends on control dependency: [if], data = [none]
}
return ifcStructuralActionEClass;
} }
|
public class class_name {
@SuppressWarnings("unchecked")
private int unsafeCompare(Object k1, Object k2) {
Comparator<? super K> comparator = comparator();
if (comparator == null) {
return ((Comparable<Object>) k1).compareTo(k2);
} else {
return ((Comparator<Object>) comparator).compare(k1, k2);
}
} }
|
public class class_name {
@SuppressWarnings("unchecked")
private int unsafeCompare(Object k1, Object k2) {
Comparator<? super K> comparator = comparator();
if (comparator == null) {
return ((Comparable<Object>) k1).compareTo(k2); // depends on control dependency: [if], data = [none]
} else {
return ((Comparator<Object>) comparator).compare(k1, k2); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@Override
public UserGroupCallbackModel getUserGroupCallback() {
if (_userGroupCallback == null) {
_userGroupCallback = (UserGroupCallbackModel)getFirstChildModel(USER_GROUP_CALLBACK);
}
return _userGroupCallback;
} }
|
public class class_name {
@Override
public UserGroupCallbackModel getUserGroupCallback() {
if (_userGroupCallback == null) {
_userGroupCallback = (UserGroupCallbackModel)getFirstChildModel(USER_GROUP_CALLBACK); // depends on control dependency: [if], data = [none]
}
return _userGroupCallback;
} }
|
public class class_name {
protected void merge(int size, MatrixParadigm mat, double[] bestd, int[] besti, PointerHierarchyRepresentationBuilder builder, double mindist, int x, int y) {
// Avoid allocating memory, by reusing existing iterators:
final DBIDArrayIter ix = mat.ix.seek(x), iy = mat.iy.seek(y);
if(LOG.isDebuggingFine()) {
LOG.debugFine("Merging: " + DBIDUtil.toString(ix) + " -> " + DBIDUtil.toString(iy) + " " + mindist);
}
// Perform merge in data structure: x -> y
assert (y < x);
// Since y < x, prefer keeping y, dropping x.
builder.add(ix, linkage.restore(mindist, getDistanceFunction().isSquared()), iy);
// Update cluster size for y:
final int sizex = builder.getSize(ix), sizey = builder.getSize(iy);
builder.setSize(iy, sizex + sizey);
// Deactivate x in cache:
besti[x] = -1;
// Note: this changes iy.
updateMatrix(size, mat.matrix, iy, bestd, besti, builder, mindist, x, y, sizex, sizey);
if(besti[y] == x) {
findBest(size, mat.matrix, bestd, besti, y);
}
} }
|
public class class_name {
protected void merge(int size, MatrixParadigm mat, double[] bestd, int[] besti, PointerHierarchyRepresentationBuilder builder, double mindist, int x, int y) {
// Avoid allocating memory, by reusing existing iterators:
final DBIDArrayIter ix = mat.ix.seek(x), iy = mat.iy.seek(y);
if(LOG.isDebuggingFine()) {
LOG.debugFine("Merging: " + DBIDUtil.toString(ix) + " -> " + DBIDUtil.toString(iy) + " " + mindist); // depends on control dependency: [if], data = [none]
}
// Perform merge in data structure: x -> y
assert (y < x);
// Since y < x, prefer keeping y, dropping x.
builder.add(ix, linkage.restore(mindist, getDistanceFunction().isSquared()), iy);
// Update cluster size for y:
final int sizex = builder.getSize(ix), sizey = builder.getSize(iy);
builder.setSize(iy, sizex + sizey);
// Deactivate x in cache:
besti[x] = -1;
// Note: this changes iy.
updateMatrix(size, mat.matrix, iy, bestd, besti, builder, mindist, x, y, sizex, sizey);
if(besti[y] == x) {
findBest(size, mat.matrix, bestd, besti, y); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static void collectFrom(List<Selector> selectors, Collection<?> results) {
if (results.size() == 0) {
return;
}
Map<String, FieldAccess> fields = BeanUtils.getFieldsFromObject(results.iterator().next());
collectFrom(selectors, results, fields);
} }
|
public class class_name {
public static void collectFrom(List<Selector> selectors, Collection<?> results) {
if (results.size() == 0) {
return; // depends on control dependency: [if], data = [none]
}
Map<String, FieldAccess> fields = BeanUtils.getFieldsFromObject(results.iterator().next());
collectFrom(selectors, results, fields);
} }
|
public class class_name {
@Override
protected void prepareFileTypeAnalyzer(Engine engine) throws InitializationException {
if (engine.getMode() != Mode.EVIDENCE_COLLECTION) {
try {
final Settings settings = engine.getSettings();
final String[] tmp = settings.getArray(Settings.KEYS.ECOSYSTEM_SKIP_CPEANALYZER);
if (tmp != null) {
final List<String> skipEcosystems = Arrays.asList(tmp);
if (skipEcosystems.contains(DEPENDENCY_ECOSYSTEM)
&& !settings.getBoolean(Settings.KEYS.ANALYZER_NODE_AUDIT_ENABLED)) {
LOGGER.debug("NodePackageAnalyzer enabled without a corresponding vulnerability analyzer");
final String msg = "Invalid Configuration: enabling the Node Package Analyzer without "
+ "using the Node Audit Analyzer is not supported.";
throw new InitializationException(msg);
} else if (!skipEcosystems.contains(DEPENDENCY_ECOSYSTEM)) {
LOGGER.warn("Using the CPE Analyzer with Node.js can result in many false positives.");
}
}
} catch (InvalidSettingException ex) {
throw new InitializationException("Unable to read configuration settings", ex);
}
}
} }
|
public class class_name {
@Override
protected void prepareFileTypeAnalyzer(Engine engine) throws InitializationException {
if (engine.getMode() != Mode.EVIDENCE_COLLECTION) {
try {
final Settings settings = engine.getSettings();
final String[] tmp = settings.getArray(Settings.KEYS.ECOSYSTEM_SKIP_CPEANALYZER);
if (tmp != null) {
final List<String> skipEcosystems = Arrays.asList(tmp);
if (skipEcosystems.contains(DEPENDENCY_ECOSYSTEM)
&& !settings.getBoolean(Settings.KEYS.ANALYZER_NODE_AUDIT_ENABLED)) {
LOGGER.debug("NodePackageAnalyzer enabled without a corresponding vulnerability analyzer"); // depends on control dependency: [if], data = [none]
final String msg = "Invalid Configuration: enabling the Node Package Analyzer without "
+ "using the Node Audit Analyzer is not supported."; // depends on control dependency: [if], data = [none]
throw new InitializationException(msg);
} else if (!skipEcosystems.contains(DEPENDENCY_ECOSYSTEM)) {
LOGGER.warn("Using the CPE Analyzer with Node.js can result in many false positives."); // depends on control dependency: [if], data = [none]
}
}
} catch (InvalidSettingException ex) {
throw new InitializationException("Unable to read configuration settings", ex);
} // depends on control dependency: [catch], data = [none]
}
} }
|
public class class_name {
private ExecutorConfig getOrFindExecutorConfig(String name) {
ExecutorConfig cfg = executorConfigCache.get(name);
if (cfg != null) {
return cfg;
} else {
cfg = nodeEngine.getConfig().findExecutorConfig(name);
ExecutorConfig executorConfig = executorConfigCache.putIfAbsent(name, cfg);
return executorConfig == null ? cfg : executorConfig;
}
} }
|
public class class_name {
private ExecutorConfig getOrFindExecutorConfig(String name) {
ExecutorConfig cfg = executorConfigCache.get(name);
if (cfg != null) {
return cfg; // depends on control dependency: [if], data = [none]
} else {
cfg = nodeEngine.getConfig().findExecutorConfig(name); // depends on control dependency: [if], data = [none]
ExecutorConfig executorConfig = executorConfigCache.putIfAbsent(name, cfg);
return executorConfig == null ? cfg : executorConfig; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
protected List<EquPart> negatize(final List<EquPart> equParts)
{
int left = 0;
for (int right = 1; right < equParts.size(); right++)
{
left = right - 1;
if (equParts.get(left) instanceof OpSubtract)
if (left == 0)
equParts.set(left, new OpNegate(equParts.get(left)));
else
{
if (equParts.get(left - 1).negatize(equParts.get(right)))
equParts.set(left, new OpNegate(equParts.get(left)));
}
}
return equParts;
} }
|
public class class_name {
protected List<EquPart> negatize(final List<EquPart> equParts)
{
int left = 0;
for (int right = 1; right < equParts.size(); right++)
{
left = right - 1; // depends on control dependency: [for], data = [right]
if (equParts.get(left) instanceof OpSubtract)
if (left == 0)
equParts.set(left, new OpNegate(equParts.get(left)));
else
{
if (equParts.get(left - 1).negatize(equParts.get(right)))
equParts.set(left, new OpNegate(equParts.get(left)));
}
}
return equParts;
} }
|
public class class_name {
private Subre parsebranch(int stopper, int type, State left, State right, boolean partial) throws RegexException {
State lp; /* left end of current construct */
boolean seencontent = false; /* is there anything in this branch yet? */
Subre t;
lp = left;
t = new Subre('=', 0, left, right); /* op '=' is tentative */
while (!see('|') && !see(stopper) && !see(EOS)) {
if (seencontent) { /* implicit concat operator */
lp = nfa.newstate();
moveins(nfa, right, lp);
}
seencontent = true;
/* NB, recursion in parseqatom() may swallow rest of branch */
parseqatom(stopper, type, lp, right, t);
}
if (!seencontent) { /* empty branch */
if (!partial) {
note(Flags.REG_UUNSPEC);
}
nfa.emptyarc(left, right);
}
return t;
} }
|
public class class_name {
private Subre parsebranch(int stopper, int type, State left, State right, boolean partial) throws RegexException {
State lp; /* left end of current construct */
boolean seencontent = false; /* is there anything in this branch yet? */
Subre t;
lp = left;
t = new Subre('=', 0, left, right); /* op '=' is tentative */
while (!see('|') && !see(stopper) && !see(EOS)) {
if (seencontent) { /* implicit concat operator */
lp = nfa.newstate(); // depends on control dependency: [if], data = [none]
moveins(nfa, right, lp); // depends on control dependency: [if], data = [none]
}
seencontent = true;
/* NB, recursion in parseqatom() may swallow rest of branch */
parseqatom(stopper, type, lp, right, t);
}
if (!seencontent) { /* empty branch */
if (!partial) {
note(Flags.REG_UUNSPEC); // depends on control dependency: [if], data = [none]
}
nfa.emptyarc(left, right);
}
return t;
} }
|
public class class_name {
public EEnum getExtendedResourceLocalIdentifierResType() {
if (extendedResourceLocalIdentifierResTypeEEnum == null) {
extendedResourceLocalIdentifierResTypeEEnum = (EEnum)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(178);
}
return extendedResourceLocalIdentifierResTypeEEnum;
} }
|
public class class_name {
public EEnum getExtendedResourceLocalIdentifierResType() {
if (extendedResourceLocalIdentifierResTypeEEnum == null) {
extendedResourceLocalIdentifierResTypeEEnum = (EEnum)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(178); // depends on control dependency: [if], data = [none]
}
return extendedResourceLocalIdentifierResTypeEEnum;
} }
|
public class class_name {
public String fileToString(File f)
throws MelcoePDPException {
ByteArrayOutputStream out = new ByteArrayOutputStream();
byte[] bytes = new byte[1024];
try {
FileInputStream fis = new FileInputStream(f);
int count = fis.read(bytes);
while (count > -1) {
out.write(bytes, 0, count);
count = fis.read(bytes);
}
fis.close();
} catch (IOException e) {
throw new MelcoePDPException("Error reading file: "
+ f.getName(), e);
}
return out.toString();
} }
|
public class class_name {
public String fileToString(File f)
throws MelcoePDPException {
ByteArrayOutputStream out = new ByteArrayOutputStream();
byte[] bytes = new byte[1024];
try {
FileInputStream fis = new FileInputStream(f);
int count = fis.read(bytes);
while (count > -1) {
out.write(bytes, 0, count); // depends on control dependency: [while], data = [none]
count = fis.read(bytes); // depends on control dependency: [while], data = [none]
}
fis.close();
} catch (IOException e) {
throw new MelcoePDPException("Error reading file: "
+ f.getName(), e);
}
return out.toString();
} }
|
public class class_name {
synchronized public boolean load() {
if (null == this.settingLoader) {
settingLoader = new SettingLoader(this.groupedMap, this.charset, this.isUseVariable);
}
return settingLoader.load(new UrlResource(this.settingUrl));
} }
|
public class class_name {
synchronized public boolean load() {
if (null == this.settingLoader) {
settingLoader = new SettingLoader(this.groupedMap, this.charset, this.isUseVariable);
// depends on control dependency: [if], data = [none]
}
return settingLoader.load(new UrlResource(this.settingUrl));
} }
|
public class class_name {
public static String printThrowable(Throwable t) {
if (t == null) {
return "No Exception details";
}
StringBuilder s = new StringBuilder();
doPrintStackTrace(s, t, null, "", new HashSet<Throwable>());
return s.toString();
} }
|
public class class_name {
public static String printThrowable(Throwable t) {
if (t == null) {
return "No Exception details"; // depends on control dependency: [if], data = [none]
}
StringBuilder s = new StringBuilder();
doPrintStackTrace(s, t, null, "", new HashSet<Throwable>());
return s.toString();
} }
|
public class class_name {
protected StringDistance[] getInnerDistances()
{
StringDistance[] innerDistances = new StringDistance[ innerLearners.length ];
for (int j=0; j<innerLearners.length; j++) {
innerDistances[j] = innerLearners[j].getDistance();
}
return innerDistances;
} }
|
public class class_name {
protected StringDistance[] getInnerDistances()
{
StringDistance[] innerDistances = new StringDistance[ innerLearners.length ];
for (int j=0; j<innerLearners.length; j++) {
innerDistances[j] = innerLearners[j].getDistance(); // depends on control dependency: [for], data = [j]
}
return innerDistances;
} }
|
public class class_name {
public List<String> getGVParameterNames(Document document, String gvname, String version) {
ArrayList<String> ret = new ArrayList<>();
Element gvdef = document.getElementById(gvname + version);
NodeList gvcontent = gvdef.getChildNodes();
int len = gvcontent.getLength();
boolean first = true;
for (int i = 0; i < len; i++) {
Node contentref = gvcontent.item(i);
if (contentref.getNodeType() == Node.ELEMENT_NODE) {
// skip seghead
if (first) {
first = false;
} else {
addLowlevelProperties(document, ret, "", (Element) contentref);
}
}
}
return ret;
} }
|
public class class_name {
public List<String> getGVParameterNames(Document document, String gvname, String version) {
ArrayList<String> ret = new ArrayList<>();
Element gvdef = document.getElementById(gvname + version);
NodeList gvcontent = gvdef.getChildNodes();
int len = gvcontent.getLength();
boolean first = true;
for (int i = 0; i < len; i++) {
Node contentref = gvcontent.item(i);
if (contentref.getNodeType() == Node.ELEMENT_NODE) {
// skip seghead
if (first) {
first = false; // depends on control dependency: [if], data = [none]
} else {
addLowlevelProperties(document, ret, "", (Element) contentref); // depends on control dependency: [if], data = [none]
}
}
}
return ret;
} }
|
public class class_name {
private void advanceAllocatingFrom(CommitLogSegment old)
{
while (true)
{
CommitLogSegment next;
synchronized (this)
{
// do this in a critical section so we can atomically remove from availableSegments and add to allocatingFrom/activeSegments
// see https://issues.apache.org/jira/browse/CASSANDRA-6557?focusedCommentId=13874432&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-13874432
if (allocatingFrom != old)
return;
next = availableSegments.poll();
if (next != null)
{
allocatingFrom = next;
activeSegments.add(next);
}
}
if (next != null)
{
if (old != null)
{
// Now we can run the user defined command just after switching to the new commit log.
// (Do this here instead of in the recycle call so we can get a head start on the archive.)
CommitLog.instance.archiver.maybeArchive(old);
// ensure we don't continue to use the old file; not strictly necessary, but cleaner to enforce it
old.discardUnusedTail();
}
// request that the CL be synced out-of-band, as we've finished a segment
CommitLog.instance.requestExtraSync();
return;
}
// no more segments, so register to receive a signal when not empty
WaitQueue.Signal signal = hasAvailableSegments.register(CommitLog.instance.metrics.waitingOnSegmentAllocation.time());
// trigger the management thread; this must occur after registering
// the signal to ensure we are woken by any new segment creation
wakeManager();
// check if the queue has already been added to before waiting on the signal, to catch modifications
// that happened prior to registering the signal; *then* check to see if we've been beaten to making the change
if (!availableSegments.isEmpty() || allocatingFrom != old)
{
signal.cancel();
// if we've been beaten, just stop immediately
if (allocatingFrom != old)
return;
// otherwise try again, as there should be an available segment
continue;
}
// can only reach here if the queue hasn't been inserted into
// before we registered the signal, as we only remove items from the queue
// after updating allocatingFrom. Can safely block until we are signalled
// by the allocator that new segments have been published
signal.awaitUninterruptibly();
}
} }
|
public class class_name {
private void advanceAllocatingFrom(CommitLogSegment old)
{
while (true)
{
CommitLogSegment next;
synchronized (this) // depends on control dependency: [while], data = [none]
{
// do this in a critical section so we can atomically remove from availableSegments and add to allocatingFrom/activeSegments
// see https://issues.apache.org/jira/browse/CASSANDRA-6557?focusedCommentId=13874432&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-13874432
if (allocatingFrom != old)
return;
next = availableSegments.poll();
if (next != null)
{
allocatingFrom = next; // depends on control dependency: [if], data = [none]
activeSegments.add(next); // depends on control dependency: [if], data = [(next]
}
}
if (next != null)
{
if (old != null)
{
// Now we can run the user defined command just after switching to the new commit log.
// (Do this here instead of in the recycle call so we can get a head start on the archive.)
CommitLog.instance.archiver.maybeArchive(old); // depends on control dependency: [if], data = [(old]
// ensure we don't continue to use the old file; not strictly necessary, but cleaner to enforce it
old.discardUnusedTail(); // depends on control dependency: [if], data = [none]
}
// request that the CL be synced out-of-band, as we've finished a segment
CommitLog.instance.requestExtraSync(); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
// no more segments, so register to receive a signal when not empty
WaitQueue.Signal signal = hasAvailableSegments.register(CommitLog.instance.metrics.waitingOnSegmentAllocation.time());
// trigger the management thread; this must occur after registering
// the signal to ensure we are woken by any new segment creation
wakeManager(); // depends on control dependency: [while], data = [none]
// check if the queue has already been added to before waiting on the signal, to catch modifications
// that happened prior to registering the signal; *then* check to see if we've been beaten to making the change
if (!availableSegments.isEmpty() || allocatingFrom != old)
{
signal.cancel(); // depends on control dependency: [if], data = [none]
// if we've been beaten, just stop immediately
if (allocatingFrom != old)
return;
// otherwise try again, as there should be an available segment
continue;
}
// can only reach here if the queue hasn't been inserted into
// before we registered the signal, as we only remove items from the queue
// after updating allocatingFrom. Can safely block until we are signalled
// by the allocator that new segments have been published
signal.awaitUninterruptibly(); // depends on control dependency: [while], data = [none]
}
} }
|
public class class_name {
@Override
public final boolean containsValue(Object value) {
int mc = this.modCount;
@SuppressWarnings("unchecked")
V v = (V) value;
boolean found = false;
Segment<K, V> segment;
for (long segmentIndex = 0; segmentIndex >= 0;
segmentIndex = nextSegmentIndex(segmentIndex, segment)) {
if ((segment = segment(segmentIndex)).containsValue(this, v)) {
found = true;
break;
}
}
if (mc != modCount)
throw new ConcurrentModificationException();
return found;
} }
|
public class class_name {
@Override
public final boolean containsValue(Object value) {
int mc = this.modCount;
@SuppressWarnings("unchecked")
V v = (V) value;
boolean found = false;
Segment<K, V> segment;
for (long segmentIndex = 0; segmentIndex >= 0;
segmentIndex = nextSegmentIndex(segmentIndex, segment)) {
if ((segment = segment(segmentIndex)).containsValue(this, v)) {
found = true; // depends on control dependency: [if], data = [none]
break;
}
}
if (mc != modCount)
throw new ConcurrentModificationException();
return found;
} }
|
public class class_name {
static long getGenerationStampFromSeperateChecksumFile(String[] listdir, String blockName) {
for (int j = 0; j < listdir.length; j++) {
String path = listdir[j];
if (!path.startsWith(blockName)) {
continue;
}
String[] vals = StringUtils.split(path, '_');
if (vals.length != 3) { // blk, blkid, genstamp.meta
continue;
}
String[] str = StringUtils.split(vals[2], '.');
if (str.length != 2) {
continue;
}
return Long.parseLong(str[0]);
}
DataNode.LOG.warn("Block " + blockName +
" does not have a metafile!");
return Block.GRANDFATHER_GENERATION_STAMP;
} }
|
public class class_name {
static long getGenerationStampFromSeperateChecksumFile(String[] listdir, String blockName) {
for (int j = 0; j < listdir.length; j++) {
String path = listdir[j];
if (!path.startsWith(blockName)) {
continue;
}
String[] vals = StringUtils.split(path, '_');
if (vals.length != 3) { // blk, blkid, genstamp.meta
continue;
}
String[] str = StringUtils.split(vals[2], '.');
if (str.length != 2) {
continue;
}
return Long.parseLong(str[0]); // depends on control dependency: [for], data = [none]
}
DataNode.LOG.warn("Block " + blockName +
" does not have a metafile!");
return Block.GRANDFATHER_GENERATION_STAMP;
} }
|
public class class_name {
public static int search(byte[] byteArray, byte value) {
int start = 0;
int end = byteArray.length - 1;
int middle = 0;
while(start <= end) {
middle = (start + end) >> 1;
if(value == byteArray[middle]) {
return middle;
}
if(value < byteArray[middle]) {
end = middle - 1 ;
}
else {
start = middle + 1;
}
}
return -1;
} }
|
public class class_name {
public static int search(byte[] byteArray, byte value) {
int start = 0;
int end = byteArray.length - 1;
int middle = 0;
while(start <= end) {
middle = (start + end) >> 1; // depends on control dependency: [while], data = [(start]
if(value == byteArray[middle]) {
return middle; // depends on control dependency: [if], data = [none]
}
if(value < byteArray[middle]) {
end = middle - 1 ; // depends on control dependency: [if], data = [none]
}
else {
start = middle + 1; // depends on control dependency: [if], data = [none]
}
}
return -1;
} }
|
public class class_name {
public List<JAXBElement<Object>> get_GenericApplicationPropertyOfOuterFloorSurface() {
if (_GenericApplicationPropertyOfOuterFloorSurface == null) {
_GenericApplicationPropertyOfOuterFloorSurface = new ArrayList<JAXBElement<Object>>();
}
return this._GenericApplicationPropertyOfOuterFloorSurface;
} }
|
public class class_name {
public List<JAXBElement<Object>> get_GenericApplicationPropertyOfOuterFloorSurface() {
if (_GenericApplicationPropertyOfOuterFloorSurface == null) {
_GenericApplicationPropertyOfOuterFloorSurface = new ArrayList<JAXBElement<Object>>(); // depends on control dependency: [if], data = [none]
}
return this._GenericApplicationPropertyOfOuterFloorSurface;
} }
|
public class class_name {
private void startOpenSessionRequest(final Activity activity, final Fragment fragment) {
// State transition.
mLinkRequestState = STATE_OPEN_SESSION_REQUEST;
// Construct status callback.
Session.StatusCallback statusCallback = new Session.StatusCallback() {
@Override
public void call(Session session, SessionState state, Exception exception) {
if (mLinkRequestState == STATE_OPEN_SESSION_REQUEST && state.isOpened()) {
// Request publish permissions.
if (!startPublishPermissionsRequest(activity, fragment)) {
handleLinkError();
}
}
}
};
// Construct new session.
Session session = new Session(activity);
Session.setActiveSession(session);
// Construct read permissions to request for.
List<String> readPermissions = new LinkedList<String>();
readPermissions.add(PERMISSION_PUBLIC_PROFILE);
readPermissions.add(PERMISSION_USER_PHOTOS);
// Construct open request.
OpenRequest openRequest;
if (fragment == null) {
openRequest = new OpenRequest(activity);
} else {
openRequest = new OpenRequest(fragment);
}
// Allow SSO login only because the web login does not allow PERMISSION_USER_PHOTOS to be bundled with the
// first openForRead() call.
openRequest.setLoginBehavior(SessionLoginBehavior.SSO_ONLY);
openRequest.setPermissions(readPermissions);
openRequest.setDefaultAudience(SessionDefaultAudience.EVERYONE);
openRequest.setCallback(statusCallback);
// Execute open request.
session.openForRead(openRequest);
} }
|
public class class_name {
private void startOpenSessionRequest(final Activity activity, final Fragment fragment) {
// State transition.
mLinkRequestState = STATE_OPEN_SESSION_REQUEST;
// Construct status callback.
Session.StatusCallback statusCallback = new Session.StatusCallback() {
@Override
public void call(Session session, SessionState state, Exception exception) {
if (mLinkRequestState == STATE_OPEN_SESSION_REQUEST && state.isOpened()) {
// Request publish permissions.
if (!startPublishPermissionsRequest(activity, fragment)) {
handleLinkError(); // depends on control dependency: [if], data = [none]
}
}
}
};
// Construct new session.
Session session = new Session(activity);
Session.setActiveSession(session);
// Construct read permissions to request for.
List<String> readPermissions = new LinkedList<String>();
readPermissions.add(PERMISSION_PUBLIC_PROFILE);
readPermissions.add(PERMISSION_USER_PHOTOS);
// Construct open request.
OpenRequest openRequest;
if (fragment == null) {
openRequest = new OpenRequest(activity); // depends on control dependency: [if], data = [none]
} else {
openRequest = new OpenRequest(fragment); // depends on control dependency: [if], data = [(fragment]
}
// Allow SSO login only because the web login does not allow PERMISSION_USER_PHOTOS to be bundled with the
// first openForRead() call.
openRequest.setLoginBehavior(SessionLoginBehavior.SSO_ONLY);
openRequest.setPermissions(readPermissions);
openRequest.setDefaultAudience(SessionDefaultAudience.EVERYONE);
openRequest.setCallback(statusCallback);
// Execute open request.
session.openForRead(openRequest);
} }
|
public class class_name {
private static boolean generateAsResource(MetaDataObject metaDataObject) {
if (metaDataObject instanceof MetaResource) {
return true;
}
List<MetaDataObject> subTypes = metaDataObject.getSubTypes(true, false);
if (!subTypes.isEmpty()) {
for (MetaDataObject subType : subTypes) {
if (generateAsResource(subType)) {
return true;
}
}
return false;
}
return false;
} }
|
public class class_name {
private static boolean generateAsResource(MetaDataObject metaDataObject) {
if (metaDataObject instanceof MetaResource) {
return true; // depends on control dependency: [if], data = [none]
}
List<MetaDataObject> subTypes = metaDataObject.getSubTypes(true, false);
if (!subTypes.isEmpty()) {
for (MetaDataObject subType : subTypes) {
if (generateAsResource(subType)) {
return true; // depends on control dependency: [if], data = [none]
}
}
return false; // depends on control dependency: [if], data = [none]
}
return false;
} }
|
public class class_name {
@Override
public RemoteEvent<T> decode(final byte[] data) {
final WakeMessagePBuf pbuf;
try {
pbuf = WakeMessagePBuf.parseFrom(data);
return new RemoteEvent<T>(null, null, pbuf.getSeq(), decoder.decode(pbuf.getData().toByteArray()));
} catch (final InvalidProtocolBufferException e) {
throw new RemoteRuntimeException(e);
}
} }
|
public class class_name {
@Override
public RemoteEvent<T> decode(final byte[] data) {
final WakeMessagePBuf pbuf;
try {
pbuf = WakeMessagePBuf.parseFrom(data); // depends on control dependency: [try], data = [none]
return new RemoteEvent<T>(null, null, pbuf.getSeq(), decoder.decode(pbuf.getData().toByteArray())); // depends on control dependency: [try], data = [none]
} catch (final InvalidProtocolBufferException e) {
throw new RemoteRuntimeException(e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public static final String getStringAttribute(Path path, String attribute, LinkOption... options) throws IOException
{
attribute = attribute.startsWith("user:") ? attribute : "user:"+attribute;
byte[] attr = (byte[]) Files.getAttribute(path, attribute, options);
if (attr == null)
{
return null;
}
return new String(attr, UTF_8);
} }
|
public class class_name {
public static final String getStringAttribute(Path path, String attribute, LinkOption... options) throws IOException
{
attribute = attribute.startsWith("user:") ? attribute : "user:"+attribute;
byte[] attr = (byte[]) Files.getAttribute(path, attribute, options);
if (attr == null)
{
return null;
// depends on control dependency: [if], data = [none]
}
return new String(attr, UTF_8);
} }
|
public class class_name {
private void readObject(java.io.ObjectInputStream s)
throws java.io.IOException, ClassNotFoundException {
s.defaultReadObject();
// Read in elements until trailing null sentinel found
Node<E> h = null, t = null;
for (Object item; (item = s.readObject()) != null; ) {
@SuppressWarnings("unchecked")
Node<E> newNode = newNode((E) item);
if (h == null)
h = t = newNode;
else {
NEXT.set(t, newNode);
PREV.set(newNode, t);
t = newNode;
}
}
initHeadTail(h, t);
} }
|
public class class_name {
private void readObject(java.io.ObjectInputStream s)
throws java.io.IOException, ClassNotFoundException {
s.defaultReadObject();
// Read in elements until trailing null sentinel found
Node<E> h = null, t = null;
for (Object item; (item = s.readObject()) != null; ) {
@SuppressWarnings("unchecked")
Node<E> newNode = newNode((E) item);
if (h == null)
h = t = newNode;
else {
NEXT.set(t, newNode); // depends on control dependency: [if], data = [none]
PREV.set(newNode, t); // depends on control dependency: [if], data = [none]
t = newNode; // depends on control dependency: [if], data = [none]
}
}
initHeadTail(h, t);
} }
|
public class class_name {
public Map<KamEdge, List<Statement>>
evidence(Collection<KamEdge> edges) throws SQLException {
if (edges == null) throw new IllegalArgumentException("edges is null");
PreparedStatement ps;
ResultSet rs = null;
Map<KamEdge, List<Statement>> results = new HashMap<KamEdge, List<Statement>>();
try {
for (KamEdge edge : edges) {
if (edge == null) continue;
List<Statement> evidence = new ArrayList<Statement>();
ps = getPreparedStatement(SQL);
ps.setInt(1, edge.getId());
rs = ps.executeQuery();
int id = -1;
Statement stmt = null;
Map<String, String> citation = new HashMap<String, String>();
while (rs.next()) {
int next = rs.getInt(1);
if (next != id ) {
if (id != -1) {
// iterating a different statement,
// save previous
if (stmt != null) {
if (!citation.isEmpty()) {
stmt.getAnnotationGroup().setCitation(fromMap(citation));
}
evidence.add(stmt);
citation.clear();
}
}
id = next;
stmt = BELParser.parseStatement(rs.getString(2));
if (stmt == null) continue;
}
String name = rs.getString(3);
String value = rs.getString(4);
if (name != null)
directAnnotation(name, value, stmt, citation);
}
// add set of rows for last statement
if (stmt != null) {
if (!citation.isEmpty())
stmt.getAnnotationGroup().setCitation(fromMap(citation));
evidence.add(stmt);
citation.clear();
}
close(rs);
results.put(edge, evidence);
}
return results;
} finally {
close(rs);
}
} }
|
public class class_name {
public Map<KamEdge, List<Statement>>
evidence(Collection<KamEdge> edges) throws SQLException {
if (edges == null) throw new IllegalArgumentException("edges is null");
PreparedStatement ps;
ResultSet rs = null;
Map<KamEdge, List<Statement>> results = new HashMap<KamEdge, List<Statement>>();
try {
for (KamEdge edge : edges) {
if (edge == null) continue;
List<Statement> evidence = new ArrayList<Statement>();
ps = getPreparedStatement(SQL); // depends on control dependency: [for], data = [none]
ps.setInt(1, edge.getId()); // depends on control dependency: [for], data = [edge]
rs = ps.executeQuery(); // depends on control dependency: [for], data = [none]
int id = -1;
Statement stmt = null;
Map<String, String> citation = new HashMap<String, String>();
while (rs.next()) {
int next = rs.getInt(1);
if (next != id ) {
if (id != -1) {
// iterating a different statement,
// save previous
if (stmt != null) {
if (!citation.isEmpty()) {
stmt.getAnnotationGroup().setCitation(fromMap(citation)); // depends on control dependency: [if], data = [none]
}
evidence.add(stmt); // depends on control dependency: [if], data = [(stmt]
citation.clear(); // depends on control dependency: [if], data = [none]
}
}
id = next; // depends on control dependency: [if], data = [none]
stmt = BELParser.parseStatement(rs.getString(2)); // depends on control dependency: [if], data = [none]
if (stmt == null) continue;
}
String name = rs.getString(3);
String value = rs.getString(4);
if (name != null)
directAnnotation(name, value, stmt, citation);
}
// add set of rows for last statement
if (stmt != null) {
if (!citation.isEmpty())
stmt.getAnnotationGroup().setCitation(fromMap(citation));
evidence.add(stmt); // depends on control dependency: [if], data = [(stmt]
citation.clear(); // depends on control dependency: [if], data = [none]
}
close(rs); // depends on control dependency: [for], data = [none]
results.put(edge, evidence); // depends on control dependency: [for], data = [edge]
}
return results;
} finally {
close(rs);
}
} }
|
public class class_name {
private void handleSerialFactory()
{
String serialProvider = _externalContext.getInitParameter(StateUtils.SERIAL_FACTORY);
SerialFactory serialFactory = null;
if (serialProvider == null)
{
serialFactory = new DefaultSerialFactory();
}
else
{
try
{
serialFactory = (SerialFactory) ClassUtils.newInstance(serialProvider);
}
catch (ClassCastException e)
{
log.log(Level.SEVERE, "Make sure '" + serialProvider + "' implements the correct interface", e);
}
catch (Exception e)
{
log.log(Level.SEVERE, "", e);
}
finally
{
if (serialFactory == null)
{
serialFactory = new DefaultSerialFactory();
log.severe("Using default serialization provider");
}
}
}
log.info("Serialization provider : " + serialFactory.getClass());
_externalContext.getApplicationMap().put(StateUtils.SERIAL_FACTORY, serialFactory);
} }
|
public class class_name {
private void handleSerialFactory()
{
String serialProvider = _externalContext.getInitParameter(StateUtils.SERIAL_FACTORY);
SerialFactory serialFactory = null;
if (serialProvider == null)
{
serialFactory = new DefaultSerialFactory(); // depends on control dependency: [if], data = [none]
}
else
{
try
{
serialFactory = (SerialFactory) ClassUtils.newInstance(serialProvider); // depends on control dependency: [try], data = [none]
}
catch (ClassCastException e)
{
log.log(Level.SEVERE, "Make sure '" + serialProvider + "' implements the correct interface", e);
} // depends on control dependency: [catch], data = [none]
catch (Exception e)
{
log.log(Level.SEVERE, "", e);
} // depends on control dependency: [catch], data = [none]
finally
{
if (serialFactory == null)
{
serialFactory = new DefaultSerialFactory(); // depends on control dependency: [if], data = [none]
log.severe("Using default serialization provider"); // depends on control dependency: [if], data = [none]
}
}
}
log.info("Serialization provider : " + serialFactory.getClass());
_externalContext.getApplicationMap().put(StateUtils.SERIAL_FACTORY, serialFactory);
} }
|
public class class_name {
@Override
protected void initParser() throws MtasConfigException {
super.initParser();
if (config != null) {
// find namespaceURI
for (int i = 0; i < config.children.size(); i++) {
MtasConfiguration current = config.children.get(i);
if (current.name.equals("namespaceURI")) {
namespaceURI = current.attributes.get("value");
}
}
// loop again
for (int i = 0; i < config.children.size(); i++) {
MtasConfiguration current = config.children.get(i);
if (current.name.equals(XML_VARIABLES)) {
for (int j = 0; j < current.children.size(); j++) {
if (current.children.get(j).name.equals(XML_VARIABLE)) {
MtasConfiguration variable = current.children.get(j);
String nameVariable = variable.attributes.get(XML_VARIABLE_NAME);
String valueVariable = variable.attributes
.get(XML_VARIABLE_VALUE);
if ((nameVariable != null) && (valueVariable != null)) {
MtasParserVariable v = new MtasParserVariable(nameVariable,
valueVariable);
v.processConfig(variable);
QName qn = getQName(nameVariable);
if (variableTypes.containsKey(qn)) {
variableTypes.get(qn).addItem(v);
} else {
MtasParserType<MtasParserVariable> t = new MtasParserType<>(
nameVariable, valueVariable, false);
t.addItem(v);
variableTypes.put(qn, t);
}
}
}
}
} else if (current.name.equals(XML_REFERENCES)) {
for (int j = 0; j < current.children.size(); j++) {
if (current.children.get(j).name.equals(XML_REFERENCE)) {
MtasConfiguration reference = current.children.get(j);
String name = reference.attributes.get(XML_REFERENCE_NAME);
String ref = reference.attributes.get(XML_REFERENCE_REF);
if ((name != null) && (ref != null)) {
MtasParserType<MtasParserMapping<?>> t = new MtasParserType<>(
MAPPING_TYPE_REF, name, false, ref);
refTypes.put(getQName(t.getName()), t);
}
}
}
} else if (current.name.equals(XML_MAPPINGS)) {
for (int j = 0; j < current.children.size(); j++) {
if (current.children.get(j).name.equals(XML_MAPPING)) {
MtasConfiguration mapping = current.children.get(j);
String typeMapping = mapping.attributes.get(XML_MAPPING_TYPE);
String nameMapping = mapping.attributes.get(XML_MAPPING_NAME);
if ((typeMapping != null) && (nameMapping != null)) {
if (typeMapping.equals(MAPPING_TYPE_RELATION)) {
MtasXMLParserMappingRelation m = new MtasXMLParserMappingRelation();
m.processConfig(mapping);
QName qn = getQName(nameMapping);
if (relationTypes.containsKey(qn)) {
relationTypes.get(qn).addItem(m);
} else {
MtasParserType<MtasParserMapping<?>> t = new MtasParserType<>(
typeMapping, nameMapping, false);
t.addItem(m);
relationTypes.put(qn, t);
}
} else if (typeMapping
.equals(MAPPING_TYPE_RELATION_ANNOTATION)) {
MtasXMLParserMappingRelationAnnotation m = new MtasXMLParserMappingRelationAnnotation();
m.processConfig(mapping);
QName qn = getQName(nameMapping);
if (relationAnnotationTypes.containsKey(qn)) {
relationAnnotationTypes.get(qn).addItem(m);
} else {
MtasParserType<MtasParserMapping<?>> t = new MtasParserType<>(
typeMapping, nameMapping, false);
t.addItem(m);
relationAnnotationTypes.put(qn, t);
}
} else if (typeMapping.equals(MAPPING_TYPE_WORD)) {
MtasXMLParserMappingWord m = new MtasXMLParserMappingWord();
m.processConfig(mapping);
QName qn = getQName(nameMapping);
if (wordTypes.containsKey(qn)) {
wordTypes.get(qn).addItem(m);
} else {
MtasParserType<MtasParserMapping<?>> t = new MtasParserType<>(
typeMapping, nameMapping, false);
t.addItem(m);
wordTypes.put(qn, t);
}
} else if (typeMapping.equals(MAPPING_TYPE_WORD_ANNOTATION)) {
MtasXMLParserMappingWordAnnotation m = new MtasXMLParserMappingWordAnnotation();
m.processConfig(mapping);
QName qn = getQName(nameMapping);
if (wordAnnotationTypes.containsKey(qn)) {
wordAnnotationTypes.get(qn).addItem(m);
} else {
MtasParserType<MtasParserMapping<?>> t = new MtasParserType<>(
typeMapping, nameMapping, false);
t.addItem(m);
wordAnnotationTypes.put(qn, t);
}
} else if (typeMapping.equals(MAPPING_TYPE_GROUP)) {
MtasXMLParserMappingGroup m = new MtasXMLParserMappingGroup();
m.processConfig(mapping);
QName qn = getQName(nameMapping);
if (groupTypes.containsKey(qn)) {
groupTypes.get(qn).addItem(m);
} else {
MtasParserType<MtasParserMapping<?>> t = new MtasParserType<>(
typeMapping, nameMapping, false);
t.addItem(m);
groupTypes.put(qn, t);
}
} else if (typeMapping.equals(MAPPING_TYPE_GROUP_ANNOTATION)) {
MtasXMLParserMappingGroupAnnotation m = new MtasXMLParserMappingGroupAnnotation();
m.processConfig(mapping);
QName qn = getQName(nameMapping);
if (groupAnnotationTypes.containsKey(qn)) {
groupAnnotationTypes.get(qn).addItem(m);
} else {
MtasParserType<MtasParserMapping<?>> t = new MtasParserType<>(
typeMapping, nameMapping, false);
t.addItem(m);
groupAnnotationTypes.put(qn, t);
}
} else {
throw new MtasConfigException(
"unknown mapping type " + typeMapping);
}
}
}
}
}
}
}
} }
|
public class class_name {
@Override
protected void initParser() throws MtasConfigException {
super.initParser();
if (config != null) {
// find namespaceURI
for (int i = 0; i < config.children.size(); i++) {
MtasConfiguration current = config.children.get(i);
if (current.name.equals("namespaceURI")) {
namespaceURI = current.attributes.get("value"); // depends on control dependency: [if], data = [none]
}
}
// loop again
for (int i = 0; i < config.children.size(); i++) {
MtasConfiguration current = config.children.get(i);
if (current.name.equals(XML_VARIABLES)) {
for (int j = 0; j < current.children.size(); j++) {
if (current.children.get(j).name.equals(XML_VARIABLE)) {
MtasConfiguration variable = current.children.get(j);
String nameVariable = variable.attributes.get(XML_VARIABLE_NAME);
String valueVariable = variable.attributes
.get(XML_VARIABLE_VALUE);
if ((nameVariable != null) && (valueVariable != null)) {
MtasParserVariable v = new MtasParserVariable(nameVariable,
valueVariable);
v.processConfig(variable); // depends on control dependency: [if], data = [none]
QName qn = getQName(nameVariable);
if (variableTypes.containsKey(qn)) {
variableTypes.get(qn).addItem(v); // depends on control dependency: [if], data = [none]
} else {
MtasParserType<MtasParserVariable> t = new MtasParserType<>(
nameVariable, valueVariable, false);
t.addItem(v); // depends on control dependency: [if], data = [none]
variableTypes.put(qn, t); // depends on control dependency: [if], data = [none]
}
}
}
}
} else if (current.name.equals(XML_REFERENCES)) {
for (int j = 0; j < current.children.size(); j++) {
if (current.children.get(j).name.equals(XML_REFERENCE)) {
MtasConfiguration reference = current.children.get(j);
String name = reference.attributes.get(XML_REFERENCE_NAME);
String ref = reference.attributes.get(XML_REFERENCE_REF);
if ((name != null) && (ref != null)) {
MtasParserType<MtasParserMapping<?>> t = new MtasParserType<>(
MAPPING_TYPE_REF, name, false, ref); // depends on control dependency: [if], data = [none]
refTypes.put(getQName(t.getName()), t); // depends on control dependency: [if], data = [none]
}
}
}
} else if (current.name.equals(XML_MAPPINGS)) {
for (int j = 0; j < current.children.size(); j++) {
if (current.children.get(j).name.equals(XML_MAPPING)) {
MtasConfiguration mapping = current.children.get(j);
String typeMapping = mapping.attributes.get(XML_MAPPING_TYPE);
String nameMapping = mapping.attributes.get(XML_MAPPING_NAME);
if ((typeMapping != null) && (nameMapping != null)) {
if (typeMapping.equals(MAPPING_TYPE_RELATION)) {
MtasXMLParserMappingRelation m = new MtasXMLParserMappingRelation();
m.processConfig(mapping); // depends on control dependency: [if], data = [none]
QName qn = getQName(nameMapping);
if (relationTypes.containsKey(qn)) {
relationTypes.get(qn).addItem(m); // depends on control dependency: [if], data = [none]
} else {
MtasParserType<MtasParserMapping<?>> t = new MtasParserType<>(
typeMapping, nameMapping, false); // depends on control dependency: [if], data = [none]
t.addItem(m); // depends on control dependency: [if], data = [none]
relationTypes.put(qn, t); // depends on control dependency: [if], data = [none]
}
} else if (typeMapping
.equals(MAPPING_TYPE_RELATION_ANNOTATION)) {
MtasXMLParserMappingRelationAnnotation m = new MtasXMLParserMappingRelationAnnotation();
m.processConfig(mapping); // depends on control dependency: [if], data = [none]
QName qn = getQName(nameMapping);
if (relationAnnotationTypes.containsKey(qn)) {
relationAnnotationTypes.get(qn).addItem(m); // depends on control dependency: [if], data = [none]
} else {
MtasParserType<MtasParserMapping<?>> t = new MtasParserType<>(
typeMapping, nameMapping, false); // depends on control dependency: [if], data = [none]
t.addItem(m); // depends on control dependency: [if], data = [none]
relationAnnotationTypes.put(qn, t); // depends on control dependency: [if], data = [none]
}
} else if (typeMapping.equals(MAPPING_TYPE_WORD)) {
MtasXMLParserMappingWord m = new MtasXMLParserMappingWord();
m.processConfig(mapping); // depends on control dependency: [if], data = [none]
QName qn = getQName(nameMapping);
if (wordTypes.containsKey(qn)) {
wordTypes.get(qn).addItem(m); // depends on control dependency: [if], data = [none]
} else {
MtasParserType<MtasParserMapping<?>> t = new MtasParserType<>(
typeMapping, nameMapping, false); // depends on control dependency: [if], data = [none]
t.addItem(m); // depends on control dependency: [if], data = [none]
wordTypes.put(qn, t); // depends on control dependency: [if], data = [none]
}
} else if (typeMapping.equals(MAPPING_TYPE_WORD_ANNOTATION)) {
MtasXMLParserMappingWordAnnotation m = new MtasXMLParserMappingWordAnnotation();
m.processConfig(mapping); // depends on control dependency: [if], data = [none]
QName qn = getQName(nameMapping);
if (wordAnnotationTypes.containsKey(qn)) {
wordAnnotationTypes.get(qn).addItem(m); // depends on control dependency: [if], data = [none]
} else {
MtasParserType<MtasParserMapping<?>> t = new MtasParserType<>(
typeMapping, nameMapping, false); // depends on control dependency: [if], data = [none]
t.addItem(m); // depends on control dependency: [if], data = [none]
wordAnnotationTypes.put(qn, t); // depends on control dependency: [if], data = [none]
}
} else if (typeMapping.equals(MAPPING_TYPE_GROUP)) {
MtasXMLParserMappingGroup m = new MtasXMLParserMappingGroup();
m.processConfig(mapping); // depends on control dependency: [if], data = [none]
QName qn = getQName(nameMapping);
if (groupTypes.containsKey(qn)) {
groupTypes.get(qn).addItem(m); // depends on control dependency: [if], data = [none]
} else {
MtasParserType<MtasParserMapping<?>> t = new MtasParserType<>(
typeMapping, nameMapping, false); // depends on control dependency: [if], data = [none]
t.addItem(m); // depends on control dependency: [if], data = [none]
groupTypes.put(qn, t); // depends on control dependency: [if], data = [none]
}
} else if (typeMapping.equals(MAPPING_TYPE_GROUP_ANNOTATION)) {
MtasXMLParserMappingGroupAnnotation m = new MtasXMLParserMappingGroupAnnotation();
m.processConfig(mapping); // depends on control dependency: [if], data = [none]
QName qn = getQName(nameMapping);
if (groupAnnotationTypes.containsKey(qn)) {
groupAnnotationTypes.get(qn).addItem(m); // depends on control dependency: [if], data = [none]
} else {
MtasParserType<MtasParserMapping<?>> t = new MtasParserType<>(
typeMapping, nameMapping, false); // depends on control dependency: [if], data = [none]
t.addItem(m); // depends on control dependency: [if], data = [none]
groupAnnotationTypes.put(qn, t); // depends on control dependency: [if], data = [none]
}
} else {
throw new MtasConfigException(
"unknown mapping type " + typeMapping);
}
}
}
}
}
}
}
} }
|
public class class_name {
public void setLayer(VectorLayer layer) {
this.layer = layer;
Object value = layerSelect.getValue();
if (value == null || !value.equals(layer.getLabel())) {
layerSelect.setValue(layer.getLabel());
}
empty();
} }
|
public class class_name {
public void setLayer(VectorLayer layer) {
this.layer = layer;
Object value = layerSelect.getValue();
if (value == null || !value.equals(layer.getLabel())) {
layerSelect.setValue(layer.getLabel()); // depends on control dependency: [if], data = [none]
}
empty();
} }
|
public class class_name {
private String getBestPattern(String skeleton, DateTimeMatcher skipMatcher, int options) {
EnumSet<DTPGflags> flags = EnumSet.noneOf(DTPGflags.class);
// Replace hour metacharacters 'j', 'C', and 'J', set flags as necessary
StringBuilder skeletonCopy = new StringBuilder(skeleton);
boolean inQuoted = false;
for (int patPos = 0; patPos < skeleton.length(); patPos++) {
char patChr = skeleton.charAt(patPos);
if (patChr == '\'') {
inQuoted = !inQuoted;
} else if (!inQuoted) {
if (patChr == 'j') {
skeletonCopy.setCharAt(patPos, defaultHourFormatChar);
} else if (patChr == 'C') {
String preferred = allowedHourFormats[0];
skeletonCopy.setCharAt(patPos, preferred.charAt(0));
final DTPGflags alt = DTPGflags.getFlag(preferred);
if (alt != null) {
flags.add(alt);
}
} else if (patChr == 'J') {
// Get pattern for skeleton with H, then (in adjustFieldTypes)
// replace H or k with defaultHourFormatChar
skeletonCopy.setCharAt(patPos, 'H');
flags.add(DTPGflags.SKELETON_USES_CAP_J);
}
}
}
String datePattern, timePattern;
synchronized(this) {
current.set(skeletonCopy.toString(), fp, false);
PatternWithMatcher bestWithMatcher = getBestRaw(current, -1, _distanceInfo, skipMatcher);
if (_distanceInfo.missingFieldMask == 0 && _distanceInfo.extraFieldMask == 0) {
// we have a good item. Adjust the field types
return adjustFieldTypes(bestWithMatcher, current, flags, options);
}
int neededFields = current.getFieldMask();
// otherwise break up by date and time.
datePattern = getBestAppending(current, neededFields & DATE_MASK, _distanceInfo, skipMatcher, flags, options);
timePattern = getBestAppending(current, neededFields & TIME_MASK, _distanceInfo, skipMatcher, flags, options);
}
if (datePattern == null) return timePattern == null ? "" : timePattern;
if (timePattern == null) return datePattern;
return SimpleFormatterImpl.formatRawPattern(
getDateTimeFormat(), 2, 2, timePattern, datePattern);
} }
|
public class class_name {
private String getBestPattern(String skeleton, DateTimeMatcher skipMatcher, int options) {
EnumSet<DTPGflags> flags = EnumSet.noneOf(DTPGflags.class);
// Replace hour metacharacters 'j', 'C', and 'J', set flags as necessary
StringBuilder skeletonCopy = new StringBuilder(skeleton);
boolean inQuoted = false;
for (int patPos = 0; patPos < skeleton.length(); patPos++) {
char patChr = skeleton.charAt(patPos);
if (patChr == '\'') {
inQuoted = !inQuoted; // depends on control dependency: [if], data = [none]
} else if (!inQuoted) {
if (patChr == 'j') {
skeletonCopy.setCharAt(patPos, defaultHourFormatChar); // depends on control dependency: [if], data = [none]
} else if (patChr == 'C') {
String preferred = allowedHourFormats[0];
skeletonCopy.setCharAt(patPos, preferred.charAt(0)); // depends on control dependency: [if], data = [none]
final DTPGflags alt = DTPGflags.getFlag(preferred);
if (alt != null) {
flags.add(alt); // depends on control dependency: [if], data = [(alt]
}
} else if (patChr == 'J') {
// Get pattern for skeleton with H, then (in adjustFieldTypes)
// replace H or k with defaultHourFormatChar
skeletonCopy.setCharAt(patPos, 'H'); // depends on control dependency: [if], data = [none]
flags.add(DTPGflags.SKELETON_USES_CAP_J); // depends on control dependency: [if], data = [none]
}
}
}
String datePattern, timePattern;
synchronized(this) {
current.set(skeletonCopy.toString(), fp, false);
PatternWithMatcher bestWithMatcher = getBestRaw(current, -1, _distanceInfo, skipMatcher);
if (_distanceInfo.missingFieldMask == 0 && _distanceInfo.extraFieldMask == 0) {
// we have a good item. Adjust the field types
return adjustFieldTypes(bestWithMatcher, current, flags, options); // depends on control dependency: [if], data = [none]
}
int neededFields = current.getFieldMask();
// otherwise break up by date and time.
datePattern = getBestAppending(current, neededFields & DATE_MASK, _distanceInfo, skipMatcher, flags, options);
timePattern = getBestAppending(current, neededFields & TIME_MASK, _distanceInfo, skipMatcher, flags, options);
}
if (datePattern == null) return timePattern == null ? "" : timePattern;
if (timePattern == null) return datePattern;
return SimpleFormatterImpl.formatRawPattern(
getDateTimeFormat(), 2, 2, timePattern, datePattern);
} }
|
public class class_name {
@Override
public List<PathMapping> getPathMappings(JoinableResourceBundle bundle, String resourcePath,
ResourceReaderHandler rsReader) {
List<PathMapping> pathMappings = new ArrayList<>();
PathMapping pathMapping = null;
GeneratorMappingHelper helper = new GeneratorMappingHelper(resourcePath);
String path = resolver.getResourcePath(helper.getPath());
String[] names = path.split(RESOURCE_BUNDLE_SEPARATOR);
for (String resourceName : names) {
path = resourceName.replace(PACKAGE_SEPARATOR, JawrConstant.URL_SEPARATOR_CHAR);
path = control.toBundleName(path, new Locale("", "")) + PROPERTIES_FILE_SUFFIX;
URL rbURL = LocaleUtils.getResourceBundleURL(path, config.getContext());
if (rbURL != null) {
String strURL = rbURL.toString();
// returns the path mapping only if the MessageBundle are on a
// filesystem
if (strURL.startsWith(JawrConstant.FILE_URL_PREFIX)) {
String parentPath = "/WEB-INF/classes/" + PathNormalizer.getParentPath(path);
String resourceBundleName = FileNameUtils.getBaseName(path);
MessageBundleFileFilter filter = new MessageBundleFileFilter(resourceBundleName);
pathMapping = new PathMapping(bundle, parentPath, filter);
pathMappings.add(pathMapping);
}
}
}
return pathMappings;
} }
|
public class class_name {
@Override
public List<PathMapping> getPathMappings(JoinableResourceBundle bundle, String resourcePath,
ResourceReaderHandler rsReader) {
List<PathMapping> pathMappings = new ArrayList<>();
PathMapping pathMapping = null;
GeneratorMappingHelper helper = new GeneratorMappingHelper(resourcePath);
String path = resolver.getResourcePath(helper.getPath());
String[] names = path.split(RESOURCE_BUNDLE_SEPARATOR);
for (String resourceName : names) {
path = resourceName.replace(PACKAGE_SEPARATOR, JawrConstant.URL_SEPARATOR_CHAR); // depends on control dependency: [for], data = [resourceName]
path = control.toBundleName(path, new Locale("", "")) + PROPERTIES_FILE_SUFFIX; // depends on control dependency: [for], data = [none]
URL rbURL = LocaleUtils.getResourceBundleURL(path, config.getContext());
if (rbURL != null) {
String strURL = rbURL.toString();
// returns the path mapping only if the MessageBundle are on a
// filesystem
if (strURL.startsWith(JawrConstant.FILE_URL_PREFIX)) {
String parentPath = "/WEB-INF/classes/" + PathNormalizer.getParentPath(path);
String resourceBundleName = FileNameUtils.getBaseName(path);
MessageBundleFileFilter filter = new MessageBundleFileFilter(resourceBundleName);
pathMapping = new PathMapping(bundle, parentPath, filter); // depends on control dependency: [if], data = [none]
pathMappings.add(pathMapping); // depends on control dependency: [if], data = [none]
}
}
}
return pathMappings;
} }
|
public class class_name {
static boolean registerMBean(Object mbean, String name) {
try {
MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
synchronized (mbs) {
ObjectName objName = new ObjectName(name);
if (mbs.isRegistered(objName)) {
mbs.unregisterMBean(objName);
}
mbs.registerMBean(mbean, objName);
}
return true;
} catch (Exception e) {
e.printStackTrace();
}
return false;
} }
|
public class class_name {
static boolean registerMBean(Object mbean, String name) {
try {
MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
synchronized (mbs) { // depends on control dependency: [try], data = [none]
ObjectName objName = new ObjectName(name);
if (mbs.isRegistered(objName)) {
mbs.unregisterMBean(objName); // depends on control dependency: [if], data = [none]
}
mbs.registerMBean(mbean, objName);
}
return true; // depends on control dependency: [try], data = [none]
} catch (Exception e) {
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
return false;
} }
|
public class class_name {
private static TermvectorNumberBasic computeTermvectorNumberBasic(
List<Integer> docSet, int termDocId, TermsEnum termsEnum, LeafReader r,
LeafReaderContext lrc, PostingsEnum postingsEnum) throws IOException {
TermvectorNumberBasic result = new TermvectorNumberBasic();
boolean hasDeletedDocuments = (r.getLiveDocs() != null);
if ((docSet.size() == r.numDocs()) && !hasDeletedDocuments) {
try {
return computeTermvectorNumberBasic(termsEnum, r);
} catch (IOException e) {
log.debug("problem", e);
// problem
}
}
result.docNumber = 0;
result.valueSum[0] = 0;
int localTermDocId = termDocId;
Iterator<Integer> docIterator = docSet.iterator();
postingsEnum = termsEnum.postings(postingsEnum, PostingsEnum.FREQS);
int docId;
while (docIterator.hasNext()) {
docId = docIterator.next() - lrc.docBase;
if (docId >= localTermDocId && ((docId == localTermDocId)
|| ((localTermDocId = postingsEnum.advance(docId)) == docId))) {
result.docNumber++;
result.valueSum[0] += postingsEnum.freq();
}
if (localTermDocId == DocIdSetIterator.NO_MORE_DOCS) {
break;
}
}
return result;
} }
|
public class class_name {
private static TermvectorNumberBasic computeTermvectorNumberBasic(
List<Integer> docSet, int termDocId, TermsEnum termsEnum, LeafReader r,
LeafReaderContext lrc, PostingsEnum postingsEnum) throws IOException {
TermvectorNumberBasic result = new TermvectorNumberBasic();
boolean hasDeletedDocuments = (r.getLiveDocs() != null);
if ((docSet.size() == r.numDocs()) && !hasDeletedDocuments) {
try {
return computeTermvectorNumberBasic(termsEnum, r); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
log.debug("problem", e);
// problem
} // depends on control dependency: [catch], data = [none]
}
result.docNumber = 0;
result.valueSum[0] = 0;
int localTermDocId = termDocId;
Iterator<Integer> docIterator = docSet.iterator();
postingsEnum = termsEnum.postings(postingsEnum, PostingsEnum.FREQS);
int docId;
while (docIterator.hasNext()) {
docId = docIterator.next() - lrc.docBase;
if (docId >= localTermDocId && ((docId == localTermDocId)
|| ((localTermDocId = postingsEnum.advance(docId)) == docId))) {
result.docNumber++;
result.valueSum[0] += postingsEnum.freq();
}
if (localTermDocId == DocIdSetIterator.NO_MORE_DOCS) {
break;
}
}
return result;
} }
|
public class class_name {
public Observable<ServiceResponse<MatchResponse>> matchFileInputWithServiceResponseAsync(byte[] imageStream, String listId, Boolean cacheImage) {
if (this.client.baseUrl() == null) {
throw new IllegalArgumentException("Parameter this.client.baseUrl() is required and cannot be null.");
}
if (imageStream == null) {
throw new IllegalArgumentException("Parameter imageStream is required and cannot be null.");
}
String parameterizedHost = Joiner.on(", ").join("{baseUrl}", this.client.baseUrl());
RequestBody imageStreamConverted = RequestBody.create(MediaType.parse("image/gif"), imageStream);
return service.matchFileInput(listId, cacheImage, imageStreamConverted, this.client.acceptLanguage(), parameterizedHost, this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<MatchResponse>>>() {
@Override
public Observable<ServiceResponse<MatchResponse>> call(Response<ResponseBody> response) {
try {
ServiceResponse<MatchResponse> clientResponse = matchFileInputDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
} }
|
public class class_name {
public Observable<ServiceResponse<MatchResponse>> matchFileInputWithServiceResponseAsync(byte[] imageStream, String listId, Boolean cacheImage) {
if (this.client.baseUrl() == null) {
throw new IllegalArgumentException("Parameter this.client.baseUrl() is required and cannot be null.");
}
if (imageStream == null) {
throw new IllegalArgumentException("Parameter imageStream is required and cannot be null.");
}
String parameterizedHost = Joiner.on(", ").join("{baseUrl}", this.client.baseUrl());
RequestBody imageStreamConverted = RequestBody.create(MediaType.parse("image/gif"), imageStream);
return service.matchFileInput(listId, cacheImage, imageStreamConverted, this.client.acceptLanguage(), parameterizedHost, this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<MatchResponse>>>() {
@Override
public Observable<ServiceResponse<MatchResponse>> call(Response<ResponseBody> response) {
try {
ServiceResponse<MatchResponse> clientResponse = matchFileInputDelegate(response);
return Observable.just(clientResponse); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
return Observable.error(t);
} // depends on control dependency: [catch], data = [none]
}
});
} }
|
public class class_name {
public static Map<IssueCategoryModel, List<ProblemSummary>> getProblemSummaries(GraphContext graphContext, Set<ProjectModel> projectModels, Set<String> includeTags,
Set<String> excludeTags,
boolean strictComparison,
boolean strictExclude)
{
// The key is the severity as a String
Map<IssueCategoryModel, List<ProblemSummary>> results = new TreeMap<>(new IssueCategoryModel.IssueSummaryPriorityComparator());
Map<RuleSummaryKey, ProblemSummary> ruleToSummary = new HashMap<>();
InlineHintService hintService = new InlineHintService(graphContext);
final Iterable<InlineHintModel> hints = projectModels == null ? hintService.findAll() : hintService.getHintsForProjects(new ArrayList<>(projectModels));
for (InlineHintModel hint : hints)
{
if (hint.getIssueDisplayMode() == IssueDisplayMode.DETAIL_ONLY)
continue;
Set<String> tags = hint.getTags();
boolean hasTagMatch;
if (strictComparison)
{
hasTagMatch = TagUtil.strictCheckMatchingTags(tags, includeTags, excludeTags);
}
else
{
hasTagMatch = TagUtil.checkMatchingTags(tags, includeTags, excludeTags, strictExclude);
}
if (!hasTagMatch)
{
continue;
}
RuleSummaryKey key = new RuleSummaryKey(hint.getEffort(), hint.getRuleID(), hint.getTitle());
ProblemSummary summary = ruleToSummary.get(key);
if (summary == null)
{
summary = new ProblemSummary(UUID.randomUUID().toString(), hint.getIssueCategory(), hint.getRuleID(), hint.getTitle(), 1, hint.getEffort());
for (LinkModel link : hint.getLinks())
{
summary.addLink(link.getDescription(), link.getLink());
}
ruleToSummary.put(key, summary);
addToResults(results, summary);
}
else
{
summary.setNumberFound(summary.getNumberFound() + 1);
}
summary.addFile(hint.getHint(), hint.getFile());
}
ClassificationService classificationService = new ClassificationService(graphContext);
for (ClassificationModel classification : classificationService.findAll())
{
if (classification.getIssueDisplayMode() == IssueDisplayMode.DETAIL_ONLY)
continue;
Set<String> tags = classification.getTags();
if (!TagUtil.checkMatchingTags(tags, includeTags, excludeTags, false))
continue;
List<FileModel> newFileModels = new ArrayList<>();
for (FileModel file : classification.getFileModels())
{
if (projectModels != null)
{
// make sure this one is in the project
if (!projectModels.contains(file.getProjectModel()))
continue;
}
newFileModels.add(file);
}
if (newFileModels.isEmpty())
continue;
RuleSummaryKey key = new RuleSummaryKey(classification.getEffort(), classification.getRuleID(), classification.getClassification());
ProblemSummary summary = ruleToSummary.get(key);
if (summary == null)
{
summary = new ProblemSummary(UUID.randomUUID().toString(), classification.getIssueCategory(), classification.getRuleID(),
classification.getClassification(),
0, classification.getEffort());
for (LinkModel link : classification.getLinks())
{
summary.addLink(link.getDescription(), link.getLink());
}
ruleToSummary.put(key, summary);
addToResults(results, summary);
}
for (FileModel file : newFileModels)
summary.addFile(classification.getDescription(), file);
summary.setNumberFound(summary.getNumberFound() + newFileModels.size());
}
return results;
} }
|
public class class_name {
public static Map<IssueCategoryModel, List<ProblemSummary>> getProblemSummaries(GraphContext graphContext, Set<ProjectModel> projectModels, Set<String> includeTags,
Set<String> excludeTags,
boolean strictComparison,
boolean strictExclude)
{
// The key is the severity as a String
Map<IssueCategoryModel, List<ProblemSummary>> results = new TreeMap<>(new IssueCategoryModel.IssueSummaryPriorityComparator());
Map<RuleSummaryKey, ProblemSummary> ruleToSummary = new HashMap<>();
InlineHintService hintService = new InlineHintService(graphContext);
final Iterable<InlineHintModel> hints = projectModels == null ? hintService.findAll() : hintService.getHintsForProjects(new ArrayList<>(projectModels));
for (InlineHintModel hint : hints)
{
if (hint.getIssueDisplayMode() == IssueDisplayMode.DETAIL_ONLY)
continue;
Set<String> tags = hint.getTags();
boolean hasTagMatch;
if (strictComparison)
{
hasTagMatch = TagUtil.strictCheckMatchingTags(tags, includeTags, excludeTags); // depends on control dependency: [if], data = [none]
}
else
{
hasTagMatch = TagUtil.checkMatchingTags(tags, includeTags, excludeTags, strictExclude); // depends on control dependency: [if], data = [none]
}
if (!hasTagMatch)
{
continue;
}
RuleSummaryKey key = new RuleSummaryKey(hint.getEffort(), hint.getRuleID(), hint.getTitle());
ProblemSummary summary = ruleToSummary.get(key);
if (summary == null)
{
summary = new ProblemSummary(UUID.randomUUID().toString(), hint.getIssueCategory(), hint.getRuleID(), hint.getTitle(), 1, hint.getEffort()); // depends on control dependency: [if], data = [none]
for (LinkModel link : hint.getLinks())
{
summary.addLink(link.getDescription(), link.getLink()); // depends on control dependency: [for], data = [link]
}
ruleToSummary.put(key, summary); // depends on control dependency: [if], data = [none]
addToResults(results, summary); // depends on control dependency: [if], data = [none]
}
else
{
summary.setNumberFound(summary.getNumberFound() + 1); // depends on control dependency: [if], data = [(summary]
}
summary.addFile(hint.getHint(), hint.getFile()); // depends on control dependency: [for], data = [hint]
}
ClassificationService classificationService = new ClassificationService(graphContext);
for (ClassificationModel classification : classificationService.findAll())
{
if (classification.getIssueDisplayMode() == IssueDisplayMode.DETAIL_ONLY)
continue;
Set<String> tags = classification.getTags();
if (!TagUtil.checkMatchingTags(tags, includeTags, excludeTags, false))
continue;
List<FileModel> newFileModels = new ArrayList<>();
for (FileModel file : classification.getFileModels())
{
if (projectModels != null)
{
// make sure this one is in the project
if (!projectModels.contains(file.getProjectModel()))
continue;
}
newFileModels.add(file); // depends on control dependency: [for], data = [file]
}
if (newFileModels.isEmpty())
continue;
RuleSummaryKey key = new RuleSummaryKey(classification.getEffort(), classification.getRuleID(), classification.getClassification());
ProblemSummary summary = ruleToSummary.get(key);
if (summary == null)
{
summary = new ProblemSummary(UUID.randomUUID().toString(), classification.getIssueCategory(), classification.getRuleID(),
classification.getClassification(),
0, classification.getEffort()); // depends on control dependency: [if], data = [none]
for (LinkModel link : classification.getLinks())
{
summary.addLink(link.getDescription(), link.getLink()); // depends on control dependency: [for], data = [link]
}
ruleToSummary.put(key, summary); // depends on control dependency: [if], data = [none]
addToResults(results, summary); // depends on control dependency: [if], data = [none]
}
for (FileModel file : newFileModels)
summary.addFile(classification.getDescription(), file);
summary.setNumberFound(summary.getNumberFound() + newFileModels.size()); // depends on control dependency: [for], data = [none]
}
return results;
} }
|
public class class_name {
boolean isUsingSecurityDefaults() {
Jenkins j = Jenkins.get();
if (j.getSecurityRealm() instanceof HudsonPrivateSecurityRealm) {
HudsonPrivateSecurityRealm securityRealm = (HudsonPrivateSecurityRealm)j.getSecurityRealm();
try {
if(securityRealm.getAllUsers().size() == 1) {
HudsonPrivateSecurityRealm.Details details = securityRealm.loadUserByUsername(SetupWizard.initialSetupAdminUserName);
FilePath iapf = getInitialAdminPasswordFile();
if (iapf.exists()) {
if (details.isPasswordCorrect(iapf.readToString().trim())) {
return true;
}
}
}
} catch(UsernameNotFoundException | IOException | InterruptedException e) {
return false; // Not initial security setup if no transitional admin user / password found
}
}
return false;
} }
|
public class class_name {
boolean isUsingSecurityDefaults() {
Jenkins j = Jenkins.get();
if (j.getSecurityRealm() instanceof HudsonPrivateSecurityRealm) {
HudsonPrivateSecurityRealm securityRealm = (HudsonPrivateSecurityRealm)j.getSecurityRealm();
try {
if(securityRealm.getAllUsers().size() == 1) {
HudsonPrivateSecurityRealm.Details details = securityRealm.loadUserByUsername(SetupWizard.initialSetupAdminUserName);
FilePath iapf = getInitialAdminPasswordFile();
if (iapf.exists()) {
if (details.isPasswordCorrect(iapf.readToString().trim())) {
return true; // depends on control dependency: [if], data = [none]
}
}
}
} catch(UsernameNotFoundException | IOException | InterruptedException e) {
return false; // Not initial security setup if no transitional admin user / password found
} // depends on control dependency: [catch], data = [none]
}
return false;
} }
|
public class class_name {
private void writeExternalEntry0(ReplicableEntry entry, Bytes destination) {
destination.writeByte(ENTRY_HUNK);
destination.writeStopBit(entry.originTimestamp());
if (entry.originIdentifier() == 0)
throw new IllegalStateException("Identifier can't be 0");
destination.writeByte(entry.originIdentifier());
Data key;
boolean isDeleted;
if (entry instanceof MapEntry) {
isDeleted = false;
key = ((MapEntry) entry).key();
} else {
isDeleted = true;
key = ((MapAbsentEntry) entry).absentKey();
}
destination.writeBoolean(isDeleted);
keySizeMarshaller.writeSize(destination, key.size());
key.writeTo(destination, destination.writePosition());
destination.writeSkip(key.size());
boolean debugEnabled = LOG.isDebugEnabled();
String message = null;
if (debugEnabled) {
if (isDeleted) {
LOG.debug("WRITING ENTRY TO DEST - into local-id={}, remove(key={})",
identifier(), key);
} else {
message = String.format(
"WRITING ENTRY TO DEST - into local-id=%d, put(key=%s,",
identifier(), key);
}
}
if (isDeleted)
return;
Data value = ((MapEntry) entry).value();
valueSizeMarshaller.writeSize(destination, value.size());
value.writeTo(destination, destination.writePosition());
destination.writeSkip(value.size());
if (debugEnabled) {
LOG.debug(message + "value=" + value + ")");
}
} }
|
public class class_name {
private void writeExternalEntry0(ReplicableEntry entry, Bytes destination) {
destination.writeByte(ENTRY_HUNK);
destination.writeStopBit(entry.originTimestamp());
if (entry.originIdentifier() == 0)
throw new IllegalStateException("Identifier can't be 0");
destination.writeByte(entry.originIdentifier());
Data key;
boolean isDeleted;
if (entry instanceof MapEntry) {
isDeleted = false; // depends on control dependency: [if], data = [none]
key = ((MapEntry) entry).key(); // depends on control dependency: [if], data = [none]
} else {
isDeleted = true; // depends on control dependency: [if], data = [none]
key = ((MapAbsentEntry) entry).absentKey(); // depends on control dependency: [if], data = [none]
}
destination.writeBoolean(isDeleted);
keySizeMarshaller.writeSize(destination, key.size());
key.writeTo(destination, destination.writePosition());
destination.writeSkip(key.size());
boolean debugEnabled = LOG.isDebugEnabled();
String message = null;
if (debugEnabled) {
if (isDeleted) {
LOG.debug("WRITING ENTRY TO DEST - into local-id={}, remove(key={})",
identifier(), key); // depends on control dependency: [if], data = [none]
} else {
message = String.format(
"WRITING ENTRY TO DEST - into local-id=%d, put(key=%s,",
identifier(), key); // depends on control dependency: [if], data = [none]
}
}
if (isDeleted)
return;
Data value = ((MapEntry) entry).value();
valueSizeMarshaller.writeSize(destination, value.size());
value.writeTo(destination, destination.writePosition());
destination.writeSkip(value.size());
if (debugEnabled) {
LOG.debug(message + "value=" + value + ")"); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@Override
protected void deregister(ServiceInstance instance) {
if (instance.getInstanceId().isPresent()) {
DeregisterInstanceRequest deregisterInstanceRequest = new DeregisterInstanceRequest().withServiceId(route53AutoRegistrationConfiguration.getAwsServiceId())
.withInstanceId(instance.getInstanceId().get());
getDiscoveryClient().deregisterInstance(deregisterInstanceRequest);
}
} }
|
public class class_name {
@Override
protected void deregister(ServiceInstance instance) {
if (instance.getInstanceId().isPresent()) {
DeregisterInstanceRequest deregisterInstanceRequest = new DeregisterInstanceRequest().withServiceId(route53AutoRegistrationConfiguration.getAwsServiceId())
.withInstanceId(instance.getInstanceId().get());
getDiscoveryClient().deregisterInstance(deregisterInstanceRequest); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public int getHeight()
{
if (getAttributes().isDefined(Attribute.HEIGHT))
{
final int high = (int) (getAttributes().getHeight() + 0.5);
if (high > 0)
{
return high;
}
}
if (null != m_video)
{
return m_video.getVideoHeight();
}
return 0;
} }
|
public class class_name {
public int getHeight()
{
if (getAttributes().isDefined(Attribute.HEIGHT))
{
final int high = (int) (getAttributes().getHeight() + 0.5);
if (high > 0)
{
return high; // depends on control dependency: [if], data = [none]
}
}
if (null != m_video)
{
return m_video.getVideoHeight(); // depends on control dependency: [if], data = [none]
}
return 0;
} }
|
public class class_name {
public void sendASCII(ReqState rs,
String dataSet)
throws DAP2Exception, ParseException {
if (Debug.isSet("showResponse"))
System.out.println("Sending OPeNDAP ASCII Data For: " + dataSet +
" CE: '" + rs.getConstraintExpression() + "'");
String requestURL, ce;
DataDDS dds;
if (rs.getConstraintExpression() == null) {
ce = "";
} else {
ce = "?" + rs.getConstraintExpression();
}
int suffixIndex = rs.getRequestURL().toString().lastIndexOf(".");
requestURL = rs.getRequestURL().substring(0, suffixIndex);
if (Debug.isSet("showResponse")) {
System.out.println("New Request URL Resource: '" + requestURL + "'");
System.out.println("New Request Constraint Expression: '" + ce + "'");
}
if (_Debug) System.out.println("Making connection to .dods service...");
try (DConnect2 url = new DConnect2(requestURL, true)) {
if (_Debug) System.out.println("Requesting data...");
dds = url.getData(ce, null, new asciiFactory());
if (_Debug) System.out.println(" ASC DDS: ");
if (_Debug) dds.print(System.out);
PrintWriter pw = new PrintWriter(new OutputStreamWriter(rs.getResponse().getOutputStream(), Util.UTF8));
PrintWriter pwDebug = new PrintWriter(new OutputStreamWriter(System.out,Util.UTF8));
if(dds!=null){
dds.print(pw);
pw.println("---------------------------------------------");
String s = "";
Enumeration e = dds.getVariables();
while (e.hasMoreElements()) {
BaseType bt = (BaseType) e.nextElement();
if (_Debug) ((toASCII) bt).toASCII(pwDebug, true, null, true);
//bt.toASCII(pw,addName,getNAme(),true);
((toASCII) bt).toASCII(pw, true, null, true);
}
}
else {
String betterURL = rs.getRequestURL().substring(0, rs.getRequestURL().lastIndexOf(".")) +
".dods?"+ rs.getConstraintExpression();
pw.println("-- ASCII RESPONSE HANDLER PROBLEM --");
pw.println("");
pw.println("The ASCII response handler was unable to obtain requested data set.");
pw.println("");
pw.println("Because this handler calls it's own OPeNDAP server to get the requested");
pw.println("data the source error is obscured.");
pw.println("");
pw.println("To get a better idea of what is going wrong, try requesting the URL:");
pw.println("");
pw.println(" "+betterURL);
pw.println("");
pw.println("And then look carefully at the returned document. Note that if you");
pw.println("are using a browser to access the URL the returned document will");
pw.println("more than likely be treated as a download and written to your");
pw.println("local disk. It should be a file with the extension \".dods\"");
pw.println("");
pw.println("Locate it, open it with a text editor, and find your");
pw.println("way to happiness and inner peace.");
pw.println("");
}
//pw.println("</pre>");
pw.flush();
if (_Debug) pwDebug.flush();
}
catch (FileNotFoundException fnfe) {
System.out.println("OUCH! FileNotFoundException: " + fnfe.getMessage());
fnfe.printStackTrace(System.out);
}
catch (MalformedURLException mue) {
System.out.println("OUCH! MalformedURLException: " + mue.getMessage());
mue.printStackTrace(System.out);
}
catch (IOException ioe) {
System.out.println("OUCH! IOException: " + ioe.getMessage());
ioe.printStackTrace(System.out);
}
catch (Throwable t) {
System.out.println("OUCH! Throwable: " + t.getMessage());
t.printStackTrace(System.out);
}
if (_Debug) System.out.println(" GetAsciiHandler done");
} }
|
public class class_name {
public void sendASCII(ReqState rs,
String dataSet)
throws DAP2Exception, ParseException {
if (Debug.isSet("showResponse"))
System.out.println("Sending OPeNDAP ASCII Data For: " + dataSet +
" CE: '" + rs.getConstraintExpression() + "'");
String requestURL, ce;
DataDDS dds;
if (rs.getConstraintExpression() == null) {
ce = "";
} else {
ce = "?" + rs.getConstraintExpression();
}
int suffixIndex = rs.getRequestURL().toString().lastIndexOf(".");
requestURL = rs.getRequestURL().substring(0, suffixIndex);
if (Debug.isSet("showResponse")) {
System.out.println("New Request URL Resource: '" + requestURL + "'");
System.out.println("New Request Constraint Expression: '" + ce + "'");
}
if (_Debug) System.out.println("Making connection to .dods service...");
try (DConnect2 url = new DConnect2(requestURL, true)) {
if (_Debug) System.out.println("Requesting data...");
dds = url.getData(ce, null, new asciiFactory());
if (_Debug) System.out.println(" ASC DDS: ");
if (_Debug) dds.print(System.out);
PrintWriter pw = new PrintWriter(new OutputStreamWriter(rs.getResponse().getOutputStream(), Util.UTF8));
PrintWriter pwDebug = new PrintWriter(new OutputStreamWriter(System.out,Util.UTF8));
if(dds!=null){
dds.print(pw);
pw.println("---------------------------------------------");
String s = "";
Enumeration e = dds.getVariables();
while (e.hasMoreElements()) {
BaseType bt = (BaseType) e.nextElement();
if (_Debug) ((toASCII) bt).toASCII(pwDebug, true, null, true);
//bt.toASCII(pw,addName,getNAme(),true);
((toASCII) bt).toASCII(pw, true, null, true);
// depends on control dependency: [while], data = [none]
}
}
else {
String betterURL = rs.getRequestURL().substring(0, rs.getRequestURL().lastIndexOf(".")) +
".dods?"+ rs.getConstraintExpression();
pw.println("-- ASCII RESPONSE HANDLER PROBLEM --");
pw.println("");
pw.println("The ASCII response handler was unable to obtain requested data set.");
pw.println("");
pw.println("Because this handler calls it's own OPeNDAP server to get the requested");
pw.println("data the source error is obscured.");
pw.println("");
pw.println("To get a better idea of what is going wrong, try requesting the URL:");
pw.println("");
pw.println(" "+betterURL);
pw.println("");
pw.println("And then look carefully at the returned document. Note that if you");
pw.println("are using a browser to access the URL the returned document will");
pw.println("more than likely be treated as a download and written to your");
pw.println("local disk. It should be a file with the extension \".dods\"");
pw.println("");
pw.println("Locate it, open it with a text editor, and find your");
pw.println("way to happiness and inner peace.");
pw.println("");
}
//pw.println("</pre>");
pw.flush();
if (_Debug) pwDebug.flush();
}
catch (FileNotFoundException fnfe) {
System.out.println("OUCH! FileNotFoundException: " + fnfe.getMessage());
fnfe.printStackTrace(System.out);
}
catch (MalformedURLException mue) {
System.out.println("OUCH! MalformedURLException: " + mue.getMessage());
mue.printStackTrace(System.out);
}
catch (IOException ioe) {
System.out.println("OUCH! IOException: " + ioe.getMessage());
ioe.printStackTrace(System.out);
}
catch (Throwable t) {
System.out.println("OUCH! Throwable: " + t.getMessage());
t.printStackTrace(System.out);
}
if (_Debug) System.out.println(" GetAsciiHandler done");
} }
|
public class class_name {
public static float max(final float a, final float b) {
if (Float.isNaN(a)) {
return b;
} else if (Float.isNaN(b)) {
return a;
} else {
return Math.max(a, b);
}
} }
|
public class class_name {
public static float max(final float a, final float b) {
if (Float.isNaN(a)) {
return b;
// depends on control dependency: [if], data = [none]
} else if (Float.isNaN(b)) {
return a;
// depends on control dependency: [if], data = [none]
} else {
return Math.max(a, b);
// depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
protected void calculateBarPositions(int _DataSize) {
int dataSize = mScrollEnabled ? mVisibleBars : _DataSize;
float barWidth = mBarWidth;
float margin = mBarMargin;
if (!mFixedBarWidth) {
// calculate the bar width if the bars should be dynamically displayed
barWidth = (mAvailableScreenSize / _DataSize) - margin;
} else {
if(_DataSize < mVisibleBars) {
dataSize = _DataSize;
}
// calculate margin between bars if the bars have a fixed width
float cumulatedBarWidths = barWidth * dataSize;
float remainingScreenSize = mAvailableScreenSize - cumulatedBarWidths;
margin = remainingScreenSize / dataSize;
}
boolean isVertical = this instanceof VerticalBarChart;
int calculatedSize = (int) ((barWidth * _DataSize) + (margin * _DataSize));
int contentWidth = isVertical ? mGraphWidth : calculatedSize;
int contentHeight = isVertical ? calculatedSize : mGraphHeight;
mContentRect = new Rect(0, 0, contentWidth, contentHeight);
mCurrentViewport = new RectF(0, 0, mGraphWidth, mGraphHeight);
calculateBounds(barWidth, margin);
mLegend.invalidate();
mGraph.invalidate();
} }
|
public class class_name {
protected void calculateBarPositions(int _DataSize) {
int dataSize = mScrollEnabled ? mVisibleBars : _DataSize;
float barWidth = mBarWidth;
float margin = mBarMargin;
if (!mFixedBarWidth) {
// calculate the bar width if the bars should be dynamically displayed
barWidth = (mAvailableScreenSize / _DataSize) - margin; // depends on control dependency: [if], data = [none]
} else {
if(_DataSize < mVisibleBars) {
dataSize = _DataSize; // depends on control dependency: [if], data = [none]
}
// calculate margin between bars if the bars have a fixed width
float cumulatedBarWidths = barWidth * dataSize;
float remainingScreenSize = mAvailableScreenSize - cumulatedBarWidths;
margin = remainingScreenSize / dataSize; // depends on control dependency: [if], data = [none]
}
boolean isVertical = this instanceof VerticalBarChart;
int calculatedSize = (int) ((barWidth * _DataSize) + (margin * _DataSize));
int contentWidth = isVertical ? mGraphWidth : calculatedSize;
int contentHeight = isVertical ? calculatedSize : mGraphHeight;
mContentRect = new Rect(0, 0, contentWidth, contentHeight);
mCurrentViewport = new RectF(0, 0, mGraphWidth, mGraphHeight);
calculateBounds(barWidth, margin);
mLegend.invalidate();
mGraph.invalidate();
} }
|
public class class_name {
protected void callChildVisitors(XSLTVisitor visitor, boolean callAttrs)
{
int s = getImportCount();
for (int j = 0; j < s; j++)
{
getImport(j).callVisitors(visitor);
}
s = getIncludeCount();
for (int j = 0; j < s; j++)
{
getInclude(j).callVisitors(visitor);
}
s = getOutputCount();
for (int j = 0; j < s; j++)
{
visitor.visitTopLevelInstruction(getOutput(j));
}
// Next, add in the attribute-set elements
s = getAttributeSetCount();
for (int j = 0; j < s; j++)
{
ElemAttributeSet attrSet = getAttributeSet(j);
if (visitor.visitTopLevelInstruction(attrSet))
{
attrSet.callChildVisitors(visitor);
}
}
// Now the decimal-formats
s = getDecimalFormatCount();
for (int j = 0; j < s; j++)
{
visitor.visitTopLevelInstruction(getDecimalFormat(j));
}
// Now the keys
s = getKeyCount();
for (int j = 0; j < s; j++)
{
visitor.visitTopLevelInstruction(getKey(j));
}
// And the namespace aliases
s = getNamespaceAliasCount();
for (int j = 0; j < s; j++)
{
visitor.visitTopLevelInstruction(getNamespaceAlias(j));
}
// Next comes the templates
s = getTemplateCount();
for (int j = 0; j < s; j++)
{
try
{
ElemTemplate template = getTemplate(j);
if (visitor.visitTopLevelInstruction(template))
{
template.callChildVisitors(visitor);
}
}
catch (TransformerException te)
{
throw new org.apache.xml.utils.WrappedRuntimeException(te);
}
}
// Then, the variables
s = getVariableOrParamCount();
for (int j = 0; j < s; j++)
{
ElemVariable var = getVariableOrParam(j);
if (visitor.visitTopLevelVariableOrParamDecl(var))
{
var.callChildVisitors(visitor);
}
}
// And lastly the whitespace preserving and stripping elements
s = getStripSpaceCount();
for (int j = 0; j < s; j++)
{
visitor.visitTopLevelInstruction(getStripSpace(j));
}
s = getPreserveSpaceCount();
for (int j = 0; j < s; j++)
{
visitor.visitTopLevelInstruction(getPreserveSpace(j));
}
if(null != m_NonXslTopLevel)
{
java.util.Enumeration elements = m_NonXslTopLevel.elements();
while(elements.hasMoreElements())
{
ElemTemplateElement elem = (ElemTemplateElement)elements.nextElement();
if (visitor.visitTopLevelInstruction(elem))
{
elem.callChildVisitors(visitor);
}
}
}
} }
|
public class class_name {
protected void callChildVisitors(XSLTVisitor visitor, boolean callAttrs)
{
int s = getImportCount();
for (int j = 0; j < s; j++)
{
getImport(j).callVisitors(visitor); // depends on control dependency: [for], data = [j]
}
s = getIncludeCount();
for (int j = 0; j < s; j++)
{
getInclude(j).callVisitors(visitor); // depends on control dependency: [for], data = [j]
}
s = getOutputCount();
for (int j = 0; j < s; j++)
{
visitor.visitTopLevelInstruction(getOutput(j)); // depends on control dependency: [for], data = [j]
}
// Next, add in the attribute-set elements
s = getAttributeSetCount();
for (int j = 0; j < s; j++)
{
ElemAttributeSet attrSet = getAttributeSet(j);
if (visitor.visitTopLevelInstruction(attrSet))
{
attrSet.callChildVisitors(visitor); // depends on control dependency: [if], data = [none]
}
}
// Now the decimal-formats
s = getDecimalFormatCount();
for (int j = 0; j < s; j++)
{
visitor.visitTopLevelInstruction(getDecimalFormat(j)); // depends on control dependency: [for], data = [j]
}
// Now the keys
s = getKeyCount();
for (int j = 0; j < s; j++)
{
visitor.visitTopLevelInstruction(getKey(j)); // depends on control dependency: [for], data = [j]
}
// And the namespace aliases
s = getNamespaceAliasCount();
for (int j = 0; j < s; j++)
{
visitor.visitTopLevelInstruction(getNamespaceAlias(j)); // depends on control dependency: [for], data = [j]
}
// Next comes the templates
s = getTemplateCount();
for (int j = 0; j < s; j++)
{
try
{
ElemTemplate template = getTemplate(j);
if (visitor.visitTopLevelInstruction(template))
{
template.callChildVisitors(visitor); // depends on control dependency: [if], data = [none]
}
}
catch (TransformerException te)
{
throw new org.apache.xml.utils.WrappedRuntimeException(te);
} // depends on control dependency: [catch], data = [none]
}
// Then, the variables
s = getVariableOrParamCount();
for (int j = 0; j < s; j++)
{
ElemVariable var = getVariableOrParam(j);
if (visitor.visitTopLevelVariableOrParamDecl(var))
{
var.callChildVisitors(visitor); // depends on control dependency: [if], data = [none]
}
}
// And lastly the whitespace preserving and stripping elements
s = getStripSpaceCount();
for (int j = 0; j < s; j++)
{
visitor.visitTopLevelInstruction(getStripSpace(j)); // depends on control dependency: [for], data = [j]
}
s = getPreserveSpaceCount();
for (int j = 0; j < s; j++)
{
visitor.visitTopLevelInstruction(getPreserveSpace(j)); // depends on control dependency: [for], data = [j]
}
if(null != m_NonXslTopLevel)
{
java.util.Enumeration elements = m_NonXslTopLevel.elements();
while(elements.hasMoreElements())
{
ElemTemplateElement elem = (ElemTemplateElement)elements.nextElement();
if (visitor.visitTopLevelInstruction(elem))
{
elem.callChildVisitors(visitor); // depends on control dependency: [if], data = [none]
}
}
}
} }
|
public class class_name {
public static <T, X, E extends Throwable> List<X> collect (List<T> coll, APartialFunction<? super T, ? extends X, E> pf) throws E {
final List<X> result = createEmptyListOfType (coll, true);
for (T o: coll) {
if (pf.isDefinedAt (o)) {
result.add (pf.apply (o));
}
}
return result;
} }
|
public class class_name {
public static <T, X, E extends Throwable> List<X> collect (List<T> coll, APartialFunction<? super T, ? extends X, E> pf) throws E {
final List<X> result = createEmptyListOfType (coll, true);
for (T o: coll) {
if (pf.isDefinedAt (o)) {
result.add (pf.apply (o)); // depends on control dependency: [if], data = [none]
}
}
return result;
} }
|
public class class_name {
private static void setIncomeBudgetPeriods(PHS398CoverPageSupplement20 coverPageSupplement,
List<? extends BudgetProjectIncomeContract> projectIncomes) {
if (projectIncomes.isEmpty()) {
coverPageSupplement.setProgramIncome(YesNoDataType.N_NO);
} else {
coverPageSupplement.setProgramIncome(YesNoDataType.Y_YES);
}
coverPageSupplement.setIncomeBudgetPeriodArray(getIncomeBudgetPeriod(projectIncomes));
} }
|
public class class_name {
private static void setIncomeBudgetPeriods(PHS398CoverPageSupplement20 coverPageSupplement,
List<? extends BudgetProjectIncomeContract> projectIncomes) {
if (projectIncomes.isEmpty()) {
coverPageSupplement.setProgramIncome(YesNoDataType.N_NO); // depends on control dependency: [if], data = [none]
} else {
coverPageSupplement.setProgramIncome(YesNoDataType.Y_YES); // depends on control dependency: [if], data = [none]
}
coverPageSupplement.setIncomeBudgetPeriodArray(getIncomeBudgetPeriod(projectIncomes));
} }
|
public class class_name {
protected Map jsonMap() {
checkJsonContentType();
try {
return JsonHelper.toMap(getRequestString());
} catch (IOException e) {
throw new WebException(e);
}
} }
|
public class class_name {
protected Map jsonMap() {
checkJsonContentType();
try {
return JsonHelper.toMap(getRequestString()); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
throw new WebException(e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public String getHtml() {
LagartoDomBuilderConfig lagartoDomBuilderConfig;
if (ownerDocument == null) {
lagartoDomBuilderConfig = ((Document) this).getConfig();
} else {
lagartoDomBuilderConfig = ownerDocument.getConfig();
}
LagartoHtmlRenderer lagartoHtmlRenderer =
lagartoDomBuilderConfig.getLagartoHtmlRenderer();
return lagartoHtmlRenderer.toHtml(this, new StringBuilder());
} }
|
public class class_name {
public String getHtml() {
LagartoDomBuilderConfig lagartoDomBuilderConfig;
if (ownerDocument == null) {
lagartoDomBuilderConfig = ((Document) this).getConfig(); // depends on control dependency: [if], data = [none]
} else {
lagartoDomBuilderConfig = ownerDocument.getConfig(); // depends on control dependency: [if], data = [none]
}
LagartoHtmlRenderer lagartoHtmlRenderer =
lagartoDomBuilderConfig.getLagartoHtmlRenderer();
return lagartoHtmlRenderer.toHtml(this, new StringBuilder());
} }
|
public class class_name {
protected void beginReplicating() {
Log.v(TAG, "submit startReplicating()");
executor.submit(new Runnable() {
@Override
public void run() {
if (isRunning()) {
Log.v(TAG, "start startReplicating()");
initPendingSequences();
initDownloadsToInsert();
startChangeTracker();
}
// start replicator ...
}
});
} }
|
public class class_name {
protected void beginReplicating() {
Log.v(TAG, "submit startReplicating()");
executor.submit(new Runnable() {
@Override
public void run() {
if (isRunning()) {
Log.v(TAG, "start startReplicating()"); // depends on control dependency: [if], data = [none]
initPendingSequences(); // depends on control dependency: [if], data = [none]
initDownloadsToInsert(); // depends on control dependency: [if], data = [none]
startChangeTracker(); // depends on control dependency: [if], data = [none]
}
// start replicator ...
}
});
} }
|
public class class_name {
@Deprecated
public static int resetBitmapRangeAndCardinalityChange(LongBuffer bitmap, int start, int end) {
if (BufferUtil.isBackedBySimpleArray(bitmap)) {
return Util.resetBitmapRangeAndCardinalityChange(bitmap.array(), start, end);
}
int cardbefore = cardinalityInBitmapWordRange(bitmap, start, end);
resetBitmapRange(bitmap, start, end);
int cardafter = cardinalityInBitmapWordRange(bitmap, start, end);
return cardafter - cardbefore;
} }
|
public class class_name {
@Deprecated
public static int resetBitmapRangeAndCardinalityChange(LongBuffer bitmap, int start, int end) {
if (BufferUtil.isBackedBySimpleArray(bitmap)) {
return Util.resetBitmapRangeAndCardinalityChange(bitmap.array(), start, end); // depends on control dependency: [if], data = [none]
}
int cardbefore = cardinalityInBitmapWordRange(bitmap, start, end);
resetBitmapRange(bitmap, start, end);
int cardafter = cardinalityInBitmapWordRange(bitmap, start, end);
return cardafter - cardbefore;
} }
|
public class class_name {
public void afterCompleted(Event event) {
ChaincodeMessage message = messageHelper(event);
logger.debug(String.format("[%s]sending COMPLETED to validator for tid", shortID(message)));
try {
serialSend(message);
} catch (Exception e) {
event.cancel(new Exception("send COMPLETED failed %s", e));
}
} }
|
public class class_name {
public void afterCompleted(Event event) {
ChaincodeMessage message = messageHelper(event);
logger.debug(String.format("[%s]sending COMPLETED to validator for tid", shortID(message)));
try {
serialSend(message); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
event.cancel(new Exception("send COMPLETED failed %s", e));
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public void setName(String name) {
if (isJB()) {
this.name = name;
} else {
ShadowDisplayManager.changeDisplay(realObject.getDisplayId(),
di -> di.name = name);
}
} }
|
public class class_name {
public void setName(String name) {
if (isJB()) {
this.name = name; // depends on control dependency: [if], data = [none]
} else {
ShadowDisplayManager.changeDisplay(realObject.getDisplayId(),
di -> di.name = name); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
protected <T> T childActorFor(final Class<T> protocol, final Definition definition) {
if (definition.supervisor() != null) {
return lifeCycle.environment.stage.actorFor(protocol, definition, this, definition.supervisor(), logger());
} else {
if (this instanceof Supervisor) {
return lifeCycle.environment.stage.actorFor(protocol, definition, this, lifeCycle.lookUpProxy(Supervisor.class), logger());
} else {
return lifeCycle.environment.stage.actorFor(protocol, definition, this, null, logger());
}
}
} }
|
public class class_name {
protected <T> T childActorFor(final Class<T> protocol, final Definition definition) {
if (definition.supervisor() != null) {
return lifeCycle.environment.stage.actorFor(protocol, definition, this, definition.supervisor(), logger()); // depends on control dependency: [if], data = [none]
} else {
if (this instanceof Supervisor) {
return lifeCycle.environment.stage.actorFor(protocol, definition, this, lifeCycle.lookUpProxy(Supervisor.class), logger()); // depends on control dependency: [if], data = [none]
} else {
return lifeCycle.environment.stage.actorFor(protocol, definition, this, null, logger()); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
@Override
public boolean containsKey(T key) {
try {
if (emulateIsAbsent)
lock.readLock().lock();
return compressedEntries.containsKey(key);
} finally {
if (emulateIsAbsent)
lock.readLock().unlock();
}
} }
|
public class class_name {
@Override
public boolean containsKey(T key) {
try {
if (emulateIsAbsent)
lock.readLock().lock();
return compressedEntries.containsKey(key); // depends on control dependency: [try], data = [none]
} finally {
if (emulateIsAbsent)
lock.readLock().unlock();
}
} }
|
public class class_name {
public ExecutorConfig findExecutorConfig(String name) {
name = getBaseName(name);
ExecutorConfig config = lookupByPattern(configPatternMatcher, executorConfigs, name);
if (config != null) {
return config.getAsReadOnly();
}
return getExecutorConfig("default").getAsReadOnly();
} }
|
public class class_name {
public ExecutorConfig findExecutorConfig(String name) {
name = getBaseName(name);
ExecutorConfig config = lookupByPattern(configPatternMatcher, executorConfigs, name);
if (config != null) {
return config.getAsReadOnly(); // depends on control dependency: [if], data = [none]
}
return getExecutorConfig("default").getAsReadOnly();
} }
|
public class class_name {
private static byte[] base64Decode(String value) {
if (value == null) {
return null;
}
try {
return Base64.decodeBase64(value.getBytes("UTF-8"));
}
catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
} }
|
public class class_name {
private static byte[] base64Decode(String value) {
if (value == null) {
return null; // depends on control dependency: [if], data = [none]
}
try {
return Base64.decodeBase64(value.getBytes("UTF-8")); // depends on control dependency: [try], data = [none]
}
catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
static private SnowflakeDateTimeFormat specializedFormatter(
Map<String, Object> parameters,
String id,
String param,
String defaultFormat)
{
String sqlFormat =
SnowflakeDateTimeFormat.effectiveSpecializedTimestampFormat(
(String) effectiveParamValue(parameters, param),
defaultFormat);
SnowflakeDateTimeFormat formatter = new SnowflakeDateTimeFormat(sqlFormat);
if (logger.isDebugEnabled())
{
logger.debug("sql {} format: {}, java {} format: {}",
id, sqlFormat,
id, formatter.toSimpleDateTimePattern());
}
return formatter;
} }
|
public class class_name {
static private SnowflakeDateTimeFormat specializedFormatter(
Map<String, Object> parameters,
String id,
String param,
String defaultFormat)
{
String sqlFormat =
SnowflakeDateTimeFormat.effectiveSpecializedTimestampFormat(
(String) effectiveParamValue(parameters, param),
defaultFormat);
SnowflakeDateTimeFormat formatter = new SnowflakeDateTimeFormat(sqlFormat);
if (logger.isDebugEnabled())
{
logger.debug("sql {} format: {}, java {} format: {}",
id, sqlFormat,
id, formatter.toSimpleDateTimePattern()); // depends on control dependency: [if], data = [none]
}
return formatter;
} }
|
public class class_name {
public static Version of(String version) {
String[] tokens = StringUtil.tokenizeVersionString(version);
if (tokens != null && tokens.length >= 2) {
return Version.of(Byte.valueOf(tokens[0]), Byte.valueOf(tokens[1]));
} else {
throw new IllegalArgumentException("Cannot parse " + version + " to ClusterVersion.");
}
} }
|
public class class_name {
public static Version of(String version) {
String[] tokens = StringUtil.tokenizeVersionString(version);
if (tokens != null && tokens.length >= 2) {
return Version.of(Byte.valueOf(tokens[0]), Byte.valueOf(tokens[1])); // depends on control dependency: [if], data = [(tokens]
} else {
throw new IllegalArgumentException("Cannot parse " + version + " to ClusterVersion.");
}
} }
|
public class class_name {
public void fireChangeEvent() {
String result = "";
// check if there is a radio button selected.
if (m_group.getSelectedButton() != null) {
// set the name of the selected radio button.
result = m_group.getSelectedButton().getName();
}
ValueChangeEvent.fire(this, result);
} }
|
public class class_name {
public void fireChangeEvent() {
String result = "";
// check if there is a radio button selected.
if (m_group.getSelectedButton() != null) {
// set the name of the selected radio button.
result = m_group.getSelectedButton().getName();
// depends on control dependency: [if], data = [none]
}
ValueChangeEvent.fire(this, result);
} }
|
public class class_name {
public Observable<ServiceResponse<Page<ApplicationStackInner>>> getAvailableStacksWithServiceResponseAsync() {
return getAvailableStacksSinglePageAsync()
.concatMap(new Func1<ServiceResponse<Page<ApplicationStackInner>>, Observable<ServiceResponse<Page<ApplicationStackInner>>>>() {
@Override
public Observable<ServiceResponse<Page<ApplicationStackInner>>> call(ServiceResponse<Page<ApplicationStackInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(getAvailableStacksNextWithServiceResponseAsync(nextPageLink));
}
});
} }
|
public class class_name {
public Observable<ServiceResponse<Page<ApplicationStackInner>>> getAvailableStacksWithServiceResponseAsync() {
return getAvailableStacksSinglePageAsync()
.concatMap(new Func1<ServiceResponse<Page<ApplicationStackInner>>, Observable<ServiceResponse<Page<ApplicationStackInner>>>>() {
@Override
public Observable<ServiceResponse<Page<ApplicationStackInner>>> call(ServiceResponse<Page<ApplicationStackInner>> 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(getAvailableStacksNextWithServiceResponseAsync(nextPageLink));
}
});
} }
|
public class class_name {
private static int findIndex(String[] array, String target){
for (int i = 0; i < array.length; i++) {
if (target.equals(array[i])) {
return i;
}
}
return -1;
} }
|
public class class_name {
private static int findIndex(String[] array, String target){
for (int i = 0; i < array.length; i++) {
if (target.equals(array[i])) {
return i; // depends on control dependency: [if], data = [none]
}
}
return -1;
} }
|
public class class_name {
public List<LineString> lineStrings() {
List<List<Point>> coordinates = coordinates();
List<LineString> lineStrings = new ArrayList<>(coordinates.size());
for (List<Point> points : coordinates) {
lineStrings.add(LineString.fromLngLats(points));
}
return lineStrings;
} }
|
public class class_name {
public List<LineString> lineStrings() {
List<List<Point>> coordinates = coordinates();
List<LineString> lineStrings = new ArrayList<>(coordinates.size());
for (List<Point> points : coordinates) {
lineStrings.add(LineString.fromLngLats(points)); // depends on control dependency: [for], data = [points]
}
return lineStrings;
} }
|
public class class_name {
private CollectTweaksResult collectTweaks(Node root) {
CollectTweaks pass = new CollectTweaks();
NodeTraversal.traverse(compiler, root, pass);
Map<String, TweakInfo> tweakInfos = pass.allTweaks;
for (TweakInfo tweakInfo : tweakInfos.values()) {
tweakInfo.emitAllWarnings();
}
return new CollectTweaksResult(tweakInfos, pass.getOverridesCalls);
} }
|
public class class_name {
private CollectTweaksResult collectTweaks(Node root) {
CollectTweaks pass = new CollectTweaks();
NodeTraversal.traverse(compiler, root, pass);
Map<String, TweakInfo> tweakInfos = pass.allTweaks;
for (TweakInfo tweakInfo : tweakInfos.values()) {
tweakInfo.emitAllWarnings(); // depends on control dependency: [for], data = [tweakInfo]
}
return new CollectTweaksResult(tweakInfos, pass.getOverridesCalls);
} }
|
public class class_name {
public void setFontAssetDelegate(
@SuppressWarnings("NullableProblems") FontAssetDelegate assetDelegate) {
this.fontAssetDelegate = assetDelegate;
if (fontAssetManager != null) {
fontAssetManager.setDelegate(assetDelegate);
}
} }
|
public class class_name {
public void setFontAssetDelegate(
@SuppressWarnings("NullableProblems") FontAssetDelegate assetDelegate) {
this.fontAssetDelegate = assetDelegate;
if (fontAssetManager != null) {
fontAssetManager.setDelegate(assetDelegate); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
static void copyState(Object object, Object context, FieldMatchingStrategy strategy) {
if (object == null) {
throw new IllegalArgumentException("object to set state cannot be null");
} else if (context == null) {
throw new IllegalArgumentException("context cannot be null");
} else if (strategy == null) {
throw new IllegalArgumentException("strategy cannot be null");
}
Set<Field> allFields = isClass(context) ? getAllStaticFields(getType(context)) : getAllInstanceFields(context);
for (Field field : allFields) {
try {
final boolean isStaticField = Modifier.isStatic(field.getModifiers());
setInternalState(isStaticField ? getType(object) : object, field.getType(), field.get(context));
} catch (FieldNotFoundException e) {
if (strategy == FieldMatchingStrategy.STRICT) {
throw e;
}
} catch (IllegalAccessException e) {
// Should never happen
throw new RuntimeException(
"Internal Error: Failed to get the field value in method setInternalStateFromContext.", e);
}
}
} }
|
public class class_name {
static void copyState(Object object, Object context, FieldMatchingStrategy strategy) {
if (object == null) {
throw new IllegalArgumentException("object to set state cannot be null");
} else if (context == null) {
throw new IllegalArgumentException("context cannot be null");
} else if (strategy == null) {
throw new IllegalArgumentException("strategy cannot be null");
}
Set<Field> allFields = isClass(context) ? getAllStaticFields(getType(context)) : getAllInstanceFields(context);
for (Field field : allFields) {
try {
final boolean isStaticField = Modifier.isStatic(field.getModifiers());
setInternalState(isStaticField ? getType(object) : object, field.getType(), field.get(context)); // depends on control dependency: [try], data = [none]
} catch (FieldNotFoundException e) {
if (strategy == FieldMatchingStrategy.STRICT) {
throw e;
}
} catch (IllegalAccessException e) { // depends on control dependency: [catch], data = [none]
// Should never happen
throw new RuntimeException(
"Internal Error: Failed to get the field value in method setInternalStateFromContext.", e);
} // depends on control dependency: [catch], data = [none]
}
} }
|
public class class_name {
public void setFilters(String value) {
m_filters = new ArrayList<String>();
List<String> filters = CmsStringUtil.splitAsList(value, ':');
Iterator<String> i = filters.iterator();
while (i.hasNext()) {
String filter = i.next();
filter = filter.trim().toLowerCase();
Iterator<String> j = FILTERS.iterator();
while (j.hasNext()) {
String candidate = j.next();
if (candidate.startsWith(filter)) {
// found a matching filter
addFilter(candidate);
break;
}
}
}
} }
|
public class class_name {
public void setFilters(String value) {
m_filters = new ArrayList<String>();
List<String> filters = CmsStringUtil.splitAsList(value, ':');
Iterator<String> i = filters.iterator();
while (i.hasNext()) {
String filter = i.next();
filter = filter.trim().toLowerCase(); // depends on control dependency: [while], data = [none]
Iterator<String> j = FILTERS.iterator();
while (j.hasNext()) {
String candidate = j.next();
if (candidate.startsWith(filter)) {
// found a matching filter
addFilter(candidate); // depends on control dependency: [if], data = [none]
break;
}
}
}
} }
|
public class class_name {
public DescribeInstanceAssociationsStatusResult withInstanceAssociationStatusInfos(InstanceAssociationStatusInfo... instanceAssociationStatusInfos) {
if (this.instanceAssociationStatusInfos == null) {
setInstanceAssociationStatusInfos(new com.amazonaws.internal.SdkInternalList<InstanceAssociationStatusInfo>(instanceAssociationStatusInfos.length));
}
for (InstanceAssociationStatusInfo ele : instanceAssociationStatusInfos) {
this.instanceAssociationStatusInfos.add(ele);
}
return this;
} }
|
public class class_name {
public DescribeInstanceAssociationsStatusResult withInstanceAssociationStatusInfos(InstanceAssociationStatusInfo... instanceAssociationStatusInfos) {
if (this.instanceAssociationStatusInfos == null) {
setInstanceAssociationStatusInfos(new com.amazonaws.internal.SdkInternalList<InstanceAssociationStatusInfo>(instanceAssociationStatusInfos.length)); // depends on control dependency: [if], data = [none]
}
for (InstanceAssociationStatusInfo ele : instanceAssociationStatusInfos) {
this.instanceAssociationStatusInfos.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} }
|
public class class_name {
public void addElement(Element element) {
if (element == null)
return;
if (element instanceof Image) {
Image img = (Image)element;
PdfPTable t = new PdfPTable(1);
float w = img.getWidthPercentage();
if (w == 0) {
t.setTotalWidth(img.getScaledWidth());
t.setLockedWidth(true);
}
else
t.setWidthPercentage(w);
t.setSpacingAfter(img.getSpacingAfter());
t.setSpacingBefore(img.getSpacingBefore());
switch (img.getAlignment()) {
case Image.LEFT:
t.setHorizontalAlignment(Element.ALIGN_LEFT);
break;
case Image.RIGHT:
t.setHorizontalAlignment(Element.ALIGN_RIGHT);
break;
default:
t.setHorizontalAlignment(Element.ALIGN_CENTER);
break;
}
PdfPCell c = new PdfPCell(img, true);
c.setPadding(0);
c.setBorder(img.getBorder());
c.setBorderColor(img.getBorderColor());
c.setBorderWidth(img.getBorderWidth());
c.setBackgroundColor(img.getBackgroundColor());
t.addCell(c);
element = t;
}
if (element.type() == Element.CHUNK) {
element = new Paragraph((Chunk)element);
}
else if (element.type() == Element.PHRASE) {
element = new Paragraph((Phrase)element);
}
if (element instanceof SimpleTable) {
try {
element = ((SimpleTable)element).createPdfPTable();
} catch (DocumentException e) {
throw new IllegalArgumentException("Element not allowed." + element.type(), e);
}
}
else if (element.type() != Element.PARAGRAPH && element.type() != Element.LIST && element.type() != Element.PTABLE && element.type() != Element.YMARK)
throw new IllegalArgumentException("Element not allowed." + element.type());
if (!composite) {
composite = true;
compositeElements = new LinkedList();
bidiLine = null;
waitPhrase = null;
}
compositeElements.add(element);
} }
|
public class class_name {
public void addElement(Element element) {
if (element == null)
return;
if (element instanceof Image) {
Image img = (Image)element;
PdfPTable t = new PdfPTable(1);
float w = img.getWidthPercentage();
if (w == 0) {
t.setTotalWidth(img.getScaledWidth()); // depends on control dependency: [if], data = [none]
t.setLockedWidth(true); // depends on control dependency: [if], data = [none]
}
else
t.setWidthPercentage(w);
t.setSpacingAfter(img.getSpacingAfter()); // depends on control dependency: [if], data = [none]
t.setSpacingBefore(img.getSpacingBefore()); // depends on control dependency: [if], data = [none]
switch (img.getAlignment()) {
case Image.LEFT:
t.setHorizontalAlignment(Element.ALIGN_LEFT); // depends on control dependency: [if], data = [none]
break;
case Image.RIGHT:
t.setHorizontalAlignment(Element.ALIGN_RIGHT); // depends on control dependency: [if], data = [none]
break;
default:
t.setHorizontalAlignment(Element.ALIGN_CENTER);
break;
}
PdfPCell c = new PdfPCell(img, true);
c.setPadding(0);
c.setBorder(img.getBorder());
c.setBorderColor(img.getBorderColor());
c.setBorderWidth(img.getBorderWidth());
c.setBackgroundColor(img.getBackgroundColor());
t.addCell(c);
element = t;
}
if (element.type() == Element.CHUNK) {
element = new Paragraph((Chunk)element);
}
else if (element.type() == Element.PHRASE) {
element = new Paragraph((Phrase)element);
}
if (element instanceof SimpleTable) {
try {
element = ((SimpleTable)element).createPdfPTable(); // depends on control dependency: [try], data = [none]
} catch (DocumentException e) {
throw new IllegalArgumentException("Element not allowed." + element.type(), e);
} // depends on control dependency: [catch], data = [none]
}
else if (element.type() != Element.PARAGRAPH && element.type() != Element.LIST && element.type() != Element.PTABLE && element.type() != Element.YMARK)
throw new IllegalArgumentException("Element not allowed." + element.type());
if (!composite) {
composite = true;
compositeElements = new LinkedList();
bidiLine = null;
waitPhrase = null;
}
compositeElements.add(element);
} }
|
public class class_name {
public List<T> getSelectedValues() {
Object[] curVal = (Object[]) $(listbox.getElement()).val();
List<T> selectedValues = new ArrayList<>();
if (curVal == null || curVal.length < 1) {
return selectedValues;
}
List<String> keyIndex = getValuesKeyIndex();
for (Object val : curVal) {
if (val instanceof String) {
int selectedIndex = keyIndex.indexOf(val);
if (selectedIndex != -1) {
selectedValues.add(values.get(selectedIndex));
} else {
if (isTags() && val instanceof String) {
selectedValues.add((T) val);
}
}
}
}
return selectedValues;
} }
|
public class class_name {
public List<T> getSelectedValues() {
Object[] curVal = (Object[]) $(listbox.getElement()).val();
List<T> selectedValues = new ArrayList<>();
if (curVal == null || curVal.length < 1) {
return selectedValues; // depends on control dependency: [if], data = [none]
}
List<String> keyIndex = getValuesKeyIndex();
for (Object val : curVal) {
if (val instanceof String) {
int selectedIndex = keyIndex.indexOf(val);
if (selectedIndex != -1) {
selectedValues.add(values.get(selectedIndex)); // depends on control dependency: [if], data = [(selectedIndex]
} else {
if (isTags() && val instanceof String) {
selectedValues.add((T) val); // depends on control dependency: [if], data = [none]
}
}
}
}
return selectedValues;
} }
|
public class class_name {
public Icons getTableIcons(String featureTable) {
Icons icons = null;
Long id = contentsId.getId(featureTable);
if (id != null) {
icons = getTableIcons(featureTable, id);
}
return icons;
} }
|
public class class_name {
public Icons getTableIcons(String featureTable) {
Icons icons = null;
Long id = contentsId.getId(featureTable);
if (id != null) {
icons = getTableIcons(featureTable, id); // depends on control dependency: [if], data = [none]
}
return icons;
} }
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.