code stringlengths 130 281k | code_dependency stringlengths 182 306k |
|---|---|
public class class_name {
public static void readFully(InputStream in, ByteArrayOutputStream out, byte[] buffer) {
try {
int numRead = 0;
while ((numRead = in.read(buffer, 0, buffer.length)) != -1) {
out.write(buffer, 0, numRead);
}
out.flush();
} catch (IOException e) {
throw new RuntimeException(e);
}
} } | public class class_name {
public static void readFully(InputStream in, ByteArrayOutputStream out, byte[] buffer) {
try {
int numRead = 0;
while ((numRead = in.read(buffer, 0, buffer.length)) != -1) {
out.write(buffer, 0, numRead); // depends on control dependency: [while], data = [none]
}
out.flush(); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private void forwardMessage(AbstractMessage aMessage,
SIBUuid8 targetMEUuid)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "forwardMessage",
new Object[]{aMessage, targetMEUuid});
if (TraceComponent.isAnyTracingEnabled() && UserTrace.tc_mt.isDebugEnabled() && !aMessage.isControlMessage())
{
JsMessage jsMsg = (JsMessage) aMessage;
JsDestinationAddress routingDestination = jsMsg.getRoutingDestination();
if(routingDestination != null)
{
String destId = routingDestination.getDestinationName();
boolean temporary = false;
if(destId.startsWith(SIMPConstants.TEMPORARY_PUBSUB_DESTINATION_PREFIX))
temporary = true;
UserTrace.forwardJSMessage(jsMsg,
targetMEUuid,
destId,
temporary);
}
else
{
DestinationHandler dest =
_destinationManager.getDestinationInternal(aMessage.getGuaranteedTargetDestinationDefinitionUUID(), false);
if (dest != null)
UserTrace.forwardJSMessage(jsMsg,
targetMEUuid,
dest.getName(),
dest.isTemporary());
else
UserTrace.forwardJSMessage(jsMsg,
targetMEUuid,
jsMsg.getGuaranteedTargetDestinationDefinitionUUID().toString(),
false);
}
}
// Send this to MPIO
_mpio.sendToMe( targetMEUuid,
aMessage.getPriority().intValue(),
aMessage );
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "forwardMessage");
} } | public class class_name {
private void forwardMessage(AbstractMessage aMessage,
SIBUuid8 targetMEUuid)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "forwardMessage",
new Object[]{aMessage, targetMEUuid});
if (TraceComponent.isAnyTracingEnabled() && UserTrace.tc_mt.isDebugEnabled() && !aMessage.isControlMessage())
{
JsMessage jsMsg = (JsMessage) aMessage;
JsDestinationAddress routingDestination = jsMsg.getRoutingDestination();
if(routingDestination != null)
{
String destId = routingDestination.getDestinationName();
boolean temporary = false;
if(destId.startsWith(SIMPConstants.TEMPORARY_PUBSUB_DESTINATION_PREFIX))
temporary = true;
UserTrace.forwardJSMessage(jsMsg,
targetMEUuid,
destId,
temporary); // depends on control dependency: [if], data = [none]
}
else
{
DestinationHandler dest =
_destinationManager.getDestinationInternal(aMessage.getGuaranteedTargetDestinationDefinitionUUID(), false);
if (dest != null)
UserTrace.forwardJSMessage(jsMsg,
targetMEUuid,
dest.getName(),
dest.isTemporary());
else
UserTrace.forwardJSMessage(jsMsg,
targetMEUuid,
jsMsg.getGuaranteedTargetDestinationDefinitionUUID().toString(),
false);
}
}
// Send this to MPIO
_mpio.sendToMe( targetMEUuid,
aMessage.getPriority().intValue(),
aMessage );
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "forwardMessage");
} } |
public class class_name {
@Override
public void setOrRemove(String key, Object v) {
if (null == v) {
this.remove(key);
} else {
this.put(key, v);
}
} } | public class class_name {
@Override
public void setOrRemove(String key, Object v) {
if (null == v) {
this.remove(key);
// depends on control dependency: [if], data = [none]
} else {
this.put(key, v);
// depends on control dependency: [if], data = [v)]
}
} } |
public class class_name {
public boolean isUnauthenticated(Subject subject) {
if (subject == null) {
return true;
}
WSCredential wsCred = getWSCredential(subject);
if (wsCred == null) {
return true;
} else {
return wsCred.isUnauthenticated();
}
} } | public class class_name {
public boolean isUnauthenticated(Subject subject) {
if (subject == null) {
return true; // depends on control dependency: [if], data = [none]
}
WSCredential wsCred = getWSCredential(subject);
if (wsCred == null) {
return true; // depends on control dependency: [if], data = [none]
} else {
return wsCred.isUnauthenticated(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public void executeListMultiActions() throws CmsRuntimeException {
if (getParamListAction().equals(LIST_MACTION_DELETE)) {
// execute the delete multiaction
Map<String, String[]> params = new HashMap<String, String[]>();
params.put(A_CmsEditGroupDialog.PARAM_GROUPID, new String[] {getParamSelItems()});
// set action parameter to initial dialog call
params.put(CmsDialog.PARAM_ACTION, new String[] {CmsDialog.DIALOG_INITIAL});
try {
getToolManager().jspForwardTool(this, getCurrentToolPath() + "/delete", params);
} catch (Exception e) {
throw new CmsRuntimeException(Messages.get().container(Messages.ERR_DELETE_SELECTED_GROUPS_0), e);
}
} else if (getParamListAction().equals(LIST_MACTION_ACTIVATE)) {
// execute the activate multiaction
try {
Iterator<CmsListItem> itItems = getSelectedItems().iterator();
while (itItems.hasNext()) {
CmsListItem listItem = itItems.next();
String groupName = listItem.get(LIST_COLUMN_NAME).toString();
CmsGroup group = getCms().readGroup(groupName);
if (!group.isEnabled()) {
group.setEnabled(true);
getCms().writeGroup(group);
}
}
} catch (CmsException e) {
throw new CmsRuntimeException(Messages.get().container(Messages.ERR_ACTIVATE_SELECTED_GROUPS_0), e);
}
// refreshing no needed becaus the activate action does not add/remove rows to the list
} else if (getParamListAction().equals(LIST_MACTION_DEACTIVATE)) {
// execute the activate multiaction
try {
Iterator<CmsListItem> itItems = getSelectedItems().iterator();
while (itItems.hasNext()) {
CmsListItem listItem = itItems.next();
String groupName = listItem.get(LIST_COLUMN_NAME).toString();
CmsGroup group = getCms().readGroup(groupName);
if (group.isEnabled()) {
group.setEnabled(false);
getCms().writeGroup(group);
}
}
} catch (CmsException e) {
throw new CmsRuntimeException(Messages.get().container(Messages.ERR_DEACTIVATE_SELECTED_GROUPS_0), e);
}
// refreshing no needed becaus the activate action does not add/remove rows to the list
} else {
throwListUnsupportedActionException();
}
listSave();
} } | public class class_name {
@Override
public void executeListMultiActions() throws CmsRuntimeException {
if (getParamListAction().equals(LIST_MACTION_DELETE)) {
// execute the delete multiaction
Map<String, String[]> params = new HashMap<String, String[]>();
params.put(A_CmsEditGroupDialog.PARAM_GROUPID, new String[] {getParamSelItems()});
// set action parameter to initial dialog call
params.put(CmsDialog.PARAM_ACTION, new String[] {CmsDialog.DIALOG_INITIAL});
try {
getToolManager().jspForwardTool(this, getCurrentToolPath() + "/delete", params); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new CmsRuntimeException(Messages.get().container(Messages.ERR_DELETE_SELECTED_GROUPS_0), e);
} // depends on control dependency: [catch], data = [none]
} else if (getParamListAction().equals(LIST_MACTION_ACTIVATE)) {
// execute the activate multiaction
try {
Iterator<CmsListItem> itItems = getSelectedItems().iterator();
while (itItems.hasNext()) {
CmsListItem listItem = itItems.next();
String groupName = listItem.get(LIST_COLUMN_NAME).toString();
CmsGroup group = getCms().readGroup(groupName);
if (!group.isEnabled()) {
group.setEnabled(true); // depends on control dependency: [if], data = [none]
getCms().writeGroup(group); // depends on control dependency: [if], data = [none]
}
}
} catch (CmsException e) {
throw new CmsRuntimeException(Messages.get().container(Messages.ERR_ACTIVATE_SELECTED_GROUPS_0), e);
} // depends on control dependency: [catch], data = [none]
// refreshing no needed becaus the activate action does not add/remove rows to the list
} else if (getParamListAction().equals(LIST_MACTION_DEACTIVATE)) {
// execute the activate multiaction
try {
Iterator<CmsListItem> itItems = getSelectedItems().iterator();
while (itItems.hasNext()) {
CmsListItem listItem = itItems.next();
String groupName = listItem.get(LIST_COLUMN_NAME).toString();
CmsGroup group = getCms().readGroup(groupName);
if (group.isEnabled()) {
group.setEnabled(false); // depends on control dependency: [if], data = [none]
getCms().writeGroup(group); // depends on control dependency: [if], data = [none]
}
}
} catch (CmsException e) {
throw new CmsRuntimeException(Messages.get().container(Messages.ERR_DEACTIVATE_SELECTED_GROUPS_0), e);
} // depends on control dependency: [catch], data = [none]
// refreshing no needed becaus the activate action does not add/remove rows to the list
} else {
throwListUnsupportedActionException();
}
listSave();
} } |
public class class_name {
@SuppressWarnings({ "rawtypes", "unchecked" })
protected Map<String, Object> getAddressCache() {
try {
final Field cacheField = InetAddress.class.getDeclaredField("addressCache");
cacheField.setAccessible(true);
final Object addressCache = cacheField.get(InetAddress.class);
Class clazz = addressCache.getClass();
final Field cacheMapField = clazz.getDeclaredField("cache");
cacheMapField.setAccessible(true);
return (Map) cacheMapField.get(addressCache);
}
catch (Exception e) {
throw new RuntimeException(e.getMessage(), e);
}
} } | public class class_name {
@SuppressWarnings({ "rawtypes", "unchecked" })
protected Map<String, Object> getAddressCache() {
try {
final Field cacheField = InetAddress.class.getDeclaredField("addressCache");
cacheField.setAccessible(true); // depends on control dependency: [try], data = [none]
final Object addressCache = cacheField.get(InetAddress.class);
Class clazz = addressCache.getClass();
final Field cacheMapField = clazz.getDeclaredField("cache");
cacheMapField.setAccessible(true); // depends on control dependency: [try], data = [none]
return (Map) cacheMapField.get(addressCache); // depends on control dependency: [try], data = [none]
}
catch (Exception e) {
throw new RuntimeException(e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void fillEdgeIDs(GHIntHashSet edgeIds, Geometry geometry, EdgeFilter filter) {
if (geometry instanceof Point) {
GHPoint point = GHPoint.create((Point) geometry);
findClosestEdgeToPoint(edgeIds, point, filter);
} else if (geometry instanceof LineString) {
PointList pl = PointList.fromLineString((LineString) geometry);
// TODO do map matching or routing
int lastIdx = pl.size() - 1;
if (pl.size() >= 2) {
double meanLat = (pl.getLatitude(0) + pl.getLatitude(lastIdx)) / 2;
double meanLon = (pl.getLongitude(0) + pl.getLongitude(lastIdx)) / 2;
findClosestEdge(edgeIds, meanLat, meanLon, filter);
}
} else if (geometry instanceof MultiPoint) {
for (Coordinate coordinate : geometry.getCoordinates()) {
findClosestEdge(edgeIds, coordinate.y, coordinate.x, filter);
}
}
} } | public class class_name {
public void fillEdgeIDs(GHIntHashSet edgeIds, Geometry geometry, EdgeFilter filter) {
if (geometry instanceof Point) {
GHPoint point = GHPoint.create((Point) geometry);
findClosestEdgeToPoint(edgeIds, point, filter); // depends on control dependency: [if], data = [none]
} else if (geometry instanceof LineString) {
PointList pl = PointList.fromLineString((LineString) geometry);
// TODO do map matching or routing
int lastIdx = pl.size() - 1;
if (pl.size() >= 2) {
double meanLat = (pl.getLatitude(0) + pl.getLatitude(lastIdx)) / 2;
double meanLon = (pl.getLongitude(0) + pl.getLongitude(lastIdx)) / 2;
findClosestEdge(edgeIds, meanLat, meanLon, filter); // depends on control dependency: [if], data = [none]
}
} else if (geometry instanceof MultiPoint) {
for (Coordinate coordinate : geometry.getCoordinates()) {
findClosestEdge(edgeIds, coordinate.y, coordinate.x, filter); // depends on control dependency: [for], data = [coordinate]
}
}
} } |
public class class_name {
public String queryLock (NodeObject.Lock lock)
{
for (NodeObject nodeobj : getNodeObjects()) {
if (nodeobj.locks.contains(lock)) {
return nodeobj.nodeName;
}
}
return null;
} } | public class class_name {
public String queryLock (NodeObject.Lock lock)
{
for (NodeObject nodeobj : getNodeObjects()) {
if (nodeobj.locks.contains(lock)) {
return nodeobj.nodeName; // depends on control dependency: [if], data = [none]
}
}
return null;
} } |
public class class_name {
public void setContentAction(Action act) {
if (act.entry != null && act.entry != this) {
Log.e(TAG, "setContentAction failed. Already applied to another notification - " +
act.entry.ID + ". Current notification is " + ID);
return;
}
this.contentAction = act;
this.contentAction.entry = this;
this.contentAction.title = "ContentAction";
} } | public class class_name {
public void setContentAction(Action act) {
if (act.entry != null && act.entry != this) {
Log.e(TAG, "setContentAction failed. Already applied to another notification - " +
act.entry.ID + ". Current notification is " + ID); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.contentAction = act;
this.contentAction.entry = this;
this.contentAction.title = "ContentAction";
} } |
public class class_name {
@Override
public void setDirectory(File dir) {
if (dir == null) {
throw new BuildException("Cannot set null directory attribute.");
}
// no override
if (this.directory == null) {
this.directory = new File(dir.getAbsolutePath());
}
} } | public class class_name {
@Override
public void setDirectory(File dir) {
if (dir == null) {
throw new BuildException("Cannot set null directory attribute.");
}
// no override
if (this.directory == null) {
this.directory = new File(dir.getAbsolutePath()); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static String getPropertyForGetter(String getterName, String returnType) {
if (getterName == null || getterName.length() == 0) return null;
if (getterName.startsWith("get")) {
String prop = getterName.substring(3);
return convertValidPropertyMethodSuffix(prop);
}
if (getterName.startsWith("is") && returnType.equals("boolean")) {
String prop = getterName.substring(2);
return convertValidPropertyMethodSuffix(prop);
}
return null;
} } | public class class_name {
public static String getPropertyForGetter(String getterName, String returnType) {
if (getterName == null || getterName.length() == 0) return null;
if (getterName.startsWith("get")) {
String prop = getterName.substring(3);
return convertValidPropertyMethodSuffix(prop); // depends on control dependency: [if], data = [none]
}
if (getterName.startsWith("is") && returnType.equals("boolean")) {
String prop = getterName.substring(2);
return convertValidPropertyMethodSuffix(prop); // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
public void updatePoint(int p) {
neighbor[p] = p; // flag for not yet found any
distance[p] = Float.MAX_VALUE;
for (int i = 0; i < npoints; i++) {
int q = points[i];
if (q != p) {
float d = linkage.d(p, q);
if (d < distance[p]) {
distance[p] = d;
neighbor[p] = q;
}
if (neighbor[q] == p) {
if (d > distance[q]) {
findNeighbor(q);
} else {
distance[q] = d;
}
}
}
}
} } | public class class_name {
public void updatePoint(int p) {
neighbor[p] = p; // flag for not yet found any
distance[p] = Float.MAX_VALUE;
for (int i = 0; i < npoints; i++) {
int q = points[i];
if (q != p) {
float d = linkage.d(p, q);
if (d < distance[p]) {
distance[p] = d; // depends on control dependency: [if], data = [none]
neighbor[p] = q; // depends on control dependency: [if], data = [none]
}
if (neighbor[q] == p) {
if (d > distance[q]) {
findNeighbor(q); // depends on control dependency: [if], data = [none]
} else {
distance[q] = d; // depends on control dependency: [if], data = [none]
}
}
}
}
} } |
public class class_name {
private BlockedDelta compute(int numBlocks) {
int contentSize = getValue(_next).remaining();
_oldDelta = _next;
UUID changeId = getChangeId(_next);
if (_list == null) {
_list = Lists.newArrayListWithCapacity(numBlocks);
}
_list.add(_next);
for (int i = 1; i < numBlocks; i++) {
if (_iterator.hasNext()) {
_next = _iterator.next();
if (getChangeId(_next).equals(changeId)) {
_list.add(_next);
contentSize += getValue(_next).remaining();
} else {
// fragmented delta encountered, we must skip over it
// We must also clear the list of the fragmented delta blocks to avoid them being stitched in with
// the next delta, which will cause a buffer overflow
_list.clear();
return null;
}
} else {
// fragmented delta and no other deltas to skip to
throw new DeltaStitchingException(_rowKey, getChangeId(_next).toString(), numBlocks, i - 1);
}
}
numBlocks += skipForward();
return new BlockedDelta(numBlocks, stitchContent(contentSize));
} } | public class class_name {
private BlockedDelta compute(int numBlocks) {
int contentSize = getValue(_next).remaining();
_oldDelta = _next;
UUID changeId = getChangeId(_next);
if (_list == null) {
_list = Lists.newArrayListWithCapacity(numBlocks); // depends on control dependency: [if], data = [none]
}
_list.add(_next);
for (int i = 1; i < numBlocks; i++) {
if (_iterator.hasNext()) {
_next = _iterator.next(); // depends on control dependency: [if], data = [none]
if (getChangeId(_next).equals(changeId)) {
_list.add(_next); // depends on control dependency: [if], data = [none]
contentSize += getValue(_next).remaining(); // depends on control dependency: [if], data = [none]
} else {
// fragmented delta encountered, we must skip over it
// We must also clear the list of the fragmented delta blocks to avoid them being stitched in with
// the next delta, which will cause a buffer overflow
_list.clear(); // depends on control dependency: [if], data = [none]
return null; // depends on control dependency: [if], data = [none]
}
} else {
// fragmented delta and no other deltas to skip to
throw new DeltaStitchingException(_rowKey, getChangeId(_next).toString(), numBlocks, i - 1);
}
}
numBlocks += skipForward();
return new BlockedDelta(numBlocks, stitchContent(contentSize));
} } |
public class class_name {
@Override
public <T> T adapt(Class<T> clazz) {
if (MessageContext.class.isAssignableFrom(clazz)) {
return clazz.cast(this);
}
return null;
} } | public class class_name {
@Override
public <T> T adapt(Class<T> clazz) {
if (MessageContext.class.isAssignableFrom(clazz)) {
return clazz.cast(this); // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
public KvStateInfo<K, N, V> duplicate() {
final TypeSerializer<K> dupKeySerializer = keySerializer.duplicate();
final TypeSerializer<N> dupNamespaceSerializer = namespaceSerializer.duplicate();
final TypeSerializer<V> dupSVSerializer = stateValueSerializer.duplicate();
if (
dupKeySerializer == keySerializer &&
dupNamespaceSerializer == namespaceSerializer &&
dupSVSerializer == stateValueSerializer
) {
return this;
}
return new KvStateInfo<>(dupKeySerializer, dupNamespaceSerializer, dupSVSerializer);
} } | public class class_name {
public KvStateInfo<K, N, V> duplicate() {
final TypeSerializer<K> dupKeySerializer = keySerializer.duplicate();
final TypeSerializer<N> dupNamespaceSerializer = namespaceSerializer.duplicate();
final TypeSerializer<V> dupSVSerializer = stateValueSerializer.duplicate();
if (
dupKeySerializer == keySerializer &&
dupNamespaceSerializer == namespaceSerializer &&
dupSVSerializer == stateValueSerializer
) {
return this; // depends on control dependency: [if], data = []
}
return new KvStateInfo<>(dupKeySerializer, dupNamespaceSerializer, dupSVSerializer);
} } |
public class class_name {
protected void updateContentSize() {
// The scrolling should be done by the CmsScrollPanel and not by the text area,
// so we try to make the text area itself as big as its content here.
int offsetHeight = m_textArea.getOffsetHeight();
int origRows = m_textArea.getVisibleLines();
// sanity check: don't do anything, if the measured height doesn't make any sense, e.g. if element is not attached
if (offsetHeight > 5) {
int scrollPosition = m_textAreaContainer.getVerticalScrollPosition();
Element textareaElem = m_textArea.getElement();
int rows = Math.max(0, m_defaultRows - 1); // we add 1 to it later, and the sum should be at least 1 and at least the default row number
int scrollHeight;
int prevOffsetHeight = -1;
do {
rows += 1;
m_textArea.setVisibleLines(rows);
scrollHeight = textareaElem.getScrollHeight();
offsetHeight = textareaElem.getOffsetHeight();
if (offsetHeight <= prevOffsetHeight) {
// Increasing the number of rows should normally increase the offset height.
// If it doesn't, e.g. because of CSS rules limiting the text area height, there is no point in continuing with the loop
break;
}
prevOffsetHeight = offsetHeight;
} while (offsetHeight < scrollHeight);
m_textAreaContainer.setVerticalScrollPosition(scrollPosition);
if (origRows != rows) {
m_textAreaContainer.onResizeDescendant();
}
}
} } | public class class_name {
protected void updateContentSize() {
// The scrolling should be done by the CmsScrollPanel and not by the text area,
// so we try to make the text area itself as big as its content here.
int offsetHeight = m_textArea.getOffsetHeight();
int origRows = m_textArea.getVisibleLines();
// sanity check: don't do anything, if the measured height doesn't make any sense, e.g. if element is not attached
if (offsetHeight > 5) {
int scrollPosition = m_textAreaContainer.getVerticalScrollPosition();
Element textareaElem = m_textArea.getElement();
int rows = Math.max(0, m_defaultRows - 1); // we add 1 to it later, and the sum should be at least 1 and at least the default row number
int scrollHeight;
int prevOffsetHeight = -1;
do {
rows += 1;
m_textArea.setVisibleLines(rows);
scrollHeight = textareaElem.getScrollHeight();
offsetHeight = textareaElem.getOffsetHeight();
if (offsetHeight <= prevOffsetHeight) {
// Increasing the number of rows should normally increase the offset height.
// If it doesn't, e.g. because of CSS rules limiting the text area height, there is no point in continuing with the loop
break;
}
prevOffsetHeight = offsetHeight;
} while (offsetHeight < scrollHeight);
m_textAreaContainer.setVerticalScrollPosition(scrollPosition); // depends on control dependency: [if], data = [none]
if (origRows != rows) {
m_textAreaContainer.onResizeDescendant(); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public AddressSelector reset() {
if (selectionsIterator != null) {
this.selections = strategy.selectConnections(leader, new ArrayList<>(servers));
this.selectionsIterator = null;
}
return this;
} } | public class class_name {
public AddressSelector reset() {
if (selectionsIterator != null) {
this.selections = strategy.selectConnections(leader, new ArrayList<>(servers)); // depends on control dependency: [if], data = [none]
this.selectionsIterator = null; // depends on control dependency: [if], data = [none]
}
return this;
} } |
public class class_name {
public long getStartCluster() {
if (type == FatType.FAT32) {
return
(LittleEndian.getUInt16(data, 0x14) << 16) |
LittleEndian.getUInt16(data, 0x1a);
} else {
return LittleEndian.getUInt16(data, 0x1a);
}
} } | public class class_name {
public long getStartCluster() {
if (type == FatType.FAT32) {
return
(LittleEndian.getUInt16(data, 0x14) << 16) |
LittleEndian.getUInt16(data, 0x1a); // depends on control dependency: [if], data = [none]
} else {
return LittleEndian.getUInt16(data, 0x1a); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public void deserializeKAM(final String kamName, final String filePath,
final boolean noPreserve) throws PKAMSerializationFailure {
// load destination KAM
final SystemConfiguration cfg =
SystemConfiguration.getSystemConfiguration();
// parse and insert KAM data from portable KAM file
PKAMReader pkr = null;
CSVReader tabbedReader = null;
KAMImportDAO kamImportDAO = null;
try {
try {
pkr = new PKAMReader(filePath);
} catch (Exception e) {
throw new PKAMSerializationFailure(filePath,
"Unable to process KAM.");
}
tabbedReader = new CSVReader(pkr, FIELD_SEPARATOR,
CSVParser.DEFAULT_QUOTE_CHARACTER,
CSVParser.DEFAULT_ESCAPE_CHARACTER);
KAMStoreTables1_0 table;
String[] data;
while ((data = tabbedReader.readNext()) != null) {
Matcher matcher = TABLE_HEADER_PATTERN.matcher(data[0]);
if (data.length == 1 && matcher.matches()) {
table = KAMStoreTables1_0.getTableByName(matcher.group(1));
if (table == KAMStoreTables1_0.KAM_CATALOG_KAM) {
String[] kcRowData = tabbedReader.readNext();
final String newKAMSchema = createKAMSchema(cfg,
kamName, kcRowData, filePath, noPreserve);
final DBConnection kcc =
createKAMConnection(filePath, cfg);
kamImportDAO = new KAMImportDAO(kcc, newKAMSchema);
continue;
}
if (kamImportDAO == null) {
throw new IllegalStateException(
"KAMImportDAO has not been constructed");
}
// commit previous table batch, if any
kamImportDAO.commitTableBatch();
kamImportDAO.startTableBatch(table);
} else {
if (kamImportDAO == null) {
throw new IllegalStateException(
"KAMImportDAO has not been constructed");
}
kamImportDAO.importDataRow(data);
}
}
if (kamImportDAO == null) {
throw new IllegalStateException(
"KAMImportDAO has not been constructed");
}
// commit final table batch
kamImportDAO.commitTableBatch();
} catch (IOException e) {
throw new PKAMSerializationFailure(filePath, e.getMessage());
} catch (SQLException e) {
throw new PKAMSerializationFailure(filePath, e.getMessage());
} finally {
// close tabbed-data reader
if (tabbedReader != null) {
try {
tabbedReader.close();
} catch (IOException e) {}
}
if (kamImportDAO != null) {
kamImportDAO.terminate();
}
}
} } | public class class_name {
@Override
public void deserializeKAM(final String kamName, final String filePath,
final boolean noPreserve) throws PKAMSerializationFailure {
// load destination KAM
final SystemConfiguration cfg =
SystemConfiguration.getSystemConfiguration();
// parse and insert KAM data from portable KAM file
PKAMReader pkr = null;
CSVReader tabbedReader = null;
KAMImportDAO kamImportDAO = null;
try {
try {
pkr = new PKAMReader(filePath); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new PKAMSerializationFailure(filePath,
"Unable to process KAM.");
} // depends on control dependency: [catch], data = [none]
tabbedReader = new CSVReader(pkr, FIELD_SEPARATOR,
CSVParser.DEFAULT_QUOTE_CHARACTER,
CSVParser.DEFAULT_ESCAPE_CHARACTER);
KAMStoreTables1_0 table;
String[] data;
while ((data = tabbedReader.readNext()) != null) {
Matcher matcher = TABLE_HEADER_PATTERN.matcher(data[0]);
if (data.length == 1 && matcher.matches()) {
table = KAMStoreTables1_0.getTableByName(matcher.group(1)); // depends on control dependency: [if], data = [none]
if (table == KAMStoreTables1_0.KAM_CATALOG_KAM) {
String[] kcRowData = tabbedReader.readNext();
final String newKAMSchema = createKAMSchema(cfg,
kamName, kcRowData, filePath, noPreserve);
final DBConnection kcc =
createKAMConnection(filePath, cfg);
kamImportDAO = new KAMImportDAO(kcc, newKAMSchema); // depends on control dependency: [if], data = [none]
continue;
}
if (kamImportDAO == null) {
throw new IllegalStateException(
"KAMImportDAO has not been constructed");
}
// commit previous table batch, if any
kamImportDAO.commitTableBatch(); // depends on control dependency: [if], data = [none]
kamImportDAO.startTableBatch(table); // depends on control dependency: [if], data = [none]
} else {
if (kamImportDAO == null) {
throw new IllegalStateException(
"KAMImportDAO has not been constructed");
}
kamImportDAO.importDataRow(data); // depends on control dependency: [if], data = [none]
}
}
if (kamImportDAO == null) {
throw new IllegalStateException(
"KAMImportDAO has not been constructed");
}
// commit final table batch
kamImportDAO.commitTableBatch();
} catch (IOException e) {
throw new PKAMSerializationFailure(filePath, e.getMessage());
} catch (SQLException e) {
throw new PKAMSerializationFailure(filePath, e.getMessage());
} finally {
// close tabbed-data reader
if (tabbedReader != null) {
try {
tabbedReader.close(); // depends on control dependency: [try], data = [none]
} catch (IOException e) {} // depends on control dependency: [catch], data = [none]
}
if (kamImportDAO != null) {
kamImportDAO.terminate(); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public static int elfHash(String str) {
int hash = 0;
int x = 0;
for (int i = 0; i < str.length(); i++) {
hash = (hash << 4) + str.charAt(i);
if ((x = (int) (hash & 0xF0000000L)) != 0) {
hash ^= (x >> 24);
hash &= ~x;
}
}
return hash & 0x7FFFFFFF;
} } | public class class_name {
public static int elfHash(String str) {
int hash = 0;
int x = 0;
for (int i = 0; i < str.length(); i++) {
hash = (hash << 4) + str.charAt(i);
// depends on control dependency: [for], data = [i]
if ((x = (int) (hash & 0xF0000000L)) != 0) {
hash ^= (x >> 24);
// depends on control dependency: [if], data = [none]
hash &= ~x;
// depends on control dependency: [if], data = [none]
}
}
return hash & 0x7FFFFFFF;
} } |
public class class_name {
public void discardFirstWords(int x) {
if (this.RunningLength >= x) {
this.RunningLength -= x;
return;
}
x -= this.RunningLength;
this.RunningLength = 0;
this.literalWordOffset += x;
this.NumberOfLiteralWords -= x;
} } | public class class_name {
public void discardFirstWords(int x) {
if (this.RunningLength >= x) {
this.RunningLength -= x; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
x -= this.RunningLength;
this.RunningLength = 0;
this.literalWordOffset += x;
this.NumberOfLiteralWords -= x;
} } |
public class class_name {
public boolean is(MatrixPredicate predicate) {
MatrixIterator it = iterator();
boolean result = predicate.test(rows, columns);
while (it.hasNext() && result) {
double x = it.next();
int i = it.rowIndex();
int j = it.columnIndex();
result = predicate.test(i, j, x);
}
return result;
} } | public class class_name {
public boolean is(MatrixPredicate predicate) {
MatrixIterator it = iterator();
boolean result = predicate.test(rows, columns);
while (it.hasNext() && result) {
double x = it.next();
int i = it.rowIndex();
int j = it.columnIndex();
result = predicate.test(i, j, x); // depends on control dependency: [while], data = [none]
}
return result;
} } |
public class class_name {
public void setNetworkDestinationIpV4(java.util.Collection<IpFilter> networkDestinationIpV4) {
if (networkDestinationIpV4 == null) {
this.networkDestinationIpV4 = null;
return;
}
this.networkDestinationIpV4 = new java.util.ArrayList<IpFilter>(networkDestinationIpV4);
} } | public class class_name {
public void setNetworkDestinationIpV4(java.util.Collection<IpFilter> networkDestinationIpV4) {
if (networkDestinationIpV4 == null) {
this.networkDestinationIpV4 = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.networkDestinationIpV4 = new java.util.ArrayList<IpFilter>(networkDestinationIpV4);
} } |
public class class_name {
@Override
public int translate(final CharSequence input, final int index, final Writer out) throws IOException {
// check if translation exists for the input at position index
if (prefixSet.contains(input.charAt(index))) {
int max = longest;
if (index + longest > input.length()) {
max = input.length() - index;
}
// implement greedy algorithm by trying maximum match first
for (int i = max; i >= shortest; i--) {
final CharSequence subSeq = input.subSequence(index, index + i);
final String result = lookupMap.get(subSeq.toString());
if (result != null) {
out.write(result);
return i;
}
}
}
return 0;
} } | public class class_name {
@Override
public int translate(final CharSequence input, final int index, final Writer out) throws IOException {
// check if translation exists for the input at position index
if (prefixSet.contains(input.charAt(index))) {
int max = longest;
if (index + longest > input.length()) {
max = input.length() - index; // depends on control dependency: [if], data = [none]
}
// implement greedy algorithm by trying maximum match first
for (int i = max; i >= shortest; i--) {
final CharSequence subSeq = input.subSequence(index, index + i);
final String result = lookupMap.get(subSeq.toString());
if (result != null) {
out.write(result); // depends on control dependency: [if], data = [(result]
return i; // depends on control dependency: [if], data = [none]
}
}
}
return 0;
} } |
public class class_name {
public PoolAddHeaders withLastModified(DateTime lastModified) {
if (lastModified == null) {
this.lastModified = null;
} else {
this.lastModified = new DateTimeRfc1123(lastModified);
}
return this;
} } | public class class_name {
public PoolAddHeaders withLastModified(DateTime lastModified) {
if (lastModified == null) {
this.lastModified = null; // depends on control dependency: [if], data = [none]
} else {
this.lastModified = new DateTimeRfc1123(lastModified); // depends on control dependency: [if], data = [(lastModified]
}
return this;
} } |
public class class_name {
public JobFile track(FileStatus jobFileStatus) {
String jobfileName = jobFileStatus.getPath().getName();
JobFile jobFile = new JobFile(jobfileName);
// Extra check, caller should already have taken care of this.
if (jobFile.isJobConfFile() || jobFile.isJobHistoryFile()) {
track(jobFile.getJobid());
long modificationTimeMillis = jobFileStatus.getModificationTime();
if (modificationTimeMillis < minModificationTimeMillis) {
minModificationTimeMillis = modificationTimeMillis;
}
if (modificationTimeMillis > maxModificationTimeMillis) {
maxModificationTimeMillis = modificationTimeMillis;
}
}
return jobFile;
} } | public class class_name {
public JobFile track(FileStatus jobFileStatus) {
String jobfileName = jobFileStatus.getPath().getName();
JobFile jobFile = new JobFile(jobfileName);
// Extra check, caller should already have taken care of this.
if (jobFile.isJobConfFile() || jobFile.isJobHistoryFile()) {
track(jobFile.getJobid()); // depends on control dependency: [if], data = [none]
long modificationTimeMillis = jobFileStatus.getModificationTime();
if (modificationTimeMillis < minModificationTimeMillis) {
minModificationTimeMillis = modificationTimeMillis; // depends on control dependency: [if], data = [none]
}
if (modificationTimeMillis > maxModificationTimeMillis) {
maxModificationTimeMillis = modificationTimeMillis; // depends on control dependency: [if], data = [none]
}
}
return jobFile;
} } |
public class class_name {
@SuppressWarnings("unchecked")
private <T> T unmarshal() {
try {
instantiateEntity();
unmarshalIdentifier();
unmarshalKeyAndParentKey();
unmarshalProperties();
unmarshalEmbeddedFields();
// If using Builder pattern, invoke build method on the Builder to
// get the final entity.
ConstructorMetadata constructorMetadata = entityMetadata.getConstructorMetadata();
if (constructorMetadata.isBuilderConstructionStrategy()) {
entity = constructorMetadata.getBuildMethodHandle().invoke(entity);
}
return (T) entity;
} catch (EntityManagerException exp) {
throw exp;
} catch (Throwable t) {
throw new EntityManagerException(t.getMessage(), t);
}
} } | public class class_name {
@SuppressWarnings("unchecked")
private <T> T unmarshal() {
try {
instantiateEntity(); // depends on control dependency: [try], data = [none]
unmarshalIdentifier(); // depends on control dependency: [try], data = [none]
unmarshalKeyAndParentKey(); // depends on control dependency: [try], data = [none]
unmarshalProperties(); // depends on control dependency: [try], data = [none]
unmarshalEmbeddedFields(); // depends on control dependency: [try], data = [none]
// If using Builder pattern, invoke build method on the Builder to
// get the final entity.
ConstructorMetadata constructorMetadata = entityMetadata.getConstructorMetadata();
if (constructorMetadata.isBuilderConstructionStrategy()) {
entity = constructorMetadata.getBuildMethodHandle().invoke(entity); // depends on control dependency: [if], data = [none]
}
return (T) entity; // depends on control dependency: [try], data = [none]
} catch (EntityManagerException exp) {
throw exp;
} catch (Throwable t) { // depends on control dependency: [catch], data = [none]
throw new EntityManagerException(t.getMessage(), t);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public Magnets createMagnets(final WiresShape wiresShape, final Direction[] requestedCardinals)
{
final IPrimitive<?> primTarget = wiresShape.getGroup();
final Point2DArray points = getWiresIntersectionPoints(wiresShape, requestedCardinals);
final ControlHandleList list = new ControlHandleList(primTarget);
final BoundingBox box = wiresShape.getPath().getBoundingBox();
final Point2D primLoc = primTarget.getComputedLocation();
final Magnets magnets = new Magnets(this, list, wiresShape);
int i = 0;
for (final Point2D p : points)
{
final double mx = primLoc.getX() + p.getX();
final double my = primLoc.getY() + p.getY();
final WiresMagnet m = new WiresMagnet(magnets, null, i++, p.getX(), p.getY(), getControlPrimitive(mx, my), true);
final Direction d = getDirection(p, box);
m.setDirection(d);
list.add(m);
}
final String uuid = primTarget.uuid();
m_magnetRegistry.put(uuid, magnets);
wiresShape.setMagnets(magnets);
return magnets;
} } | public class class_name {
public Magnets createMagnets(final WiresShape wiresShape, final Direction[] requestedCardinals)
{
final IPrimitive<?> primTarget = wiresShape.getGroup();
final Point2DArray points = getWiresIntersectionPoints(wiresShape, requestedCardinals);
final ControlHandleList list = new ControlHandleList(primTarget);
final BoundingBox box = wiresShape.getPath().getBoundingBox();
final Point2D primLoc = primTarget.getComputedLocation();
final Magnets magnets = new Magnets(this, list, wiresShape);
int i = 0;
for (final Point2D p : points)
{
final double mx = primLoc.getX() + p.getX();
final double my = primLoc.getY() + p.getY();
final WiresMagnet m = new WiresMagnet(magnets, null, i++, p.getX(), p.getY(), getControlPrimitive(mx, my), true);
final Direction d = getDirection(p, box);
m.setDirection(d); // depends on control dependency: [for], data = [none]
list.add(m); // depends on control dependency: [for], data = [none]
}
final String uuid = primTarget.uuid();
m_magnetRegistry.put(uuid, magnets);
wiresShape.setMagnets(magnets);
return magnets;
} } |
public class class_name {
public void setReplaceInfo(Widget replaceInfo) {
if (m_replaceInfo != null) {
m_replaceInfo.removeFromParent();
}
m_replaceInfo = replaceInfo;
m_mainPanel.insert(m_replaceInfo, 0);
} } | public class class_name {
public void setReplaceInfo(Widget replaceInfo) {
if (m_replaceInfo != null) {
m_replaceInfo.removeFromParent();
// depends on control dependency: [if], data = [none]
}
m_replaceInfo = replaceInfo;
m_mainPanel.insert(m_replaceInfo, 0);
} } |
public class class_name {
@Override
protected void doExecute(ExecutionContext context) {
CommandConsole commandConsole = context.getCommandConsole();
ManifestFileProcessor processor = new ManifestFileProcessor();
for (Map.Entry<String, Map<String, ProvisioningFeatureDefinition>> prodFeatureEntries : processor.getFeatureDefinitionsByProduct().entrySet()) {
String productName = prodFeatureEntries.getKey();
boolean headingPrinted = false;
for (Map.Entry<String, ProvisioningFeatureDefinition> entry : prodFeatureEntries.getValue().entrySet()) {
// entry.getKey() this is the longer Subsystem-SymbolicName
FeatureDefinition featureDefintion = entry.getValue();
String featureName = featureDefintion.getFeatureName();
if (featureDefintion.getVisibility() == Visibility.PUBLIC) {
if (productName.equals(ManifestFileProcessor.CORE_PRODUCT_NAME)) {
commandConsole.printInfoMessage(featureName);
} else {
if (headingPrinted == false) {
commandConsole.printlnInfoMessage("");
commandConsole.printInfoMessage("Product Extension: ");
commandConsole.printlnInfoMessage(productName);
headingPrinted = true;
}
int colonIndex = featureName.indexOf(":");
commandConsole.printInfoMessage(featureName.substring(colonIndex + 1));
}
commandConsole.printInfoMessage(" [");
commandConsole.printInfoMessage(featureDefintion.getVersion().toString());
commandConsole.printlnInfoMessage("]");
}
}
}
} } | public class class_name {
@Override
protected void doExecute(ExecutionContext context) {
CommandConsole commandConsole = context.getCommandConsole();
ManifestFileProcessor processor = new ManifestFileProcessor();
for (Map.Entry<String, Map<String, ProvisioningFeatureDefinition>> prodFeatureEntries : processor.getFeatureDefinitionsByProduct().entrySet()) {
String productName = prodFeatureEntries.getKey();
boolean headingPrinted = false;
for (Map.Entry<String, ProvisioningFeatureDefinition> entry : prodFeatureEntries.getValue().entrySet()) {
// entry.getKey() this is the longer Subsystem-SymbolicName
FeatureDefinition featureDefintion = entry.getValue();
String featureName = featureDefintion.getFeatureName();
if (featureDefintion.getVisibility() == Visibility.PUBLIC) {
if (productName.equals(ManifestFileProcessor.CORE_PRODUCT_NAME)) {
commandConsole.printInfoMessage(featureName); // depends on control dependency: [if], data = [none]
} else {
if (headingPrinted == false) {
commandConsole.printlnInfoMessage(""); // depends on control dependency: [if], data = [none]
commandConsole.printInfoMessage("Product Extension: "); // depends on control dependency: [if], data = [none]
commandConsole.printlnInfoMessage(productName); // depends on control dependency: [if], data = [none]
headingPrinted = true; // depends on control dependency: [if], data = [none]
}
int colonIndex = featureName.indexOf(":");
commandConsole.printInfoMessage(featureName.substring(colonIndex + 1)); // depends on control dependency: [if], data = [none]
}
commandConsole.printInfoMessage(" ["); // depends on control dependency: [if], data = [none]
commandConsole.printInfoMessage(featureDefintion.getVersion().toString()); // depends on control dependency: [if], data = [none]
commandConsole.printlnInfoMessage("]"); // depends on control dependency: [if], data = [none]
}
}
}
} } |
public class class_name {
public static KeyHolder buildRSAKey(int keySize) {
try {
KeyPairGenerator generator = KeyPairGenerator.getInstance("RSA");
generator.initialize(keySize);
KeyPair keyPair = generator.generateKeyPair();
PrivateKey privateKey = keyPair.getPrivate();
PublicKey publicKey = keyPair.getPublic();
return new KeyHolder(privateKey, publicKey);
} catch (NoSuchAlgorithmException e) {
throw new SecureException("当前系统没有提供生成RSA密钥对的算法", e);
}
} } | public class class_name {
public static KeyHolder buildRSAKey(int keySize) {
try {
KeyPairGenerator generator = KeyPairGenerator.getInstance("RSA");
generator.initialize(keySize); // depends on control dependency: [try], data = [none]
KeyPair keyPair = generator.generateKeyPair();
PrivateKey privateKey = keyPair.getPrivate();
PublicKey publicKey = keyPair.getPublic();
return new KeyHolder(privateKey, publicKey); // depends on control dependency: [try], data = [none]
} catch (NoSuchAlgorithmException e) {
throw new SecureException("当前系统没有提供生成RSA密钥对的算法", e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static Long toTimestamp(String dateStr, TimeZone tz) {
int length = dateStr.length();
String format;
if (length == 21) {
format = DEFAULT_DATETIME_FORMATS[1];
} else if (length == 22) {
format = DEFAULT_DATETIME_FORMATS[2];
} else if (length == 23) {
format = DEFAULT_DATETIME_FORMATS[3];
} else {
// otherwise fall back to the default
format = DEFAULT_DATETIME_FORMATS[0];
}
return toTimestamp(dateStr, format, tz);
} } | public class class_name {
public static Long toTimestamp(String dateStr, TimeZone tz) {
int length = dateStr.length();
String format;
if (length == 21) {
format = DEFAULT_DATETIME_FORMATS[1]; // depends on control dependency: [if], data = [none]
} else if (length == 22) {
format = DEFAULT_DATETIME_FORMATS[2]; // depends on control dependency: [if], data = [none]
} else if (length == 23) {
format = DEFAULT_DATETIME_FORMATS[3]; // depends on control dependency: [if], data = [none]
} else {
// otherwise fall back to the default
format = DEFAULT_DATETIME_FORMATS[0]; // depends on control dependency: [if], data = [none]
}
return toTimestamp(dateStr, format, tz);
} } |
public class class_name {
private static String createBaseUrl(AuthleteConfiguration configuration)
{
String baseUrl = configuration.getBaseUrl();
// If the configuration does not contain a base URL.
if (baseUrl == null)
{
throw new IllegalArgumentException("The configuration does not have information about the base URL.");
}
try
{
// Check whether the format of the given URL is valid.
new URL(baseUrl);
}
catch (MalformedURLException e)
{
// The format of the base URL is wrong.
throw new IllegalArgumentException("The base URL is malformed.", e);
}
if (baseUrl.endsWith("/"))
{
// Drop the '/' at the end of the URL.
return baseUrl.substring(0, baseUrl.length() - 1);
}
else
{
// Use the value of the base URL without modification.
return baseUrl;
}
} } | public class class_name {
private static String createBaseUrl(AuthleteConfiguration configuration)
{
String baseUrl = configuration.getBaseUrl();
// If the configuration does not contain a base URL.
if (baseUrl == null)
{
throw new IllegalArgumentException("The configuration does not have information about the base URL.");
}
try
{
// Check whether the format of the given URL is valid.
new URL(baseUrl); // depends on control dependency: [try], data = [none]
}
catch (MalformedURLException e)
{
// The format of the base URL is wrong.
throw new IllegalArgumentException("The base URL is malformed.", e);
} // depends on control dependency: [catch], data = [none]
if (baseUrl.endsWith("/"))
{
// Drop the '/' at the end of the URL.
return baseUrl.substring(0, baseUrl.length() - 1); // depends on control dependency: [if], data = [none]
}
else
{
// Use the value of the base URL without modification.
return baseUrl; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public BigDecimal divideToIntegralValue(BigDecimal divisor) {
// Calculate preferred scale
int preferredScale = saturateLong((long) this.scale - divisor.scale);
if (this.compareMagnitude(divisor) < 0) {
// much faster when this << divisor
return zeroValueOf(preferredScale);
}
if (this.signum() == 0 && divisor.signum() != 0)
return this.setScale(preferredScale, ROUND_UNNECESSARY);
// Perform a divide with enough digits to round to a correct
// integer value; then remove any fractional digits
int maxDigits = (int)Math.min(this.precision() +
(long)Math.ceil(10.0*divisor.precision()/3.0) +
Math.abs((long)this.scale() - divisor.scale()) + 2,
Integer.MAX_VALUE);
BigDecimal quotient = this.divide(divisor, new MathContext(maxDigits,
RoundingMode.DOWN));
if (quotient.scale > 0) {
quotient = quotient.setScale(0, RoundingMode.DOWN);
quotient = stripZerosToMatchScale(quotient.intVal, quotient.intCompact, quotient.scale, preferredScale);
}
if (quotient.scale < preferredScale) {
// pad with zeros if necessary
quotient = quotient.setScale(preferredScale, ROUND_UNNECESSARY);
}
return quotient;
} } | public class class_name {
public BigDecimal divideToIntegralValue(BigDecimal divisor) {
// Calculate preferred scale
int preferredScale = saturateLong((long) this.scale - divisor.scale);
if (this.compareMagnitude(divisor) < 0) {
// much faster when this << divisor
return zeroValueOf(preferredScale); // depends on control dependency: [if], data = [none]
}
if (this.signum() == 0 && divisor.signum() != 0)
return this.setScale(preferredScale, ROUND_UNNECESSARY);
// Perform a divide with enough digits to round to a correct
// integer value; then remove any fractional digits
int maxDigits = (int)Math.min(this.precision() +
(long)Math.ceil(10.0*divisor.precision()/3.0) +
Math.abs((long)this.scale() - divisor.scale()) + 2,
Integer.MAX_VALUE);
BigDecimal quotient = this.divide(divisor, new MathContext(maxDigits,
RoundingMode.DOWN));
if (quotient.scale > 0) {
quotient = quotient.setScale(0, RoundingMode.DOWN); // depends on control dependency: [if], data = [none]
quotient = stripZerosToMatchScale(quotient.intVal, quotient.intCompact, quotient.scale, preferredScale); // depends on control dependency: [if], data = [none]
}
if (quotient.scale < preferredScale) {
// pad with zeros if necessary
quotient = quotient.setScale(preferredScale, ROUND_UNNECESSARY); // depends on control dependency: [if], data = [none]
}
return quotient;
} } |
public class class_name {
private Option toOption(CliOption cliParam) {
Option.Builder builder = builder(cliParam.value()).hasArg(cliParam.hasArg())
.required(cliParam.required());
if (!cliParam.longOpt().isEmpty()) {
builder.longOpt(cliParam.longOpt());
}
if (!cliParam.desc().isEmpty()) {
builder.desc(cliParam.desc());
}
return builder.build();
} } | public class class_name {
private Option toOption(CliOption cliParam) {
Option.Builder builder = builder(cliParam.value()).hasArg(cliParam.hasArg())
.required(cliParam.required());
if (!cliParam.longOpt().isEmpty()) {
builder.longOpt(cliParam.longOpt()); // depends on control dependency: [if], data = [none]
}
if (!cliParam.desc().isEmpty()) {
builder.desc(cliParam.desc()); // depends on control dependency: [if], data = [none]
}
return builder.build();
} } |
public class class_name {
public SQLGenerator newInstance() throws SQLException,
NoCompatibleSQLGeneratorException,
SQLGeneratorLoadException {
Logger logger = SQLGenUtil.logger();
logger.fine("Loading a compatible SQL generator");
ServiceLoader<SQLGenerator> candidates =
ServiceLoader.load(SQLGenerator.class);
/*
* candidates will never be null, even if we mess up and forget to
* create a provider-configuration file for ProtempaSQLGenerator.
*/
try {
for (SQLGenerator candidateInstance : candidates) {
candidateInstance.loadDriverIfNeeded();
}
for (SQLGenerator candidateInstance : candidates) {
logger.log(Level.FINER,
"Checking compatibility of SQL generator {0}",
candidateInstance.getClass().getName());
String forcedSQLGenerator =
System.getProperty(
SQLGenUtil.SYSTEM_PROPERTY_FORCE_SQL_GENERATOR);
if (forcedSQLGenerator != null) {
if (forcedSQLGenerator.equals(
candidateInstance.getClass().getName())) {
logger.log(Level.INFO,
"Forcing use of SQL generator {0}",
candidateInstance.getClass().getName());
candidateInstance.initialize(
this.backend.isDryRun() ? null : this.connectionSpec,
this.relationalDatabaseSpec,
this.backend);
logger.log(Level.FINE, "SQL generator {0} is loaded",
candidateInstance.getClass().getName());
return candidateInstance;
}
} else {
/*
* We get a new connection for each compatibility check so that
* no state (or a closed connection!) is carried over.
*/
Connection con = this.connectionSpec.getOrCreate();
try {
if (candidateInstance.checkCompatibility(con)) {
DatabaseMetaData metaData = con.getMetaData();
logCompatibility(logger, candidateInstance,
metaData);
candidateInstance.initialize(
this.backend.isDryRun() ? null : this.connectionSpec,
this.relationalDatabaseSpec,
this.backend);
logger.log(Level.FINE, "SQL generator {0} is loaded",
candidateInstance.getClass().getName());
return candidateInstance;
}
con.close();
con = null;
} finally {
if (con != null) {
try {
con.close();
} catch (SQLException ex) {
}
}
}
logger.log(Level.FINER,
"SQL generator {0} is not compatible",
candidateInstance.getClass().getName());
}
}
} catch (ServiceConfigurationError sce) {
throw new SQLGeneratorLoadException(
"Could not load SQL generators", sce);
}
throw new NoCompatibleSQLGeneratorException(
"Could not find a SQL generator that is compatible with your database and available JDBC drivers");
} } | public class class_name {
public SQLGenerator newInstance() throws SQLException,
NoCompatibleSQLGeneratorException,
SQLGeneratorLoadException {
Logger logger = SQLGenUtil.logger();
logger.fine("Loading a compatible SQL generator");
ServiceLoader<SQLGenerator> candidates =
ServiceLoader.load(SQLGenerator.class);
/*
* candidates will never be null, even if we mess up and forget to
* create a provider-configuration file for ProtempaSQLGenerator.
*/
try {
for (SQLGenerator candidateInstance : candidates) {
candidateInstance.loadDriverIfNeeded(); // depends on control dependency: [for], data = [candidateInstance]
}
for (SQLGenerator candidateInstance : candidates) {
logger.log(Level.FINER,
"Checking compatibility of SQL generator {0}",
candidateInstance.getClass().getName()); // depends on control dependency: [for], data = [none]
String forcedSQLGenerator =
System.getProperty(
SQLGenUtil.SYSTEM_PROPERTY_FORCE_SQL_GENERATOR);
if (forcedSQLGenerator != null) {
if (forcedSQLGenerator.equals(
candidateInstance.getClass().getName())) {
logger.log(Level.INFO,
"Forcing use of SQL generator {0}",
candidateInstance.getClass().getName()); // depends on control dependency: [if], data = [none]
candidateInstance.initialize(
this.backend.isDryRun() ? null : this.connectionSpec,
this.relationalDatabaseSpec,
this.backend); // depends on control dependency: [if], data = [none]
logger.log(Level.FINE, "SQL generator {0} is loaded",
candidateInstance.getClass().getName()); // depends on control dependency: [if], data = [none]
return candidateInstance; // depends on control dependency: [if], data = [none]
}
} else {
/*
* We get a new connection for each compatibility check so that
* no state (or a closed connection!) is carried over.
*/
Connection con = this.connectionSpec.getOrCreate();
try {
if (candidateInstance.checkCompatibility(con)) {
DatabaseMetaData metaData = con.getMetaData();
logCompatibility(logger, candidateInstance,
metaData); // depends on control dependency: [if], data = [none]
candidateInstance.initialize(
this.backend.isDryRun() ? null : this.connectionSpec,
this.relationalDatabaseSpec,
this.backend); // depends on control dependency: [if], data = [none]
logger.log(Level.FINE, "SQL generator {0} is loaded",
candidateInstance.getClass().getName()); // depends on control dependency: [if], data = [none]
return candidateInstance; // depends on control dependency: [if], data = [none]
}
con.close(); // depends on control dependency: [try], data = [none]
con = null; // depends on control dependency: [try], data = [none]
} finally {
if (con != null) {
try {
con.close(); // depends on control dependency: [try], data = [none]
} catch (SQLException ex) {
} // depends on control dependency: [catch], data = [none]
}
}
logger.log(Level.FINER,
"SQL generator {0} is not compatible",
candidateInstance.getClass().getName()); // depends on control dependency: [if], data = [none]
}
}
} catch (ServiceConfigurationError sce) {
throw new SQLGeneratorLoadException(
"Could not load SQL generators", sce);
}
throw new NoCompatibleSQLGeneratorException(
"Could not find a SQL generator that is compatible with your database and available JDBC drivers");
} } |
public class class_name {
public ProviderConfig<T> setServer(ServerConfig server) {
if (this.server == null) {
this.server = new ArrayList<ServerConfig>();
}
this.server.add(server);
return this;
} } | public class class_name {
public ProviderConfig<T> setServer(ServerConfig server) {
if (this.server == null) {
this.server = new ArrayList<ServerConfig>(); // depends on control dependency: [if], data = [none]
}
this.server.add(server);
return this;
} } |
public class class_name {
public static boolean validate(Control control) {
ValidationFacade facade = (ValidationFacade) control.getParent();
for (ValidatorBase validator : facade.validators) {
validator.setSrcControl(facade.controlProperty.get());
validator.validate();
if (validator.getHasErrors()) {
facade.activeValidator.set(validator);
control.pseudoClassStateChanged(PSEUDO_CLASS_ERROR, true);
return false;
}
}
control.pseudoClassStateChanged(PSEUDO_CLASS_ERROR, false);
facade.activeValidator.set(null);
return true;
} } | public class class_name {
public static boolean validate(Control control) {
ValidationFacade facade = (ValidationFacade) control.getParent();
for (ValidatorBase validator : facade.validators) {
validator.setSrcControl(facade.controlProperty.get()); // depends on control dependency: [for], data = [validator]
validator.validate(); // depends on control dependency: [for], data = [validator]
if (validator.getHasErrors()) {
facade.activeValidator.set(validator); // depends on control dependency: [if], data = [none]
control.pseudoClassStateChanged(PSEUDO_CLASS_ERROR, true); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
}
control.pseudoClassStateChanged(PSEUDO_CLASS_ERROR, false);
facade.activeValidator.set(null);
return true;
} } |
public class class_name {
public QueryBuilder<T, ID> selectRaw(String... columns) {
for (String column : columns) {
addSelectToList(ColumnNameOrRawSql.withRawSql(column));
}
return this;
} } | public class class_name {
public QueryBuilder<T, ID> selectRaw(String... columns) {
for (String column : columns) {
addSelectToList(ColumnNameOrRawSql.withRawSql(column)); // depends on control dependency: [for], data = [column]
}
return this;
} } |
public class class_name {
@Override
public String getName() {
final Object attributeValue = this.getAttributeValue(this.userNameAttribute);
if (attributeValue == null) {
return null;
}
return attributeValue.toString();
} } | public class class_name {
@Override
public String getName() {
final Object attributeValue = this.getAttributeValue(this.userNameAttribute);
if (attributeValue == null) {
return null; // depends on control dependency: [if], data = [none]
}
return attributeValue.toString();
} } |
public class class_name {
public void marshall(LogsLocation logsLocation, ProtocolMarshaller protocolMarshaller) {
if (logsLocation == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(logsLocation.getGroupName(), GROUPNAME_BINDING);
protocolMarshaller.marshall(logsLocation.getStreamName(), STREAMNAME_BINDING);
protocolMarshaller.marshall(logsLocation.getDeepLink(), DEEPLINK_BINDING);
protocolMarshaller.marshall(logsLocation.getS3DeepLink(), S3DEEPLINK_BINDING);
protocolMarshaller.marshall(logsLocation.getCloudWatchLogs(), CLOUDWATCHLOGS_BINDING);
protocolMarshaller.marshall(logsLocation.getS3Logs(), S3LOGS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(LogsLocation logsLocation, ProtocolMarshaller protocolMarshaller) {
if (logsLocation == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(logsLocation.getGroupName(), GROUPNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(logsLocation.getStreamName(), STREAMNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(logsLocation.getDeepLink(), DEEPLINK_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(logsLocation.getS3DeepLink(), S3DEEPLINK_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(logsLocation.getCloudWatchLogs(), CLOUDWATCHLOGS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(logsLocation.getS3Logs(), S3LOGS_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 {
double getChainArea(int chain) {
int chainIndex = getChainIndex_(chain);
double v = m_chainAreas.read(chainIndex);
if (NumberUtils.isNaN(v)) {
updateChainAreaAndPerimeter_(chain);
v = m_chainAreas.read(chainIndex);
}
return v;
} } | public class class_name {
double getChainArea(int chain) {
int chainIndex = getChainIndex_(chain);
double v = m_chainAreas.read(chainIndex);
if (NumberUtils.isNaN(v)) {
updateChainAreaAndPerimeter_(chain); // depends on control dependency: [if], data = [none]
v = m_chainAreas.read(chainIndex); // depends on control dependency: [if], data = [none]
}
return v;
} } |
public class class_name {
private void writeToFile(String filename, File outputDir) {
File outFile = new File(outputDir, filename);
OutputStream os;
try {
os = new FileOutputStream(outFile);
} catch (FileNotFoundException e) {
throw new UIMARuntimeException(e);
}
InputStream is = null;
try {
is = ResourceHelper.getInputStream("viewer/" + filename);
byte[] buf = new byte[1024];
int numRead;
while ((numRead = is.read(buf)) > 0) {
os.write(buf, 0, numRead);
}
} catch (IOException e) {
throw new UIMARuntimeException(e);
} finally {
try {
is.close();
} catch (IOException e) {
// ignore close errors
}
try {
os.close();
} catch (IOException e) {
// ignore close errors
}
}
} } | public class class_name {
private void writeToFile(String filename, File outputDir) {
File outFile = new File(outputDir, filename);
OutputStream os;
try {
os = new FileOutputStream(outFile); // depends on control dependency: [try], data = [none]
} catch (FileNotFoundException e) {
throw new UIMARuntimeException(e);
} // depends on control dependency: [catch], data = [none]
InputStream is = null;
try {
is = ResourceHelper.getInputStream("viewer/" + filename); // depends on control dependency: [try], data = [none]
byte[] buf = new byte[1024];
int numRead;
while ((numRead = is.read(buf)) > 0) {
os.write(buf, 0, numRead); // depends on control dependency: [while], data = [none]
}
} catch (IOException e) {
throw new UIMARuntimeException(e);
} finally { // depends on control dependency: [catch], data = [none]
try {
is.close(); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
// ignore close errors
} // depends on control dependency: [catch], data = [none]
try {
os.close(); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
// ignore close errors
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
@SuppressWarnings("LocalVariableHidesMemberVariable")
private void handleLinks(HttpResponse response) {
Map<String, Map<URI, String>> links = new HashMap<>();
Map<String, String> linkTemplates = new HashMap<>();
handleHeaderLinks(response, links, linkTemplates);
HttpEntity entity = response.getEntity();
if (entity != null) {
Header contentType = entity.getContentType();
if ((contentType != null) && contentType.getValue().startsWith("application/json")) {
try {
handleBodyLinks(serializer.readTree(entity.getContent()), links, linkTemplates);
} catch (IOException ex) {
throw new RuntimeException();
// Body error handling is done elsewhere
}
}
}
this.links = unmodifiableMap(links);
this.linkTemplates = unmodifiableMap(linkTemplates);
} } | public class class_name {
@SuppressWarnings("LocalVariableHidesMemberVariable")
private void handleLinks(HttpResponse response) {
Map<String, Map<URI, String>> links = new HashMap<>();
Map<String, String> linkTemplates = new HashMap<>();
handleHeaderLinks(response, links, linkTemplates);
HttpEntity entity = response.getEntity();
if (entity != null) {
Header contentType = entity.getContentType();
if ((contentType != null) && contentType.getValue().startsWith("application/json")) {
try {
handleBodyLinks(serializer.readTree(entity.getContent()), links, linkTemplates); // depends on control dependency: [try], data = [none]
} catch (IOException ex) {
throw new RuntimeException();
// Body error handling is done elsewhere
} // depends on control dependency: [catch], data = [none]
}
}
this.links = unmodifiableMap(links);
this.linkTemplates = unmodifiableMap(linkTemplates);
} } |
public class class_name {
public PropertyIdentifier getPropertyIdentifier(String entityType, List<String> propertyPath, int requiredDepth) {
// we analyze the property path to find all the associations/embedded which are in the way and create proper
// aliases for them
String entityAlias = aliasResolver.findAliasForType( entityType );
String propertyEntityType = entityType;
String propertyAlias = entityAlias;
String propertyName;
List<String> currentPropertyPath = new ArrayList<>();
List<String> lastAssociationPath = Collections.emptyList();
OgmEntityPersister currentPersister = getPersister( entityType );
boolean isLastElementAssociation = false;
int depth = 1;
for ( String property : propertyPath ) {
currentPropertyPath.add( property );
Type currentPropertyType = getPropertyType( entityType, currentPropertyPath );
// determine if the current property path is still part of requiredPropertyMatch
boolean optionalMatch = depth > requiredDepth;
if ( currentPropertyType.isAssociationType() ) {
AssociationType associationPropertyType = (AssociationType) currentPropertyType;
Joinable associatedJoinable = associationPropertyType.getAssociatedJoinable( getSessionFactory() );
if ( associatedJoinable.isCollection()
&& !( (OgmCollectionPersister) associatedJoinable ).getType().isEntityType() ) {
// we have a collection of embedded
propertyAlias = aliasResolver.createAliasForEmbedded( entityAlias, currentPropertyPath, optionalMatch );
}
else {
propertyEntityType = associationPropertyType.getAssociatedEntityName( getSessionFactory() );
currentPersister = getPersister( propertyEntityType );
String targetNodeType = currentPersister.getEntityKeyMetadata().getTable();
propertyAlias = aliasResolver.createAliasForAssociation( entityAlias, currentPropertyPath, targetNodeType, optionalMatch );
lastAssociationPath = new ArrayList<>( currentPropertyPath );
isLastElementAssociation = true;
}
}
else if ( currentPropertyType.isComponentType()
&& !isIdProperty( currentPersister, propertyPath.subList( lastAssociationPath.size(), propertyPath.size() ) ) ) {
// we are in the embedded case and the embedded is not the id of the entity (the id is stored as normal
// properties)
propertyAlias = aliasResolver.createAliasForEmbedded( entityAlias, currentPropertyPath, optionalMatch );
}
else {
isLastElementAssociation = false;
}
depth++;
}
if ( isLastElementAssociation ) {
// even the last element is an association, we need to find a suitable identifier property
propertyName = getSessionFactory().getMetamodel().entityPersister( propertyEntityType ).getIdentifierPropertyName();
}
else {
// the last element is a property so we can build the test with this property
propertyName = getColumnName( propertyEntityType, propertyPath.subList( lastAssociationPath.size(), propertyPath.size() ) );
}
return new PropertyIdentifier( propertyAlias, propertyName );
} } | public class class_name {
public PropertyIdentifier getPropertyIdentifier(String entityType, List<String> propertyPath, int requiredDepth) {
// we analyze the property path to find all the associations/embedded which are in the way and create proper
// aliases for them
String entityAlias = aliasResolver.findAliasForType( entityType );
String propertyEntityType = entityType;
String propertyAlias = entityAlias;
String propertyName;
List<String> currentPropertyPath = new ArrayList<>();
List<String> lastAssociationPath = Collections.emptyList();
OgmEntityPersister currentPersister = getPersister( entityType );
boolean isLastElementAssociation = false;
int depth = 1;
for ( String property : propertyPath ) {
currentPropertyPath.add( property ); // depends on control dependency: [for], data = [property]
Type currentPropertyType = getPropertyType( entityType, currentPropertyPath );
// determine if the current property path is still part of requiredPropertyMatch
boolean optionalMatch = depth > requiredDepth;
if ( currentPropertyType.isAssociationType() ) {
AssociationType associationPropertyType = (AssociationType) currentPropertyType;
Joinable associatedJoinable = associationPropertyType.getAssociatedJoinable( getSessionFactory() );
if ( associatedJoinable.isCollection()
&& !( (OgmCollectionPersister) associatedJoinable ).getType().isEntityType() ) {
// we have a collection of embedded
propertyAlias = aliasResolver.createAliasForEmbedded( entityAlias, currentPropertyPath, optionalMatch ); // depends on control dependency: [if], data = [none]
}
else {
propertyEntityType = associationPropertyType.getAssociatedEntityName( getSessionFactory() ); // depends on control dependency: [if], data = [none]
currentPersister = getPersister( propertyEntityType ); // depends on control dependency: [if], data = [none]
String targetNodeType = currentPersister.getEntityKeyMetadata().getTable();
propertyAlias = aliasResolver.createAliasForAssociation( entityAlias, currentPropertyPath, targetNodeType, optionalMatch ); // depends on control dependency: [if], data = [none]
lastAssociationPath = new ArrayList<>( currentPropertyPath ); // depends on control dependency: [if], data = [none]
isLastElementAssociation = true; // depends on control dependency: [if], data = [none]
}
}
else if ( currentPropertyType.isComponentType()
&& !isIdProperty( currentPersister, propertyPath.subList( lastAssociationPath.size(), propertyPath.size() ) ) ) {
// we are in the embedded case and the embedded is not the id of the entity (the id is stored as normal
// properties)
propertyAlias = aliasResolver.createAliasForEmbedded( entityAlias, currentPropertyPath, optionalMatch ); // depends on control dependency: [if], data = [none]
}
else {
isLastElementAssociation = false; // depends on control dependency: [if], data = [none]
}
depth++; // depends on control dependency: [for], data = [none]
}
if ( isLastElementAssociation ) {
// even the last element is an association, we need to find a suitable identifier property
propertyName = getSessionFactory().getMetamodel().entityPersister( propertyEntityType ).getIdentifierPropertyName(); // depends on control dependency: [if], data = [none]
}
else {
// the last element is a property so we can build the test with this property
propertyName = getColumnName( propertyEntityType, propertyPath.subList( lastAssociationPath.size(), propertyPath.size() ) ); // depends on control dependency: [if], data = [none]
}
return new PropertyIdentifier( propertyAlias, propertyName );
} } |
public class class_name {
public void stop() {
syncLock.lock();
try {
if (syncThread == null) {
return;
}
instanceChangeStreamListener.stop();
syncThread.interrupt();
try {
syncThread.join();
} catch (final InterruptedException e) {
return;
}
syncThread = null;
isRunning = false;
} finally {
syncLock.unlock();
}
} } | public class class_name {
public void stop() {
syncLock.lock();
try {
if (syncThread == null) {
return; // depends on control dependency: [if], data = [none]
}
instanceChangeStreamListener.stop(); // depends on control dependency: [try], data = [none]
syncThread.interrupt(); // depends on control dependency: [try], data = [none]
try {
syncThread.join(); // depends on control dependency: [try], data = [none]
} catch (final InterruptedException e) {
return;
} // depends on control dependency: [catch], data = [none]
syncThread = null; // depends on control dependency: [try], data = [none]
isRunning = false; // depends on control dependency: [try], data = [none]
} finally {
syncLock.unlock();
}
} } |
public class class_name {
@Override
public void dereferenceLocalisation(LocalizationPoint ptoPMessageItemStream)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "dereferenceLocalisation", new Object[] { ptoPMessageItemStream, this });
_localisationManager.dereferenceLocalisation(ptoPMessageItemStream);
// Reset the reference to the local messages itemstream if it is being removed.
if (ptoPMessageItemStream
.getLocalizingMEUuid()
.equals(_messageProcessor.getMessagingEngineUuid()))
{
_pToPLocalMsgsItemStream = null;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "dereferenceLocalisation");
} } | public class class_name {
@Override
public void dereferenceLocalisation(LocalizationPoint ptoPMessageItemStream)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "dereferenceLocalisation", new Object[] { ptoPMessageItemStream, this });
_localisationManager.dereferenceLocalisation(ptoPMessageItemStream);
// Reset the reference to the local messages itemstream if it is being removed.
if (ptoPMessageItemStream
.getLocalizingMEUuid()
.equals(_messageProcessor.getMessagingEngineUuid()))
{
_pToPLocalMsgsItemStream = null; // depends on control dependency: [if], data = [none]
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "dereferenceLocalisation");
} } |
public class class_name {
public static String resolveEnvironmentsParameters(String expression) {
// Si l'expression est vide
if(expression == null || expression.trim().length() == 0) {
// On retourne null
return null;
}
// Tant que la chaene traitee contient des ENVs
while(isExpressionContainPattern(expression, ENV_CHAIN_PATTERN)) {
// Obtention de la liste des ENVs
String[] envs = extractToken(expression, ENV_CHAIN_PATTERN);
// Parcours
for (String env : envs) {
String cleanEnv = env.replace("${", "");
cleanEnv = cleanEnv.replace("}", "");
// On remplace l'occurence courante par le nom de la variable
expression = expression.replace(env, System.getProperty(cleanEnv));
}
}
// On retourne l'expression
return expression;
} } | public class class_name {
public static String resolveEnvironmentsParameters(String expression) {
// Si l'expression est vide
if(expression == null || expression.trim().length() == 0) {
// On retourne null
return null;
// depends on control dependency: [if], data = [none]
}
// Tant que la chaene traitee contient des ENVs
while(isExpressionContainPattern(expression, ENV_CHAIN_PATTERN)) {
// Obtention de la liste des ENVs
String[] envs = extractToken(expression, ENV_CHAIN_PATTERN);
// Parcours
for (String env : envs) {
String cleanEnv = env.replace("${", "");
cleanEnv = cleanEnv.replace("}", "");
// depends on control dependency: [for], data = [none]
// On remplace l'occurence courante par le nom de la variable
expression = expression.replace(env, System.getProperty(cleanEnv));
// depends on control dependency: [for], data = [env]
}
}
// On retourne l'expression
return expression;
} } |
public class class_name {
private synchronized void initBuckets() {
final SparseIntArray bucketSizes = mPoolParams.bucketSizes;
// create the buckets
if (bucketSizes != null) {
fillBuckets(bucketSizes);
mAllowNewBuckets = false;
} else {
mAllowNewBuckets = true;
}
} } | public class class_name {
private synchronized void initBuckets() {
final SparseIntArray bucketSizes = mPoolParams.bucketSizes;
// create the buckets
if (bucketSizes != null) {
fillBuckets(bucketSizes); // depends on control dependency: [if], data = [(bucketSizes]
mAllowNewBuckets = false; // depends on control dependency: [if], data = [none]
} else {
mAllowNewBuckets = true; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void removeWebApplication(DeployedModule deployedModule, String contextRoot) {
//boolean restarting = deployedModule.isRestarting();
if (TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE))
logger.logp(Level.FINE, CLASS_NAME, "removeWebApplication", "ContextRoot : " + contextRoot);
String ct = makeProperContextRoot(deployedModule.getContextRoot()); // proper
String mapRoot = makeMappingContextRoot(ct);
//PK37449 adding synchronization block
// removeMappedObject uses the mapped root (the same format that was used to add it)
// removeMappedObject is synchronized, and returns the object that was removed from the map (if there was one)
WebGroup webGroup = (WebGroup) removeMappedObject(mapRoot);
if (webGroup != null) {
// Begin 284644, reverse removal of web applications from map to prevent requests from coming in after app removed
// Liberty: removed redundant call to remove mapping: call to removeMappedObject does what is needed
webGroup.removeWebApplication(deployedModule);
// End 284644, reverse removal of web applications from map to prevent requests from coming in after app removed
//PK37449 adding trace and call to removeSubContainer() from AbstractContainer.
// The call that was in WebGroup was removed.
if (TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE))
logger.logp(Level.FINE, CLASS_NAME, "removeWebApplication", "name: " + webGroup.getName());
//if (!restarting)
removeSubContainer(webGroup.getName());
//PK37449 end
}
} } | public class class_name {
public void removeWebApplication(DeployedModule deployedModule, String contextRoot) {
//boolean restarting = deployedModule.isRestarting();
if (TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE))
logger.logp(Level.FINE, CLASS_NAME, "removeWebApplication", "ContextRoot : " + contextRoot);
String ct = makeProperContextRoot(deployedModule.getContextRoot()); // proper
String mapRoot = makeMappingContextRoot(ct);
//PK37449 adding synchronization block
// removeMappedObject uses the mapped root (the same format that was used to add it)
// removeMappedObject is synchronized, and returns the object that was removed from the map (if there was one)
WebGroup webGroup = (WebGroup) removeMappedObject(mapRoot);
if (webGroup != null) {
// Begin 284644, reverse removal of web applications from map to prevent requests from coming in after app removed
// Liberty: removed redundant call to remove mapping: call to removeMappedObject does what is needed
webGroup.removeWebApplication(deployedModule); // depends on control dependency: [if], data = [none]
// End 284644, reverse removal of web applications from map to prevent requests from coming in after app removed
//PK37449 adding trace and call to removeSubContainer() from AbstractContainer.
// The call that was in WebGroup was removed.
if (TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE))
logger.logp(Level.FINE, CLASS_NAME, "removeWebApplication", "name: " + webGroup.getName());
//if (!restarting)
removeSubContainer(webGroup.getName()); // depends on control dependency: [if], data = [(webGroup]
//PK37449 end
}
} } |
public class class_name {
@Override
protected void _fit(Dataframe trainingData) {
TrainingParameters trainingParameters = knowledgeBase.getTrainingParameters();
Configuration configuration = knowledgeBase.getConfiguration();
//reset previous entries on the bundle
resetBundle();
//perform stepwise
int maxIterations = trainingParameters.getMaxIterations();
double aOut = trainingParameters.getAout();
//copy data before starting
Dataframe copiedTrainingData = trainingData.copy();
//backword elimination algorithm
for(int iteration = 0; iteration<maxIterations ; ++iteration) {
Map<Object, Double> pvalues = runRegression(copiedTrainingData);
if(pvalues.isEmpty()) {
break; //no more features
}
//fetch the feature with highest pvalue, excluding constant
pvalues.remove(Dataframe.COLUMN_NAME_CONSTANT);
Map.Entry<Object, Double> maxPvalueEntry = MapMethods.selectMaxKeyValue(pvalues);
//pvalues=null;
if(maxPvalueEntry.getValue()<=aOut) {
break; //nothing to remove, the highest pvalue is less than the aOut
}
Set<Object> removedFeatures = new HashSet<>();
removedFeatures.add(maxPvalueEntry.getKey());
copiedTrainingData.dropXColumns(removedFeatures);
//removedFeatures = null;
if(copiedTrainingData.xColumnSize()==0) {
break; //if no more features exit
}
}
//once we have the dataset has been cleared from the unnecessary columns train the model once again
AbstractRegressor mlregressor = MLBuilder.create(
knowledgeBase.getTrainingParameters().getRegressionTrainingParameters(),
configuration
);
mlregressor.fit(copiedTrainingData);
bundle.put(REG_KEY, mlregressor);
copiedTrainingData.close();
} } | public class class_name {
@Override
protected void _fit(Dataframe trainingData) {
TrainingParameters trainingParameters = knowledgeBase.getTrainingParameters();
Configuration configuration = knowledgeBase.getConfiguration();
//reset previous entries on the bundle
resetBundle();
//perform stepwise
int maxIterations = trainingParameters.getMaxIterations();
double aOut = trainingParameters.getAout();
//copy data before starting
Dataframe copiedTrainingData = trainingData.copy();
//backword elimination algorithm
for(int iteration = 0; iteration<maxIterations ; ++iteration) {
Map<Object, Double> pvalues = runRegression(copiedTrainingData);
if(pvalues.isEmpty()) {
break; //no more features
}
//fetch the feature with highest pvalue, excluding constant
pvalues.remove(Dataframe.COLUMN_NAME_CONSTANT); // depends on control dependency: [for], data = [none]
Map.Entry<Object, Double> maxPvalueEntry = MapMethods.selectMaxKeyValue(pvalues);
//pvalues=null;
if(maxPvalueEntry.getValue()<=aOut) {
break; //nothing to remove, the highest pvalue is less than the aOut
}
Set<Object> removedFeatures = new HashSet<>();
removedFeatures.add(maxPvalueEntry.getKey()); // depends on control dependency: [for], data = [none]
copiedTrainingData.dropXColumns(removedFeatures); // depends on control dependency: [for], data = [none]
//removedFeatures = null;
if(copiedTrainingData.xColumnSize()==0) {
break; //if no more features exit
}
}
//once we have the dataset has been cleared from the unnecessary columns train the model once again
AbstractRegressor mlregressor = MLBuilder.create(
knowledgeBase.getTrainingParameters().getRegressionTrainingParameters(),
configuration
);
mlregressor.fit(copiedTrainingData);
bundle.put(REG_KEY, mlregressor);
copiedTrainingData.close();
} } |
public class class_name {
@Override
public boolean accept(RepositoryLogRecord record) {
/*
* Logic operates under assumption that record will be accepted by default, therefore
* filtering check if record should be excluded
*/
// Filtering by threadID
if (filterThread) {
if (intThreadID != record.getThreadID()) {
return false; // no need to continue, this record does not pass
}
}
// Filtering by level
if (filterLevel) {
if (minLevel != null) {
if (record.getLevel().intValue() < minLevel.intValue()) {
return false; // no need to continue, this record does not pass
}
}
if (maxLevel != null) {
if (record.getLevel().intValue() > maxLevel.intValue()) {
return false; // no need to continue, this record does not pass
}
}
}
// Filtering by Date/Time
if (filterTime) {
Date recordDate = new Date();
recordDate.setTime(record.getMillis());
if (startDate != null) {
if (recordDate.before(startDate)) {
return false; // no need to continue, this record does not
// pass
}
}
if (stopDate != null) {
if (recordDate.after(stopDate)) {
return false; // no need to continue, this record does not
// pass
}
}
}
// Filtering by Logger
if (filterLoggers) {
/*
* Can't return false at first filter out in case of loggers cause it's possible
* that a more specific include could over-ride the exclude. So we check them all -
* and track the highest include and exclude matches. If there are no matches for
* either include or exclude default is to exclude it.
*/
int excludeMatchLevel = -1;
int includeMatchLevel = -1;
if (excludeLoggers != null) {
for (String x : exLoggers) {
if (record.getLoggerName() != null && record.getLoggerName().matches(x.replace("*", ".*"))) {
int tmpInt = x.split("\\.").length;
if (tmpInt > excludeMatchLevel)
// This match is higher than any previous matches
excludeMatchLevel = tmpInt;
}
}
} else
excludeMatchLevel = 0; // Equivalent of excludeLoggers="*"
if (includeLoggers != null) {
for (String x : inLoggers) {
if (record.getLoggerName() != null && record.getLoggerName().matches(x.replace("*", ".*"))) {
int tmpInt = x.split("\\.").length;
if (tmpInt > includeMatchLevel)
// This match is higher than any previous matches
includeMatchLevel = tmpInt;
}
}
} else
includeMatchLevel = 0; // Equivalent of includeLoggers="*"
// Only want to accept the record if it matches an include, and does
// not match an exclude (of greater value if it matches both).
if (includeLoggers == null) {
// default include is *
}
// Using equals on match level, so default will be to exclude a record if user has
// defined both include and exclude Logger criteria and we did not match on either
// case
if (includeMatchLevel <= excludeMatchLevel)
return false;
}
// Filtering by message
if (filterMessage) {
String recordMessage = (record.getFormattedMessage() != null) ? record.getFormattedMessage() : record.getRawMessage();
if (recordMessage == null) {
return false;
}
recordMessage = recordMessage.replace("\n", "").replace("\r", "");
if (messageRegExp != null) {
boolean foundmessagekey = messageRegExp.matcher(recordMessage).find();
if (!foundmessagekey) {
return false;
}
}
if (excludeMessages != null) {
for (Pattern p : excludeMessagesRegExpPatterns) {
boolean excludeMsg = p.matcher(recordMessage).find();
if (excludeMsg) {
// The Log record message will be excluded from the Log viewer.
return false;
}
}
}
}
// Filtering by extension
if (extensions != null) {
boolean match = false;
for (Extension extension : extensions) {
String value = record.getExtension(extension.key);
if (value != null) {
if (extension.value == null || includeExtensionRegExpPatterns.get(includeExtensionRegExpKeys.indexOf(extension.key)).matcher(value).find()) {
match = true;
break;
}
}
}
if (!match) {
return false;
}
}
// if we made it this far, then the record should be good.
return true;
} } | public class class_name {
@Override
public boolean accept(RepositoryLogRecord record) {
/*
* Logic operates under assumption that record will be accepted by default, therefore
* filtering check if record should be excluded
*/
// Filtering by threadID
if (filterThread) {
if (intThreadID != record.getThreadID()) {
return false; // no need to continue, this record does not pass // depends on control dependency: [if], data = [none]
}
}
// Filtering by level
if (filterLevel) {
if (minLevel != null) {
if (record.getLevel().intValue() < minLevel.intValue()) {
return false; // no need to continue, this record does not pass // depends on control dependency: [if], data = [none]
}
}
if (maxLevel != null) {
if (record.getLevel().intValue() > maxLevel.intValue()) {
return false; // no need to continue, this record does not pass // depends on control dependency: [if], data = [none]
}
}
}
// Filtering by Date/Time
if (filterTime) {
Date recordDate = new Date();
recordDate.setTime(record.getMillis()); // depends on control dependency: [if], data = [none]
if (startDate != null) {
if (recordDate.before(startDate)) {
return false; // no need to continue, this record does not // depends on control dependency: [if], data = [none]
// pass
}
}
if (stopDate != null) {
if (recordDate.after(stopDate)) {
return false; // no need to continue, this record does not // depends on control dependency: [if], data = [none]
// pass
}
}
}
// Filtering by Logger
if (filterLoggers) {
/*
* Can't return false at first filter out in case of loggers cause it's possible
* that a more specific include could over-ride the exclude. So we check them all -
* and track the highest include and exclude matches. If there are no matches for
* either include or exclude default is to exclude it.
*/
int excludeMatchLevel = -1;
int includeMatchLevel = -1;
if (excludeLoggers != null) {
for (String x : exLoggers) {
if (record.getLoggerName() != null && record.getLoggerName().matches(x.replace("*", ".*"))) {
int tmpInt = x.split("\\.").length;
if (tmpInt > excludeMatchLevel)
// This match is higher than any previous matches
excludeMatchLevel = tmpInt;
}
}
} else
excludeMatchLevel = 0; // Equivalent of excludeLoggers="*"
if (includeLoggers != null) {
for (String x : inLoggers) {
if (record.getLoggerName() != null && record.getLoggerName().matches(x.replace("*", ".*"))) {
int tmpInt = x.split("\\.").length;
if (tmpInt > includeMatchLevel)
// This match is higher than any previous matches
includeMatchLevel = tmpInt;
}
}
} else
includeMatchLevel = 0; // Equivalent of includeLoggers="*"
// Only want to accept the record if it matches an include, and does
// not match an exclude (of greater value if it matches both).
if (includeLoggers == null) {
// default include is *
}
// Using equals on match level, so default will be to exclude a record if user has
// defined both include and exclude Logger criteria and we did not match on either
// case
if (includeMatchLevel <= excludeMatchLevel)
return false;
}
// Filtering by message
if (filterMessage) {
String recordMessage = (record.getFormattedMessage() != null) ? record.getFormattedMessage() : record.getRawMessage();
if (recordMessage == null) {
return false; // depends on control dependency: [if], data = [none]
}
recordMessage = recordMessage.replace("\n", "").replace("\r", ""); // depends on control dependency: [if], data = [none]
if (messageRegExp != null) {
boolean foundmessagekey = messageRegExp.matcher(recordMessage).find();
if (!foundmessagekey) {
return false; // depends on control dependency: [if], data = [none]
}
}
if (excludeMessages != null) {
for (Pattern p : excludeMessagesRegExpPatterns) {
boolean excludeMsg = p.matcher(recordMessage).find();
if (excludeMsg) {
// The Log record message will be excluded from the Log viewer.
return false; // depends on control dependency: [if], data = [none]
}
}
}
}
// Filtering by extension
if (extensions != null) {
boolean match = false;
for (Extension extension : extensions) {
String value = record.getExtension(extension.key);
if (value != null) {
if (extension.value == null || includeExtensionRegExpPatterns.get(includeExtensionRegExpKeys.indexOf(extension.key)).matcher(value).find()) {
match = true; // depends on control dependency: [if], data = [none]
break;
}
}
}
if (!match) {
return false; // depends on control dependency: [if], data = [none]
}
}
// if we made it this far, then the record should be good.
return true;
} } |
public class class_name {
@Override public boolean onInterceptTouchEvent(MotionEvent ev) {
if (!isEnabled()) {
return false;
}
switch (MotionEventCompat.getActionMasked(ev) & MotionEventCompat.ACTION_MASK) {
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP:
viewDragHelper.cancel();
return false;
case MotionEvent.ACTION_DOWN:
int index = MotionEventCompat.getActionIndex(ev);
activePointerId = MotionEventCompat.getPointerId(ev, index);
if (activePointerId == INVALID_POINTER) {
return false;
}
break;
default:
break;
}
boolean interceptTap = viewDragHelper.isViewUnder(dragView, (int) ev.getX(), (int) ev.getY());
return viewDragHelper.shouldInterceptTouchEvent(ev) || interceptTap;
} } | public class class_name {
@Override public boolean onInterceptTouchEvent(MotionEvent ev) {
if (!isEnabled()) {
return false; // depends on control dependency: [if], data = [none]
}
switch (MotionEventCompat.getActionMasked(ev) & MotionEventCompat.ACTION_MASK) {
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP:
viewDragHelper.cancel();
return false;
case MotionEvent.ACTION_DOWN:
int index = MotionEventCompat.getActionIndex(ev);
activePointerId = MotionEventCompat.getPointerId(ev, index);
if (activePointerId == INVALID_POINTER) {
return false; // depends on control dependency: [if], data = [none]
}
break;
default:
break;
}
boolean interceptTap = viewDragHelper.isViewUnder(dragView, (int) ev.getX(), (int) ev.getY());
return viewDragHelper.shouldInterceptTouchEvent(ev) || interceptTap;
} } |
public class class_name {
public void deselectByIndex(int index) {
getDispatcher().beforeDeselect(this, index);
new Select(getElement()).deselectByIndex(index);
if (Config.getBoolConfigProperty(ConfigProperty.ENABLE_GUI_LOGGING)) {
logUIActions(UIActions.CLEARED, Integer.toString(index));
}
getDispatcher().afterDeselect(this, index);
} } | public class class_name {
public void deselectByIndex(int index) {
getDispatcher().beforeDeselect(this, index);
new Select(getElement()).deselectByIndex(index);
if (Config.getBoolConfigProperty(ConfigProperty.ENABLE_GUI_LOGGING)) {
logUIActions(UIActions.CLEARED, Integer.toString(index)); // depends on control dependency: [if], data = [none]
}
getDispatcher().afterDeselect(this, index);
} } |
public class class_name {
public final void setColumnValue(final String columnName, final Object columnValue) {
SQLExpression sqlExpression = values[getColumnIndex(columnName)];
if (sqlExpression instanceof SQLParameterMarkerExpression) {
parameters[getParameterIndex(sqlExpression)] = columnValue;
} else {
SQLExpression columnExpression = String.class == columnValue.getClass() ? new SQLTextExpression(String.valueOf(columnValue)) : new SQLNumberExpression((Number) columnValue);
values[getColumnIndex(columnName)] = columnExpression;
}
} } | public class class_name {
public final void setColumnValue(final String columnName, final Object columnValue) {
SQLExpression sqlExpression = values[getColumnIndex(columnName)];
if (sqlExpression instanceof SQLParameterMarkerExpression) {
parameters[getParameterIndex(sqlExpression)] = columnValue; // depends on control dependency: [if], data = [none]
} else {
SQLExpression columnExpression = String.class == columnValue.getClass() ? new SQLTextExpression(String.valueOf(columnValue)) : new SQLNumberExpression((Number) columnValue);
values[getColumnIndex(columnName)] = columnExpression; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
protected E update (E elem)
{
// look up this entry's position in our set
int eidx = ArrayUtil.binarySearch(_entries, 0, _size, elem, ENTRY_COMP);
// if we found it, update it
if (eidx >= 0) {
E oldEntry = _entries[eidx];
_entries[eidx] = elem;
_modCount++;
return oldEntry;
} else {
return null;
}
} } | public class class_name {
protected E update (E elem)
{
// look up this entry's position in our set
int eidx = ArrayUtil.binarySearch(_entries, 0, _size, elem, ENTRY_COMP);
// if we found it, update it
if (eidx >= 0) {
E oldEntry = _entries[eidx];
_entries[eidx] = elem; // depends on control dependency: [if], data = [none]
_modCount++; // depends on control dependency: [if], data = [none]
return oldEntry; // depends on control dependency: [if], data = [none]
} else {
return null; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void marshall(DeleteRuleGroupRequest deleteRuleGroupRequest, ProtocolMarshaller protocolMarshaller) {
if (deleteRuleGroupRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deleteRuleGroupRequest.getRuleGroupId(), RULEGROUPID_BINDING);
protocolMarshaller.marshall(deleteRuleGroupRequest.getChangeToken(), CHANGETOKEN_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(DeleteRuleGroupRequest deleteRuleGroupRequest, ProtocolMarshaller protocolMarshaller) {
if (deleteRuleGroupRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deleteRuleGroupRequest.getRuleGroupId(), RULEGROUPID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(deleteRuleGroupRequest.getChangeToken(), CHANGETOKEN_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public BaseFont getCalculatedBaseFont(boolean specialEncoding) {
if (baseFont != null)
return baseFont;
int style = this.style;
if (style == UNDEFINED) {
style = NORMAL;
}
String fontName = BaseFont.HELVETICA;
String encoding = BaseFont.WINANSI;
BaseFont cfont = null;
switch (family) {
case COURIER:
switch (style & BOLDITALIC) {
case BOLD:
fontName = BaseFont.COURIER_BOLD;
break;
case ITALIC:
fontName = BaseFont.COURIER_OBLIQUE;
break;
case BOLDITALIC:
fontName = BaseFont.COURIER_BOLDOBLIQUE;
break;
default:
//case NORMAL:
fontName = BaseFont.COURIER;
break;
}
break;
case TIMES_ROMAN:
switch (style & BOLDITALIC) {
case BOLD:
fontName = BaseFont.TIMES_BOLD;
break;
case ITALIC:
fontName = BaseFont.TIMES_ITALIC;
break;
case BOLDITALIC:
fontName = BaseFont.TIMES_BOLDITALIC;
break;
default:
case NORMAL:
fontName = BaseFont.TIMES_ROMAN;
break;
}
break;
case SYMBOL:
fontName = BaseFont.SYMBOL;
if (specialEncoding)
encoding = BaseFont.SYMBOL;
break;
case ZAPFDINGBATS:
fontName = BaseFont.ZAPFDINGBATS;
if (specialEncoding)
encoding = BaseFont.ZAPFDINGBATS;
break;
default:
case Font.HELVETICA:
switch (style & BOLDITALIC) {
case BOLD:
fontName = BaseFont.HELVETICA_BOLD;
break;
case ITALIC:
fontName = BaseFont.HELVETICA_OBLIQUE;
break;
case BOLDITALIC:
fontName = BaseFont.HELVETICA_BOLDOBLIQUE;
break;
default:
case NORMAL:
fontName = BaseFont.HELVETICA;
break;
}
break;
}
try {
cfont = BaseFont.createFont(fontName, encoding, false);
} catch (Exception ee) {
throw new ExceptionConverter(ee);
}
return cfont;
} } | public class class_name {
public BaseFont getCalculatedBaseFont(boolean specialEncoding) {
if (baseFont != null)
return baseFont;
int style = this.style;
if (style == UNDEFINED) {
style = NORMAL; // depends on control dependency: [if], data = [none]
}
String fontName = BaseFont.HELVETICA;
String encoding = BaseFont.WINANSI;
BaseFont cfont = null;
switch (family) {
case COURIER:
switch (style & BOLDITALIC) {
case BOLD:
fontName = BaseFont.COURIER_BOLD;
break;
case ITALIC:
fontName = BaseFont.COURIER_OBLIQUE;
break;
case BOLDITALIC:
fontName = BaseFont.COURIER_BOLDOBLIQUE;
break;
default:
//case NORMAL:
fontName = BaseFont.COURIER;
break;
}
break;
case TIMES_ROMAN:
switch (style & BOLDITALIC) {
case BOLD:
fontName = BaseFont.TIMES_BOLD;
break;
case ITALIC:
fontName = BaseFont.TIMES_ITALIC;
break;
case BOLDITALIC:
fontName = BaseFont.TIMES_BOLDITALIC;
break;
default:
case NORMAL:
fontName = BaseFont.TIMES_ROMAN;
break;
}
break;
case SYMBOL:
fontName = BaseFont.SYMBOL;
if (specialEncoding)
encoding = BaseFont.SYMBOL;
break;
case ZAPFDINGBATS:
fontName = BaseFont.ZAPFDINGBATS;
if (specialEncoding)
encoding = BaseFont.ZAPFDINGBATS;
break;
default:
case Font.HELVETICA:
switch (style & BOLDITALIC) {
case BOLD:
fontName = BaseFont.HELVETICA_BOLD;
break;
case ITALIC:
fontName = BaseFont.HELVETICA_OBLIQUE;
break;
case BOLDITALIC:
fontName = BaseFont.HELVETICA_BOLDOBLIQUE;
break;
default:
case NORMAL:
fontName = BaseFont.HELVETICA;
break;
}
break;
}
try {
cfont = BaseFont.createFont(fontName, encoding, false);
} catch (Exception ee) {
throw new ExceptionConverter(ee);
}
return cfont;
} } |
public class class_name {
public static <T> void filterListToMap(final Map<String, T> destinationMap, final String[] nameMapping,
final List<? extends T> sourceList) {
if( destinationMap == null ) {
throw new NullPointerException("destinationMap should not be null");
} else if( nameMapping == null ) {
throw new NullPointerException("nameMapping should not be null");
} else if( sourceList == null ) {
throw new NullPointerException("sourceList should not be null");
} else if( nameMapping.length != sourceList.size() ) {
throw new SuperCsvException(
String
.format(
"the nameMapping array and the sourceList should be the same size (nameMapping length = %d, sourceList size = %d)",
nameMapping.length, sourceList.size()));
}
destinationMap.clear();
for( int i = 0; i < nameMapping.length; i++ ) {
final String key = nameMapping[i];
if( key == null ) {
continue; // null's in the name mapping means skip column
}
// no duplicates allowed
if( destinationMap.containsKey(key) ) {
throw new SuperCsvException(String.format("duplicate nameMapping '%s' at index %d", key, i));
}
destinationMap.put(key, sourceList.get(i));
}
} } | public class class_name {
public static <T> void filterListToMap(final Map<String, T> destinationMap, final String[] nameMapping,
final List<? extends T> sourceList) {
if( destinationMap == null ) {
throw new NullPointerException("destinationMap should not be null");
} else if( nameMapping == null ) {
throw new NullPointerException("nameMapping should not be null");
} else if( sourceList == null ) {
throw new NullPointerException("sourceList should not be null");
} else if( nameMapping.length != sourceList.size() ) {
throw new SuperCsvException(
String
.format(
"the nameMapping array and the sourceList should be the same size (nameMapping length = %d, sourceList size = %d)",
nameMapping.length, sourceList.size()));
}
destinationMap.clear();
for( int i = 0; i < nameMapping.length; i++ ) {
final String key = nameMapping[i];
if( key == null ) {
continue; // null's in the name mapping means skip column
}
// no duplicates allowed
if( destinationMap.containsKey(key) ) {
throw new SuperCsvException(String.format("duplicate nameMapping '%s' at index %d", key, i));
}
destinationMap.put(key, sourceList.get(i)); // depends on control dependency: [for], data = [i]
}
} } |
public class class_name {
@Override
public String getParameter(String name) {
String value = wrapped.getParameter(name);
if (value == null) {
final String[] multipleValue = parameters.get(name);
if ((multipleValue != null) && (multipleValue.length > 0)) {
value = multipleValue[0];
}
}
return value;
} } | public class class_name {
@Override
public String getParameter(String name) {
String value = wrapped.getParameter(name);
if (value == null) {
final String[] multipleValue = parameters.get(name);
if ((multipleValue != null) && (multipleValue.length > 0)) {
value = multipleValue[0]; // depends on control dependency: [if], data = [none]
}
}
return value;
} } |
public class class_name {
private void checkSslConfigAvailability(Config config) {
if (config.getAdvancedNetworkConfig().isEnabled()) {
return;
}
SSLConfig sslConfig = config.getNetworkConfig().getSSLConfig();
checkSslConfigAvailability(sslConfig);
} } | public class class_name {
private void checkSslConfigAvailability(Config config) {
if (config.getAdvancedNetworkConfig().isEnabled()) {
return; // depends on control dependency: [if], data = [none]
}
SSLConfig sslConfig = config.getNetworkConfig().getSSLConfig();
checkSslConfigAvailability(sslConfig);
} } |
public class class_name {
public void close() {
try {
if (is != null) is.close();
} catch (IOException e) {
log.error(null, e);
throw new RuntimeException(e);
}
isClosed = true;
} } | public class class_name {
public void close() {
try {
if (is != null) is.close();
} catch (IOException e) {
log.error(null, e);
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
isClosed = true;
} } |
public class class_name {
protected static <T extends IPAddress> T[] getSpanningPrefixBlocks(
T first,
T other,
UnaryOperator<T> getLower,
UnaryOperator<T> getUpper,
Comparator<T> comparator,
UnaryOperator<T> prefixAdder,
UnaryOperator<T> prefixRemover,
IntFunction<T[]> arrayProducer) {
T[] result = checkPrefixBlockContainment(first, other, prefixAdder, arrayProducer);
if(result != null) {
return result;
}
List<IPAddressSegmentSeries> blocks =
IPAddressSection.getSpanningBlocks(first, other, getLower, getUpper, comparator, prefixRemover, IPAddressSection::splitIntoPrefixBlocks);
return blocks.toArray(arrayProducer.apply(blocks.size()));
} } | public class class_name {
protected static <T extends IPAddress> T[] getSpanningPrefixBlocks(
T first,
T other,
UnaryOperator<T> getLower,
UnaryOperator<T> getUpper,
Comparator<T> comparator,
UnaryOperator<T> prefixAdder,
UnaryOperator<T> prefixRemover,
IntFunction<T[]> arrayProducer) {
T[] result = checkPrefixBlockContainment(first, other, prefixAdder, arrayProducer);
if(result != null) {
return result; // depends on control dependency: [if], data = [none]
}
List<IPAddressSegmentSeries> blocks =
IPAddressSection.getSpanningBlocks(first, other, getLower, getUpper, comparator, prefixRemover, IPAddressSection::splitIntoPrefixBlocks);
return blocks.toArray(arrayProducer.apply(blocks.size()));
} } |
public class class_name {
public void setScalingInstructions(java.util.Collection<ScalingInstruction> scalingInstructions) {
if (scalingInstructions == null) {
this.scalingInstructions = null;
return;
}
this.scalingInstructions = new java.util.ArrayList<ScalingInstruction>(scalingInstructions);
} } | public class class_name {
public void setScalingInstructions(java.util.Collection<ScalingInstruction> scalingInstructions) {
if (scalingInstructions == null) {
this.scalingInstructions = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.scalingInstructions = new java.util.ArrayList<ScalingInstruction>(scalingInstructions);
} } |
public class class_name {
public Observable<ServiceResponse<ListLabsResponseInner>> listLabsWithServiceResponseAsync(String userName) {
if (userName == null) {
throw new IllegalArgumentException("Parameter userName is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
return service.listLabs(userName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<ListLabsResponseInner>>>() {
@Override
public Observable<ServiceResponse<ListLabsResponseInner>> call(Response<ResponseBody> response) {
try {
ServiceResponse<ListLabsResponseInner> clientResponse = listLabsDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
} } | public class class_name {
public Observable<ServiceResponse<ListLabsResponseInner>> listLabsWithServiceResponseAsync(String userName) {
if (userName == null) {
throw new IllegalArgumentException("Parameter userName is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
return service.listLabs(userName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<ListLabsResponseInner>>>() {
@Override
public Observable<ServiceResponse<ListLabsResponseInner>> call(Response<ResponseBody> response) {
try {
ServiceResponse<ListLabsResponseInner> clientResponse = listLabsDelegate(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 EClass getIfcRotationalFrequencyMeasure() {
if (ifcRotationalFrequencyMeasureEClass == null) {
ifcRotationalFrequencyMeasureEClass = (EClass) EPackage.Registry.INSTANCE
.getEPackage(Ifc2x3tc1Package.eNS_URI).getEClassifiers().get(730);
}
return ifcRotationalFrequencyMeasureEClass;
} } | public class class_name {
public EClass getIfcRotationalFrequencyMeasure() {
if (ifcRotationalFrequencyMeasureEClass == null) {
ifcRotationalFrequencyMeasureEClass = (EClass) EPackage.Registry.INSTANCE
.getEPackage(Ifc2x3tc1Package.eNS_URI).getEClassifiers().get(730);
// depends on control dependency: [if], data = [none]
}
return ifcRotationalFrequencyMeasureEClass;
} } |
public class class_name {
public static Builder fromPropertyFile(String filename, String propertyPrefix, CharsetDecoder decoder) {
Properties properties = new Properties();
if (filename != null && filename.length() > 0) {
try {
properties.load(new InputStreamReader(new FileInputStream(filename), decoder));
} catch (Exception e) {
throw new DatabaseException("Unable to read properties file: " + filename, e);
}
}
return fromProperties(properties, propertyPrefix, true);
} } | public class class_name {
public static Builder fromPropertyFile(String filename, String propertyPrefix, CharsetDecoder decoder) {
Properties properties = new Properties();
if (filename != null && filename.length() > 0) {
try {
properties.load(new InputStreamReader(new FileInputStream(filename), decoder)); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new DatabaseException("Unable to read properties file: " + filename, e);
} // depends on control dependency: [catch], data = [none]
}
return fromProperties(properties, propertyPrefix, true);
} } |
public class class_name {
public static boolean isConvex(double[] data, int points)
{
if (points < 3)
{
return true;
}
for (int i1 = 0; i1 < points; i1++)
{
int i2 = (i1 + 1) % points;
int i3 = (i2 + 1) % points;
double x1 = data[2 * i1];
double y1 = data[2 * i1 + 1];
double x2 = data[2 * i2];
double y2 = data[2 * i2 + 1];
double x3 = data[2 * i3];
double y3 = data[2 * i3 + 1];
if (Vectors.isClockwise(x1, y1, x2, y2, x3, y3))
{
return false;
}
}
return true;
} } | public class class_name {
public static boolean isConvex(double[] data, int points)
{
if (points < 3)
{
return true;
// depends on control dependency: [if], data = [none]
}
for (int i1 = 0; i1 < points; i1++)
{
int i2 = (i1 + 1) % points;
int i3 = (i2 + 1) % points;
double x1 = data[2 * i1];
double y1 = data[2 * i1 + 1];
double x2 = data[2 * i2];
double y2 = data[2 * i2 + 1];
double x3 = data[2 * i3];
double y3 = data[2 * i3 + 1];
if (Vectors.isClockwise(x1, y1, x2, y2, x3, y3))
{
return false;
// depends on control dependency: [if], data = [none]
}
}
return true;
} } |
public class class_name {
public void setCaseCanonicalizationLocale(final Locale caseCanonicalizationLocale) {
if (caseCanonicalizationLocale == null) {
this.caseCanonicalizationLocale = Locale.getDefault();
} else {
this.caseCanonicalizationLocale = caseCanonicalizationLocale;
}
} } | public class class_name {
public void setCaseCanonicalizationLocale(final Locale caseCanonicalizationLocale) {
if (caseCanonicalizationLocale == null) {
this.caseCanonicalizationLocale = Locale.getDefault(); // depends on control dependency: [if], data = [none]
} else {
this.caseCanonicalizationLocale = caseCanonicalizationLocale; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public Node previousNode() {
if (currentNode == null)
return null;
// get sibling
Node result = getPreviousSibling(currentNode);
if (result == null) {
result = getParentNode(currentNode);
if (result != null) {
currentNode = result;
return result;
}
return null;
}
// get the lastChild of result.
Node lastChild = getLastChild(result);
Node prev = lastChild;
while (lastChild != null) {
prev = lastChild;
lastChild = getLastChild(prev);
}
lastChild = prev;
// if there is a lastChild which passes filters return it.
if (lastChild != null) {
currentNode = lastChild;
return lastChild;
}
// otherwise return the previous sibling.
currentNode = result;
return result;
} } | public class class_name {
public Node previousNode() {
if (currentNode == null)
return null;
// get sibling
Node result = getPreviousSibling(currentNode);
if (result == null) {
result = getParentNode(currentNode); // depends on control dependency: [if], data = [none]
if (result != null) {
currentNode = result; // depends on control dependency: [if], data = [none]
return result; // depends on control dependency: [if], data = [none]
}
return null; // depends on control dependency: [if], data = [none]
}
// get the lastChild of result.
Node lastChild = getLastChild(result);
Node prev = lastChild;
while (lastChild != null) {
prev = lastChild; // depends on control dependency: [while], data = [none]
lastChild = getLastChild(prev); // depends on control dependency: [while], data = [none]
}
lastChild = prev;
// if there is a lastChild which passes filters return it.
if (lastChild != null) {
currentNode = lastChild; // depends on control dependency: [if], data = [none]
return lastChild; // depends on control dependency: [if], data = [none]
}
// otherwise return the previous sibling.
currentNode = result;
return result;
} } |
public class class_name {
public BusHub addBusHub(String name, BusStop... stops) {
// Do not set immediatly the container to
// avoid event firing when adding the stops
final BusHub hub = new BusHub(null, name);
for (final BusStop stop : stops) {
hub.addBusStop(stop, false);
}
if (addBusHub(hub)) {
return hub;
}
return null;
} } | public class class_name {
public BusHub addBusHub(String name, BusStop... stops) {
// Do not set immediatly the container to
// avoid event firing when adding the stops
final BusHub hub = new BusHub(null, name);
for (final BusStop stop : stops) {
hub.addBusStop(stop, false); // depends on control dependency: [for], data = [stop]
}
if (addBusHub(hub)) {
return hub; // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
private String morphColor(String str) {
if (str.equals("")) {
return "#000000";
}
if (str.equals("white")) {
return "#ffffff";
}
if (str.equals("black")) {
return "#000000";
}
return str;
} } | public class class_name {
private String morphColor(String str) {
if (str.equals("")) {
return "#000000";
// depends on control dependency: [if], data = [none]
}
if (str.equals("white")) {
return "#ffffff";
// depends on control dependency: [if], data = [none]
}
if (str.equals("black")) {
return "#000000";
// depends on control dependency: [if], data = [none]
}
return str;
} } |
public class class_name {
public final N adjacentNode(Object node) {
if (node.equals(nodeU)) {
return nodeV;
} else if (node.equals(nodeV)) {
return nodeU;
} else {
throw new IllegalArgumentException("EndpointPair " + this + " does not contain node " + node);
}
} } | public class class_name {
public final N adjacentNode(Object node) {
if (node.equals(nodeU)) {
return nodeV; // depends on control dependency: [if], data = [none]
} else if (node.equals(nodeV)) {
return nodeU; // depends on control dependency: [if], data = [none]
} else {
throw new IllegalArgumentException("EndpointPair " + this + " does not contain node " + node);
}
} } |
public class class_name {
private ArrayList<Segment10> tableSegments(TableEntry10 table)
{
ArrayList<Segment10> tableSegments = new ArrayList<>();
for (Segment10 segment : _segments) {
if (Arrays.equals(segment.key(), table.key())) {
tableSegments.add(segment);
}
}
Collections.sort(tableSegments,
(x,y)->Long.signum(y.sequence() - x.sequence()));
return tableSegments;
} } | public class class_name {
private ArrayList<Segment10> tableSegments(TableEntry10 table)
{
ArrayList<Segment10> tableSegments = new ArrayList<>();
for (Segment10 segment : _segments) {
if (Arrays.equals(segment.key(), table.key())) {
tableSegments.add(segment); // depends on control dependency: [if], data = [none]
}
}
Collections.sort(tableSegments,
(x,y)->Long.signum(y.sequence() - x.sequence()));
return tableSegments;
} } |
public class class_name {
public T executeFrom(Object bean) {
List<T> executeFromCollectionResult = executeFrom(Collections.singleton(bean));
if (CollectionUtils.isEmpty(executeFromCollectionResult)) {
return null;
} else {
return executeFromCollectionResult.get(0);
}
} } | public class class_name {
public T executeFrom(Object bean) {
List<T> executeFromCollectionResult = executeFrom(Collections.singleton(bean));
if (CollectionUtils.isEmpty(executeFromCollectionResult)) {
return null; // depends on control dependency: [if], data = [none]
} else {
return executeFromCollectionResult.get(0); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void marshall(DeleteVpcLinkRequest deleteVpcLinkRequest, ProtocolMarshaller protocolMarshaller) {
if (deleteVpcLinkRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deleteVpcLinkRequest.getVpcLinkId(), VPCLINKID_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(DeleteVpcLinkRequest deleteVpcLinkRequest, ProtocolMarshaller protocolMarshaller) {
if (deleteVpcLinkRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deleteVpcLinkRequest.getVpcLinkId(), VPCLINKID_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static List<String> getExtensionsRunningIssues(AddOn.AddOnRunRequirements requirements) {
if (!requirements.hasExtensionsWithRunningIssues()) {
return new ArrayList<>(0);
}
List<String> issues = new ArrayList<>(10);
for (AddOn.ExtensionRunRequirements extReqs : requirements.getExtensionRequirements()) {
issues.addAll(getRunningIssues(extReqs));
}
return issues;
} } | public class class_name {
public static List<String> getExtensionsRunningIssues(AddOn.AddOnRunRequirements requirements) {
if (!requirements.hasExtensionsWithRunningIssues()) {
return new ArrayList<>(0); // depends on control dependency: [if], data = [none]
}
List<String> issues = new ArrayList<>(10);
for (AddOn.ExtensionRunRequirements extReqs : requirements.getExtensionRequirements()) {
issues.addAll(getRunningIssues(extReqs)); // depends on control dependency: [for], data = [extReqs]
}
return issues;
} } |
public class class_name {
public boolean isReadOnly(ELContext context,
Object base,
Object property) {
if (context == null) {
throw new NullPointerException();
}
if ((base == null) && ("pageContext".equals(property) ||
"pageScope".equals(property)) ||
"requestScope".equals(property) ||
"sessionScope".equals(property) ||
"applicationScope".equals (property) ||
"param".equals (property) ||
"paramValues".equals (property) ||
"header".equals (property) ||
"headerValues".equals (property) ||
"initParam".equals (property) ||
"cookie".equals (property)) {
context.setPropertyResolved(true);
return true;
}
return false; // Doesn't matter
} } | public class class_name {
public boolean isReadOnly(ELContext context,
Object base,
Object property) {
if (context == null) {
throw new NullPointerException();
}
if ((base == null) && ("pageContext".equals(property) ||
"pageScope".equals(property)) ||
"requestScope".equals(property) ||
"sessionScope".equals(property) ||
"applicationScope".equals (property) ||
"param".equals (property) ||
"paramValues".equals (property) ||
"header".equals (property) ||
"headerValues".equals (property) ||
"initParam".equals (property) ||
"cookie".equals (property)) {
context.setPropertyResolved(true); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
return false; // Doesn't matter
} } |
public class class_name {
public void setComments(String tag, List<String> comments) {
String nt = normaliseTag(tag);
if(this.comments.containsKey(nt)) {
this.comments.remove(nt);
}
this.comments.put(nt, comments);
} } | public class class_name {
public void setComments(String tag, List<String> comments) {
String nt = normaliseTag(tag);
if(this.comments.containsKey(nt)) {
this.comments.remove(nt); // depends on control dependency: [if], data = [none]
}
this.comments.put(nt, comments);
} } |
public class class_name {
private String getTitle() {
if (rootParent instanceof JFrame) {
return ((JFrame) rootParent).getTitle();
} else if (rootParent instanceof JDialog) {
return ((JDialog) rootParent).getTitle();
}
return null;
} } | public class class_name {
private String getTitle() {
if (rootParent instanceof JFrame) {
return ((JFrame) rootParent).getTitle();
// depends on control dependency: [if], data = [none]
} else if (rootParent instanceof JDialog) {
return ((JDialog) rootParent).getTitle();
// depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
public void add( NewChunk nc ) {
assert _cidx >= 0;
assert _sparseLen <= _len;
assert nc._sparseLen <= nc._len:"_sparseLen = " + nc._sparseLen + ", _len = " + nc._len;
if( nc._len == 0 ) return;
if(_len == 0){
_ls = nc._ls; nc._ls = null;
_xs = nc._xs; nc._xs = null;
_id = nc._id; nc._id = null;
_ds = nc._ds; nc._ds = null;
_sparseLen = nc._sparseLen;
_len = nc._len;
return;
}
if(nc.sparse() != sparse()){ // for now, just make it dense
cancel_sparse();
nc.cancel_sparse();
}
if( _ds != null ) throw H2O.unimpl();
while( _sparseLen+nc._sparseLen >= _xs.length )
_xs = MemoryManager.arrayCopyOf(_xs,_xs.length<<1);
_ls = MemoryManager.arrayCopyOf(_ls,_xs.length);
System.arraycopy(nc._ls,0,_ls,_sparseLen,nc._sparseLen);
System.arraycopy(nc._xs,0,_xs,_sparseLen,nc._sparseLen);
if(_id != null) {
assert nc._id != null;
_id = MemoryManager.arrayCopyOf(_id,_xs.length);
System.arraycopy(nc._id,0,_id,_sparseLen,nc._sparseLen);
for(int i = _sparseLen; i < _sparseLen + nc._sparseLen; ++i) _id[i] += _len;
} else assert nc._id == null;
_sparseLen += nc._sparseLen;
_len += nc._len;
nc._ls = null; nc._xs = null; nc._id = null; nc._sparseLen = nc._len = 0;
assert _sparseLen <= _len;
} } | public class class_name {
public void add( NewChunk nc ) {
assert _cidx >= 0;
assert _sparseLen <= _len;
assert nc._sparseLen <= nc._len:"_sparseLen = " + nc._sparseLen + ", _len = " + nc._len;
if( nc._len == 0 ) return;
if(_len == 0){
_ls = nc._ls; nc._ls = null; // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
_xs = nc._xs; nc._xs = null; // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
_id = nc._id; nc._id = null; // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
_ds = nc._ds; nc._ds = null; // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
_sparseLen = nc._sparseLen; // depends on control dependency: [if], data = [none]
_len = nc._len; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
if(nc.sparse() != sparse()){ // for now, just make it dense
cancel_sparse(); // depends on control dependency: [if], data = [none]
nc.cancel_sparse(); // depends on control dependency: [if], data = [none]
}
if( _ds != null ) throw H2O.unimpl();
while( _sparseLen+nc._sparseLen >= _xs.length )
_xs = MemoryManager.arrayCopyOf(_xs,_xs.length<<1);
_ls = MemoryManager.arrayCopyOf(_ls,_xs.length);
System.arraycopy(nc._ls,0,_ls,_sparseLen,nc._sparseLen);
System.arraycopy(nc._xs,0,_xs,_sparseLen,nc._sparseLen);
if(_id != null) {
assert nc._id != null;
_id = MemoryManager.arrayCopyOf(_id,_xs.length); // depends on control dependency: [if], data = [(_id]
System.arraycopy(nc._id,0,_id,_sparseLen,nc._sparseLen); // depends on control dependency: [if], data = [none]
for(int i = _sparseLen; i < _sparseLen + nc._sparseLen; ++i) _id[i] += _len;
} else assert nc._id == null;
_sparseLen += nc._sparseLen;
_len += nc._len;
nc._ls = null; nc._xs = null; nc._id = null; nc._sparseLen = nc._len = 0;
assert _sparseLen <= _len;
} } |
public class class_name {
public static IntStream of(final Supplier<IntList> supplier) {
final IntIterator iter = new IntIteratorEx() {
private IntIterator iterator = null;
@Override
public boolean hasNext() {
if (iterator == null) {
init();
}
return iterator.hasNext();
}
@Override
public int nextInt() {
if (iterator == null) {
init();
}
return iterator.nextInt();
}
private void init() {
final IntList c = supplier.get();
if (N.isNullOrEmpty(c)) {
iterator = IntIterator.empty();
} else {
iterator = c.iterator();
}
}
};
return of(iter);
} } | public class class_name {
public static IntStream of(final Supplier<IntList> supplier) {
final IntIterator iter = new IntIteratorEx() {
private IntIterator iterator = null;
@Override
public boolean hasNext() {
if (iterator == null) {
init();
// depends on control dependency: [if], data = [none]
}
return iterator.hasNext();
}
@Override
public int nextInt() {
if (iterator == null) {
init();
// depends on control dependency: [if], data = [none]
}
return iterator.nextInt();
}
private void init() {
final IntList c = supplier.get();
if (N.isNullOrEmpty(c)) {
iterator = IntIterator.empty();
// depends on control dependency: [if], data = [none]
} else {
iterator = c.iterator();
// depends on control dependency: [if], data = [none]
}
}
};
return of(iter);
} } |
public class class_name {
public void marshall(FunctionConfiguration functionConfiguration, ProtocolMarshaller protocolMarshaller) {
if (functionConfiguration == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(functionConfiguration.getEncodingType(), ENCODINGTYPE_BINDING);
protocolMarshaller.marshall(functionConfiguration.getEnvironment(), ENVIRONMENT_BINDING);
protocolMarshaller.marshall(functionConfiguration.getExecArgs(), EXECARGS_BINDING);
protocolMarshaller.marshall(functionConfiguration.getExecutable(), EXECUTABLE_BINDING);
protocolMarshaller.marshall(functionConfiguration.getMemorySize(), MEMORYSIZE_BINDING);
protocolMarshaller.marshall(functionConfiguration.getPinned(), PINNED_BINDING);
protocolMarshaller.marshall(functionConfiguration.getTimeout(), TIMEOUT_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(FunctionConfiguration functionConfiguration, ProtocolMarshaller protocolMarshaller) {
if (functionConfiguration == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(functionConfiguration.getEncodingType(), ENCODINGTYPE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(functionConfiguration.getEnvironment(), ENVIRONMENT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(functionConfiguration.getExecArgs(), EXECARGS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(functionConfiguration.getExecutable(), EXECUTABLE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(functionConfiguration.getMemorySize(), MEMORYSIZE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(functionConfiguration.getPinned(), PINNED_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(functionConfiguration.getTimeout(), TIMEOUT_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private static void header(Map<String, String> header, HttpURLConnection httpUrlConn) {
if (header == null)
return;
if (!header.isEmpty()) {
for (Map.Entry<String, String> map : header.entrySet()) {
String headerKey = map.getKey();
String headerValue = map.getValue();
httpUrlConn.setRequestProperty(headerKey, headerValue);
}
}
} } | public class class_name {
private static void header(Map<String, String> header, HttpURLConnection httpUrlConn) {
if (header == null)
return;
if (!header.isEmpty()) {
for (Map.Entry<String, String> map : header.entrySet()) {
String headerKey = map.getKey();
String headerValue = map.getValue();
httpUrlConn.setRequestProperty(headerKey, headerValue); // depends on control dependency: [for], data = [none]
}
}
} } |
public class class_name {
private synchronized Producer<EncodedImage> getCommonNetworkFetchToEncodedMemorySequence() {
if (FrescoSystrace.isTracing()) {
FrescoSystrace.beginSection(
"ProducerSequenceFactory#getCommonNetworkFetchToEncodedMemorySequence");
}
if (mCommonNetworkFetchToEncodedMemorySequence == null) {
if (FrescoSystrace.isTracing()) {
FrescoSystrace.beginSection(
"ProducerSequenceFactory#getCommonNetworkFetchToEncodedMemorySequence:init");
}
Producer<EncodedImage> inputProducer =
newEncodedCacheMultiplexToTranscodeSequence(
mProducerFactory.newNetworkFetchProducer(mNetworkFetcher));
mCommonNetworkFetchToEncodedMemorySequence =
ProducerFactory.newAddImageTransformMetaDataProducer(inputProducer);
mCommonNetworkFetchToEncodedMemorySequence =
mProducerFactory.newResizeAndRotateProducer(
mCommonNetworkFetchToEncodedMemorySequence,
mResizeAndRotateEnabledForNetwork && !mDownsampleEnabled,
mImageTranscoderFactory);
if (FrescoSystrace.isTracing()) {
FrescoSystrace.endSection();
}
}
if (FrescoSystrace.isTracing()) {
FrescoSystrace.endSection();
}
return mCommonNetworkFetchToEncodedMemorySequence;
} } | public class class_name {
private synchronized Producer<EncodedImage> getCommonNetworkFetchToEncodedMemorySequence() {
if (FrescoSystrace.isTracing()) {
FrescoSystrace.beginSection(
"ProducerSequenceFactory#getCommonNetworkFetchToEncodedMemorySequence"); // depends on control dependency: [if], data = [none]
}
if (mCommonNetworkFetchToEncodedMemorySequence == null) {
if (FrescoSystrace.isTracing()) {
FrescoSystrace.beginSection(
"ProducerSequenceFactory#getCommonNetworkFetchToEncodedMemorySequence:init"); // depends on control dependency: [if], data = [none]
}
Producer<EncodedImage> inputProducer =
newEncodedCacheMultiplexToTranscodeSequence(
mProducerFactory.newNetworkFetchProducer(mNetworkFetcher));
mCommonNetworkFetchToEncodedMemorySequence =
ProducerFactory.newAddImageTransformMetaDataProducer(inputProducer); // depends on control dependency: [if], data = [none]
mCommonNetworkFetchToEncodedMemorySequence =
mProducerFactory.newResizeAndRotateProducer(
mCommonNetworkFetchToEncodedMemorySequence,
mResizeAndRotateEnabledForNetwork && !mDownsampleEnabled,
mImageTranscoderFactory); // depends on control dependency: [if], data = [none]
if (FrescoSystrace.isTracing()) {
FrescoSystrace.endSection(); // depends on control dependency: [if], data = [none]
}
}
if (FrescoSystrace.isTracing()) {
FrescoSystrace.endSection(); // depends on control dependency: [if], data = [none]
}
return mCommonNetworkFetchToEncodedMemorySequence;
} } |
public class class_name {
public static int lastIndexOfIgnoreCase(final CharSequence str, final CharSequence searchStr) {
if (str == null || searchStr == null) {
return INDEX_NOT_FOUND;
}
return lastIndexOfIgnoreCase(str, searchStr, str.length());
} } | public class class_name {
public static int lastIndexOfIgnoreCase(final CharSequence str, final CharSequence searchStr) {
if (str == null || searchStr == null) {
return INDEX_NOT_FOUND; // depends on control dependency: [if], data = [none]
}
return lastIndexOfIgnoreCase(str, searchStr, str.length());
} } |
public class class_name {
public static void register(XStream stream) {
for (XConverter converter : converters) {
stream.registerConverter(converter);
converter.registerAliases(stream);
}
} } | public class class_name {
public static void register(XStream stream) {
for (XConverter converter : converters) {
stream.registerConverter(converter); // depends on control dependency: [for], data = [converter]
converter.registerAliases(stream); // depends on control dependency: [for], data = [converter]
}
} } |
public class class_name {
public static IdScopedByLocation from(@Nullable String locationId, String id) {
checkNotNull(id);
checkArgument(!id.isEmpty());
if (locationId != null) {
checkArgument(!locationId.isEmpty());
}
return new SlashEncodedIdScopedByLocation(locationId, id);
} } | public class class_name {
public static IdScopedByLocation from(@Nullable String locationId, String id) {
checkNotNull(id);
checkArgument(!id.isEmpty());
if (locationId != null) {
checkArgument(!locationId.isEmpty()); // depends on control dependency: [if], data = [none]
}
return new SlashEncodedIdScopedByLocation(locationId, id);
} } |
public class class_name {
@Override
public void setCharsetName( String charsetName )
{
for ( SourcePositionMapper mapper: mappers )
{
mapper.setCharsetName( charsetName );
}
} } | public class class_name {
@Override
public void setCharsetName( String charsetName )
{
for ( SourcePositionMapper mapper: mappers )
{
mapper.setCharsetName( charsetName ); // depends on control dependency: [for], data = [mapper]
}
} } |
public class class_name {
public static synchronized void destroy() {
defaultBuilder = null;
provider = null;
if (configurationContainer != null) {
configurationContainer.destroy();
}
configurationContainer = null;
initialized = false;
} } | public class class_name {
public static synchronized void destroy() {
defaultBuilder = null;
provider = null;
if (configurationContainer != null) {
configurationContainer.destroy(); // depends on control dependency: [if], data = [none]
}
configurationContainer = null;
initialized = false;
} } |
public class class_name {
private void interiorAreaInteriorPoint_(int cluster, int id_a) {
if (m_matrix[MatrixPredicate.InteriorInterior] == 0)
return;
int clusterParentage = m_topo_graph.getClusterParentage(cluster);
if ((clusterParentage & id_a) == 0) {
int chain = m_topo_graph.getClusterChain(cluster);
int chainParentage = m_topo_graph.getChainParentage(chain);
if ((chainParentage & id_a) != 0) {
m_matrix[MatrixPredicate.InteriorInterior] = 0;
}
}
} } | public class class_name {
private void interiorAreaInteriorPoint_(int cluster, int id_a) {
if (m_matrix[MatrixPredicate.InteriorInterior] == 0)
return;
int clusterParentage = m_topo_graph.getClusterParentage(cluster);
if ((clusterParentage & id_a) == 0) {
int chain = m_topo_graph.getClusterChain(cluster);
int chainParentage = m_topo_graph.getChainParentage(chain);
if ((chainParentage & id_a) != 0) {
m_matrix[MatrixPredicate.InteriorInterior] = 0; // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
@Override
public String getFormattedMessage(final String[] formats) {
if (formats != null && formats.length > 0) {
for (int i = 0; i < formats.length; i++) {
final String format = formats[i];
if (Format.XML.name().equalsIgnoreCase(format)) {
return asXml();
} else if (Format.FULL.name().equalsIgnoreCase(format)) {
return asString(Format.FULL, null);
}
}
return asString(null, null);
}
return asString(Format.FULL, null);
} } | public class class_name {
@Override
public String getFormattedMessage(final String[] formats) {
if (formats != null && formats.length > 0) {
for (int i = 0; i < formats.length; i++) {
final String format = formats[i];
if (Format.XML.name().equalsIgnoreCase(format)) {
return asXml(); // depends on control dependency: [if], data = [none]
} else if (Format.FULL.name().equalsIgnoreCase(format)) {
return asString(Format.FULL, null); // depends on control dependency: [if], data = [none]
}
}
return asString(null, null); // depends on control dependency: [if], data = [none]
}
return asString(Format.FULL, null);
} } |
public class class_name {
private void parseConfiguration(String config) {
CmsSelectConfigurationParser parser = new CmsSelectConfigurationParser(config);
// set the help info first!!
for (Entry<String, String> helpEntry : parser.getHelpTexts().entrySet()) {
m_selectBox.setTitle(helpEntry.getKey(), helpEntry.getValue());
}
//set value and option to the combo box.
m_selectBox.setItems(parser.getOptions());
//if one entrance is declared for default.
if (parser.getDefaultValue() != null) {
//set the declared value selected.
m_selectBox.selectValue(parser.getDefaultValue());
m_defaultValue = parser.getDefaultValue();
}
fireChangeEvent();
} } | public class class_name {
private void parseConfiguration(String config) {
CmsSelectConfigurationParser parser = new CmsSelectConfigurationParser(config);
// set the help info first!!
for (Entry<String, String> helpEntry : parser.getHelpTexts().entrySet()) {
m_selectBox.setTitle(helpEntry.getKey(), helpEntry.getValue());
// depends on control dependency: [for], data = [helpEntry]
}
//set value and option to the combo box.
m_selectBox.setItems(parser.getOptions());
//if one entrance is declared for default.
if (parser.getDefaultValue() != null) {
//set the declared value selected.
m_selectBox.selectValue(parser.getDefaultValue());
// depends on control dependency: [if], data = [(parser.getDefaultValue()]
m_defaultValue = parser.getDefaultValue();
// depends on control dependency: [if], data = [none]
}
fireChangeEvent();
} } |
public class class_name {
public void marshall(LambdaFunctionTimedOutEventAttributes lambdaFunctionTimedOutEventAttributes, ProtocolMarshaller protocolMarshaller) {
if (lambdaFunctionTimedOutEventAttributes == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(lambdaFunctionTimedOutEventAttributes.getScheduledEventId(), SCHEDULEDEVENTID_BINDING);
protocolMarshaller.marshall(lambdaFunctionTimedOutEventAttributes.getStartedEventId(), STARTEDEVENTID_BINDING);
protocolMarshaller.marshall(lambdaFunctionTimedOutEventAttributes.getTimeoutType(), TIMEOUTTYPE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(LambdaFunctionTimedOutEventAttributes lambdaFunctionTimedOutEventAttributes, ProtocolMarshaller protocolMarshaller) {
if (lambdaFunctionTimedOutEventAttributes == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(lambdaFunctionTimedOutEventAttributes.getScheduledEventId(), SCHEDULEDEVENTID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(lambdaFunctionTimedOutEventAttributes.getStartedEventId(), STARTEDEVENTID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(lambdaFunctionTimedOutEventAttributes.getTimeoutType(), TIMEOUTTYPE_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static void main(String[] args) {
try {
if (args.length>0) {
if (args[0].equals("-hosts")) {
String[] hosts = ApiUtil.get_db_obj().get_device_member("tango/admin/*");
for (String host : hosts) {
System.out.println(host);
}
}
}
else {
System.err.println("Parameters ?");
System.err.println("\t-hosts: display controlled (by a Starter) host list");
}
}
catch (DevFailed e) {
System.err.println(e.errors[0].desc);
}
} } | public class class_name {
public static void main(String[] args) {
try {
if (args.length>0) {
if (args[0].equals("-hosts")) {
String[] hosts = ApiUtil.get_db_obj().get_device_member("tango/admin/*");
for (String host : hosts) {
System.out.println(host); // depends on control dependency: [for], data = [host]
}
}
}
else {
System.err.println("Parameters ?"); // depends on control dependency: [if], data = [none]
System.err.println("\t-hosts: display controlled (by a Starter) host list"); // depends on control dependency: [if], data = [none]
}
}
catch (DevFailed e) {
System.err.println(e.errors[0].desc);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static boolean isHasSaveAttr(final Cell cell, final String saveAttrs) {
if (cell != null) {
int columnIndex = cell.getColumnIndex();
String str = TieConstants.CELL_ADDR_PRE_FIX + columnIndex + "=";
if ((saveAttrs != null) && (saveAttrs.indexOf(str) >= 0)) {
return true;
}
}
return false;
} } | public class class_name {
public static boolean isHasSaveAttr(final Cell cell, final String saveAttrs) {
if (cell != null) {
int columnIndex = cell.getColumnIndex();
String str = TieConstants.CELL_ADDR_PRE_FIX + columnIndex + "=";
if ((saveAttrs != null) && (saveAttrs.indexOf(str) >= 0)) {
return true;
// depends on control dependency: [if], data = [none]
}
}
return false;
} } |
public class class_name {
@Override
public boolean contains(Object o) {
if(parsed) {
return cache.contains(o);
} else {
parseJson();
return cache.contains(o);
}
} } | public class class_name {
@Override
public boolean contains(Object o) {
if(parsed) {
return cache.contains(o); // depends on control dependency: [if], data = [none]
} else {
parseJson(); // depends on control dependency: [if], data = [none]
return cache.contains(o); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@SuppressWarnings("rawtypes")
@Override
public Converter<?, RequestBody> requestBodyConverter(Type type, Annotation[] parameterAnnotations,
Annotation[] methodAnnotations, Retrofit retrofit) {
if (type instanceof Class) {
Class<?> ct = ((Class) type);
Annotation annotation = ct.getAnnotation(BindType.class);
if (annotation != null) {
return new KriptonRequestBodyConverter<>(binderContext, (Class<?>) type);
} else {
return null;
}
} else if (type instanceof ParameterizedType) {
ParameterizedType pt = ((ParameterizedType) type);
if (pt.getActualTypeArguments().length == 1) {
return new KriptonRequestBodyCollectionConverter<>(binderContext, (ParameterizedType) type);
} else {
return null;
}
}
return null;
} } | public class class_name {
@SuppressWarnings("rawtypes")
@Override
public Converter<?, RequestBody> requestBodyConverter(Type type, Annotation[] parameterAnnotations,
Annotation[] methodAnnotations, Retrofit retrofit) {
if (type instanceof Class) {
Class<?> ct = ((Class) type); // depends on control dependency: [if], data = [none]
Annotation annotation = ct.getAnnotation(BindType.class);
if (annotation != null) {
return new KriptonRequestBodyConverter<>(binderContext, (Class<?>) type); // depends on control dependency: [if], data = [none]
} else {
return null; // depends on control dependency: [if], data = [none]
}
} else if (type instanceof ParameterizedType) {
ParameterizedType pt = ((ParameterizedType) type);
if (pt.getActualTypeArguments().length == 1) {
return new KriptonRequestBodyCollectionConverter<>(binderContext, (ParameterizedType) type); // depends on control dependency: [if], data = [none]
} else {
return null; // depends on control dependency: [if], data = [none]
}
}
return null;
} } |
public class class_name {
@Override
public final JsHealthState getHealthState()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.entry(this, tc, "getHealthState");
SibTr.exit(this, tc, "getHealthState", "return=" + _healthState);
}
return _healthState;
} } | public class class_name {
@Override
public final JsHealthState getHealthState()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.entry(this, tc, "getHealthState"); // depends on control dependency: [if], data = [none]
SibTr.exit(this, tc, "getHealthState", "return=" + _healthState); // depends on control dependency: [if], data = [none]
}
return _healthState;
} } |
public class class_name {
public static List<URL> getClasspathUrls(String classPath)
throws Exception {
List<URL> urls = new ArrayList<URL>();
for (String path : classPath.split(CLASSPATH_SEPARATOR)) {
if (!path.isEmpty()) {
if (path.toLowerCase().endsWith(JARS_WILDCARD)) {
path = path.substring(0, path.length() - JARS_WILDCARD.length());
File f = new File(path).getAbsoluteFile();
if (f.exists()) {
File[] jars = f.listFiles(new FileFilter() {
@Override
public boolean accept(File pathname) {
return pathname.getName().toLowerCase().endsWith(JARS_WILDCARD.substring(1));
}
});
for (File jar : jars) {
urls.add(jar.toURI().toURL());
}
} else {
throw new IllegalArgumentException(String.format(CLASSPATH_DIR_DOES_NOT_EXIST_MSG, f));
}
} else {
if (!path.endsWith(FILE_SEPARATOR)) {
path = path + FILE_SEPARATOR;
}
File f = new File(path).getAbsoluteFile();
if (f.exists()) {
if (f.isDirectory()) {
urls.add(f.toURI().toURL());
} else {
throw new IllegalArgumentException(String.format(CLASSPATH_PATH_S_IS_NOT_A_DIR_MSG, f));
}
} else {
throw new IllegalArgumentException(String.format(CLASSPATH_DIR_DOES_NOT_EXIST_MSG, f));
}
}
}
}
return urls;
} } | public class class_name {
public static List<URL> getClasspathUrls(String classPath)
throws Exception {
List<URL> urls = new ArrayList<URL>();
for (String path : classPath.split(CLASSPATH_SEPARATOR)) {
if (!path.isEmpty()) {
if (path.toLowerCase().endsWith(JARS_WILDCARD)) {
path = path.substring(0, path.length() - JARS_WILDCARD.length()); // depends on control dependency: [if], data = [none]
File f = new File(path).getAbsoluteFile();
if (f.exists()) {
File[] jars = f.listFiles(new FileFilter() {
@Override
public boolean accept(File pathname) {
return pathname.getName().toLowerCase().endsWith(JARS_WILDCARD.substring(1));
}
});
for (File jar : jars) {
urls.add(jar.toURI().toURL()); // depends on control dependency: [for], data = [jar]
}
} else {
throw new IllegalArgumentException(String.format(CLASSPATH_DIR_DOES_NOT_EXIST_MSG, f));
}
} else {
if (!path.endsWith(FILE_SEPARATOR)) {
path = path + FILE_SEPARATOR; // depends on control dependency: [if], data = [none]
}
File f = new File(path).getAbsoluteFile();
if (f.exists()) {
if (f.isDirectory()) {
urls.add(f.toURI().toURL()); // depends on control dependency: [if], data = [none]
} else {
throw new IllegalArgumentException(String.format(CLASSPATH_PATH_S_IS_NOT_A_DIR_MSG, f));
}
} else {
throw new IllegalArgumentException(String.format(CLASSPATH_DIR_DOES_NOT_EXIST_MSG, f));
}
}
}
}
return urls;
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.