code
stringlengths 130
281k
| code_dependency
stringlengths 182
306k
|
|---|---|
public class class_name {
public void setOnNonEmptyWorkDirectory(String value) {
try {
this.nonEmptyWorkDirAction = NonEmptyWorkDirectoryAction.valueOf(value.toUpperCase(Locale.ROOT));
} catch (IllegalArgumentException e) {
throw new IllegalArgumentException("OnNonEmptyWorkDirectory accepts any of: "
+ Arrays.toString(NonEmptyWorkDirectoryAction.values()) + ", value is not valid: " + value);
}
} }
|
public class class_name {
public void setOnNonEmptyWorkDirectory(String value) {
try {
this.nonEmptyWorkDirAction = NonEmptyWorkDirectoryAction.valueOf(value.toUpperCase(Locale.ROOT)); // depends on control dependency: [try], data = [none]
} catch (IllegalArgumentException e) {
throw new IllegalArgumentException("OnNonEmptyWorkDirectory accepts any of: "
+ Arrays.toString(NonEmptyWorkDirectoryAction.values()) + ", value is not valid: " + value);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public java.util.List<String> getFlowLogIds() {
if (flowLogIds == null) {
flowLogIds = new com.amazonaws.internal.SdkInternalList<String>();
}
return flowLogIds;
} }
|
public class class_name {
public java.util.List<String> getFlowLogIds() {
if (flowLogIds == null) {
flowLogIds = new com.amazonaws.internal.SdkInternalList<String>(); // depends on control dependency: [if], data = [none]
}
return flowLogIds;
} }
|
public class class_name {
public void setValueOff(String newValue, @Nullable String newName) {
if (!isChecked()) { // refining on valueOff: facetRefinement needs an update
searcher.updateFacetRefinement(attribute, valueOff, false)
.updateFacetRefinement(newName != null ? newName : attribute, newValue, true)
.search();
}
this.valueOff = newValue;
applyEventualNewAttribute(newName);
} }
|
public class class_name {
public void setValueOff(String newValue, @Nullable String newName) {
if (!isChecked()) { // refining on valueOff: facetRefinement needs an update
searcher.updateFacetRefinement(attribute, valueOff, false)
.updateFacetRefinement(newName != null ? newName : attribute, newValue, true)
.search(); // depends on control dependency: [if], data = [none]
}
this.valueOff = newValue;
applyEventualNewAttribute(newName);
} }
|
public class class_name {
private static void setDeserializer(Properties props) {
final String deSerName = ByteArrayDeserializer.class.getName();
Object keyDeSer = props.get(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG);
Object valDeSer = props.get(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG);
if (keyDeSer != null && !keyDeSer.equals(deSerName)) {
LOG.warn("Ignoring configured key DeSerializer ({})", ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG);
}
if (valDeSer != null && !valDeSer.equals(deSerName)) {
LOG.warn("Ignoring configured value DeSerializer ({})", ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG);
}
props.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, deSerName);
props.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, deSerName);
} }
|
public class class_name {
private static void setDeserializer(Properties props) {
final String deSerName = ByteArrayDeserializer.class.getName();
Object keyDeSer = props.get(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG);
Object valDeSer = props.get(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG);
if (keyDeSer != null && !keyDeSer.equals(deSerName)) {
LOG.warn("Ignoring configured key DeSerializer ({})", ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG); // depends on control dependency: [if], data = [none]
}
if (valDeSer != null && !valDeSer.equals(deSerName)) {
LOG.warn("Ignoring configured value DeSerializer ({})", ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG); // depends on control dependency: [if], data = [none]
}
props.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, deSerName);
props.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, deSerName);
} }
|
public class class_name {
public List<Integer> getHitList(File file)
{
//FIXME skip lex location in other files
// idea: if !lextLocation.getFile().equals(file) then continue;
List<Integer> hits = new Vector<Integer>();
synchronized (allLocations)
{
for (ILexLocation l : allLocations)
{
if (l.getHits() > 0 && l.getFile().equals(file))
{
hits.add(l.getStartLine());
}
}
}
return hits;
} }
|
public class class_name {
public List<Integer> getHitList(File file)
{
//FIXME skip lex location in other files
// idea: if !lextLocation.getFile().equals(file) then continue;
List<Integer> hits = new Vector<Integer>();
synchronized (allLocations)
{
for (ILexLocation l : allLocations)
{
if (l.getHits() > 0 && l.getFile().equals(file))
{
hits.add(l.getStartLine()); // depends on control dependency: [if], data = [none]
}
}
}
return hits;
} }
|
public class class_name {
protected void handleInvocationResponse (int reqId, int methodId, Object[] args)
{
// look up the invocation marshaller registered for that response
ListenerMarshaller listener = _listeners.remove(reqId);
if (listener == null) {
log.warning("Received invocation response for which we have no registered listener. " +
"It is possible that this listener was flushed because the response did " +
"not arrive within " + _listenerMaxAge + " milliseconds.",
"reqId", reqId, "methId", methodId, "args", args);
return;
}
// log.info("Dispatching invocation response", "listener", listener,
// "methId", methodId, "args", args);
// dispatch the response
try {
listener.dispatchResponse(methodId, args);
} catch (Throwable t) {
log.warning("Invocation response listener choked", "listener", listener,
"methId", methodId, "args", args, t);
}
// flush expired listeners periodically
long now = System.currentTimeMillis();
if (now - _lastFlushTime > LISTENER_FLUSH_INTERVAL) {
_lastFlushTime = now;
flushListeners(now);
}
} }
|
public class class_name {
protected void handleInvocationResponse (int reqId, int methodId, Object[] args)
{
// look up the invocation marshaller registered for that response
ListenerMarshaller listener = _listeners.remove(reqId);
if (listener == null) {
log.warning("Received invocation response for which we have no registered listener. " +
"It is possible that this listener was flushed because the response did " +
"not arrive within " + _listenerMaxAge + " milliseconds.",
"reqId", reqId, "methId", methodId, "args", args); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
// log.info("Dispatching invocation response", "listener", listener,
// "methId", methodId, "args", args);
// dispatch the response
try {
listener.dispatchResponse(methodId, args); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
log.warning("Invocation response listener choked", "listener", listener,
"methId", methodId, "args", args, t);
} // depends on control dependency: [catch], data = [none]
// flush expired listeners periodically
long now = System.currentTimeMillis();
if (now - _lastFlushTime > LISTENER_FLUSH_INTERVAL) {
_lastFlushTime = now; // depends on control dependency: [if], data = [none]
flushListeners(now); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static void install(ResourceSet rs, MavenProject project) {
final Iterator<Adapter> iterator = rs.eAdapters().iterator();
while (iterator.hasNext()) {
if (iterator.next() instanceof MavenProjectAdapter) {
iterator.remove();
}
}
rs.eAdapters().add(new MavenProjectAdapter(project));
} }
|
public class class_name {
public static void install(ResourceSet rs, MavenProject project) {
final Iterator<Adapter> iterator = rs.eAdapters().iterator();
while (iterator.hasNext()) {
if (iterator.next() instanceof MavenProjectAdapter) {
iterator.remove(); // depends on control dependency: [if], data = [none]
}
}
rs.eAdapters().add(new MavenProjectAdapter(project));
} }
|
public class class_name {
void writeSections(boolean rewriteRequired) throws InternalLogException
{
if (tc.isEntryEnabled()) Tr.entry(tc, "writeSections",new java.lang.Object[]{this,new Boolean(rewriteRequired)});
// If the parent recovery log instance has experienced a serious internal error then prevent
// this operation from executing.
if (_recLog.failed())
{
if (tc.isEntryEnabled()) Tr.exit(tc, "writeSections", "InternalLogException");
throw new InternalLogException(null);
}
// Obtain an iterator that can be used to access each of the recoverable unit sections in turn.
Iterator recoverableUnitSectionsIterator = _recoverableUnitSections.values().iterator();
while (recoverableUnitSectionsIterator.hasNext())
{
SQLRecoverableUnitSectionImpl section = (SQLRecoverableUnitSectionImpl)(recoverableUnitSectionsIterator.next());
// Now direct the recoverable unit section to write its content. If the recoverable unit
// section has no data to write then this will be a no-op.
writeSection(section);
}
if (tc.isEntryEnabled()) Tr.exit(tc, "writeSections");
} }
|
public class class_name {
void writeSections(boolean rewriteRequired) throws InternalLogException
{
if (tc.isEntryEnabled()) Tr.entry(tc, "writeSections",new java.lang.Object[]{this,new Boolean(rewriteRequired)});
// If the parent recovery log instance has experienced a serious internal error then prevent
// this operation from executing.
if (_recLog.failed())
{
if (tc.isEntryEnabled()) Tr.exit(tc, "writeSections", "InternalLogException");
throw new InternalLogException(null);
}
// Obtain an iterator that can be used to access each of the recoverable unit sections in turn.
Iterator recoverableUnitSectionsIterator = _recoverableUnitSections.values().iterator();
while (recoverableUnitSectionsIterator.hasNext())
{
SQLRecoverableUnitSectionImpl section = (SQLRecoverableUnitSectionImpl)(recoverableUnitSectionsIterator.next());
// Now direct the recoverable unit section to write its content. If the recoverable unit
// section has no data to write then this will be a no-op.
writeSection(section); // depends on control dependency: [while], data = [none]
}
if (tc.isEntryEnabled()) Tr.exit(tc, "writeSections");
} }
|
public class class_name {
public int find() {
for (int node = root; node != NIL; ) {
final int cmp = compare(node);
if (cmp < 0) {
node = left(node);
} else if (cmp > 0) {
node = right(node);
} else {
return node;
}
}
return NIL;
} }
|
public class class_name {
public int find() {
for (int node = root; node != NIL; ) {
final int cmp = compare(node);
if (cmp < 0) {
node = left(node); // depends on control dependency: [if], data = [none]
} else if (cmp > 0) {
node = right(node); // depends on control dependency: [if], data = [none]
} else {
return node; // depends on control dependency: [if], data = [none]
}
}
return NIL;
} }
|
public class class_name {
@Override
public String text( Locale locale,
Object... arguments ) {
try {
String rawText = rawText(locale == null ? Locale.getDefault() : locale);
return StringUtil.createString(rawText, arguments);
} catch (IllegalArgumentException err) {
throw new IllegalArgumentException(CommonI18n.i18nRequiredToSuppliedParameterMismatch.text(id,
i18nClass,
err.getMessage()));
} catch (SystemFailureException err) {
return '<' + err.getMessage() + '>';
}
} }
|
public class class_name {
@Override
public String text( Locale locale,
Object... arguments ) {
try {
String rawText = rawText(locale == null ? Locale.getDefault() : locale);
return StringUtil.createString(rawText, arguments); // depends on control dependency: [try], data = [none]
} catch (IllegalArgumentException err) {
throw new IllegalArgumentException(CommonI18n.i18nRequiredToSuppliedParameterMismatch.text(id,
i18nClass,
err.getMessage()));
} catch (SystemFailureException err) { // depends on control dependency: [catch], data = [none]
return '<' + err.getMessage() + '>';
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
protected String formatStr(int bits, String val, Object key) {
if (val.equals("")) {
return val;
} else if (val.length() > bits) {
//throw new Exception();
sbError.append("! Waring: There is a variable [").append(key).append("] with oversized content [").append(val).append("], only first ").append(bits).append(" bits will be applied.\r\n");
return val.substring(0, bits);
}
return val;
} }
|
public class class_name {
protected String formatStr(int bits, String val, Object key) {
if (val.equals("")) {
return val; // depends on control dependency: [if], data = [none]
} else if (val.length() > bits) {
//throw new Exception();
sbError.append("! Waring: There is a variable [").append(key).append("] with oversized content [").append(val).append("], only first ").append(bits).append(" bits will be applied.\r\n"); // depends on control dependency: [if], data = [bits)]
return val.substring(0, bits); // depends on control dependency: [if], data = [bits)]
}
return val;
} }
|
public class class_name {
void subrange(int from, int to, State lp, State rp) throws RegexException {
/* Avoid one call to map.get() for each character in the range.
* This map will usually contain one item, but in complex cases more.
* For example, if we had [a-f][g-h] and then someone asked for [f-g], there
* would be two. Each of these new ranges will get a new color via subcolor.
*/
Map<Range<Integer>, Short> curColors = map.subRangeMap(Range.closed(from, to)).asMapOfRanges();
/*
* To avoid concurrent mod problems, we need to copy the ranges we are working from.
*/
List<Range<Integer>> ranges = Lists.newArrayList(curColors.keySet());
for (Range<Integer> rangeToProcess : ranges) {
// bound management here irritating.
int start = rangeToProcess.lowerEndpoint();
if (rangeToProcess.lowerBoundType() == BoundType.OPEN) {
start++;
}
int end = rangeToProcess.upperEndpoint();
if (rangeToProcess.upperBoundType() == BoundType.CLOSED) {
end++;
}
// allocate a new subcolor and account it owning the entire range.
short color = subcolor(start, end - start);
compiler.getNfa().newarc(Compiler.PLAIN, color, lp, rp);
}
} }
|
public class class_name {
void subrange(int from, int to, State lp, State rp) throws RegexException {
/* Avoid one call to map.get() for each character in the range.
* This map will usually contain one item, but in complex cases more.
* For example, if we had [a-f][g-h] and then someone asked for [f-g], there
* would be two. Each of these new ranges will get a new color via subcolor.
*/
Map<Range<Integer>, Short> curColors = map.subRangeMap(Range.closed(from, to)).asMapOfRanges();
/*
* To avoid concurrent mod problems, we need to copy the ranges we are working from.
*/
List<Range<Integer>> ranges = Lists.newArrayList(curColors.keySet());
for (Range<Integer> rangeToProcess : ranges) {
// bound management here irritating.
int start = rangeToProcess.lowerEndpoint();
if (rangeToProcess.lowerBoundType() == BoundType.OPEN) {
start++; // depends on control dependency: [if], data = [none]
}
int end = rangeToProcess.upperEndpoint();
if (rangeToProcess.upperBoundType() == BoundType.CLOSED) {
end++; // depends on control dependency: [if], data = [none]
}
// allocate a new subcolor and account it owning the entire range.
short color = subcolor(start, end - start);
compiler.getNfa().newarc(Compiler.PLAIN, color, lp, rp);
}
} }
|
public class class_name {
private static <E> boolean addAllImpl(
Multiset<E> self, AbstractMapBasedMultiset<? extends E> elements) {
if (elements.isEmpty()) {
return false;
}
elements.addTo(self);
return true;
} }
|
public class class_name {
private static <E> boolean addAllImpl(
Multiset<E> self, AbstractMapBasedMultiset<? extends E> elements) {
if (elements.isEmpty()) {
return false; // depends on control dependency: [if], data = [none]
}
elements.addTo(self);
return true;
} }
|
public class class_name {
public LayoutParams getLayoutParams() {
if (mLayoutParams == null) {
mLayoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
}
return mLayoutParams;
} }
|
public class class_name {
public LayoutParams getLayoutParams() {
if (mLayoutParams == null) {
mLayoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); // depends on control dependency: [if], data = [none]
}
return mLayoutParams;
} }
|
public class class_name {
protected void putPhase(Map<String, DevelopmentPhase> map, String key, DevelopmentPhase phase) {
String newKey = key.toLowerCase(Locale.US);
while (newKey != null) {
DevelopmentPhase existingPhase = map.get(newKey);
if ((existingPhase != null) && (existingPhase != phase)) {
throw new IllegalStateException("Development phase '" + phase + "' has key '" + newKey + "' that is already mapped to '" + existingPhase + "'.");
}
map.put(newKey, phase);
if (newKey.contains("-")) {
newKey = newKey.replace("-", "");
} else {
newKey = null;
}
}
} }
|
public class class_name {
protected void putPhase(Map<String, DevelopmentPhase> map, String key, DevelopmentPhase phase) {
String newKey = key.toLowerCase(Locale.US);
while (newKey != null) {
DevelopmentPhase existingPhase = map.get(newKey);
if ((existingPhase != null) && (existingPhase != phase)) {
throw new IllegalStateException("Development phase '" + phase + "' has key '" + newKey + "' that is already mapped to '" + existingPhase + "'.");
}
map.put(newKey, phase); // depends on control dependency: [while], data = [(newKey]
if (newKey.contains("-")) {
newKey = newKey.replace("-", ""); // depends on control dependency: [if], data = [none]
} else {
newKey = null; // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
void paintBackground(SeaGlassContext context, Graphics g, JComponent c) {
context.getPainter().paintTextFieldBackground(context, g, 0, 0, c.getWidth(), c.getHeight());
// If necessary, paint the placeholder text.
if (placeholderText != null && ((JTextComponent) c).getText().length() == 0 && !c.hasFocus()) {
paintPlaceholderText(context, g, c);
}
} }
|
public class class_name {
void paintBackground(SeaGlassContext context, Graphics g, JComponent c) {
context.getPainter().paintTextFieldBackground(context, g, 0, 0, c.getWidth(), c.getHeight());
// If necessary, paint the placeholder text.
if (placeholderText != null && ((JTextComponent) c).getText().length() == 0 && !c.hasFocus()) {
paintPlaceholderText(context, g, c); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static boolean equal(Object obj1, Object obj2) {
if (obj1 == obj2) {
return true;
}
if (obj1 == null || obj2 == null) {
return false;
}
if (obj1.getClass().isArray()) {
return equalsArray(obj1, obj2);
}
// this does not handle arrays embedded in objects, such as in lists/maps
// but you shouldn't use arrays like that, should you?
return obj1.equals(obj2);
} }
|
public class class_name {
public static boolean equal(Object obj1, Object obj2) {
if (obj1 == obj2) {
return true; // depends on control dependency: [if], data = [none]
}
if (obj1 == null || obj2 == null) {
return false; // depends on control dependency: [if], data = [none]
}
if (obj1.getClass().isArray()) {
return equalsArray(obj1, obj2); // depends on control dependency: [if], data = [none]
}
// this does not handle arrays embedded in objects, such as in lists/maps
// but you shouldn't use arrays like that, should you?
return obj1.equals(obj2);
} }
|
public class class_name {
@Override
public Map<IPortletType, PortletPublishingDefinition> getChannelPublishingDefinitions() {
final List<IPortletType> channelTypes = this.portletTypeRegistry.getPortletTypes();
final Map<IPortletType, PortletPublishingDefinition> cpds =
new LinkedHashMap<IPortletType, PortletPublishingDefinition>(channelTypes.size());
for (final IPortletType channelType : channelTypes) {
final PortletPublishingDefinition cpd =
this.getChannelPublishingDefinition(channelType.getId());
cpds.put(channelType, cpd);
}
return cpds;
} }
|
public class class_name {
@Override
public Map<IPortletType, PortletPublishingDefinition> getChannelPublishingDefinitions() {
final List<IPortletType> channelTypes = this.portletTypeRegistry.getPortletTypes();
final Map<IPortletType, PortletPublishingDefinition> cpds =
new LinkedHashMap<IPortletType, PortletPublishingDefinition>(channelTypes.size());
for (final IPortletType channelType : channelTypes) {
final PortletPublishingDefinition cpd =
this.getChannelPublishingDefinition(channelType.getId());
cpds.put(channelType, cpd); // depends on control dependency: [for], data = [channelType]
}
return cpds;
} }
|
public class class_name {
public void marshall(CancelJobRequest cancelJobRequest, ProtocolMarshaller protocolMarshaller) {
if (cancelJobRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(cancelJobRequest.getJobId(), JOBID_BINDING);
protocolMarshaller.marshall(cancelJobRequest.getReasonCode(), REASONCODE_BINDING);
protocolMarshaller.marshall(cancelJobRequest.getComment(), COMMENT_BINDING);
protocolMarshaller.marshall(cancelJobRequest.getForce(), FORCE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(CancelJobRequest cancelJobRequest, ProtocolMarshaller protocolMarshaller) {
if (cancelJobRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(cancelJobRequest.getJobId(), JOBID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(cancelJobRequest.getReasonCode(), REASONCODE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(cancelJobRequest.getComment(), COMMENT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(cancelJobRequest.getForce(), FORCE_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 KeysAndAttributes withKeys(java.util.Map<String, AttributeValue>... keys) {
if (this.keys == null) {
setKeys(new java.util.ArrayList<java.util.Map<String, AttributeValue>>(keys.length));
}
for (java.util.Map<String, AttributeValue> ele : keys) {
this.keys.add(ele);
}
return this;
} }
|
public class class_name {
public KeysAndAttributes withKeys(java.util.Map<String, AttributeValue>... keys) {
if (this.keys == null) {
setKeys(new java.util.ArrayList<java.util.Map<String, AttributeValue>>(keys.length)); // depends on control dependency: [if], data = [none]
}
for (java.util.Map<String, AttributeValue> ele : keys) {
this.keys.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} }
|
public class class_name {
public java.lang.String getCharactersToSkip() {
java.lang.Object ref = "";
if (charactersCase_ == 1) {
ref = characters_;
}
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (charactersCase_ == 1) {
characters_ = s;
}
return s;
}
} }
|
public class class_name {
public java.lang.String getCharactersToSkip() {
java.lang.Object ref = "";
if (charactersCase_ == 1) {
ref = characters_; // depends on control dependency: [if], data = [none]
}
if (ref instanceof java.lang.String) {
return (java.lang.String) ref; // depends on control dependency: [if], data = [none]
} else {
com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (charactersCase_ == 1) {
characters_ = s; // depends on control dependency: [if], data = [none]
}
return s; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static void setDebugMode(boolean b) {
debugMode = Boolean.valueOf( b );
if (debugMode) {
if (!MVELRuntime.hasDebuggerContext()) {
MVELRuntime.setThreadDebugger(new MVELDebugger());
}
} else {
MVELRuntime.resetDebugger();
}
System.setProperty( DEBUG_LAUNCH_KEY, debugMode.toString());
} }
|
public class class_name {
public static void setDebugMode(boolean b) {
debugMode = Boolean.valueOf( b );
if (debugMode) {
if (!MVELRuntime.hasDebuggerContext()) {
MVELRuntime.setThreadDebugger(new MVELDebugger()); // depends on control dependency: [if], data = [none]
}
} else {
MVELRuntime.resetDebugger(); // depends on control dependency: [if], data = [none]
}
System.setProperty( DEBUG_LAUNCH_KEY, debugMode.toString());
} }
|
public class class_name {
protected <T extends JvmTypeReference> T cloneAndAssociate(T original) {
final boolean canAssociate = languageInfo.isLanguage(original.eResource());
EcoreUtil.Copier copier = new EcoreUtil.Copier(false) {
private static final long serialVersionUID = 1L;
@Override/* @Nullable */
protected EObject createCopy(/* @Nullable */ EObject eObject) {
EObject result = super.createCopy(eObject);
if (result != null && eObject != null && !eObject.eIsProxy()) {
if (canAssociate)
associator.associate(eObject, result);
}
return result;
}
@Override
public EObject copy(/* @Nullable */ EObject eObject) {
EObject result = super.copy(eObject);
if (result instanceof JvmWildcardTypeReference) {
boolean upperBoundSeen = false;
for(JvmTypeConstraint constraint: ((JvmWildcardTypeReference) result).getConstraints()) {
if (constraint instanceof JvmUpperBound) {
upperBoundSeen = true;
break;
}
}
if (!upperBoundSeen) {
// no upper bound found - seems to be an invalid - assume object as upper bound
JvmTypeReference object = newObjectReference();
JvmUpperBound upperBound = typesFactory.createJvmUpperBound();
upperBound.setTypeReference(object);
((JvmWildcardTypeReference) result).getConstraints().add(0, upperBound);
}
}
return result;
}
};
@SuppressWarnings("unchecked")
T copy = (T) copier.copy(original);
copier.copyReferences();
return copy;
} }
|
public class class_name {
protected <T extends JvmTypeReference> T cloneAndAssociate(T original) {
final boolean canAssociate = languageInfo.isLanguage(original.eResource());
EcoreUtil.Copier copier = new EcoreUtil.Copier(false) {
private static final long serialVersionUID = 1L;
@Override/* @Nullable */
protected EObject createCopy(/* @Nullable */ EObject eObject) {
EObject result = super.createCopy(eObject);
if (result != null && eObject != null && !eObject.eIsProxy()) {
if (canAssociate)
associator.associate(eObject, result);
}
return result;
}
@Override
public EObject copy(/* @Nullable */ EObject eObject) {
EObject result = super.copy(eObject);
if (result instanceof JvmWildcardTypeReference) {
boolean upperBoundSeen = false;
for(JvmTypeConstraint constraint: ((JvmWildcardTypeReference) result).getConstraints()) {
if (constraint instanceof JvmUpperBound) {
upperBoundSeen = true; // depends on control dependency: [if], data = [none]
break;
}
}
if (!upperBoundSeen) {
// no upper bound found - seems to be an invalid - assume object as upper bound
JvmTypeReference object = newObjectReference();
JvmUpperBound upperBound = typesFactory.createJvmUpperBound();
upperBound.setTypeReference(object); // depends on control dependency: [if], data = [none]
((JvmWildcardTypeReference) result).getConstraints().add(0, upperBound); // depends on control dependency: [if], data = [none]
}
}
return result;
}
};
@SuppressWarnings("unchecked")
T copy = (T) copier.copy(original);
copier.copyReferences();
return copy;
} }
|
public class class_name {
public static void createNewRow(SheetTemplate template) {
if (template.lastRowIndex > template.currentRowIndex && template.currentRowIndex != template.initRowIndex) {
template.sheet.shiftRows(template.currentRowIndex, template.lastRowIndex, 1, true, true);
template.lastRowIndex++;
}
template.currentRow = template.sheet.createRow(template.currentRowIndex);
template.currentRow.setHeightInPoints(template.rowHeight);
template.currentRowIndex++;
template.currentColumnIndex = template.initColumnIndex;
} }
|
public class class_name {
public static void createNewRow(SheetTemplate template) {
if (template.lastRowIndex > template.currentRowIndex && template.currentRowIndex != template.initRowIndex) {
template.sheet.shiftRows(template.currentRowIndex, template.lastRowIndex, 1, true, true); // depends on control dependency: [if], data = [none]
template.lastRowIndex++; // depends on control dependency: [if], data = [none]
}
template.currentRow = template.sheet.createRow(template.currentRowIndex);
template.currentRow.setHeightInPoints(template.rowHeight);
template.currentRowIndex++;
template.currentColumnIndex = template.initColumnIndex;
} }
|
public class class_name {
protected final Event processEvent() throws IOException {
while (true) {
String line;
try {
line = readLine();
} catch (final EOFException ex) {
if (doneOnce) {
throw ex;
}
doneOnce = true;
line = "";
}
// If the line is empty (a blank line), Dispatch the event, as defined below.
if (line.isEmpty()) {
// If the data buffer is an empty string, set the data buffer and the event name buffer to
// the empty string and abort these steps.
if (dataBuffer.length() == 0) {
eventName = "";
continue;
}
// If the event name buffer is not the empty string but is also not a valid NCName,
// set the data buffer and the event name buffer to the empty string and abort these steps.
// NOT IMPLEMENTED
final Event.Builder eventBuilder = new Event.Builder();
eventBuilder.withEventName(eventName.isEmpty() ? Event.MESSAGE_EVENT : eventName);
eventBuilder.withData(dataBuffer.toString());
// Set the data buffer and the event name buffer to the empty string.
dataBuffer = new StringBuilder();
eventName = "";
return eventBuilder.build();
// If the line starts with a U+003A COLON character (':')
} else if (line.startsWith(":")) {
// ignore the line
// If the line contains a U+003A COLON character (':') character
} else if (line.contains(":")) {
// Collect the characters on the line before the first U+003A COLON character (':'),
// and let field be that string.
final int colonIdx = line.indexOf(":");
final String field = line.substring(0, colonIdx);
// Collect the characters on the line after the first U+003A COLON character (':'),
// and let value be that string.
// If value starts with a single U+0020 SPACE character, remove it from value.
String value = line.substring(colonIdx + 1);
value = value.startsWith(" ") ? value.substring(1) : value;
processField(field, value);
// Otherwise, the string is not empty but does not contain a U+003A COLON character (':')
// character
} else {
processField(line, "");
}
}
} }
|
public class class_name {
protected final Event processEvent() throws IOException {
while (true) {
String line;
try {
line = readLine(); // depends on control dependency: [try], data = [none]
} catch (final EOFException ex) {
if (doneOnce) {
throw ex;
}
doneOnce = true;
line = "";
} // depends on control dependency: [catch], data = [none]
// If the line is empty (a blank line), Dispatch the event, as defined below.
if (line.isEmpty()) {
// If the data buffer is an empty string, set the data buffer and the event name buffer to
// the empty string and abort these steps.
if (dataBuffer.length() == 0) {
eventName = ""; // depends on control dependency: [if], data = [none]
continue;
}
// If the event name buffer is not the empty string but is also not a valid NCName,
// set the data buffer and the event name buffer to the empty string and abort these steps.
// NOT IMPLEMENTED
final Event.Builder eventBuilder = new Event.Builder();
eventBuilder.withEventName(eventName.isEmpty() ? Event.MESSAGE_EVENT : eventName); // depends on control dependency: [if], data = [none]
eventBuilder.withData(dataBuffer.toString()); // depends on control dependency: [if], data = [none]
// Set the data buffer and the event name buffer to the empty string.
dataBuffer = new StringBuilder(); // depends on control dependency: [if], data = [none]
eventName = ""; // depends on control dependency: [if], data = [none]
return eventBuilder.build(); // depends on control dependency: [if], data = [none]
// If the line starts with a U+003A COLON character (':')
} else if (line.startsWith(":")) {
// ignore the line
// If the line contains a U+003A COLON character (':') character
} else if (line.contains(":")) {
// Collect the characters on the line before the first U+003A COLON character (':'),
// and let field be that string.
final int colonIdx = line.indexOf(":");
final String field = line.substring(0, colonIdx);
// Collect the characters on the line after the first U+003A COLON character (':'),
// and let value be that string.
// If value starts with a single U+0020 SPACE character, remove it from value.
String value = line.substring(colonIdx + 1);
value = value.startsWith(" ") ? value.substring(1) : value; // depends on control dependency: [if], data = [none]
processField(field, value); // depends on control dependency: [if], data = [none]
// Otherwise, the string is not empty but does not contain a U+003A COLON character (':')
// character
} else {
processField(line, ""); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public void goBack() {
String action = "Going back one page";
String expected = "Previous page from browser history is loaded";
try {
driver.navigate().back();
} catch (Exception e) {
reporter.fail(action, expected, "Browser was unable to go back one page. " + e.getMessage());
log.warn(e);
return;
}
reporter.pass(action, expected, expected);
} }
|
public class class_name {
public void goBack() {
String action = "Going back one page";
String expected = "Previous page from browser history is loaded";
try {
driver.navigate().back(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
reporter.fail(action, expected, "Browser was unable to go back one page. " + e.getMessage());
log.warn(e);
return;
} // depends on control dependency: [catch], data = [none]
reporter.pass(action, expected, expected);
} }
|
public class class_name {
public static base_responses update(nitro_service client, snmpuser resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
snmpuser updateresources[] = new snmpuser[resources.length];
for (int i=0;i<resources.length;i++){
updateresources[i] = new snmpuser();
updateresources[i].name = resources[i].name;
updateresources[i].group = resources[i].group;
updateresources[i].authtype = resources[i].authtype;
updateresources[i].authpasswd = resources[i].authpasswd;
updateresources[i].privtype = resources[i].privtype;
updateresources[i].privpasswd = resources[i].privpasswd;
}
result = update_bulk_request(client, updateresources);
}
return result;
} }
|
public class class_name {
public static base_responses update(nitro_service client, snmpuser resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
snmpuser updateresources[] = new snmpuser[resources.length];
for (int i=0;i<resources.length;i++){
updateresources[i] = new snmpuser(); // depends on control dependency: [for], data = [i]
updateresources[i].name = resources[i].name; // depends on control dependency: [for], data = [i]
updateresources[i].group = resources[i].group; // depends on control dependency: [for], data = [i]
updateresources[i].authtype = resources[i].authtype; // depends on control dependency: [for], data = [i]
updateresources[i].authpasswd = resources[i].authpasswd; // depends on control dependency: [for], data = [i]
updateresources[i].privtype = resources[i].privtype; // depends on control dependency: [for], data = [i]
updateresources[i].privpasswd = resources[i].privpasswd; // depends on control dependency: [for], data = [i]
}
result = update_bulk_request(client, updateresources);
}
return result;
} }
|
public class class_name {
public void setInstanceTypeFilter(java.util.Collection<String> instanceTypeFilter) {
if (instanceTypeFilter == null) {
this.instanceTypeFilter = null;
return;
}
this.instanceTypeFilter = new com.amazonaws.internal.SdkInternalList<String>(instanceTypeFilter);
} }
|
public class class_name {
public void setInstanceTypeFilter(java.util.Collection<String> instanceTypeFilter) {
if (instanceTypeFilter == null) {
this.instanceTypeFilter = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.instanceTypeFilter = new com.amazonaws.internal.SdkInternalList<String>(instanceTypeFilter);
} }
|
public class class_name {
private void addParams(RequestBuilder call, Param[] params) {
// Once upon a time this was necessary, now it isn't
//call.addParam("format", "json");
if (this.accessToken != null)
call.addParam("access_token", this.accessToken);
if (this.appSecretProof != null)
call.addParam("appsecret_proof", this.appSecretProof);
if (params != null) {
for (Param param: params) {
if (param instanceof BinaryParam) {
call.addParam(param.name, (InputStream)param.value, ((BinaryParam)param).contentType, "irrelevant");
} else {
String paramValue = StringUtils.stringifyValue(param, this.mapper);
call.addParam(param.name, paramValue);
}
}
}
} }
|
public class class_name {
private void addParams(RequestBuilder call, Param[] params) {
// Once upon a time this was necessary, now it isn't
//call.addParam("format", "json");
if (this.accessToken != null)
call.addParam("access_token", this.accessToken);
if (this.appSecretProof != null)
call.addParam("appsecret_proof", this.appSecretProof);
if (params != null) {
for (Param param: params) {
if (param instanceof BinaryParam) {
call.addParam(param.name, (InputStream)param.value, ((BinaryParam)param).contentType, "irrelevant");
// depends on control dependency: [if], data = [none]
} else {
String paramValue = StringUtils.stringifyValue(param, this.mapper);
call.addParam(param.name, paramValue);
// depends on control dependency: [if], data = [none]
}
}
}
} }
|
public class class_name {
private String getHttpMethod(final HttpServletRequest request) {
String ret = (String) request.getAttribute(Keys.HttpRequest.REQUEST_METHOD);
if (StringUtils.isBlank(ret)) {
ret = request.getMethod();
}
return ret;
} }
|
public class class_name {
private String getHttpMethod(final HttpServletRequest request) {
String ret = (String) request.getAttribute(Keys.HttpRequest.REQUEST_METHOD);
if (StringUtils.isBlank(ret)) {
ret = request.getMethod(); // depends on control dependency: [if], data = [none]
}
return ret;
} }
|
public class class_name {
protected int countComponentContainPaxWicketBeanAnnotatedFieldsHierachical(Class<?> component) {
Class<?> clazz = component;
int numberOfInjectionFields = 0;
while (clazz != null && !isBoundaryClass(clazz)) {
for (Field field : clazz.getDeclaredFields()) {
if (field.isAnnotationPresent(Inject.class)) {
numberOfInjectionFields++;
}
}
clazz = clazz.getSuperclass();
}
return numberOfInjectionFields;
} }
|
public class class_name {
protected int countComponentContainPaxWicketBeanAnnotatedFieldsHierachical(Class<?> component) {
Class<?> clazz = component;
int numberOfInjectionFields = 0;
while (clazz != null && !isBoundaryClass(clazz)) {
for (Field field : clazz.getDeclaredFields()) {
if (field.isAnnotationPresent(Inject.class)) {
numberOfInjectionFields++; // depends on control dependency: [if], data = [none]
}
}
clazz = clazz.getSuperclass(); // depends on control dependency: [while], data = [none]
}
return numberOfInjectionFields;
} }
|
public class class_name {
public static String getFileName(String string) throws UnsupportedEncodingException {
if (Checker.isNotEmpty(string)) {
string = URLDecoder.decode(string, "UTF-8");
Matcher matcher = FILE_NAME_PATTERN.matcher(string);
if (matcher.find() && Checker.isNotEmpty(matcher.group(0))) {
String name = matcher.group(0).split("\\?")[0];
if (Checker.isNotEmpty(name)) {
return name;
}
}
}
return "undefined";
} }
|
public class class_name {
public static String getFileName(String string) throws UnsupportedEncodingException {
if (Checker.isNotEmpty(string)) {
string = URLDecoder.decode(string, "UTF-8");
Matcher matcher = FILE_NAME_PATTERN.matcher(string);
if (matcher.find() && Checker.isNotEmpty(matcher.group(0))) {
String name = matcher.group(0).split("\\?")[0];
if (Checker.isNotEmpty(name)) {
return name; // depends on control dependency: [if], data = [none]
}
}
}
return "undefined";
} }
|
public class class_name {
public static int mergingCells(Sheet sheet, int firstRow, int lastRow, int firstColumn, int lastColumn, CellStyle cellStyle) {
final CellRangeAddress cellRangeAddress = new CellRangeAddress(//
firstRow, // first row (0-based)
lastRow, // last row (0-based)
firstColumn, // first column (0-based)
lastColumn // last column (0-based)
);
if (null != cellStyle) {
RegionUtil.setBorderTop(cellStyle.getBorderTopEnum(), cellRangeAddress, sheet);
RegionUtil.setBorderRight(cellStyle.getBorderRightEnum(), cellRangeAddress, sheet);
RegionUtil.setBorderBottom(cellStyle.getBorderBottomEnum(), cellRangeAddress, sheet);
RegionUtil.setBorderLeft(cellStyle.getBorderLeftEnum(), cellRangeAddress, sheet);
}
return sheet.addMergedRegion(cellRangeAddress);
} }
|
public class class_name {
public static int mergingCells(Sheet sheet, int firstRow, int lastRow, int firstColumn, int lastColumn, CellStyle cellStyle) {
final CellRangeAddress cellRangeAddress = new CellRangeAddress(//
firstRow, // first row (0-based)
lastRow, // last row (0-based)
firstColumn, // first column (0-based)
lastColumn // last column (0-based)
);
if (null != cellStyle) {
RegionUtil.setBorderTop(cellStyle.getBorderTopEnum(), cellRangeAddress, sheet);
// depends on control dependency: [if], data = [none]
RegionUtil.setBorderRight(cellStyle.getBorderRightEnum(), cellRangeAddress, sheet);
// depends on control dependency: [if], data = [none]
RegionUtil.setBorderBottom(cellStyle.getBorderBottomEnum(), cellRangeAddress, sheet);
// depends on control dependency: [if], data = [none]
RegionUtil.setBorderLeft(cellStyle.getBorderLeftEnum(), cellRangeAddress, sheet);
// depends on control dependency: [if], data = [none]
}
return sheet.addMergedRegion(cellRangeAddress);
} }
|
public class class_name {
public void removeConsumerDispatcherMatchTarget(ConsumerDispatcher consumerDispatcher, SelectionCriteria selectionCriteria)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc,
"removeConsumerDispatcherMatchTarget",
new Object[] {consumerDispatcher, selectionCriteria});
// Remove the consumer point from the matchspace
// Set the CD and selection criteria into a wrapper that extends MatchTarget
MatchingConsumerDispatcherWithCriteira key = new MatchingConsumerDispatcherWithCriteira (consumerDispatcher,selectionCriteria);
// Reset the CD flag to indicate that this subscription is not in the MatchSpace.
consumerDispatcher.setIsInMatchSpace(false);
try
{
removeTarget(key);
}
catch (MatchingException e)
{
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.matching.MessageProcessorMatching.removeConsumerDispatcherMatchTarget",
"1:1312:1.117.1.11",
this);
SibTr.exception(tc, e);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "removeConsumerDispatcherMatchTarget", "SICoreException");
SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0002",
new Object[] {
"com.ibm.ws.sib.processor.matching.MessageProcessorMatching",
"1:1323:1.117.1.11",
e });
throw new SIErrorException(
nls.getFormattedMessage(
"INTERNAL_MESSAGING_ERROR_CWSIP0002",
new Object[] {
"com.ibm.ws.sib.processor.matching.MessageProcessorMatching",
"1:1331:1.117.1.11",
e },
null),
e);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "removeConsumerDispatcherMatchTarget");
} }
|
public class class_name {
public void removeConsumerDispatcherMatchTarget(ConsumerDispatcher consumerDispatcher, SelectionCriteria selectionCriteria)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc,
"removeConsumerDispatcherMatchTarget",
new Object[] {consumerDispatcher, selectionCriteria});
// Remove the consumer point from the matchspace
// Set the CD and selection criteria into a wrapper that extends MatchTarget
MatchingConsumerDispatcherWithCriteira key = new MatchingConsumerDispatcherWithCriteira (consumerDispatcher,selectionCriteria);
// Reset the CD flag to indicate that this subscription is not in the MatchSpace.
consumerDispatcher.setIsInMatchSpace(false);
try
{
removeTarget(key); // depends on control dependency: [try], data = [none]
}
catch (MatchingException e)
{
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.matching.MessageProcessorMatching.removeConsumerDispatcherMatchTarget",
"1:1312:1.117.1.11",
this);
SibTr.exception(tc, e);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "removeConsumerDispatcherMatchTarget", "SICoreException");
SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0002",
new Object[] {
"com.ibm.ws.sib.processor.matching.MessageProcessorMatching",
"1:1323:1.117.1.11",
e });
throw new SIErrorException(
nls.getFormattedMessage(
"INTERNAL_MESSAGING_ERROR_CWSIP0002",
new Object[] {
"com.ibm.ws.sib.processor.matching.MessageProcessorMatching",
"1:1331:1.117.1.11",
e },
null),
e);
} // depends on control dependency: [catch], data = [none]
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "removeConsumerDispatcherMatchTarget");
} }
|
public class class_name {
private static IntNaryTree readSubtreeInPtbFormat(IntObjectBimap<String> lexAlphabet, IntObjectBimap<String> ntAlphabet, Reader reader) throws IOException {
ReaderState state = ReaderState.START;
StringBuilder symbolSb = new StringBuilder();
ArrayList<IntNaryTree> children = null;
boolean isLexical = false;
char[] cbuf = new char[1];
while (reader.read(cbuf) != -1) {
//for (int i=0; i<treeStr.length(); i++) {
//char c = treeStr.charAt(i);
char c = cbuf[0];
if (state == ReaderState.START) {
if (c == '(') {
state = ReaderState.NONTERMINAL;
} else if (c == ')') {
// This was the tail end of a tree.
break;
} else if (!isWhitespace(c)) {
symbolSb.append(c);
state = ReaderState.LEXICAL;
isLexical = true;
}
} else if (state == ReaderState.LEXICAL) {
if (isWhitespace(c) || c == ')') {
state = ReaderState.DONE;
break;
} else {
symbolSb.append(c);
}
} else if (state == ReaderState.NONTERMINAL) {
if (isWhitespace(c)) {
state = ReaderState.CHILDREN;
children = readTreesInPtbFormat(lexAlphabet, ntAlphabet, reader);
state = ReaderState.DONE;
break;
} else {
symbolSb.append(c);
}
} else {
throw new IllegalStateException("Invalid state: " + state);
}
}
if (state != ReaderState.DONE) {
// This reader did not start with a valid PTB style tree.
return null;
}
int start = NOT_INITIALIZED;
int end = NOT_INITIALIZED;
IntObjectBimap<String> alphabet = (isLexical ? lexAlphabet : ntAlphabet);
String symbolStr = symbolSb.toString();
String l = isLexical ? symbolStr : symbolStr;
int symbol = alphabet.lookupIndex(l);
if (symbol == -1) {
throw new IllegalStateException("Unknown "
+ (isLexical ? "word" : "nonterminal") + ": "
+ symbolSb.toString());
}
IntNaryTree root = new IntNaryTree(symbol, start, end, children, isLexical, alphabet);
return root;
} }
|
public class class_name {
private static IntNaryTree readSubtreeInPtbFormat(IntObjectBimap<String> lexAlphabet, IntObjectBimap<String> ntAlphabet, Reader reader) throws IOException {
ReaderState state = ReaderState.START;
StringBuilder symbolSb = new StringBuilder();
ArrayList<IntNaryTree> children = null;
boolean isLexical = false;
char[] cbuf = new char[1];
while (reader.read(cbuf) != -1) {
//for (int i=0; i<treeStr.length(); i++) {
//char c = treeStr.charAt(i);
char c = cbuf[0];
if (state == ReaderState.START) {
if (c == '(') {
state = ReaderState.NONTERMINAL; // depends on control dependency: [if], data = [none]
} else if (c == ')') {
// This was the tail end of a tree.
break;
} else if (!isWhitespace(c)) {
symbolSb.append(c); // depends on control dependency: [if], data = [none]
state = ReaderState.LEXICAL; // depends on control dependency: [if], data = [none]
isLexical = true; // depends on control dependency: [if], data = [none]
}
} else if (state == ReaderState.LEXICAL) {
if (isWhitespace(c) || c == ')') {
state = ReaderState.DONE; // depends on control dependency: [if], data = [none]
break;
} else {
symbolSb.append(c); // depends on control dependency: [if], data = [none]
}
} else if (state == ReaderState.NONTERMINAL) {
if (isWhitespace(c)) {
state = ReaderState.CHILDREN; // depends on control dependency: [if], data = [none]
children = readTreesInPtbFormat(lexAlphabet, ntAlphabet, reader); // depends on control dependency: [if], data = [none]
state = ReaderState.DONE; // depends on control dependency: [if], data = [none]
break;
} else {
symbolSb.append(c); // depends on control dependency: [if], data = [none]
}
} else {
throw new IllegalStateException("Invalid state: " + state);
}
}
if (state != ReaderState.DONE) {
// This reader did not start with a valid PTB style tree.
return null;
}
int start = NOT_INITIALIZED;
int end = NOT_INITIALIZED;
IntObjectBimap<String> alphabet = (isLexical ? lexAlphabet : ntAlphabet);
String symbolStr = symbolSb.toString();
String l = isLexical ? symbolStr : symbolStr;
int symbol = alphabet.lookupIndex(l);
if (symbol == -1) {
throw new IllegalStateException("Unknown "
+ (isLexical ? "word" : "nonterminal") + ": "
+ symbolSb.toString());
}
IntNaryTree root = new IntNaryTree(symbol, start, end, children, isLexical, alphabet);
return root;
} }
|
public class class_name {
public void setClassifiers(java.util.Collection<Classifier> classifiers) {
if (classifiers == null) {
this.classifiers = null;
return;
}
this.classifiers = new java.util.ArrayList<Classifier>(classifiers);
} }
|
public class class_name {
public void setClassifiers(java.util.Collection<Classifier> classifiers) {
if (classifiers == null) {
this.classifiers = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.classifiers = new java.util.ArrayList<Classifier>(classifiers);
} }
|
public class class_name {
public static String getCMDKey(final MetaData columnMD, final String line) {
if (!columnMD.isAnyRecordFormatSpecified()) {
// no <RECORD> elements were specified for this parse, just return the
// detail id
return FPConstants.DETAIL_ID;
}
final Iterator<Entry<String, XMLRecordElement>> mapEntries = columnMD.xmlRecordIterator();
// loop through the XMLRecordElement objects and see if we need a
// different MD object
while (mapEntries.hasNext()) {
final Entry<String, XMLRecordElement> entry = mapEntries.next();
final XMLRecordElement recordXMLElement = entry.getValue();
if (recordXMLElement.getEndPositition() > line.length()) {
// make sure our substring is not going to fail
continue;
}
final int subfrm = recordXMLElement.getStartPosition() - 1; // convert
// to 0
// based
final int subto = recordXMLElement.getEndPositition();
if (line.substring(subfrm, subto).equals(recordXMLElement.getIndicator())) {
// we found the MD object we want to return
return entry.getKey();
}
}
// must be a detail line
return FPConstants.DETAIL_ID;
} }
|
public class class_name {
public static String getCMDKey(final MetaData columnMD, final String line) {
if (!columnMD.isAnyRecordFormatSpecified()) {
// no <RECORD> elements were specified for this parse, just return the
// detail id
return FPConstants.DETAIL_ID;
// depends on control dependency: [if], data = [none]
}
final Iterator<Entry<String, XMLRecordElement>> mapEntries = columnMD.xmlRecordIterator();
// loop through the XMLRecordElement objects and see if we need a
// different MD object
while (mapEntries.hasNext()) {
final Entry<String, XMLRecordElement> entry = mapEntries.next();
final XMLRecordElement recordXMLElement = entry.getValue();
if (recordXMLElement.getEndPositition() > line.length()) {
// make sure our substring is not going to fail
continue;
}
final int subfrm = recordXMLElement.getStartPosition() - 1; // convert
// to 0
// based
final int subto = recordXMLElement.getEndPositition();
if (line.substring(subfrm, subto).equals(recordXMLElement.getIndicator())) {
// we found the MD object we want to return
return entry.getKey();
// depends on control dependency: [if], data = [none]
}
}
// must be a detail line
return FPConstants.DETAIL_ID;
} }
|
public class class_name {
public EnumMap<TimeUnit, Timespan> getAsTimespans(EnumSet<TimeUnit> timeUnits) {
EnumMap<TimeUnit, Timespan> res = new EnumMap<TimeUnit, Timespan>(TimeUnit.class);
long durationInMillis = getDurationInMilliseconds();
for (TimeUnit timeUnit : TIME_UNIT_ORDER) {
if (timeUnits.contains(timeUnit)) {
Timespan timespan = truncateDurationToUnit(durationInMillis, timeUnit);
res.put(timeUnit, timespan);
durationInMillis -= timespan.getDurationInMilliseconds();
}
}
return res;
} }
|
public class class_name {
public EnumMap<TimeUnit, Timespan> getAsTimespans(EnumSet<TimeUnit> timeUnits) {
EnumMap<TimeUnit, Timespan> res = new EnumMap<TimeUnit, Timespan>(TimeUnit.class);
long durationInMillis = getDurationInMilliseconds();
for (TimeUnit timeUnit : TIME_UNIT_ORDER) {
if (timeUnits.contains(timeUnit)) {
Timespan timespan = truncateDurationToUnit(durationInMillis, timeUnit);
res.put(timeUnit, timespan); // depends on control dependency: [if], data = [none]
durationInMillis -= timespan.getDurationInMilliseconds(); // depends on control dependency: [if], data = [none]
}
}
return res;
} }
|
public class class_name {
public boolean isSame(Item otherItem)
{
if (isValid())
{
if (otherItem == null)
{
return false;
}
if (!this.getClass().equals(otherItem.getClass()))
{
return false;
}
try
{
// identifier is not changed on ItemImpl
return getInternalIdentifier().equals(((ItemImpl)otherItem).getInternalIdentifier());
}
catch (Exception e)
{
LOG.debug("Item.isSame() failed " + e.getMessage());
return false;
}
}
return false;
} }
|
public class class_name {
public boolean isSame(Item otherItem)
{
if (isValid())
{
if (otherItem == null)
{
return false; // depends on control dependency: [if], data = [none]
}
if (!this.getClass().equals(otherItem.getClass()))
{
return false; // depends on control dependency: [if], data = [none]
}
try
{
// identifier is not changed on ItemImpl
return getInternalIdentifier().equals(((ItemImpl)otherItem).getInternalIdentifier()); // depends on control dependency: [try], data = [none]
}
catch (Exception e)
{
LOG.debug("Item.isSame() failed " + e.getMessage());
return false;
} // depends on control dependency: [catch], data = [none]
}
return false;
} }
|
public class class_name {
public static Map<String, CmsResourceTableProperty> getDefaultColumnsByName() {
if (m_columnsByName == null) {
m_columnsByName = Maps.newHashMap();
for (CmsResourceTableProperty column : defaultProperties()) {
m_columnsByName.put(column.getId(), column);
}
}
return Collections.unmodifiableMap(m_columnsByName);
} }
|
public class class_name {
public static Map<String, CmsResourceTableProperty> getDefaultColumnsByName() {
if (m_columnsByName == null) {
m_columnsByName = Maps.newHashMap(); // depends on control dependency: [if], data = [none]
for (CmsResourceTableProperty column : defaultProperties()) {
m_columnsByName.put(column.getId(), column); // depends on control dependency: [for], data = [column]
}
}
return Collections.unmodifiableMap(m_columnsByName);
} }
|
public class class_name {
public synchronized boolean validate(java.io.PrintStream printStream)
throws ObjectManagerException
{
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.entry(this,
cclass,
"validate",
new Object[] { printStream });
boolean valid = true; // Until proven otherwise.
int logSizePlus1 = 0;
for (long sizePlus1 = size + 1; sizePlus1 != 0; sizePlus1 = sizePlus1 >>> 1) {
logSizePlus1++;
} // for...
int maximumLeafDepth = (int) (2 * logSizePlus1);
int firstBlackDepth = 0;
long numberFound = 0;
Iterator iterator = entrySet().iterator();
Entry previous = null;
if (iterator.hasNext()) {
numberFound++;
previous = (Entry) iterator.next();
} // if (iterator.hasNext()).
while (iterator.hasNext()) {
numberFound++;
Entry entry = (Entry) iterator.next();
// Check keys are returned in the sort order.
if (compare(entry.getKey(), previous.getKey()) < 0) {
valid = false;
printStream.println("key=" + previous.getKey() + " < following key=" + entry.getKey());
} // if (compare...
previous = entry;
// Check that a RED node has two BLACK/Null children.
if (entry.getColor()) {
if ((entry.getLeft() != null && entry.getLeft().getColor())
|| (entry.getRight() != null && entry.getRight().getColor())) {
printStream.println((indexLabel(entry) + " ").substring(0, 20)
+ " Key=" + entry.getKey() + " Value=" + entry.getValue()
+ " Red node without two BLACK/null chideren left=" + entry.getLeft() + " right=" + entry.getRight());
}
} // if (entry.getColor())
// Check tree is balanced, all leaf nodes must have the same number
// of BLACK nodes between themselves and the root. No leaf may be more
// than 2*Log2(size+1) nodes from the root.
if (entry.getLeft() == null || entry.getRight() == null) {
int blackDepth = 0;
int depth = 0;
for (Entry parent = entry; parent != getRoot(); parent = (Entry) parent.getParent()) {
depth++;
if (!parent.getColor())
blackDepth++;
} // for...
if (firstBlackDepth == 0)
firstBlackDepth = blackDepth;
if (depth > maximumLeafDepth) {
valid = false;
printStream.println((indexLabel(entry) + " ").substring(0, 20)
+ " Key=" + entry.getKey() + " Value=" + entry.getValue()
+ " Leaf depth=" + depth + ">" + maximumLeafDepth);
} // if if (depth > maximumLeafDepth ).
if (blackDepth != firstBlackDepth) {
valid = false;
printStream.println((indexLabel(entry) + " ").substring(0, 20)
+ " Key=" + entry.getKey() + " Value=" + entry.getValue()
+ " blackDepth=" + blackDepth + " != " + firstBlackDepth);
} // if if (depth > maximumLeafDepth ).
}
} // while...
if (numberFound != size())
printStream.println(" Number of Entries found=" + numberFound + " != size()" + size());
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.exit(this,
cclass,
"validate",
new Object[] { new Boolean(valid) });
return valid;
} }
|
public class class_name {
public synchronized boolean validate(java.io.PrintStream printStream)
throws ObjectManagerException
{
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.entry(this,
cclass,
"validate",
new Object[] { printStream });
boolean valid = true; // Until proven otherwise.
int logSizePlus1 = 0;
for (long sizePlus1 = size + 1; sizePlus1 != 0; sizePlus1 = sizePlus1 >>> 1) {
logSizePlus1++;
} // for...
int maximumLeafDepth = (int) (2 * logSizePlus1);
int firstBlackDepth = 0;
long numberFound = 0;
Iterator iterator = entrySet().iterator();
Entry previous = null;
if (iterator.hasNext()) {
numberFound++;
previous = (Entry) iterator.next();
} // if (iterator.hasNext()).
while (iterator.hasNext()) {
numberFound++;
Entry entry = (Entry) iterator.next();
// Check keys are returned in the sort order.
if (compare(entry.getKey(), previous.getKey()) < 0) {
valid = false; // depends on control dependency: [if], data = [none]
printStream.println("key=" + previous.getKey() + " < following key=" + entry.getKey()); // depends on control dependency: [if], data = [none]
} // if (compare...
previous = entry;
// Check that a RED node has two BLACK/Null children.
if (entry.getColor()) {
if ((entry.getLeft() != null && entry.getLeft().getColor())
|| (entry.getRight() != null && entry.getRight().getColor())) {
printStream.println((indexLabel(entry) + " ").substring(0, 20)
+ " Key=" + entry.getKey() + " Value=" + entry.getValue()
+ " Red node without two BLACK/null chideren left=" + entry.getLeft() + " right=" + entry.getRight()); // depends on control dependency: [if], data = [none]
}
} // if (entry.getColor())
// Check tree is balanced, all leaf nodes must have the same number
// of BLACK nodes between themselves and the root. No leaf may be more
// than 2*Log2(size+1) nodes from the root.
if (entry.getLeft() == null || entry.getRight() == null) {
int blackDepth = 0;
int depth = 0;
for (Entry parent = entry; parent != getRoot(); parent = (Entry) parent.getParent()) {
depth++; // depends on control dependency: [for], data = [none]
if (!parent.getColor())
blackDepth++;
} // for...
if (firstBlackDepth == 0)
firstBlackDepth = blackDepth;
if (depth > maximumLeafDepth) {
valid = false; // depends on control dependency: [if], data = [none]
printStream.println((indexLabel(entry) + " ").substring(0, 20)
+ " Key=" + entry.getKey() + " Value=" + entry.getValue()
+ " Leaf depth=" + depth + ">" + maximumLeafDepth); // depends on control dependency: [if], data = [none]
} // if if (depth > maximumLeafDepth ).
if (blackDepth != firstBlackDepth) {
valid = false; // depends on control dependency: [if], data = [none]
printStream.println((indexLabel(entry) + " ").substring(0, 20)
+ " Key=" + entry.getKey() + " Value=" + entry.getValue()
+ " blackDepth=" + blackDepth + " != " + firstBlackDepth); // depends on control dependency: [if], data = [none]
} // if if (depth > maximumLeafDepth ).
}
} // while...
if (numberFound != size())
printStream.println(" Number of Entries found=" + numberFound + " != size()" + size());
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.exit(this,
cclass,
"validate",
new Object[] { new Boolean(valid) });
return valid;
} }
|
public class class_name {
public DevCmdHistory[] command_inout_history_2(final String command, int n) throws DevFailed,
SystemException {
Util.out4.println("Device_2Impl.command_inout_history_2 arrived");
final String cmd_str = command.toLowerCase();
// Record operation request in black box
blackbox.insert_op(Op_Command_inout_history_2);
// Check that device supports this command
check_command_exists(cmd_str);
// Check that the command is polled
PollObj polled_cmd = null;
final Vector poll_list = get_poll_obj_list();
for (int i = 0; i < poll_list.size(); i++) {
final PollObj poll_obj = (PollObj) poll_list.elementAt(i);
if (poll_obj.get_type() == Tango_POLL_CMD && poll_obj.get_name().equals(cmd_str)) {
polled_cmd = poll_obj;
}
}
if (polled_cmd == null) // NOT found
{
Except.throw_exception("API_CmdNotPolled", "Command " + cmd_str + " not polled",
"Device_2Impl.command_inout_history_2");
}
// Check that some data is available in cache
assert polled_cmd != null;
if (polled_cmd.is_ring_empty()) {
Except.throw_exception("API_NoDataYet", "No data available in cache for command "
+ cmd_str, "Device_2Impl.command_inout_history_2");
}
// Set the number of returned records
final int in_buf = polled_cmd.get_elt_nb_in_buffer();
if (n > in_buf) {
n = in_buf;
}
// return command result history
return polled_cmd.get_cmd_history(n);
} }
|
public class class_name {
public DevCmdHistory[] command_inout_history_2(final String command, int n) throws DevFailed,
SystemException {
Util.out4.println("Device_2Impl.command_inout_history_2 arrived");
final String cmd_str = command.toLowerCase();
// Record operation request in black box
blackbox.insert_op(Op_Command_inout_history_2);
// Check that device supports this command
check_command_exists(cmd_str);
// Check that the command is polled
PollObj polled_cmd = null;
final Vector poll_list = get_poll_obj_list();
for (int i = 0; i < poll_list.size(); i++) {
final PollObj poll_obj = (PollObj) poll_list.elementAt(i);
if (poll_obj.get_type() == Tango_POLL_CMD && poll_obj.get_name().equals(cmd_str)) {
polled_cmd = poll_obj; // depends on control dependency: [if], data = [none]
}
}
if (polled_cmd == null) // NOT found
{
Except.throw_exception("API_CmdNotPolled", "Command " + cmd_str + " not polled",
"Device_2Impl.command_inout_history_2");
}
// Check that some data is available in cache
assert polled_cmd != null;
if (polled_cmd.is_ring_empty()) {
Except.throw_exception("API_NoDataYet", "No data available in cache for command "
+ cmd_str, "Device_2Impl.command_inout_history_2");
}
// Set the number of returned records
final int in_buf = polled_cmd.get_elt_nb_in_buffer();
if (n > in_buf) {
n = in_buf;
}
// return command result history
return polled_cmd.get_cmd_history(n);
} }
|
public class class_name {
@Override
public boolean cyclic(int u, int v) {
final int[] colors = vertexColor();
// if either vertex has no color then the edge can not
// be cyclic
if (colors[u] < 0 || colors[v] < 0) return false;
// if the vertex color is 0 it is shared between
// two components (i.e. spiro-rings) we need to
// check each component
if (colors[u] == 0 || colors[v] == 0) {
// either vertices are shared - need to do the expensive check
for (final BitSet cycle : cycles) {
if (cycle.get(u) && cycle.get(v)) return true;
}
return false;
}
// vertex is not shared between components
return colors[u] == colors[v];
} }
|
public class class_name {
@Override
public boolean cyclic(int u, int v) {
final int[] colors = vertexColor();
// if either vertex has no color then the edge can not
// be cyclic
if (colors[u] < 0 || colors[v] < 0) return false;
// if the vertex color is 0 it is shared between
// two components (i.e. spiro-rings) we need to
// check each component
if (colors[u] == 0 || colors[v] == 0) {
// either vertices are shared - need to do the expensive check
for (final BitSet cycle : cycles) {
if (cycle.get(u) && cycle.get(v)) return true;
}
return false; // depends on control dependency: [if], data = [none]
}
// vertex is not shared between components
return colors[u] == colors[v];
} }
|
public class class_name {
public java.util.List<String> getRestorableNodeTypes() {
if (restorableNodeTypes == null) {
restorableNodeTypes = new com.amazonaws.internal.SdkInternalList<String>();
}
return restorableNodeTypes;
} }
|
public class class_name {
public java.util.List<String> getRestorableNodeTypes() {
if (restorableNodeTypes == null) {
restorableNodeTypes = new com.amazonaws.internal.SdkInternalList<String>(); // depends on control dependency: [if], data = [none]
}
return restorableNodeTypes;
} }
|
public class class_name {
public void scan(String source) {
String input = source + "\n%_FEATURE_END_%";
byte[] data = null;
try {
data = input.getBytes("UTF-8");
} catch(UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
int cs, p = 0, pe = data.length;
int eof = pe;
int lineNumber = 1;
int lastNewline = 0;
int contentStart = -1;
int currentLine = -1;
int docstringContentTypeStart = -1;
int docstringContentTypeEnd = -1;
int startCol = -1;
int nextKeywordStart = -1;
int keywordStart = -1;
String keyword = null;
List<String> currentRow = null;
// line 657 "java/src/main/java/gherkin/lexer/Fr.java"
{
cs = lexer_start;
}
// line 185 "ragel/i18n/fr.java.rl"
// line 664 "java/src/main/java/gherkin/lexer/Fr.java"
{
int _klen;
int _trans = 0;
int _acts;
int _nacts;
int _keys;
int _goto_targ = 0;
_goto: while (true) {
switch ( _goto_targ ) {
case 0:
if ( p == pe ) {
_goto_targ = 4;
continue _goto;
}
if ( cs == 0 ) {
_goto_targ = 5;
continue _goto;
}
case 1:
_match: do {
_keys = _lexer_key_offsets[cs];
_trans = _lexer_index_offsets[cs];
_klen = _lexer_single_lengths[cs];
if ( _klen > 0 ) {
int _lower = _keys;
int _mid;
int _upper = _keys + _klen - 1;
while (true) {
if ( _upper < _lower )
break;
_mid = _lower + ((_upper-_lower) >> 1);
if ( data[p] < _lexer_trans_keys[_mid] )
_upper = _mid - 1;
else if ( data[p] > _lexer_trans_keys[_mid] )
_lower = _mid + 1;
else {
_trans += (_mid - _keys);
break _match;
}
}
_keys += _klen;
_trans += _klen;
}
_klen = _lexer_range_lengths[cs];
if ( _klen > 0 ) {
int _lower = _keys;
int _mid;
int _upper = _keys + (_klen<<1) - 2;
while (true) {
if ( _upper < _lower )
break;
_mid = _lower + (((_upper-_lower) >> 1) & ~1);
if ( data[p] < _lexer_trans_keys[_mid] )
_upper = _mid - 2;
else if ( data[p] > _lexer_trans_keys[_mid+1] )
_lower = _mid + 2;
else {
_trans += ((_mid - _keys)>>1);
break _match;
}
}
_trans += _klen;
}
} while (false);
_trans = _lexer_indicies[_trans];
cs = _lexer_trans_targs[_trans];
if ( _lexer_trans_actions[_trans] != 0 ) {
_acts = _lexer_trans_actions[_trans];
_nacts = (int) _lexer_actions[_acts++];
while ( _nacts-- > 0 )
{
switch ( _lexer_actions[_acts++] )
{
case 0:
// line 16 "ragel/i18n/fr.java.rl"
{
contentStart = p;
currentLine = lineNumber;
if(keyword != null) {
startCol = p - lastNewline - (keyword.length() + 1);
}
}
break;
case 1:
// line 24 "ragel/i18n/fr.java.rl"
{
currentLine = lineNumber;
startCol = p - lastNewline;
}
break;
case 2:
// line 29 "ragel/i18n/fr.java.rl"
{
contentStart = p;
}
break;
case 3:
// line 33 "ragel/i18n/fr.java.rl"
{
docstringContentTypeStart = p;
}
break;
case 4:
// line 37 "ragel/i18n/fr.java.rl"
{
docstringContentTypeEnd = p;
}
break;
case 5:
// line 41 "ragel/i18n/fr.java.rl"
{
String con = unindent(startCol, substring(data, contentStart, nextKeywordStart-1).replaceFirst("(\\r?\\n)?([\\t ])*\\Z", "").replace("\\\"\\\"\\\"", "\"\"\""));
String conType = substring(data, docstringContentTypeStart, docstringContentTypeEnd).trim();
listener.docString(conType, con, currentLine);
}
break;
case 6:
// line 47 "ragel/i18n/fr.java.rl"
{
String[] nameDescription = nameAndUnindentedDescription(startCol, keywordContent(data, p, eof, nextKeywordStart, contentStart));
listener.feature(keyword, nameDescription[0], nameDescription[1], currentLine);
if(nextKeywordStart != -1) p = nextKeywordStart - 1;
nextKeywordStart = -1;
}
break;
case 7:
// line 54 "ragel/i18n/fr.java.rl"
{
String[] nameDescription = nameAndUnindentedDescription(startCol, keywordContent(data, p, eof, nextKeywordStart, contentStart));
listener.background(keyword, nameDescription[0], nameDescription[1], currentLine);
if(nextKeywordStart != -1) p = nextKeywordStart - 1;
nextKeywordStart = -1;
}
break;
case 8:
// line 61 "ragel/i18n/fr.java.rl"
{
String[] nameDescription = nameAndUnindentedDescription(startCol, keywordContent(data, p, eof, nextKeywordStart, contentStart));
listener.scenario(keyword, nameDescription[0], nameDescription[1], currentLine);
if(nextKeywordStart != -1) p = nextKeywordStart - 1;
nextKeywordStart = -1;
}
break;
case 9:
// line 68 "ragel/i18n/fr.java.rl"
{
String[] nameDescription = nameAndUnindentedDescription(startCol, keywordContent(data, p, eof, nextKeywordStart, contentStart));
listener.scenarioOutline(keyword, nameDescription[0], nameDescription[1], currentLine);
if(nextKeywordStart != -1) p = nextKeywordStart - 1;
nextKeywordStart = -1;
}
break;
case 10:
// line 75 "ragel/i18n/fr.java.rl"
{
String[] nameDescription = nameAndUnindentedDescription(startCol, keywordContent(data, p, eof, nextKeywordStart, contentStart));
listener.examples(keyword, nameDescription[0], nameDescription[1], currentLine);
if(nextKeywordStart != -1) p = nextKeywordStart - 1;
nextKeywordStart = -1;
}
break;
case 11:
// line 82 "ragel/i18n/fr.java.rl"
{
listener.step(keyword, substring(data, contentStart, p).trim(), currentLine);
}
break;
case 12:
// line 86 "ragel/i18n/fr.java.rl"
{
listener.comment(substring(data, contentStart, p).trim(), lineNumber);
keywordStart = -1;
}
break;
case 13:
// line 91 "ragel/i18n/fr.java.rl"
{
listener.tag(substring(data, contentStart, p).trim(), currentLine);
keywordStart = -1;
}
break;
case 14:
// line 96 "ragel/i18n/fr.java.rl"
{
lineNumber++;
}
break;
case 15:
// line 100 "ragel/i18n/fr.java.rl"
{
lastNewline = p + 1;
}
break;
case 16:
// line 104 "ragel/i18n/fr.java.rl"
{
if(keywordStart == -1) keywordStart = p;
}
break;
case 17:
// line 108 "ragel/i18n/fr.java.rl"
{
keyword = substring(data, keywordStart, p).replaceFirst(":$","");
keywordStart = -1;
}
break;
case 18:
// line 113 "ragel/i18n/fr.java.rl"
{
nextKeywordStart = p;
}
break;
case 19:
// line 117 "ragel/i18n/fr.java.rl"
{
p = p - 1;
currentRow = new ArrayList<String>();
currentLine = lineNumber;
}
break;
case 20:
// line 123 "ragel/i18n/fr.java.rl"
{
contentStart = p;
}
break;
case 21:
// line 127 "ragel/i18n/fr.java.rl"
{
String con = substring(data, contentStart, p).trim();
currentRow.add(con
.replace("\\|", "|")
.replace("\\n", "\n")
.replace("\\\\", "\\")
);
}
break;
case 22:
// line 136 "ragel/i18n/fr.java.rl"
{
listener.row(currentRow, currentLine);
}
break;
case 23:
// line 140 "ragel/i18n/fr.java.rl"
{
if(cs < lexer_first_final) {
String content = currentLineContent(data, lastNewline);
throw new LexingError("Lexing error on line " + lineNumber + ": '" + content + "'. See http://wiki.github.com/cucumber/gherkin/lexingerror for more information.");
} else {
listener.eof();
}
}
break;
// line 925 "java/src/main/java/gherkin/lexer/Fr.java"
}
}
}
case 2:
if ( cs == 0 ) {
_goto_targ = 5;
continue _goto;
}
if ( ++p != pe ) {
_goto_targ = 1;
continue _goto;
}
case 4:
if ( p == eof )
{
int __acts = _lexer_eof_actions[cs];
int __nacts = (int) _lexer_actions[__acts++];
while ( __nacts-- > 0 ) {
switch ( _lexer_actions[__acts++] ) {
case 23:
// line 140 "ragel/i18n/fr.java.rl"
{
if(cs < lexer_first_final) {
String content = currentLineContent(data, lastNewline);
throw new LexingError("Lexing error on line " + lineNumber + ": '" + content + "'. See http://wiki.github.com/cucumber/gherkin/lexingerror for more information.");
} else {
listener.eof();
}
}
break;
// line 957 "java/src/main/java/gherkin/lexer/Fr.java"
}
}
}
case 5:
}
break; }
}
// line 186 "ragel/i18n/fr.java.rl"
} }
|
public class class_name {
public void scan(String source) {
String input = source + "\n%_FEATURE_END_%";
byte[] data = null;
try {
data = input.getBytes("UTF-8"); // depends on control dependency: [try], data = [none]
} catch(UnsupportedEncodingException e) {
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
int cs, p = 0, pe = data.length;
int eof = pe;
int lineNumber = 1;
int lastNewline = 0;
int contentStart = -1;
int currentLine = -1;
int docstringContentTypeStart = -1;
int docstringContentTypeEnd = -1;
int startCol = -1;
int nextKeywordStart = -1;
int keywordStart = -1;
String keyword = null;
List<String> currentRow = null;
// line 657 "java/src/main/java/gherkin/lexer/Fr.java"
{
cs = lexer_start;
}
// line 185 "ragel/i18n/fr.java.rl"
// line 664 "java/src/main/java/gherkin/lexer/Fr.java"
{
int _klen;
int _trans = 0;
int _acts;
int _nacts;
int _keys;
int _goto_targ = 0;
_goto: while (true) {
switch ( _goto_targ ) {
case 0:
if ( p == pe ) {
_goto_targ = 4; // depends on control dependency: [if], data = [none]
continue _goto;
}
if ( cs == 0 ) {
_goto_targ = 5; // depends on control dependency: [if], data = [none]
continue _goto;
}
case 1:
_match: do {
_keys = _lexer_key_offsets[cs];
_trans = _lexer_index_offsets[cs];
_klen = _lexer_single_lengths[cs];
if ( _klen > 0 ) {
int _lower = _keys;
int _mid;
int _upper = _keys + _klen - 1;
while (true) {
if ( _upper < _lower )
break;
_mid = _lower + ((_upper-_lower) >> 1); // depends on control dependency: [while], data = [none]
if ( data[p] < _lexer_trans_keys[_mid] )
_upper = _mid - 1;
else if ( data[p] > _lexer_trans_keys[_mid] )
_lower = _mid + 1;
else {
_trans += (_mid - _keys); // depends on control dependency: [if], data = [none]
break _match;
}
}
_keys += _klen; // depends on control dependency: [if], data = [none]
_trans += _klen; // depends on control dependency: [if], data = [none]
}
_klen = _lexer_range_lengths[cs];
if ( _klen > 0 ) {
int _lower = _keys;
int _mid;
int _upper = _keys + (_klen<<1) - 2;
while (true) {
if ( _upper < _lower )
break;
_mid = _lower + (((_upper-_lower) >> 1) & ~1); // depends on control dependency: [while], data = [none]
if ( data[p] < _lexer_trans_keys[_mid] )
_upper = _mid - 2;
else if ( data[p] > _lexer_trans_keys[_mid+1] )
_lower = _mid + 2;
else {
_trans += ((_mid - _keys)>>1); // depends on control dependency: [if], data = [none]
break _match;
}
}
_trans += _klen; // depends on control dependency: [if], data = [none]
}
} while (false);
_trans = _lexer_indicies[_trans];
cs = _lexer_trans_targs[_trans];
if ( _lexer_trans_actions[_trans] != 0 ) {
_acts = _lexer_trans_actions[_trans]; // depends on control dependency: [if], data = [none]
_nacts = (int) _lexer_actions[_acts++]; // depends on control dependency: [if], data = [none]
while ( _nacts-- > 0 )
{
switch ( _lexer_actions[_acts++] )
{
case 0:
// line 16 "ragel/i18n/fr.java.rl"
{
contentStart = p;
currentLine = lineNumber;
if(keyword != null) {
startCol = p - lastNewline - (keyword.length() + 1); // depends on control dependency: [if], data = [(keyword]
}
}
break;
case 1:
// line 24 "ragel/i18n/fr.java.rl"
{
currentLine = lineNumber;
startCol = p - lastNewline;
}
break;
case 2:
// line 29 "ragel/i18n/fr.java.rl"
{
contentStart = p;
}
break;
case 3:
// line 33 "ragel/i18n/fr.java.rl"
{
docstringContentTypeStart = p;
}
break;
case 4:
// line 37 "ragel/i18n/fr.java.rl"
{
docstringContentTypeEnd = p;
}
break;
case 5:
// line 41 "ragel/i18n/fr.java.rl"
{
String con = unindent(startCol, substring(data, contentStart, nextKeywordStart-1).replaceFirst("(\\r?\\n)?([\\t ])*\\Z", "").replace("\\\"\\\"\\\"", "\"\"\""));
String conType = substring(data, docstringContentTypeStart, docstringContentTypeEnd).trim();
listener.docString(conType, con, currentLine);
}
break;
case 6:
// line 47 "ragel/i18n/fr.java.rl"
{
String[] nameDescription = nameAndUnindentedDescription(startCol, keywordContent(data, p, eof, nextKeywordStart, contentStart));
listener.feature(keyword, nameDescription[0], nameDescription[1], currentLine);
if(nextKeywordStart != -1) p = nextKeywordStart - 1;
nextKeywordStart = -1;
}
break;
case 7:
// line 54 "ragel/i18n/fr.java.rl"
{
String[] nameDescription = nameAndUnindentedDescription(startCol, keywordContent(data, p, eof, nextKeywordStart, contentStart));
listener.background(keyword, nameDescription[0], nameDescription[1], currentLine);
if(nextKeywordStart != -1) p = nextKeywordStart - 1;
nextKeywordStart = -1;
}
break;
case 8:
// line 61 "ragel/i18n/fr.java.rl"
{
String[] nameDescription = nameAndUnindentedDescription(startCol, keywordContent(data, p, eof, nextKeywordStart, contentStart));
listener.scenario(keyword, nameDescription[0], nameDescription[1], currentLine);
if(nextKeywordStart != -1) p = nextKeywordStart - 1;
nextKeywordStart = -1;
}
break;
case 9:
// line 68 "ragel/i18n/fr.java.rl"
{
String[] nameDescription = nameAndUnindentedDescription(startCol, keywordContent(data, p, eof, nextKeywordStart, contentStart));
listener.scenarioOutline(keyword, nameDescription[0], nameDescription[1], currentLine);
if(nextKeywordStart != -1) p = nextKeywordStart - 1;
nextKeywordStart = -1;
}
break;
case 10:
// line 75 "ragel/i18n/fr.java.rl"
{
String[] nameDescription = nameAndUnindentedDescription(startCol, keywordContent(data, p, eof, nextKeywordStart, contentStart));
listener.examples(keyword, nameDescription[0], nameDescription[1], currentLine);
if(nextKeywordStart != -1) p = nextKeywordStart - 1;
nextKeywordStart = -1;
}
break;
case 11:
// line 82 "ragel/i18n/fr.java.rl"
{
listener.step(keyword, substring(data, contentStart, p).trim(), currentLine);
}
break;
case 12:
// line 86 "ragel/i18n/fr.java.rl"
{
listener.comment(substring(data, contentStart, p).trim(), lineNumber);
keywordStart = -1;
}
break;
case 13:
// line 91 "ragel/i18n/fr.java.rl"
{
listener.tag(substring(data, contentStart, p).trim(), currentLine);
keywordStart = -1;
}
break;
case 14:
// line 96 "ragel/i18n/fr.java.rl"
{
lineNumber++;
}
break;
case 15:
// line 100 "ragel/i18n/fr.java.rl"
{
lastNewline = p + 1;
}
break;
case 16:
// line 104 "ragel/i18n/fr.java.rl"
{
if(keywordStart == -1) keywordStart = p;
}
break;
case 17:
// line 108 "ragel/i18n/fr.java.rl"
{
keyword = substring(data, keywordStart, p).replaceFirst(":$","");
keywordStart = -1;
}
break;
case 18:
// line 113 "ragel/i18n/fr.java.rl"
{
nextKeywordStart = p;
}
break;
case 19:
// line 117 "ragel/i18n/fr.java.rl"
{
p = p - 1;
currentRow = new ArrayList<String>();
currentLine = lineNumber;
}
break;
case 20:
// line 123 "ragel/i18n/fr.java.rl"
{
contentStart = p;
}
break;
case 21:
// line 127 "ragel/i18n/fr.java.rl"
{
String con = substring(data, contentStart, p).trim();
currentRow.add(con
.replace("\\|", "|")
.replace("\\n", "\n")
.replace("\\\\", "\\")
);
}
break;
case 22:
// line 136 "ragel/i18n/fr.java.rl"
{
listener.row(currentRow, currentLine);
}
break;
case 23:
// line 140 "ragel/i18n/fr.java.rl"
{
if(cs < lexer_first_final) {
String content = currentLineContent(data, lastNewline);
throw new LexingError("Lexing error on line " + lineNumber + ": '" + content + "'. See http://wiki.github.com/cucumber/gherkin/lexingerror for more information.");
} else { // depends on control dependency: [while], data = [none]
listener.eof();
}
}
break;
// line 925 "java/src/main/java/gherkin/lexer/Fr.java"
}
}
}
case 2:
if ( cs == 0 ) {
_goto_targ = 5; // depends on control dependency: [if], data = [none]
continue _goto;
}
if ( ++p != pe ) {
_goto_targ = 1; // depends on control dependency: [if], data = [none]
continue _goto;
}
case 4:
if ( p == eof )
{
int __acts = _lexer_eof_actions[cs];
int __nacts = (int) _lexer_actions[__acts++];
while ( __nacts-- > 0 ) {
switch ( _lexer_actions[__acts++] ) {
case 23:
// line 140 "ragel/i18n/fr.java.rl"
{
if(cs < lexer_first_final) {
String content = currentLineContent(data, lastNewline);
throw new LexingError("Lexing error on line " + lineNumber + ": '" + content + "'. See http://wiki.github.com/cucumber/gherkin/lexingerror for more information.");
} else { // depends on control dependency: [while], data = [none]
listener.eof();
}
}
break;
// line 957 "java/src/main/java/gherkin/lexer/Fr.java"
}
}
}
case 5:
}
break; }
}
// line 186 "ragel/i18n/fr.java.rl"
} }
|
public class class_name {
@Override
@Nullable
public Path getCloudSdkPath() {
// search system environment PATH
List<String> possiblePaths = getLocationsFromPath(System.getenv("PATH"));
// try environment variable GOOGLE_CLOUD_SDK_HOME
possiblePaths.add(System.getenv("GOOGLE_CLOUD_SDK_HOME"));
// search program files
if (IS_WINDOWS) {
possiblePaths.add(getLocalAppDataLocation());
possiblePaths.add(getProgramFilesLocation());
} else {
// home directory
possiblePaths.add(System.getProperty("user.home") + "/google-cloud-sdk");
// usr directory
possiblePaths.add("/usr/lib/google-cloud-sdk");
// try devshell VM
possiblePaths.add("/google/google-cloud-sdk");
// try bitnami Jenkins VM:
possiblePaths.add("/usr/local/share/google/google-cloud-sdk");
}
Path finalPath = searchPaths(possiblePaths);
logger.log(Level.FINE, "Resolved SDK path : " + finalPath);
return finalPath;
} }
|
public class class_name {
@Override
@Nullable
public Path getCloudSdkPath() {
// search system environment PATH
List<String> possiblePaths = getLocationsFromPath(System.getenv("PATH"));
// try environment variable GOOGLE_CLOUD_SDK_HOME
possiblePaths.add(System.getenv("GOOGLE_CLOUD_SDK_HOME"));
// search program files
if (IS_WINDOWS) {
possiblePaths.add(getLocalAppDataLocation()); // depends on control dependency: [if], data = [none]
possiblePaths.add(getProgramFilesLocation()); // depends on control dependency: [if], data = [none]
} else {
// home directory
possiblePaths.add(System.getProperty("user.home") + "/google-cloud-sdk"); // depends on control dependency: [if], data = [none]
// usr directory
possiblePaths.add("/usr/lib/google-cloud-sdk"); // depends on control dependency: [if], data = [none]
// try devshell VM
possiblePaths.add("/google/google-cloud-sdk"); // depends on control dependency: [if], data = [none]
// try bitnami Jenkins VM:
possiblePaths.add("/usr/local/share/google/google-cloud-sdk"); // depends on control dependency: [if], data = [none]
}
Path finalPath = searchPaths(possiblePaths);
logger.log(Level.FINE, "Resolved SDK path : " + finalPath);
return finalPath;
} }
|
public class class_name {
void printCounters() {
System.out.printf("New Job:\n", counters);
for (String groupName : counters.getGroupNames()) {
Counters.Group group = counters.getGroup(groupName);
System.out.printf("\t%s[%s]\n", groupName, group.getDisplayName());
for (Counters.Counter counter : group) {
System.out.printf("\t\t%s: %s\n", counter.getDisplayName(),
counter.getCounter());
}
}
System.out.printf("\n");
} }
|
public class class_name {
void printCounters() {
System.out.printf("New Job:\n", counters);
for (String groupName : counters.getGroupNames()) {
Counters.Group group = counters.getGroup(groupName);
System.out.printf("\t%s[%s]\n", groupName, group.getDisplayName()); // depends on control dependency: [for], data = [groupName]
for (Counters.Counter counter : group) {
System.out.printf("\t\t%s: %s\n", counter.getDisplayName(),
counter.getCounter()); // depends on control dependency: [for], data = [counter]
}
}
System.out.printf("\n");
} }
|
public class class_name {
private static EntityMetadata loadMetadata(Class<?> entityClass) {
synchronized (entityClass) {
EntityMetadata metadata = cache.get(entityClass);
if (metadata == null) {
EntityIntrospector introspector = new EntityIntrospector(entityClass);
introspector.process();
metadata = introspector.entityMetadata;
cache.put(entityClass, metadata);
}
return metadata;
}
} }
|
public class class_name {
private static EntityMetadata loadMetadata(Class<?> entityClass) {
synchronized (entityClass) {
EntityMetadata metadata = cache.get(entityClass);
if (metadata == null) {
EntityIntrospector introspector = new EntityIntrospector(entityClass);
introspector.process(); // depends on control dependency: [if], data = [none]
metadata = introspector.entityMetadata; // depends on control dependency: [if], data = [none]
cache.put(entityClass, metadata); // depends on control dependency: [if], data = [none]
}
return metadata;
}
} }
|
public class class_name {
private static ValueAnimator loadAnimator(Context context, AttributeSet attrs, ValueAnimator anim)
throws NotFoundException {
TypedArray a =
context.obtainStyledAttributes(attrs, /*com.android.internal.R.styleable.*/Animator);
long duration = a.getInt(/*com.android.internal.R.styleable.*/Animator_duration, 0);
long startDelay = a.getInt(/*com.android.internal.R.styleable.*/Animator_startOffset, 0);
int valueType = a.getInt(/*com.android.internal.R.styleable.*/Animator_valueType,
VALUE_TYPE_FLOAT);
if (anim == null) {
anim = new ValueAnimator();
}
//TypeEvaluator evaluator = null;
int valueFromIndex = /*com.android.internal.R.styleable.*/Animator_valueFrom;
int valueToIndex = /*com.android.internal.R.styleable.*/Animator_valueTo;
boolean getFloats = (valueType == VALUE_TYPE_FLOAT);
TypedValue tvFrom = a.peekValue(valueFromIndex);
boolean hasFrom = (tvFrom != null);
int fromType = hasFrom ? tvFrom.type : 0;
TypedValue tvTo = a.peekValue(valueToIndex);
boolean hasTo = (tvTo != null);
int toType = hasTo ? tvTo.type : 0;
if ((hasFrom && (fromType >= TypedValue.TYPE_FIRST_COLOR_INT) &&
(fromType <= TypedValue.TYPE_LAST_COLOR_INT)) ||
(hasTo && (toType >= TypedValue.TYPE_FIRST_COLOR_INT) &&
(toType <= TypedValue.TYPE_LAST_COLOR_INT))) {
// special case for colors: ignore valueType and get ints
getFloats = false;
anim.setEvaluator(new ArgbEvaluator());
}
if (getFloats) {
float valueFrom;
float valueTo;
if (hasFrom) {
if (fromType == TypedValue.TYPE_DIMENSION) {
valueFrom = a.getDimension(valueFromIndex, 0f);
} else {
valueFrom = a.getFloat(valueFromIndex, 0f);
}
if (hasTo) {
if (toType == TypedValue.TYPE_DIMENSION) {
valueTo = a.getDimension(valueToIndex, 0f);
} else {
valueTo = a.getFloat(valueToIndex, 0f);
}
anim.setFloatValues(valueFrom, valueTo);
} else {
anim.setFloatValues(valueFrom);
}
} else {
if (toType == TypedValue.TYPE_DIMENSION) {
valueTo = a.getDimension(valueToIndex, 0f);
} else {
valueTo = a.getFloat(valueToIndex, 0f);
}
anim.setFloatValues(valueTo);
}
} else {
int valueFrom;
int valueTo;
if (hasFrom) {
if (fromType == TypedValue.TYPE_DIMENSION) {
valueFrom = (int) a.getDimension(valueFromIndex, 0f);
} else if ((fromType >= TypedValue.TYPE_FIRST_COLOR_INT) &&
(fromType <= TypedValue.TYPE_LAST_COLOR_INT)) {
valueFrom = a.getColor(valueFromIndex, 0);
} else {
valueFrom = a.getInt(valueFromIndex, 0);
}
if (hasTo) {
if (toType == TypedValue.TYPE_DIMENSION) {
valueTo = (int) a.getDimension(valueToIndex, 0f);
} else if ((toType >= TypedValue.TYPE_FIRST_COLOR_INT) &&
(toType <= TypedValue.TYPE_LAST_COLOR_INT)) {
valueTo = a.getColor(valueToIndex, 0);
} else {
valueTo = a.getInt(valueToIndex, 0);
}
anim.setIntValues(valueFrom, valueTo);
} else {
anim.setIntValues(valueFrom);
}
} else {
if (hasTo) {
if (toType == TypedValue.TYPE_DIMENSION) {
valueTo = (int) a.getDimension(valueToIndex, 0f);
} else if ((toType >= TypedValue.TYPE_FIRST_COLOR_INT) &&
(toType <= TypedValue.TYPE_LAST_COLOR_INT)) {
valueTo = a.getColor(valueToIndex, 0);
} else {
valueTo = a.getInt(valueToIndex, 0);
}
anim.setIntValues(valueTo);
}
}
}
anim.setDuration(duration);
anim.setStartDelay(startDelay);
if (a.hasValue(/*com.android.internal.R.styleable.*/Animator_repeatCount)) {
anim.setRepeatCount(
a.getInt(/*com.android.internal.R.styleable.*/Animator_repeatCount, 0));
}
if (a.hasValue(/*com.android.internal.R.styleable.*/Animator_repeatMode)) {
anim.setRepeatMode(
a.getInt(/*com.android.internal.R.styleable.*/Animator_repeatMode,
ValueAnimator.RESTART));
}
//if (evaluator != null) {
// anim.setEvaluator(evaluator);
//}
final int resID =
a.getResourceId(/*com.android.internal.R.styleable.*/Animator_interpolator, 0);
if (resID > 0) {
anim.setInterpolator(AnimationUtils.loadInterpolator(context, resID));
}
a.recycle();
return anim;
} }
|
public class class_name {
private static ValueAnimator loadAnimator(Context context, AttributeSet attrs, ValueAnimator anim)
throws NotFoundException {
TypedArray a =
context.obtainStyledAttributes(attrs, /*com.android.internal.R.styleable.*/Animator);
long duration = a.getInt(/*com.android.internal.R.styleable.*/Animator_duration, 0);
long startDelay = a.getInt(/*com.android.internal.R.styleable.*/Animator_startOffset, 0);
int valueType = a.getInt(/*com.android.internal.R.styleable.*/Animator_valueType,
VALUE_TYPE_FLOAT);
if (anim == null) {
anim = new ValueAnimator();
}
//TypeEvaluator evaluator = null;
int valueFromIndex = /*com.android.internal.R.styleable.*/Animator_valueFrom;
int valueToIndex = /*com.android.internal.R.styleable.*/Animator_valueTo;
boolean getFloats = (valueType == VALUE_TYPE_FLOAT);
TypedValue tvFrom = a.peekValue(valueFromIndex);
boolean hasFrom = (tvFrom != null);
int fromType = hasFrom ? tvFrom.type : 0;
TypedValue tvTo = a.peekValue(valueToIndex);
boolean hasTo = (tvTo != null);
int toType = hasTo ? tvTo.type : 0;
if ((hasFrom && (fromType >= TypedValue.TYPE_FIRST_COLOR_INT) &&
(fromType <= TypedValue.TYPE_LAST_COLOR_INT)) ||
(hasTo && (toType >= TypedValue.TYPE_FIRST_COLOR_INT) &&
(toType <= TypedValue.TYPE_LAST_COLOR_INT))) {
// special case for colors: ignore valueType and get ints
getFloats = false;
anim.setEvaluator(new ArgbEvaluator());
}
if (getFloats) {
float valueFrom;
float valueTo;
if (hasFrom) {
if (fromType == TypedValue.TYPE_DIMENSION) {
valueFrom = a.getDimension(valueFromIndex, 0f); // depends on control dependency: [if], data = [none]
} else {
valueFrom = a.getFloat(valueFromIndex, 0f); // depends on control dependency: [if], data = [none]
}
if (hasTo) {
if (toType == TypedValue.TYPE_DIMENSION) {
valueTo = a.getDimension(valueToIndex, 0f); // depends on control dependency: [if], data = [none]
} else {
valueTo = a.getFloat(valueToIndex, 0f); // depends on control dependency: [if], data = [none]
}
anim.setFloatValues(valueFrom, valueTo); // depends on control dependency: [if], data = [none]
} else {
anim.setFloatValues(valueFrom); // depends on control dependency: [if], data = [none]
}
} else {
if (toType == TypedValue.TYPE_DIMENSION) {
valueTo = a.getDimension(valueToIndex, 0f); // depends on control dependency: [if], data = [none]
} else {
valueTo = a.getFloat(valueToIndex, 0f); // depends on control dependency: [if], data = [none]
}
anim.setFloatValues(valueTo); // depends on control dependency: [if], data = [none]
}
} else {
int valueFrom;
int valueTo;
if (hasFrom) {
if (fromType == TypedValue.TYPE_DIMENSION) {
valueFrom = (int) a.getDimension(valueFromIndex, 0f); // depends on control dependency: [if], data = [none]
} else if ((fromType >= TypedValue.TYPE_FIRST_COLOR_INT) &&
(fromType <= TypedValue.TYPE_LAST_COLOR_INT)) {
valueFrom = a.getColor(valueFromIndex, 0); // depends on control dependency: [if], data = [none]
} else {
valueFrom = a.getInt(valueFromIndex, 0); // depends on control dependency: [if], data = [none]
}
if (hasTo) {
if (toType == TypedValue.TYPE_DIMENSION) {
valueTo = (int) a.getDimension(valueToIndex, 0f); // depends on control dependency: [if], data = [none]
} else if ((toType >= TypedValue.TYPE_FIRST_COLOR_INT) &&
(toType <= TypedValue.TYPE_LAST_COLOR_INT)) {
valueTo = a.getColor(valueToIndex, 0); // depends on control dependency: [if], data = [none]
} else {
valueTo = a.getInt(valueToIndex, 0); // depends on control dependency: [if], data = [none]
}
anim.setIntValues(valueFrom, valueTo); // depends on control dependency: [if], data = [none]
} else {
anim.setIntValues(valueFrom); // depends on control dependency: [if], data = [none]
}
} else {
if (hasTo) {
if (toType == TypedValue.TYPE_DIMENSION) {
valueTo = (int) a.getDimension(valueToIndex, 0f); // depends on control dependency: [if], data = [none]
} else if ((toType >= TypedValue.TYPE_FIRST_COLOR_INT) &&
(toType <= TypedValue.TYPE_LAST_COLOR_INT)) {
valueTo = a.getColor(valueToIndex, 0); // depends on control dependency: [if], data = [none]
} else {
valueTo = a.getInt(valueToIndex, 0); // depends on control dependency: [if], data = [none]
}
anim.setIntValues(valueTo); // depends on control dependency: [if], data = [none]
}
}
}
anim.setDuration(duration);
anim.setStartDelay(startDelay);
if (a.hasValue(/*com.android.internal.R.styleable.*/Animator_repeatCount)) {
anim.setRepeatCount(
a.getInt(/*com.android.internal.R.styleable.*/Animator_repeatCount, 0));
}
if (a.hasValue(/*com.android.internal.R.styleable.*/Animator_repeatMode)) {
anim.setRepeatMode(
a.getInt(/*com.android.internal.R.styleable.*/Animator_repeatMode,
ValueAnimator.RESTART));
}
//if (evaluator != null) {
// anim.setEvaluator(evaluator);
//}
final int resID =
a.getResourceId(/*com.android.internal.R.styleable.*/Animator_interpolator, 0);
if (resID > 0) {
anim.setInterpolator(AnimationUtils.loadInterpolator(context, resID));
}
a.recycle();
return anim;
} }
|
public class class_name {
@Override
public double calculateObservedDisagreement() {
ensureDistanceFunction();
double result = 0.0;
double maxDistance = 1.0;
for (ICodingAnnotationItem item : study.getItems()) {
Map<Object, Integer> annotationsPerCategory
= CodingAnnotationStudy.countTotalAnnotationsPerCategory(item);
for (Entry<Object, Integer> category1 : annotationsPerCategory.entrySet())
for (Entry<Object, Integer> category2 : annotationsPerCategory.entrySet()) {
if (category1.getValue() == null)
continue;
if (category2.getValue() == null)
continue;
double distance = distanceFunction.measureDistance(study,
category1.getKey(), category2.getKey());
result += category1.getValue() * category2.getValue()
* distance;
if (distance > maxDistance)
maxDistance = distance;
}
}
result /= (double) (maxDistance * study.getItemCount() * study.getRaterCount()
* (study.getRaterCount() - 1));
return result;
} }
|
public class class_name {
@Override
public double calculateObservedDisagreement() {
ensureDistanceFunction();
double result = 0.0;
double maxDistance = 1.0;
for (ICodingAnnotationItem item : study.getItems()) {
Map<Object, Integer> annotationsPerCategory
= CodingAnnotationStudy.countTotalAnnotationsPerCategory(item);
for (Entry<Object, Integer> category1 : annotationsPerCategory.entrySet())
for (Entry<Object, Integer> category2 : annotationsPerCategory.entrySet()) {
if (category1.getValue() == null)
continue;
if (category2.getValue() == null)
continue;
double distance = distanceFunction.measureDistance(study,
category1.getKey(), category2.getKey());
result += category1.getValue() * category2.getValue()
* distance; // depends on control dependency: [for], data = [none]
if (distance > maxDistance)
maxDistance = distance;
}
}
result /= (double) (maxDistance * study.getItemCount() * study.getRaterCount()
* (study.getRaterCount() - 1));
return result;
} }
|
public class class_name {
private Collection<Directory> collectExistingRoots(final Directory pNewRoot) {
final Path parentPath = pNewRoot.getPath();
final Collection<Directory> pathsToRebase = new LinkedList<>();
dirs.entrySet().forEach(e -> {
final Path childPath = e.getKey();
if (childPath.startsWith(parentPath) && e.getValue().isRoot()) {
pathsToRebase.add(e.getValue());
}
});
return pathsToRebase;
} }
|
public class class_name {
private Collection<Directory> collectExistingRoots(final Directory pNewRoot) {
final Path parentPath = pNewRoot.getPath();
final Collection<Directory> pathsToRebase = new LinkedList<>();
dirs.entrySet().forEach(e -> {
final Path childPath = e.getKey();
if (childPath.startsWith(parentPath) && e.getValue().isRoot()) {
pathsToRebase.add(e.getValue()); // depends on control dependency: [if], data = [none]
}
});
return pathsToRebase;
} }
|
public class class_name {
protected ManagedIndex createIndex( IndexDefinition defn,
String workspaceName,
NodeTypes.Supplier nodeTypesSupplier,
NodeTypePredicate matcher,
IndexFeedback feedback ) {
ManagedIndexBuilder builder = getIndexBuilder(defn, workspaceName, nodeTypesSupplier, matcher);
if (builder == null) {
throw new UnsupportedOperationException("Index providers should either override this method or the #getIndexBuilder method");
}
logger().debug("Index provider '{0}' is creating index in workspace '{1}': {2}", getName(), workspaceName, defn);
ManagedIndex index = builder.build();
if (index.requiresReindexing()) {
scanWorkspace(feedback, defn, workspaceName, index, nodeTypesSupplier);
}
return index;
} }
|
public class class_name {
protected ManagedIndex createIndex( IndexDefinition defn,
String workspaceName,
NodeTypes.Supplier nodeTypesSupplier,
NodeTypePredicate matcher,
IndexFeedback feedback ) {
ManagedIndexBuilder builder = getIndexBuilder(defn, workspaceName, nodeTypesSupplier, matcher);
if (builder == null) {
throw new UnsupportedOperationException("Index providers should either override this method or the #getIndexBuilder method");
}
logger().debug("Index provider '{0}' is creating index in workspace '{1}': {2}", getName(), workspaceName, defn);
ManagedIndex index = builder.build();
if (index.requiresReindexing()) {
scanWorkspace(feedback, defn, workspaceName, index, nodeTypesSupplier); // depends on control dependency: [if], data = [none]
}
return index;
} }
|
public class class_name {
public static boolean specificToDecadeScale(String eventDate) {
boolean result = false;
if (!isEmpty(eventDate)) {
Interval eventDateInterval = extractDateInterval(eventDate);
if (eventDateInterval.toDuration().getStandardDays()<=3650l) {
result = true;
}
}
return result;
} }
|
public class class_name {
public static boolean specificToDecadeScale(String eventDate) {
boolean result = false;
if (!isEmpty(eventDate)) {
Interval eventDateInterval = extractDateInterval(eventDate);
if (eventDateInterval.toDuration().getStandardDays()<=3650l) {
result = true; // depends on control dependency: [if], data = [none]
}
}
return result;
} }
|
public class class_name {
public CallActivityBehavior createCallActivityBehavior(CallActivity callActivity) {
String expressionRegex = "\\$+\\{+.+\\}";
CallActivityBehavior callActivityBehaviour = null;
if (StringUtils.isNotEmpty(callActivity.getCalledElement()) && callActivity.getCalledElement().matches(expressionRegex)) {
callActivityBehaviour = new CallActivityBehavior(expressionManager.createExpression(callActivity.getCalledElement()),
callActivity.getMapExceptions());
} else {
callActivityBehaviour = new CallActivityBehavior(callActivity.getCalledElement(),
callActivity.getMapExceptions());
}
return callActivityBehaviour;
} }
|
public class class_name {
public CallActivityBehavior createCallActivityBehavior(CallActivity callActivity) {
String expressionRegex = "\\$+\\{+.+\\}";
CallActivityBehavior callActivityBehaviour = null;
if (StringUtils.isNotEmpty(callActivity.getCalledElement()) && callActivity.getCalledElement().matches(expressionRegex)) {
callActivityBehaviour = new CallActivityBehavior(expressionManager.createExpression(callActivity.getCalledElement()),
callActivity.getMapExceptions()); // depends on control dependency: [if], data = [none]
} else {
callActivityBehaviour = new CallActivityBehavior(callActivity.getCalledElement(),
callActivity.getMapExceptions()); // depends on control dependency: [if], data = [none]
}
return callActivityBehaviour;
} }
|
public class class_name {
private Map<String, String> filterProps(Map<String, Object> props) {
HashMap<String, String> filteredProps = new HashMap<>();
Iterator<String> it = props.keySet().iterator();
boolean debug = tc.isDebugEnabled() && TraceComponent.isAnyTracingEnabled();
while (it.hasNext()) {
String key = it.next();
String newKey = null;
if (debug) {
Tr.debug(tc, "key: " + key + " value: " + props.get(key));
}
// skip stuff we don't care about
if (propertiesToRemove.contains(key)) {
continue;
}
// convert from shorthand key (timeout) to actual prop name (com.ibm.way.too.long.name.timeout)
// note that this swap is NOT case sensitive.
newKey = key;
if (propsToTranslate.containsKey(key.toLowerCase())) {
newKey = propsToTranslate.get(key.toLowerCase());
if (debug) {
Tr.debug(tc, " translated " + key + " to " + newKey);
}
}
filteredProps.put(newKey, props.get(key).toString());
// special case for authnToken
if (newKey.compareTo("authnToken") == 0) {
String replacementKey = validateAuthn(props.get(key).toString());
if (replacementKey != null) {
filteredProps.remove(newKey);
filteredProps.put(replacementKey, "true");
} else {
filteredProps.remove(newKey); // invalid token type, back it out.
}
}
}
return filteredProps;
} }
|
public class class_name {
private Map<String, String> filterProps(Map<String, Object> props) {
HashMap<String, String> filteredProps = new HashMap<>();
Iterator<String> it = props.keySet().iterator();
boolean debug = tc.isDebugEnabled() && TraceComponent.isAnyTracingEnabled();
while (it.hasNext()) {
String key = it.next();
String newKey = null;
if (debug) {
Tr.debug(tc, "key: " + key + " value: " + props.get(key)); // depends on control dependency: [if], data = [none]
}
// skip stuff we don't care about
if (propertiesToRemove.contains(key)) {
continue;
}
// convert from shorthand key (timeout) to actual prop name (com.ibm.way.too.long.name.timeout)
// note that this swap is NOT case sensitive.
newKey = key; // depends on control dependency: [while], data = [none]
if (propsToTranslate.containsKey(key.toLowerCase())) {
newKey = propsToTranslate.get(key.toLowerCase()); // depends on control dependency: [if], data = [none]
if (debug) {
Tr.debug(tc, " translated " + key + " to " + newKey); // depends on control dependency: [if], data = [none]
}
}
filteredProps.put(newKey, props.get(key).toString()); // depends on control dependency: [while], data = [none]
// special case for authnToken
if (newKey.compareTo("authnToken") == 0) {
String replacementKey = validateAuthn(props.get(key).toString());
if (replacementKey != null) {
filteredProps.remove(newKey); // depends on control dependency: [if], data = [none]
filteredProps.put(replacementKey, "true"); // depends on control dependency: [if], data = [(replacementKey]
} else {
filteredProps.remove(newKey); // invalid token type, back it out. // depends on control dependency: [if], data = [none]
}
}
}
return filteredProps;
} }
|
public class class_name {
public void setCurrentDate(@Nullable CalendarDay day, boolean useSmoothScroll) {
if (day == null) {
return;
}
int index = adapter.getIndexForDay(day);
pager.setCurrentItem(index, useSmoothScroll);
updateUi();
} }
|
public class class_name {
public void setCurrentDate(@Nullable CalendarDay day, boolean useSmoothScroll) {
if (day == null) {
return; // depends on control dependency: [if], data = [none]
}
int index = adapter.getIndexForDay(day);
pager.setCurrentItem(index, useSmoothScroll);
updateUi();
} }
|
public class class_name {
public int getRegisteredResourceRequestCount() {
int count = 0;
for(Entry<K, Queue<AsyncResourceRequest<V>>> entry: this.requestQueueMap.entrySet()) {
// FYI: .size() is not constant time in the next call. ;)
count += entry.getValue().size();
}
return count;
} }
|
public class class_name {
public int getRegisteredResourceRequestCount() {
int count = 0;
for(Entry<K, Queue<AsyncResourceRequest<V>>> entry: this.requestQueueMap.entrySet()) {
// FYI: .size() is not constant time in the next call. ;)
count += entry.getValue().size(); // depends on control dependency: [for], data = [entry]
}
return count;
} }
|
public class class_name {
public final PJsonObject toJSON() {
try {
JSONObject json = new JSONObject();
for (String key: this.obj.keySet()) {
Object opt = opt(key);
if (opt instanceof PYamlObject) {
opt = ((PYamlObject) opt).toJSON().getInternalObj();
} else if (opt instanceof PYamlArray) {
opt = ((PYamlArray) opt).toJSON().getInternalArray();
}
json.put(key, opt);
}
return new PJsonObject(json, this.getContextName());
} catch (Throwable e) {
throw ExceptionUtils.getRuntimeException(e);
}
} }
|
public class class_name {
public final PJsonObject toJSON() {
try {
JSONObject json = new JSONObject();
for (String key: this.obj.keySet()) {
Object opt = opt(key);
if (opt instanceof PYamlObject) {
opt = ((PYamlObject) opt).toJSON().getInternalObj(); // depends on control dependency: [if], data = [none]
} else if (opt instanceof PYamlArray) {
opt = ((PYamlArray) opt).toJSON().getInternalArray(); // depends on control dependency: [if], data = [none]
}
json.put(key, opt); // depends on control dependency: [for], data = [key]
}
return new PJsonObject(json, this.getContextName()); // depends on control dependency: [try], data = [none]
} catch (Throwable e) {
throw ExceptionUtils.getRuntimeException(e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
protected void fillArray(final short[] array) {
int pos = 0;
int base = 0;
for (int k = 0; k < bitmap.length; ++k) {
long bitset = bitmap[k];
while (bitset != 0) {
array[pos++] = (short) (base + numberOfTrailingZeros(bitset));
bitset &= (bitset - 1);
}
base += 64;
}
} }
|
public class class_name {
protected void fillArray(final short[] array) {
int pos = 0;
int base = 0;
for (int k = 0; k < bitmap.length; ++k) {
long bitset = bitmap[k];
while (bitset != 0) {
array[pos++] = (short) (base + numberOfTrailingZeros(bitset)); // depends on control dependency: [while], data = [(bitset]
bitset &= (bitset - 1); // depends on control dependency: [while], data = [(bitset]
}
base += 64; // depends on control dependency: [for], data = [none]
}
} }
|
public class class_name {
public void marshall(TrustedAdvisorResourcesSummary trustedAdvisorResourcesSummary, ProtocolMarshaller protocolMarshaller) {
if (trustedAdvisorResourcesSummary == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(trustedAdvisorResourcesSummary.getResourcesProcessed(), RESOURCESPROCESSED_BINDING);
protocolMarshaller.marshall(trustedAdvisorResourcesSummary.getResourcesFlagged(), RESOURCESFLAGGED_BINDING);
protocolMarshaller.marshall(trustedAdvisorResourcesSummary.getResourcesIgnored(), RESOURCESIGNORED_BINDING);
protocolMarshaller.marshall(trustedAdvisorResourcesSummary.getResourcesSuppressed(), RESOURCESSUPPRESSED_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(TrustedAdvisorResourcesSummary trustedAdvisorResourcesSummary, ProtocolMarshaller protocolMarshaller) {
if (trustedAdvisorResourcesSummary == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(trustedAdvisorResourcesSummary.getResourcesProcessed(), RESOURCESPROCESSED_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(trustedAdvisorResourcesSummary.getResourcesFlagged(), RESOURCESFLAGGED_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(trustedAdvisorResourcesSummary.getResourcesIgnored(), RESOURCESIGNORED_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(trustedAdvisorResourcesSummary.getResourcesSuppressed(), RESOURCESSUPPRESSED_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public static Resource temporaryDirectory() {
File tempDir = new File(SystemInfo.JAVA_IO_TMPDIR);
String baseName = System.currentTimeMillis() + "-";
for (int i = 0; i < 1_000_000; i++) {
File tmp = new File(tempDir, baseName + i);
if (tmp.mkdir()) {
return new FileResource(tmp);
}
}
throw new RuntimeException("Unable to create temp directory");
} }
|
public class class_name {
public static Resource temporaryDirectory() {
File tempDir = new File(SystemInfo.JAVA_IO_TMPDIR);
String baseName = System.currentTimeMillis() + "-";
for (int i = 0; i < 1_000_000; i++) {
File tmp = new File(tempDir, baseName + i);
if (tmp.mkdir()) {
return new FileResource(tmp); // depends on control dependency: [if], data = [none]
}
}
throw new RuntimeException("Unable to create temp directory");
} }
|
public class class_name {
public static UUID uuid() {
@javax.annotation.Nonnull String index = Integer.toHexString(com.simiacryptus.util.Util.idcounter.incrementAndGet());
while (index.length() < 8) {
index = "0" + index;
}
@javax.annotation.Nonnull final String tempId = com.simiacryptus.util.Util.jvmId.substring(0, com.simiacryptus.util.Util.jvmId.length() - index.length()) + index;
return UUID.fromString(tempId);
} }
|
public class class_name {
public static UUID uuid() {
@javax.annotation.Nonnull String index = Integer.toHexString(com.simiacryptus.util.Util.idcounter.incrementAndGet());
while (index.length() < 8) {
index = "0" + index; // depends on control dependency: [while], data = [none]
}
@javax.annotation.Nonnull final String tempId = com.simiacryptus.util.Util.jvmId.substring(0, com.simiacryptus.util.Util.jvmId.length() - index.length()) + index;
return UUID.fromString(tempId);
} }
|
public class class_name {
public void marshall(PropertyNameSuggestion propertyNameSuggestion, ProtocolMarshaller protocolMarshaller) {
if (propertyNameSuggestion == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(propertyNameSuggestion.getPropertyName(), PROPERTYNAME_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(PropertyNameSuggestion propertyNameSuggestion, ProtocolMarshaller protocolMarshaller) {
if (propertyNameSuggestion == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(propertyNameSuggestion.getPropertyName(), PROPERTYNAME_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public void setSpotInstanceRequests(java.util.Collection<SpotInstanceRequest> spotInstanceRequests) {
if (spotInstanceRequests == null) {
this.spotInstanceRequests = null;
return;
}
this.spotInstanceRequests = new com.amazonaws.internal.SdkInternalList<SpotInstanceRequest>(spotInstanceRequests);
} }
|
public class class_name {
public void setSpotInstanceRequests(java.util.Collection<SpotInstanceRequest> spotInstanceRequests) {
if (spotInstanceRequests == null) {
this.spotInstanceRequests = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.spotInstanceRequests = new com.amazonaws.internal.SdkInternalList<SpotInstanceRequest>(spotInstanceRequests);
} }
|
public class class_name {
private int pruneHeadTasks(Predicate<ReceiveMessageBatchTask> pruneCondition) {
int numberPruned = 0;
while (!finishedTasks.isEmpty()) {
if (pruneCondition.test(finishedTasks.getFirst())) {
finishedTasks.removeFirst();
numberPruned++;
} else {
break;
}
}
return numberPruned;
} }
|
public class class_name {
private int pruneHeadTasks(Predicate<ReceiveMessageBatchTask> pruneCondition) {
int numberPruned = 0;
while (!finishedTasks.isEmpty()) {
if (pruneCondition.test(finishedTasks.getFirst())) {
finishedTasks.removeFirst(); // depends on control dependency: [if], data = [none]
numberPruned++; // depends on control dependency: [if], data = [none]
} else {
break;
}
}
return numberPruned;
} }
|
public class class_name {
@Override
public InStore openRead(long address, int size)
{
if (fileSize() < address + size) {
throw new IllegalStateException(L.l("{0} read open for length {1}:{2} but file length {3}",
this, address, size, fileSize()));
}
if (_isClosed.get()) {
throw new IllegalStateException(L.l("{0} is closed.", this));
}
if (_fileSize < address + size) {
throw new IllegalStateException(L.l("Open read of large file {0}:{1}",
Long.toHexString(address), size));
}
try {
streamOpen(address, size);
return openReadImpl(address, size);
} catch (IOException e) {
throw new RuntimeException(e);
}
} }
|
public class class_name {
@Override
public InStore openRead(long address, int size)
{
if (fileSize() < address + size) {
throw new IllegalStateException(L.l("{0} read open for length {1}:{2} but file length {3}",
this, address, size, fileSize()));
}
if (_isClosed.get()) {
throw new IllegalStateException(L.l("{0} is closed.", this));
}
if (_fileSize < address + size) {
throw new IllegalStateException(L.l("Open read of large file {0}:{1}",
Long.toHexString(address), size));
}
try {
streamOpen(address, size); // depends on control dependency: [try], data = [none]
return openReadImpl(address, size); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public final void contains(@NullableDecl Object element) {
if (!Iterables.contains(actual(), element)) {
List<Object> elementList = newArrayList(element);
if (hasMatchingToStringPair(actual(), elementList)) {
failWithoutActual(
fact("expected to contain", element),
fact("an instance of", objectToTypeName(element)),
simpleFact("but did not"),
fact(
"though it did contain",
countDuplicatesAndAddTypeInfo(
retainMatchingToString(actual(), elementList /* itemsToCheck */))),
fullContents());
} else {
failWithActual("expected to contain", element);
}
}
} }
|
public class class_name {
public final void contains(@NullableDecl Object element) {
if (!Iterables.contains(actual(), element)) {
List<Object> elementList = newArrayList(element);
if (hasMatchingToStringPair(actual(), elementList)) {
failWithoutActual(
fact("expected to contain", element),
fact("an instance of", objectToTypeName(element)),
simpleFact("but did not"),
fact(
"though it did contain",
countDuplicatesAndAddTypeInfo(
retainMatchingToString(actual(), elementList /* itemsToCheck */))),
fullContents()); // depends on control dependency: [if], data = [none]
} else {
failWithActual("expected to contain", element); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
private void initialize(Map<String, Object> metadata) {
if (metadata == null) {
metadata = new HashMap<String, Object>();
}
metadata.put(REQUEST_ID, generateRequestID());
this.metadata = metadata;
} }
|
public class class_name {
private void initialize(Map<String, Object> metadata) {
if (metadata == null) {
metadata = new HashMap<String, Object>(); // depends on control dependency: [if], data = [none]
}
metadata.put(REQUEST_ID, generateRequestID());
this.metadata = metadata;
} }
|
public class class_name {
public boolean onSupportNavigateUp() {
Intent upIntent = getSupportParentActivityIntent();
if (upIntent != null) {
if (supportShouldUpRecreateTask(upIntent)) {
TaskStackBuilder b = TaskStackBuilder.create(this);
onCreateSupportNavigateUpTaskStack(b);
onPrepareSupportNavigateUpTaskStack(b);
b.startActivities();
try {
ActivityCompat.finishAffinity(this);
} catch (IllegalStateException e) {
// This can only happen on 4.1+, when we don't have a parent or a result set.
// In that case we should just finish().
finish();
}
} else {
// This activity is part of the application's task, so simply
// navigate up to the hierarchical parent activity.
supportNavigateUpTo(upIntent);
}
return true;
}
return false;
} }
|
public class class_name {
public boolean onSupportNavigateUp() {
Intent upIntent = getSupportParentActivityIntent();
if (upIntent != null) {
if (supportShouldUpRecreateTask(upIntent)) {
TaskStackBuilder b = TaskStackBuilder.create(this);
onCreateSupportNavigateUpTaskStack(b); // depends on control dependency: [if], data = [none]
onPrepareSupportNavigateUpTaskStack(b); // depends on control dependency: [if], data = [none]
b.startActivities(); // depends on control dependency: [if], data = [none]
try {
ActivityCompat.finishAffinity(this); // depends on control dependency: [try], data = [none]
} catch (IllegalStateException e) {
// This can only happen on 4.1+, when we don't have a parent or a result set.
// In that case we should just finish().
finish();
} // depends on control dependency: [catch], data = [none]
} else {
// This activity is part of the application's task, so simply
// navigate up to the hierarchical parent activity.
supportNavigateUpTo(upIntent); // depends on control dependency: [if], data = [none]
}
return true; // depends on control dependency: [if], data = [none]
}
return false;
} }
|
public class class_name {
public static void setupCellStyle(final Workbook wb,
final FacesCell fcell, final Cell poiCell,
final float rowHeight) {
CellStyle cellStyle = poiCell.getCellStyle();
if ((cellStyle != null) && (!cellStyle.getLocked())) {
// not locked
if (fcell.getInputType().isEmpty()) {
fcell.setInputType(
CellStyleUtility.getInputTypeFromCellType(poiCell));
}
if (fcell.getControl().isEmpty()
&& (!fcell.getInputType().isEmpty())) {
fcell.setControl("text");
}
setInputStyleBaseOnInputType(fcell, poiCell);
}
String webStyle = getCellStyle(wb, poiCell, fcell.getInputType())
+ getCellFontStyle(wb, poiCell)
+ getRowStyle(wb, poiCell, fcell.getInputType(), rowHeight,
fcell.getRowspan());
fcell.setStyle(webStyle);
fcell.setColumnStyle(getColumnStyle(wb, fcell, poiCell, rowHeight));
} }
|
public class class_name {
public static void setupCellStyle(final Workbook wb,
final FacesCell fcell, final Cell poiCell,
final float rowHeight) {
CellStyle cellStyle = poiCell.getCellStyle();
if ((cellStyle != null) && (!cellStyle.getLocked())) {
// not locked
if (fcell.getInputType().isEmpty()) {
fcell.setInputType(
CellStyleUtility.getInputTypeFromCellType(poiCell));
// depends on control dependency: [if], data = [none]
}
if (fcell.getControl().isEmpty()
&& (!fcell.getInputType().isEmpty())) {
fcell.setControl("text");
// depends on control dependency: [if], data = [none]
}
setInputStyleBaseOnInputType(fcell, poiCell);
// depends on control dependency: [if], data = [none]
}
String webStyle = getCellStyle(wb, poiCell, fcell.getInputType())
+ getCellFontStyle(wb, poiCell)
+ getRowStyle(wb, poiCell, fcell.getInputType(), rowHeight,
fcell.getRowspan());
fcell.setStyle(webStyle);
fcell.setColumnStyle(getColumnStyle(wb, fcell, poiCell, rowHeight));
} }
|
public class class_name {
private short newsub(short co) throws RegexException {
short sco; // new subcolor.
ColorDesc cd = colorDescs.get(co);
sco = colorDescs.get(co).sub;
if (sco == Constants.NOSUB) { /* color has no open subcolor */
if (cd.getNChars() == 1) { /* optimization */
return co;
}
sco = newcolor(); /* must create subcolor */
if (sco == Constants.COLORLESS) {
throw new RegexException("Invalid color allocation");
}
ColorDesc subcd = colorDescs.get(sco);
cd.sub = sco;
subcd.sub = sco; /* open subcolor points to self */
}
return sco;
} }
|
public class class_name {
private short newsub(short co) throws RegexException {
short sco; // new subcolor.
ColorDesc cd = colorDescs.get(co);
sco = colorDescs.get(co).sub;
if (sco == Constants.NOSUB) { /* color has no open subcolor */
if (cd.getNChars() == 1) { /* optimization */
return co; // depends on control dependency: [if], data = [none]
}
sco = newcolor(); /* must create subcolor */
if (sco == Constants.COLORLESS) {
throw new RegexException("Invalid color allocation");
}
ColorDesc subcd = colorDescs.get(sco);
cd.sub = sco;
subcd.sub = sco; /* open subcolor points to self */
}
return sco;
} }
|
public class class_name {
public AnimaQuery<T> in(String column, Object... args) {
if (null == args || args.length == 0) {
log.warn("Column: {}, query params is empty.");
return this;
}
conditionSQL.append(" AND ").append(column).append(" IN (");
this.setArguments(args);
conditionSQL.append(")");
return this;
} }
|
public class class_name {
public AnimaQuery<T> in(String column, Object... args) {
if (null == args || args.length == 0) {
log.warn("Column: {}, query params is empty."); // depends on control dependency: [if], data = [none]
return this; // depends on control dependency: [if], data = [none]
}
conditionSQL.append(" AND ").append(column).append(" IN (");
this.setArguments(args);
conditionSQL.append(")");
return this;
} }
|
public class class_name {
public static boolean matches(Matcher<?> matcher, Object item, Description mismatch, String message) {
if (mismatch instanceof Description.NullDescription) {
return matcher.matches(item);
} else if (message == null || message.equals("$1")) {
return matches(matcher, item, mismatch);
}
if (message.contains("$1")) {
final Description subMismatch = new StringDescription();
if (!matches(matcher, item, subMismatch)) {
mismatch.appendText(message.replace("$1", subMismatch.toString()));
return false;
}
} else {
if (!matcher.matches(item)) {
mismatch.appendText(message);
return false;
}
}
return true;
} }
|
public class class_name {
public static boolean matches(Matcher<?> matcher, Object item, Description mismatch, String message) {
if (mismatch instanceof Description.NullDescription) {
return matcher.matches(item);
// depends on control dependency: [if], data = [none]
} else if (message == null || message.equals("$1")) {
return matches(matcher, item, mismatch);
// depends on control dependency: [if], data = [none]
}
if (message.contains("$1")) {
final Description subMismatch = new StringDescription();
if (!matches(matcher, item, subMismatch)) {
mismatch.appendText(message.replace("$1", subMismatch.toString()));
// depends on control dependency: [if], data = [none]
return false;
// depends on control dependency: [if], data = [none]
}
} else {
if (!matcher.matches(item)) {
mismatch.appendText(message);
// depends on control dependency: [if], data = [none]
return false;
// depends on control dependency: [if], data = [none]
}
}
return true;
} }
|
public class class_name {
public void clip(final long pX0, final long pY0, final long pX1, final long pY1) {
if (!mPathMode) {
if (isOnTheSameSideOut(pX0, pY0, pX1, pY1)) {
return;
}
}
if (isInClipArea(pX0, pY0)) {
if (isInClipArea(pX1, pY1)) {
nextVertex(pX0, pY0);
nextVertex(pX1, pY1);
return;
}
if (intersection(pX0, pY0, pX1, pY1)) {
nextVertex(pX0, pY0);
nextVertex(mOptimIntersection.x, mOptimIntersection.y);
if (mPathMode) {
nextVertex(clipX(pX1), clipY(pY1));
}
return;
}
throw new RuntimeException("Cannot find expected mOptimIntersection for " + new RectL(pX0, pY0, pX1, pY1));
}
if (isInClipArea(pX1, pY1)) {
if (intersection(pX0, pY0, pX1, pY1)) {
if (mPathMode) {
nextVertex(clipX(pX0), clipY(pY0));
}
nextVertex(mOptimIntersection.x, mOptimIntersection.y);
nextVertex(pX1, pY1);
return;
}
throw new RuntimeException("Cannot find expected mOptimIntersection for " + new RectL(pX0, pY0, pX1, pY1));
}
// no point is on the screen
int count = 0;
if (intersection(pX0, pY0, pX1, pY1, mXMin, mYMin, mXMin, mYMax)) { // x mClipMin segment
final PointL point = count ++ == 0 ? mOptimIntersection1 : mOptimIntersection2;
point.set(mOptimIntersection);
}
if (intersection(pX0, pY0, pX1, pY1, mXMax, mYMin, mXMax, mYMax)) { // x mClipMax segment
final PointL point = count ++ == 0 ? mOptimIntersection1 : mOptimIntersection2;
point.set(mOptimIntersection);
}
if (intersection(pX0, pY0, pX1, pY1, mXMin, mYMin, mXMax, mYMin)) { // y mClipMin segment
final PointL point = count ++ == 0 ? mOptimIntersection1 : mOptimIntersection2;
point.set(mOptimIntersection);
}
if (intersection(pX0, pY0, pX1, pY1, mXMin, mYMax, mXMax, mYMax)) { // y mClipMax segment
final PointL point = count ++ == 0 ? mOptimIntersection1 : mOptimIntersection2;
point.set(mOptimIntersection);
}
if (count == 2) {
final double distance1 = Distance.getSquaredDistanceToPoint(
mOptimIntersection1.x, mOptimIntersection1.y, pX0, pY0);
final double distance2 = Distance.getSquaredDistanceToPoint(
mOptimIntersection2.x, mOptimIntersection2.y, pX0, pY0);
final PointL start = distance1 < distance2 ? mOptimIntersection1 : mOptimIntersection2;
final PointL end = distance1 < distance2 ? mOptimIntersection2 : mOptimIntersection1;
if (mPathMode) {
nextVertex(clipX(pX0), clipY(pY0));
}
nextVertex(start.x, start.y);
nextVertex(end.x, end.y);
if (mPathMode) {
nextVertex(clipX(pX1), clipY(pY1));
}
return;
}
if (count == 1) {
if (mPathMode) {
nextVertex(clipX(pX0), clipY(pY0));
nextVertex(mOptimIntersection1.x, mOptimIntersection1.y);
nextVertex(clipX(pX1), clipY(pY1));
}
return;
}
if (count == 0) {
if (mPathMode) {
nextVertex(clipX(pX0), clipY(pY0));
final int corner = getClosestCorner(pX0, pY0, pX1, pY1);
nextVertex(cornerX[corner], cornerY[corner]);
nextVertex(clipX(pX1), clipY(pY1));
}
return;
}
throw new RuntimeException("Impossible mOptimIntersection count (" + count + ")");
} }
|
public class class_name {
public void clip(final long pX0, final long pY0, final long pX1, final long pY1) {
if (!mPathMode) {
if (isOnTheSameSideOut(pX0, pY0, pX1, pY1)) {
return; // depends on control dependency: [if], data = [none]
}
}
if (isInClipArea(pX0, pY0)) {
if (isInClipArea(pX1, pY1)) {
nextVertex(pX0, pY0); // depends on control dependency: [if], data = [none]
nextVertex(pX1, pY1); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
if (intersection(pX0, pY0, pX1, pY1)) {
nextVertex(pX0, pY0); // depends on control dependency: [if], data = [none]
nextVertex(mOptimIntersection.x, mOptimIntersection.y); // depends on control dependency: [if], data = [none]
if (mPathMode) {
nextVertex(clipX(pX1), clipY(pY1)); // depends on control dependency: [if], data = [none]
}
return; // depends on control dependency: [if], data = [none]
}
throw new RuntimeException("Cannot find expected mOptimIntersection for " + new RectL(pX0, pY0, pX1, pY1));
}
if (isInClipArea(pX1, pY1)) {
if (intersection(pX0, pY0, pX1, pY1)) {
if (mPathMode) {
nextVertex(clipX(pX0), clipY(pY0)); // depends on control dependency: [if], data = [none]
}
nextVertex(mOptimIntersection.x, mOptimIntersection.y); // depends on control dependency: [if], data = [none]
nextVertex(pX1, pY1); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
throw new RuntimeException("Cannot find expected mOptimIntersection for " + new RectL(pX0, pY0, pX1, pY1));
}
// no point is on the screen
int count = 0;
if (intersection(pX0, pY0, pX1, pY1, mXMin, mYMin, mXMin, mYMax)) { // x mClipMin segment
final PointL point = count ++ == 0 ? mOptimIntersection1 : mOptimIntersection2;
point.set(mOptimIntersection); // depends on control dependency: [if], data = [none]
}
if (intersection(pX0, pY0, pX1, pY1, mXMax, mYMin, mXMax, mYMax)) { // x mClipMax segment
final PointL point = count ++ == 0 ? mOptimIntersection1 : mOptimIntersection2;
point.set(mOptimIntersection); // depends on control dependency: [if], data = [none]
}
if (intersection(pX0, pY0, pX1, pY1, mXMin, mYMin, mXMax, mYMin)) { // y mClipMin segment
final PointL point = count ++ == 0 ? mOptimIntersection1 : mOptimIntersection2;
point.set(mOptimIntersection); // depends on control dependency: [if], data = [none]
}
if (intersection(pX0, pY0, pX1, pY1, mXMin, mYMax, mXMax, mYMax)) { // y mClipMax segment
final PointL point = count ++ == 0 ? mOptimIntersection1 : mOptimIntersection2;
point.set(mOptimIntersection); // depends on control dependency: [if], data = [none]
}
if (count == 2) {
final double distance1 = Distance.getSquaredDistanceToPoint(
mOptimIntersection1.x, mOptimIntersection1.y, pX0, pY0);
final double distance2 = Distance.getSquaredDistanceToPoint(
mOptimIntersection2.x, mOptimIntersection2.y, pX0, pY0);
final PointL start = distance1 < distance2 ? mOptimIntersection1 : mOptimIntersection2;
final PointL end = distance1 < distance2 ? mOptimIntersection2 : mOptimIntersection1;
if (mPathMode) {
nextVertex(clipX(pX0), clipY(pY0)); // depends on control dependency: [if], data = [none]
}
nextVertex(start.x, start.y); // depends on control dependency: [if], data = [none]
nextVertex(end.x, end.y); // depends on control dependency: [if], data = [none]
if (mPathMode) {
nextVertex(clipX(pX1), clipY(pY1)); // depends on control dependency: [if], data = [none]
}
return; // depends on control dependency: [if], data = [none]
}
if (count == 1) {
if (mPathMode) {
nextVertex(clipX(pX0), clipY(pY0)); // depends on control dependency: [if], data = [none]
nextVertex(mOptimIntersection1.x, mOptimIntersection1.y); // depends on control dependency: [if], data = [none]
nextVertex(clipX(pX1), clipY(pY1)); // depends on control dependency: [if], data = [none]
}
return; // depends on control dependency: [if], data = [none]
}
if (count == 0) {
if (mPathMode) {
nextVertex(clipX(pX0), clipY(pY0)); // depends on control dependency: [if], data = [none]
final int corner = getClosestCorner(pX0, pY0, pX1, pY1);
nextVertex(cornerX[corner], cornerY[corner]); // depends on control dependency: [if], data = [none]
nextVertex(clipX(pX1), clipY(pY1)); // depends on control dependency: [if], data = [none]
}
return; // depends on control dependency: [if], data = [none]
}
throw new RuntimeException("Impossible mOptimIntersection count (" + count + ")");
} }
|
public class class_name {
public boolean isImmutable(Class<?> clazz) {
if (clazz.isPrimitive() || clazz.isEnum()) {
return false;
}
if (clazz.isArray()) {
return false;
}
final IsImmutable isImmutable;
if (DETECTED_IMMUTABLE_CLASSES.containsKey(clazz)) {
isImmutable = DETECTED_IMMUTABLE_CLASSES.get(clazz);
} else {
Dotted dottedClassName = Dotted.fromClass(clazz);
isImmutable = ANALYSIS_SESSION.get().resultFor(dottedClassName).isImmutable;
DETECTED_IMMUTABLE_CLASSES.put(clazz, isImmutable);
}
if (isImmutable.equals(IsImmutable.IMMUTABLE) || isImmutable.equals(IsImmutable.EFFECTIVELY_IMMUTABLE)) {
return true;
} else {
return false;
}
} }
|
public class class_name {
public boolean isImmutable(Class<?> clazz) {
if (clazz.isPrimitive() || clazz.isEnum()) {
return false; // depends on control dependency: [if], data = [none]
}
if (clazz.isArray()) {
return false; // depends on control dependency: [if], data = [none]
}
final IsImmutable isImmutable;
if (DETECTED_IMMUTABLE_CLASSES.containsKey(clazz)) {
isImmutable = DETECTED_IMMUTABLE_CLASSES.get(clazz); // depends on control dependency: [if], data = [none]
} else {
Dotted dottedClassName = Dotted.fromClass(clazz);
isImmutable = ANALYSIS_SESSION.get().resultFor(dottedClassName).isImmutable; // depends on control dependency: [if], data = [none]
DETECTED_IMMUTABLE_CLASSES.put(clazz, isImmutable); // depends on control dependency: [if], data = [none]
}
if (isImmutable.equals(IsImmutable.IMMUTABLE) || isImmutable.equals(IsImmutable.EFFECTIVELY_IMMUTABLE)) {
return true; // depends on control dependency: [if], data = [none]
} else {
return false; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public TypeElement getObjcClass(TypeMirror t) {
if (isArray(t)) {
return getIosArray(((ArrayType) t).getComponentType());
} else if (isDeclaredType(t)) {
return getObjcClass((TypeElement) ((DeclaredType) t).asElement());
}
return null;
} }
|
public class class_name {
public TypeElement getObjcClass(TypeMirror t) {
if (isArray(t)) {
return getIosArray(((ArrayType) t).getComponentType()); // depends on control dependency: [if], data = [none]
} else if (isDeclaredType(t)) {
return getObjcClass((TypeElement) ((DeclaredType) t).asElement()); // depends on control dependency: [if], data = [none]
}
return null;
} }
|
public class class_name {
public EEnum getSTOBORNTION() {
if (stoborntionEEnum == null) {
stoborntionEEnum = (EEnum)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(73);
}
return stoborntionEEnum;
} }
|
public class class_name {
public EEnum getSTOBORNTION() {
if (stoborntionEEnum == null) {
stoborntionEEnum = (EEnum)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(73); // depends on control dependency: [if], data = [none]
}
return stoborntionEEnum;
} }
|
public class class_name {
public static int getLocalTID(TransactionImpl tran)
{
if (tc.isEntryEnabled()) Tr.entry(tc, "getLocalTID", tran);
int id;
while (true)
{
// Capture the current seed value. Do another increment
// and shift by the difference of current seed. Due to
// randomness of thread access and Java memory model, this
// will improve the key space to reduce collisions. Using
// this approach to avoid using Thread.currentThread() or
// a ThreadLocal variable.
final int currSeed = _baseSeed++;
id = (++_baseSeed << (_baseSeed - currSeed)) & 0x7FFFFFFF;
// Conditionally add the new local tid to the map
// associating it with the given transaction.
// This has been modified to use non-optimistic putIfAbsent()
// to address a race condition if put() is used on its own.
if (id > 0 && localTIDMap.putIfAbsent(id, tran) == null)
{
// We're done
break;
}
// If there is a clash, generate a new local TID until
// we find one that is free.
}
if (tc.isEntryEnabled()) Tr.exit(tc, "getLocalTID", id);
return id;
} }
|
public class class_name {
public static int getLocalTID(TransactionImpl tran)
{
if (tc.isEntryEnabled()) Tr.entry(tc, "getLocalTID", tran);
int id;
while (true)
{
// Capture the current seed value. Do another increment
// and shift by the difference of current seed. Due to
// randomness of thread access and Java memory model, this
// will improve the key space to reduce collisions. Using
// this approach to avoid using Thread.currentThread() or
// a ThreadLocal variable.
final int currSeed = _baseSeed++;
id = (++_baseSeed << (_baseSeed - currSeed)) & 0x7FFFFFFF; // depends on control dependency: [while], data = [none]
// Conditionally add the new local tid to the map
// associating it with the given transaction.
// This has been modified to use non-optimistic putIfAbsent()
// to address a race condition if put() is used on its own.
if (id > 0 && localTIDMap.putIfAbsent(id, tran) == null)
{
// We're done
break;
}
// If there is a clash, generate a new local TID until
// we find one that is free.
}
if (tc.isEntryEnabled()) Tr.exit(tc, "getLocalTID", id);
return id;
} }
|
public class class_name {
@Override
public ManagedChannel shutdownNow() {
for (ManagedChannel channel : channels) {
if (!channel.isTerminated()) {
channel.shutdownNow();
}
}
return this;
} }
|
public class class_name {
@Override
public ManagedChannel shutdownNow() {
for (ManagedChannel channel : channels) {
if (!channel.isTerminated()) {
channel.shutdownNow(); // depends on control dependency: [if], data = [none]
}
}
return this;
} }
|
public class class_name {
private void buildOrderBy(final StringBuilder orderByBuilder, final Map<String, SortDirection> sorts) {
boolean isFirst = true;
String querySortDirection;
for (final Map.Entry<String, SortDirection> sort : sorts.entrySet()) {
if (isFirst) {
orderByBuilder.append(" ORDER BY ");
isFirst = false;
} else {
orderByBuilder.append(", ");
}
if (sort.getValue().equals(SortDirection.ASCENDING)) {
querySortDirection = "ASC";
} else {
querySortDirection = "DESC";
}
orderByBuilder.append(sort.getKey()).append(" ").append(querySortDirection);
}
} }
|
public class class_name {
private void buildOrderBy(final StringBuilder orderByBuilder, final Map<String, SortDirection> sorts) {
boolean isFirst = true;
String querySortDirection;
for (final Map.Entry<String, SortDirection> sort : sorts.entrySet()) {
if (isFirst) {
orderByBuilder.append(" ORDER BY "); // depends on control dependency: [if], data = [none]
isFirst = false; // depends on control dependency: [if], data = [none]
} else {
orderByBuilder.append(", "); // depends on control dependency: [if], data = [none]
}
if (sort.getValue().equals(SortDirection.ASCENDING)) {
querySortDirection = "ASC"; // depends on control dependency: [if], data = [none]
} else {
querySortDirection = "DESC"; // depends on control dependency: [if], data = [none]
}
orderByBuilder.append(sort.getKey()).append(" ").append(querySortDirection); // depends on control dependency: [for], data = [sort]
}
} }
|
public class class_name {
public TypeVariable[] typeParameters() {
if (env.legacyDoclet) {
return new TypeVariable[0];
}
TypeVariable res[] = new TypeVariable[sym.type.getTypeArguments().length()];
TypeMaker.getTypes(env, sym.type.getTypeArguments(), res);
return res;
} }
|
public class class_name {
public TypeVariable[] typeParameters() {
if (env.legacyDoclet) {
return new TypeVariable[0]; // depends on control dependency: [if], data = [none]
}
TypeVariable res[] = new TypeVariable[sym.type.getTypeArguments().length()];
TypeMaker.getTypes(env, sym.type.getTypeArguments(), res);
return res;
} }
|
public class class_name {
private void accum_all2(Chunk chks[], Chunk wrks, int nh[], int[] rows) {
final DHistogram hcs[][] = _hcs;
// Local temp arrays, no atomic updates.
int bins[] = new int [nbins];
double sums[] = new double[nbins];
double ssqs[] = new double[nbins];
// For All Columns
for( int c=0; c<_ncols; c++) { // for all columns
Chunk chk = chks[c];
// For All NIDs
for( int n=0; n<hcs.length; n++ ) {
final DRealHistogram rh = ((DRealHistogram)hcs[n][c]);
if( rh==null ) continue; // Ignore untracked columns in this split
final int lo = n==0 ? 0 : nh[n-1];
final int hi = nh[n];
float min = rh._min2;
float max = rh._maxIn;
// While most of the time we are limited to nbins, we allow more bins
// in a few cases (top-level splits have few total bins across all
// the (few) splits) so it's safe to bin more; also categoricals want
// to split one bin-per-level no matter how many levels).
if( rh._bins.length >= bins.length ) { // Grow bins if needed
bins = new int [rh._bins.length];
sums = new double[rh._bins.length];
ssqs = new double[rh._bins.length];
}
// Gather all the data for this set of rows, for 1 column and 1 split/NID
// Gather min/max, sums and sum-squares.
for( int xrow=lo; xrow<hi; xrow++ ) {
int row = rows[xrow];
float col_data = (float)chk.at0(row);
if( col_data < min ) min = col_data;
if( col_data > max ) max = col_data;
int b = rh.bin(col_data); // Compute bin# via linear interpolation
bins[b]++; // Bump count in bin
double resp = wrks.at0(row);
sums[b] += resp;
ssqs[b] += resp*resp;
}
// Add all the data into the Histogram (atomically add)
rh.setMin(min); // Track actual lower/upper bound per-bin
rh.setMax(max);
for( int b=0; b<rh._bins.length; b++ ) { // Bump counts in bins
if( bins[b] != 0 ) { Utils.AtomicIntArray.add(rh._bins,b,bins[b]); bins[b]=0; }
if( ssqs[b] != 0 ) { rh.incr1(b,sums[b],ssqs[b]); sums[b]=ssqs[b]=0; }
}
}
}
} }
|
public class class_name {
private void accum_all2(Chunk chks[], Chunk wrks, int nh[], int[] rows) {
final DHistogram hcs[][] = _hcs;
// Local temp arrays, no atomic updates.
int bins[] = new int [nbins];
double sums[] = new double[nbins];
double ssqs[] = new double[nbins];
// For All Columns
for( int c=0; c<_ncols; c++) { // for all columns
Chunk chk = chks[c];
// For All NIDs
for( int n=0; n<hcs.length; n++ ) {
final DRealHistogram rh = ((DRealHistogram)hcs[n][c]);
if( rh==null ) continue; // Ignore untracked columns in this split
final int lo = n==0 ? 0 : nh[n-1];
final int hi = nh[n];
float min = rh._min2;
float max = rh._maxIn;
// While most of the time we are limited to nbins, we allow more bins
// in a few cases (top-level splits have few total bins across all
// the (few) splits) so it's safe to bin more; also categoricals want
// to split one bin-per-level no matter how many levels).
if( rh._bins.length >= bins.length ) { // Grow bins if needed
bins = new int [rh._bins.length]; // depends on control dependency: [if], data = [none]
sums = new double[rh._bins.length]; // depends on control dependency: [if], data = [none]
ssqs = new double[rh._bins.length]; // depends on control dependency: [if], data = [none]
}
// Gather all the data for this set of rows, for 1 column and 1 split/NID
// Gather min/max, sums and sum-squares.
for( int xrow=lo; xrow<hi; xrow++ ) {
int row = rows[xrow];
float col_data = (float)chk.at0(row);
if( col_data < min ) min = col_data;
if( col_data > max ) max = col_data;
int b = rh.bin(col_data); // Compute bin# via linear interpolation
bins[b]++; // Bump count in bin // depends on control dependency: [for], data = [none]
double resp = wrks.at0(row);
sums[b] += resp; // depends on control dependency: [for], data = [none]
ssqs[b] += resp*resp; // depends on control dependency: [for], data = [none]
}
// Add all the data into the Histogram (atomically add)
rh.setMin(min); // Track actual lower/upper bound per-bin // depends on control dependency: [for], data = [none]
rh.setMax(max); // depends on control dependency: [for], data = [none]
for( int b=0; b<rh._bins.length; b++ ) { // Bump counts in bins
if( bins[b] != 0 ) { Utils.AtomicIntArray.add(rh._bins,b,bins[b]); bins[b]=0; } // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
if( ssqs[b] != 0 ) { rh.incr1(b,sums[b],ssqs[b]); sums[b]=ssqs[b]=0; } // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
}
}
}
} }
|
public class class_name {
public static void invokeSetter(Object object, String setterName, Object[] args)
throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
int index = setterName.indexOf('.');
if (index > 0) {
String getterName = setterName.substring(0, index);
Object o = invokeGetter(object, getterName);
invokeSetter(o, setterName.substring(index + 1), args);
} else {
if (!setterName.startsWith("set")) {
setterName = "set" + setterName.substring(0, 1).toUpperCase(Locale.US) + setterName.substring(1);
}
invokeMethod(object, setterName, args);
}
} }
|
public class class_name {
public static void invokeSetter(Object object, String setterName, Object[] args)
throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
int index = setterName.indexOf('.');
if (index > 0) {
String getterName = setterName.substring(0, index);
Object o = invokeGetter(object, getterName);
invokeSetter(o, setterName.substring(index + 1), args);
} else {
if (!setterName.startsWith("set")) {
setterName = "set" + setterName.substring(0, 1).toUpperCase(Locale.US) + setterName.substring(1); // depends on control dependency: [if], data = [none]
}
invokeMethod(object, setterName, args);
}
} }
|
public class class_name {
public boolean isNotify() {
if (message == null) {
return false;
}
return (((Request) message).getMethod().equals(Request.NOTIFY));
} }
|
public class class_name {
public boolean isNotify() {
if (message == null) {
return false; // depends on control dependency: [if], data = [none]
}
return (((Request) message).getMethod().equals(Request.NOTIFY));
} }
|
public class class_name {
private static void getChromaXX(byte[] pels, int picW, int picH, byte[] blk, int blkOff, int blkStride, int fullX,
int fullY, int fracX, int fracY, int blkW, int blkH) {
int w00 = fullY * picW + fullX;
int w01 = w00 + (fullY < picH - 1 ? picW : 0);
int w10 = w00 + (fullX < picW - 1 ? 1 : 0);
int w11 = w10 + w01 - w00;
int eMx = 8 - fracX;
int eMy = 8 - fracY;
for (int j = 0; j < blkH; j++) {
for (int i = 0; i < blkW; i++) {
blk[blkOff + i] = (byte) ((eMx * eMy * pels[w00 + i] + fracX * eMy * pels[w10 + i] + eMx * fracY
* pels[w01 + i] + fracX * fracY * pels[w11 + i] + 32) >> 6);
}
blkOff += blkStride;
w00 += picW;
w01 += picW;
w10 += picW;
w11 += picW;
}
} }
|
public class class_name {
private static void getChromaXX(byte[] pels, int picW, int picH, byte[] blk, int blkOff, int blkStride, int fullX,
int fullY, int fracX, int fracY, int blkW, int blkH) {
int w00 = fullY * picW + fullX;
int w01 = w00 + (fullY < picH - 1 ? picW : 0);
int w10 = w00 + (fullX < picW - 1 ? 1 : 0);
int w11 = w10 + w01 - w00;
int eMx = 8 - fracX;
int eMy = 8 - fracY;
for (int j = 0; j < blkH; j++) {
for (int i = 0; i < blkW; i++) {
blk[blkOff + i] = (byte) ((eMx * eMy * pels[w00 + i] + fracX * eMy * pels[w10 + i] + eMx * fracY
* pels[w01 + i] + fracX * fracY * pels[w11 + i] + 32) >> 6); // depends on control dependency: [for], data = [i]
}
blkOff += blkStride; // depends on control dependency: [for], data = [none]
w00 += picW; // depends on control dependency: [for], data = [none]
w01 += picW; // depends on control dependency: [for], data = [none]
w10 += picW; // depends on control dependency: [for], data = [none]
w11 += picW; // depends on control dependency: [for], data = [none]
}
} }
|
public class class_name {
@Override
public EClass getProjectSmall() {
if (projectSmallEClass == null) {
projectSmallEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(StorePackage.eNS_URI).getEClassifiers().get(90);
}
return projectSmallEClass;
} }
|
public class class_name {
@Override
public EClass getProjectSmall() {
if (projectSmallEClass == null) {
projectSmallEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(StorePackage.eNS_URI).getEClassifiers().get(90);
// depends on control dependency: [if], data = [none]
}
return projectSmallEClass;
} }
|
public class class_name {
public EnumT valueOf(String constant) {
if (constant == null || constant.isEmpty()) {
throw new IllegalArgumentException("Empty enum constants not allowed.");
}
EnumT value = knownValues.get(constant);
if (value != null) {
return value;
} else {
return constructor.apply(constant);
}
} }
|
public class class_name {
public EnumT valueOf(String constant) {
if (constant == null || constant.isEmpty()) {
throw new IllegalArgumentException("Empty enum constants not allowed.");
}
EnumT value = knownValues.get(constant);
if (value != null) {
return value; // depends on control dependency: [if], data = [none]
} else {
return constructor.apply(constant); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
protected void clearDependentsWriteCount() {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "clearDependentsWriteCount entry: for this node: " + this);
}
dependentWriteCount = 0;
if ((dependents == null) || (dependents.size() == 0)) {
return;
}
for (int i = 0; i < dependents.size(); i++) {
dependents.get(i).setWriteCount(0);
}
} }
|
public class class_name {
protected void clearDependentsWriteCount() {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "clearDependentsWriteCount entry: for this node: " + this); // depends on control dependency: [if], data = [none]
}
dependentWriteCount = 0;
if ((dependents == null) || (dependents.size() == 0)) {
return; // depends on control dependency: [if], data = [none]
}
for (int i = 0; i < dependents.size(); i++) {
dependents.get(i).setWriteCount(0); // depends on control dependency: [for], data = [i]
}
} }
|
public class class_name {
private int calculateSize(char[] source,
int sourceStart,
int sourceLength) {
int destSize = sourceLength;
switch (options & LETTERS_MASK) {
case LETTERS_SHAPE:
case LETTERS_SHAPE_TASHKEEL_ISOLATED:
if (isLogical) {
for (int i = sourceStart, e = sourceStart + sourceLength - 1; i < e; ++i) {
if ((source[i] == LAM_CHAR && isAlefChar(source[i+1])) || isTashkeelCharFE(source[i])){
--destSize;
}
}
} else { // visual
for(int i = sourceStart + 1, e = sourceStart + sourceLength; i < e; ++i) {
if ((source[i] == LAM_CHAR && isAlefChar(source[i-1])) || isTashkeelCharFE(source[i])) {
--destSize;
}
}
}
break;
case LETTERS_UNSHAPE:
for(int i = sourceStart, e = sourceStart + sourceLength; i < e; ++i) {
if (isLamAlefChar(source[i])) {
destSize++;
}
}
break;
default:
break;
}
return destSize;
} }
|
public class class_name {
private int calculateSize(char[] source,
int sourceStart,
int sourceLength) {
int destSize = sourceLength;
switch (options & LETTERS_MASK) {
case LETTERS_SHAPE:
case LETTERS_SHAPE_TASHKEEL_ISOLATED:
if (isLogical) {
for (int i = sourceStart, e = sourceStart + sourceLength - 1; i < e; ++i) {
if ((source[i] == LAM_CHAR && isAlefChar(source[i+1])) || isTashkeelCharFE(source[i])){
--destSize; // depends on control dependency: [if], data = [none]
}
}
} else { // visual
for(int i = sourceStart + 1, e = sourceStart + sourceLength; i < e; ++i) {
if ((source[i] == LAM_CHAR && isAlefChar(source[i-1])) || isTashkeelCharFE(source[i])) {
--destSize; // depends on control dependency: [if], data = [none]
}
}
}
break;
case LETTERS_UNSHAPE:
for(int i = sourceStart, e = sourceStart + sourceLength; i < e; ++i) {
if (isLamAlefChar(source[i])) {
destSize++; // depends on control dependency: [if], data = [none]
}
}
break;
default:
break;
}
return destSize;
} }
|
public class class_name {
public static <P extends Parameterizable> Set<P> getParameterizables(Package javaPackage, Class<P> clazz) throws IOException, FileNotFoundException, ClassNotFoundException, InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException {
Set<P> parameterizables = new HashSet<>(50);
for (Class<?> c : ClassHelper.fromPackage(javaPackage)) {
if (clazz.isAssignableFrom(c) && !Modifier.isAbstract(c.getModifiers())) {
P p = (P) c.newInstance();
ParamAnnotationProcessor.PAP.initParameters(p);
parameterizables.add(p);
}
}
return parameterizables;
} }
|
public class class_name {
public static <P extends Parameterizable> Set<P> getParameterizables(Package javaPackage, Class<P> clazz) throws IOException, FileNotFoundException, ClassNotFoundException, InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException {
Set<P> parameterizables = new HashSet<>(50);
for (Class<?> c : ClassHelper.fromPackage(javaPackage)) {
if (clazz.isAssignableFrom(c) && !Modifier.isAbstract(c.getModifiers())) {
P p = (P) c.newInstance();
ParamAnnotationProcessor.PAP.initParameters(p); // depends on control dependency: [if], data = [none]
parameterizables.add(p); // depends on control dependency: [if], data = [none]
}
}
return parameterizables;
} }
|
public class class_name {
public void setAwsAccountId(java.util.Collection<StringFilter> awsAccountId) {
if (awsAccountId == null) {
this.awsAccountId = null;
return;
}
this.awsAccountId = new java.util.ArrayList<StringFilter>(awsAccountId);
} }
|
public class class_name {
public void setAwsAccountId(java.util.Collection<StringFilter> awsAccountId) {
if (awsAccountId == null) {
this.awsAccountId = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.awsAccountId = new java.util.ArrayList<StringFilter>(awsAccountId);
} }
|
public class class_name {
protected boolean validateRequired(final FacesContext context, final Object newValue) {
// If our value is valid, enforce the required property if present
if (isValid() && isRequired() && isEmpty(newValue)) {
final String requiredMessageStr = getRequiredMessage();
FacesMessage message;
if (null != requiredMessageStr) {
message = new FacesMessage(FacesMessage.SEVERITY_ERROR,
requiredMessageStr,
requiredMessageStr);
}
else {
message = new FacesMessage(FacesMessage.SEVERITY_ERROR,
MESSAGE_REQUIRED,
MESSAGE_REQUIRED);
}
context.addMessage(getClientId(context), message);
final Sheet sheet = getSheet();
if (sheet != null) {
sheet.getInvalidUpdates().add(
new SheetInvalidUpdate(sheet.getRowKeyValue(context), sheet.getColumns().indexOf(this), this, newValue,
message.getDetail()));
}
setValid(false);
return false;
}
return true;
} }
|
public class class_name {
protected boolean validateRequired(final FacesContext context, final Object newValue) {
// If our value is valid, enforce the required property if present
if (isValid() && isRequired() && isEmpty(newValue)) {
final String requiredMessageStr = getRequiredMessage();
FacesMessage message;
if (null != requiredMessageStr) {
message = new FacesMessage(FacesMessage.SEVERITY_ERROR,
requiredMessageStr,
requiredMessageStr); // depends on control dependency: [if], data = [none]
}
else {
message = new FacesMessage(FacesMessage.SEVERITY_ERROR,
MESSAGE_REQUIRED,
MESSAGE_REQUIRED); // depends on control dependency: [if], data = [none]
}
context.addMessage(getClientId(context), message); // depends on control dependency: [if], data = [none]
final Sheet sheet = getSheet();
if (sheet != null) {
sheet.getInvalidUpdates().add(
new SheetInvalidUpdate(sheet.getRowKeyValue(context), sheet.getColumns().indexOf(this), this, newValue,
message.getDetail())); // depends on control dependency: [if], data = [none]
}
setValid(false); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
return true;
} }
|
public class class_name {
public EClass getIfcCurvatureMeasure() {
if (ifcCurvatureMeasureEClass == null) {
ifcCurvatureMeasureEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(662);
}
return ifcCurvatureMeasureEClass;
} }
|
public class class_name {
public EClass getIfcCurvatureMeasure() {
if (ifcCurvatureMeasureEClass == null) {
ifcCurvatureMeasureEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(662);
// depends on control dependency: [if], data = [none]
}
return ifcCurvatureMeasureEClass;
} }
|
public class class_name {
public java.util.List<Cluster> getClusters() {
if (clusters == null) {
clusters = new com.amazonaws.internal.SdkInternalList<Cluster>();
}
return clusters;
} }
|
public class class_name {
public java.util.List<Cluster> getClusters() {
if (clusters == null) {
clusters = new com.amazonaws.internal.SdkInternalList<Cluster>(); // depends on control dependency: [if], data = [none]
}
return clusters;
} }
|
public class class_name {
protected void parseArguments(final Options options, String[] cmdArray) {
CommandLineParser parser = new PosixParser();
try {
CommandLine cmd = parser.parse(options, cmdArray);
Option[] opts = cmd.getOptions();
for (Option o : opts) {
arguments.put(o.getLongOpt(), o.getValue() == null ? "" : o.getValue());
}
} catch (ParseException e) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(MSG_WRONG_ARGUMENT);
}
e.printStackTrace();
}
} }
|
public class class_name {
protected void parseArguments(final Options options, String[] cmdArray) {
CommandLineParser parser = new PosixParser();
try {
CommandLine cmd = parser.parse(options, cmdArray);
Option[] opts = cmd.getOptions();
for (Option o : opts) {
arguments.put(o.getLongOpt(), o.getValue() == null ? "" : o.getValue()); // depends on control dependency: [for], data = [o]
}
} catch (ParseException e) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(MSG_WRONG_ARGUMENT); // depends on control dependency: [if], data = [none]
}
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public UpdateDomainNameRequest withPatchOperations(PatchOperation... patchOperations) {
if (this.patchOperations == null) {
setPatchOperations(new java.util.ArrayList<PatchOperation>(patchOperations.length));
}
for (PatchOperation ele : patchOperations) {
this.patchOperations.add(ele);
}
return this;
} }
|
public class class_name {
public UpdateDomainNameRequest withPatchOperations(PatchOperation... patchOperations) {
if (this.patchOperations == null) {
setPatchOperations(new java.util.ArrayList<PatchOperation>(patchOperations.length)); // depends on control dependency: [if], data = [none]
}
for (PatchOperation ele : patchOperations) {
this.patchOperations.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} }
|
public class class_name {
private void visitList(final ObjectGraphNode node) {
int index = 0;
for (Iterator i = ((List) node.getValue()).iterator(); i.hasNext();) {
Object entry = i.next();
String entryType = entry == null ? Object.class.getName() : entry.getClass().getName();
ObjectGraphNode childNode = new ObjectGraphNode(++nodeCount, "[" + index++ + "]",
entryType, entry);
node.add(childNode);
visit(childNode);
}
adjustOverhead(node);
} }
|
public class class_name {
private void visitList(final ObjectGraphNode node) {
int index = 0;
for (Iterator i = ((List) node.getValue()).iterator(); i.hasNext();) {
Object entry = i.next();
String entryType = entry == null ? Object.class.getName() : entry.getClass().getName();
ObjectGraphNode childNode = new ObjectGraphNode(++nodeCount, "[" + index++ + "]",
entryType, entry);
node.add(childNode); // depends on control dependency: [for], data = [none]
visit(childNode); // depends on control dependency: [for], data = [none]
}
adjustOverhead(node);
} }
|
public class class_name {
public static boolean seek(KafkaConsumer<?, ?> consumer, KafkaTopicPartitionOffset tpo) {
synchronized (consumer) {
Set<TopicPartition> topicParts = consumer.assignment();
if (topicParts != null) {
for (TopicPartition tp : topicParts) {
if (StringUtils.equals(tpo.topic, tp.topic())
&& tpo.partition == tp.partition()) {
consumer.seek(tp, tpo.offset);
// we want to seek as soon as possible
// since seekToEnd evaluates lazily, invoke position()
// so
// that seeking will be committed.
consumer.position(tp);
return true;
}
}
}
}
return false;
} }
|
public class class_name {
public static boolean seek(KafkaConsumer<?, ?> consumer, KafkaTopicPartitionOffset tpo) {
synchronized (consumer) {
Set<TopicPartition> topicParts = consumer.assignment();
if (topicParts != null) {
for (TopicPartition tp : topicParts) {
if (StringUtils.equals(tpo.topic, tp.topic())
&& tpo.partition == tp.partition()) {
consumer.seek(tp, tpo.offset); // depends on control dependency: [if], data = [none]
// we want to seek as soon as possible
// since seekToEnd evaluates lazily, invoke position()
// so
// that seeking will be committed.
consumer.position(tp); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
}
}
}
return false;
} }
|
public class class_name {
public void evaluationComplete(IVdmEvaluationResult result)
{
// if plug-in has shutdown, ignore - see bug# 8693
if (VdmDebugPlugin.getDefault() == null)
{
return;
}
final IVdmValue value = result.getValue();
if (result.hasErrors() || value != null)
{
final Display display = VdmDebugPlugin.getStandardDisplay();
if (display.isDisposed())
{
return;
}
// Each action should implement this method for own purposes
displayResult(result);
}
} }
|
public class class_name {
public void evaluationComplete(IVdmEvaluationResult result)
{
// if plug-in has shutdown, ignore - see bug# 8693
if (VdmDebugPlugin.getDefault() == null)
{
return; // depends on control dependency: [if], data = [none]
}
final IVdmValue value = result.getValue();
if (result.hasErrors() || value != null)
{
final Display display = VdmDebugPlugin.getStandardDisplay();
if (display.isDisposed())
{
return; // depends on control dependency: [if], data = [none]
}
// Each action should implement this method for own purposes
displayResult(result); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
protected Rectangle convertToDiagramBounds(Rectangle2D modelBounds) {
double xCenter = modelBounds.getCenterX();
double yCenter = modelBounds.getCenterY();
double modelWidth = modelBounds.getWidth();
double modelHeight = modelBounds.getHeight();
double scale = rendererModel.getParameter(Scale.class).getValue();
double zoom = rendererModel.getParameter(ZoomFactor.class).getValue();
Point2d screenCoord = this.toScreenCoordinates(xCenter, yCenter);
// special case for 0 or 1 atoms
if (modelWidth == 0 && modelHeight == 0) {
return new Rectangle((int) screenCoord.x, (int) screenCoord.y, 0, 0);
}
double margin = rendererModel.getParameter(Margin.class).getValue();
int width = (int) ((scale * zoom * modelWidth) + (2 * margin));
int height = (int) ((scale * zoom * modelHeight) + (2 * margin));
int xCoord = (int) (screenCoord.x - width / 2);
int yCoord = (int) (screenCoord.y - height / 2);
return new Rectangle(xCoord, yCoord, width, height);
} }
|
public class class_name {
protected Rectangle convertToDiagramBounds(Rectangle2D modelBounds) {
double xCenter = modelBounds.getCenterX();
double yCenter = modelBounds.getCenterY();
double modelWidth = modelBounds.getWidth();
double modelHeight = modelBounds.getHeight();
double scale = rendererModel.getParameter(Scale.class).getValue();
double zoom = rendererModel.getParameter(ZoomFactor.class).getValue();
Point2d screenCoord = this.toScreenCoordinates(xCenter, yCenter);
// special case for 0 or 1 atoms
if (modelWidth == 0 && modelHeight == 0) {
return new Rectangle((int) screenCoord.x, (int) screenCoord.y, 0, 0); // depends on control dependency: [if], data = [none]
}
double margin = rendererModel.getParameter(Margin.class).getValue();
int width = (int) ((scale * zoom * modelWidth) + (2 * margin));
int height = (int) ((scale * zoom * modelHeight) + (2 * margin));
int xCoord = (int) (screenCoord.x - width / 2);
int yCoord = (int) (screenCoord.y - height / 2);
return new Rectangle(xCoord, yCoord, width, height);
} }
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.