code
stringlengths 130
281k
| code_dependency
stringlengths 182
306k
|
|---|---|
public class class_name {
public GVRSceneObject startDrag(GVRSceneObject dragMe, float relX, float relY, float relZ) {
synchronized (mLock) {
if (mCursorController == null) {
Log.w(TAG, "Physics drag failed: Cursor controller not found!");
return null;
}
if (mDragMe != null) {
Log.w(TAG, "Physics drag failed: Previous drag wasn't finished!");
return null;
}
if (mPivotObject == null) {
mPivotObject = onCreatePivotObject(mContext);
}
mDragMe = dragMe;
GVRTransform t = dragMe.getTransform();
/* It is not possible to drag a rigid body directly, we need a pivot object.
We are using the pivot object's position as pivot of the dragging's physics constraint.
*/
mPivotObject.getTransform().setPosition(t.getPositionX() + relX,
t.getPositionY() + relY, t.getPositionZ() + relZ);
mCursorController.startDrag(mPivotObject);
}
return mPivotObject;
} }
|
public class class_name {
public GVRSceneObject startDrag(GVRSceneObject dragMe, float relX, float relY, float relZ) {
synchronized (mLock) {
if (mCursorController == null) {
Log.w(TAG, "Physics drag failed: Cursor controller not found!"); // depends on control dependency: [if], data = [none]
return null; // depends on control dependency: [if], data = [none]
}
if (mDragMe != null) {
Log.w(TAG, "Physics drag failed: Previous drag wasn't finished!"); // depends on control dependency: [if], data = [none]
return null; // depends on control dependency: [if], data = [none]
}
if (mPivotObject == null) {
mPivotObject = onCreatePivotObject(mContext); // depends on control dependency: [if], data = [none]
}
mDragMe = dragMe;
GVRTransform t = dragMe.getTransform();
/* It is not possible to drag a rigid body directly, we need a pivot object.
We are using the pivot object's position as pivot of the dragging's physics constraint.
*/
mPivotObject.getTransform().setPosition(t.getPositionX() + relX,
t.getPositionY() + relY, t.getPositionZ() + relZ);
mCursorController.startDrag(mPivotObject);
}
return mPivotObject;
} }
|
public class class_name {
public AccountAggregationSource withAwsRegions(String... awsRegions) {
if (this.awsRegions == null) {
setAwsRegions(new com.amazonaws.internal.SdkInternalList<String>(awsRegions.length));
}
for (String ele : awsRegions) {
this.awsRegions.add(ele);
}
return this;
} }
|
public class class_name {
public AccountAggregationSource withAwsRegions(String... awsRegions) {
if (this.awsRegions == null) {
setAwsRegions(new com.amazonaws.internal.SdkInternalList<String>(awsRegions.length)); // depends on control dependency: [if], data = [none]
}
for (String ele : awsRegions) {
this.awsRegions.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} }
|
public class class_name {
private static int normalisedPort(String scheme, int port) {
if (port != DEFAULT_PORT) {
return port;
}
if (isHttp(scheme)) {
return DEFAULT_HTTP_PORT;
}
if (isHttps(scheme)) {
return DEFAULT_HTTPS_PORT;
}
return UNKNOWN_PORT;
} }
|
public class class_name {
private static int normalisedPort(String scheme, int port) {
if (port != DEFAULT_PORT) {
return port; // depends on control dependency: [if], data = [none]
}
if (isHttp(scheme)) {
return DEFAULT_HTTP_PORT; // depends on control dependency: [if], data = [none]
}
if (isHttps(scheme)) {
return DEFAULT_HTTPS_PORT; // depends on control dependency: [if], data = [none]
}
return UNKNOWN_PORT;
} }
|
public class class_name {
public boolean checkHeartbeatInfo(HeartbeatArgs jtInfo) {
if (expectedInfo.requestId != jtInfo.requestId){
LOG.fatal("heartbeat out-of-sync:" + sessionId +
" CM:" + expectedInfo.requestId + " " + expectedInfo.grantId +
" JT:" + jtInfo.requestId + " " + jtInfo.grantId);
return false;
}
if (expectedInfo.grantId == jtInfo.grantId){
// perfect match
if (LOG.isDebugEnabled()) {
LOG.debug("heartbeat match:" + sessionId);
}
lastSyncTime = System.currentTimeMillis();
lastHeartbeat.requestId = 0;
lastHeartbeat.grantId = 0;
return true;
}
// delay
if ( jtInfo.grantId != lastHeartbeat.grantId) {
LOG.info("heartbeat mismatch with progress:" + sessionId +
" CM:" + expectedInfo.requestId + " " + expectedInfo.grantId +
" JT:" + jtInfo.requestId + " " + jtInfo.grantId);
lastSyncTime = System.currentTimeMillis();
lastHeartbeat.requestId = jtInfo.requestId;
lastHeartbeat.grantId = jtInfo.grantId;
return true;
}
if (System.currentTimeMillis() - lastSyncTime > maxDelay) {
// no progress
LOG.error("heartbeat out-of-sync:" + sessionId +
" CM:" + expectedInfo.requestId + " " + expectedInfo.grantId +
" JT:" + jtInfo.requestId + " " + jtInfo.grantId);
return true;
}
LOG.info("heartbeat mismatch with no progress:" + sessionId +
" CM:" + expectedInfo.requestId + " " + expectedInfo.grantId +
" JT:" + jtInfo.requestId + " " + jtInfo.grantId);
return true;
} }
|
public class class_name {
public boolean checkHeartbeatInfo(HeartbeatArgs jtInfo) {
if (expectedInfo.requestId != jtInfo.requestId){
LOG.fatal("heartbeat out-of-sync:" + sessionId +
" CM:" + expectedInfo.requestId + " " + expectedInfo.grantId +
" JT:" + jtInfo.requestId + " " + jtInfo.grantId); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
if (expectedInfo.grantId == jtInfo.grantId){
// perfect match
if (LOG.isDebugEnabled()) {
LOG.debug("heartbeat match:" + sessionId); // depends on control dependency: [if], data = [none]
}
lastSyncTime = System.currentTimeMillis(); // depends on control dependency: [if], data = [none]
lastHeartbeat.requestId = 0; // depends on control dependency: [if], data = [none]
lastHeartbeat.grantId = 0; // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
// delay
if ( jtInfo.grantId != lastHeartbeat.grantId) {
LOG.info("heartbeat mismatch with progress:" + sessionId +
" CM:" + expectedInfo.requestId + " " + expectedInfo.grantId +
" JT:" + jtInfo.requestId + " " + jtInfo.grantId); // depends on control dependency: [if], data = [none]
lastSyncTime = System.currentTimeMillis(); // depends on control dependency: [if], data = [none]
lastHeartbeat.requestId = jtInfo.requestId; // depends on control dependency: [if], data = [none]
lastHeartbeat.grantId = jtInfo.grantId; // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
if (System.currentTimeMillis() - lastSyncTime > maxDelay) {
// no progress
LOG.error("heartbeat out-of-sync:" + sessionId +
" CM:" + expectedInfo.requestId + " " + expectedInfo.grantId +
" JT:" + jtInfo.requestId + " " + jtInfo.grantId); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
LOG.info("heartbeat mismatch with no progress:" + sessionId +
" CM:" + expectedInfo.requestId + " " + expectedInfo.grantId +
" JT:" + jtInfo.requestId + " " + jtInfo.grantId);
return true;
} }
|
public class class_name {
@Override
public Object getData() {
Object data = super.getData();
// Check if we need to default to the first option
if (data == null && !isAllowNoSelection()) {
List<?> options = getOptions();
if (options != null && !options.isEmpty()) {
// Check if NULL is an option
if (SelectListUtil.containsOption(options, null)) {
return null;
}
// Use the first option
Object firstOption = SelectListUtil.getFirstOption(options);
return firstOption;
}
return null;
}
return data;
} }
|
public class class_name {
@Override
public Object getData() {
Object data = super.getData();
// Check if we need to default to the first option
if (data == null && !isAllowNoSelection()) {
List<?> options = getOptions();
if (options != null && !options.isEmpty()) {
// Check if NULL is an option
if (SelectListUtil.containsOption(options, null)) {
return null; // depends on control dependency: [if], data = [none]
}
// Use the first option
Object firstOption = SelectListUtil.getFirstOption(options);
return firstOption; // depends on control dependency: [if], data = [none]
}
return null; // depends on control dependency: [if], data = [none]
}
return data;
} }
|
public class class_name {
public static <K, V> Optional<CaffeineConfiguration<K, V>> from(Config config, String cacheName) {
CaffeineConfiguration<K, V> configuration = null;
try {
if (config.hasPath("caffeine.jcache." + cacheName)) {
configuration = new Configurator<K, V>(config, cacheName).configure();
}
} catch (ConfigException.BadPath e) {
logger.log(Level.WARNING, "Failed to load cache configuration", e);
}
return Optional.ofNullable(configuration);
} }
|
public class class_name {
public static <K, V> Optional<CaffeineConfiguration<K, V>> from(Config config, String cacheName) {
CaffeineConfiguration<K, V> configuration = null;
try {
if (config.hasPath("caffeine.jcache." + cacheName)) {
configuration = new Configurator<K, V>(config, cacheName).configure(); // depends on control dependency: [if], data = [none]
}
} catch (ConfigException.BadPath e) {
logger.log(Level.WARNING, "Failed to load cache configuration", e);
} // depends on control dependency: [catch], data = [none]
return Optional.ofNullable(configuration);
} }
|
public class class_name {
public void marshall(DescribeLunaClientRequest describeLunaClientRequest, ProtocolMarshaller protocolMarshaller) {
if (describeLunaClientRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(describeLunaClientRequest.getClientArn(), CLIENTARN_BINDING);
protocolMarshaller.marshall(describeLunaClientRequest.getCertificateFingerprint(), CERTIFICATEFINGERPRINT_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(DescribeLunaClientRequest describeLunaClientRequest, ProtocolMarshaller protocolMarshaller) {
if (describeLunaClientRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(describeLunaClientRequest.getClientArn(), CLIENTARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(describeLunaClientRequest.getCertificateFingerprint(), CERTIFICATEFINGERPRINT_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 <T> void register(Class<T> clazz) {
// There are two possible cases
// 1) This might be a simple class with @Entity
// 2) This might be a class annotated with @Subclass
// @Entity is inherited, but we only create entity metadata for the class with the @Entity declaration
if (TypeUtils.isDeclaredAnnotationPresent(clazz, Entity.class)) {
String kind = Key.getKind(clazz);
// If we are already registered, ignore
if (this.byKind.containsKey(kind))
return;
EntityMetadata<T> cmeta = new EntityMetadata<>(this.fact, clazz);
this.byKind.put(kind, cmeta);
if (cmeta.getCacheExpirySeconds() != null)
this.cacheEnabled = true;
}
else if (clazz.isAnnotationPresent(Subclass.class)) {
// We just need to make sure that a translator was created
fact.getTranslators().getRoot(clazz);
}
else {
throw new IllegalArgumentException(clazz + " must be annotated with either @Entity or @Subclass");
}
} }
|
public class class_name {
public <T> void register(Class<T> clazz) {
// There are two possible cases
// 1) This might be a simple class with @Entity
// 2) This might be a class annotated with @Subclass
// @Entity is inherited, but we only create entity metadata for the class with the @Entity declaration
if (TypeUtils.isDeclaredAnnotationPresent(clazz, Entity.class)) {
String kind = Key.getKind(clazz);
// If we are already registered, ignore
if (this.byKind.containsKey(kind))
return;
EntityMetadata<T> cmeta = new EntityMetadata<>(this.fact, clazz);
this.byKind.put(kind, cmeta);
// depends on control dependency: [if], data = [none]
if (cmeta.getCacheExpirySeconds() != null)
this.cacheEnabled = true;
}
else if (clazz.isAnnotationPresent(Subclass.class)) {
// We just need to make sure that a translator was created
fact.getTranslators().getRoot(clazz);
// depends on control dependency: [if], data = [none]
}
else {
throw new IllegalArgumentException(clazz + " must be annotated with either @Entity or @Subclass");
}
} }
|
public class class_name {
public Object getNextData()
{
try {
String strNext = m_daIn.readUTF();
return strNext;
} catch (IOException ex) {
ex.printStackTrace();
return null;
}
} }
|
public class class_name {
public Object getNextData()
{
try {
String strNext = m_daIn.readUTF();
return strNext; // depends on control dependency: [try], data = [none]
} catch (IOException ex) {
ex.printStackTrace();
return null;
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public void info(CharSequence info) {
if (StringUtils.isNotEmpty(info)) {
msg.printMessage(Diagnostic.Kind.NOTE, Consts.PREFIX_OF_LOGGER + info);
}
} }
|
public class class_name {
public void info(CharSequence info) {
if (StringUtils.isNotEmpty(info)) {
msg.printMessage(Diagnostic.Kind.NOTE, Consts.PREFIX_OF_LOGGER + info); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private void createRemoteListenerDeactivateOnException(
final boolean initialAttempt) {
final String methodName = "createRemoteListenerDeactivateOnException";
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.entry(this, TRACE, methodName, Boolean
.valueOf(initialAttempt));
}
try {
createRemoteListener(initialAttempt);
} catch (final ResourceException exception) {
FFDCFilter.processException(exception, CLASS_NAME + "."
+ methodName, FFDC_PROBE_7, this);
SibTr.error(TRACE, "CONNECT_FAILED_CWSIV0783", new Object[] {
_endpointConfiguration.getDestination()
.getDestinationName(),
_endpointConfiguration.getBusName(), this, exception });
deactivate();
}
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.exit(this, TRACE, methodName);
}
} }
|
public class class_name {
private void createRemoteListenerDeactivateOnException(
final boolean initialAttempt) {
final String methodName = "createRemoteListenerDeactivateOnException";
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.entry(this, TRACE, methodName, Boolean
.valueOf(initialAttempt)); // depends on control dependency: [if], data = [none]
}
try {
createRemoteListener(initialAttempt); // depends on control dependency: [try], data = [none]
} catch (final ResourceException exception) {
FFDCFilter.processException(exception, CLASS_NAME + "."
+ methodName, FFDC_PROBE_7, this);
SibTr.error(TRACE, "CONNECT_FAILED_CWSIV0783", new Object[] {
_endpointConfiguration.getDestination()
.getDestinationName(),
_endpointConfiguration.getBusName(), this, exception });
deactivate();
} // depends on control dependency: [catch], data = [none]
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.exit(this, TRACE, methodName); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private void add_snake_case_properties(List<PropertyDescriptor> pdl) throws IntrospectionException {
List<PropertyDescriptor> alternatives = new ArrayList<PropertyDescriptor>();
for (PropertyDescriptor descriptor : pdl) {
String camelCase = descriptor.getName();
if (camelCase.equals("rendererType")) {
continue;
}
if (camelCase.equals("localValueSet")) {
continue;
}
if (camelCase.equals("submittedValue")) {
continue;
}
String snake_case = BsfUtils.camelCaseToSnakeCase(camelCase);
if (snake_case != camelCase) { // in this particular case, we don't
// need to use equals!
if (descriptor.getReadMethod() != null && descriptor.getWriteMethod() != null) {
String getter = descriptor.getReadMethod().getName();
String setter = descriptor.getWriteMethod().getName();
if (UIComponent.class != descriptor.getReadMethod().getDeclaringClass()) {
PropertyDescriptor alternative = new PropertyDescriptor(snake_case, getDecoratedClass(), getter,
setter);
alternative.setBound(true);
alternatives.add(alternative);
// more alternatives
if (camelCase.equals("styleClass")) {
alternative = new PropertyDescriptor("class", getDecoratedClass(), getter, setter);
alternative.setBound(true);
alternatives.add(alternative);
}
}
}
}
}
if (alternatives.size() > 0) {
pdl.addAll(alternatives);
}
} }
|
public class class_name {
private void add_snake_case_properties(List<PropertyDescriptor> pdl) throws IntrospectionException {
List<PropertyDescriptor> alternatives = new ArrayList<PropertyDescriptor>();
for (PropertyDescriptor descriptor : pdl) {
String camelCase = descriptor.getName();
if (camelCase.equals("rendererType")) {
continue;
}
if (camelCase.equals("localValueSet")) {
continue;
}
if (camelCase.equals("submittedValue")) {
continue;
}
String snake_case = BsfUtils.camelCaseToSnakeCase(camelCase);
if (snake_case != camelCase) { // in this particular case, we don't
// need to use equals!
if (descriptor.getReadMethod() != null && descriptor.getWriteMethod() != null) {
String getter = descriptor.getReadMethod().getName();
String setter = descriptor.getWriteMethod().getName();
if (UIComponent.class != descriptor.getReadMethod().getDeclaringClass()) {
PropertyDescriptor alternative = new PropertyDescriptor(snake_case, getDecoratedClass(), getter,
setter);
alternative.setBound(true); // depends on control dependency: [if], data = [none]
alternatives.add(alternative); // depends on control dependency: [if], data = [none]
// more alternatives
if (camelCase.equals("styleClass")) {
alternative = new PropertyDescriptor("class", getDecoratedClass(), getter, setter); // depends on control dependency: [if], data = [none]
alternative.setBound(true); // depends on control dependency: [if], data = [none]
alternatives.add(alternative); // depends on control dependency: [if], data = [none]
}
}
}
}
}
if (alternatives.size() > 0) {
pdl.addAll(alternatives);
}
} }
|
public class class_name {
public static HiveRegister get(String hiveRegisterType, State props, Optional<String> metastoreURI) {
try {
return (HiveRegister) ConstructorUtils.invokeConstructor(Class.forName(hiveRegisterType), props, metastoreURI);
} catch (ReflectiveOperationException e) {
throw Throwables.propagate(e);
}
} }
|
public class class_name {
public static HiveRegister get(String hiveRegisterType, State props, Optional<String> metastoreURI) {
try {
return (HiveRegister) ConstructorUtils.invokeConstructor(Class.forName(hiveRegisterType), props, metastoreURI); // depends on control dependency: [try], data = [none]
} catch (ReflectiveOperationException e) {
throw Throwables.propagate(e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
@Override
protected void paintComponent(Graphics g) {
if (!isInitialized()) {
return;
}
final Graphics2D G2 = (Graphics2D) g.create();
G2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
G2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
G2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE);
G2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
// Translate the coordinate system related to insets
G2.translate(getFramelessOffset().getX(), getFramelessOffset().getY());
final AffineTransform OLD_TRANSFORM = G2.getTransform();
// Draw combined background image
G2.drawImage(bImage, 0, 0, null);
// Draw blips
G2.setColor(BLIP_TEXT_COLOR);
G2.setFont(BLIP_FONT);
for (Poi poi : blips.values()) {
if (poi.distanceTo(MY_LOCATION) < this.range) {
G2.drawImage(poi.getPoiImage(), (int) (CENTER.getX() - poi.getPoiImage().getWidth() / 2.0 + (poi.getLocationXY().getX() - CENTER_XY.getX()) / pixelScaleX), (int) (CENTER.getY() - poi.getPoiImage().getWidth() / 2.0 + (poi.getLocationXY().getY() - CENTER_XY.getY()) / pixelScaleY), null);
G2.drawString(poi.getName(), (int) (CENTER.getX() - poi.getPoiImage().getWidth() + (poi.getLocationXY().getX() - CENTER_XY.getX()) / pixelScaleX), (int) (CENTER.getY() - poi.getPoiImage().getWidth() + (poi.getLocationXY().getY() - CENTER_XY.getY()) / pixelScaleY));
}
}
// Draw the beam
G2.rotate(rotationAngle, CENTER.getX(), CENTER.getY());
G2.drawImage(beamImage, 0, 0, null);
G2.setTransform(OLD_TRANSFORM);
G2.rotate(Math.toRadians(-135) + rotationAngle, CENTER.getX(), CENTER.getY());
G2.setColor(BEAM_COLOR);
G2.draw(BEAM);
G2.setTransform(OLD_TRANSFORM);
if (!isEnabled()) {
G2.drawImage(disabledImage, 0, 0, null);
}
G2.dispose();
} }
|
public class class_name {
@Override
protected void paintComponent(Graphics g) {
if (!isInitialized()) {
return; // depends on control dependency: [if], data = [none]
}
final Graphics2D G2 = (Graphics2D) g.create();
G2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
G2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
G2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE);
G2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
// Translate the coordinate system related to insets
G2.translate(getFramelessOffset().getX(), getFramelessOffset().getY());
final AffineTransform OLD_TRANSFORM = G2.getTransform();
// Draw combined background image
G2.drawImage(bImage, 0, 0, null);
// Draw blips
G2.setColor(BLIP_TEXT_COLOR);
G2.setFont(BLIP_FONT);
for (Poi poi : blips.values()) {
if (poi.distanceTo(MY_LOCATION) < this.range) {
G2.drawImage(poi.getPoiImage(), (int) (CENTER.getX() - poi.getPoiImage().getWidth() / 2.0 + (poi.getLocationXY().getX() - CENTER_XY.getX()) / pixelScaleX), (int) (CENTER.getY() - poi.getPoiImage().getWidth() / 2.0 + (poi.getLocationXY().getY() - CENTER_XY.getY()) / pixelScaleY), null); // depends on control dependency: [if], data = [none]
G2.drawString(poi.getName(), (int) (CENTER.getX() - poi.getPoiImage().getWidth() + (poi.getLocationXY().getX() - CENTER_XY.getX()) / pixelScaleX), (int) (CENTER.getY() - poi.getPoiImage().getWidth() + (poi.getLocationXY().getY() - CENTER_XY.getY()) / pixelScaleY)); // depends on control dependency: [if], data = [none]
}
}
// Draw the beam
G2.rotate(rotationAngle, CENTER.getX(), CENTER.getY());
G2.drawImage(beamImage, 0, 0, null);
G2.setTransform(OLD_TRANSFORM);
G2.rotate(Math.toRadians(-135) + rotationAngle, CENTER.getX(), CENTER.getY());
G2.setColor(BEAM_COLOR);
G2.draw(BEAM);
G2.setTransform(OLD_TRANSFORM);
if (!isEnabled()) {
G2.drawImage(disabledImage, 0, 0, null); // depends on control dependency: [if], data = [none]
}
G2.dispose();
} }
|
public class class_name {
@SuppressLint("MissingPermission")
@RequiresPermission(anyOf = {
ACCESS_COARSE_LOCATION, ACCESS_FINE_LOCATION
})
public Observable<Beacon> observe() {
if (!isBleSupported()) {
return Observable.empty();
}
if (isAtLeastAndroidLollipop()) {
scanStrategy = new LollipopScanStrategy(bluetoothAdapter);
} else {
scanStrategy = new PreLollipopScanStrategy(bluetoothAdapter);
}
try {
return observe(scanStrategy);
} catch (SecurityException e) {
return Observable.empty();
}
} }
|
public class class_name {
@SuppressLint("MissingPermission")
@RequiresPermission(anyOf = {
ACCESS_COARSE_LOCATION, ACCESS_FINE_LOCATION
})
public Observable<Beacon> observe() {
if (!isBleSupported()) {
return Observable.empty(); // depends on control dependency: [if], data = [none]
}
if (isAtLeastAndroidLollipop()) {
scanStrategy = new LollipopScanStrategy(bluetoothAdapter); // depends on control dependency: [if], data = [none]
} else {
scanStrategy = new PreLollipopScanStrategy(bluetoothAdapter); // depends on control dependency: [if], data = [none]
}
try {
return observe(scanStrategy); // depends on control dependency: [try], data = [none]
} catch (SecurityException e) {
return Observable.empty();
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
@Override
public String editSlideshow(String username, String password, String slideshowId, String slideshowTitle,
String slideshowDescription, Collection<String> slideshowTags, PrivacySetting privacySetting) {
if (privacySetting == null) {
return editSlideshow(username, password, slideshowId, slideshowTitle, slideshowDescription, slideshowTags,
null, null, null, null);
}
return editSlideshow(username, password, slideshowId, slideshowTitle, slideshowDescription, slideshowTags,
privacySetting.getMakeSlideshowPrivate(), privacySetting.getGenerateSecretUrl(),
privacySetting.getAllowEmbeds(), privacySetting.getShareWithContacts());
} }
|
public class class_name {
@Override
public String editSlideshow(String username, String password, String slideshowId, String slideshowTitle,
String slideshowDescription, Collection<String> slideshowTags, PrivacySetting privacySetting) {
if (privacySetting == null) {
return editSlideshow(username, password, slideshowId, slideshowTitle, slideshowDescription, slideshowTags,
null, null, null, null); // depends on control dependency: [if], data = [none]
}
return editSlideshow(username, password, slideshowId, slideshowTitle, slideshowDescription, slideshowTags,
privacySetting.getMakeSlideshowPrivate(), privacySetting.getGenerateSecretUrl(),
privacySetting.getAllowEmbeds(), privacySetting.getShareWithContacts());
} }
|
public class class_name {
private int getNextLastDayOfMonth(int day, int lastDay)
{
// lastDaysOfMonth = 0b1000 0011 (LSB) = Last, -6, -7
// Shift left so that "Last" aligns with the last day of the month.
// For example, for Jan, we want the Last bit in position 31, so we
// shift 30-7=23 (note: 0-based last day for Jan is 30) resulting in:
// bits = 0b0100 0001 1000 0000 0000 0000 0000 0000 (LSB)
int offset = lastDay - 7;
long bits = lastDaysOfMonth << offset;
if (!contains(bits, day))
{
long higher = higher(bits, day);
if (higher != 0)
{
return first(higher);
}
return ADVANCE_TO_NEXT_MONTH;
}
return day;
} }
|
public class class_name {
private int getNextLastDayOfMonth(int day, int lastDay)
{
// lastDaysOfMonth = 0b1000 0011 (LSB) = Last, -6, -7
// Shift left so that "Last" aligns with the last day of the month.
// For example, for Jan, we want the Last bit in position 31, so we
// shift 30-7=23 (note: 0-based last day for Jan is 30) resulting in:
// bits = 0b0100 0001 1000 0000 0000 0000 0000 0000 (LSB)
int offset = lastDay - 7;
long bits = lastDaysOfMonth << offset;
if (!contains(bits, day))
{
long higher = higher(bits, day);
if (higher != 0)
{
return first(higher); // depends on control dependency: [if], data = [(higher]
}
return ADVANCE_TO_NEXT_MONTH; // depends on control dependency: [if], data = [none]
}
return day;
} }
|
public class class_name {
private static boolean isDistinct(OProjectionItem item) {
if (item.getExpression() == null) {
return false;
}
if (item.getExpression().getMathExpression() == null) {
return false;
}
if (!(item.getExpression().getMathExpression() instanceof OBaseExpression)) {
return false;
}
OBaseExpression base = (OBaseExpression) item.getExpression().getMathExpression();
if (base.getIdentifier() == null) {
return false;
}
if (base.getModifier() != null) {
return false;
}
if (base.getIdentifier().getLevelZero() == null) {
return false;
}
OFunctionCall function = base.getIdentifier().getLevelZero().getFunctionCall();
if (function == null) {
return false;
}
return function.getName().getStringValue().equalsIgnoreCase("distinct");
} }
|
public class class_name {
private static boolean isDistinct(OProjectionItem item) {
if (item.getExpression() == null) {
return false; // depends on control dependency: [if], data = [none]
}
if (item.getExpression().getMathExpression() == null) {
return false; // depends on control dependency: [if], data = [none]
}
if (!(item.getExpression().getMathExpression() instanceof OBaseExpression)) {
return false; // depends on control dependency: [if], data = [none]
}
OBaseExpression base = (OBaseExpression) item.getExpression().getMathExpression();
if (base.getIdentifier() == null) {
return false; // depends on control dependency: [if], data = [none]
}
if (base.getModifier() != null) {
return false; // depends on control dependency: [if], data = [none]
}
if (base.getIdentifier().getLevelZero() == null) {
return false; // depends on control dependency: [if], data = [none]
}
OFunctionCall function = base.getIdentifier().getLevelZero().getFunctionCall();
if (function == null) {
return false; // depends on control dependency: [if], data = [none]
}
return function.getName().getStringValue().equalsIgnoreCase("distinct");
} }
|
public class class_name {
private static void addData(final Map<String, List<ViewRiksdagenPartyCoalationAgainstAnnualSummary>> map,
final Series series, final DataSeries dataSeries) {
final Set<Entry<String, List<ViewRiksdagenPartyCoalationAgainstAnnualSummary>>> entryMap = map.entrySet();
for (final Entry<String, List<ViewRiksdagenPartyCoalationAgainstAnnualSummary>> entry : entryMap) {
if (!entry.getValue().isEmpty()) {
series.addSeries(new XYseries().setLabel(entry.getKey()));
dataSeries.newSeries();
for (final ViewRiksdagenPartyCoalationAgainstAnnualSummary data : entry.getValue()) {
dataSeries.add(data.getEmbeddedId().getYear() + "-01-01", data.getTotal());
}
}
}
} }
|
public class class_name {
private static void addData(final Map<String, List<ViewRiksdagenPartyCoalationAgainstAnnualSummary>> map,
final Series series, final DataSeries dataSeries) {
final Set<Entry<String, List<ViewRiksdagenPartyCoalationAgainstAnnualSummary>>> entryMap = map.entrySet();
for (final Entry<String, List<ViewRiksdagenPartyCoalationAgainstAnnualSummary>> entry : entryMap) {
if (!entry.getValue().isEmpty()) {
series.addSeries(new XYseries().setLabel(entry.getKey())); // depends on control dependency: [if], data = [none]
dataSeries.newSeries(); // depends on control dependency: [if], data = [none]
for (final ViewRiksdagenPartyCoalationAgainstAnnualSummary data : entry.getValue()) {
dataSeries.add(data.getEmbeddedId().getYear() + "-01-01", data.getTotal()); // depends on control dependency: [for], data = [data]
}
}
}
} }
|
public class class_name {
private Collection<Method> sortControllerMethods(Set<Method> controllerMethods) {
List<Method> list = new ArrayList<>(controllerMethods);
list.sort((m1, m2) -> {
int o1 = Integer.MAX_VALUE;
Order order1 = ClassUtils.getAnnotation(m1, Order.class);
if (order1 != null) {
o1 = order1.value();
}
int o2 = Integer.MAX_VALUE;
Order order2 = ClassUtils.getAnnotation(m2, Order.class);
if (order2 != null) {
o2 = order2.value();
}
if (o1 == o2) {
// same or unsorted, compare controller+controllerMethod
String s1 = LangUtils.toString(m1);
String s2 = LangUtils.toString(m2);
return s1.compareTo(s2);
}
return (o1 < o2) ? -1 : 1;
});
return list;
} }
|
public class class_name {
private Collection<Method> sortControllerMethods(Set<Method> controllerMethods) {
List<Method> list = new ArrayList<>(controllerMethods);
list.sort((m1, m2) -> {
int o1 = Integer.MAX_VALUE;
Order order1 = ClassUtils.getAnnotation(m1, Order.class);
if (order1 != null) {
o1 = order1.value(); // depends on control dependency: [if], data = [none]
}
int o2 = Integer.MAX_VALUE;
Order order2 = ClassUtils.getAnnotation(m2, Order.class);
if (order2 != null) {
o2 = order2.value(); // depends on control dependency: [if], data = [none]
}
if (o1 == o2) {
// same or unsorted, compare controller+controllerMethod
String s1 = LangUtils.toString(m1);
String s2 = LangUtils.toString(m2);
return s1.compareTo(s2); // depends on control dependency: [if], data = [none]
}
return (o1 < o2) ? -1 : 1;
});
return list;
} }
|
public class class_name {
public void loadDefault() {
try {
load( new BufferedReader(new StringReader(
DefaultTeXHyphenData.hyphenData) ) );
} catch(IOException e) {
// shouldn't happen
throw new RuntimeException(e);
}
} }
|
public class class_name {
public void loadDefault() {
try {
load( new BufferedReader(new StringReader(
DefaultTeXHyphenData.hyphenData) ) );
// depends on control dependency: [try], data = [none]
} catch(IOException e) {
// shouldn't happen
throw new RuntimeException(e);
}
// depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
private static boolean validatePart(String part, boolean isFinalPart) {
// These tests could be collapsed into one big boolean expression, but
// they have been left as independent tests for clarity.
if (part.length() < 1 || part.length() > MAX_DOMAIN_PART_LENGTH) {
return false;
}
/*
* GWT claims to support java.lang.Character's char-classification methods, but it actually only
* works for ASCII. So for now, assume any non-ASCII characters are valid. The only place this
* seems to be documented is here:
* http://osdir.com/ml/GoogleWebToolkitContributors/2010-03/msg00178.html
*
* <p>ASCII characters in the part are expected to be valid per RFC 1035, with underscore also
* being allowed due to widespread practice.
*/
String asciiChars = CharMatcher.ascii().retainFrom(part);
if (!PART_CHAR_MATCHER.matchesAllOf(asciiChars)) {
return false;
}
// No initial or final dashes or underscores.
if (DASH_MATCHER.matches(part.charAt(0))
|| DASH_MATCHER.matches(part.charAt(part.length() - 1))) {
return false;
}
/*
* Note that we allow (in contravention of a strict interpretation of the relevant RFCs) domain
* parts other than the last may begin with a digit (for example, "3com.com"). It's important to
* disallow an initial digit in the last part; it's the only thing that stops an IPv4 numeric
* address like 127.0.0.1 from looking like a valid domain name.
*/
if (isFinalPart && CharMatcher.digit().matches(part.charAt(0))) {
return false;
}
return true;
} }
|
public class class_name {
private static boolean validatePart(String part, boolean isFinalPart) {
// These tests could be collapsed into one big boolean expression, but
// they have been left as independent tests for clarity.
if (part.length() < 1 || part.length() > MAX_DOMAIN_PART_LENGTH) {
return false; // depends on control dependency: [if], data = [none]
}
/*
* GWT claims to support java.lang.Character's char-classification methods, but it actually only
* works for ASCII. So for now, assume any non-ASCII characters are valid. The only place this
* seems to be documented is here:
* http://osdir.com/ml/GoogleWebToolkitContributors/2010-03/msg00178.html
*
* <p>ASCII characters in the part are expected to be valid per RFC 1035, with underscore also
* being allowed due to widespread practice.
*/
String asciiChars = CharMatcher.ascii().retainFrom(part);
if (!PART_CHAR_MATCHER.matchesAllOf(asciiChars)) {
return false; // depends on control dependency: [if], data = [none]
}
// No initial or final dashes or underscores.
if (DASH_MATCHER.matches(part.charAt(0))
|| DASH_MATCHER.matches(part.charAt(part.length() - 1))) {
return false; // depends on control dependency: [if], data = [none]
}
/*
* Note that we allow (in contravention of a strict interpretation of the relevant RFCs) domain
* parts other than the last may begin with a digit (for example, "3com.com"). It's important to
* disallow an initial digit in the last part; it's the only thing that stops an IPv4 numeric
* address like 127.0.0.1 from looking like a valid domain name.
*/
if (isFinalPart && CharMatcher.digit().matches(part.charAt(0))) {
return false; // depends on control dependency: [if], data = [none]
}
return true;
} }
|
public class class_name {
@Override
public Set<String> getProviderNames() {
Set<String> result = new HashSet<>();
for (CurrencyProviderSpi spi : Bootstrap.getServices(CurrencyProviderSpi.class)) {
try {
result.add(spi.getProviderName());
} catch (Exception e) {
Logger.getLogger(DefaultMonetaryCurrenciesSingletonSpi.class.getName())
.log(Level.SEVERE, "Error loading currency provider names for " + spi.getClass().getName(),
e);
}
}
return result;
} }
|
public class class_name {
@Override
public Set<String> getProviderNames() {
Set<String> result = new HashSet<>();
for (CurrencyProviderSpi spi : Bootstrap.getServices(CurrencyProviderSpi.class)) {
try {
result.add(spi.getProviderName()); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
Logger.getLogger(DefaultMonetaryCurrenciesSingletonSpi.class.getName())
.log(Level.SEVERE, "Error loading currency provider names for " + spi.getClass().getName(),
e);
} // depends on control dependency: [catch], data = [none]
}
return result;
} }
|
public class class_name {
public void endLayer() {
int n = 1;
if (layerDepth != null && !layerDepth.isEmpty()) {
n = ((Integer)layerDepth.get(layerDepth.size() - 1)).intValue();
layerDepth.remove(layerDepth.size() - 1);
} else {
throw new IllegalPdfSyntaxException("Unbalanced layer operators." );
}
while (n-- > 0)
content.append("EMC").append_i(separator);
} }
|
public class class_name {
public void endLayer() {
int n = 1;
if (layerDepth != null && !layerDepth.isEmpty()) {
n = ((Integer)layerDepth.get(layerDepth.size() - 1)).intValue(); // depends on control dependency: [if], data = [(layerDepth]
layerDepth.remove(layerDepth.size() - 1); // depends on control dependency: [if], data = [(layerDepth]
} else {
throw new IllegalPdfSyntaxException("Unbalanced layer operators." );
}
while (n-- > 0)
content.append("EMC").append_i(separator);
} }
|
public class class_name {
public void addTargetHandler( TargetHandler targetItf ) {
if( targetItf != null ) {
this.logger.info( "Target handler '" + targetItf.getTargetId() + "' is now available in Roboconf's DM." );
synchronized( this.targetHandlers ) {
this.targetHandlers.add( targetItf );
}
listTargets( this.targetHandlers, this.logger );
}
} }
|
public class class_name {
public void addTargetHandler( TargetHandler targetItf ) {
if( targetItf != null ) {
this.logger.info( "Target handler '" + targetItf.getTargetId() + "' is now available in Roboconf's DM." ); // depends on control dependency: [if], data = [none]
synchronized( this.targetHandlers ) { // depends on control dependency: [if], data = [none]
this.targetHandlers.add( targetItf );
}
listTargets( this.targetHandlers, this.logger ); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public TerminalEmulatorDeviceConfiguration withBlinkLengthInMilliSeconds(int blinkLengthInMilliSeconds) {
if (this.blinkLengthInMilliSeconds == blinkLengthInMilliSeconds) {
return this;
} else {
return new TerminalEmulatorDeviceConfiguration(
this.lineBufferScrollbackSize,
blinkLengthInMilliSeconds,
this.cursorStyle,
this.cursorColor,
this.cursorBlinking,
this.clipboardAvailable);
}
} }
|
public class class_name {
public TerminalEmulatorDeviceConfiguration withBlinkLengthInMilliSeconds(int blinkLengthInMilliSeconds) {
if (this.blinkLengthInMilliSeconds == blinkLengthInMilliSeconds) {
return this; // depends on control dependency: [if], data = [none]
} else {
return new TerminalEmulatorDeviceConfiguration(
this.lineBufferScrollbackSize,
blinkLengthInMilliSeconds,
this.cursorStyle,
this.cursorColor,
this.cursorBlinking,
this.clipboardAvailable); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public synchronized ProviderLoader getLoaderForIdent(final ProviderIdent ident) throws ProviderLoaderException {
final cacheItem cacheItem = cache.get(ident);
if (null == cacheItem) {
return rescanForItem(ident);
}
final File file = cacheItem.getFirst();
if (cacheItem.getSecond().isExpired(ident, file)) {
remove(ident);
return rescanForItem(ident);
} else {
return loadFileProvider(cacheItem);
}
} }
|
public class class_name {
public synchronized ProviderLoader getLoaderForIdent(final ProviderIdent ident) throws ProviderLoaderException {
final cacheItem cacheItem = cache.get(ident);
if (null == cacheItem) {
return rescanForItem(ident); // depends on control dependency: [if], data = [none]
}
final File file = cacheItem.getFirst();
if (cacheItem.getSecond().isExpired(ident, file)) {
remove(ident); // depends on control dependency: [if], data = [none]
return rescanForItem(ident); // depends on control dependency: [if], data = [none]
} else {
return loadFileProvider(cacheItem); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@Nullable
public JAXBContext getFromCache (@Nonnull final Class <?> aClass, @Nullable final ClassLoader aClassLoader)
{
ValueEnforcer.notNull (aClass, "Class");
final Package aPackage = aClass.getPackage ();
if (aPackage.getAnnotation (XmlSchema.class) != null)
{
// Redirect to cached version
return getFromCache (aPackage, aClassLoader);
}
// E.g. an internal class - try anyway!
if (GlobalDebug.isDebugMode ())
LOGGER.info ("Creating JAXB context for class " + aClass.getName ());
if (aClassLoader != null)
LOGGER.warn ("Package " +
aPackage.getName () +
" does not seem to be JAXB generated. Therefore a new JAXBContext is created and the provided ClassLoader is ignored!");
try
{
// Using the version with a ClassLoader would require an
// ObjectFactory.class or an jaxb.index file in the same package!
return JAXBContext.newInstance (aClass);
}
catch (final JAXBException ex)
{
final String sMsg = "Failed to create JAXB context for class '" + aClass.getName () + "'";
LOGGER.error (sMsg + ": " + ex.getMessage ());
throw new IllegalArgumentException (sMsg, ex);
}
} }
|
public class class_name {
@Nullable
public JAXBContext getFromCache (@Nonnull final Class <?> aClass, @Nullable final ClassLoader aClassLoader)
{
ValueEnforcer.notNull (aClass, "Class");
final Package aPackage = aClass.getPackage ();
if (aPackage.getAnnotation (XmlSchema.class) != null)
{
// Redirect to cached version
return getFromCache (aPackage, aClassLoader); // depends on control dependency: [if], data = [none]
}
// E.g. an internal class - try anyway!
if (GlobalDebug.isDebugMode ())
LOGGER.info ("Creating JAXB context for class " + aClass.getName ());
if (aClassLoader != null)
LOGGER.warn ("Package " +
aPackage.getName () +
" does not seem to be JAXB generated. Therefore a new JAXBContext is created and the provided ClassLoader is ignored!");
try
{
// Using the version with a ClassLoader would require an
// ObjectFactory.class or an jaxb.index file in the same package!
return JAXBContext.newInstance (aClass); // depends on control dependency: [try], data = [none]
}
catch (final JAXBException ex)
{
final String sMsg = "Failed to create JAXB context for class '" + aClass.getName () + "'";
LOGGER.error (sMsg + ": " + ex.getMessage ());
throw new IllegalArgumentException (sMsg, ex);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public ProviderStatus getStatus() {
if (status == ProviderStatus.WARMING_UP) {
if (System.currentTimeMillis() > (Long) getDynamicAttr(ProviderInfoAttrs.ATTR_WARM_UP_END_TIME)) {
// 如果已经过了预热时间,恢复为正常
status = ProviderStatus.AVAILABLE;
setDynamicAttr(ProviderInfoAttrs.ATTR_WARM_UP_END_TIME, null);
}
}
return status;
} }
|
public class class_name {
public ProviderStatus getStatus() {
if (status == ProviderStatus.WARMING_UP) {
if (System.currentTimeMillis() > (Long) getDynamicAttr(ProviderInfoAttrs.ATTR_WARM_UP_END_TIME)) {
// 如果已经过了预热时间,恢复为正常
status = ProviderStatus.AVAILABLE; // depends on control dependency: [if], data = [none]
setDynamicAttr(ProviderInfoAttrs.ATTR_WARM_UP_END_TIME, null); // depends on control dependency: [if], data = [none]
}
}
return status;
} }
|
public class class_name {
public static List<List<Object>> buildResults(Result result,
GeoPackageDataType[] dataTypes, Integer limit) {
List<List<Object>> results = new ArrayList<>();
try {
int columns = result.getColumnCount();
while (result.moveToNext()) {
List<Object> row = new ArrayList<>();
for (int i = 0; i < columns; i++) {
row.add(result.getValue(i, dataTypes != null ? dataTypes[i]
: null));
}
results.add(row);
if (limit != null && results.size() >= limit) {
break;
}
}
} finally {
result.close();
}
return results;
} }
|
public class class_name {
public static List<List<Object>> buildResults(Result result,
GeoPackageDataType[] dataTypes, Integer limit) {
List<List<Object>> results = new ArrayList<>();
try {
int columns = result.getColumnCount();
while (result.moveToNext()) {
List<Object> row = new ArrayList<>();
for (int i = 0; i < columns; i++) {
row.add(result.getValue(i, dataTypes != null ? dataTypes[i]
: null)); // depends on control dependency: [for], data = [none]
}
results.add(row); // depends on control dependency: [while], data = [none]
if (limit != null && results.size() >= limit) {
break;
}
}
} finally {
result.close();
}
return results;
} }
|
public class class_name {
protected Object invokeStaticMissingProperty(Object instance, String propertyName, Object optionalValue, boolean isGetter) {
MetaClass mc = instance instanceof Class ? registry.getMetaClass((Class) instance) : this;
if (isGetter) {
MetaMethod propertyMissing = mc.getMetaMethod(STATIC_PROPERTY_MISSING, GETTER_MISSING_ARGS);
if (propertyMissing != null) {
return propertyMissing.invoke(instance, new Object[]{propertyName});
}
} else {
MetaMethod propertyMissing = mc.getMetaMethod(STATIC_PROPERTY_MISSING, SETTER_MISSING_ARGS);
if (propertyMissing != null) {
return propertyMissing.invoke(instance, new Object[]{propertyName, optionalValue});
}
}
if (instance instanceof Class) {
throw new MissingPropertyException(propertyName, (Class) instance);
}
throw new MissingPropertyException(propertyName, theClass);
} }
|
public class class_name {
protected Object invokeStaticMissingProperty(Object instance, String propertyName, Object optionalValue, boolean isGetter) {
MetaClass mc = instance instanceof Class ? registry.getMetaClass((Class) instance) : this;
if (isGetter) {
MetaMethod propertyMissing = mc.getMetaMethod(STATIC_PROPERTY_MISSING, GETTER_MISSING_ARGS);
if (propertyMissing != null) {
return propertyMissing.invoke(instance, new Object[]{propertyName}); // depends on control dependency: [if], data = [none]
}
} else {
MetaMethod propertyMissing = mc.getMetaMethod(STATIC_PROPERTY_MISSING, SETTER_MISSING_ARGS);
if (propertyMissing != null) {
return propertyMissing.invoke(instance, new Object[]{propertyName, optionalValue}); // depends on control dependency: [if], data = [none]
}
}
if (instance instanceof Class) {
throw new MissingPropertyException(propertyName, (Class) instance);
}
throw new MissingPropertyException(propertyName, theClass);
} }
|
public class class_name {
public void remove(T node) {
for (int i = 0; i < numberOfReplicas; i++) {
circle.remove(hashFunc.hash(node.toString() + i));
}
} }
|
public class class_name {
public void remove(T node) {
for (int i = 0; i < numberOfReplicas; i++) {
circle.remove(hashFunc.hash(node.toString() + i)); // depends on control dependency: [for], data = [i]
}
} }
|
public class class_name {
public void setViewPager(ViewPager viewPager) {
mTabStrip.removeAllViews();
mViewPager = viewPager;
if (viewPager != null) {
viewPager.setOnPageChangeListener(new InternalViewPagerListener());
populateTabStrip();
}
} }
|
public class class_name {
public void setViewPager(ViewPager viewPager) {
mTabStrip.removeAllViews();
mViewPager = viewPager;
if (viewPager != null) {
viewPager.setOnPageChangeListener(new InternalViewPagerListener()); // depends on control dependency: [if], data = [none]
populateTabStrip(); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private static String getExceptionMessage(final String[] exception) {
StringBuffer buff = new StringBuffer();
for (int i = 0; i < exception.length; i++) {
buff.append(exception[i]);
}
return buff.toString();
} }
|
public class class_name {
private static String getExceptionMessage(final String[] exception) {
StringBuffer buff = new StringBuffer();
for (int i = 0; i < exception.length; i++) {
buff.append(exception[i]); // depends on control dependency: [for], data = [i]
}
return buff.toString();
} }
|
public class class_name {
private void clusterIt() {
dendrogram = new LinkedPair[numItems-1];
logger.debug("Initial matrix: \n"+matrixToString());
for (int m=0;m<numItems-1;m++) {
updateIndicesToCheck(m);
LinkedPair pair = getClosestPair();
merge(pair);
dendrogram[m] = pair;
//if (debug) {
// System.out.println("Matrix after iteration "+m+" (merged "+pair.getFirst()+","+pair.getSecond()+")");
// printMatrix();
//}
}
} }
|
public class class_name {
private void clusterIt() {
dendrogram = new LinkedPair[numItems-1];
logger.debug("Initial matrix: \n"+matrixToString());
for (int m=0;m<numItems-1;m++) {
updateIndicesToCheck(m); // depends on control dependency: [for], data = [m]
LinkedPair pair = getClosestPair();
merge(pair);
dendrogram[m] = pair; // depends on control dependency: [for], data = [none]
//if (debug) {
// System.out.println("Matrix after iteration "+m+" (merged "+pair.getFirst()+","+pair.getSecond()+")");
// printMatrix();
//}
}
} }
|
public class class_name {
public String secureUrl(HttpServletRequest request, HttpServletResponse response) throws IOException {
String protocol = getProtocol(request);
if( protocol.equalsIgnoreCase(HTTP_PROTOCOL) ) {
int port = mapPort(TO_SECURE_PORT_MAP, getPort(request));
try {
URI newUri = changeProtocolAndPort(HTTPS_PROTOCOL, port == DEFAULT_HTTPS_PORT ? -1 : port, request);
return newUri.toString();
} catch (URISyntaxException e) {
throw new IllegalStateException("Failed to create URI.", e);
}
}
else {
throw new UnsupportedProtocolException("Cannot build secure url for "+protocol);
}
} }
|
public class class_name {
public String secureUrl(HttpServletRequest request, HttpServletResponse response) throws IOException {
String protocol = getProtocol(request);
if( protocol.equalsIgnoreCase(HTTP_PROTOCOL) ) {
int port = mapPort(TO_SECURE_PORT_MAP, getPort(request));
try {
URI newUri = changeProtocolAndPort(HTTPS_PROTOCOL, port == DEFAULT_HTTPS_PORT ? -1 : port, request);
return newUri.toString(); // depends on control dependency: [try], data = [none]
} catch (URISyntaxException e) {
throw new IllegalStateException("Failed to create URI.", e);
} // depends on control dependency: [catch], data = [none]
}
else {
throw new UnsupportedProtocolException("Cannot build secure url for "+protocol);
}
} }
|
public class class_name {
private AppModuleName setAppModuleNames(IServletContext isc) {
WebAppConfig webAppConfig = isc.getWebAppConfig();
if (webAppConfig.isSystemApp()) {
Tr.debug(tc, "Detected system app so won't track for health check; appName = ", webAppConfig.getApplicationName());
return null;
}
if (isOsgiApp(isc)) {
Tr.debug(tc, "Detected OSGi app, so won't track for health check; appName = ", webAppConfig.getApplicationName());
return null;
}
WebModuleMetaData webModuleMetaData = ((WebAppConfigExtended) webAppConfig).getMetaData();
String appName = webModuleMetaData.getApplicationMetaData().getName();
String moduleName = webModuleMetaData.getJ2EEName().toString();
return addAppModuleNames(appName, moduleName);
} }
|
public class class_name {
private AppModuleName setAppModuleNames(IServletContext isc) {
WebAppConfig webAppConfig = isc.getWebAppConfig();
if (webAppConfig.isSystemApp()) {
Tr.debug(tc, "Detected system app so won't track for health check; appName = ", webAppConfig.getApplicationName());
return null;
}
if (isOsgiApp(isc)) {
Tr.debug(tc, "Detected OSGi app, so won't track for health check; appName = ", webAppConfig.getApplicationName()); // depends on control dependency: [if], data = [none]
return null; // depends on control dependency: [if], data = [none]
}
WebModuleMetaData webModuleMetaData = ((WebAppConfigExtended) webAppConfig).getMetaData();
String appName = webModuleMetaData.getApplicationMetaData().getName();
String moduleName = webModuleMetaData.getJ2EEName().toString();
return addAppModuleNames(appName, moduleName);
} }
|
public class class_name {
public static double wrapDouble(double value, double min, double max)
{
double newValue = value;
final double step = max - min;
if (Double.compare(newValue, max) >= 0)
{
while (Double.compare(newValue, max) >= 0)
{
newValue -= step;
}
}
else if (newValue < min)
{
while (newValue < min)
{
newValue += step;
}
}
return newValue;
} }
|
public class class_name {
public static double wrapDouble(double value, double min, double max)
{
double newValue = value;
final double step = max - min;
if (Double.compare(newValue, max) >= 0)
{
while (Double.compare(newValue, max) >= 0)
{
newValue -= step; // depends on control dependency: [while], data = [none]
}
}
else if (newValue < min)
{
while (newValue < min)
{
newValue += step; // depends on control dependency: [while], data = [none]
}
}
return newValue;
} }
|
public class class_name {
private void initializeMappingTable() {
for (TaskBase taskClassObject : taskClassObjects) {
Class<? extends TaskBase> claz = taskClassObject.getClass();
for (Method method : claz.getDeclaredMethods()) {
for (Annotation annotation : method.getAnnotations()) {
if (annotation instanceof Task) {
String methodName = ((Task) annotation).name();
String methodVersion = ((Task) annotation).version();
String key = getKey(methodName, methodVersion);
if (!methodMap.containsKey(key)) {
methodMap.put(key, method);
objectMap.put(key, taskClassObject);
} else {
// duplicate name--version pair
throw new DuplicateTaskAnnotationException(methodName, methodVersion);
}
}
}
}
}
} }
|
public class class_name {
private void initializeMappingTable() {
for (TaskBase taskClassObject : taskClassObjects) {
Class<? extends TaskBase> claz = taskClassObject.getClass();
for (Method method : claz.getDeclaredMethods()) {
for (Annotation annotation : method.getAnnotations()) {
if (annotation instanceof Task) {
String methodName = ((Task) annotation).name();
String methodVersion = ((Task) annotation).version();
String key = getKey(methodName, methodVersion);
if (!methodMap.containsKey(key)) {
methodMap.put(key, method); // depends on control dependency: [if], data = [none]
objectMap.put(key, taskClassObject); // depends on control dependency: [if], data = [none]
} else {
// duplicate name--version pair
throw new DuplicateTaskAnnotationException(methodName, methodVersion);
}
}
}
}
}
} }
|
public class class_name {
private void handleAsyncComplete(boolean forceQueue, TCPReadCompletedCallback inCallback) {
boolean fireHere = true;
if (forceQueue) {
// Complete must be returned on a separate thread.
// Reuse queuedWork object (performance), but reset the error parameters.
queuedWork.setCompleteParameters(getConnLink().getVirtualConnection(), this, inCallback);
EventEngine events = SSLChannelProvider.getEventService();
if (null == events) {
Exception e = new Exception("missing event service");
FFDCFilter.processException(e, getClass().getName(), "471", this);
// fall-thru below and use callback here regardless
} else {
// fire an event to continue this queued work
Event event = events.createEvent(SSLEventHandler.TOPIC_QUEUED_WORK);
event.setProperty(SSLEventHandler.KEY_RUNNABLE, this.queuedWork);
events.postEvent(event);
fireHere = false;
}
}
if (fireHere) {
// Call the callback right here.
inCallback.complete(getConnLink().getVirtualConnection(), this);
}
} }
|
public class class_name {
private void handleAsyncComplete(boolean forceQueue, TCPReadCompletedCallback inCallback) {
boolean fireHere = true;
if (forceQueue) {
// Complete must be returned on a separate thread.
// Reuse queuedWork object (performance), but reset the error parameters.
queuedWork.setCompleteParameters(getConnLink().getVirtualConnection(), this, inCallback); // depends on control dependency: [if], data = [none]
EventEngine events = SSLChannelProvider.getEventService();
if (null == events) {
Exception e = new Exception("missing event service");
FFDCFilter.processException(e, getClass().getName(), "471", this); // depends on control dependency: [if], data = [none]
// fall-thru below and use callback here regardless
} else {
// fire an event to continue this queued work
Event event = events.createEvent(SSLEventHandler.TOPIC_QUEUED_WORK);
event.setProperty(SSLEventHandler.KEY_RUNNABLE, this.queuedWork); // depends on control dependency: [if], data = [none]
events.postEvent(event); // depends on control dependency: [if], data = [none]
fireHere = false; // depends on control dependency: [if], data = [none]
}
}
if (fireHere) {
// Call the callback right here.
inCallback.complete(getConnLink().getVirtualConnection(), this); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@Pure
public P getElementAt(int index) {
if (index >= 0 && index < this.referenceElementCount) {
int idx = 0;
for (final GridCellElement<P> element : this.elements) {
if (element.isReferenceCell(this)) {
if (idx == index) {
return element.get();
}
++idx;
}
}
}
throw new IndexOutOfBoundsException();
} }
|
public class class_name {
@Pure
public P getElementAt(int index) {
if (index >= 0 && index < this.referenceElementCount) {
int idx = 0;
for (final GridCellElement<P> element : this.elements) {
if (element.isReferenceCell(this)) {
if (idx == index) {
return element.get(); // depends on control dependency: [if], data = [none]
}
++idx; // depends on control dependency: [if], data = [none]
}
}
}
throw new IndexOutOfBoundsException();
} }
|
public class class_name {
public void setNoMatchReturnValue(String filterReturnValue) {
if (filterReturnValue.equalsIgnoreCase("accept")) {
noMatchReturnValue = ACCEPT;
} else if (filterReturnValue.equalsIgnoreCase("deny")) {
noMatchReturnValue = DENY;
} else if (filterReturnValue.equalsIgnoreCase("neutral")) {
noMatchReturnValue = NEUTRAL;
} else {
LogLog.error("invalid noMatchReturnValue: " + filterReturnValue);
}
} }
|
public class class_name {
public void setNoMatchReturnValue(String filterReturnValue) {
if (filterReturnValue.equalsIgnoreCase("accept")) {
noMatchReturnValue = ACCEPT; // depends on control dependency: [if], data = [none]
} else if (filterReturnValue.equalsIgnoreCase("deny")) {
noMatchReturnValue = DENY; // depends on control dependency: [if], data = [none]
} else if (filterReturnValue.equalsIgnoreCase("neutral")) {
noMatchReturnValue = NEUTRAL; // depends on control dependency: [if], data = [none]
} else {
LogLog.error("invalid noMatchReturnValue: " + filterReturnValue); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
protected void setActivePane(ElementTreePane pane) {
if (pane == activePane) {
return;
}
if (activePane != null) {
activePane.makeActivePane(false);
}
activePane = pane;
if (activePane != null) {
activePane.makeActivePane(true);
}
} }
|
public class class_name {
protected void setActivePane(ElementTreePane pane) {
if (pane == activePane) {
return; // depends on control dependency: [if], data = [none]
}
if (activePane != null) {
activePane.makeActivePane(false); // depends on control dependency: [if], data = [none]
}
activePane = pane;
if (activePane != null) {
activePane.makeActivePane(true); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@UiThread
public int getChildAdapterPosition() {
int flatPosition = getAdapterPosition();
if (mExpandableAdapter == null || flatPosition == RecyclerView.NO_POSITION) {
return RecyclerView.NO_POSITION;
}
return mExpandableAdapter.getChildPosition(flatPosition);
} }
|
public class class_name {
@UiThread
public int getChildAdapterPosition() {
int flatPosition = getAdapterPosition();
if (mExpandableAdapter == null || flatPosition == RecyclerView.NO_POSITION) {
return RecyclerView.NO_POSITION; // depends on control dependency: [if], data = [none]
}
return mExpandableAdapter.getChildPosition(flatPosition);
} }
|
public class class_name {
@Override
public void run() {
try {
log.info("UDP - client started: " + this.hostname + ":" + this.port);
isRunning = true;
buf = new ByteBuffer(5000);
buf.setString(getInitMessage()); // A buffer size of 5000 to handle the server_param message.
socket = new DatagramSocket();
// Timeout of 3mins to ensure that the coach stays connected.
socket.setSoTimeout(300000);
DatagramPacket p = new DatagramPacket(buf.getByteArray(), buf.getByteArray().length,
InetAddress.getByName(hostname), port);
socket.send(p);
socket.receive(p);
this.host = p.getAddress();
this.port = p.getPort();
received(buf.getString());
// Continue until the program is closed. This is where sserver messages are received.
while (isRunning) {
buf.reset();
DatagramPacket packet = new DatagramPacket(buf.getByteArray(), buf.getByteArray().length);
socket.receive(packet);
received(buf.getString());
}
} catch (Exception ex) {
log.error("Stopped running " + getName() + " " + getDescription() + " because: " + ex.toString());
}
// Clean up.
socket.close();
try {
buf.close();
} catch (IOException ex) {
log.error("Error cleaning up thread - " + ex.getMessage());
}
try {
this.finalize();
} catch (Throwable ex) {
log.error("Error cleaning up thread - " + ex.getMessage());
}
log.info("UDP - client terminated: " + this.hostname + ":" + this.port);
} }
|
public class class_name {
@Override
public void run() {
try {
log.info("UDP - client started: " + this.hostname + ":" + this.port); // depends on control dependency: [try], data = [none]
isRunning = true; // depends on control dependency: [try], data = [none]
buf = new ByteBuffer(5000); // depends on control dependency: [try], data = [none]
buf.setString(getInitMessage()); // A buffer size of 5000 to handle the server_param message. // depends on control dependency: [try], data = [none]
socket = new DatagramSocket(); // depends on control dependency: [try], data = [none]
// Timeout of 3mins to ensure that the coach stays connected.
socket.setSoTimeout(300000); // depends on control dependency: [try], data = [none]
DatagramPacket p = new DatagramPacket(buf.getByteArray(), buf.getByteArray().length,
InetAddress.getByName(hostname), port);
socket.send(p); // depends on control dependency: [try], data = [none]
socket.receive(p); // depends on control dependency: [try], data = [none]
this.host = p.getAddress(); // depends on control dependency: [try], data = [none]
this.port = p.getPort(); // depends on control dependency: [try], data = [none]
received(buf.getString()); // depends on control dependency: [try], data = [none]
// Continue until the program is closed. This is where sserver messages are received.
while (isRunning) {
buf.reset(); // depends on control dependency: [while], data = [none]
DatagramPacket packet = new DatagramPacket(buf.getByteArray(), buf.getByteArray().length);
socket.receive(packet); // depends on control dependency: [while], data = [none]
received(buf.getString()); // depends on control dependency: [while], data = [none]
}
} catch (Exception ex) {
log.error("Stopped running " + getName() + " " + getDescription() + " because: " + ex.toString());
} // depends on control dependency: [catch], data = [none]
// Clean up.
socket.close();
try {
buf.close(); // depends on control dependency: [try], data = [none]
} catch (IOException ex) {
log.error("Error cleaning up thread - " + ex.getMessage());
} // depends on control dependency: [catch], data = [none]
try {
this.finalize(); // depends on control dependency: [try], data = [none]
} catch (Throwable ex) {
log.error("Error cleaning up thread - " + ex.getMessage());
} // depends on control dependency: [catch], data = [none]
log.info("UDP - client terminated: " + this.hostname + ":" + this.port);
} }
|
public class class_name {
public DateInterval getDateRangeLimits() {
DateVetoPolicy policy = getVetoPolicy();
if (policy instanceof DateVetoPolicyMinimumMaximumDate) {
return ((DateVetoPolicyMinimumMaximumDate) policy).getDateRangeLimits();
}
return new DateInterval();
} }
|
public class class_name {
public DateInterval getDateRangeLimits() {
DateVetoPolicy policy = getVetoPolicy();
if (policy instanceof DateVetoPolicyMinimumMaximumDate) {
return ((DateVetoPolicyMinimumMaximumDate) policy).getDateRangeLimits(); // depends on control dependency: [if], data = [none]
}
return new DateInterval();
} }
|
public class class_name {
private boolean isWhitespace(char c) {
if (c > 0x20) {
return false;
}
if ((c == 0x20) || (c == 0x0a) || (c == 0x09) || (c == 0x0d)) {
return true;
}
return false; // illegal ...
} }
|
public class class_name {
private boolean isWhitespace(char c) {
if (c > 0x20) {
return false; // depends on control dependency: [if], data = [none]
}
if ((c == 0x20) || (c == 0x0a) || (c == 0x09) || (c == 0x0d)) {
return true; // depends on control dependency: [if], data = [none]
}
return false; // illegal ...
} }
|
public class class_name {
private static boolean advanceToFind(Iterator<?> iterator, Object value) {
while (iterator.hasNext()) {
if (Objects.equal(iterator.next(), value)) {
return true;
}
}
return false;
} }
|
public class class_name {
private static boolean advanceToFind(Iterator<?> iterator, Object value) {
while (iterator.hasNext()) {
if (Objects.equal(iterator.next(), value)) {
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
} }
|
public class class_name {
public T plus(
long amount,
U unit
) {
if (amount == 0) {
return this.getContext();
}
try {
return this.getChronology().getRule(unit).addTo(this.getContext(), amount);
} catch (IllegalArgumentException iae) {
ArithmeticException ex = new ArithmeticException("Result beyond boundaries of time axis.");
ex.initCause(iae);
throw ex;
}
} }
|
public class class_name {
public T plus(
long amount,
U unit
) {
if (amount == 0) {
return this.getContext(); // depends on control dependency: [if], data = [none]
}
try {
return this.getChronology().getRule(unit).addTo(this.getContext(), amount); // depends on control dependency: [try], data = [none]
} catch (IllegalArgumentException iae) {
ArithmeticException ex = new ArithmeticException("Result beyond boundaries of time axis.");
ex.initCause(iae);
throw ex;
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
protected void configureWordPressClient(final Collection<BaseClient> properties) {
val wp = pac4jProperties.getWordpress();
if (StringUtils.isNotBlank(wp.getId()) && StringUtils.isNotBlank(wp.getSecret())) {
val client = new WordPressClient(wp.getId(), wp.getSecret());
configureClient(client, wp);
LOGGER.debug("Created client [{}] with identifier [{}]", client.getName(), client.getKey());
properties.add(client);
}
} }
|
public class class_name {
protected void configureWordPressClient(final Collection<BaseClient> properties) {
val wp = pac4jProperties.getWordpress();
if (StringUtils.isNotBlank(wp.getId()) && StringUtils.isNotBlank(wp.getSecret())) {
val client = new WordPressClient(wp.getId(), wp.getSecret());
configureClient(client, wp); // depends on control dependency: [if], data = [none]
LOGGER.debug("Created client [{}] with identifier [{}]", client.getName(), client.getKey()); // depends on control dependency: [if], data = [none]
properties.add(client); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private String getDetailsAsHTML(String title, Level level, Throwable e) {
if (e != null) {
// convert the stacktrace into a more pleasent bit of HTML
StringBuffer html = new StringBuffer("<html>");
html.append("<h2>" + escapeXml(title) + "</h2>");
html.append("<HR size='1' noshade>");
html.append("<div></div>");
html.append("<b>Message:</b>");
html.append("<pre>");
html.append(" " + escapeXml(e.toString()));
html.append("</pre>");
html.append("<b>Level:</b>");
html.append("<pre>");
html.append(" " + level);
html.append("</pre>");
html.append("<b>Stack Trace:</b>");
html.append("<pre>");
for (StackTraceElement el : e.getStackTrace()) {
html.append(" " + el.toString().replace("<init>", "<init>") + "\n");
}
if (e.getCause() != null) {
html.append("</pre>");
html.append("<b>Cause:</b>");
html.append("<pre>");
html.append(e.getCause().getMessage());
html.append("</pre><pre>");
for (StackTraceElement el : e.getCause().getStackTrace()) {
html.append(" " + el.toString().replace("<init>", "<init>") + "\n");
}
}
html.append("</pre></html>");
return html.toString();
} else {
return null;
}
} }
|
public class class_name {
private String getDetailsAsHTML(String title, Level level, Throwable e) {
if (e != null) {
// convert the stacktrace into a more pleasent bit of HTML
StringBuffer html = new StringBuffer("<html>");
html.append("<h2>" + escapeXml(title) + "</h2>");
html.append("<HR size='1' noshade>");
html.append("<div></div>"); // depends on control dependency: [if], data = [none]
html.append("<b>Message:</b>");
html.append("<pre>"); // depends on control dependency: [if], data = [none]
html.append(" " + escapeXml(e.toString())); // depends on control dependency: [if], data = [(e]
html.append("</pre>"); // depends on control dependency: [if], data = [none]
html.append("<b>Level:</b>");
html.append("<pre>"); // depends on control dependency: [if], data = [none]
html.append(" " + level); // depends on control dependency: [if], data = [none]
html.append("</pre>"); // depends on control dependency: [if], data = [none]
html.append("<b>Stack Trace:</b>"); // depends on control dependency: [if], data = [none]
html.append("<pre>"); // depends on control dependency: [if], data = [none]
for (StackTraceElement el : e.getStackTrace()) {
html.append(" " + el.toString().replace("<init>", "<init>") + "\n"); // depends on control dependency: [for], data = [el]
}
if (e.getCause() != null) {
html.append("</pre>"); // depends on control dependency: [if], data = [none]
html.append("<b>Cause:</b>");
html.append("<pre>"); // depends on control dependency: [if], data = [none]
html.append(e.getCause().getMessage()); // depends on control dependency: [if], data = [(e.getCause()]
html.append("</pre><pre>"); // depends on control dependency: [if], data = [none]
for (StackTraceElement el : e.getCause().getStackTrace()) {
html.append(" " + el.toString().replace("<init>", "<init>") + "\n"); // depends on control dependency: [for], data = [el]
}
}
html.append("</pre></html>"); // depends on control dependency: [if], data = [none]
return html.toString(); // depends on control dependency: [if], data = [none]
} else {
return null; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@SuppressWarnings({ "rawtypes" })
@Override
public void writeObject(Object object) {
if (!checkWriteReference(object)) {
storeReference(object);
// create new map out of bean properties
BeanMap beanMap = new BeanMap(object);
// set of bean attributes
Set attrs = beanMap.keySet();
log.trace("Bean map keys: {}", attrs);
if (attrs.size() == 0 || (attrs.size() == 1 && beanMap.containsKey("class"))) {
// beanMap is empty or can only access "class" attribute, skip it
writeArbitraryObject(object);
return;
}
// write out either start of object marker for class name or "empty" start of object marker
Class<?> objectClass = object.getClass();
if (!objectClass.isAnnotationPresent(Anonymous.class)) {
buf.put(AMF.TYPE_CLASS_OBJECT);
putString(buf, Serializer.getClassName(objectClass));
} else {
buf.put(AMF.TYPE_OBJECT);
}
if (object instanceof ICustomSerializable) {
((ICustomSerializable) object).serialize(this);
buf.put(AMF.END_OF_OBJECT_SEQUENCE);
return;
}
// Iterate thru entries and write out property names with separators
for (Object key : attrs) {
String fieldName = key.toString();
log.debug("Field name: {} class: {}", fieldName, objectClass);
Field field = getField(objectClass, fieldName);
Method getter = getGetter(objectClass, beanMap, fieldName);
// Check if the Field corresponding to the getter/setter pair is transient
if (!serializeField(objectClass, fieldName, field, getter)) {
continue;
}
putString(buf, fieldName);
Serializer.serialize(this, field, getter, object, beanMap.get(key));
}
// write out end of object mark
buf.put(AMF.END_OF_OBJECT_SEQUENCE);
}
} }
|
public class class_name {
@SuppressWarnings({ "rawtypes" })
@Override
public void writeObject(Object object) {
if (!checkWriteReference(object)) {
storeReference(object); // depends on control dependency: [if], data = [none]
// create new map out of bean properties
BeanMap beanMap = new BeanMap(object);
// set of bean attributes
Set attrs = beanMap.keySet();
log.trace("Bean map keys: {}", attrs); // depends on control dependency: [if], data = [none]
if (attrs.size() == 0 || (attrs.size() == 1 && beanMap.containsKey("class"))) {
// beanMap is empty or can only access "class" attribute, skip it
writeArbitraryObject(object); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
// write out either start of object marker for class name or "empty" start of object marker
Class<?> objectClass = object.getClass();
if (!objectClass.isAnnotationPresent(Anonymous.class)) {
buf.put(AMF.TYPE_CLASS_OBJECT); // depends on control dependency: [if], data = [none]
putString(buf, Serializer.getClassName(objectClass)); // depends on control dependency: [if], data = [none]
} else {
buf.put(AMF.TYPE_OBJECT); // depends on control dependency: [if], data = [none]
}
if (object instanceof ICustomSerializable) {
((ICustomSerializable) object).serialize(this); // depends on control dependency: [if], data = [none]
buf.put(AMF.END_OF_OBJECT_SEQUENCE); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
// Iterate thru entries and write out property names with separators
for (Object key : attrs) {
String fieldName = key.toString();
log.debug("Field name: {} class: {}", fieldName, objectClass); // depends on control dependency: [for], data = [none]
Field field = getField(objectClass, fieldName);
Method getter = getGetter(objectClass, beanMap, fieldName);
// Check if the Field corresponding to the getter/setter pair is transient
if (!serializeField(objectClass, fieldName, field, getter)) {
continue;
}
putString(buf, fieldName); // depends on control dependency: [for], data = [none]
Serializer.serialize(this, field, getter, object, beanMap.get(key)); // depends on control dependency: [for], data = [key]
}
// write out end of object mark
buf.put(AMF.END_OF_OBJECT_SEQUENCE); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@Reference(policy = ReferencePolicy.DYNAMIC, cardinality = ReferenceCardinality.MULTIPLE, target = "(!(objectClass=com.ibm.ws.security.registry.FederationRegistry))")
protected Map<String, Object> setUserRegistry(ServiceReference<UserRegistry> ref) {
String configId = (String) ref.getProperty(KEY_CONFIG_ID);
String type = (String) ref.getProperty(KEY_TYPE);
if (configId != null && type != null) {
configId = parseIdFromConfigID(configId);
userRegistries.putReference(configId, ref);
} else {
if (type == null) {
Tr.error(tc, "USER_REGISTRY_SERVICE_WITHOUT_TYPE", ref.getProperty(KEY_COMPONENT_NAME));
}
if (configId == null) {
if (type != null) {
Tr.error(tc, "USER_REGISTRY_SERVICE_CONFIGURATION_WITHOUT_ID", type);
} else {
Tr.error(tc, "USER_REGISTRY_SERVICE_CONFIGURATION_WITHOUT_ID", UNKNOWN_TYPE);
}
}
}
if (type != null) {
registryTypes.add(type);
} else {
registryTypes.add(UNKNOWN_TYPE);
}
notifyListeners();
return refreshUserRegistryCache();
} }
|
public class class_name {
@Reference(policy = ReferencePolicy.DYNAMIC, cardinality = ReferenceCardinality.MULTIPLE, target = "(!(objectClass=com.ibm.ws.security.registry.FederationRegistry))")
protected Map<String, Object> setUserRegistry(ServiceReference<UserRegistry> ref) {
String configId = (String) ref.getProperty(KEY_CONFIG_ID);
String type = (String) ref.getProperty(KEY_TYPE);
if (configId != null && type != null) {
configId = parseIdFromConfigID(configId); // depends on control dependency: [if], data = [(configId]
userRegistries.putReference(configId, ref); // depends on control dependency: [if], data = [(configId]
} else {
if (type == null) {
Tr.error(tc, "USER_REGISTRY_SERVICE_WITHOUT_TYPE", ref.getProperty(KEY_COMPONENT_NAME)); // depends on control dependency: [if], data = [none]
}
if (configId == null) {
if (type != null) {
Tr.error(tc, "USER_REGISTRY_SERVICE_CONFIGURATION_WITHOUT_ID", type); // depends on control dependency: [if], data = [none]
} else {
Tr.error(tc, "USER_REGISTRY_SERVICE_CONFIGURATION_WITHOUT_ID", UNKNOWN_TYPE); // depends on control dependency: [if], data = [none]
}
}
}
if (type != null) {
registryTypes.add(type); // depends on control dependency: [if], data = [(type]
} else {
registryTypes.add(UNKNOWN_TYPE); // depends on control dependency: [if], data = [none]
}
notifyListeners();
return refreshUserRegistryCache();
} }
|
public class class_name {
public static void setProperty(Object object, String propertyName, Object propertyValue) {
Method method = getWriteMethod(object, propertyName);
if (method == null) {
throw new UnexpectedLiquibaseException (
String.format("Property [%s] was not found for object type [%s]", propertyName,
object.getClass().getName()
));
}
try {
if (propertyValue == null) {
setProperty(object, propertyName, null);
return;
}
if (!method.getParameterTypes()[0].isAssignableFrom(propertyValue.getClass())) {
setProperty(object, propertyName, propertyValue.toString());
return;
}
method.invoke(object, propertyValue);
} catch (IllegalAccessException | InvocationTargetException e) {
throw new UnexpectedLiquibaseException(e);
} catch (IllegalArgumentException e) {
throw new UnexpectedLiquibaseException("Cannot call " + method.toString() + " with value of type "
+ (propertyValue == null ? "null" : propertyValue.getClass().getName()));
}
} }
|
public class class_name {
public static void setProperty(Object object, String propertyName, Object propertyValue) {
Method method = getWriteMethod(object, propertyName);
if (method == null) {
throw new UnexpectedLiquibaseException (
String.format("Property [%s] was not found for object type [%s]", propertyName,
object.getClass().getName()
));
}
try {
if (propertyValue == null) {
setProperty(object, propertyName, null); // depends on control dependency: [if], data = [null)]
return; // depends on control dependency: [if], data = [none]
}
if (!method.getParameterTypes()[0].isAssignableFrom(propertyValue.getClass())) {
setProperty(object, propertyName, propertyValue.toString()); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
method.invoke(object, propertyValue); // depends on control dependency: [try], data = [none]
} catch (IllegalAccessException | InvocationTargetException e) {
throw new UnexpectedLiquibaseException(e);
} catch (IllegalArgumentException e) { // depends on control dependency: [catch], data = [none]
throw new UnexpectedLiquibaseException("Cannot call " + method.toString() + " with value of type "
+ (propertyValue == null ? "null" : propertyValue.getClass().getName()));
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
@Override
public <E> CollectionAttribute<X, E> getDeclaredCollection(String paramString, Class<E> paramClass)
{
PluralAttribute<X, ?, ?> declaredAttrib = getDeclaredPluralAttribute(paramString);
if (onCheckCollectionAttribute(declaredAttrib, paramClass))
{
return (CollectionAttribute<X, E>) declaredAttrib;
}
throw new IllegalArgumentException(
"attribute of the given name and type is not present in the managed type, for name:" + paramString
+ " , type:" + paramClass);
} }
|
public class class_name {
@Override
public <E> CollectionAttribute<X, E> getDeclaredCollection(String paramString, Class<E> paramClass)
{
PluralAttribute<X, ?, ?> declaredAttrib = getDeclaredPluralAttribute(paramString);
if (onCheckCollectionAttribute(declaredAttrib, paramClass))
{
return (CollectionAttribute<X, E>) declaredAttrib; // depends on control dependency: [if], data = [none]
}
throw new IllegalArgumentException(
"attribute of the given name and type is not present in the managed type, for name:" + paramString
+ " , type:" + paramClass);
} }
|
public class class_name {
public java.util.List<CustomKeyStoresListEntry> getCustomKeyStores() {
if (customKeyStores == null) {
customKeyStores = new com.amazonaws.internal.SdkInternalList<CustomKeyStoresListEntry>();
}
return customKeyStores;
} }
|
public class class_name {
public java.util.List<CustomKeyStoresListEntry> getCustomKeyStores() {
if (customKeyStores == null) {
customKeyStores = new com.amazonaws.internal.SdkInternalList<CustomKeyStoresListEntry>(); // depends on control dependency: [if], data = [none]
}
return customKeyStores;
} }
|
public class class_name {
public void await() { // public as parts
if (server == null) {
throw new IllegalStateException("server has not been started.");
}
try {
server.getServer().await();
} catch (Exception e) {
throw new IllegalStateException("server join failed.", e);
}
} }
|
public class class_name {
public void await() { // public as parts
if (server == null) {
throw new IllegalStateException("server has not been started.");
}
try {
server.getServer().await(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new IllegalStateException("server join failed.", e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
@Programmatic
public ApplicationPermission newPermission(
final ApplicationRole role,
final ApplicationPermissionRule rule,
final ApplicationPermissionMode mode,
final ApplicationFeatureType featureType,
final String featureFqn) {
final ApplicationFeatureId featureId = ApplicationFeatureId.newFeature(featureType, featureFqn);
final ApplicationFeature feature = applicationFeatureRepository.findFeature(featureId);
if(feature == null) {
container.warnUser("No such " + featureType.name().toLowerCase() + ": " + featureFqn);
return null;
}
return newPermissionNoCheck(role, rule, mode, featureType, featureFqn);
} }
|
public class class_name {
@Programmatic
public ApplicationPermission newPermission(
final ApplicationRole role,
final ApplicationPermissionRule rule,
final ApplicationPermissionMode mode,
final ApplicationFeatureType featureType,
final String featureFqn) {
final ApplicationFeatureId featureId = ApplicationFeatureId.newFeature(featureType, featureFqn);
final ApplicationFeature feature = applicationFeatureRepository.findFeature(featureId);
if(feature == null) {
container.warnUser("No such " + featureType.name().toLowerCase() + ": " + featureFqn); // depends on control dependency: [if], data = [none]
return null; // depends on control dependency: [if], data = [none]
}
return newPermissionNoCheck(role, rule, mode, featureType, featureFqn);
} }
|
public class class_name {
public <T> List<T> getOptional(Class<T> type, Object locator) {
try {
return find(type, locator, false);
} catch (Exception ex) {
return new ArrayList<T>();
}
} }
|
public class class_name {
public <T> List<T> getOptional(Class<T> type, Object locator) {
try {
return find(type, locator, false); // depends on control dependency: [try], data = [none]
} catch (Exception ex) {
return new ArrayList<T>();
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public DescribeExpressionsRequest withExpressionNames(String... expressionNames) {
if (this.expressionNames == null) {
setExpressionNames(new com.amazonaws.internal.SdkInternalList<String>(expressionNames.length));
}
for (String ele : expressionNames) {
this.expressionNames.add(ele);
}
return this;
} }
|
public class class_name {
public DescribeExpressionsRequest withExpressionNames(String... expressionNames) {
if (this.expressionNames == null) {
setExpressionNames(new com.amazonaws.internal.SdkInternalList<String>(expressionNames.length)); // depends on control dependency: [if], data = [none]
}
for (String ele : expressionNames) {
this.expressionNames.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} }
|
public class class_name {
public static Money add(Money money1, Money money2) {
if (money1 == null) {
return money2;
}
if (money2 == null) {
return money1;
}
return money1.plus(money2);
} }
|
public class class_name {
public static Money add(Money money1, Money money2) {
if (money1 == null) {
return money2;
// depends on control dependency: [if], data = [none]
}
if (money2 == null) {
return money1;
// depends on control dependency: [if], data = [none]
}
return money1.plus(money2);
} }
|
public class class_name {
private void applyAliases()
{
CustomFieldContainer fields = m_projectFile.getCustomFields();
for (Map.Entry<FieldType, String> entry : ALIASES.entrySet())
{
fields.getCustomField(entry.getKey()).setAlias(entry.getValue());
}
} }
|
public class class_name {
private void applyAliases()
{
CustomFieldContainer fields = m_projectFile.getCustomFields();
for (Map.Entry<FieldType, String> entry : ALIASES.entrySet())
{
fields.getCustomField(entry.getKey()).setAlias(entry.getValue()); // depends on control dependency: [for], data = [entry]
}
} }
|
public class class_name {
@SuppressWarnings("unchecked")
private void init(Object object, Parameterized parameterized, ResourceBundle bundle,
JCommander jCommander) {
this.object = object;
this.parameterized = parameterized;
this.bundle = bundle;
if (this.bundle == null) {
this.bundle = findResourceBundle(object);
}
this.jCommander = jCommander;
if (parameterAnnotation != null) {
String description;
if (Enum.class.isAssignableFrom(parameterized.getType())
&& parameterAnnotation.description().isEmpty()) {
description = "Options: " + EnumSet.allOf((Class<? extends Enum>) parameterized.getType());
}else {
description = parameterAnnotation.description();
}
initDescription(description, parameterAnnotation.descriptionKey(),
parameterAnnotation.names());
} else if (dynamicParameterAnnotation != null) {
initDescription(dynamicParameterAnnotation.description(),
dynamicParameterAnnotation.descriptionKey(),
dynamicParameterAnnotation.names());
} else {
throw new AssertionError("Shound never happen");
}
try {
defaultObject = parameterized.get(object);
} catch (Exception e) {
}
//
// Validate default values, if any and if applicable
//
if (defaultObject != null) {
if (parameterAnnotation != null) {
validateDefaultValues(parameterAnnotation.names());
}
}
} }
|
public class class_name {
@SuppressWarnings("unchecked")
private void init(Object object, Parameterized parameterized, ResourceBundle bundle,
JCommander jCommander) {
this.object = object;
this.parameterized = parameterized;
this.bundle = bundle;
if (this.bundle == null) {
this.bundle = findResourceBundle(object); // depends on control dependency: [if], data = [none]
}
this.jCommander = jCommander;
if (parameterAnnotation != null) {
String description;
if (Enum.class.isAssignableFrom(parameterized.getType())
&& parameterAnnotation.description().isEmpty()) {
description = "Options: " + EnumSet.allOf((Class<? extends Enum>) parameterized.getType()); // depends on control dependency: [if], data = [none]
}else {
description = parameterAnnotation.description(); // depends on control dependency: [if], data = [none]
}
initDescription(description, parameterAnnotation.descriptionKey(),
parameterAnnotation.names()); // depends on control dependency: [if], data = [none]
} else if (dynamicParameterAnnotation != null) {
initDescription(dynamicParameterAnnotation.description(),
dynamicParameterAnnotation.descriptionKey(),
dynamicParameterAnnotation.names()); // depends on control dependency: [if], data = [none]
} else {
throw new AssertionError("Shound never happen");
}
try {
defaultObject = parameterized.get(object); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
} // depends on control dependency: [catch], data = [none]
//
// Validate default values, if any and if applicable
//
if (defaultObject != null) {
if (parameterAnnotation != null) {
validateDefaultValues(parameterAnnotation.names()); // depends on control dependency: [if], data = [(parameterAnnotation]
}
}
} }
|
public class class_name {
public synchronized <T> T removeAttachment(final AttachmentKey<T> key) {
if (key == null) {
return null;
}
return key.cast(attachments.remove(key));
} }
|
public class class_name {
public synchronized <T> T removeAttachment(final AttachmentKey<T> key) {
if (key == null) {
return null; // depends on control dependency: [if], data = [none]
}
return key.cast(attachments.remove(key));
} }
|
public class class_name {
private static void writeToFile(String text, String logFilePath, boolean isDetailed) {
if (isSDCardAvailable() && isSDCardWritable() && text != null) {
try {
File file = new File(logFilePath);
OutputStream os = new FileOutputStream(file, true);
if (isDetailed) {
os.write(("---" + new SimpleDateFormat("yyyy/MM/dd HH:mm:ss.SSS").format(Calendar.getInstance().getTime()) + "---\n").getBytes());
}
os.write((text + "\n").getBytes());
// os.write(("------\n").getBytes());
os.close();
} catch (Exception e) {
QuickUtils.log.e("Exception", e);
}
} else {
return;
}
} }
|
public class class_name {
private static void writeToFile(String text, String logFilePath, boolean isDetailed) {
if (isSDCardAvailable() && isSDCardWritable() && text != null) {
try {
File file = new File(logFilePath);
OutputStream os = new FileOutputStream(file, true);
if (isDetailed) {
os.write(("---" + new SimpleDateFormat("yyyy/MM/dd HH:mm:ss.SSS").format(Calendar.getInstance().getTime()) + "---\n").getBytes());
// depends on control dependency: [if], data = [none]
}
os.write((text + "\n").getBytes());
// depends on control dependency: [try], data = [none]
// os.write(("------\n").getBytes());
os.close();
// depends on control dependency: [try], data = [none]
} catch (Exception e) {
QuickUtils.log.e("Exception", e);
}
// depends on control dependency: [catch], data = [none]
} else {
return;
// depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private ModelAndView getParamErrors(FieldException fe) {
if (fe.isGlobal()) {
if (fe.getGlobalErrorArgs() == null || fe.getGlobalErrorArgs().length <= 0) {
return buildError(fe.getGlobalErrorMsg(), ErrorCode.GLOBAL_ERROR);
} else {
return buildError(fe.getGlobalErrorMsg(), fe.getGlobalErrorArgs(), ErrorCode.GLOBAL_ERROR);
}
} else {
// 构造error的映射
Map<String, String> errorMap = fe.getMessageErrorMap();
Map<String, Object[]> errorArgs = fe.getMessageErrorArgs();
if (errorMap != null) {
if (errorArgs != null) {
return paramError(errorMap, errorArgs, ErrorCode.FIELD_ERROR);
}
return paramError(errorMap, ErrorCode.FIELD_ERROR);
}
return paramError(new HashMap<String, String>(), ErrorCode.FIELD_ERROR);
}
} }
|
public class class_name {
private ModelAndView getParamErrors(FieldException fe) {
if (fe.isGlobal()) {
if (fe.getGlobalErrorArgs() == null || fe.getGlobalErrorArgs().length <= 0) {
return buildError(fe.getGlobalErrorMsg(), ErrorCode.GLOBAL_ERROR); // depends on control dependency: [if], data = [none]
} else {
return buildError(fe.getGlobalErrorMsg(), fe.getGlobalErrorArgs(), ErrorCode.GLOBAL_ERROR); // depends on control dependency: [if], data = [none]
}
} else {
// 构造error的映射
Map<String, String> errorMap = fe.getMessageErrorMap();
Map<String, Object[]> errorArgs = fe.getMessageErrorArgs();
if (errorMap != null) {
if (errorArgs != null) {
return paramError(errorMap, errorArgs, ErrorCode.FIELD_ERROR); // depends on control dependency: [if], data = [none]
}
return paramError(errorMap, ErrorCode.FIELD_ERROR); // depends on control dependency: [if], data = [(errorMap]
}
return paramError(new HashMap<String, String>(), ErrorCode.FIELD_ERROR); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void set(int index, T object) {
synchronized (mLock) {
if (mOriginalValues != null) {
mOriginalValues.set(index, object);
} else {
mObjects.set(index, object);
}
}
if (mNotifyOnChange) notifyDataSetChanged();
} }
|
public class class_name {
public void set(int index, T object) {
synchronized (mLock) {
if (mOriginalValues != null) {
mOriginalValues.set(index, object); // depends on control dependency: [if], data = [none]
} else {
mObjects.set(index, object); // depends on control dependency: [if], data = [none]
}
}
if (mNotifyOnChange) notifyDataSetChanged();
} }
|
public class class_name {
public static String decodeHttpParams(String str)
{
if (str == null) {
return "";
}
StringBuffer buf = new StringBuffer();
char[] array = str.toCharArray();
for (int i = 0; i < array.length; i++) {
char ch = array[i];
if (ch == '%') {
if (i + 2 >= array.length) {
break;
}
int val = (array[++i] - '0');
val <<= 4;
val |= (array[++i] - '0');
ch = (char) val;
}
buf.append(ch);
}
return buf.toString();
} }
|
public class class_name {
public static String decodeHttpParams(String str)
{
if (str == null) {
return ""; // depends on control dependency: [if], data = [none]
}
StringBuffer buf = new StringBuffer();
char[] array = str.toCharArray();
for (int i = 0; i < array.length; i++) {
char ch = array[i];
if (ch == '%') {
if (i + 2 >= array.length) {
break;
}
int val = (array[++i] - '0');
val <<= 4; // depends on control dependency: [if], data = [none]
val |= (array[++i] - '0'); // depends on control dependency: [if], data = [none]
ch = (char) val; // depends on control dependency: [if], data = [(ch]
}
buf.append(ch); // depends on control dependency: [for], data = [none]
}
return buf.toString();
} }
|
public class class_name {
private static RepositoryPolicy asRepositoryPolicy(org.apache.maven.settings.RepositoryPolicy policy) {
boolean enabled = true;
String checksums = RepositoryPolicy.CHECKSUM_POLICY_WARN;
String updates = RepositoryPolicy.UPDATE_POLICY_DAILY;
if (policy != null) {
enabled = policy.isEnabled();
if (policy.getUpdatePolicy() != null) {
updates = policy.getUpdatePolicy();
}
if (policy.getChecksumPolicy() != null) {
checksums = policy.getChecksumPolicy();
}
}
return new RepositoryPolicy(enabled, updates, checksums);
} }
|
public class class_name {
private static RepositoryPolicy asRepositoryPolicy(org.apache.maven.settings.RepositoryPolicy policy) {
boolean enabled = true;
String checksums = RepositoryPolicy.CHECKSUM_POLICY_WARN;
String updates = RepositoryPolicy.UPDATE_POLICY_DAILY;
if (policy != null) {
enabled = policy.isEnabled(); // depends on control dependency: [if], data = [none]
if (policy.getUpdatePolicy() != null) {
updates = policy.getUpdatePolicy(); // depends on control dependency: [if], data = [none]
}
if (policy.getChecksumPolicy() != null) {
checksums = policy.getChecksumPolicy(); // depends on control dependency: [if], data = [none]
}
}
return new RepositoryPolicy(enabled, updates, checksums);
} }
|
public class class_name {
protected HttpUrl buildUrl(Endpoint endpoint, String path, String... segments) {
Preconditions.checkNotNull(endpoint);
Preconditions.checkNotNull(path);
HttpUrl.Builder builder = endpoint.buildUrl()
.addPathSegment(path);
for (String segment : segments) {
if (segment == null || segment.isEmpty()) {
continue;
}
builder = builder.addPathSegment(segment);
}
return builder.build();
} }
|
public class class_name {
protected HttpUrl buildUrl(Endpoint endpoint, String path, String... segments) {
Preconditions.checkNotNull(endpoint);
Preconditions.checkNotNull(path);
HttpUrl.Builder builder = endpoint.buildUrl()
.addPathSegment(path);
for (String segment : segments) {
if (segment == null || segment.isEmpty()) {
continue;
}
builder = builder.addPathSegment(segment); // depends on control dependency: [for], data = [segment]
}
return builder.build();
} }
|
public class class_name {
private void addRelationName(Relation rField)
{
if (rField != null && !rField.isRelatedViaJoinTable())
{
String relationName = getJoinColumnName(rField.getProperty());
if (rField.getProperty().isAnnotationPresent(PrimaryKeyJoinColumn.class))
{
relationName = this.getIdAttribute().getName();
}
addToRelationNameCollection(relationName);
}
} }
|
public class class_name {
private void addRelationName(Relation rField)
{
if (rField != null && !rField.isRelatedViaJoinTable())
{
String relationName = getJoinColumnName(rField.getProperty());
if (rField.getProperty().isAnnotationPresent(PrimaryKeyJoinColumn.class))
{
relationName = this.getIdAttribute().getName();
// depends on control dependency: [if], data = [none]
}
addToRelationNameCollection(relationName);
// depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static void removeFromList(List<String> list, String value) {
int foundIndex = -1;
int i = 0;
for (String id : list) {
if (id.equalsIgnoreCase(value)) {
foundIndex = i;
break;
}
i++;
}
if (foundIndex != -1) {
list.remove(foundIndex);
}
} }
|
public class class_name {
public static void removeFromList(List<String> list, String value) {
int foundIndex = -1;
int i = 0;
for (String id : list) {
if (id.equalsIgnoreCase(value)) {
foundIndex = i; // depends on control dependency: [if], data = [none]
break;
}
i++; // depends on control dependency: [for], data = [none]
}
if (foundIndex != -1) {
list.remove(foundIndex); // depends on control dependency: [if], data = [(foundIndex]
}
} }
|
public class class_name {
public boolean doCommand(String strCommand, ScreenField sourceSField, int iCommandOptions)
{
boolean bFlag = false;
if ((strCommand.indexOf("FileHdrScreen") != -1)
|| (strCommand.indexOf("LayoutScreen") != -1))
iCommandOptions = ScreenConstants.USE_NEW_WINDOW | ScreenConstants.DONT_PUSH_TO_BROWSER;
if ((strCommand.indexOf("ExportRecordsToXml") != -1)
|| (strCommand.indexOf("AccessGridScreen") != -1))
{
iCommandOptions = ScreenConstants.USE_NEW_WINDOW | ScreenConstants.DONT_PUSH_TO_BROWSER;
strCommand = Utility.addURLParam(strCommand, DBParams.RECORD, this.getMainRecord().getField(ClassInfo.CLASS_NAME).toString());
String packageName = ((ClassInfo)this.getMainRecord()).getPackageName(null);
strCommand = Utility.addURLParam(strCommand, "package", packageName);
strCommand = Utility.addURLParam(strCommand, "project", Converter.stripNonNumber(this.getMainRecord().getField(ClassInfo.CLASS_PROJECT_ID).toString()));
}
if (!DBConstants.RESET.equalsIgnoreCase(strCommand))
if ((this.getMainRecord().getEditMode() == DBConstants.EDIT_ADD)
|| (this.getMainRecord().getEditMode() == DBConstants.EDIT_IN_PROGRESS))
{
try {
this.getMainRecord().writeAndRefresh(false); // Make sure data is current before doing any command.
if (this.getScreenRecord().getField(ClassVars.CLASS_KEY).getListener(SwitchClassSub.class) != null)
{
ScreenField screen = ((SwitchClassSub)this.getScreenRecord().getField(ClassVars.CLASS_KEY).getListener(SwitchClassSub.class)).getSubScreen();
if (screen instanceof Screen)
((Screen)screen).getMainRecord().writeAndRefresh(false); // Make sure data is current before doing any command.
else if (screen instanceof GridScreen)
((GridScreen)screen).finalizeThisScreen(); //? Validate current row
}
} catch (DBException e) {
e.printStackTrace();
}
}
if (bFlag == false)
bFlag = super.doCommand(strCommand, sourceSField, iCommandOptions); // This will send the command to my parent
return bFlag;
} }
|
public class class_name {
public boolean doCommand(String strCommand, ScreenField sourceSField, int iCommandOptions)
{
boolean bFlag = false;
if ((strCommand.indexOf("FileHdrScreen") != -1)
|| (strCommand.indexOf("LayoutScreen") != -1))
iCommandOptions = ScreenConstants.USE_NEW_WINDOW | ScreenConstants.DONT_PUSH_TO_BROWSER;
if ((strCommand.indexOf("ExportRecordsToXml") != -1)
|| (strCommand.indexOf("AccessGridScreen") != -1))
{
iCommandOptions = ScreenConstants.USE_NEW_WINDOW | ScreenConstants.DONT_PUSH_TO_BROWSER; // depends on control dependency: [if], data = [none]
strCommand = Utility.addURLParam(strCommand, DBParams.RECORD, this.getMainRecord().getField(ClassInfo.CLASS_NAME).toString()); // depends on control dependency: [if], data = [none]
String packageName = ((ClassInfo)this.getMainRecord()).getPackageName(null);
strCommand = Utility.addURLParam(strCommand, "package", packageName); // depends on control dependency: [if], data = [none]
strCommand = Utility.addURLParam(strCommand, "project", Converter.stripNonNumber(this.getMainRecord().getField(ClassInfo.CLASS_PROJECT_ID).toString())); // depends on control dependency: [if], data = [none]
}
if (!DBConstants.RESET.equalsIgnoreCase(strCommand))
if ((this.getMainRecord().getEditMode() == DBConstants.EDIT_ADD)
|| (this.getMainRecord().getEditMode() == DBConstants.EDIT_IN_PROGRESS))
{
try {
this.getMainRecord().writeAndRefresh(false); // Make sure data is current before doing any command. // depends on control dependency: [try], data = [none]
if (this.getScreenRecord().getField(ClassVars.CLASS_KEY).getListener(SwitchClassSub.class) != null)
{
ScreenField screen = ((SwitchClassSub)this.getScreenRecord().getField(ClassVars.CLASS_KEY).getListener(SwitchClassSub.class)).getSubScreen();
if (screen instanceof Screen)
((Screen)screen).getMainRecord().writeAndRefresh(false); // Make sure data is current before doing any command.
else if (screen instanceof GridScreen)
((GridScreen)screen).finalizeThisScreen(); //? Validate current row
}
} catch (DBException e) {
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
}
if (bFlag == false)
bFlag = super.doCommand(strCommand, sourceSField, iCommandOptions); // This will send the command to my parent
return bFlag;
} }
|
public class class_name {
private static Object[] fitToVargs(Object[] argumentArrayOrig, CachedClass[] paramTypes) {
Class vargsClassOrig = paramTypes[paramTypes.length - 1].getTheClass().getComponentType();
Class vargsClass = ReflectionCache.autoboxType(vargsClassOrig);
Object[] argumentArray = argumentArrayOrig.clone();
MetaClassHelper.unwrap(argumentArray);
if (argumentArray.length == paramTypes.length - 1) {
// the vargs argument is missing, so fill it with an empty array
Object[] newArgs = new Object[paramTypes.length];
System.arraycopy(argumentArray, 0, newArgs, 0, argumentArray.length);
Object vargs = Array.newInstance(vargsClass, 0);
newArgs[newArgs.length - 1] = vargs;
return newArgs;
} else if (argumentArray.length == paramTypes.length) {
// the number of arguments is correct, but if the last argument
// is no array we have to wrap it in a array. If the last argument
// is null, then we don't have to do anything
Object lastArgument = argumentArray[argumentArray.length - 1];
if (lastArgument != null && !lastArgument.getClass().isArray()) {
// no array so wrap it
Object wrapped = makeCommonArray(argumentArray, paramTypes.length - 1, vargsClass);
Object[] newArgs = new Object[paramTypes.length];
System.arraycopy(argumentArray, 0, newArgs, 0, paramTypes.length - 1);
newArgs[newArgs.length - 1] = wrapped;
return newArgs;
} else {
// we may have to box the argument!
return argumentArray;
}
} else if (argumentArray.length > paramTypes.length) {
// the number of arguments is too big, wrap all exceeding elements
// in an array, but keep the old elements that are no vargs
Object[] newArgs = new Object[paramTypes.length];
// copy arguments that are not a varg
System.arraycopy(argumentArray, 0, newArgs, 0, paramTypes.length - 1);
// create a new array for the vargs and copy them
Object vargs = makeCommonArray(argumentArray, paramTypes.length - 1, vargsClass);
newArgs[newArgs.length - 1] = vargs;
return newArgs;
} else {
throw new GroovyBugError("trying to call a vargs method without enough arguments");
}
} }
|
public class class_name {
private static Object[] fitToVargs(Object[] argumentArrayOrig, CachedClass[] paramTypes) {
Class vargsClassOrig = paramTypes[paramTypes.length - 1].getTheClass().getComponentType();
Class vargsClass = ReflectionCache.autoboxType(vargsClassOrig);
Object[] argumentArray = argumentArrayOrig.clone();
MetaClassHelper.unwrap(argumentArray);
if (argumentArray.length == paramTypes.length - 1) {
// the vargs argument is missing, so fill it with an empty array
Object[] newArgs = new Object[paramTypes.length];
System.arraycopy(argumentArray, 0, newArgs, 0, argumentArray.length); // depends on control dependency: [if], data = [none]
Object vargs = Array.newInstance(vargsClass, 0);
newArgs[newArgs.length - 1] = vargs; // depends on control dependency: [if], data = [none]
return newArgs; // depends on control dependency: [if], data = [none]
} else if (argumentArray.length == paramTypes.length) {
// the number of arguments is correct, but if the last argument
// is no array we have to wrap it in a array. If the last argument
// is null, then we don't have to do anything
Object lastArgument = argumentArray[argumentArray.length - 1];
if (lastArgument != null && !lastArgument.getClass().isArray()) {
// no array so wrap it
Object wrapped = makeCommonArray(argumentArray, paramTypes.length - 1, vargsClass);
Object[] newArgs = new Object[paramTypes.length];
System.arraycopy(argumentArray, 0, newArgs, 0, paramTypes.length - 1); // depends on control dependency: [if], data = [none]
newArgs[newArgs.length - 1] = wrapped; // depends on control dependency: [if], data = [none]
return newArgs; // depends on control dependency: [if], data = [none]
} else {
// we may have to box the argument!
return argumentArray; // depends on control dependency: [if], data = [none]
}
} else if (argumentArray.length > paramTypes.length) {
// the number of arguments is too big, wrap all exceeding elements
// in an array, but keep the old elements that are no vargs
Object[] newArgs = new Object[paramTypes.length];
// copy arguments that are not a varg
System.arraycopy(argumentArray, 0, newArgs, 0, paramTypes.length - 1); // depends on control dependency: [if], data = [none]
// create a new array for the vargs and copy them
Object vargs = makeCommonArray(argumentArray, paramTypes.length - 1, vargsClass);
newArgs[newArgs.length - 1] = vargs; // depends on control dependency: [if], data = [none]
return newArgs; // depends on control dependency: [if], data = [none]
} else {
throw new GroovyBugError("trying to call a vargs method without enough arguments");
}
} }
|
public class class_name {
private void applyPropertyOverride(PropertyMetadata propertyMetadata) {
String name = propertyMetadata.getName();
Property override = entityMetadata.getPropertyOverride(name);
if (override != null) {
String mappedName = override.name();
if (mappedName != null && mappedName.trim().length() > 0) {
propertyMetadata.setMappedName(mappedName);
}
propertyMetadata.setIndexed(override.indexed());
propertyMetadata.setOptional(override.optional());
}
} }
|
public class class_name {
private void applyPropertyOverride(PropertyMetadata propertyMetadata) {
String name = propertyMetadata.getName();
Property override = entityMetadata.getPropertyOverride(name);
if (override != null) {
String mappedName = override.name();
if (mappedName != null && mappedName.trim().length() > 0) {
propertyMetadata.setMappedName(mappedName); // depends on control dependency: [if], data = [(mappedName]
}
propertyMetadata.setIndexed(override.indexed()); // depends on control dependency: [if], data = [(override]
propertyMetadata.setOptional(override.optional()); // depends on control dependency: [if], data = [(override]
}
} }
|
public class class_name {
protected void zipFile( InputStream is, ZipArchiveOutputStream zOut, String vPath, long lastModified, File fromArchive,
int mode, String symlinkDestination )
throws IOException, ArchiverException
{
if ( MANIFEST_NAME.equalsIgnoreCase( vPath ) )
{
if ( !doubleFilePass || skipWriting )
{
filesetManifest( fromArchive, is );
}
}
else if ( INDEX_NAME.equalsIgnoreCase( vPath ) && index )
{
getLogger().warn( "Warning: selected " + archiveType + " files include a META-INF/INDEX.LIST which will"
+ " be replaced by a newly generated one." );
}
else
{
if ( index && ( !vPath.contains( "/" ) ) )
{
rootEntries.addElement( vPath );
}
super.zipFile( is, zOut, vPath, lastModified, fromArchive, mode, symlinkDestination );
}
} }
|
public class class_name {
protected void zipFile( InputStream is, ZipArchiveOutputStream zOut, String vPath, long lastModified, File fromArchive,
int mode, String symlinkDestination )
throws IOException, ArchiverException
{
if ( MANIFEST_NAME.equalsIgnoreCase( vPath ) )
{
if ( !doubleFilePass || skipWriting )
{
filesetManifest( fromArchive, is ); // depends on control dependency: [if], data = [none]
}
}
else if ( INDEX_NAME.equalsIgnoreCase( vPath ) && index )
{
getLogger().warn( "Warning: selected " + archiveType + " files include a META-INF/INDEX.LIST which will"
+ " be replaced by a newly generated one." );
}
else
{
if ( index && ( !vPath.contains( "/" ) ) )
{
rootEntries.addElement( vPath ); // depends on control dependency: [if], data = [none]
}
super.zipFile( is, zOut, vPath, lastModified, fromArchive, mode, symlinkDestination );
}
} }
|
public class class_name {
void checkProperty(final String name) {
if (SecurityActions.getPropertyPrivileged(name) == null) {
propertiesToClear.add(name);
}
} }
|
public class class_name {
void checkProperty(final String name) {
if (SecurityActions.getPropertyPrivileged(name) == null) {
propertiesToClear.add(name); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private static boolean isRepoWS(String parameter)
{
String repWS = parameter;
repWS = repWS.replaceAll("\\\\", "/");
if ( !repWS.matches("[/][^/]+") && !repWS.matches("[/][^/]+[/][^/]+"))
{
return false;
}
else
{
return true;
}
} }
|
public class class_name {
private static boolean isRepoWS(String parameter)
{
String repWS = parameter;
repWS = repWS.replaceAll("\\\\", "/");
if ( !repWS.matches("[/][^/]+") && !repWS.matches("[/][^/]+[/][^/]+"))
{
return false;
// depends on control dependency: [if], data = [none]
}
else
{
return true;
// depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@Nullable
public Event nextInvalid() {
final Iterator<Entry<Integer, State>> iter = states.entrySet().iterator();
if (iter.hasNext()) {
final Entry<Integer, State> entry = iter.next();
State currentState = entry.getValue();
int address = entry.getKey();
iter.remove();
EventType event = currentState.randomInvalidTransition(rnd);
return new Event(event, address);
}
else {
return null;
}
} }
|
public class class_name {
@Nullable
public Event nextInvalid() {
final Iterator<Entry<Integer, State>> iter = states.entrySet().iterator();
if (iter.hasNext()) {
final Entry<Integer, State> entry = iter.next();
State currentState = entry.getValue();
int address = entry.getKey();
iter.remove(); // depends on control dependency: [if], data = [none]
EventType event = currentState.randomInvalidTransition(rnd);
return new Event(event, address); // depends on control dependency: [if], data = [none]
}
else {
return null; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private JSONValue toJsonStringList(Collection<? extends Object> list) {
if (null != list) {
JSONArray array = new JSONArray();
for (Object o : list) {
array.set(array.size(), new JSONString(o.toString()));
}
return array;
} else {
return null;
}
} }
|
public class class_name {
private JSONValue toJsonStringList(Collection<? extends Object> list) {
if (null != list) {
JSONArray array = new JSONArray();
for (Object o : list) {
array.set(array.size(), new JSONString(o.toString())); // depends on control dependency: [for], data = [o]
}
return array; // depends on control dependency: [if], data = [none]
} else {
return null; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private SectionContainer buildSectionStructure(List<SectionContent> scl)
{
SectionContainer result = new SectionContainer(0);
for (SectionContent sContent : scl)
{
int contentLevel = sContent.getLevel();
SectionContainer sContainer = result;
// get the right SectionContainer or create it
for (int containerLevel = result.getLevel() + 1; containerLevel < contentLevel; containerLevel++)
{
int containerSubSections = sContainer.nrOfSubSections();
if (containerSubSections != 0)
{
Section temp = sContainer
.getSubSection(containerSubSections - 1);
if (temp.getClass() == SectionContainer.class)
{
sContainer = (SectionContainer) temp;
}
else
{
SectionContainer sct = new SectionContainer(temp
.getTitleElement(), containerLevel);
sct.addSection(temp);
if (calculateSrcSpans)
{
sct.setSrcSpan(temp.getSrcSpan());
}
temp.setTitleElement(null);
temp.setLevel(containerLevel + 1);
sContainer.removeSection(temp);
sContainer.addSection(sct);
sContainer = sct;
}
}
else
{
sContainer = new SectionContainer(null, containerLevel);
}
}
sContainer.addSection(sContent);
}
if (calculateSrcSpans)
{
result.setSrcSpan(new SrcSpan(0, -1));
}
return result;
} }
|
public class class_name {
private SectionContainer buildSectionStructure(List<SectionContent> scl)
{
SectionContainer result = new SectionContainer(0);
for (SectionContent sContent : scl)
{
int contentLevel = sContent.getLevel();
SectionContainer sContainer = result;
// get the right SectionContainer or create it
for (int containerLevel = result.getLevel() + 1; containerLevel < contentLevel; containerLevel++)
{
int containerSubSections = sContainer.nrOfSubSections();
if (containerSubSections != 0)
{
Section temp = sContainer
.getSubSection(containerSubSections - 1);
if (temp.getClass() == SectionContainer.class)
{
sContainer = (SectionContainer) temp; // depends on control dependency: [if], data = [none]
}
else
{
SectionContainer sct = new SectionContainer(temp
.getTitleElement(), containerLevel);
sct.addSection(temp); // depends on control dependency: [if], data = [none]
if (calculateSrcSpans)
{
sct.setSrcSpan(temp.getSrcSpan()); // depends on control dependency: [if], data = [none]
}
temp.setTitleElement(null); // depends on control dependency: [if], data = [none]
temp.setLevel(containerLevel + 1); // depends on control dependency: [if], data = [none]
sContainer.removeSection(temp); // depends on control dependency: [if], data = [none]
sContainer.addSection(sct); // depends on control dependency: [if], data = [none]
sContainer = sct; // depends on control dependency: [if], data = [none]
}
}
else
{
sContainer = new SectionContainer(null, containerLevel); // depends on control dependency: [if], data = [none]
}
}
sContainer.addSection(sContent); // depends on control dependency: [for], data = [sContent]
}
if (calculateSrcSpans)
{
result.setSrcSpan(new SrcSpan(0, -1)); // depends on control dependency: [if], data = [none]
}
return result;
} }
|
public class class_name {
private static void checkPartForTextType(HashMap<String, Collection<String>> bodies, Part part) throws IOException, MessagingException {
Object content = part.getContent();
if (content instanceof CharSequence) {
String ct = part.getContentType();
Collection<String> value = bodies.get(ct);
if (value != null) {
value.add(content.toString());
} else {
value = new LinkedList<>();
value.add(content.toString());
bodies.put(ct, value);
}
} else if (content instanceof Multipart) {
Multipart mp = (Multipart) content;
for(int i = 0; i < mp.getCount(); i++) {
checkPartForTextType(bodies, mp.getBodyPart(i));
}
}
} }
|
public class class_name {
private static void checkPartForTextType(HashMap<String, Collection<String>> bodies, Part part) throws IOException, MessagingException {
Object content = part.getContent();
if (content instanceof CharSequence) {
String ct = part.getContentType();
Collection<String> value = bodies.get(ct);
if (value != null) {
value.add(content.toString()); // depends on control dependency: [if], data = [none]
} else {
value = new LinkedList<>(); // depends on control dependency: [if], data = [none]
value.add(content.toString()); // depends on control dependency: [if], data = [none]
bodies.put(ct, value); // depends on control dependency: [if], data = [none]
}
} else if (content instanceof Multipart) {
Multipart mp = (Multipart) content;
for(int i = 0; i < mp.getCount(); i++) {
checkPartForTextType(bodies, mp.getBodyPart(i)); // depends on control dependency: [for], data = [i]
}
}
} }
|
public class class_name {
protected void findLocations(String newServerName,
String instanceDirStr,
String outputDirStr,
String logDirStr,
String consoleLogFileStr) throws LocationException {
// Server name only found via command line
setProcessName(newServerName);
// always use the parent of the lib dir as WLP_INSTALL_ROOT
installRoot = bootstrapLib.getParentFile();
// WLP_USER_DIR = /wlp/usr
if (instanceDirStr == null)
userRoot = new File(installRoot, BootstrapConstants.LOC_AREA_NAME_USR);
else
userRoot = assertDirectory(FileUtils.normalize(instanceDirStr), BootstrapConstants.ENV_WLP_USER_DIR);
// /wlp/usr/servers
processesRoot = new File(userRoot, getProcessesSubdirectory());
// /wlp/usr/servers/serverName
configDir = new File(processesRoot, processName);
// Canonicalize server name for case-insensitive file systems.
// UNLESS it is a symlink, in which case we just try to match case.
String canonicalServerName = processName;
try {
// canonicalServerName = configDir.getCanonicalFile().getName();
File parentDir = configDir.getParentFile();
if (!isSymbolicLink(configDir, parentDir)) {
canonicalServerName = configDir.getCanonicalFile().getName();
if (!processName.equals(canonicalServerName)) {
processName = canonicalServerName;
// Recreate configDir (rather than using the result of
// getCanonicalFile above) to preserve symlinks.
configDir = new File(processesRoot, processName);
}
} else {
// Find exact match, OR find case-variant if exact fails.
File candidate = null;
File[] siblings = parentDir.listFiles();
File canonicalConfigDir = configDir.getCanonicalFile();
for (int i = 0; i < siblings.length; ++i) {
File sibling = siblings[i];
if (!sibling.isDirectory())
continue;
String sibname = sibling.getCanonicalFile().getName();
if (sibname.equals(processName)) {
candidate = sibling;
break; // exact match exists, use as it stands
} else if (sibname.equalsIgnoreCase(processName)) {
if (sibling.getCanonicalFile().equals(canonicalConfigDir))
candidate = sibling; // Not exact match, but same file.
// Continue scanning in case exact match also exists.
// If several exist with varying case but nothing is exact...
// we currently take last-found; could instead order lexically, or
// could tell the user to stop typing nonsense.
}
}
if (candidate != null) {
processName = candidate.getName();
// Recreate configDir (rather than using the result of
// getCanonicalFile above) to preserve symlinks.
configDir = new File(processesRoot, processName);
}
}
} catch (IOException e) {
// Ignore.
}
if (outputDirStr == null) {
outputRoot = processesRoot;
outputDir = configDir;
} else {
// separate output dir, WLP_OUTPUT_DIR
outputRoot = assertDirectory(FileUtils.normalize(outputDirStr), getOutputDirectoryEnvName());
outputDir = new File(outputRoot, processName);
}
// Logs could be redirected to a place other than the server output dir (like /var/log.. )
if (logDirStr == null)
logDir = new File(outputDir, BootstrapConstants.LOC_AREA_NAME_LOGS);
else
logDir = assertDirectory(FileUtils.normalize(logDirStr), BootstrapConstants.ENV_LOG_DIR);
consoleLogFile = new File(logDir, consoleLogFileStr != null ? consoleLogFileStr : BootstrapConstants.CONSOLE_LOG);
// Server workarea always a child of outputDir
workarea = new File(outputDir, BootstrapConstants.LOC_AREA_NAME_WORKING);
} }
|
public class class_name {
protected void findLocations(String newServerName,
String instanceDirStr,
String outputDirStr,
String logDirStr,
String consoleLogFileStr) throws LocationException {
// Server name only found via command line
setProcessName(newServerName);
// always use the parent of the lib dir as WLP_INSTALL_ROOT
installRoot = bootstrapLib.getParentFile();
// WLP_USER_DIR = /wlp/usr
if (instanceDirStr == null)
userRoot = new File(installRoot, BootstrapConstants.LOC_AREA_NAME_USR);
else
userRoot = assertDirectory(FileUtils.normalize(instanceDirStr), BootstrapConstants.ENV_WLP_USER_DIR);
// /wlp/usr/servers
processesRoot = new File(userRoot, getProcessesSubdirectory());
// /wlp/usr/servers/serverName
configDir = new File(processesRoot, processName);
// Canonicalize server name for case-insensitive file systems.
// UNLESS it is a symlink, in which case we just try to match case.
String canonicalServerName = processName;
try {
// canonicalServerName = configDir.getCanonicalFile().getName();
File parentDir = configDir.getParentFile();
if (!isSymbolicLink(configDir, parentDir)) {
canonicalServerName = configDir.getCanonicalFile().getName(); // depends on control dependency: [if], data = [none]
if (!processName.equals(canonicalServerName)) {
processName = canonicalServerName; // depends on control dependency: [if], data = [none]
// Recreate configDir (rather than using the result of
// getCanonicalFile above) to preserve symlinks.
configDir = new File(processesRoot, processName); // depends on control dependency: [if], data = [none]
}
} else {
// Find exact match, OR find case-variant if exact fails.
File candidate = null;
File[] siblings = parentDir.listFiles();
File canonicalConfigDir = configDir.getCanonicalFile();
for (int i = 0; i < siblings.length; ++i) {
File sibling = siblings[i];
if (!sibling.isDirectory())
continue;
String sibname = sibling.getCanonicalFile().getName();
if (sibname.equals(processName)) {
candidate = sibling; // depends on control dependency: [if], data = [none]
break; // exact match exists, use as it stands
} else if (sibname.equalsIgnoreCase(processName)) {
if (sibling.getCanonicalFile().equals(canonicalConfigDir))
candidate = sibling; // Not exact match, but same file.
// Continue scanning in case exact match also exists.
// If several exist with varying case but nothing is exact...
// we currently take last-found; could instead order lexically, or
// could tell the user to stop typing nonsense.
}
}
if (candidate != null) {
processName = candidate.getName(); // depends on control dependency: [if], data = [none]
// Recreate configDir (rather than using the result of
// getCanonicalFile above) to preserve symlinks.
configDir = new File(processesRoot, processName); // depends on control dependency: [if], data = [none]
}
}
} catch (IOException e) {
// Ignore.
}
if (outputDirStr == null) {
outputRoot = processesRoot;
outputDir = configDir;
} else {
// separate output dir, WLP_OUTPUT_DIR
outputRoot = assertDirectory(FileUtils.normalize(outputDirStr), getOutputDirectoryEnvName());
outputDir = new File(outputRoot, processName);
}
// Logs could be redirected to a place other than the server output dir (like /var/log.. )
if (logDirStr == null)
logDir = new File(outputDir, BootstrapConstants.LOC_AREA_NAME_LOGS);
else
logDir = assertDirectory(FileUtils.normalize(logDirStr), BootstrapConstants.ENV_LOG_DIR);
consoleLogFile = new File(logDir, consoleLogFileStr != null ? consoleLogFileStr : BootstrapConstants.CONSOLE_LOG);
// Server workarea always a child of outputDir
workarea = new File(outputDir, BootstrapConstants.LOC_AREA_NAME_WORKING);
} }
|
public class class_name {
@Override
public InputStream getResourceAsStream(String resourceName, boolean processingBundle) {
InputStream is = null;
if (!resourceName.contains(":") && isAccessPermitted(resourceName)) {
is = context.getResourceAsStream(resourceName);
}
return is;
} }
|
public class class_name {
@Override
public InputStream getResourceAsStream(String resourceName, boolean processingBundle) {
InputStream is = null;
if (!resourceName.contains(":") && isAccessPermitted(resourceName)) {
is = context.getResourceAsStream(resourceName); // depends on control dependency: [if], data = [none]
}
return is;
} }
|
public class class_name {
List<File> findNonJdkJars() throws IOException, SAXException, XPathExpressionException, ParserConfigurationException {
Enumeration<URL> manifests = LibraryVersions.class.getClassLoader().getResources("META-INF/MANIFEST.MF");
String javaHome = System.getProperty("java.home");
List<File> ret = new LinkedList<File>();
while (manifests.hasMoreElements()) {
URL u = manifests.nextElement();
// jar:file:/home/username/.m2/repository/org/slf4j/slf4j-jdk14/1.5.0/slf4j-jdk14-1.5.0.jar!/META-INF/MANIFEST.MF
// we're not interested if it's not a jar, although how you'd have a MANIFEST.MF which wasn't in a jar?
if (u.getProtocol().equals("jar")) {
// file:/home/username/.m2/repository/com/betfair/tornjak/kpi/3.0-SNAPSHOT/kpi-3.0-SNAPSHOT.jar!/META-INF/MANIFEST.MF
String file = u.getFile();
// file:/home/username/.m2/repository/com/betfair/tornjak/kpi/3.0-SNAPSHOT/kpi-3.0-SNAPSHOT.jar
file = file.substring(0, file.indexOf("!"));
// /home/username/.m2/repository/com/betfair/tornjak/kpi/3.0-SNAPSHOT/kpi-3.0-SNAPSHOT.jar
file = file.substring(5);
// remove %20 etc
file = URLDecoder.decode(file, "UTF-8");
File f = new File(file);
String canonicalPath = f.getCanonicalPath();
if (!canonicalPath.startsWith(javaHome)) {
ret.add(f);
}
} else {
logger.info("Can't include code in checksum which isn't in a JAR: " + u);
}
}
return ret;
} }
|
public class class_name {
List<File> findNonJdkJars() throws IOException, SAXException, XPathExpressionException, ParserConfigurationException {
Enumeration<URL> manifests = LibraryVersions.class.getClassLoader().getResources("META-INF/MANIFEST.MF");
String javaHome = System.getProperty("java.home");
List<File> ret = new LinkedList<File>();
while (manifests.hasMoreElements()) {
URL u = manifests.nextElement();
// jar:file:/home/username/.m2/repository/org/slf4j/slf4j-jdk14/1.5.0/slf4j-jdk14-1.5.0.jar!/META-INF/MANIFEST.MF
// we're not interested if it's not a jar, although how you'd have a MANIFEST.MF which wasn't in a jar?
if (u.getProtocol().equals("jar")) {
// file:/home/username/.m2/repository/com/betfair/tornjak/kpi/3.0-SNAPSHOT/kpi-3.0-SNAPSHOT.jar!/META-INF/MANIFEST.MF
String file = u.getFile();
// file:/home/username/.m2/repository/com/betfair/tornjak/kpi/3.0-SNAPSHOT/kpi-3.0-SNAPSHOT.jar
file = file.substring(0, file.indexOf("!"));
// /home/username/.m2/repository/com/betfair/tornjak/kpi/3.0-SNAPSHOT/kpi-3.0-SNAPSHOT.jar
file = file.substring(5);
// remove %20 etc
file = URLDecoder.decode(file, "UTF-8");
File f = new File(file);
String canonicalPath = f.getCanonicalPath();
if (!canonicalPath.startsWith(javaHome)) {
ret.add(f); // depends on control dependency: [if], data = [none]
}
} else {
logger.info("Can't include code in checksum which isn't in a JAR: " + u);
}
}
return ret;
} }
|
public class class_name {
<T> Mapping<T> begin(Mapping<T> mapping) {
if (mapping == null) {
throw new IllegalArgumentException("Method argument mapping must not be null");
}
OngoingMappings ongoingMappings = getOrCreateMappings();
@SuppressWarnings("unchecked")
Mapping<T> alreadyExistingMapping = ongoingMappings.get(mapping);
if (alreadyExistingMapping == null) {
trackNestedMapping(ongoingMappings);
ongoingMappings.add(mapping);
}
return alreadyExistingMapping;
} }
|
public class class_name {
<T> Mapping<T> begin(Mapping<T> mapping) {
if (mapping == null) {
throw new IllegalArgumentException("Method argument mapping must not be null");
}
OngoingMappings ongoingMappings = getOrCreateMappings();
@SuppressWarnings("unchecked")
Mapping<T> alreadyExistingMapping = ongoingMappings.get(mapping);
if (alreadyExistingMapping == null) {
trackNestedMapping(ongoingMappings); // depends on control dependency: [if], data = [none]
ongoingMappings.add(mapping); // depends on control dependency: [if], data = [none]
}
return alreadyExistingMapping;
} }
|
public class class_name {
public static boolean addBuffersToStream(ByteBuf[] buffers, OutputStream stream) {
if (!sZeroCopySendSupported || !stream.getClass().equals(sBufferList.getDeclaringClass())) {
return false;
}
try {
if (sCurrent.get(stream) != null) {
return false;
}
for (ByteBuf buffer : buffers) {
Object nettyBuffer = sNettyWritableBufferConstructor.newInstance(buffer);
List list = (List) sBufferList.get(stream);
list.add(nettyBuffer);
buffer.retain();
sCurrent.set(stream, nettyBuffer);
}
return true;
} catch (Exception e) {
LOG.warn("Failed to add data buffer to stream: {}.", e.getMessage());
return false;
}
} }
|
public class class_name {
public static boolean addBuffersToStream(ByteBuf[] buffers, OutputStream stream) {
if (!sZeroCopySendSupported || !stream.getClass().equals(sBufferList.getDeclaringClass())) {
return false; // depends on control dependency: [if], data = [none]
}
try {
if (sCurrent.get(stream) != null) {
return false; // depends on control dependency: [if], data = [none]
}
for (ByteBuf buffer : buffers) {
Object nettyBuffer = sNettyWritableBufferConstructor.newInstance(buffer);
List list = (List) sBufferList.get(stream);
list.add(nettyBuffer); // depends on control dependency: [for], data = [none]
buffer.retain(); // depends on control dependency: [for], data = [buffer]
sCurrent.set(stream, nettyBuffer); // depends on control dependency: [for], data = [none]
}
return true;
} catch (Exception e) {
LOG.warn("Failed to add data buffer to stream: {}.", e.getMessage());
return false;
}
} }
|
public class class_name {
public void bind(NameComponent[] nc, org.omg.CORBA.Object obj) throws NotFound, CannotProceed, InvalidName,
AlreadyBound {
if (this.destroyed)
throw new CannotProceed();
if (nc == null || nc.length == 0)
throw new InvalidName();
if (obj == null)
throw new org.omg.CORBA.BAD_PARAM();
Name n = new Name(nc);
Name ctx = n.ctxName();
NameComponent nb = n.baseNameComponent();
if (ctx == null) {
if (this.names.containsKey(n)) {
// if the name is still in use, try to ping the object
org.omg.CORBA.Object ref = (org.omg.CORBA.Object) this.names.get(n);
if (isDead(ref)) {
rebind(n.components(), obj);
return;
}
throw new AlreadyBound();
} else if (this.contexts.containsKey(n)) {
// if the name is still in use, try to ping the object
org.omg.CORBA.Object ref = (org.omg.CORBA.Object) this.contexts.get(n);
if (isDead(ref))
unbind(n.components());
throw new AlreadyBound();
}
if ((this.names.put(n, obj)) != null)
throw new CannotProceed(_this(), n.components());
IIOPLogger.ROOT_LOGGER.debugf("Bound name: %s", n);
} else {
NameComponent[] ncx = new NameComponent[]{nb};
org.omg.CORBA.Object context = this.resolve(ctx.components());
// try first to call the context implementation object directly.
String contextOID = this.getObjectOID(context);
CorbaNamingContext jbossContext = (contextOID == null ? null : contextImpls.get(contextOID));
if (jbossContext != null)
jbossContext.bind(ncx, obj);
else
NamingContextExtHelper.narrow(context).bind(ncx, obj);
}
} }
|
public class class_name {
public void bind(NameComponent[] nc, org.omg.CORBA.Object obj) throws NotFound, CannotProceed, InvalidName,
AlreadyBound {
if (this.destroyed)
throw new CannotProceed();
if (nc == null || nc.length == 0)
throw new InvalidName();
if (obj == null)
throw new org.omg.CORBA.BAD_PARAM();
Name n = new Name(nc);
Name ctx = n.ctxName();
NameComponent nb = n.baseNameComponent();
if (ctx == null) {
if (this.names.containsKey(n)) {
// if the name is still in use, try to ping the object
org.omg.CORBA.Object ref = (org.omg.CORBA.Object) this.names.get(n);
if (isDead(ref)) {
rebind(n.components(), obj); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
throw new AlreadyBound();
} else if (this.contexts.containsKey(n)) {
// if the name is still in use, try to ping the object
org.omg.CORBA.Object ref = (org.omg.CORBA.Object) this.contexts.get(n);
if (isDead(ref))
unbind(n.components());
throw new AlreadyBound();
}
if ((this.names.put(n, obj)) != null)
throw new CannotProceed(_this(), n.components());
IIOPLogger.ROOT_LOGGER.debugf("Bound name: %s", n);
} else {
NameComponent[] ncx = new NameComponent[]{nb};
org.omg.CORBA.Object context = this.resolve(ctx.components());
// try first to call the context implementation object directly.
String contextOID = this.getObjectOID(context);
CorbaNamingContext jbossContext = (contextOID == null ? null : contextImpls.get(contextOID));
if (jbossContext != null)
jbossContext.bind(ncx, obj);
else
NamingContextExtHelper.narrow(context).bind(ncx, obj);
}
} }
|
public class class_name {
public List<Hit<V>> parseText(String text)
{
int position = 1;
int currentState = 0;
List<Hit<V>> collectedEmits = new LinkedList<Hit<V>>();
for (int i = 0; i < text.length(); ++i)
{
currentState = getState(currentState, text.charAt(i));
storeEmits(position, currentState, collectedEmits);
++position;
}
return collectedEmits;
} }
|
public class class_name {
public List<Hit<V>> parseText(String text)
{
int position = 1;
int currentState = 0;
List<Hit<V>> collectedEmits = new LinkedList<Hit<V>>();
for (int i = 0; i < text.length(); ++i)
{
currentState = getState(currentState, text.charAt(i)); // depends on control dependency: [for], data = [i]
storeEmits(position, currentState, collectedEmits); // depends on control dependency: [for], data = [none]
++position; // depends on control dependency: [for], data = [none]
}
return collectedEmits;
} }
|
public class class_name {
protected void addOrRemoveGeneratedImport (boolean add)
{
final String IMPORT = "import javax.annotation.Generated;";
int packageLine = -1;
int importLine = -1;
int lastJavaImport = -1;
int firstNonJavaImport = -1;
for (int ii = 0, nn = _lines.size(); ii < nn; ii++) {
String line = _lines.get(ii);
if (line.startsWith(IMPORT)) {
if (add) {
return; // we already got one!
}
importLine = ii;
break;
} else if (line.startsWith("package ")) {
packageLine = ii;
} else if (line.startsWith("import java")) {
lastJavaImport = ii;
} else if (firstNonJavaImport == -1 && line.startsWith("import ")) {
firstNonJavaImport = ii;
}
}
if (importLine != -1) {
// we must be removing, or we'd have already exited
_lines.remove(importLine);
} else if (!add) {
return; // it's already not there!
} else {
importLine = (lastJavaImport != -1) ? lastJavaImport + 1
: ((firstNonJavaImport != -1) ? firstNonJavaImport : packageLine + 1);
_lines.add(importLine, IMPORT);
}
// the import line is always above these other lines, so they can be adjusted wholesale
int adjustment = add ? 1 : -1;
_nstart += adjustment;
_nend += adjustment;
_mstart += adjustment;
_mend += adjustment;
} }
|
public class class_name {
protected void addOrRemoveGeneratedImport (boolean add)
{
final String IMPORT = "import javax.annotation.Generated;";
int packageLine = -1;
int importLine = -1;
int lastJavaImport = -1;
int firstNonJavaImport = -1;
for (int ii = 0, nn = _lines.size(); ii < nn; ii++) {
String line = _lines.get(ii);
if (line.startsWith(IMPORT)) {
if (add) {
return; // we already got one! // depends on control dependency: [if], data = [none]
}
importLine = ii; // depends on control dependency: [if], data = [none]
break;
} else if (line.startsWith("package ")) {
packageLine = ii; // depends on control dependency: [if], data = [none]
} else if (line.startsWith("import java")) {
lastJavaImport = ii; // depends on control dependency: [if], data = [none]
} else if (firstNonJavaImport == -1 && line.startsWith("import ")) {
firstNonJavaImport = ii; // depends on control dependency: [if], data = [none]
}
}
if (importLine != -1) {
// we must be removing, or we'd have already exited
_lines.remove(importLine); // depends on control dependency: [if], data = [(importLine]
} else if (!add) {
return; // it's already not there! // depends on control dependency: [if], data = [none]
} else {
importLine = (lastJavaImport != -1) ? lastJavaImport + 1
: ((firstNonJavaImport != -1) ? firstNonJavaImport : packageLine + 1); // depends on control dependency: [if], data = [none]
_lines.add(importLine, IMPORT); // depends on control dependency: [if], data = [none]
}
// the import line is always above these other lines, so they can be adjusted wholesale
int adjustment = add ? 1 : -1;
_nstart += adjustment;
_nend += adjustment;
_mstart += adjustment;
_mend += adjustment;
} }
|
public class class_name {
public void setManagedResourceSummaryList(java.util.Collection<ManagedResourceSummary> managedResourceSummaryList) {
if (managedResourceSummaryList == null) {
this.managedResourceSummaryList = null;
return;
}
this.managedResourceSummaryList = new java.util.ArrayList<ManagedResourceSummary>(managedResourceSummaryList);
} }
|
public class class_name {
public void setManagedResourceSummaryList(java.util.Collection<ManagedResourceSummary> managedResourceSummaryList) {
if (managedResourceSummaryList == null) {
this.managedResourceSummaryList = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.managedResourceSummaryList = new java.util.ArrayList<ManagedResourceSummary>(managedResourceSummaryList);
} }
|
public class class_name {
@Override
public void getSocket(
GetSocketRequest request, StreamObserver<GetSocketResponse> responseObserver) {
InternalInstrumented<SocketStats> s = channelz.getSocket(request.getSocketId());
if (s == null) {
responseObserver.onError(
Status.NOT_FOUND.withDescription("Can't find socket " + request.getSocketId())
.asRuntimeException());
return;
}
GetSocketResponse resp;
try {
resp =
GetSocketResponse.newBuilder().setSocket(ChannelzProtoUtil.toSocket(s)).build();
} catch (StatusRuntimeException e) {
responseObserver.onError(e);
return;
}
responseObserver.onNext(resp);
responseObserver.onCompleted();
} }
|
public class class_name {
@Override
public void getSocket(
GetSocketRequest request, StreamObserver<GetSocketResponse> responseObserver) {
InternalInstrumented<SocketStats> s = channelz.getSocket(request.getSocketId());
if (s == null) {
responseObserver.onError(
Status.NOT_FOUND.withDescription("Can't find socket " + request.getSocketId())
.asRuntimeException()); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
GetSocketResponse resp;
try {
resp =
GetSocketResponse.newBuilder().setSocket(ChannelzProtoUtil.toSocket(s)).build(); // depends on control dependency: [try], data = [none]
} catch (StatusRuntimeException e) {
responseObserver.onError(e);
return;
} // depends on control dependency: [catch], data = [none]
responseObserver.onNext(resp);
responseObserver.onCompleted();
} }
|
public class class_name {
private void advance() {
String s = null;
while (tokenizer.hasNext()) {
String nextToken = tokenizer.next();
// stop if the word should be returned
if (filter.accept(nextToken)) {
s = nextToken;
break;
}
}
next = s;
} }
|
public class class_name {
private void advance() {
String s = null;
while (tokenizer.hasNext()) {
String nextToken = tokenizer.next();
// stop if the word should be returned
if (filter.accept(nextToken)) {
s = nextToken; // depends on control dependency: [if], data = [none]
break;
}
}
next = s;
} }
|
public class class_name {
private void generateOuterAccessPaths(BranchNode parentNode) {
JoinNode outerChildNode = parentNode.getLeftNode();
assert(outerChildNode != null);
JoinType joinType = parentNode.getJoinType();
// For LEFT and FULL join types, the outer join expressions are kept as a pre-join predicate
// at the join node to pre-qualify the outer rows
List<AbstractExpression> joinOuterList = (joinType == JoinType.INNER) ?
parentNode.m_joinOuterList : null;
if (outerChildNode instanceof BranchNode) {
generateOuterAccessPaths((BranchNode)outerChildNode);
generateInnerAccessPaths((BranchNode)outerChildNode);
// The join node can have only sequential scan access
outerChildNode.m_accessPaths.add(getRelevantNaivePath(joinOuterList,
parentNode.m_whereOuterList));
assert(outerChildNode.m_accessPaths.size() > 0);
return;
}
// WHERE Outer expressions must stay at the join node for the FULL joins
// They will be added later as part of the WHERE predicate of the join node
List<AbstractExpression> parentWhereList = null;
if (joinType != JoinType.FULL) {
parentWhereList = parentNode.m_whereOuterList;
}
outerChildNode.m_accessPaths.addAll(
getRelevantAccessPathsForTable(outerChildNode.getTableScan(),
joinOuterList, parentWhereList, null));
} }
|
public class class_name {
private void generateOuterAccessPaths(BranchNode parentNode) {
JoinNode outerChildNode = parentNode.getLeftNode();
assert(outerChildNode != null);
JoinType joinType = parentNode.getJoinType();
// For LEFT and FULL join types, the outer join expressions are kept as a pre-join predicate
// at the join node to pre-qualify the outer rows
List<AbstractExpression> joinOuterList = (joinType == JoinType.INNER) ?
parentNode.m_joinOuterList : null;
if (outerChildNode instanceof BranchNode) {
generateOuterAccessPaths((BranchNode)outerChildNode); // depends on control dependency: [if], data = [none]
generateInnerAccessPaths((BranchNode)outerChildNode); // depends on control dependency: [if], data = [none]
// The join node can have only sequential scan access
outerChildNode.m_accessPaths.add(getRelevantNaivePath(joinOuterList,
parentNode.m_whereOuterList)); // depends on control dependency: [if], data = [none]
assert(outerChildNode.m_accessPaths.size() > 0); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
// WHERE Outer expressions must stay at the join node for the FULL joins
// They will be added later as part of the WHERE predicate of the join node
List<AbstractExpression> parentWhereList = null;
if (joinType != JoinType.FULL) {
parentWhereList = parentNode.m_whereOuterList; // depends on control dependency: [if], data = [none]
}
outerChildNode.m_accessPaths.addAll(
getRelevantAccessPathsForTable(outerChildNode.getTableScan(),
joinOuterList, parentWhereList, null));
} }
|
public class class_name {
static PrintDrawable initIcon(Context context, AttributeSet attrs, boolean inEditMode) {
PrintDrawable.Builder iconBuilder = new PrintDrawable.Builder(context);
if (attrs != null) {
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.PrintView);
if (a.hasValue(R.styleable.PrintView_print_iconText)) {
String iconText = a.getString(R.styleable.PrintView_print_iconText);
iconBuilder.iconText(iconText);
}
if (a.hasValue(R.styleable.PrintView_print_iconCode)) {
int iconCode = a.getInteger(R.styleable.PrintView_print_iconCode, 0);
iconBuilder.iconCode(iconCode);
}
if (!inEditMode && a.hasValue(R.styleable.PrintView_print_iconFont)) {
String iconFontPath = a.getString(R.styleable.PrintView_print_iconFont);
iconBuilder.iconFont(TypefaceManager.load(context.getAssets(), iconFontPath));
}
if (a.hasValue(R.styleable.PrintView_print_iconColor)) {
ColorStateList iconColor = a.getColorStateList(R.styleable.PrintView_print_iconColor);
iconBuilder.iconColor(iconColor);
}
int iconSize = a.getDimensionPixelSize(R.styleable.PrintView_print_iconSize, 0);
iconBuilder.iconSize(TypedValue.COMPLEX_UNIT_PX, iconSize);
iconBuilder.inEditMode(inEditMode);
a.recycle();
}
return iconBuilder.build();
} }
|
public class class_name {
static PrintDrawable initIcon(Context context, AttributeSet attrs, boolean inEditMode) {
PrintDrawable.Builder iconBuilder = new PrintDrawable.Builder(context);
if (attrs != null) {
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.PrintView);
if (a.hasValue(R.styleable.PrintView_print_iconText)) {
String iconText = a.getString(R.styleable.PrintView_print_iconText);
iconBuilder.iconText(iconText); // depends on control dependency: [if], data = [none]
}
if (a.hasValue(R.styleable.PrintView_print_iconCode)) {
int iconCode = a.getInteger(R.styleable.PrintView_print_iconCode, 0);
iconBuilder.iconCode(iconCode); // depends on control dependency: [if], data = [none]
}
if (!inEditMode && a.hasValue(R.styleable.PrintView_print_iconFont)) {
String iconFontPath = a.getString(R.styleable.PrintView_print_iconFont);
iconBuilder.iconFont(TypefaceManager.load(context.getAssets(), iconFontPath)); // depends on control dependency: [if], data = [none]
}
if (a.hasValue(R.styleable.PrintView_print_iconColor)) {
ColorStateList iconColor = a.getColorStateList(R.styleable.PrintView_print_iconColor);
iconBuilder.iconColor(iconColor); // depends on control dependency: [if], data = [none]
}
int iconSize = a.getDimensionPixelSize(R.styleable.PrintView_print_iconSize, 0);
iconBuilder.iconSize(TypedValue.COMPLEX_UNIT_PX, iconSize); // depends on control dependency: [if], data = [none]
iconBuilder.inEditMode(inEditMode); // depends on control dependency: [if], data = [none]
a.recycle(); // depends on control dependency: [if], data = [none]
}
return iconBuilder.build();
} }
|
public class class_name {
private static final byte[] expandToLength16(byte scaledValue[], final boolean isNegative) {
if (scaledValue.length == 16) {
return scaledValue;
}
byte replacement[] = new byte[16];
if (isNegative) {
Arrays.fill(replacement, (byte)-1);
}
int shift = (16 - scaledValue.length);
for (int ii = 0; ii < scaledValue.length; ++ii) {
replacement[ii+shift] = scaledValue[ii];
}
return replacement;
} }
|
public class class_name {
private static final byte[] expandToLength16(byte scaledValue[], final boolean isNegative) {
if (scaledValue.length == 16) {
return scaledValue; // depends on control dependency: [if], data = [none]
}
byte replacement[] = new byte[16];
if (isNegative) {
Arrays.fill(replacement, (byte)-1); // depends on control dependency: [if], data = [none]
}
int shift = (16 - scaledValue.length);
for (int ii = 0; ii < scaledValue.length; ++ii) {
replacement[ii+shift] = scaledValue[ii]; // depends on control dependency: [for], data = [ii]
}
return replacement;
} }
|
public class class_name {
public static List<CPMeasurementUnit> toModels(
CPMeasurementUnitSoap[] soapModels) {
if (soapModels == null) {
return null;
}
List<CPMeasurementUnit> models = new ArrayList<CPMeasurementUnit>(soapModels.length);
for (CPMeasurementUnitSoap soapModel : soapModels) {
models.add(toModel(soapModel));
}
return models;
} }
|
public class class_name {
public static List<CPMeasurementUnit> toModels(
CPMeasurementUnitSoap[] soapModels) {
if (soapModels == null) {
return null; // depends on control dependency: [if], data = [none]
}
List<CPMeasurementUnit> models = new ArrayList<CPMeasurementUnit>(soapModels.length);
for (CPMeasurementUnitSoap soapModel : soapModels) {
models.add(toModel(soapModel)); // depends on control dependency: [for], data = [soapModel]
}
return models;
} }
|
public class class_name {
public static VariableNamePattern fromTemplateVariables(VariableNumMap templateVariables,
VariableNumMap fixedVariables) {
List<VariableNameMatcher> matchers = Lists.newArrayList();
for (String variableName : templateVariables.getVariableNamesArray()) {
int varIndex = variableName.indexOf("?(");
String variableNamePrefix = variableName.substring(0, varIndex);
String variableNameSuffix = variableName.substring(varIndex + 1);
int offsetIndex = variableNameSuffix.indexOf(")");
int offset = Integer.parseInt(variableNameSuffix.substring(1, offsetIndex));
variableNameSuffix = variableNameSuffix.substring(offsetIndex + 1);
matchers.add(new VariableNameMatcher(variableNamePrefix, variableNameSuffix, offset));
}
return new VariableNamePattern(matchers, templateVariables, fixedVariables);
} }
|
public class class_name {
public static VariableNamePattern fromTemplateVariables(VariableNumMap templateVariables,
VariableNumMap fixedVariables) {
List<VariableNameMatcher> matchers = Lists.newArrayList();
for (String variableName : templateVariables.getVariableNamesArray()) {
int varIndex = variableName.indexOf("?(");
String variableNamePrefix = variableName.substring(0, varIndex);
String variableNameSuffix = variableName.substring(varIndex + 1);
int offsetIndex = variableNameSuffix.indexOf(")");
int offset = Integer.parseInt(variableNameSuffix.substring(1, offsetIndex));
variableNameSuffix = variableNameSuffix.substring(offsetIndex + 1); // depends on control dependency: [for], data = [variableName]
matchers.add(new VariableNameMatcher(variableNamePrefix, variableNameSuffix, offset)); // depends on control dependency: [for], data = [variableName]
}
return new VariableNamePattern(matchers, templateVariables, fixedVariables);
} }
|
public class class_name {
private static int ceilingLog2(int n)
{
int oa;
int i;
int b;
oa = n;
b = 32 / 2;
i = 0;
while (b != 0)
{
i = (i << 1);
if (n >= (1 << b))
{
n /= (1 << b);
i = i | 1;
}
else
{
n &= (1 << b) - 1;
}
b /= 2;
}
if ((1 << i) == oa)
{
return i;
}
else
{
return i + 1;
}
} }
|
public class class_name {
private static int ceilingLog2(int n)
{
int oa;
int i;
int b;
oa = n;
b = 32 / 2;
i = 0;
while (b != 0)
{
i = (i << 1); // depends on control dependency: [while], data = [none]
if (n >= (1 << b))
{
n /= (1 << b); // depends on control dependency: [if], data = [none]
i = i | 1; // depends on control dependency: [if], data = [none]
}
else
{
n &= (1 << b) - 1; // depends on control dependency: [if], data = [none]
}
b /= 2; // depends on control dependency: [while], data = [none]
}
if ((1 << i) == oa)
{
return i; // depends on control dependency: [if], data = [none]
}
else
{
return i + 1; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private void _recurse (@Nonnull final Block aRoot, final boolean bListMode)
{
Block aBlock;
Block aList;
Line aLine = aRoot.m_aLines;
if (bListMode)
{
aRoot.removeListIndent (m_bUseExtensions);
if (m_bUseExtensions && aRoot.m_aLines != null && aRoot.m_aLines.getLineType (m_bUseExtensions) != ELineType.CODE)
{
aRoot.m_sID = aRoot.m_aLines.stripID ();
}
}
while (aLine != null && aLine.m_bIsEmpty)
aLine = aLine.m_aNext;
if (aLine == null)
return;
while (aLine != null)
{
final ELineType eType = aLine.getLineType (m_bUseExtensions);
switch (eType)
{
case OTHER:
{
final boolean bWasEmpty = aLine.m_bPrevEmpty;
while (aLine != null && !aLine.m_bIsEmpty)
{
final ELineType eType2 = aLine.getLineType (m_bUseExtensions);
if ((bListMode || m_bUseExtensions) && (eType2 == ELineType.OLIST || eType2 == ELineType.ULIST))
break;
if (m_bUseExtensions &&
(eType2 == ELineType.CODE || eType2 == ELineType.FENCED_CODE || eType2 == ELineType.PLUGIN))
break;
if (eType2 == ELineType.HEADLINE ||
eType2 == ELineType.HEADLINE1 ||
eType2 == ELineType.HEADLINE2 ||
eType2 == ELineType.HR ||
eType2 == ELineType.BQUOTE ||
eType2 == ELineType.XML ||
eType2 == ELineType.XML_COMMENT)
break;
aLine = aLine.m_aNext;
}
final EBlockType eBlockType;
if (aLine != null && !aLine.m_bIsEmpty)
{
eBlockType = (bListMode && !bWasEmpty) ? EBlockType.NONE : EBlockType.PARAGRAPH;
aRoot.split (aLine.m_aPrevious).m_eType = eBlockType;
aRoot.removeLeadingEmptyLines ();
}
else
{
eBlockType = (bListMode && (aLine == null || !aLine.m_bIsEmpty) && !bWasEmpty) ? EBlockType.NONE
: EBlockType.PARAGRAPH;
aRoot.split (aLine == null ? aRoot.m_aLineTail : aLine).m_eType = eBlockType;
aRoot.removeLeadingEmptyLines ();
}
aLine = aRoot.m_aLines;
break;
}
case CODE:
while (aLine != null && (aLine.m_bIsEmpty || aLine.m_nLeading > 3))
{
aLine = aLine.m_aNext;
}
aBlock = aRoot.split (aLine != null ? aLine.m_aPrevious : aRoot.m_aLineTail);
aBlock.m_eType = EBlockType.CODE;
aBlock.removeSurroundingEmptyLines ();
break;
case XML:
case XML_COMMENT:
if (aLine.m_aPrevious != null)
{
// FIXME ... this looks wrong
aRoot.split (aLine.m_aPrevious);
}
aRoot.split (aLine.m_aXmlEndLine).m_eType = eType == ELineType.XML ? EBlockType.XML : EBlockType.XML_COMMENT;
aRoot.removeLeadingEmptyLines ();
aLine = aRoot.m_aLines;
break;
case BQUOTE:
while (aLine != null)
{
if (!aLine.m_bIsEmpty &&
aLine.m_bPrevEmpty &&
aLine.m_nLeading == 0 &&
aLine.getLineType (m_bUseExtensions) != ELineType.BQUOTE)
break;
aLine = aLine.m_aNext;
}
aBlock = aRoot.split (aLine != null ? aLine.m_aPrevious : aRoot.m_aLineTail);
aBlock.m_eType = EBlockType.BLOCKQUOTE;
aBlock.removeSurroundingEmptyLines ();
aBlock.removeBlockQuotePrefix ();
_recurse (aBlock, false);
aLine = aRoot.m_aLines;
break;
case HR:
if (aLine.m_aPrevious != null)
{
// FIXME ... this looks wrong
aRoot.split (aLine.m_aPrevious);
}
aRoot.split (aLine).m_eType = EBlockType.RULER;
aRoot.removeLeadingEmptyLines ();
aLine = aRoot.m_aLines;
break;
case FENCED_CODE:
aLine = aLine.m_aNext;
while (aLine != null)
{
if (aLine.getLineType (m_bUseExtensions) == ELineType.FENCED_CODE)
break;
// TODO ... is this really necessary? Maybe add a special
// flag?
aLine = aLine.m_aNext;
}
if (aLine != null)
aLine = aLine.m_aNext;
aBlock = aRoot.split (aLine != null ? aLine.m_aPrevious : aRoot.m_aLineTail);
aBlock.m_eType = EBlockType.FENCED_CODE;
aBlock.m_sMeta = MarkdownHelper.getMetaFromFence (aBlock.m_aLines.m_sValue);
aBlock.m_aLines.setEmpty ();
if (aBlock.m_aLineTail.getLineType (m_bUseExtensions) == ELineType.FENCED_CODE)
aBlock.m_aLineTail.setEmpty ();
aBlock.removeSurroundingEmptyLines ();
break;
case PLUGIN:
aLine = aLine.m_aNext;
while (aLine != null)
{
if (aLine.getLineType (m_bUseExtensions) == ELineType.PLUGIN)
break;
// TODO ... is this really necessary? Maybe add a special
// flag?
aLine = aLine.m_aNext;
}
if (aLine != null)
aLine = aLine.m_aNext;
aBlock = aRoot.split (aLine != null ? aLine.m_aPrevious : aRoot.m_aLineTail);
aBlock.m_eType = EBlockType.PLUGIN;
aBlock.m_sMeta = MarkdownHelper.getMetaFromFence (aBlock.m_aLines.m_sValue);
aBlock.m_aLines.setEmpty ();
if (aBlock.m_aLineTail.getLineType (m_bUseExtensions) == ELineType.PLUGIN)
aBlock.m_aLineTail.setEmpty ();
aBlock.removeSurroundingEmptyLines ();
break;
case HEADLINE:
case HEADLINE1:
case HEADLINE2:
if (aLine.m_aPrevious != null)
aRoot.split (aLine.m_aPrevious);
if (eType != ELineType.HEADLINE)
aLine.m_aNext.setEmpty ();
aBlock = aRoot.split (aLine);
aBlock.m_eType = EBlockType.HEADLINE;
if (eType != ELineType.HEADLINE)
aBlock.m_nHeadlineDepth = eType == ELineType.HEADLINE1 ? 1 : 2;
if (m_bUseExtensions)
aBlock.m_sID = aBlock.m_aLines.stripID ();
aBlock.transfromHeadline ();
aRoot.removeLeadingEmptyLines ();
aLine = aRoot.m_aLines;
break;
case OLIST:
case ULIST:
while (aLine != null)
{
final ELineType eType2 = aLine.getLineType (m_bUseExtensions);
if (!aLine.m_bIsEmpty &&
(aLine.m_bPrevEmpty && aLine.m_nLeading == 0 && !(eType2 == ELineType.OLIST || eType2 == ELineType.ULIST)))
break;
aLine = aLine.m_aNext;
}
aList = aRoot.split (aLine != null ? aLine.m_aPrevious : aRoot.m_aLineTail);
aList.m_eType = eType == ELineType.OLIST ? EBlockType.ORDERED_LIST : EBlockType.UNORDERED_LIST;
aList.m_aLines.m_bPrevEmpty = false;
aList.removeSurroundingEmptyLines ();
aList.m_aLines.m_bPrevEmpty = false;
_initListBlock (aList);
aBlock = aList.m_aBlocks;
while (aBlock != null)
{
_recurse (aBlock, true);
aBlock = aBlock.m_aNext;
}
aList.expandListParagraphs ();
break;
default:
aLine = aLine.m_aNext;
break;
}
}
} }
|
public class class_name {
private void _recurse (@Nonnull final Block aRoot, final boolean bListMode)
{
Block aBlock;
Block aList;
Line aLine = aRoot.m_aLines;
if (bListMode)
{
aRoot.removeListIndent (m_bUseExtensions); // depends on control dependency: [if], data = [none]
if (m_bUseExtensions && aRoot.m_aLines != null && aRoot.m_aLines.getLineType (m_bUseExtensions) != ELineType.CODE)
{
aRoot.m_sID = aRoot.m_aLines.stripID (); // depends on control dependency: [if], data = [none]
}
}
while (aLine != null && aLine.m_bIsEmpty)
aLine = aLine.m_aNext;
if (aLine == null)
return;
while (aLine != null)
{
final ELineType eType = aLine.getLineType (m_bUseExtensions);
switch (eType)
{
case OTHER:
{
final boolean bWasEmpty = aLine.m_bPrevEmpty;
while (aLine != null && !aLine.m_bIsEmpty)
{
final ELineType eType2 = aLine.getLineType (m_bUseExtensions);
if ((bListMode || m_bUseExtensions) && (eType2 == ELineType.OLIST || eType2 == ELineType.ULIST))
break;
if (m_bUseExtensions &&
(eType2 == ELineType.CODE || eType2 == ELineType.FENCED_CODE || eType2 == ELineType.PLUGIN))
break;
if (eType2 == ELineType.HEADLINE ||
eType2 == ELineType.HEADLINE1 ||
eType2 == ELineType.HEADLINE2 ||
eType2 == ELineType.HR ||
eType2 == ELineType.BQUOTE ||
eType2 == ELineType.XML ||
eType2 == ELineType.XML_COMMENT)
break;
aLine = aLine.m_aNext; // depends on control dependency: [while], data = [none]
}
final EBlockType eBlockType;
if (aLine != null && !aLine.m_bIsEmpty)
{
eBlockType = (bListMode && !bWasEmpty) ? EBlockType.NONE : EBlockType.PARAGRAPH; // depends on control dependency: [if], data = [none]
aRoot.split (aLine.m_aPrevious).m_eType = eBlockType; // depends on control dependency: [if], data = [(aLine]
aRoot.removeLeadingEmptyLines (); // depends on control dependency: [if], data = [none]
}
else
{
eBlockType = (bListMode && (aLine == null || !aLine.m_bIsEmpty) && !bWasEmpty) ? EBlockType.NONE
: EBlockType.PARAGRAPH; // depends on control dependency: [if], data = [(aLine]
aRoot.split (aLine == null ? aRoot.m_aLineTail : aLine).m_eType = eBlockType; // depends on control dependency: [if], data = [(aLine]
aRoot.removeLeadingEmptyLines (); // depends on control dependency: [if], data = [none]
}
aLine = aRoot.m_aLines;
break;
}
case CODE:
while (aLine != null && (aLine.m_bIsEmpty || aLine.m_nLeading > 3))
{
aLine = aLine.m_aNext; // depends on control dependency: [while], data = [none]
}
aBlock = aRoot.split (aLine != null ? aLine.m_aPrevious : aRoot.m_aLineTail); // depends on control dependency: [while], data = [(aLine]
aBlock.m_eType = EBlockType.CODE; // depends on control dependency: [while], data = [none]
aBlock.removeSurroundingEmptyLines (); // depends on control dependency: [while], data = [none]
break;
case XML:
case XML_COMMENT:
if (aLine.m_aPrevious != null)
{
// FIXME ... this looks wrong
aRoot.split (aLine.m_aPrevious); // depends on control dependency: [if], data = [(aLine.m_aPrevious]
}
aRoot.split (aLine.m_aXmlEndLine).m_eType = eType == ELineType.XML ? EBlockType.XML : EBlockType.XML_COMMENT; // depends on control dependency: [while], data = [(aLine]
aRoot.removeLeadingEmptyLines (); // depends on control dependency: [while], data = [none]
aLine = aRoot.m_aLines; // depends on control dependency: [while], data = [none]
break;
case BQUOTE:
while (aLine != null)
{
if (!aLine.m_bIsEmpty &&
aLine.m_bPrevEmpty &&
aLine.m_nLeading == 0 &&
aLine.getLineType (m_bUseExtensions) != ELineType.BQUOTE)
break;
aLine = aLine.m_aNext; // depends on control dependency: [while], data = [none]
}
aBlock = aRoot.split (aLine != null ? aLine.m_aPrevious : aRoot.m_aLineTail); // depends on control dependency: [while], data = [(aLine]
aBlock.m_eType = EBlockType.BLOCKQUOTE; // depends on control dependency: [while], data = [none]
aBlock.removeSurroundingEmptyLines (); // depends on control dependency: [while], data = [none]
aBlock.removeBlockQuotePrefix (); // depends on control dependency: [while], data = [none]
_recurse (aBlock, false); // depends on control dependency: [while], data = [none]
aLine = aRoot.m_aLines; // depends on control dependency: [while], data = [none]
break;
case HR:
if (aLine.m_aPrevious != null)
{
// FIXME ... this looks wrong
aRoot.split (aLine.m_aPrevious); // depends on control dependency: [if], data = [(aLine.m_aPrevious]
}
aRoot.split (aLine).m_eType = EBlockType.RULER; // depends on control dependency: [while], data = [(aLine]
aRoot.removeLeadingEmptyLines (); // depends on control dependency: [while], data = [none]
aLine = aRoot.m_aLines; // depends on control dependency: [while], data = [none]
break;
case FENCED_CODE:
aLine = aLine.m_aNext;
while (aLine != null)
{
if (aLine.getLineType (m_bUseExtensions) == ELineType.FENCED_CODE)
break;
// TODO ... is this really necessary? Maybe add a special
// flag?
aLine = aLine.m_aNext; // depends on control dependency: [while], data = [none]
}
if (aLine != null)
aLine = aLine.m_aNext;
aBlock = aRoot.split (aLine != null ? aLine.m_aPrevious : aRoot.m_aLineTail); // depends on control dependency: [while], data = [(aLine]
aBlock.m_eType = EBlockType.FENCED_CODE; // depends on control dependency: [while], data = [none]
aBlock.m_sMeta = MarkdownHelper.getMetaFromFence (aBlock.m_aLines.m_sValue); // depends on control dependency: [while], data = [none]
aBlock.m_aLines.setEmpty (); // depends on control dependency: [while], data = [none]
if (aBlock.m_aLineTail.getLineType (m_bUseExtensions) == ELineType.FENCED_CODE)
aBlock.m_aLineTail.setEmpty ();
aBlock.removeSurroundingEmptyLines (); // depends on control dependency: [while], data = [none]
break;
case PLUGIN:
aLine = aLine.m_aNext;
while (aLine != null)
{
if (aLine.getLineType (m_bUseExtensions) == ELineType.PLUGIN)
break;
// TODO ... is this really necessary? Maybe add a special
// flag?
aLine = aLine.m_aNext; // depends on control dependency: [while], data = [none]
}
if (aLine != null)
aLine = aLine.m_aNext;
aBlock = aRoot.split (aLine != null ? aLine.m_aPrevious : aRoot.m_aLineTail); // depends on control dependency: [while], data = [(aLine]
aBlock.m_eType = EBlockType.PLUGIN; // depends on control dependency: [while], data = [none]
aBlock.m_sMeta = MarkdownHelper.getMetaFromFence (aBlock.m_aLines.m_sValue); // depends on control dependency: [while], data = [none]
aBlock.m_aLines.setEmpty (); // depends on control dependency: [while], data = [none]
if (aBlock.m_aLineTail.getLineType (m_bUseExtensions) == ELineType.PLUGIN)
aBlock.m_aLineTail.setEmpty ();
aBlock.removeSurroundingEmptyLines (); // depends on control dependency: [while], data = [none]
break;
case HEADLINE:
case HEADLINE1:
case HEADLINE2:
if (aLine.m_aPrevious != null)
aRoot.split (aLine.m_aPrevious);
if (eType != ELineType.HEADLINE)
aLine.m_aNext.setEmpty ();
aBlock = aRoot.split (aLine); // depends on control dependency: [while], data = [(aLine]
aBlock.m_eType = EBlockType.HEADLINE; // depends on control dependency: [while], data = [none]
if (eType != ELineType.HEADLINE)
aBlock.m_nHeadlineDepth = eType == ELineType.HEADLINE1 ? 1 : 2;
if (m_bUseExtensions)
aBlock.m_sID = aBlock.m_aLines.stripID ();
aBlock.transfromHeadline (); // depends on control dependency: [while], data = [none]
aRoot.removeLeadingEmptyLines (); // depends on control dependency: [while], data = [none]
aLine = aRoot.m_aLines; // depends on control dependency: [while], data = [none]
break;
case OLIST:
case ULIST:
while (aLine != null)
{
final ELineType eType2 = aLine.getLineType (m_bUseExtensions);
if (!aLine.m_bIsEmpty &&
(aLine.m_bPrevEmpty && aLine.m_nLeading == 0 && !(eType2 == ELineType.OLIST || eType2 == ELineType.ULIST)))
break;
aLine = aLine.m_aNext; // depends on control dependency: [while], data = [none]
}
aList = aRoot.split (aLine != null ? aLine.m_aPrevious : aRoot.m_aLineTail); // depends on control dependency: [while], data = [(aLine]
aList.m_eType = eType == ELineType.OLIST ? EBlockType.ORDERED_LIST : EBlockType.UNORDERED_LIST; // depends on control dependency: [while], data = [none]
aList.m_aLines.m_bPrevEmpty = false; // depends on control dependency: [while], data = [none]
aList.removeSurroundingEmptyLines (); // depends on control dependency: [while], data = [none]
aList.m_aLines.m_bPrevEmpty = false; // depends on control dependency: [while], data = [none]
_initListBlock (aList); // depends on control dependency: [while], data = [none]
aBlock = aList.m_aBlocks; // depends on control dependency: [while], data = [none]
while (aBlock != null)
{
_recurse (aBlock, true); // depends on control dependency: [while], data = [(aBlock]
aBlock = aBlock.m_aNext; // depends on control dependency: [while], data = [none]
}
aList.expandListParagraphs (); // depends on control dependency: [while], data = [none]
break;
default:
aLine = aLine.m_aNext;
break;
}
}
} }
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.